From c1c0b72e17095422a0e506b30a63725517f1de0c Mon Sep 17 00:00:00 2001 From: "DESKTOP-450PEFP\\mainc" Date: Fri, 17 Apr 2026 17:53:36 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B2=E7=BA=BF=E7=AC=AC=E4=BA=8C=E6=AF=94?= =?UTF-8?q?=E4=BE=8B=E5=B1=9E=E6=80=A7=E7=BC=96=E8=BE=91=E5=99=A8=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=EF=BC=8C=E7=AC=AC=E4=BA=8C=E6=AF=94=E4=BE=8B=E5=A4=A7?= =?UTF-8?q?=E5=B0=8F=EF=BC=8C=E8=87=AA=E5=8A=A8=E8=AE=A1=E7=AE=97=E4=BA=8C?= =?UTF-8?q?=E6=AF=94=E4=BE=8B=EF=BC=8C=E7=BB=98=E5=88=B6=E5=B7=A6=E4=BA=8C?= =?UTF-8?q?=E6=AF=94=E4=BE=8B=EF=BC=8C=E7=BB=98=E5=88=B6=E5=8F=B3=E4=BA=8C?= =?UTF-8?q?=E6=AF=94=E4=BE=8B=EF=BC=8C=E4=BA=8C=E6=AF=94=E4=BE=8B=E8=BF=9E?= =?UTF-8?q?=E7=BB=AD=E6=8A=98=E8=BF=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- logPlus/PropertyWidget.cpp | 115 ++++++++++--------- logPlus/forminfo.cpp | 189 +++++++++++++++++++++++++------ logPlus/forminfo.h | 5 +- logPlus/qmycustomplot.cpp | 226 ++++++++++++++++++++++++++++++++++--- logPlus/qmycustomplot.h | 9 +- 5 files changed, 434 insertions(+), 110 deletions(-) diff --git a/logPlus/PropertyWidget.cpp b/logPlus/PropertyWidget.cpp index 191b122..47faaab 100644 --- a/logPlus/PropertyWidget.cpp +++ b/logPlus/PropertyWidget.cpp @@ -1946,16 +1946,26 @@ void PropertyWidget::SlotPropertyChanged( QtProperty *pProperty, const QVariant } else if(m_strCurrentProperty == Curve_Property) { + QString strGroup = ""; + if (1 == pProperty->getParentItem().count()) + { + QtProperty * pParentProperty = *(pProperty->getParentItem().begin()); + strGroup = pParentProperty->propertyName(); + } bool bhv = false; bool bDraw = false; QStringList slist; - slist << "曲线名称" << "曲线单位" << "曲线刻度" << "单比例连续折返"; + slist << "曲线名称" << "曲线单位" << "曲线刻度" << "单比例连续折返" + << "线宽" << "颜色" << "线型" + << "第二比例大小" << "自动计算二比例" + << "绘制左二比例" << "左二比例连续折返" << "左二比例左刻度" << "左二比例右刻度" + << "绘制右二比例" << "右二比例连续折返" << "右二比例左刻度" << "右二比例右刻度"; for (int i = 0; i < slist.length(); i++) { if (slist.at(i) == m_propertyData[pProperty]) { bhv = true; - bDraw = m_formInfo->setInfoProperty(m_propertyData[pProperty], variant); + bDraw = m_formInfo->setInfoProperty(m_propertyData[pProperty], variant, strGroup); break; } } @@ -1971,6 +1981,7 @@ void PropertyWidget::SlotPropertyChanged( QtProperty *pProperty, const QVariant listCond << m_strLineName; listCond << m_propertyData[pProperty]; listCond << variant; + listCond << strGroup; emit CallManage::getInstance()->sig_changeDrawProperty(listCond); } } @@ -2062,56 +2073,56 @@ void PropertyWidget::SlotPropertyChanged( QtProperty *pProperty, const QVariant m_formInfo->m_nRightCross = variant.toInt(); emit CallManage::getInstance()->sig_ChangeCross(m_strUuid, m_strTrackUuid); } - else if("颜色" == m_propertyData[pProperty]) - { - //qDebug() << "颜色->改变"; - //曲线颜色 - // 假设variant已经被设置为包含QColor - QColor newColor = variant.value(); - emit CallManage::getInstance()->sig_ChangeLineColor(m_strUuid, m_strSlfName, m_strWellName, m_strTrackName, m_strLineName, newColor); - } - else if("线宽" == m_propertyData[pProperty]) - { - //qDebug() << "线宽->改变"; - double newWidth = variant.value(); - emit CallManage::getInstance()->sig_ChangeLineWidth(m_strUuid, m_strSlfName, m_strWellName, m_strTrackName, m_strLineName, newWidth); - } - else if("线型" == m_propertyData[pProperty]) - { - //qDebug() << "线型->改变"; - Qt::PenStyle newStyle = Qt::SolidLine; - int iStyle = variant.value(); - switch(iStyle) - { - case 0: - //无 - newStyle = Qt::NoPen; - break; - case 1: - //实线 - newStyle = Qt::SolidLine; - break; - case 2: - //虚线 - newStyle = Qt::DashLine; - break; - case 3: - //点线 - newStyle = Qt::DotLine; - break; - case 4: - //虚点线 - newStyle = Qt::DashDotLine; - break; - case 5: - //虚点点线 - newStyle = Qt::DashDotDotLine; - break; - default: - break; - } - emit CallManage::getInstance()->sig_ChangeLineStyle(m_strUuid, m_strSlfName, m_strWellName, m_strTrackName, m_strLineName, newStyle); - } + //else if("颜色" == m_propertyData[pProperty]) + //{ + // //qDebug() << "颜色->改变"; + // //曲线颜色 + // // 假设variant已经被设置为包含QColor + // QColor newColor = variant.value(); + // emit CallManage::getInstance()->sig_ChangeLineColor(m_strUuid, m_strSlfName, m_strWellName, m_strTrackName, m_strLineName, newColor); + //} + //else if("线宽" == m_propertyData[pProperty]) + //{ + // //qDebug() << "线宽->改变"; + // double newWidth = variant.value(); + // emit CallManage::getInstance()->sig_ChangeLineWidth(m_strUuid, m_strSlfName, m_strWellName, m_strTrackName, m_strLineName, newWidth); + //} + //else if("线型" == m_propertyData[pProperty]) + //{ + // //qDebug() << "线型->改变"; + // Qt::PenStyle newStyle = Qt::SolidLine; + // int iStyle = variant.value(); + // switch(iStyle) + // { + // case 0: + // //无 + // newStyle = Qt::NoPen; + // break; + // case 1: + // //实线 + // newStyle = Qt::SolidLine; + // break; + // case 2: + // //虚线 + // newStyle = Qt::DashLine; + // break; + // case 3: + // //点线 + // newStyle = Qt::DotLine; + // break; + // case 4: + // //虚点线 + // newStyle = Qt::DashDotLine; + // break; + // case 5: + // //虚点点线 + // newStyle = Qt::DashDotDotLine; + // break; + // default: + // break; + // } + // emit CallManage::getInstance()->sig_ChangeLineStyle(m_strUuid, m_strSlfName, m_strWellName, m_strTrackName, m_strLineName, newStyle); + //} else if("曲线" == m_propertyData[pProperty]) { //qDebug() << "曲线->改变"; diff --git a/logPlus/forminfo.cpp b/logPlus/forminfo.cpp index 1e574eb..d42b9be 100644 --- a/logPlus/forminfo.cpp +++ b/logPlus/forminfo.cpp @@ -27,6 +27,9 @@ FormInfo::FormInfo(QWidget *parent, QString strSlfName, QString strWellName, QSt m_strTrackName = strTrackName; m_strLineName = strLineName; m_lineColor = lineColor; + + m_twoBLlineColor = lineColor; + // m_dWidth = 3; m_lineStyle = Qt::SolidLine; @@ -1040,19 +1043,23 @@ void FormInfo::paintEvent(QPaintEvent* event) if(m_strType=="waveObject" || m_strType=="curveObject") { - QFont oldFont = painter.font(); - painter.setFont(m_curveUnitFont); - painter.drawText(rect.left()+10, rect.top() + rect.height() * 2 / 3, rect.width(), rect.height() / 3, Qt::AlignCenter, m_strUnit); - painter.setFont(oldFont); + int nbay = rect.height() - 5; + // 显示刻度 if (m_bShowScale) { - painter.setFont(m_curveScaleFont); - QFontMetrics fm1(m_curveScaleFont); - QRect textRect = fm1.boundingRect(QString::number(m_vmax, 'f', 0)); - painter.drawText(rect.left() + 10, rect.top() + rect.height() * 2 / 3, rect.width(), rect.height() / 3, Qt::AlignLeft | Qt::AlignVCenter, QString::number(m_vmin));// +" ~ " + QString::number(m_vmax)); - painter.drawText(rect.left() + 10, rect.top() + rect.height() * 2 / 3, rect.width() - textRect.width(), rect.height() / 3, Qt::AlignRight | Qt::AlignVCenter, QString::number(m_vmax)); + drawScale(painter, rect); } + QFont oldFont = painter.font(); + painter.setFont(m_curveUnitFont); + QFontMetrics fm2(m_curveUnitFont); + QRect tRect = fm2.boundingRect(m_strUnit); + painter.drawText(rect.width()/2- tRect.width()/2, nbay - 6, m_strUnit); + painter.setFont(oldFont); + + painter.setPen(QPen(m_lineColor, m_dWidth, m_lineStyle)); + // 刻度线 + painter.drawLine(rect.x()-5, nbay, rect.x()+ rect.width()-5, nbay); } } @@ -1345,6 +1352,70 @@ void FormInfo::paintEvent(QPaintEvent* event) QWidget::paintEvent(event); } +void FormInfo::drawScale(QPainter& painter, const QRect& rect) +{ + int nbay = rect.height() - 5; + QVector vecScale; + if (m_strType == "curveObject") // 曲线 + { + if (m_twoBLSize > 0) // 第二比例大小 + { + if (m_twoBLDrawLeft) // 绘制左二比例 + { + if (m_twoBLAuto) // 自动计算二比例 + { + float ftm = (m_vmax - m_vmin)*m_twoBLSize; + vecScale << QStringList({ QString::number(m_vmax) , QString::number(m_vmax + ftm) }); + } + else + { + if (m_twoBLLeftLeft.length() > 0 || m_twoBLLeftRight.length() > 0) + { + vecScale << QStringList({ m_twoBLLeftLeft , m_twoBLLeftRight }); + } + } + } + + vecScale << QStringList({ QString::number(m_vmin) , QString::number(m_vmax) }); + + if (m_twoBLDrawRight) // 绘制右二比例 + { + if (m_twoBLAuto) // 自动计算二比例 + { + float ftm = (m_vmax - m_vmin)*m_twoBLSize; + vecScale << QStringList({ QString::number(m_vmin - ftm) , QString::number(m_vmin) }); + } + else + { + if (m_twoBLRightLeft.length() > 0 || m_twoBLRightRight.length() > 0) + { + vecScale << QStringList({ m_twoBLRightLeft , m_twoBLRightRight }); + } + } + } + + } + else + vecScale << QStringList({ QString::number(m_vmin) , QString::number(m_vmax) }); + } + else + vecScale << QStringList({ QString::number(m_vmin) , QString::number(m_vmax) }); + + painter.setFont(m_curveScaleFont); + QFontMetrics fm1(m_curveScaleFont); + QRect textRect = fm1.boundingRect(QString::number(m_vmin, 'f', 0)); + int ntxthei = textRect.height() - 4; + int nyy = nbay - ntxthei * vecScale.size() - 3; + for (int i = 0; i < vecScale.size(); i++) + { + const QStringList& slist = vecScale.at(i); + QRect textRect = fm1.boundingRect(slist.at(1)); + int y = nyy + (i + 1) * ntxthei; + painter.drawText(rect.x() + 3, y, slist.at(0)); + painter.drawText(rect.width() - textRect.width() - 3, y, slist.at(1)); + } +} + void FormInfo::paintClassify(QPainter &painter, int compassCenterY) { // 绘制分类 @@ -1592,6 +1663,7 @@ void FormInfo::setCpLineWidth(int cpLineWidth) void FormInfo::setLineWidth(double dWidth) { m_dWidth = dWidth; + m_twoBLWidth = m_dWidth; } double FormInfo::getLineWidth() @@ -1650,47 +1722,48 @@ QColor FormInfo::getBackColor() return m_backColor; } -bool FormInfo::setInfoProperty(QString strProName, QVariant val) +bool FormInfo::setInfoProperty(QString strProName, QVariant val, QString strGp) { - bool bDraw = false; + bool bDraw = true; if ("显示名称" == strProName) - { + { + bDraw = false; this->m_strAliasName = val.toString(); } else if ("显示单位" == strProName) - { + { + bDraw = false; this->m_strUnit = val.toString(); } else if ("曲线名称" == strProName || "字体" == strProName) - { + { + bDraw = false; this->m_curveNameFont = val.value(); } else if ("曲线单位" == strProName) - { + { + bDraw = false; this->m_curveUnitFont = val.value(); } else if ("曲线刻度" == strProName) - { + { + bDraw = false; this->m_curveScaleFont = val.value(); } else if ("类型" == strProName) { - bDraw = true; this->m_nDrawType = val.toInt(); } else if ("方式" == strProName) { - bDraw = true; this->m_nFillType = val.toInt(); } else if ("左刻度" == strProName) { - bDraw = true; this->m_vmin = val.toDouble(); } else if ("右刻度" == strProName) { - bDraw = true; this->m_vmax = val.toDouble(); } else if ("幅度刻度" == strProName) @@ -1699,52 +1772,98 @@ bool FormInfo::setInfoProperty(QString strProName, QVariant val) } else if ("最大振幅" == strProName) { - bDraw = true; this->m_fMaxAmp = val.toFloat(); } else if ("显示刻度" == strProName) - { + { + bDraw = false; this->m_bShowScale = val.toBool(); } else if ("绘制波深度" == strProName) { - bDraw = true; this->m_bDrawDepth = val.toBool(); } else if ("绘制波基线" == strProName) { - bDraw = true; this->m_bDrawBase = val.toBool(); } else if ("奇偶配色" == strProName) { - bDraw = true; this->m_bOddEven = val.toBool(); } else if ("波列基值" == strProName) { - bDraw = true; this->m_fWaveBase = val.toFloat(); } else if ("波形间隔" == strProName) { - bDraw = true; this->m_nWaveJg = val.toInt(); } else if ("波形高度" == strProName) { - bDraw = true; this->m_fWaveHei = val.toInt(); } + else if ("线型" == strProName) + { + if ("曲线第二比例" == strGp) + m_twoBLlineStyle = (Qt::PenStyle)val.toInt(); + else + this->m_lineStyle = (Qt::PenStyle)val.toInt(); + } else if ("颜色" == strProName) { - bDraw = true; - this->m_lineColor = val.value(); + if ("曲线第二比例" == strGp) + m_twoBLlineColor = val.value(); + else + this->m_lineColor = val.value(); } else if ("线宽" == strProName) { - this->m_dWidth = val.toInt(); + if ("曲线第二比例" == strGp) + m_twoBLWidth = val.toInt(); + else + this->m_dWidth = val.toInt(); } + else if ("第二比例大小" == strProName) + { + m_twoBLSize = val.toInt(); + } + else if ("自动计算二比例" == strProName) + { + m_twoBLAuto = val.toBool(); + } + else if ("绘制左二比例" == strProName) + { + m_twoBLDrawLeft = val.toBool(); + } + else if ("左二比例连续折返" == strProName) + { + m_twoBLLeftConBackAndForth = val.toBool(); + } + else if ("左二比例左刻度" == strProName) + { + m_twoBLLeftLeft = val.toString(); + } + else if ("左二比例右刻度" == strProName) + { + m_twoBLLeftRight = val.toString(); + } + else if ("绘制右二比例" == strProName) + { + m_twoBLDrawRight = val.toBool(); + } + else if ("右二比例连续折返" == strProName) + { + m_twoBLRightConBackAndForth = val.toBool(); + } + else if ("右二比例左刻度" == strProName) + { + m_twoBLRightLeft = val.toString(); + } + else if ("右二比例右刻度" == strProName) + { + m_twoBLRightRight = val.toString(); + } else if ("色板" == strProName) { this->m_nSchemeIndex = val.toInt(); @@ -1757,40 +1876,36 @@ bool FormInfo::setInfoProperty(QString strProName, QVariant val) } else if ("垂向绘制" == strProName) { + bDraw = false; this->m_bVerticaDrawing = val.toBool(); } else if ("旋转角度(°)" == strProName) { + bDraw = false; this->m_nRotationAngle = val.toInt(); } else if ("结论占比%" == strProName) { - bDraw = true; this->m_nConclusionProportion = val.toInt(); } else if ("显示位置(cm)" == strProName) { - bDraw = true; this->m_nShowPos = val.toInt(); } else if ("显示层号" == strProName) { - bDraw = true; this->m_bShowLayerNo = val.toBool(); } else if ("层号字体" == strProName) { - bDraw = true; this->m_layerFont = val.value(); } else if ("层号旋转" == strProName) { - bDraw = true; this->m_fLayerRotate = val.toFloat(); } else if ("单比例连续折返" == strProName) { - bDraw = true; this->m_bConBackAndForth = val.toBool(); } diff --git a/logPlus/forminfo.h b/logPlus/forminfo.h index 26c1abf..9b8077a 100644 --- a/logPlus/forminfo.h +++ b/logPlus/forminfo.h @@ -34,6 +34,9 @@ private: protected: void paintEvent(QPaintEvent *event); + // 绘制刻度 + void drawScale(QPainter& painter, const QRect& rect); + public slots: void dragEnterEvent(QDragEnterEvent* event); void dragMoveEvent(QDragMoveEvent* event); @@ -375,7 +378,7 @@ public: void setBackColor(QColor backColor); QColor getBackColor(); - bool setInfoProperty(QString strProName, QVariant val); + bool setInfoProperty(QString strProName, QVariant val, QString strGp=""); int getFillTypeIndex(); diff --git a/logPlus/qmycustomplot.cpp b/logPlus/qmycustomplot.cpp index 424ad80..bcd4c10 100644 --- a/logPlus/qmycustomplot.cpp +++ b/logPlus/qmycustomplot.cpp @@ -5004,12 +5004,40 @@ void QMyCustomPlot::s_changeDrawProperty(QVariantList vlist) { m_nWaveHei = varVal.toInt(); this->changePropertyWaveUpdate(); - } - else if ("颜色" == strProperty) - { - m_newColor = varVal.value(); - this->changePropertyWaveUpdate(); - } + } + else if ("线宽" == strProperty || "线型" == strProperty || "颜色" == strProperty) + { + QString strGroupVal = vlist.at(7).toString(); + this->changeGrapProperty(strGroupVal); + + } + //else if ("线型" == strProperty) + //{ + // QCPGraph* graph = this->graph(0); + // if (graph) + // { + // QPen pen = graph->pen(); + // pen.setStyle((Qt::PenStyle)varVal.toInt()); + // graph->setPen(pen); + // } + //} + // else if ("颜色" == strProperty) + //{ + // m_newColor = varVal.value(); + // QString strGroupVal = vlist.at(7).toString(); + // if ("曲线线型" == strGroupVal) + // { + // QCPGraph* graph = this->graph(0); + // if (graph) + // { + // QPen pen = graph->pen(); + // pen.setColor(m_newColor); + // graph->setPen(pen); + // } + // } + // else + // this->changePropertyWaveUpdate(); + // } else if ("方式" == strProperty) { m_nMode = varVal.toFloat(); @@ -5063,8 +5091,31 @@ void QMyCustomPlot::s_changeDrawProperty(QVariantList vlist) } else if ("单比例连续折返" == strProperty) { + QCPGraph *graph = this->graph(1); + if (graph) + graph->setVisible(false); + graph = this->graph(2); + if (graph) + graph->setVisible(false); this->updateCurveConBackAndForth(); } + else if ("第二比例大小" == strProperty || "左二比例连续折返" == strProperty || "右二比例连续折返" == strProperty) + { + this->updateCurveTwoBackAndForth(); + } + else if ("绘制左二比例" == strProperty) + { + QCPGraph *graph = this->graph(1); + if (graph) + graph->setVisible(varVal.toBool()); + } + else if ("绘制右二比例" == strProperty) + { + QCPGraph *graph = this->graph(2); + if (graph) + graph->setVisible(varVal.toBool()); + } + this->replot(); } } @@ -5697,7 +5748,14 @@ void QMyCustomPlot::s_ChangeLeftScale(QString strUuid, QString strSlfName, QStri double upper = m_iX2 + rg * m_nRightCross; yAxis->setRange(lower, upper); - updateCurveConBackAndForth(true); + FormInfo* pInfo = m_formTrack->getFormInfoByParameters(m_strUuid, m_strWellName, m_strTrackName, m_strLineName); + if (pInfo) + { + if (pInfo->m_bConBackAndForth) + updateCurveConBackAndForth(); + if (pInfo->m_twoBLSize > 0) + updateCurveTwoBackAndForth(); + } // replot(); } @@ -5730,7 +5788,14 @@ void QMyCustomPlot::s_ChangeRightScale(QString strUuid, QString strSlfName, QStr double upper = m_iX2 + rg * m_nRightCross; yAxis->setRange(lower, upper); - updateCurveConBackAndForth(true); + FormInfo* pInfo = m_formTrack->getFormInfoByParameters(m_strUuid, m_strWellName, m_strTrackName, m_strLineName); + if (pInfo) + { + if (pInfo->m_bConBackAndForth) + updateCurveConBackAndForth(); + if (pInfo->m_twoBLSize > 0) + updateCurveTwoBackAndForth(); + } // replot(); } @@ -6758,7 +6823,7 @@ void QMyCustomPlot::slot_replot() void QMyCustomPlot::addRandomGraph(QVector x, QVector y, QString strSlfName, QString strLineName, QString strAliasName, QString strUnit, - double newLeftScale, double newRightScale, QString strScaleType, QColor &newlineColor, double width, Qt::PenStyle lineStyle) + double newLeftScale, double newRightScale, QString strScaleType, QColor &newlineColor, double& width, Qt::PenStyle lineStyle) { //AppendConsole(PAI_INFO, "FormDraw addRandomGraph"); @@ -10223,7 +10288,7 @@ void QMyCustomPlot::setColGridVisible(bool bvis) } } -void QMyCustomPlot::updateCurveConBackAndForth(bool bkd) +void QMyCustomPlot::updateCurveConBackAndForth() { FormInfo* pInfo = m_formTrack->getFormInfoByParameters(m_strUuid, m_strWellName, m_strTrackName, m_strLineName); if (pInfo == NULL) @@ -10231,12 +10296,6 @@ void QMyCustomPlot::updateCurveConBackAndForth(bool bkd) return; } - if (bkd) - { - if (!pInfo->m_bConBackAndForth) - return; - } - int nzflag = 0; m_showX.clear(); m_showY.clear(); @@ -10244,7 +10303,7 @@ void QMyCustomPlot::updateCurveConBackAndForth(bool bkd) { m_showX.append(m_x.at(i)); double dy = m_y.at(i); - if (pInfo->m_bConBackAndForth) + if (pInfo->m_bConBackAndForth) // 单比例连续折返 { if (dy > pInfo->m_vmax) { @@ -10294,6 +10353,139 @@ void QMyCustomPlot::updateCurveConBackAndForth(bool bkd) } +void QMyCustomPlot::updateCurveTwoBackAndForth() +{ + FormInfo* pInfo = m_formTrack->getFormInfoByParameters(m_strUuid, m_strWellName, m_strTrackName, m_strLineName); + if (pInfo == NULL) + { + return; + } + if (pInfo->m_bConBackAndForth) + return; + + QVector tmpLeftX; + QVector tmpLeftY; + QVector tmpRightX; + QVector tmpRightY; + for (int i = 0; i < m_y.size(); i++) + { + tmpLeftX.append(m_x.at(i)); + tmpRightX.append(m_x.at(i)); + double dy = m_y.at(i); + if (pInfo->m_twoBLSize > 0) // 第二比例大小 + { + if (dy > pInfo->m_vmax) + { + dy = pInfo->m_vmin + ((dy - pInfo->m_vmax) / pInfo->m_twoBLSize); + tmpLeftY.append(dy); + } + else + { + if(pInfo->m_twoBLLeftConBackAndForth) + tmpLeftY.append(pInfo->m_vmin); + else + tmpLeftY.append(-9999); + } + + if (dy >-1000 && dy < pInfo->m_vmin) + { + dy = pInfo->m_vmax - ((pInfo->m_vmin - dy) / pInfo->m_twoBLSize); + tmpRightY.append(dy); + } + else + { + if (pInfo->m_twoBLRightConBackAndForth) + tmpRightY.append(pInfo->m_vmax); + else + tmpRightY.append(9999); + } + } + } + + QCPGraph *graph = this->graph(1);// addGraph(); + if (!graph) + { + graph = this->addGraph(); + QPen pen = graph->pen(); + pen.setColor(pInfo->m_twoBLlineColor); + pen.setWidthF(pInfo->m_twoBLWidth); + pen.setStyle(pInfo->m_twoBLlineStyle); + graph->setPen(pen); + } + if (pInfo->m_twoBLDrawLeft) + graph->setVisible(true); + else + graph->setVisible(false); + graph->setData(tmpLeftX, tmpLeftY); + + graph = this->graph(2);// addGraph(); + if (!graph) + { + graph = this->addGraph(); + QPen pen = graph->pen(); + pen.setColor(pInfo->m_twoBLlineColor); + pen.setWidthF(pInfo->m_twoBLWidth); + pen.setStyle(pInfo->m_twoBLlineStyle); + graph->setPen(pen); + } + if (pInfo->m_twoBLDrawRight) + graph->setVisible(true); + else + graph->setVisible(false); + graph->setData(tmpRightX, tmpRightY); + replot(); + +} + +void QMyCustomPlot::changeGrapProperty(QString strGroup) +{ + FormInfo* pInfo = m_formTrack->getFormInfoByParameters(m_strUuid, m_strWellName, m_strTrackName, m_strLineName); + if (pInfo == NULL) + { + return; + } + if (strGroup == "曲线第二比例") + { + QCPGraph* graph = this->graph(1); // 左二比例 + if (graph) + { + QPen pen = graph->pen(); + pen.setColor(pInfo->m_twoBLlineColor); + pen.setWidthF(pInfo->m_twoBLWidth); + pen.setStyle(pInfo->m_twoBLlineStyle); + graph->setPen(pen); + } + graph = this->graph(2); // 右二比例 + if (graph) + { + QPen pen = graph->pen(); + pen.setColor(pInfo->m_twoBLlineColor); + pen.setWidthF(pInfo->m_twoBLWidth); + pen.setStyle(pInfo->m_twoBLlineStyle); + graph->setPen(pen); + } + } + else + { + if ("曲线线型" == strGroup) + { + QCPGraph* graph = this->graph(0); + if (graph) + { + QPen pen = graph->pen(); + pen.setColor(pInfo->m_lineColor); + pen.setWidthF(pInfo->m_dWidth); + pen.setStyle(pInfo->m_lineStyle); + graph->setPen(pen); + } + } + else + this->changePropertyWaveUpdate(); // 波列 + + } + +} + //道宽改变后,避免井壁取心等组件变形,需要重新刷新 void QMyCustomPlot::resetPosition() { diff --git a/logPlus/qmycustomplot.h b/logPlus/qmycustomplot.h index 88a8461..37dc847 100644 --- a/logPlus/qmycustomplot.h +++ b/logPlus/qmycustomplot.h @@ -106,8 +106,11 @@ public: void setColGridVisible(bool bvis); // 单比例连续折返 - void updateCurveConBackAndForth(bool bkd = false); - + void updateCurveConBackAndForth(); + // 二比例 + void updateCurveTwoBackAndForth(); + // + void changeGrapProperty(QString strGroup); protected: @@ -377,7 +380,7 @@ public: //曲线 void addRandomGraph(QVector x, QVector y, QString strSlfName, QString strLineName, QString strAliasName, QString strUnit, - double newLeftScale, double newRightScale, QString strScaleType, QColor &newlineColor, double width, Qt::PenStyle lineStyle); + double newLeftScale, double newRightScale, QString strScaleType, QColor &newlineColor, double& width, Qt::PenStyle lineStyle); //文字结论 void addTextToPlot(double left_Low, double right_Hight, const QString strText, bool bRefresh=true, QColor crColor=QColor(255, 255, 255, 80));