From 50d83817092cf50362172a596634e54757ecccbb Mon Sep 17 00:00:00 2001 From: jiayulong Date: Mon, 20 Apr 2026 17:30:44 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BF=BD=E5=8A=A0=E8=9D=8C=E8=9A=AA=E5=9B=BE?= =?UTF-8?q?=E5=B1=9E=E6=80=A7=EF=BC=8C=E5=AE=8C=E6=88=90=E5=9F=BA=E7=A1=80?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=90=AD=E5=BB=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- logPlus/PropertyWidget.cpp | 282 ++++++++++++++++++++- logPlus/PropertyWidget.h | 6 + logPlus/formdraw.cpp | 495 +++---------------------------------- logPlus/formdraw.h | 27 +- logPlus/forminfo.cpp | 5 - logPlus/forminfo.h | 6 + logPlus/qmycustomplot.cpp | 372 +++++++++++++++++++++++++++- logPlus/qmycustomplot.h | 73 +++--- 8 files changed, 746 insertions(+), 520 deletions(-) diff --git a/logPlus/PropertyWidget.cpp b/logPlus/PropertyWidget.cpp index b1934e5..5fe6a75 100644 --- a/logPlus/PropertyWidget.cpp +++ b/logPlus/PropertyWidget.cpp @@ -2355,7 +2355,13 @@ void PropertyWidget::SlotPropertyChanged( QtProperty *pProperty, const QVariant this->CommonPropertyChanged(pProperty, variant); this->changedCrackProperty(m_propertyData[pProperty], variant); } - + else if (m_strCurrentProperty == Kedou_Property)//蝌蚪图 + { + //先处理通用属性 + CommonPropertyChanged(pProperty, variant); + // + changedKedouProperty(m_propertyData[pProperty], variant); + } } @@ -3150,6 +3156,11 @@ void PropertyWidget::initProperty(FormInfo *formInfo) // 岩心分析 this->initCorePhysicsProperty(formInfo); } + else if (m_strLineName == "FRAC_HOLE.TABLE") + { + //蝌蚪图 + this->initKedouProperty(formInfo); + } else { this->initTableProperty(formInfo); @@ -5148,3 +5159,272 @@ void PropertyWidget::changedRoseProperty(QString strProperty, QVariant varVal) emit CallManage::getInstance()->sig_changeRoseProperty(variantMap); } } + +void PropertyWidget::initKedouProperty(FormInfo *formInfo) +{ + + _CreateVariantPropertyItem("曲线图名", "显示名称", formInfo->m_strAliasName, QVariant::String); + _CreateVariantPropertyItem("字体", "名称", formInfo->m_curveNameFont, QVariant::Font); + _CreateVariantPropertyItem("字体", "单位", formInfo->m_strUnitFont, QVariant::Font); + _CreateVariantPropertyItem("字体", "刻度", formInfo->m_pl_fontScale, QVariant::Font); + + _CreateVariantPropertyItem("井文件名", "井文件名称", m_strSlfName, QVariant::String); + + QStringList listType; + listType.append("曲线型数据"); + listType.append("表格型数据"); + _CreateEnumPropertyItem("数据类型选择", "数据类型", formInfo->m_pl_dataType, listType); + // + _CreateVariantPropertyItem("曲线选择", "方位曲线", formInfo->m_pl_azimuthCurve, QVariant::String); + _CreateVariantPropertyItem("曲线选择", "倾角曲线", formInfo->m_pl_inclinationCurve, QVariant::String); + _CreateVariantPropertyItem("曲线选择", "可信度曲线", formInfo->m_pl_GradCurve, QVariant::String); + // + _CreateVariantPropertyItem("字段选择(数据表)", "深度字段", formInfo->m_rose_depth_field, QVariant::String); + _CreateVariantPropertyItem("字段选择(数据表)", "方位字段", formInfo->m_rose_azimuth_field, QVariant::String); + _CreateVariantPropertyItem("字段选择(数据表)", "倾角字段", formInfo->m_rose_dip_field, QVariant::String); + _CreateVariantPropertyItem("字段选择(数据表)", "属性字段", formInfo->m_rose_attribute_field, QVariant::String); + // + _CreateVariantPropertyItem("蝌蚪符号", "圆半径", formInfo->m_nRadius, QVariant::Double); + _CreateVariantPropertyItem("蝌蚪符号", "圆线宽度", formInfo->m_nCircleWidth, QVariant::Double); + _CreateVariantPropertyItem("蝌蚪符号", "尾线长度", formInfo->m_nTailLen, QVariant::Double); + _CreateVariantPropertyItem("蝌蚪符号", "尾线宽度", formInfo->m_nTailWidth, QVariant::Double); + _CreateVariantPropertyItem("蝌蚪符号", "圆线颜色", formInfo->m_crCircle, QVariant::Color); + _CreateVariantPropertyItem("蝌蚪符号", "尾线颜色", formInfo->m_crTail, QVariant::Color); + // + _CreateVariantPropertyItem("显示控制", "最小倾角", formInfo->m_pl_minInclination, QVariant::Double); + _CreateVariantPropertyItem("显示控制", "最大倾角", formInfo->m_pl_maxInclination, QVariant::Double); + _CreateVariantPropertyItem("显示控制", "可信度1", formInfo->m_flGrad1, QVariant::Double); + _CreateVariantPropertyItem("显示控制", "可信度2", formInfo->m_flGrad2, QVariant::Double); + // + _CreateVariantPropertyItem("显示控制(数据表)", "小数位数", formInfo->m_crack_decimal_digits, QVariant::Int); + // 分类 + this->loadClassifyProperty(formInfo); + + m_strCurrentProperty = Kedou_Property; +} + +void PropertyWidget::changedKedouProperty(QString strProperty, QVariant varVal) +{ + bool flag = false; + // 字体 + if ("名称" == strProperty) + { + QFont newFont = varVal.value(); +// this->m_formInfo->m_strAliasNameFont = newFont; +// this->m_formInfo->repaint(); + m_formInfo->m_curveNameFont = newFont; + m_formInfo->update(); + } + else if ("单位" == strProperty) + { + QFont temp = varVal.value(); + this->m_formInfo->m_strUnitFont = temp; + this->m_formInfo->repaint(); + } + else if ("刻度" == strProperty) + { + this->m_formInfo->m_pl_fontScale = varVal.value(); + flag = true; + } + // 数据 + else if ("数据类型" == strProperty) + { + this->m_formInfo->m_pl_dataType = varVal.toInt(); + flag = true; + } + else if ("方位曲线" == strProperty) + { + this->m_formInfo->m_pl_azimuthCurve = varVal.toString(); + flag = true; + } + else if ("倾角曲线" == strProperty) + { + this->m_formInfo->m_pl_inclinationCurve = varVal.toString(); + flag = true; + } + else if ("可信度曲线" == strProperty) + { + this->m_formInfo->m_pl_GradCurve = varVal.toString(); + flag = true; + } + // 蝌蚪符号 + else if ("圆半径" == strProperty) + { + this->m_formInfo->m_nRadius = varVal.toDouble(); + flag = true; + } + else if ("圆线宽度" == strProperty) + { + this->m_formInfo->m_nCircleWidth = varVal.toDouble(); + flag = true; + } + else if ("尾线长度" == strProperty) + { + this->m_formInfo->m_nTailLen = varVal.toDouble(); + flag = true; + } + else if ("尾线宽度" == strProperty) + { + this->m_formInfo->m_nTailWidth = varVal.toDouble(); + flag = true; + } + else if ("圆线颜色" == strProperty) + { + this->m_formInfo->m_crCircle = varVal.value(); + flag = true; + } + else if ("尾线颜色" == strProperty) + { + this->m_formInfo->m_crTail = varVal.value(); + flag = true; + } + // + else if ("最小倾角" == strProperty) + { + this->m_formInfo->m_pl_minInclination = varVal.toDouble(); + flag = true; + } + else if ("最大倾角" == strProperty) + { + this->m_formInfo->m_pl_maxInclination = varVal.toDouble(); + flag = true; + } + else if ("可信度1" == strProperty) + { + this->m_formInfo->m_flGrad1 = varVal.toDouble(); + flag = true; + } + else if ("可信度2" == strProperty) + { + this->m_formInfo->m_flGrad2 = varVal.toDouble(); + flag = true; + } + //显示控制(数据表) + else if ("小数位数" == strProperty) + { + this->m_formInfo->m_crack_decimal_digits = varVal.toInt(); + } + // 表数据 + else if ("深度字段" == strProperty) + { + this->m_formInfo->m_rose_depth_field = varVal.toString(); + flag = true; + } + else if ("方位字段" == strProperty) + { + this->m_formInfo->m_rose_azimuth_field = varVal.toString(); + flag = true; + } + else if ("倾角字段" == strProperty) + { + this->m_formInfo->m_rose_dip_field = varVal.toString(); + flag = true; + } + else if ("属性字段" == strProperty) + { + this->m_formInfo->m_rose_attribute_field = varVal.toString(); + flag = true; + } + // 分类 + else if ("高导缝" == strProperty) + { + this->m_formInfo->m_pl_highGap = varVal.toBool(); + } + else if ("高阻缝" == strProperty) + { + this->m_formInfo->m_pl_highReservoir = varVal.toBool(); + } + else if ("网状缝" == strProperty) + { + this->m_formInfo->m_pl_reticularFracture = varVal.toBool(); + } + else if ("诱导缝" == strProperty) + { + this->m_formInfo->m_pl_inducedFracture = varVal.toBool(); + } + else if ("层理" == strProperty) + { + this->m_formInfo->m_pl_bedLayer = varVal.toBool(); + } + else if ("侵蚀面" == strProperty) + { + this->m_formInfo->m_pl_erosionSurface = varVal.toBool(); + } + else if ("孔洞" == strProperty) + { + this->m_formInfo->m_pl_pore = varVal.toBool(); + } + else if ("气孔" == strProperty) + { + this->m_formInfo->m_pl_vesicle = varVal.toBool(); + } + else if ("砾石" == strProperty) + { + this->m_formInfo->m_pl_gravel = varVal.toBool(); + } + else if ("结核" == strProperty) + { + this->m_formInfo->m_pl_nodule = varVal.toBool(); + } + else if ("团块" == strProperty) + { + this->m_formInfo->m_pl_lumps = varVal.toBool(); + } + else if ("断层" == strProperty) + { + this->m_formInfo->m_pl_fault = varVal.toBool(); + } + else if ("垂直缝" == strProperty) + { + this->m_formInfo->m_pl_verticalFracture = varVal.toBool(); + } + else if ("自定义1" == strProperty) + { + this->m_formInfo->m_pl_custom1 = varVal.toBool(); + } + else if ("自定义2" == strProperty) + { + this->m_formInfo->m_pl_custom2 = varVal.toBool(); + } + + if(flag) + { + QVariantMap variantMap; + // 必须用来判断当前道 + variantMap["m_strTrackName"] = this->m_formInfo->m_strTrackName; + // 数据 + variantMap["m_pl_dataType"] = this->m_formInfo->m_pl_dataType; + variantMap["m_pl_azimuthCurve"] = this->m_formInfo->m_pl_azimuthCurve; + variantMap["m_pl_inclinationCurve"] = this->m_formInfo->m_pl_inclinationCurve; + // 表数据 + variantMap["m_rose_depth_field"] = this->m_formInfo->m_rose_depth_field; + variantMap["m_rose_azimuth_field"] = this->m_formInfo->m_rose_azimuth_field; + variantMap["m_rose_dip_field"] = this->m_formInfo->m_rose_dip_field; + variantMap["m_rose_attribute_field"] = this->m_formInfo->m_rose_attribute_field; + // 控制曲线 + variantMap["m_pl_controlCurveName"] = this->m_formInfo->m_pl_controlCurveName; + variantMap["m_pl_controlMinValue"] = this->m_formInfo->m_pl_controlMinValue; + variantMap["m_pl_controlMaxValue"] = this->m_formInfo->m_pl_controlMaxValue; + // 字体 + variantMap["m_pl_fontScale"] = this->m_formInfo->m_pl_fontScale; + // 蝌蚪图 + variantMap["m_rose_sector_enabled"] = this->m_formInfo->m_rose_sector_enabled; + variantMap["m_rose_circle_radius_cm"] = this->m_formInfo->m_rose_circle_radius_cm; + variantMap["m_rose_radiation_circle_enabled"] = this->m_formInfo->m_rose_radiation_circle_enabled; + variantMap["m_rose_azimuth_print_interval"] = this->m_formInfo->m_rose_azimuth_print_interval; + variantMap["m_rose_circle_line_color"] = this->m_formInfo->m_rose_circle_line_color; + variantMap["m_rose_circle_line_width"] = this->m_formInfo->m_rose_circle_line_width; + variantMap["m_rose_stress_line_color"] = this->m_formInfo->m_rose_stress_line_color; + variantMap["m_rose_collapse_line_color"] = this->m_formInfo->m_rose_collapse_line_color; + variantMap["m_rose_draw_radiation_line"] = this->m_formInfo->m_rose_draw_radiation_line; + variantMap["m_rose_draw_wellbore_collapse"] = this->m_formInfo->m_rose_draw_wellbore_collapse; + variantMap["m_rose_fill_enabled"] = this->m_formInfo->m_rose_fill_enabled; + variantMap["m_rose_draw_annotation"] = this->m_formInfo->m_rose_draw_annotation; + // + variantMap["m_pl_minInclination"] = this->m_formInfo->m_pl_minInclination; + variantMap["m_pl_maxInclination"] = this->m_formInfo->m_pl_maxInclination; + + variantMap["m_strUuid"] = this->m_formInfo->m_strUuid; + //emit CallManage::getInstance()->sig_changeRoseProperty(variantMap); + } +} diff --git a/logPlus/PropertyWidget.h b/logPlus/PropertyWidget.h index 66e4253..e81e14e 100644 --- a/logPlus/PropertyWidget.h +++ b/logPlus/PropertyWidget.h @@ -77,6 +77,8 @@ #define Tubing_Property "Tubing_Property" //套管组件 #define TubingItem_Property "TubingItem_Property" //套管组件item +#define Kedou_Property "Kedou_Property" //蝌蚪图 + #pragma execution_character_set("utf-8") /** @@ -256,6 +258,10 @@ public: void initRoseProperty(FormInfo *formInfo); void changedRoseProperty(QString strProName, QVariant val); + //蝌蚪图 + void initKedouProperty(FormInfo *formInfo); + void changedKedouProperty(QString strProName, QVariant val); + public slots: void SlotPropertyChanged(QtProperty *property, const QVariant &variant); void SlotPropertyChanged(QtProperty *property, const int &val, bool islinestyle); diff --git a/logPlus/formdraw.cpp b/logPlus/formdraw.cpp index 4aa4036..7e66298 100644 --- a/logPlus/formdraw.cpp +++ b/logPlus/formdraw.cpp @@ -2871,8 +2871,11 @@ QMyCustomPlot* FormDraw::addTableLine(QString strUuid, QString strSlfName, QStri //隐藏网格 curv->xAxis->grid()->setVisible(false); curv->yAxis->grid()->setVisible(false); - - initTableLine(curv, strSlfName, strLineName); + // + curv->m_bRowGridVisible = false; + curv->m_bColGridVisible = false; + // + initKedou(curv, strSlfName, strLineName); } else if (strLineName == "WORDS_RELUST") { @@ -5045,99 +5048,8 @@ void FormDraw::DrawImageNew_NoFilter(QMyCustomPlot *widget, QString strSlfName, } //表格曲线 -void FormDraw::initTableLine(QMyCustomPlot *widget, QString strSlfName, QString strLineName) +void FormDraw::initKedou(QMyCustomPlot *widget, QString strSlfName, QString strLineName, QString strAliasName, QColor newlineColor, QStringList listOtherProperty) { - m_Value=NULL; - m_Value2=NULL; - m_Value3=NULL; - //m_csUnit = "(°)"; - m_bTableData=0;//表格或曲线 - m_LeftVal2=0; - m_RightVal2=360; - - m_csCurveDDIR = "DDIR"; // 方位 曲线名 - m_csCurveDANG = "DANG";//倾角 - m_csCurveGrad = "GRAD"; - - - m_nTailWidth=2; - m_crTail=qRgb(0,0,0); - m_crPointFill=qRgb(0,0,0); - - m_crGridSmall=qRgb(100,100,100); - m_nRadius = 6; - m_nTailLen = 10; - m_nCircleWidth=1; - m_flGrad1 = 10; - m_flGrad2 = 50; - - //Table dip - m_qsTable="FRAC_HOLE.TABLE"; - m_qsDIR=("DIR"); // 方位 曲线名 - m_qsDIP=("DIPorS");//倾角 - m_qsDepth="DEP"; - m_qsID = "ID"; - m_qsProperty=("ID"); - m_iPrecision = 3; - // - // ReadFracDef(); - // for (int i = 0 ; i < iFracType ; i++) - // { - // m_bTypeDraw[i] = true; - // } - - if (m_bTableData) - { - // - m_qsDIR=("DDIR"); // 方位 曲线名 - m_qsDIP=("DANG");//倾角 - m_qsDepth="DEPT"; - m_qsID = "ID"; - ReadData(strSlfName, strLineName); - - //------------------------ - // int nPointNum = m_FracTabList.count(); - // if ( nPointNum < 1 )return ; - // FRAC_TABLE frac = m_FracTabList.at(0); - } - else - { - // - m_csCurveDDIR = "DDIR"; // 方位 曲线名 - m_csCurveDANG = "DANG";//倾角 - m_csCurveGrad = "GRAD"; - this->ReadData(strSlfName, m_csCurveDDIR, 0, &m_Curve); - this->ReadData(strSlfName, m_csCurveDANG, 1, &m_Curve2); - this->ReadData(strSlfName, m_csCurveGrad, 2, &m_Curve3); - } - - - - // bool bFistValue=false; - // float vmax = -9999; - // float vmin = -9999; - // //最大值,最小值 - // vmax=vmin=frac.DIR; - // //slf文件读取曲线 - // for(int i=0; ifrac.DIR)vmin=frac.DIR; - // } - // widget->m_iX1 = vmin; - // widget->m_iX2 = vmax; - int iMyWidth = widget->axisRect(0)->width(); float vmax = iMyWidth; float vmin = 0; @@ -5166,19 +5078,41 @@ void FormDraw::initTableLine(QMyCustomPlot *widget, QString strSlfName, QString widget->xAxis2->setVisible(false); widget->yAxis->setVisible(false); widget->yAxis2->setVisible(false); - // - if (m_bTableData) - { - DrawTabDip(widget); - } - else - { - DrawDip(widget); - } - QString strAliasName = ""; + //----------------------------------- + widget->m_Value=NULL; + widget->m_Value2=NULL; + widget->m_Value3=NULL; + //m_csUnit = "(°)"; + widget->m_bTableData=1;//表格或曲线 + widget->m_LeftVal2=0; + widget->m_RightVal2=360; + widget->m_csCurveDDIR = "DDIR"; // 方位 曲线名 + widget->m_csCurveDANG = "DANG";//倾角 + widget->m_csCurveGrad = "GRAD"; + widget->m_nTailWidth=2; + widget->m_crTail=qRgb(0,0,0); + widget->m_crPointFill=qRgb(0,0,0); + // + widget->m_crGridSmall=qRgb(100,100,100); + widget->m_nRadius = 6; + widget->m_nTailLen = 10; + widget->m_nCircleWidth=1; + widget->m_flGrad1 = 10; //可信度 + widget->m_flGrad2 = 50; + //Table dip + widget->m_qsTable="FRAC_HOLE.TABLE"; + widget->m_qsDIR=("DIR"); // 方位 曲线名 + widget->m_qsDIP=("DIPorS");//倾角 + widget->m_qsDepth="DEP"; + widget->m_qsID = "ID"; + widget->m_qsProperty=("ID"); + widget->m_iPrecision = 3; + //蝌蚪图 + widget->Draw_Kedou(); + + //------ QString strUnit = ""; - QColor newlineColor=QColor(0,0,0); double width=2; QString strScaleType = ""; //道-对象 @@ -6560,157 +6494,6 @@ void FormDraw::CalcDipWidth(int nColumn,float *flWidth,float factor,int x1,int x } } -void FormDraw::DrawDip(QMyCustomPlot *widget) -{ - float flWidth[50]; - int l; - float dep; - int m_nScaleThinGrid=10; - // 计算位置 - int iMyWidth = widget->axisRect(0)->width(); - float x1 = 0; - float x2 = iMyWidth; - float x=0,y=0; - int j=0,i=0,k=0; - float flTemp=0; - for(int i=0;i<50;i++) flWidth[i]=0; - CalcDipWidth(m_nScaleThinGrid, flWidth, 1.2, x1, x2, 1.); - - //绘制网格线,注意颜色、宽度属性 - QPen pPenStraightLine(m_crTail, m_nTailWidth); - QPen pPenStraightLineSmall(m_crGridSmall, m_nTailWidth/2); - for(i=0;ipoint1->setCoords(-m_SDep, dtick);//位置 - qcpItemLine->point2->setCoords(-m_EDep, dtick);//位置 - if(j==0) - { - qcpItemLine->setPen(pPenStraightLine); - } - else - { - qcpItemLine->setPen(pPenStraightLineSmall); - } - } - } - } - - QPen pPen(m_crTail,m_nTailWidth); - QBrush cBrushFill(m_crPointFill); - - float flDepthScale,tempf,flVal; - int nPointNum=0,tempi; - QRectF rt,rtRect; - float dgtord,dr; - for(int i=0;i<50;i++) flWidth[i]=0; - if(m_Value==0 || m_Value2==0) - { - Refurbish(); - } - if ( m_Value==0 || m_Value2==0 ) - return ; - - dgtord=3.14159265/180.; - - CalcDipWidth(9, flWidth, 1.2, 0, iMyWidth, 1); - - - while ( 1) - { - dep = m_SDep + k * m_Rlev; - if ( dep >m_EDep ) - break; - - if(dep m_RightVal || flVal < m_LeftVal ) - { - k++; - continue; - } - - tempi = (int)( flVal /10.); - - tempf = 0.; - for (j=0; jsetPen(pPen);// [5/22/2019 9:43 hxb] - // rtRect.setLeft(x - GetLineWidth(pDC,m_nRadius)); - // rtRect.setRight(x + GetLineWidth(pDC,m_nRadius)); - // rtRect.setBottom(y +GetLineWidth(pDC,m_nRadius)); - // rtRect.setTop(y -GetLineWidth(pDC,m_nRadius)); - // pDC->setPen(PenCircle); - // pDC->drawEllipse(rtRect.center(),m_nRadius,m_nRadius); - - QCPItemEllipse *qcpItemEllipse = new QCPItemEllipse(widget); - qcpItemEllipse->setPen(pPen); - qcpItemEllipse->m_bCustom = true; - qcpItemEllipse->m_nRadius = m_nRadius; - qcpItemEllipse->topLeft->setCoords(y, x);//圆心位置 - qcpItemEllipse->bottomRight->setCoords(y, x);//圆心位置 - qcpItemEllipse->setBrush(cBrushFill);//填充圆的颜色 - - - //方位 - flVal = GetData(m_Curve.RepCode,(char *)&m_Value[i*m_Curve.CodeLen]);//DDIR - dr=flVal*dgtord; - // // 注意映射方式 - // x +=GetLineWidth(pDC,m_nRadius)*sin(dr); - // y -=GetLineWidth(pDC,m_nRadius)*cos(dr); - // float x1=x +GetLineWidth(pDC,m_nTailLen)*sin(dr); - // float y1=y -GetLineWidth(pDC,m_nTailLen)*cos(dr); - // pDC->setPen(pPen); - // pDC->drawLine(QPointF(x,y),QPointF(x1,y1)); - QCPItemLine *qcpItemLine = new QCPItemLine(widget); - qcpItemLine->start->setCoords(y, x);//圆心位置 - qcpItemLine->end->setCoords(y, x);//圆心位置 - qcpItemLine->setPen(pPen); - qcpItemLine->m_bCustom = true; - qcpItemLine->m_nTailLen = m_nTailLen; //尾长 - qcpItemLine->m_nRadius = m_nRadius; //半径 - qcpItemLine->m_dr = dr; - - - //移动对象 - // widget->mSizeHandleManager->addItem(qcpItemEllipse, true); - // widget->mSizeHandleManager->addItem(qcpItemLine, true); - - k++; - } -} void FormDraw::DrawJykt(QMyCustomPlot *widget, QString strSlfName) { @@ -7071,207 +6854,7 @@ void FormDraw::DrawStck(QMyCustomPlot *widget) k++; } } -void FormDraw::DrawTabDip(QMyCustomPlot *widget) -{ - float flDepthScale,tempf,flVal; - int i,j,n,nPointNum=0,tempi; - QRectF rt,rtRect; - float x,y; - float dgtord,dr; - float flWidth[50]; - FRAC_TABLE frac; - bool bDraw; - FRAC_DEF fd; - //CString cs; - if(m_iPrecision<0) m_iPrecision=0; - - nPointNum = m_FracTabList.count(); - if ( nPointNum < 1 )return ; - - dgtord=3.14159265/180.; - // - m_nCircleWidth = 1; - m_nRadius = 6; - m_crCircle = QColor(0,0,0); - // - m_nTailWidth = 2; - m_nTailLen = 10; - m_crTail = QColor(0,0,0); - - int iMyWidth = widget->axisRect(0)->width(); //setSizeConstraintRect() - int iMyHeight = widget->axisRect(0)->height(); //setSizeConstraintRect() - qDebug() << "iMyWidth=" << QString::number(iMyWidth) << ", iMyHeight=" << QString::number(iMyHeight); - - //----------- - int l; - float x1 = 0; - float x2 = iMyWidth; - float flTemp=0; - for(int i=0;i<50;i++) flWidth[i]=0; - int m_nScaleThinGrid=10; - CalcDipWidth(m_nScaleThinGrid, flWidth, 1.2, x1, x2, 1.); - //绘制网格线,注意颜色、宽度属性 - QPen pPenStraightLine(m_crTail, m_nTailWidth); - QPen pPenStraightLineSmall(m_crGridSmall, m_nTailWidth/2); - for(i=0;ipoint1->setCoords(-m_iY2, dtick);//位置 - qcpItemLine->point2->setCoords(-m_iY1, dtick);//位置 - if(j==0) - { - qcpItemLine->setPen(pPenStraightLine); - } - else - { - qcpItemLine->setPen(pPenStraightLineSmall); - } - } - } - } - - CalcDipWidth(9,flWidth, 1.2, 0, iMyWidth, 1.); - - n = m_FracDefList.count(); - for (i=0; i -m_iY1) - // { - // continue; - // } - - // bDraw = false; - // for (j=0; jsetPen(pPen); - // pDC->drawEllipse(rtRect.left(),rtRect.top(),rtRect.width(),rtRect.height()); - // QPainterPath myPath; - // myPath.addEllipse(rtRect); - // pDC->fillPath(myPath,cBrush); - - //CustomEllipse *qcpitemellipse = new CustomEllipse(widget); - - QCPItemEllipse *qcpItemEllipse = new QCPItemEllipse(widget); - qcpItemEllipse->setPen(pPen); - qcpItemEllipse->m_bCustom = true; - qcpItemEllipse->m_nRadius = m_nRadius; - qcpItemEllipse->topLeft->setCoords(y, x);//圆心位置 - qcpItemEllipse->bottomRight->setCoords(y, x);//圆心位置 - qcpItemEllipse->setBrush(cBrush);//填充圆的颜色 - - //方位 - dr=frac.DIR *dgtord; - - // QCPItemStraightLine *qcpItemLine = new QCPItemStraightLine(widget); - // qcpItemLine->point1->setCoords(y, x);//圆心位置 - // qcpItemLine->point2->setCoords(y, x);//圆心位置 - QCPItemLine *qcpItemLine = new QCPItemLine(widget); - qcpItemLine->start->setCoords(y, x);//圆心位置 - qcpItemLine->end->setCoords(y, x);//圆心位置 - qcpItemLine->setPen(pPenTail); - qcpItemLine->m_bCustom = true; - qcpItemLine->m_nTailLen = m_nTailLen; //尾长 - qcpItemLine->m_nRadius = m_nRadius; //半径 - qcpItemLine->m_dr = dr; - - - //break; - - // x += m_nRadius*sin(dr); - // // 注意映射方式 - // y -=m_nRadius*cos(dr); - // //pDC->moveto(x,y); - // float x1=x +m_nTailLen*sin(dr); - // // 注意映射方式 - // float y1= y-m_nTailLen*cos(dr); - - // pDC->setPen(pPenTail); - // pDC->drawLine(x,y,x1,y1); - - - // if ( m_bDrawValue ) //显示倾角、方位 - // { - // rtRect.setTop(rtRect.top()-GetLineWidth(pDC,objViewInfo->GetLogUnitFont().pointSize())); - // rtRect.setBottom(rtRect.bottom()+GetLineWidth(pDC,objViewInfo->GetLogUnitFont().pointSize())); - // QString cs1 = QString::number(frac.DIPorS,'f',m_iPrecision); - // QString cs2 = QString::number(frac.DIR,'f',m_iPrecision); - // cs=cs1+"//"+cs2; - // cs.Replace((" "),""); - // if ( frac.DIPorS >= 30 ) - // { - // x = 2.*(float)(GetLineWidth(pDC,m_nRadius)); - // rtRect.setRight(rtRect.center().x() - x); - // rtRect.setLeft(mrt.left()); - // pDC->drawText(rtRect,Qt::AlignVCenter|Qt::AlignHCenter,cs.GetString()); - // } - // else - // { - // x = 2.*(float)(GetLineWidth(pDC,m_nRadius)); - // rtRect.setLeft(rtRect.center().x() + x); - // rtRect.setRight(mrt.right()); - // pDC->drawText(rtRect,Qt::AlignVCenter,cs.GetString()); - // } - // } - } - } -} //read config file: FRAC.CFG,save info into m_FracDef void FormDraw::ReadFracDef() diff --git a/logPlus/formdraw.h b/logPlus/formdraw.h index bc9c47e..e28e8f7 100644 --- a/logPlus/formdraw.h +++ b/logPlus/formdraw.h @@ -15,29 +15,6 @@ #pragma execution_character_set("utf-8") //const int iFracType=15; -//蝌蚪图 -typedef struct FRACDEF -{ - int iCode; //代码 - QString csName; // 名称 - int iType; //形状代码(1:正弦曲线 2:连线 3:封闭区域) - QColor crColor; //颜色(红 绿 蓝) - int nLineWidth; //线宽度 - int bDraw; // 是否显示 -}FRAC_DEF; - -typedef struct FRACTABLE -{ - float DEP; //深度 - float AorX; - float XETAorH; - float W; - float DIPorS; //倾角 - float DIR; //方位 - float ID; //裂缝代码/可信度 - float NUM; - float X[16],Y[16];//X0,Y0,X1,Y1,X2,Y2,X3,Y3,X4,Y4,X5,Y5,X6,Y6,X7,Y7,X8,Y8,X9,Y9; -}FRAC_TABLE; namespace Ui { class FormDraw; @@ -174,13 +151,11 @@ public: void DrawImageNew_NoFilter(QMyCustomPlot *widget, QString strSlfName, QString &strWaveName, int &_nSamples); //表格曲线 - void initTableLine(QMyCustomPlot *widget, QString strSlfName, QString strLineName); + void initKedou(QMyCustomPlot *widget, QString strSlfName, QString strLineName, QString strAliasName = "蝌蚪图", QColor newlineColor=QColor(0,0,0), QStringList listOtherProperty={}); void ReadFracDef(); void ReadData(QString strSlfName, QString strLineName);//表格 void ReadData(QString strSlfName, QString strLineName, int iCurve, Slf_CURVE *curve);//曲线 - void DrawDip(QMyCustomPlot *widget); void DrawStck(QMyCustomPlot *widget); - void DrawTabDip(QMyCustomPlot *widget); void CalcDipWidth(int nColumn,float *flWidth,float factor,int x1,int x2,float flHoriRatio); void Refurbish(); void DrawJykt(QMyCustomPlot *widget, QString strSlfName); diff --git a/logPlus/forminfo.cpp b/logPlus/forminfo.cpp index 117e532..092ea88 100644 --- a/logPlus/forminfo.cpp +++ b/logPlus/forminfo.cpp @@ -954,11 +954,6 @@ void FormInfo::paintEvent(QPaintEvent* event) //岩心分析,不绘制左右范围 // strShowTxt = "岩心实验数据"; } - else if(m_strLineName=="FRAC_HOLE.TABLE" && m_strType=="tableObject") - { - //蝌蚪图,不绘制左右范围 - strShowTxt = "蝌蚪图"; - } if(this->m_strType == "plObject" || this->m_strType == "roseObject" || this->m_strType == "CrackObject") { strShowTxt = " "; diff --git a/logPlus/forminfo.h b/logPlus/forminfo.h index 9f1e1da..052e9d6 100644 --- a/logPlus/forminfo.h +++ b/logPlus/forminfo.h @@ -362,6 +362,12 @@ public: int cpLineWidth() const; void setCpLineWidth(int cpLineWidth); + //蝌蚪图 + QString m_pl_GradCurve = "GRAD"; // 可信度曲线 + float m_flGrad1,m_flGrad2; // 可信度 + float m_nRadius,m_nCircleWidth; // 半径,圆线宽度 + float m_nTailWidth,m_nTailLen; // 尾宽度、尾长 + QColor m_crTail,m_crCircle;//颜色 public: void setLineWidth(double dWidth); double getLineWidth(); diff --git a/logPlus/qmycustomplot.cpp b/logPlus/qmycustomplot.cpp index c492274..9aabdbb 100644 --- a/logPlus/qmycustomplot.cpp +++ b/logPlus/qmycustomplot.cpp @@ -9004,8 +9004,50 @@ bool QMyCustomPlot::getIsEditor() return true; } +//读取高导缝配置 +void QMyCustomPlot::ReadFracDef_gaodaofeng() +{ + m_FracDefList.clear(); + FRAC_DEF fd; + //char path[MAX_PATH+1]; + char str[512],name[512]; + int r,g,b,id; + FILE *fp; + QString qs; + + //sprintf(str,"%sconf\\FRAC.CFG",path); + // QString fracFilePath = GetConfPath() + "FRAC_New.CFG"; + QString fracFilePath = GetConfPath() + "FRAC.CFG"; + fp = fopen(fracFilePath.toStdString().c_str(),"r"); + if ( fp !=NULL ) + { + fgets(str,256,fp); // 跳过第一行 + while (!feof(fp)) + { + fgets(str,256,fp); + qs = str; qs.trimmed(); + if (qs.length() < 8) break ; + //代码 名称 形状代码(1:正弦曲线 2:连线 3:封闭区域) 颜色(红 绿 蓝) 线宽度 + sscanf(str,"%d %s %d %d %d %d %d",&fd.iCode, name, &fd.iType, &r, &g, &b, &fd.nLineWidth); + fd.crColor = QColor(r,g,b);//RGB(r,g,b); + fd.csName = name; + fd.csName = fd.csName.trimmed();//.Trim(); + fd.bDraw = 0; + m_FracDefList.append(fd); + if ( feof(fp)) + break; + } + fclose(fp); + } + else + { + sprintf(name,"打开裂缝参数配置文件错误:%s!",str); + QMessageBox::information(nullptr, "读取文件失败", name); + } +} + //沉积相 -void QMyCustomPlot::ReadFracDef() +void QMyCustomPlot::ReadFracDef_Fac() { m_FracDef.clear(); @@ -9256,7 +9298,7 @@ bool QMyCustomPlot::LoadFromSLF_Fac(QString strSlfName, QString csCurve, bool bA m_qcpItemLine2->point2->setCoords(-2, 3*iMyWidth/4);//位置 } - ReadFracDef(); + ReadFracDef_Fac(); ReadData_Fac(strSlfName, csCurve, bAdd); DrawFac(1);//相 @@ -11093,6 +11135,12 @@ bool QMyCustomPlot::Refurbish() bool flag = true; if (m_bTableData) { + ReadFracDef_gaodaofeng(); + for (int i = 0 ; i < iFracType ; i++) + { + m_bTypeDraw[i] = true; + } + // ReadData(m_strSlfName, ""); } else @@ -11383,7 +11431,7 @@ void QMyCustomPlot::drawRose(bool bTableData, QString csCurveDDIR, QString csCur if (m_bTableData) { - ReadFracDef(); + ReadFracDef_gaodaofeng(); for (int i = 0 ; i < iFracType ; i++) { m_bTypeDraw[i] = true; @@ -11739,3 +11787,321 @@ void QMyCustomPlot::vertScrollBarChanged(QString strUuid, int value) } } } + +void QMyCustomPlot::Draw_Kedou() +{ + if (m_bTableData) + { + // + m_qsDIR="DDIR"; // 方位 曲线名 + m_qsDIP="DANG";//倾角 + m_qsDepth="DEPT"; + m_qsID = "ID"; + ReadData(m_strSlfName, m_strLineName); + } + else + { + // + m_csCurveDDIR = "DDIR"; // 方位 曲线名 + m_csCurveDANG = "DANG";//倾角 + m_csCurveGrad = "GRAD"; + this->ReadData(m_strSlfName, m_csCurveDDIR, 0, &m_Curve); + this->ReadData(m_strSlfName, m_csCurveDANG, 1, &m_Curve2); + this->ReadData(m_strSlfName, m_csCurveGrad, 2, &m_Curve3); + } + + if (m_bTableData) + { + this->DrawTabDip_Kedou(); + } + else + { + this->DrawDip_Kedou(); + } +} + +void QMyCustomPlot::CalcDipWidth(int nColumn,float *flWidth,float factor,int x1,int x2,float flHoriRatio) +{ + float scale ; + int k; + + scale = flWidth[0]=1.; + for(k=1;kaxisRect(0)->width(); //setSizeConstraintRect() + int iMyHeight = this->axisRect(0)->height(); //setSizeConstraintRect() + qDebug() << "iMyWidth=" << QString::number(iMyWidth) << ", iMyHeight=" << QString::number(iMyHeight); + + //----------- + int l; + float x1 = 0; + float x2 = iMyWidth; + float flTemp=0; + for(int i=0;i<50;i++) flWidth[i]=0; + int m_nScaleThinGrid=10; + CalcDipWidth(m_nScaleThinGrid, flWidth, 1.2, x1, x2, 1.); + //绘制网格线,注意颜色、宽度属性 + QPen pPenStraightLine(m_crTail, m_nTailWidth); + QPen pPenStraightLineSmall(m_crGridSmall, m_nTailWidth/2); + for(i=0;ipoint1->setCoords(-m_iY2, dtick);//位置 + qcpItemLine->point2->setCoords(-m_iY1, dtick);//位置 + if(j==0) + { + qcpItemLine->setPen(pPenStraightLine); + } + else + { + qcpItemLine->setPen(pPenStraightLineSmall); + } + } + } + } + + CalcDipWidth(9,flWidth, 1.2, 0, iMyWidth, 1.); + + n = m_FracDefList.count(); + for (i=0; isetPen(pPen); + qcpItemEllipse->m_bCustom = true; + qcpItemEllipse->m_nRadius = m_nRadius; + qcpItemEllipse->topLeft->setCoords(y, x);//圆心位置 + qcpItemEllipse->bottomRight->setCoords(y, x);//圆心位置 + qcpItemEllipse->setBrush(cBrush);//填充圆的颜色 + + //方位 + dr=frac.DIR *dgtord; + // + QCPItemLine *qcpItemLine = new QCPItemLine(this); + qcpItemLine->start->setCoords(y, x);//圆心位置 + qcpItemLine->end->setCoords(y, x);//圆心位置 + qcpItemLine->setPen(pPenTail); + qcpItemLine->m_bCustom = true; + qcpItemLine->m_nTailLen = m_nTailLen; //尾长 + qcpItemLine->m_nRadius = m_nRadius; //半径 + qcpItemLine->m_dr = dr; + } + } +} + +void QMyCustomPlot::DrawDip_Kedou() +{ + float flWidth[50]; + int l; + float dep; + int m_nScaleThinGrid=10; + // 计算位置 + int iMyWidth = this->axisRect(0)->width(); + float x1 = 0; + float x2 = iMyWidth; + float x=0,y=0; + int j=0,i=0,k=0; + float flTemp=0; + for(int i=0;i<50;i++) flWidth[i]=0; + CalcDipWidth(m_nScaleThinGrid, flWidth, 1.2, x1, x2, 1.); + + //绘制网格线,注意颜色、宽度属性 + QPen pPenStraightLine(m_crTail, m_nTailWidth); + QPen pPenStraightLineSmall(m_crGridSmall, m_nTailWidth/2); + for(i=0;ipoint1->setCoords(-m_SDep, dtick);//位置 + qcpItemLine->point2->setCoords(-m_EDep, dtick);//位置 + if(j==0) + { + qcpItemLine->setPen(pPenStraightLine); + } + else + { + qcpItemLine->setPen(pPenStraightLineSmall); + } + } + } + } + + QPen pPen(m_crTail,m_nTailWidth); + QBrush cBrushFill(m_crPointFill); + + float flDepthScale,tempf,flVal; + int nPointNum=0,tempi; + QRectF rt,rtRect; + float dgtord,dr; + for(int i=0;i<50;i++) flWidth[i]=0; + if(m_Value==0 || m_Value2==0) + { + Refurbish(); + } + if ( m_Value==0 || m_Value2==0 ) + return ; + + dgtord=3.14159265/180.; + + CalcDipWidth(9, flWidth, 1.2, 0, iMyWidth, 1); + + + while ( 1) + { + dep = m_SDep + k * m_Rlev; + if ( dep >m_EDep ) + break; + + if(dep m_flGrad2 || flVal < m_flGrad1 ) + { + k++; + continue; + } + + tempi = (int)( flVal /10.); + + tempf = 0.; + for (j=0; jsetPen(pPen); + qcpItemEllipse->m_bCustom = true; + qcpItemEllipse->m_nRadius = m_nRadius; + qcpItemEllipse->topLeft->setCoords(y, x);//圆心位置 + qcpItemEllipse->bottomRight->setCoords(y, x);//圆心位置 + qcpItemEllipse->setBrush(cBrushFill);//填充圆的颜色 + + //方位 + flVal = GetData(m_Curve.RepCode,(char *)&m_Value[i*m_Curve.CodeLen]);//DDIR + dr=flVal*dgtord; + // + QCPItemLine *qcpItemLine = new QCPItemLine(this); + qcpItemLine->start->setCoords(y, x);//圆心位置 + qcpItemLine->end->setCoords(y, x);//圆心位置 + qcpItemLine->setPen(pPen); + qcpItemLine->m_bCustom = true; + qcpItemLine->m_nTailLen = m_nTailLen; //尾长 + qcpItemLine->m_nRadius = m_nRadius; //半径 + qcpItemLine->m_dr = dr; + k++; + } +} diff --git a/logPlus/qmycustomplot.h b/logPlus/qmycustomplot.h index 82bd5f5..450ecc9 100644 --- a/logPlus/qmycustomplot.h +++ b/logPlus/qmycustomplot.h @@ -27,6 +27,7 @@ struct Slf_JIEGUPOS { char Dest[64]; }; +//沉积相 typedef struct { int iCode; //代码 @@ -34,7 +35,6 @@ typedef struct QString Phase; //亚相 QString mFac; //微相 }FAC_DEF; - typedef struct { int no; @@ -46,6 +46,29 @@ typedef struct char Dest[32]; }FAC_TABLE; +//蝌蚪图 +typedef struct FRACDEF +{ + int iCode; //代码 + QString csName; // 名称 + int iType; //形状代码(1:正弦曲线 2:连线 3:封闭区域) + QColor crColor; //颜色(红 绿 蓝) + int nLineWidth; //线宽度 + int bDraw; // 是否显示 +}FRAC_DEF; +typedef struct FRACTABLE +{ + float DEP; //深度 + float AorX; + float XETAorH; + float W; + float DIPorS; //倾角 + float DIR; //方位 + float ID; //裂缝代码/可信度 + float NUM; + float X[16],Y[16];//X0,Y0,X1,Y1,X2,Y2,X3,Y3,X4,Y4,X5,Y5,X6,Y6,X7,Y7,X8,Y8,X9,Y9; +}FRAC_TABLE; + class FormTrack; class FormDraw; class TransparentGroupResult; @@ -338,14 +361,14 @@ public: bool m_bDrawFac = true; // 绘制相 bool m_bDrawPhase = true; // 绘制亚相 bool m_bDrawMFacName = true; // 微相名称 - void ReadFracDef(); + void ReadFracDef_Fac(); void ReadData_Fac(QString strSlfName, QString csCurve, bool bAdd=true); void DrawFac(int iType); bool LoadFromSLF_Fac(QString strSlfName, QString csCurve, bool bAdd=true); //保存 void SaveToSLF_Fac(); - //套管組件 + //套管组件 bool m_bDrawStruct_Tubing = true; //绘制结构 bool m_bDrawTubing_Tubing = true; //绘制管柱 bool m_bDrawTools_Tubing = true; //绘制工具 @@ -669,32 +692,8 @@ public: virtual void contextMenuEvent(QContextMenuEvent *event); - - - typedef struct FRACTABLE - { - float DEP; //深度 - float AorX; - float XETAorH; - float W; - float DIPorS; //倾角 - float DIR; //方位 - float ID; //裂缝代码/可信度 - float NUM; - float X[16],Y[16];//X0,Y0,X1,Y1,X2,Y2,X3,Y3,X4,Y4,X5,Y5,X6,Y6,X7,Y7,X8,Y8,X9,Y9; - }FRAC_TABLE; - //蝌蚪图 - typedef struct FRACDEF - { - int iCode; //代码 - QString csName; // 名称 - int iType; //形状代码(1:正弦曲线 2:连线 3:封闭区域) - QColor crColor; //颜色(红 绿 蓝) - int nLineWidth; //线宽度 - int bDraw; // 是否显示 - }FRAC_DEF; - QList m_FracTabList; // -- - QList m_FracDefList; + QList m_FracTabList; + QList m_FracDefList;// 高导缝... bool m_bTypeDraw[iFracType]; // -- int m_bTableData = 0; QString m_csCurveDDIR,m_csCurveDANG,m_csCurveGrad; @@ -729,6 +728,22 @@ public: bool m_rose_fill_enabled, bool m_rose_draw_annotation, int nstep, float m_LeftVal, float m_RightVal); void addQCPItemLine(QMyCustomPlot *widget, float cx, float cy, const QPointF& p1, const QPointF& p2, const QPen& wPen); + + //蝌蚪 + float m_LeftVal2,m_RightVal2; //最小倾角、最大倾角 + float m_flGrad1,m_flGrad2; // 可信度 + int m_iPrecision; //小数位数 + float m_nRadius,m_nCircleWidth; // 半径,圆线宽度 + float m_nTailWidth,m_nTailLen; // 尾宽度、尾长 + QColor m_crPointFill,m_crTail,m_crCircle;//颜色 + QColor m_crGridSmall; // + void CalcDipWidth(int nColumn,float *flWidth,float factor,int x1,int x2,float flHoriRatio); + void Draw_Kedou(); + void DrawDip_Kedou(); + void DrawTabDip_Kedou(); + + void ReadFracDef_gaodaofeng(); + private: };