From 770c07bd97e3309f41e1027f135838c0be8a4439 Mon Sep 17 00:00:00 2001 From: crqiqi77 Date: Mon, 30 Mar 2026 14:18:09 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B2=A9=E5=BF=83=E5=88=86=E6=9E=90=E5=B1=9E?= =?UTF-8?q?=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CallManage/CallManage.h | 2 +- logPlus/PropertyWidget.cpp | 103 ++++++++---- logPlus/TransparentDraggableCorePhysics.cpp | 116 +++++++------- logPlus/formdraw.cpp | 44 +++--- logPlus/forminfo.cpp | 56 ++++++- logPlus/forminfo.h | 6 +- logPlus/formtrack.cpp | 30 ++-- logPlus/qmycustomplot.cpp | 165 ++++++++++++-------- logPlus/qmycustomplot.h | 2 +- 9 files changed, 314 insertions(+), 210 deletions(-) diff --git a/CallManage/CallManage.h b/CallManage/CallManage.h index 783feea..d3e0a7d 100644 --- a/CallManage/CallManage.h +++ b/CallManage/CallManage.h @@ -183,7 +183,7 @@ signals: void sig_changeDepthProperty(QVariantList vlist); //改变岩心分析 - void sig_changeCorePhysicsProperty(QVariantList vlist); + void sig_changeCorePhysicsProperty(QVariantMap vlist); //右键--添加分段线 void sig_AddShiftLine(QString strUuid, double left_Low, double right_Hight); diff --git a/logPlus/PropertyWidget.cpp b/logPlus/PropertyWidget.cpp index 7163ab5..534b85a 100644 --- a/logPlus/PropertyWidget.cpp +++ b/logPlus/PropertyWidget.cpp @@ -296,22 +296,25 @@ void PropertyWidget::changedCorePhysicsProperty(QtProperty *qtProperty, const QV { int temp = variant.toInt(); this->m_formInfo->m_cp_lineWidth = temp; - this->m_tdCorePhysics->setCpLineWidth(temp); - QVariantList listCond; -// emit CallManage::getInstance()->sig_changeCorePhysicsProperty(listCond); + QVariantMap variantMap; + variantMap["lineWidth"] = temp; + emit CallManage::getInstance()->sig_changeCorePhysicsProperty(variantMap); } else if("颜色" == m_propertyData[qtProperty]) { QColor temp = variant.value(); this->m_formInfo->m_cp_lineColor = temp; - this->m_tdCorePhysics->setCpLineColor(temp); + + QVariantMap variantMap; + variantMap["lineColor"] = temp; + emit CallManage::getInstance()->sig_changeCorePhysicsProperty(variantMap); } else if("线型" == m_propertyData[qtProperty]) { + int temp = variant.value(); Qt::PenStyle newStyle = Qt::SolidLine; - int iStyle = variant.value(); - switch(iStyle) + switch(temp) { case 0: //无 @@ -341,43 +344,62 @@ void PropertyWidget::changedCorePhysicsProperty(QtProperty *qtProperty, const QV break; } this->m_formInfo->m_cp_lineStyle = newStyle; - this->m_tdCorePhysics->setCpLineStyle(newStyle); + + QVariantMap variantMap; + variantMap["lineStyle"] = temp; + emit CallManage::getInstance()->sig_changeCorePhysicsProperty(variantMap); } else if("杆状" == m_propertyData[qtProperty]) { bool temp = variant.toBool(); this->m_formInfo->m_cp_drawAsBar = temp; - this->m_tdCorePhysics->setCpDrawAsBar(temp); + + QVariantMap variantMap; + variantMap["drawAsBar"] = temp; + emit CallManage::getInstance()->sig_changeCorePhysicsProperty(variantMap); } else if("左界" == m_propertyData[qtProperty]) { bool temp = variant.toBool(); this->m_formInfo->m_cp_leftBoundary = temp; - this->m_tdCorePhysics->setCpLeftBoundary(temp); + + QVariantMap variantMap; + variantMap["leftBoundary"] = temp; + emit CallManage::getInstance()->sig_changeCorePhysicsProperty(variantMap); } else if("不绘零等无效值" == m_propertyData[qtProperty]) { bool temp = variant.toBool(); this->m_formInfo->m_cp_skipZeroInvalidValues = temp; - this->m_tdCorePhysics->setCpSkipZeroInvalidValues(temp); + + QVariantMap variantMap; + variantMap["skipZeroInvalidValues"] = temp; + emit CallManage::getInstance()->sig_changeCorePhysicsProperty(variantMap); } else if("绘制包络线" == m_propertyData[qtProperty]) { bool temp = variant.toBool(); this->m_formInfo->m_cp_drawEnvelope = temp; - this->m_tdCorePhysics->setCpDrawEnvelope(temp); + + QVariantMap variantMap; + variantMap["drawEnvelope"] = temp; + emit CallManage::getInstance()->sig_changeCorePhysicsProperty(variantMap); } else if("点状" == m_propertyData[qtProperty]) { bool temp = variant.toBool(); this->m_formInfo->m_cp_drawAsDot = temp; - this->m_tdCorePhysics->setCpDrawAsDot(temp); + + QVariantMap variantMap; + variantMap["drawAsDot"] = temp; + emit CallManage::getInstance()->sig_changeCorePhysicsProperty(variantMap); } else if("符号类型" == m_propertyData[qtProperty]) { + // 目前只有 圆形和矩形 + int temp = variant.value(); int newStyle = 0; - int iStyle = variant.value(); - switch(iStyle) + switch(temp) { case 0: // 圆形 @@ -397,25 +419,37 @@ void PropertyWidget::changedCorePhysicsProperty(QtProperty *qtProperty, const QV break; } this->m_formInfo->m_cp_symbolType = newStyle; - this->m_tdCorePhysics->setCpSymbolType(newStyle); + + QVariantMap variantMap; + variantMap["symbolType"] = temp; + emit CallManage::getInstance()->sig_changeCorePhysicsProperty(variantMap); } else if("边框颜色" == m_propertyData[qtProperty]) { QColor temp = variant.value(); this->m_formInfo->m_cp_symbolBorderColor = temp; - this->m_tdCorePhysics->setCpSymbolBorderColor(temp); + + QVariantMap variantMap; + variantMap["symbolBorderColor"] = temp; + emit CallManage::getInstance()->sig_changeCorePhysicsProperty(variantMap); } else if("大小" == m_propertyData[qtProperty]) { int temp = variant.toInt(); this->m_formInfo->m_cp_symbolSize = temp; - this->m_tdCorePhysics->setCpSymbolSize(temp); + + QVariantMap variantMap; + variantMap["symbolSize"] = temp; + emit CallManage::getInstance()->sig_changeCorePhysicsProperty(variantMap); } else if("填充颜色" == m_propertyData[qtProperty]) { QColor temp = variant.value(); this->m_formInfo->m_cp_symbolFillColor = temp; - this->m_tdCorePhysics->setCpSymbolFillColor(temp); + + QVariantMap variantMap; + variantMap["symbolFillColor"] = temp; + emit CallManage::getInstance()->sig_changeCorePhysicsProperty(variantMap); } else if("序号" == m_propertyData[qtProperty]) { @@ -449,32 +483,37 @@ void PropertyWidget::changedCorePhysicsProperty(QtProperty *qtProperty, const QV { double temp = variant.toDouble(); this->m_formInfo->m_cp_leftScale = temp; + this->m_formInfo->repaint(); + // this->m_tdCorePhysics->setCpLeftScale(temp); // 这个操作需要修改所有对象 - QMap m_mapDraggable_CorePhysics = this->m_tdCorePhysics->mPlot->m_mapDraggable_CorePhysics; - for (QMap::Iterator iter = m_mapDraggable_CorePhysics.begin(); iter != m_mapDraggable_CorePhysics.end(); iter++) - { - TransparentDraggableCorePhysics* pDraggableRect = (TransparentDraggableCorePhysics*)iter.value(); - pDraggableRect->setCpLeftScale(temp); - } +// QMap m_mapDraggable_CorePhysics = this->m_tdCorePhysics->mPlot->m_mapDraggable_CorePhysics; +// for (QMap::Iterator iter = m_mapDraggable_CorePhysics.begin(); iter != m_mapDraggable_CorePhysics.end(); iter++) +// { +// TransparentDraggableCorePhysics* pDraggableRect = (TransparentDraggableCorePhysics*)iter.value(); +// pDraggableRect->setCpLeftScale(temp); +// } } else if("右刻度" == m_propertyData[qtProperty]) { double temp = variant.toDouble(); this->m_formInfo->m_cp_rightScale = temp; + this->m_formInfo->repaint(); + // this->m_tdCorePhysics->setCpRightScale(temp); - QMap m_mapDraggable_CorePhysics = this->m_tdCorePhysics->mPlot->m_mapDraggable_CorePhysics; - for (QMap::Iterator iter = m_mapDraggable_CorePhysics.begin(); iter != m_mapDraggable_CorePhysics.end(); iter++) - { - TransparentDraggableCorePhysics* pDraggableRect = (TransparentDraggableCorePhysics*)iter.value(); - pDraggableRect->setCpRightScale(temp); - } +// QMap m_mapDraggable_CorePhysics = this->m_tdCorePhysics->mPlot->m_mapDraggable_CorePhysics; +// for (QMap::Iterator iter = m_mapDraggable_CorePhysics.begin(); iter != m_mapDraggable_CorePhysics.end(); iter++) +// { +// TransparentDraggableCorePhysics* pDraggableRect = (TransparentDraggableCorePhysics*)iter.value(); +// pDraggableRect->setCpRightScale(temp); +// } } else if("等分刻度数或自定义序列" == m_propertyData[qtProperty]) { double temp = variant.toDouble(); this->m_formInfo->m_cp_scaleDivisionsOrCustom = temp; - this->m_tdCorePhysics->setCpScaleDivisionsOrCustom(temp); + this->m_formInfo->repaint(); +// this->m_tdCorePhysics->setCpScaleDivisionsOrCustom(temp); } else if("刻度类型" == m_propertyData[qtProperty]) @@ -504,7 +543,7 @@ void PropertyWidget::changedCorePhysicsProperty(QtProperty *qtProperty, const QV { QString temp = variant.toString(); this->m_formInfo->m_strUnit = temp; - this->m_tdCorePhysics->setCpDisplayUnit(temp); +// this->m_tdCorePhysics->setCpDisplayUnit(temp); this->m_formInfo->repaint(); } else if("曲线单位" == m_propertyData[qtProperty]) diff --git a/logPlus/TransparentDraggableCorePhysics.cpp b/logPlus/TransparentDraggableCorePhysics.cpp index c2b3a2c..db00957 100644 --- a/logPlus/TransparentDraggableCorePhysics.cpp +++ b/logPlus/TransparentDraggableCorePhysics.cpp @@ -104,7 +104,6 @@ void TransparentDraggableCorePhysics::initRect() connect(mPlot, &QCustomPlot::mouseRelease, this, &TransparentDraggableCorePhysics::onMouseRelease); qcpItemLine = new QCPItemLine(mPlot); -// qcpItemLine->setPen(QPen(Qt::blue, 20)); qcpItemLine->setLayer("overlay"); // 确保在最上层 //上下边界 @@ -115,7 +114,7 @@ void TransparentDraggableCorePhysics::initRect() tracer->setGraph(nullptr); // 不关联曲线,自由定位 tracer->setStyle(QCPItemTracer::tsCircle); // 圆形,可选:tsSquare, tsCross, tsPlus等 tracer->setSize(3); // 点的大小(像素) - tracer->setPen(QPen(Qt::red)); // 边框颜色 + tracer->setPen(QPen(Qt::black)); // 边框颜色 tracer->setBrush(QBrush(QColor(0, 0, 0, 0))); // 黄色半透明,Alpha=128 tracer->setInterpolating(false); // 绑定到线条终点(关键!) @@ -167,7 +166,7 @@ void TransparentDraggableCorePhysics::onMousePress(QMouseEvent *event) TransparentDraggableCorePhysics *tmpLine = (TransparentDraggableCorePhysics*)mPlot->m_SelectShiftLine; QPen pen = tmpLine->qcpItemLine->pen(); // pen.setWidth(getCpLineWidth()); - pen.setColor(Qt::black); // 线宽 + pen.setColor(this->getCpLineColor()); // 线宽 tmpLine->qcpItemLine->setPen(pen); // tmpLine->qcpItemLine->setPen(QPen(Qt::black)); } @@ -345,12 +344,11 @@ int TransparentDraggableCorePhysics::getCpLineWidth() const void TransparentDraggableCorePhysics::setCpLineWidth(int value) { this->m_cp_lineWidth = value; - QList itemLine = this->mPlot->findChildren(); - foreach (QCPItemLine *tracer, itemLine) { - QPen pen = tracer->pen(); - pen.setWidth(value); // 线宽 - tracer->setPen(pen); - } + + QPen pen = this->qcpItemLine->pen(); + pen.setWidth(value); // 线宽 + this->qcpItemLine->setPen(pen); + } QColor TransparentDraggableCorePhysics::getCpLineColor() const @@ -362,14 +360,12 @@ void TransparentDraggableCorePhysics::setCpLineColor(QColor value) { this->m_cp_lineColor = value; - QList itemLine = this->mPlot->findChildren(); - foreach (QCPItemLine *tracer, itemLine) { - QPen pen = tracer->pen(); - pen.setColor(value); - tracer->setPen(pen); - } + QPen pen = this->qcpItemLine->pen(); + pen.setColor(value); + this->qcpItemLine->setPen(pen); } + Qt::PenStyle TransparentDraggableCorePhysics::getCpLineStyle() const { return this->m_cp_lineStyle; @@ -379,12 +375,10 @@ void TransparentDraggableCorePhysics::setCpLineStyle(Qt::PenStyle value) { this->m_cp_lineStyle = value; - QList itemLine = this->mPlot->findChildren(); - foreach (QCPItemLine *tracer, itemLine) { - QPen pen = tracer->pen(); - pen.setStyle(value); - tracer->setPen(pen); - } + QPen pen = this->qcpItemLine->pen(); + pen.setStyle(value); + this->qcpItemLine->setPen(pen); + } double TransparentDraggableCorePhysics::getCpLeftScale() const @@ -396,9 +390,9 @@ void TransparentDraggableCorePhysics::setCpLeftScale(double value) { this->m_cp_leftScale = value; - this->mPlot->yAxis2->setRange(value, this->mPlot->yAxis2->range().upper); - // 重新绘制图形 - this->setRange(this->m_left_Low, this->m_left_Low, this->getCpCoreValue(), false); +// this->mPlot->yAxis2->setRange(value, this->mPlot->yAxis2->range().upper); +// // 重新绘制图形 +// this->setRange(this->m_left_Low, this->m_left_Low, this->getCpCoreValue(), false); } double TransparentDraggableCorePhysics::getCpRightScale() const @@ -410,9 +404,9 @@ void TransparentDraggableCorePhysics::setCpRightScale(double value) { this->m_cp_rightScale = value; - this->mPlot->yAxis2->setRange(this->mPlot->yAxis2->range().lower, value); - // 重新绘制图形 - this->setRange(this->m_left_Low, this->m_left_Low, this->getCpCoreValue(), false); +// this->mPlot->yAxis2->setRange(this->mPlot->yAxis2->range().lower, value); +// // 重新绘制图形 +// this->setRange(this->m_left_Low, this->m_left_Low, this->getCpCoreValue(), false); } int TransparentDraggableCorePhysics::getCpScaleType() const @@ -424,22 +418,22 @@ void TransparentDraggableCorePhysics::setCpScaleType(int value) { this->m_cp_scaleType = value; - int newStyle = 0; - switch(value) - { - case 0: - // 线性 - this->mPlot->yAxis2->setScaleType(QCPAxis::stLinear); - break; - case 1: - // 对数 - this->mPlot->yAxis2->setScaleType(QCPAxis::stLogarithmic); - break; - case 2: - // 倾角 没有倾角类型 - this->mPlot->yAxis2->setScaleType(QCPAxis::stLogarithmic); - break; - } +// int newStyle = 0; +// switch(value) +// { +// case 0: +// // 线性 +// this->mPlot->yAxis2->setScaleType(QCPAxis::stLinear); +// break; +// case 1: +// // 对数 +// this->mPlot->yAxis2->setScaleType(QCPAxis::stLogarithmic); +// break; +// case 2: +// // 倾角 没有倾角类型 +// this->mPlot->yAxis2->setScaleType(QCPAxis::stLogarithmic); +// break; +// } } int TransparentDraggableCorePhysics::getCpScaleDivisionsOrCustom() const @@ -451,23 +445,23 @@ void TransparentDraggableCorePhysics::setCpScaleDivisionsOrCustom(int value) { this->m_cp_scaleDivisionsOrCustom = value; - // 创建文本刻度 Ticker - QSharedPointer textTicker(new QCPAxisTickerText); - double minVal = this->mPlot->yAxis2->range().lower; - double maxVal = this->mPlot->yAxis2->range().upper; - // 计算步长:(最大值 - 最小值) / 等分数 - double step = (maxVal - minVal) / value; - // 生成刻度 - for (int i = 0; i <= value; ++i) { - double value = minVal + step * i; - // 取整显示(34.0 显示为 "34") - QString label = QString::number(qRound(value)); - textTicker->addTick(value, label); - } - // 应用 Ticker - this->mPlot->yAxis2->setTicker(textTicker); - // 设置范围(稍微留边距,让刻度显示完整) -// this->mPlot->yAxis2->setRange(minVal - step * 0.1, maxVal + step * 0.1); +// // 创建文本刻度 Ticker +// QSharedPointer textTicker(new QCPAxisTickerText); +// double minVal = this->mPlot->yAxis2->range().lower; +// double maxVal = this->mPlot->yAxis2->range().upper; +// // 计算步长:(最大值 - 最小值) / 等分数 +// double step = (maxVal - minVal) / value; +// // 生成刻度 +// for (int i = 0; i <= value; ++i) { +// double value = minVal + step * i; +// // 取整显示(34.0 显示为 "34") +// QString label = QString::number(qRound(value)); +// textTicker->addTick(value, label); +// } +// // 应用 Ticker +// this->mPlot->yAxis2->setTicker(textTicker); +// // 设置范围(稍微留边距,让刻度显示完整) +//// this->mPlot->yAxis2->setRange(minVal - step * 0.1, maxVal + step * 0.1); } QString TransparentDraggableCorePhysics::getCpDisplayUnit() const @@ -509,7 +503,7 @@ void TransparentDraggableCorePhysics::setCpCurveScale(QFont value) { this->m_cp_curveScale = value; - this->mPlot->yAxis2->setTickLabelFont(value); +// this->mPlot->yAxis2->setTickLabelFont(value); } bool TransparentDraggableCorePhysics::getCpDrawAsBar() const diff --git a/logPlus/formdraw.cpp b/logPlus/formdraw.cpp index 7fbeea7..f4a00cc 100644 --- a/logPlus/formdraw.cpp +++ b/logPlus/formdraw.cpp @@ -6959,30 +6959,28 @@ void FormDraw::initCorePhysics(QMyCustomPlot *widget, QString strSlfName, QStrin widget->xAxis->setTicks(false); widget->yAxis->setTicks(false); widget->xAxis2->setTicks(false); - widget->yAxis2->setTicks(true); + widget->yAxis2->setTicks(false); - widget->yAxis2->setTickLabels(true); - widget->yAxis2->setTickLabelSide(QCPAxis::lsInside); - - - widget->yAxis2->setRange(0, 100); - // 设置刻度 - // 创建文本刻度 Ticker - QSharedPointer textTicker(new QCPAxisTickerText); - double minVal = widget->yAxis2->range().lower; - double maxVal = widget->yAxis2->range().upper; - int value = 2; - // 计算步长:(最大值 - 最小值) / 等分数 - double step = (maxVal - minVal) / value; - // 生成刻度 - for (int i = 0; i <= value; ++i) { - double value = minVal + step * i; - // 取整显示(34.0 显示为 "34") - QString label = QString::number(qRound(value)); - textTicker->addTick(value, label); - } - // 应用 Ticker - widget->yAxis2->setTicker(textTicker); +// widget->yAxis2->setTickLabels(true); +// widget->yAxis2->setTickLabelSide(QCPAxis::lsInside); +// widget->yAxis2->setRange(0, 100); +// // 设置刻度 +// // 创建文本刻度 Ticker +// QSharedPointer textTicker(new QCPAxisTickerText); +// double minVal = widget->yAxis2->range().lower; +// double maxVal = widget->yAxis2->range().upper; +// int value = 2; +// // 计算步长:(最大值 - 最小值) / 等分数 +// double step = (maxVal - minVal) / value; +// // 生成刻度 +// for (int i = 0; i <= value; ++i) { +// double value = minVal + step * i; +// // 取整显示(34.0 显示为 "34") +// QString label = QString::number(qRound(value)); +// textTicker->addTick(value, label); +// } +// // 应用 Ticker +// widget->yAxis2->setTicker(textTicker); // 加载slf文件 开始 diff --git a/logPlus/forminfo.cpp b/logPlus/forminfo.cpp index 195d5c7..5050c84 100644 --- a/logPlus/forminfo.cpp +++ b/logPlus/forminfo.cpp @@ -800,20 +800,62 @@ void FormInfo::paintEvent(QPaintEvent* event) } if(m_strType == "tableObject" && m_strLineName == "CORE_PHYSICS") { + painter.setPen(Qt::black); + // 字体->曲线单位 QFont oldFont = painter.font(); painter.setFont(m_strUnitFont); + // 显示单位 painter.drawText(rect.left()+10, rect.top() + rect.height() * 2 / 3, rect.width(), rect.height() / 3, Qt::AlignCenter, m_strUnit); painter.setFont(oldFont); - // 显示刻度 - if (m_bShowScale) + + // 刻度的那条线 + int baseY = rect.top() + rect.height() * 2 / 3; + int textH = rect.height() / 3; + // 关键:线 Y 坐标 = 文字底部,但不超过 rect 底部 + int lineY = baseY + textH - 7; + int x1 = rect.left() + 20; + int x2 = rect.right() - 30; + painter.drawLine(x1, lineY, x2, lineY); + + // 字体->曲线刻度 + oldFont = painter.font(); + painter.setFont(m_cp_curveScale); + // ========== 在这条线上画刻度 + 数字 ========== + int minVal = this->m_cp_leftScale; // 最小值(可变) + int maxVal = this->m_cp_rightScale; // 最大值(可变) + if(this->m_cp_scaleDivisionsOrCustom <= 0) { - 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)); + this->m_cp_scaleDivisionsOrCustom = 1; } + int tickCount = this->m_cp_scaleDivisionsOrCustom + 1; // 总刻度等分数(可变,比如 5/10/20) + // 样式配置 + int tickHeight = 6; // 小刻度高度 + int textOffsetUp = 18; // 数字往上偏移量(解决被遮挡问题) + // 计算总步长(自动等分) + double step = (maxVal - minVal) * 1.0 / (tickCount - 1); + // 开始画所有刻度 + 数字 + for (int i = 0; i < tickCount; ++i) { + // 当前刻度值(自动计算) + int val = minVal + qRound(step * i); + // 计算在横线上的 X 坐标 + qreal ratio = (val - minVal) * 1.0 / (maxVal - minVal); + int tickX = x1 + ratio * (x2 - x1); + // 画向上的小刻度线 + painter.drawLine(tickX, lineY, tickX, lineY - tickHeight); + // 画刻度数字(在线上方,不遮挡) + painter.drawText( + tickX - 12, + lineY - tickHeight - textOffsetUp, + 24, 14, + Qt::AlignCenter, + QString::number(val) + ); + } + painter.setFont(oldFont); + + } + QWidget::paintEvent(event); } diff --git a/logPlus/forminfo.h b/logPlus/forminfo.h index 1f7bc1c..53116bc 100644 --- a/logPlus/forminfo.h +++ b/logPlus/forminfo.h @@ -225,10 +225,10 @@ public: Qt::PenStyle m_cp_lineStyle; // 线型 double m_cp_leftScale = 0; // 左刻度 double m_cp_rightScale = 100; // 右刻度 - int m_cp_scaleDivisionsOrCustom = 2; // 等分刻度数或自定序列 + int m_cp_scaleDivisionsOrCustom = 1; // 等分刻度数或自定序列 int m_cp_scaleType = 0; // 刻度类型 - QFont m_cp_curveUnit; // 曲线单位 - QFont m_cp_curveScale; // 曲线刻度 + QFont m_cp_curveUnit = QFont("微软雅黑", 7); // 曲线单位 + QFont m_cp_curveScale = QFont("微软雅黑", 7); // 曲线刻度 bool m_cp_drawAsBar = true; // 杆状 bool m_cp_leftBoundary = true; // 左界 bool m_cp_skipZeroInvalidValues = false; // 不绘零等无效值 diff --git a/logPlus/formtrack.cpp b/logPlus/formtrack.cpp index a84b436..09b42d4 100644 --- a/logPlus/formtrack.cpp +++ b/logPlus/formtrack.cpp @@ -681,11 +681,11 @@ void FormTrack::s_AddTableLine(QString strSlfName, QString strWellName, QString formInfo->m_strAliasName = listOtherProperty[3]; // 线宽 formInfo->m_cp_lineWidth = listOtherProperty[4].toInt(); - QVariantList listCond; - listCond.append(listOtherProperty[4].toInt()); + QVariantMap variantMap; + variantMap["lineWidth"] = listOtherProperty[4].toInt(); // 线条颜色 formInfo->m_cp_lineColor = listOtherProperty[5]; - listCond.append(listOtherProperty[5]); + variantMap["lineColor"] = listOtherProperty[5]; // 线型 Qt::PenStyle newStyle = Qt::SolidLine; int iStyle = listOtherProperty[6].toInt(); @@ -719,7 +719,7 @@ void FormTrack::s_AddTableLine(QString strSlfName, QString strWellName, QString break; } formInfo->m_cp_lineStyle = newStyle; - listCond.append(listOtherProperty[6].toInt()); + variantMap["lineStyle"] = (listOtherProperty[6].toInt()); // 左刻度 formInfo->m_cp_leftScale = listOtherProperty[7].toInt(); formInfo->m_vmin = listOtherProperty[7].toInt(); @@ -764,36 +764,36 @@ void FormTrack::s_AddTableLine(QString strSlfName, QString strWellName, QString } // 杆状 formInfo->m_cp_drawAsBar = (listOtherProperty[15] == "1"); - listCond.append(formInfo->m_cp_drawAsBar); + variantMap["drawAsBar"] = (formInfo->m_cp_drawAsBar); // 左界 formInfo->m_cp_leftBoundary = (listOtherProperty[16] == "1"); - listCond.append(formInfo->m_cp_leftBoundary); + variantMap["leftBoundary"] = (formInfo->m_cp_leftBoundary); // 不绘零等无效值 formInfo->m_cp_skipZeroInvalidValues = (listOtherProperty[17] == "1"); - listCond.append(formInfo->m_cp_skipZeroInvalidValues); + variantMap["skipZeroInvalidValues"] = (formInfo->m_cp_skipZeroInvalidValues); // 绘制包络线 formInfo->m_cp_drawEnvelope = (listOtherProperty[18] == "1"); - listCond.append(formInfo->m_cp_drawEnvelope); + variantMap["drawEnvelope"] = (formInfo->m_cp_drawEnvelope); // 点状 formInfo->m_cp_drawAsDot = (listOtherProperty[19] == "1"); - listCond.append(formInfo->m_cp_drawAsDot); + variantMap["drawAsDot"] = (formInfo->m_cp_drawAsDot); // 符号类型 formInfo->m_cp_symbolType = listOtherProperty[20].toInt(); - listCond.append(formInfo->m_cp_symbolType); + variantMap["symbolType"] = (formInfo->m_cp_symbolType); // 边框颜色 formInfo->m_cp_symbolBorderColor = listOtherProperty[21]; - listCond.append(formInfo->m_cp_symbolBorderColor); + variantMap["symbolBorderColor"] = formInfo->m_cp_symbolBorderColor; // 大小 formInfo->m_cp_symbolSize = listOtherProperty[22].toInt(); - listCond.append(formInfo->m_cp_symbolSize); + variantMap["symbolSize"] = (formInfo->m_cp_symbolSize); // 填充颜色 formInfo->m_cp_symbolFillColor = listOtherProperty[23]; - listCond.append(formInfo->m_cp_symbolFillColor); + variantMap["symbolFillColor"] = (formInfo->m_cp_symbolFillColor); // 字段名称 formInfo->m_cp_fieldName = listOtherProperty[24].toInt(); - listCond.append(formInfo->m_cp_fieldName); + variantMap["fieldName"] = (formInfo->m_cp_fieldName); - emit CallManage::getInstance()->sig_changeCorePhysicsProperty(listCond); + emit CallManage::getInstance()->sig_changeCorePhysicsProperty(variantMap); } } diff --git a/logPlus/qmycustomplot.cpp b/logPlus/qmycustomplot.cpp index e7f1d70..f69bac9 100644 --- a/logPlus/qmycustomplot.cpp +++ b/logPlus/qmycustomplot.cpp @@ -142,7 +142,7 @@ QMyCustomPlot::QMyCustomPlot(QWidget *parent, QString strSlfName, QString strWel // 深度属性修改 connect(CallManage::getInstance(), SIGNAL(sig_changeDepthProperty(QVariantList)), this, SLOT(s_changeDepthProperty(QVariantList))); // 岩心分析 - connect(CallManage::getInstance(), SIGNAL(sig_changeCorePhysicsProperty(QVariantList)), this, SLOT(s_changeCorePhysicsProperty(QVariantList))); + connect(CallManage::getInstance(), SIGNAL(sig_changeCorePhysicsProperty(QVariantMap)), this, SLOT(s_changeCorePhysicsProperty(QVariantMap))); //改变固井曲线名 connect(CallManage::getInstance(), SIGNAL(sig_changeGujingLine(QString, QString, QString, QString, QString, QString)), this, SLOT(s_changeGujingLine(QString, QString, QString, QString, QString, QString))); @@ -4841,76 +4841,107 @@ void QMyCustomPlot::s_changeDepthProperty(QVariantList vlist) } // 岩心分析 -void QMyCustomPlot::s_changeCorePhysicsProperty(QVariantList vlist) +void QMyCustomPlot::s_changeCorePhysicsProperty(QVariantMap variantMap) { - int lineWidth = vlist.at(0).toInt(); - QColor lineColor = vlist[1].value(); - int iStyle = vlist.at(2).toInt(); - Qt::PenStyle newStyle = Qt::SolidLine; - 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; - } - // 杆状 - bool drawAsBar = vlist.at(3).toBool(); - // 左界 - bool leftBoundary = vlist.at(4).toBool(); - // 不绘零等无效值 - bool skipZeroInvalidValues = vlist.at(5).toBool(); - // 绘制包络线 - bool drawEnvelope = vlist.at(6).toBool(); - // 点状 - bool drawAsDot = vlist.at(7).toBool(); - // 符号类型 - int symbolType = vlist.at(8).toInt(); - // 边框颜色 - QColor symbolBorderColor = vlist[9].value(); - // 大小 - int symbolSize = vlist.at(10).toInt(); - // 填充颜色 - QColor symbolFillColor = vlist[11].value(); - - TransparentDraggableCorePhysics *pDraggableRect =NULL; + TransparentDraggableCorePhysics *tdCorePhysics = NULL; for (QMap::Iterator iter = m_mapDraggable_CorePhysics.begin(); iter != m_mapDraggable_CorePhysics.end(); iter++) { - pDraggableRect = (TransparentDraggableCorePhysics*)iter.value(); - pDraggableRect->setCpLineWidth(lineWidth); - pDraggableRect->setCpLineColor(lineColor); - pDraggableRect->setCpLineStyle(newStyle); - pDraggableRect->setCpDrawAsBar(drawAsBar); - pDraggableRect->setCpLeftBoundary(leftBoundary); - pDraggableRect->setCpDrawAsDot(drawAsDot); - pDraggableRect->setCpSymbolType(symbolType); - pDraggableRect->setCpSymbolBorderColor(symbolBorderColor); - pDraggableRect->setCpSymbolSize(symbolSize); - pDraggableRect->setCpSymbolFillColor(symbolFillColor); + tdCorePhysics = (TransparentDraggableCorePhysics*)iter.value(); + // 线宽 + if(variantMap["lineWidth"].isValid()) + { + tdCorePhysics->setCpLineWidth(variantMap["lineWidth"].toInt()); + } + // 颜色 + if(variantMap["lineColor"].isValid()) + { + tdCorePhysics->setCpLineColor(variantMap["lineColor"].value()); + } + // 线形 + if(variantMap["lineStyle"].isValid()) + { + int lineStyle = variantMap["lineStyle"].toInt(); + Qt::PenStyle penStyle = Qt::SolidLine; + switch(lineStyle) + { + case 0: + //无 + penStyle = Qt::NoPen; + break; + case 1: + //实线 + penStyle = Qt::SolidLine; + break; + case 2: + //虚线 + penStyle = Qt::DashLine; + break; + case 3: + //点线 + penStyle = Qt::DotLine; + break; + case 4: + //虚点线 + penStyle = Qt::DashDotLine; + break; + case 5: + //虚点点线 + penStyle = Qt::DashDotDotLine; + break; + default: + break; + } + tdCorePhysics->setCpLineStyle(penStyle); + } + // 杆状 + if(variantMap["drawAsBar"].isValid()) + { + tdCorePhysics->setCpDrawAsBar(variantMap["drawAsBar"].toBool()); + } + // 左界 + if(variantMap["leftBoundary"].isValid()) + { + tdCorePhysics->setCpLeftBoundary(variantMap["leftBoundary"].toBool()); + } + + // 不绘零等无效值 + if(variantMap["skipZeroInvalidValues"].isValid()) + { + tdCorePhysics->setCpSkipZeroInvalidValues(variantMap["skipZeroInvalidValues"].toBool()); + } + // 绘制包络线 + if(variantMap["drawEnvelope"].isValid()) + { + tdCorePhysics->setCpDrawEnvelope(variantMap["drawEnvelope"].toBool()); + } + // 点状 + if(variantMap["drawAsDot"].isValid()) + { + tdCorePhysics->setCpDrawAsDot(variantMap["drawAsDot"].toBool()); + } + + // 符号类型 + if(variantMap["symbolType"].isValid()) + { + tdCorePhysics->setCpSymbolType(variantMap["symbolType"].toInt()); + } + // 边框颜色 + if(variantMap["symbolBorderColor"].isValid()) + { + tdCorePhysics->setCpSymbolBorderColor(variantMap["symbolBorderColor"].value()); + } + // 大小 + if(variantMap["symbolSize"].isValid()) + { + tdCorePhysics->setCpSymbolSize(variantMap["symbolSize"].toInt()); + } + // 填充颜色 + if(variantMap["symbolFillColor"].isValid()) + { + tdCorePhysics->setCpSymbolFillColor(variantMap["symbolFillColor"].value()); + } } - this->replot(); + this->replot(); } //校深线段 diff --git a/logPlus/qmycustomplot.h b/logPlus/qmycustomplot.h index f7ba52c..7d17e2b 100644 --- a/logPlus/qmycustomplot.h +++ b/logPlus/qmycustomplot.h @@ -551,7 +551,7 @@ public slots: void s_changeDepthProperty(QVariantList vlist); // 岩心分析 - void s_changeCorePhysicsProperty(QVariantList vlist); + void s_changeCorePhysicsProperty(QVariantMap vlist); void onAddRect();