From 770c07bd97e3309f41e1027f135838c0be8a4439 Mon Sep 17 00:00:00 2001 From: crqiqi77 Date: Mon, 30 Mar 2026 14:18:09 +0800 Subject: [PATCH 1/7] =?UTF-8?q?=E5=B2=A9=E5=BF=83=E5=88=86=E6=9E=90?= =?UTF-8?q?=E5=B1=9E=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(); From b7ac133cf675a3f6d8246c619f981c3febb0e176 Mon Sep 17 00:00:00 2001 From: zhaolei <353719554@qq.com> Date: Mon, 30 Mar 2026 15:02:34 +0800 Subject: [PATCH 2/7] =?UTF-8?q?=E5=AF=BC=E5=85=A5=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=88=B7=E6=96=B0=E6=A0=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- logPlus/qtprojectwidgets.cpp | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/logPlus/qtprojectwidgets.cpp b/logPlus/qtprojectwidgets.cpp index 965ce55..a176eb6 100644 --- a/logPlus/qtprojectwidgets.cpp +++ b/logPlus/qtprojectwidgets.cpp @@ -216,6 +216,7 @@ void QtProjectWidgets::s_loadTreeWidget(QString fileFull) //展开树图 ui->treeWidget->expandItem(parent); + itemIndex->setExpanded(true); } void QtProjectWidgets::loadIndexSysTree(QTreeWidgetItem *parent, QString fileFull, QString prjname) @@ -1286,21 +1287,37 @@ void QtProjectWidgets::onImportSingleWellLogData() QTreeWidgetItem *wellItem = *ui->treeWidget->selectedItems().begin(); QString wellname = wellItem->text(0); - if (wellname == "井组") + QString wellroundname = wellname; + QString strTreeTag = wellItem->data(0, Qt::UserRole).toString(); + if (strTreeTag == "wells") //井组 { QFileInfo temDir(file_name); QString tempWellName=temDir.completeBaseName(); tempWellName.replace(" ","");//whp add 2020.3.3 删除井名中的空格 //m_WellLogRoundInfo->SetName(tempWellName.toStdString()); wellname = tempWellName; + wellroundname = wellname; } - QString wellroundname = wellname; + else if (strTreeTag == "wellname") //井名 + { + + } + else if (strTreeTag == "wellItem") //井次 + { + wellname = wellItem->parent()->text(0); + } ImportDataDialog *pDialog = new ImportDataDialog(NULL,wellname,wellroundname); QTreeWidgetItem rootItem = *ui->treeWidget->topLevelItem(0); pDialog->SetProjectname(rootItem.text(0)); pDialog->DisplayFileInformationAreaData(vConvertor,listFiles[0]); if ( pDialog->exec() == QDialog::Accepted ) + { + QString strProjectFolder = GetProjectFolder(); + QString strProjectFile = strProjectFolder + g_prjname; + strProjectFile += ".wwl"; + s_OpenProject(strProjectFile); return ; + } } } From dc1f6604dc8557ffcfaea79c643b96ce18859df7 Mon Sep 17 00:00:00 2001 From: crqiqi77 Date: Mon, 30 Mar 2026 15:20:41 +0800 Subject: [PATCH 3/7] =?UTF-8?q?=E5=B2=A9=E5=BF=83=E5=88=86=E6=9E=90?= =?UTF-8?q?=E5=B1=9E=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- logPlus/PropertyWidget.cpp | 10 +- logPlus/TransparentDraggableCorePhysics.cpp | 187 ++++++++++---------- logPlus/TransparentDraggableCorePhysics.h | 40 ++--- logPlus/qmycustomplot.cpp | 4 + 4 files changed, 120 insertions(+), 121 deletions(-) diff --git a/logPlus/PropertyWidget.cpp b/logPlus/PropertyWidget.cpp index 534b85a..466827e 100644 --- a/logPlus/PropertyWidget.cpp +++ b/logPlus/PropertyWidget.cpp @@ -536,7 +536,7 @@ void PropertyWidget::changedCorePhysicsProperty(QtProperty *qtProperty, const QV break; } this->m_formInfo->m_cp_scaleType = newStyle; - this->m_tdCorePhysics->setCpScaleType(newStyle); +// this->m_tdCorePhysics->setCpScaleType(newStyle); } else if("显示单位" == m_propertyData[qtProperty]) @@ -3449,6 +3449,14 @@ void PropertyWidget::initCorePhysicsItemProperty(TransparentDraggableCorePhysics { //初始化,清空 InitCurrentViewInfo(); +// qDebug() << "=========-----this:" << tdImage << " mPlot:" << tdImage->mPlot; +// QMyCustomPlot *mPlot = tdImage->mPlot; +// qDebug() << tdImage->mPlot->m_strUuid << "===="; +// qDebug() << tdImage->mPlot->m_strWellName << "===="; +// qDebug() << tdImage->mPlot->m_strTrackName << "===="; +// qDebug() << tdImage->mPlot->m_strLineName << "===="; +// qDebug() << tdImage->mPlot->m_formTrack << "===="; + FormInfo* formInfo = tdImage->mPlot->m_formTrack->getFormInfoByParameters(tdImage->mPlot->m_strUuid, tdImage->mPlot->m_strWellName, tdImage->mPlot->m_strTrackName, tdImage->mPlot->m_strLineName); if (formInfo != NULL) diff --git a/logPlus/TransparentDraggableCorePhysics.cpp b/logPlus/TransparentDraggableCorePhysics.cpp index db00957..92bceed 100644 --- a/logPlus/TransparentDraggableCorePhysics.cpp +++ b/logPlus/TransparentDraggableCorePhysics.cpp @@ -50,7 +50,7 @@ void TransparentDraggableCorePhysics::setRange(double left_Low, double right_Hig } m_lY1 = lY1; // lY2除以实际左到右刻度数值 - lY2 = lY2 / (getCpRightScale() - getCpLeftScale()) * 100; +// lY2 = lY2 / (getCpRightScale() - getCpLeftScale()) * 100; qcpItemLine->start->setCoords(left_Low, lY1);//圆心位置 @@ -122,6 +122,7 @@ void TransparentDraggableCorePhysics::initRect() tracer->setVisible(false); qDebug() << "Creating qcpItemLine"; +// qDebug() << "=========this:" << this << " mPlot:" << mPlot; } void TransparentDraggableCorePhysics::updateHandles() @@ -306,35 +307,25 @@ void TransparentDraggableCorePhysics::setCpCoreValue(double value) qcpItemLine->end->setCoords(currentX, value); } -double TransparentDraggableCorePhysics::getCpExampleAreaHeightCm() const -{ - return this->m_cp_exampleAreaHeightCm; -} +//double TransparentDraggableCorePhysics::getCpRotationAngle() const +//{ +// return this->m_cp_rotationAngle; +//} -void TransparentDraggableCorePhysics::setCpExampleAreaHeightCm(double value) -{ - this->m_cp_exampleAreaHeightCm = value; -} +//void TransparentDraggableCorePhysics::setCpRotationAngle(double value) +//{ +// this->m_cp_rotationAngle = value; +//} -double TransparentDraggableCorePhysics::getCpRotationAngle() const -{ - return this->m_cp_rotationAngle; -} +//QString TransparentDraggableCorePhysics::getCpDisplayName() const +//{ +// return this->m_cp_displayName; +//} -void TransparentDraggableCorePhysics::setCpRotationAngle(double value) -{ - this->m_cp_rotationAngle = value; -} - -QString TransparentDraggableCorePhysics::getCpDisplayName() const -{ - return this->m_cp_displayName; -} - -void TransparentDraggableCorePhysics::setCpDisplayName(const QString &value) -{ - this->m_cp_displayName = value; -} +//void TransparentDraggableCorePhysics::setCpDisplayName(const QString &value) +//{ +// this->m_cp_displayName = value; +//} int TransparentDraggableCorePhysics::getCpLineWidth() const { @@ -381,88 +372,88 @@ void TransparentDraggableCorePhysics::setCpLineStyle(Qt::PenStyle value) } -double TransparentDraggableCorePhysics::getCpLeftScale() const -{ - return this->m_cp_leftScale; -} +//double TransparentDraggableCorePhysics::getCpLeftScale() const +//{ +// return this->m_cp_leftScale; +//} -void TransparentDraggableCorePhysics::setCpLeftScale(double value) -{ - this->m_cp_leftScale = value; +//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 -{ - return this->m_cp_rightScale; -} +//double TransparentDraggableCorePhysics::getCpRightScale() const +//{ +// return this->m_cp_rightScale; +//} -void TransparentDraggableCorePhysics::setCpRightScale(double value) -{ - this->m_cp_rightScale = value; +//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 -{ - return this->m_cp_scaleType; -} +//int TransparentDraggableCorePhysics::getCpScaleType() const +//{ +// return this->m_cp_scaleType; +//} -void TransparentDraggableCorePhysics::setCpScaleType(int value) -{ - this->m_cp_scaleType = value; +//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 -{ - return this->m_cp_scaleDivisionsOrCustom; -} +//int TransparentDraggableCorePhysics::getCpScaleDivisionsOrCustom() const +//{ +// return this->m_cp_scaleDivisionsOrCustom; +//} -void TransparentDraggableCorePhysics::setCpScaleDivisionsOrCustom(int value) -{ - this->m_cp_scaleDivisionsOrCustom = value; +//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 { diff --git a/logPlus/TransparentDraggableCorePhysics.h b/logPlus/TransparentDraggableCorePhysics.h index 294e5fa..9f212e5 100644 --- a/logPlus/TransparentDraggableCorePhysics.h +++ b/logPlus/TransparentDraggableCorePhysics.h @@ -48,14 +48,11 @@ public: double getCpCoreValue() const; void setCpCoreValue(double value); - double getCpExampleAreaHeightCm() const; - void setCpExampleAreaHeightCm(double value); +// double getCpRotationAngle() const; +// void setCpRotationAngle(double value); - double getCpRotationAngle() const; - void setCpRotationAngle(double value); - - QString getCpDisplayName() const; - void setCpDisplayName(const QString &value); +// QString getCpDisplayName() const; +// void setCpDisplayName(const QString &value); int getCpLineWidth() const; void setCpLineWidth(int value); @@ -66,17 +63,17 @@ public: Qt::PenStyle getCpLineStyle() const; void setCpLineStyle(Qt::PenStyle value); - double getCpLeftScale() const; - void setCpLeftScale(double value); +// double getCpLeftScale() const; +// void setCpLeftScale(double value); - double getCpRightScale() const; - void setCpRightScale(double value); +// double getCpRightScale() const; +// void setCpRightScale(double value); - int getCpScaleType() const; - void setCpScaleType(int value); +// int getCpScaleType() const; +// void setCpScaleType(int value); - int getCpScaleDivisionsOrCustom() const; - void setCpScaleDivisionsOrCustom(int value); +// int getCpScaleDivisionsOrCustom() const; +// void setCpScaleDivisionsOrCustom(int value); QString getCpDisplayUnit() const; void setCpDisplayUnit(const QString &value); @@ -124,16 +121,15 @@ signals: void rangeChanged(QCPRange newRange); private: - double m_cp_exampleAreaHeightCm; // 例区高度(cm) - double m_cp_rotationAngle; // 旋转角度 - QString m_cp_displayName; // 显示名称 +// double m_cp_rotationAngle; // 旋转角度 +// QString m_cp_displayName; // 显示名称 int m_cp_lineWidth; // 线宽 QColor m_cp_lineColor; // 线条颜色 Qt::PenStyle m_cp_lineStyle; // 线型 - double m_cp_leftScale = 0; // 左刻度 - double m_cp_rightScale = 100; // 右刻度 - int m_cp_scaleType; // 刻度类型 - int m_cp_scaleDivisionsOrCustom; // 等分刻度数或自定序列 +// double m_cp_leftScale = 0; // 左刻度 +// double m_cp_rightScale = 100; // 右刻度 +// int m_cp_scaleType; // 刻度类型 +// int m_cp_scaleDivisionsOrCustom; // 等分刻度数或自定序列 QString m_cp_displayUnit; // 显示单位 QString m_cp_curveName; // 曲线名称 QString m_cp_curveUnit; // 曲线单位 diff --git a/logPlus/qmycustomplot.cpp b/logPlus/qmycustomplot.cpp index f69bac9..08422fe 100644 --- a/logPlus/qmycustomplot.cpp +++ b/logPlus/qmycustomplot.cpp @@ -1930,6 +1930,10 @@ void QMyCustomPlot::addCorePhysics() void QMyCustomPlot::addCorePhysicsWithParam(int Order, double Depth, double CorrDepth, double CoreValue) { +// qDebug() << Order << "====="; +// qDebug() << Depth << "====="; +// qDebug() << CorrDepth << "====="; +// qDebug() << CoreValue << "====="; QtCommonClass *qtCommon = new QtCommonClass(this); QString strUuid = qtCommon->getUUid(); TransparentDraggableCorePhysics *dragRect = new TransparentDraggableCorePhysics(this, strUuid); From 05ae5043e99611fecc80677a51acdc53f103fcf3 Mon Sep 17 00:00:00 2001 From: crqiqi77 Date: Mon, 30 Mar 2026 15:56:03 +0800 Subject: [PATCH 4/7] =?UTF-8?q?=E5=B2=A9=E5=BF=83=E5=88=86=E6=9E=90?= =?UTF-8?q?=E5=B7=A6=E5=8F=B3=E5=88=BB=E5=BA=A6=E5=B1=9E=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- logPlus/PropertyWidget.cpp | 18 +++- logPlus/TransparentDraggableCorePhysics.cpp | 109 +++++++++++--------- logPlus/TransparentDraggableCorePhysics.h | 18 ++-- logPlus/forminfo.cpp | 2 - logPlus/qmycustomplot.cpp | 17 +++ 5 files changed, 101 insertions(+), 63 deletions(-) diff --git a/logPlus/PropertyWidget.cpp b/logPlus/PropertyWidget.cpp index 466827e..c9dde42 100644 --- a/logPlus/PropertyWidget.cpp +++ b/logPlus/PropertyWidget.cpp @@ -454,28 +454,24 @@ void PropertyWidget::changedCorePhysicsProperty(QtProperty *qtProperty, const QV else if("序号" == m_propertyData[qtProperty]) { int temp = variant.toInt(); -// this->m_formInfo->m_cp_order = temp; this->m_tdCorePhysics->setCpOrder(temp); this->m_tdCorePhysics->mPlot->saveToSLFCorePhysics(); } else if("深度" == m_propertyData[qtProperty]) { double temp = variant.toDouble(); -// this->m_formInfo->m_cp_depth = temp; this->m_tdCorePhysics->setCpDepth(temp); this->m_tdCorePhysics->mPlot->saveToSLFCorePhysics(); } else if("校正深度" == m_propertyData[qtProperty]) { double temp = variant.toDouble(); -// this->m_formInfo->m_cp_corrDepth = temp; this->m_tdCorePhysics->setRange(temp,temp,this->m_tdCorePhysics->getCpCoreValue()); this->m_tdCorePhysics->mPlot->saveToSLFCorePhysics(); } else if("数值" == m_propertyData[qtProperty]) { double temp = variant.toDouble(); -// this->m_formInfo->m_cp_coreValue = temp; this->m_tdCorePhysics->setCpCoreValue(temp); this->m_tdCorePhysics->mPlot->saveToSLFCorePhysics(); } @@ -485,6 +481,10 @@ void PropertyWidget::changedCorePhysicsProperty(QtProperty *qtProperty, const QV this->m_formInfo->m_cp_leftScale = temp; this->m_formInfo->repaint(); + QVariantMap variantMap; + variantMap["leftScale"] = temp; + emit CallManage::getInstance()->sig_changeCorePhysicsProperty(variantMap); + // this->m_tdCorePhysics->setCpLeftScale(temp); // 这个操作需要修改所有对象 // QMap m_mapDraggable_CorePhysics = this->m_tdCorePhysics->mPlot->m_mapDraggable_CorePhysics; @@ -500,6 +500,10 @@ void PropertyWidget::changedCorePhysicsProperty(QtProperty *qtProperty, const QV this->m_formInfo->m_cp_rightScale = temp; this->m_formInfo->repaint(); + QVariantMap variantMap; + variantMap["rightScale"] = temp; + emit CallManage::getInstance()->sig_changeCorePhysicsProperty(variantMap); + // 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++) @@ -518,8 +522,8 @@ void PropertyWidget::changedCorePhysicsProperty(QtProperty *qtProperty, const QV } else if("刻度类型" == m_propertyData[qtProperty]) { - int newStyle = 0; int iStyle = variant.value(); + int newStyle = 0; switch(iStyle) { case 0: @@ -536,6 +540,10 @@ void PropertyWidget::changedCorePhysicsProperty(QtProperty *qtProperty, const QV break; } this->m_formInfo->m_cp_scaleType = newStyle; + + QVariantMap variantMap; + variantMap["scaleType"] = newStyle; + emit CallManage::getInstance()->sig_changeCorePhysicsProperty(variantMap); // this->m_tdCorePhysics->setCpScaleType(newStyle); } diff --git a/logPlus/TransparentDraggableCorePhysics.cpp b/logPlus/TransparentDraggableCorePhysics.cpp index 92bceed..3312fc5 100644 --- a/logPlus/TransparentDraggableCorePhysics.cpp +++ b/logPlus/TransparentDraggableCorePhysics.cpp @@ -52,6 +52,38 @@ void TransparentDraggableCorePhysics::setRange(double left_Low, double right_Hig // lY2除以实际左到右刻度数值 // lY2 = lY2 / (getCpRightScale() - getCpLeftScale()) * 100; + double minV = getCpLeftScale(); + double maxV = getCpRightScale(); + double value = lY2; + double finalValue = 0; + int scaleType = getCpScaleType(); // 0=线性 1=对数 2=倾角 + if (scaleType == 0) + { + // 线性(原来的公式) + finalValue = (value - minV) / (maxV - minV) * 100.0; + } + else if (scaleType == 1) + { + // 对数刻度(匹配 QCPAxis::stLogarithmic) + double logMin = log10(minV <= 0 ? 1 : minV); + double logMax = log10(maxV); + double logVal = log10(value); + finalValue = (logVal - logMin) / (logMax - logMin) * 100.0; + } + else if (scaleType == 2) + { + // 倾角刻度(正切非线性,QCustomPlot没有,我们自己实现标准倾角) + double PI = acos(-1); + auto linearNorm = (value - minV) / (maxV - minV); // 0~1 + double tanPos = tan(linearNorm * PI/2 - PI/4); // -1 ~ +1 + double tanNorm = (tanPos + 1.0) / 2.0; // 0~1 + finalValue = tanNorm * 100.0; + } + // 最终结果赋值给 lY2 + lY2 = finalValue; + + + qcpItemLine->start->setCoords(left_Low, lY1);//圆心位置 qcpItemLine->end->setCoords(right_Hight, lY2);//圆心位置 @@ -372,60 +404,44 @@ void TransparentDraggableCorePhysics::setCpLineStyle(Qt::PenStyle value) } -//double TransparentDraggableCorePhysics::getCpLeftScale() const -//{ -// return this->m_cp_leftScale; -//} +double TransparentDraggableCorePhysics::getCpLeftScale() const +{ + return this->m_cp_leftScale; +} -//void TransparentDraggableCorePhysics::setCpLeftScale(double value) -//{ -// this->m_cp_leftScale = value; +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->setRange(this->m_left_Low, this->m_left_Low, this->getCpCoreValue(), false); +} -//double TransparentDraggableCorePhysics::getCpRightScale() const -//{ -// return this->m_cp_rightScale; -//} +double TransparentDraggableCorePhysics::getCpRightScale() const +{ + return this->m_cp_rightScale; +} -//void TransparentDraggableCorePhysics::setCpRightScale(double value) -//{ -// this->m_cp_rightScale = value; +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->setRange(this->m_left_Low, this->m_left_Low, this->getCpCoreValue(), false); +} -//int TransparentDraggableCorePhysics::getCpScaleType() const -//{ -// return this->m_cp_scaleType; -//} +int TransparentDraggableCorePhysics::getCpScaleType() const +{ + return this->m_cp_scaleType; +} -//void TransparentDraggableCorePhysics::setCpScaleType(int value) -//{ -// this->m_cp_scaleType = value; +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; -//// } -//} + // 重新绘制图形 + this->setRange(this->m_left_Low, this->m_left_Low, this->getCpCoreValue(), false); +} //int TransparentDraggableCorePhysics::getCpScaleDivisionsOrCustom() const //{ @@ -642,7 +658,6 @@ void TransparentDraggableCorePhysics::setCpSymbolSize(int value) foreach (QCPItemTracer *tracer, tracers) { tracer->setSize(value); // 点的大小(像素) } - } QColor TransparentDraggableCorePhysics::getCpSymbolFillColor() const diff --git a/logPlus/TransparentDraggableCorePhysics.h b/logPlus/TransparentDraggableCorePhysics.h index 9f212e5..4adf41a 100644 --- a/logPlus/TransparentDraggableCorePhysics.h +++ b/logPlus/TransparentDraggableCorePhysics.h @@ -63,14 +63,14 @@ public: Qt::PenStyle getCpLineStyle() const; void setCpLineStyle(Qt::PenStyle value); -// double getCpLeftScale() const; -// void setCpLeftScale(double value); + double getCpLeftScale() const; + void setCpLeftScale(double value); -// double getCpRightScale() const; -// void setCpRightScale(double value); + double getCpRightScale() const; + void setCpRightScale(double value); -// int getCpScaleType() const; -// void setCpScaleType(int value); + int getCpScaleType() const; + void setCpScaleType(int value); // int getCpScaleDivisionsOrCustom() const; // void setCpScaleDivisionsOrCustom(int value); @@ -126,9 +126,9 @@ private: int m_cp_lineWidth; // 线宽 QColor m_cp_lineColor; // 线条颜色 Qt::PenStyle m_cp_lineStyle; // 线型 -// double m_cp_leftScale = 0; // 左刻度 -// double m_cp_rightScale = 100; // 右刻度 -// int m_cp_scaleType; // 刻度类型 + double m_cp_leftScale = 0; // 左刻度 + double m_cp_rightScale = 100; // 右刻度 + int m_cp_scaleType = 0; // 刻度类型 // int m_cp_scaleDivisionsOrCustom; // 等分刻度数或自定序列 QString m_cp_displayUnit; // 显示单位 QString m_cp_curveName; // 曲线名称 diff --git a/logPlus/forminfo.cpp b/logPlus/forminfo.cpp index 5050c84..df4b35e 100644 --- a/logPlus/forminfo.cpp +++ b/logPlus/forminfo.cpp @@ -852,8 +852,6 @@ void FormInfo::paintEvent(QPaintEvent* event) ); } painter.setFont(oldFont); - - } QWidget::paintEvent(event); diff --git a/logPlus/qmycustomplot.cpp b/logPlus/qmycustomplot.cpp index 08422fe..3697218 100644 --- a/logPlus/qmycustomplot.cpp +++ b/logPlus/qmycustomplot.cpp @@ -4944,6 +4944,23 @@ void QMyCustomPlot::s_changeCorePhysicsProperty(QVariantMap variantMap) { tdCorePhysics->setCpSymbolFillColor(variantMap["symbolFillColor"].value()); } + // 左刻度 + if(variantMap["leftScale"].isValid()) + { + tdCorePhysics->setCpLeftScale(variantMap["leftScale"].toDouble()); + } + // 右刻度 + if(variantMap["rightScale"].isValid()) + { + tdCorePhysics->setCpRightScale(variantMap["rightScale"].toDouble()); + } + + // 刻度类型 + if(variantMap["scaleType"].isValid()) + { + tdCorePhysics->setCpScaleType(variantMap["scaleType"].toInt()); + } + } this->replot(); } From d8cb84ded64af3b6dc391b383d1181f82daa9bc6 Mon Sep 17 00:00:00 2001 From: jiayulong Date: Mon, 30 Mar 2026 16:50:08 +0800 Subject: [PATCH 5/7] =?UTF-8?q?1.=E4=BF=AE=E6=94=B9=E4=BA=95=E5=AE=BD?= =?UTF-8?q?=E5=8F=98=E9=87=8Fint=E4=B8=BAdouble=202.=E5=9B=BA=E4=BA=95?= =?UTF-8?q?=E3=80=81=E4=BA=95=E5=A3=81=E5=8F=96=E5=BF=83=E7=AD=89=E5=8F=AA?= =?UTF-8?q?=E8=83=BD=E9=80=89=E6=8B=A9=E8=87=AA=E5=B7=B1=E7=9A=84=E7=AC=A6?= =?UTF-8?q?=E5=8F=B7=E7=9B=AE=E5=BD=95=EF=BC=8C=E9=80=89=E6=8B=A9=E5=85=B6?= =?UTF-8?q?=E4=BB=96=E9=94=99=E8=AF=AF=E8=B7=AF=E5=BE=84=E4=BC=9A=E6=8F=90?= =?UTF-8?q?=E9=86=92=E6=8A=A5=E9=94=99=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- logPlus/PropertyWidget.cpp | 378 +++++++++++++++++++++++++++++------- logPlus/PropertyWidget.h | 2 +- logPlus/formwell.cpp | 4 +- logPlus/mainwindowcurve.cpp | 28 ++- logPlus/mainwindowcurve.h | 4 +- logPlus/qmycustomplot.cpp | 18 +- 6 files changed, 341 insertions(+), 93 deletions(-) diff --git a/logPlus/PropertyWidget.cpp b/logPlus/PropertyWidget.cpp index c9dde42..9091063 100644 --- a/logPlus/PropertyWidget.cpp +++ b/logPlus/PropertyWidget.cpp @@ -472,6 +472,7 @@ void PropertyWidget::changedCorePhysicsProperty(QtProperty *qtProperty, const QV else if("数值" == m_propertyData[qtProperty]) { double temp = variant.toDouble(); +// this->m_formInfo->m_cp_coreValue = temp; this->m_tdCorePhysics->setCpCoreValue(temp); this->m_tdCorePhysics->mPlot->saveToSLFCorePhysics(); } @@ -941,10 +942,24 @@ void PropertyWidget::SlotPropertyChanged( QtProperty *pProperty, const QVariant else if("岩性" == m_propertyData[pProperty]) { QString newResult = variant.value(); - m_tdLayer->setLith(newResult); + + //只能选择自己的符号,不能选择其他。 + QString strDefaultPath = ::GetLithSymbolDir(); + //符号统一 + strDefaultPath.replace("\\","/"); + newResult.replace("\\","/"); // - QCPRange currentRange = m_tdLayer->getRange(); - m_tdLayer->setRange(currentRange.lower, currentRange.upper); + if(newResult.contains(strDefaultPath)) + { + m_tdLayer->setLith(newResult); + // + QCPRange currentRange = m_tdLayer->getRange(); + m_tdLayer->setRange(currentRange.lower, currentRange.upper); + } + else { + QMessageBox::information(nullptr,"提示","所选目录不支持"); + return; + } } } else if (m_strCurrentProperty == JieshiItem_Property) @@ -1021,12 +1036,26 @@ void PropertyWidget::SlotPropertyChanged( QtProperty *pProperty, const QVariant if(m_tdGujing) { QString newResult = variant.value(); - m_tdGujing->setResult(newResult); + + //只能选择自己的符号,不能选择其他。 + QString strDefaultPath = ::GetGujingSymbolDir(); + //符号统一 + strDefaultPath.replace("\\","/"); + newResult.replace("\\","/"); // - QCPRange currentRange = m_tdGujing->getRange(); - m_tdGujing->setRange(currentRange.lower, currentRange.upper); - //保存 - m_tdGujing->mPlot->SaveToSLF_Gujing(); + if(newResult.contains(strDefaultPath)) + { + m_tdGujing->setResult(newResult); + // + QCPRange currentRange = m_tdGujing->getRange(); + m_tdGujing->setRange(currentRange.lower, currentRange.upper); + //保存 + m_tdGujing->mPlot->SaveToSLF_Gujing(); + } + else { + QMessageBox::information(nullptr,"提示","所选目录不支持"); + return; + } } } } @@ -1076,12 +1105,26 @@ void PropertyWidget::SlotPropertyChanged( QtProperty *pProperty, const QVariant if(m_tdSwallCore) { QString newResult = variant.value(); - m_tdSwallCore->setLith(newResult); + + //只能选择自己的符号,不能选择其他。 + QString strDefaultPath = ::GetSymbolDir()+"取心岩性符号"; + //符号统一 + strDefaultPath.replace("\\","/"); + newResult.replace("\\","/"); // - QCPRange currentRange = m_tdSwallCore->getRange(); - m_tdSwallCore->setRange(currentRange.lower, currentRange.upper); - //保存 - m_tdSwallCore->mPlot->SaveToSLF_SwallCore(); + if(newResult.contains(strDefaultPath)) + { + m_tdSwallCore->setLith(newResult); + // + QCPRange currentRange = m_tdSwallCore->getRange(); + m_tdSwallCore->setRange(currentRange.lower, currentRange.upper); + //保存 + m_tdSwallCore->mPlot->SaveToSLF_SwallCore(); + } + else { + QMessageBox::information(nullptr,"提示","所选目录不支持"); + return; + } } } else if("油气" == m_propertyData[pProperty]) @@ -1090,12 +1133,26 @@ void PropertyWidget::SlotPropertyChanged( QtProperty *pProperty, const QVariant if(m_tdSwallCore) { QString newResult = variant.value(); - m_tdSwallCore->setOil(newResult); + + //只能选择自己的符号,不能选择其他。 + QString strDefaultPath = ::GetGasSymbolDir(); + //符号统一 + strDefaultPath.replace("\\","/"); + newResult.replace("\\","/"); // - QCPRange currentRange = m_tdSwallCore->getRange(); - m_tdSwallCore->setRange(currentRange.lower, currentRange.upper); - //保存 - m_tdSwallCore->mPlot->SaveToSLF_SwallCore(); + if(newResult.contains(strDefaultPath)) + { + m_tdSwallCore->setOil(newResult); + // + QCPRange currentRange = m_tdSwallCore->getRange(); + m_tdSwallCore->setRange(currentRange.lower, currentRange.upper); + //保存 + m_tdSwallCore->mPlot->SaveToSLF_SwallCore(); + } + else { + QMessageBox::information(nullptr,"提示","所选目录不支持"); + return; + } } } else if("颜色" == m_propertyData[pProperty]) @@ -1105,24 +1162,37 @@ void PropertyWidget::SlotPropertyChanged( QtProperty *pProperty, const QVariant { QString ColorImage = variant.value(); - QString name = ""; - int CoreColor = 0; + //只能选择自己的符号,不能选择其他。 + QString strDefaultPath = ::GetColorSymbolDir(); + //符号统一 + strDefaultPath.replace("\\","/"); ColorImage.replace("\\","/"); - int l=ColorImage.lastIndexOf("/"); - if(l>-1) name=ColorImage.mid(l+1); - - l=name.indexOf("."); - if(l>-1)name=name.left(l); - int ind=m_tdSwallCore->mPlot->colors_SWallCore.indexOf(name); - if(ind<0||ind>=m_tdSwallCore->mPlot->colorinds_SWallCore.size()) CoreColor=0; - else CoreColor=m_tdSwallCore->mPlot->colorinds_SWallCore[ind].toInt(); - - m_tdSwallCore->setTitle(QString::number(CoreColor)); // - QCPRange currentRange = m_tdSwallCore->getRange(); - m_tdSwallCore->setRange(currentRange.lower, currentRange.upper); - //保存 - m_tdSwallCore->mPlot->SaveToSLF_SwallCore(); + if(ColorImage.contains(strDefaultPath)) + { + QString name = ""; + int CoreColor = 0; + ColorImage.replace("\\","/"); + int l=ColorImage.lastIndexOf("/"); + if(l>-1) name=ColorImage.mid(l+1); + + l=name.indexOf("."); + if(l>-1)name=name.left(l); + int ind=m_tdSwallCore->mPlot->colors_SWallCore.indexOf(name); + if(ind<0||ind>=m_tdSwallCore->mPlot->colorinds_SWallCore.size()) CoreColor=0; + else CoreColor=m_tdSwallCore->mPlot->colorinds_SWallCore[ind].toInt(); + + m_tdSwallCore->setTitle(QString::number(CoreColor)); + // + QCPRange currentRange = m_tdSwallCore->getRange(); + m_tdSwallCore->setRange(currentRange.lower, currentRange.upper); + //保存 + m_tdSwallCore->mPlot->SaveToSLF_SwallCore(); + } + else { + QMessageBox::information(nullptr,"提示","所选目录不支持"); + return; + } } } else if("起始位置" == m_propertyData[pProperty]) @@ -1174,12 +1244,26 @@ void PropertyWidget::SlotPropertyChanged( QtProperty *pProperty, const QVariant if(m_tdGeoLith) { QString newResult = variant.value(); - m_tdGeoLith->setLith(newResult, m_tdGeoLith->m_Color); + + //只能选择自己的符号,不能选择其他。 + QString strDefaultPath = ::GetMudSymbolDir(); + //符号统一 + strDefaultPath.replace("\\","/"); + newResult.replace("\\","/"); // - QCPRange currentRange = m_tdGeoLith->getRange(); - m_tdGeoLith->setRange(currentRange.lower, currentRange.upper); - //保存 - m_tdGeoLith->mPlot->SaveToSLF_GeoLith(); + if(newResult.contains(strDefaultPath)) + { + m_tdGeoLith->setLith(newResult, m_tdGeoLith->m_Color); + // + QCPRange currentRange = m_tdGeoLith->getRange(); + m_tdGeoLith->setRange(currentRange.lower, currentRange.upper); + //保存 + m_tdGeoLith->mPlot->SaveToSLF_GeoLith(); + } + else { + QMessageBox::information(nullptr,"提示","所选目录不支持"); + return; + } } } else if("油气" == m_propertyData[pProperty]) @@ -1188,12 +1272,26 @@ void PropertyWidget::SlotPropertyChanged( QtProperty *pProperty, const QVariant if(m_tdGeoLith) { QString newResult = variant.value(); - m_tdGeoLith->setOil(newResult); + + //只能选择自己的符号,不能选择其他。 + QString strDefaultPath = ::GetGasSymbolDir(); + //符号统一 + strDefaultPath.replace("\\","/"); + newResult.replace("\\","/"); // - QCPRange currentRange = m_tdGeoLith->getRange(); - m_tdGeoLith->setRange(currentRange.lower, currentRange.upper); - //保存 - m_tdGeoLith->mPlot->SaveToSLF_GeoLith(); + if(newResult.contains(strDefaultPath)) + { + m_tdGeoLith->setOil(newResult); + // + QCPRange currentRange = m_tdGeoLith->getRange(); + m_tdGeoLith->setRange(currentRange.lower, currentRange.upper); + //保存 + m_tdGeoLith->mPlot->SaveToSLF_GeoLith(); + } + else { + QMessageBox::information(nullptr,"提示","所选目录不支持"); + return; + } } } else if("颜色" == m_propertyData[pProperty]) @@ -1202,12 +1300,26 @@ void PropertyWidget::SlotPropertyChanged( QtProperty *pProperty, const QVariant if(m_tdGeoLith) { QString newResult = variant.value(); - m_tdGeoLith->setLith(m_tdGeoLith->m_Lith, newResult); + + //只能选择自己的符号,不能选择其他。 + QString strDefaultPath = ::GetColorSymbolDir(); + //符号统一 + strDefaultPath.replace("\\","/"); + newResult.replace("\\","/"); // - QCPRange currentRange = m_tdGeoLith->getRange(); - m_tdGeoLith->setRange(currentRange.lower, currentRange.upper); - //保存 - m_tdGeoLith->mPlot->SaveToSLF_GeoLith(); + if(newResult.contains(strDefaultPath)) + { + m_tdGeoLith->setLith(m_tdGeoLith->m_Lith, newResult); + // + QCPRange currentRange = m_tdGeoLith->getRange(); + m_tdGeoLith->setRange(currentRange.lower, currentRange.upper); + //保存 + m_tdGeoLith->mPlot->SaveToSLF_GeoLith(); + } + else { + QMessageBox::information(nullptr,"提示","所选目录不支持"); + return; + } } } else if("含油占比(1~8)" == m_propertyData[pProperty]) @@ -1675,19 +1787,33 @@ void PropertyWidget::SlotPropertyChanged( QtProperty *pProperty, const QVariant //-------------------------- QString newResult = variant.value(); - m_tdGuan->setResult(newResult); - // - QCPRange currentRange = m_tdGuan->getRange(); - m_tdGuan->setRange(currentRange.lower, currentRange.upper); - //保存 - m_tdGuan->mPlot->SaveToSLF_Tubing(); - //--------- - bool bReDrawNew = m_tdGuan->mPlot->checkTubingName(m_tdGuan->m_Result); - if(bReDrawOld || bReDrawNew) + //只能选择自己的符号,不能选择其他。 + QString strDefaultPath = GetSymbolDir()+"管柱组件"; + //符号统一 + strDefaultPath.replace("\\","/"); + newResult.replace("\\","/"); + // + if(newResult.contains(strDefaultPath)) { - //组件改变后,重绘管柱 - m_tdGuan->mPlot->LoadFromSLF_ReDrawTubing(m_tdGuan->mPlot->m_strSlfName, m_tdGuan->mPlot->m_strLineName); + m_tdGuan->setResult(newResult); + // + QCPRange currentRange = m_tdGuan->getRange(); + m_tdGuan->setRange(currentRange.lower, currentRange.upper); + //保存 + m_tdGuan->mPlot->SaveToSLF_Tubing(); + + //--------- + bool bReDrawNew = m_tdGuan->mPlot->checkTubingName(m_tdGuan->m_Result); + if(bReDrawOld || bReDrawNew) + { + //组件改变后,重绘管柱 + m_tdGuan->mPlot->LoadFromSLF_ReDrawTubing(m_tdGuan->mPlot->m_strSlfName, m_tdGuan->mPlot->m_strLineName); + } + } + else { + QMessageBox::information(nullptr,"提示","所选目录不支持"); + return; } } } @@ -3125,9 +3251,51 @@ void PropertyWidget::initSwallCoreItemProperty(TransparentDraggableSwallCore* td // _CreateVariantPropertyItem("当前项", "深度", -Depth, QVariant::Double); - _CreateVariantPropertyItem("当前项", "岩性", LithologyImage, VariantManager::filePathTypeId()); - _CreateVariantPropertyItem("当前项", "油气", OilGasImage, VariantManager::filePathTypeId()); - _CreateVariantPropertyItem("当前项", "颜色", ColorImage, VariantManager::filePathTypeId()); + + //只能选择自己的符号,不能选择其他。 + QString strDefaultPath = ::GetSymbolDir()+"取心岩性符号"; + //符号统一 + strDefaultPath.replace("\\","/"); + LithologyImage.replace("\\","/"); + // + if(LithologyImage.contains(strDefaultPath)) + { + _CreateVariantPropertyItem("当前项", "岩性", LithologyImage, VariantManager::filePathTypeId()); + } + else{ + _CreateVariantPropertyItem("当前项", "岩性", strDefaultPath, VariantManager::filePathTypeId()); + } + + //只能选择自己的符号,不能选择其他。 + strDefaultPath = ::GetGasSymbolDir(); + //符号统一 + strDefaultPath.replace("\\","/"); + OilGasImage.replace("\\","/"); + // + if(OilGasImage.contains(strDefaultPath)) + { + _CreateVariantPropertyItem("当前项", "油气", OilGasImage, VariantManager::filePathTypeId()); + } + else + { + _CreateVariantPropertyItem("当前项", "油气", strDefaultPath, VariantManager::filePathTypeId()); + } + + //只能选择自己的符号,不能选择其他。 + strDefaultPath = ::GetColorSymbolDir(); + //符号统一 + strDefaultPath.replace("\\","/"); + ColorImage.replace("\\","/"); + // + if(ColorImage.contains(strDefaultPath)) + { + _CreateVariantPropertyItem("当前项", "颜色", ColorImage, VariantManager::filePathTypeId()); + } + else + { + _CreateVariantPropertyItem("当前项", "颜色", strDefaultPath, VariantManager::filePathTypeId()); + } + _CreateVariantPropertyItem("当前项", "起始位置", Sideleft, QVariant::Double); //_CreateVariantPropertyItem("当前项", "宽度", -Depth, QVariant::Double); } @@ -3294,7 +3462,21 @@ void PropertyWidget::initGujingItemProperty(TransparentDraggableGujing* tdGujing // _CreateVariantPropertyItem("当前项", "顶深(m)", -upper, QVariant::Double); _CreateVariantPropertyItem("当前项", "底深(m)", -lower, QVariant::Double); - _CreateVariantPropertyItem("当前项", "固井结论", strResult, VariantManager::filePathTypeId()); + + //只能选择自己的符号,不能选择其他。 + QString strDefaultPath = ::GetGujingSymbolDir(); + //符号统一 + strDefaultPath.replace("\\","/"); + strResult.replace("\\","/"); + // + if(strResult.contains(strDefaultPath)) + { + _CreateVariantPropertyItem("当前项", "固井结论", strResult, VariantManager::filePathTypeId()); + } + else + { + _CreateVariantPropertyItem("当前项", "固井结论", strDefaultPath, VariantManager::filePathTypeId()); + } } void PropertyWidget::initImageProperty(FormInfo *formInfo) @@ -3612,7 +3794,7 @@ void PropertyWidget::initTvdProperty(FormInfo *formInfo) m_strCurrentProperty = Tvd_Property; } -void PropertyWidget::initGeoLithItemProperty(TransparentDraggableGeoLith* tdGeoLith, double lower, double upper, const QString myLith, const QString myOil, const QString myColor) +void PropertyWidget::initGeoLithItemProperty(TransparentDraggableGeoLith* tdGeoLith, double lower, double upper, QString myLith, QString myOil, QString myColor) { //初始化,清空 InitCurrentViewInfo(); @@ -3654,9 +3836,54 @@ void PropertyWidget::initGeoLithItemProperty(TransparentDraggableGeoLith* tdGeoL // _CreateVariantPropertyItem("当前项", "顶深(m)", -upper, QVariant::Double); _CreateVariantPropertyItem("当前项", "底深(m)", -lower, QVariant::Double); - _CreateVariantPropertyItem("当前项", "岩性", myLith, VariantManager::filePathTypeId()); - _CreateVariantPropertyItem("当前项", "油气", myOil, VariantManager::filePathTypeId()); - _CreateVariantPropertyItem("当前项", "颜色", myColor, VariantManager::filePathTypeId()); + + //只能选择自己的符号,不能选择其他。 + QString strDefaultPath = ::GetMudSymbolDir(); + //符号统一 + strDefaultPath.replace("\\","/"); + myLith.replace("\\","/"); + // + if(myLith.contains(strDefaultPath)) + { + _CreateVariantPropertyItem("当前项", "岩性", myLith, VariantManager::filePathTypeId()); + } + else{ + _CreateVariantPropertyItem("当前项", "岩性", strDefaultPath, VariantManager::filePathTypeId()); + } + + //只能选择自己的符号,不能选择其他。 + strDefaultPath = ::GetGasSymbolDir(); + //符号统一 + strDefaultPath.replace("\\","/"); + myOil.replace("\\","/"); + // + if(myOil.contains(strDefaultPath)) + { + _CreateVariantPropertyItem("当前项", "油气", myOil, VariantManager::filePathTypeId()); + } + else + { + _CreateVariantPropertyItem("当前项", "油气", strDefaultPath, VariantManager::filePathTypeId()); + } + + //只能选择自己的符号,不能选择其他。 + strDefaultPath = ::GetColorSymbolDir(); + //符号统一 + strDefaultPath.replace("\\","/"); + myColor.replace("\\","/"); + // + if(myColor.contains(strDefaultPath)) + { + _CreateVariantPropertyItem("当前项", "颜色", myColor, VariantManager::filePathTypeId()); + } + else + { + _CreateVariantPropertyItem("当前项", "颜色", strDefaultPath, VariantManager::filePathTypeId()); + } + +// _CreateVariantPropertyItem("当前项", "岩性", myLith, VariantManager::filePathTypeId()); +// _CreateVariantPropertyItem("当前项", "油气", myOil, VariantManager::filePathTypeId()); +// _CreateVariantPropertyItem("当前项", "颜色", myColor, VariantManager::filePathTypeId()); } //气测/FMT/射孔/文本 @@ -3815,7 +4042,20 @@ void PropertyWidget::initTubingItemProperty(TransparentDraggableGuan* tdGuan, do // _CreateVariantPropertyItem("当前项", "深度(m)", -(upper+lower)/2.0, QVariant::Double); - _CreateVariantPropertyItem("当前项", "组件类型", strResult, VariantManager::filePathTypeId()); + + //只能选择自己的符号,不能选择其他。 + QString strDefaultPath = GetSymbolDir()+"管柱组件"; + //符号统一 + strDefaultPath.replace("\\","/"); + strResult.replace("\\","/"); + // + if(strResult.contains(strDefaultPath)) + { + _CreateVariantPropertyItem("当前项", "组件类型", strResult, VariantManager::filePathTypeId()); + } + else { + _CreateVariantPropertyItem("当前项", "组件类型", strDefaultPath, VariantManager::filePathTypeId()); + } } void PropertyWidget::changedDepthProperty(QString strProperty, QVariant varVal) diff --git a/logPlus/PropertyWidget.h b/logPlus/PropertyWidget.h index bf143c0..cf1ead6 100644 --- a/logPlus/PropertyWidget.h +++ b/logPlus/PropertyWidget.h @@ -203,7 +203,7 @@ public: // 录井剖面属性 void initGeoLithProperty(FormInfo *formInfo); - void initGeoLithItemProperty(TransparentDraggableGeoLith* tdGeoLith, double lower, double upper, const QString myLith, const QString myOil, const QString myColor); + void initGeoLithItemProperty(TransparentDraggableGeoLith* tdGeoLith, double lower, double upper, QString myLith, QString myOil, QString myColor); // 文字结论属性 void initTextProperty(FormInfo *formInfo); diff --git a/logPlus/formwell.cpp b/logPlus/formwell.cpp index 5528947..6fdab02 100644 --- a/logPlus/formwell.cpp +++ b/logPlus/formwell.cpp @@ -438,11 +438,11 @@ void FormWell::slot_NewTrack_No_Line(QString strUuid, QJsonObject topObj, QJsonO } } - int nW = 0; + double nW = 0; if (topObj.contains("TrackW")) { QJsonValue value = topObj.value("TrackW"); - nW = value.toInt(); + nW = value.toDouble(); } QStringList listdt; diff --git a/logPlus/mainwindowcurve.cpp b/logPlus/mainwindowcurve.cpp index 6b63424..78e30dc 100644 --- a/logPlus/mainwindowcurve.cpp +++ b/logPlus/mainwindowcurve.cpp @@ -91,7 +91,7 @@ MainWindowCurve::MainWindowCurve(QWidget *parent) : // 连接信号和槽 connect(ui->tableWidget_2, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(slotContextMenu(QPoint))); - connect(this, SIGNAL(sig_NewTrackChangeWidth(QString, int)), this, SLOT(s_NewTrackChangeWidth(QString, int))); + connect(this, SIGNAL(sig_NewTrackChangeWidth(QString, double)), this, SLOT(s_NewTrackChangeWidth(QString, double))); //connect(this, SIGNAL(sig_NewWell(QString, QString)), this, SLOT(s_NewWell(QString, QString))); connect(CallManage::getInstance(), SIGNAL(sig_mouseWheel(QWheelEvent*)), this, SLOT(s_mouseWheel(QWheelEvent*))); @@ -2611,7 +2611,7 @@ void MainWindowCurve::onItemClicked(QTableWidgetItem* item) PropertyService()->initWellProperty(m_strUuid, strSlfName, strWellName, m_iY1, m_iY2); //取消所有选中单元格 - emit CallManage::getInstance()->sig_Raise(m_strUuid, strSlfName, strWellName, "", "", 0, ""); + emit CallManage::getInstance()->sig_Raise(m_strUuid, strSlfName, strWellName, "", "", 1, ""); } @@ -3365,7 +3365,7 @@ void MainWindowCurve::s_NewTDT() emit CallManage::getInstance()->sig_NewCol(dt); } -void MainWindowCurve::s_NewTrackChangeWidth(QString strWellName, int nW) +void MainWindowCurve::s_NewTrackChangeWidth(QString strWellName, double nW) { qDebug() << "MainWindowCurve s_NewTrackChangeWidth"; @@ -3419,7 +3419,7 @@ void MainWindowCurve::s_AddLine_Property(QString strSlfName, QString strWellName //新建井+道+曲线(首条) void MainWindowCurve::NewWellAndTrack(QString strWellName, QString strSlfName, QString strLineName, QString strType) { - int nW = 0; + double nW = 0; if(strType=="SantuyibiaoObject") { //斜井三图一表 @@ -4024,7 +4024,7 @@ void MainWindowCurve::DisplayTracks(QJsonArray tracksArray) QJsonObject trackObj = trackValue.toObject(); // QString strTrackName = ""; - int nTrackW = 0; + double nTrackW = 0; if (trackObj.contains("topinfo") && trackObj.contains("info")) { QJsonValue topVal = trackObj.value("topinfo"); @@ -4037,7 +4037,7 @@ void MainWindowCurve::DisplayTracks(QJsonArray tracksArray) DisplayTrack_Top(id, topObj, infoObj); strTrackName = topObj.value("TrackName").toString(); - nTrackW = topObj.value("TrackW").toInt(); + nTrackW = topObj.value("TrackW").toDouble(); } } // if (trackObj.contains("info")) @@ -4057,7 +4057,7 @@ void MainWindowCurve::DisplayTrack_Top(int id, QJsonObject trackTop, QJsonObject { //新建道+曲线 s_NewTrack_No_Line(trackTop, trackInfo);//新建空白道,没有曲线 - if(id>0) + //if(id>0) { QString strWellName = ""; if (trackTop.contains("WellName")) @@ -4068,14 +4068,22 @@ void MainWindowCurve::DisplayTrack_Top(int id, QJsonObject trackTop, QJsonObject qDebug() << "WellName:" << strWellName; } } - int nW = 0; + double nW = 0; if (trackTop.contains("TrackW")) { QJsonValue value = trackTop.value("TrackW"); - nW = value.toInt(); + nW = value.toDouble(); } //改变井宽 - s_NewTrackChangeWidth(strWellName, nW * static_cast(g_dPixelPerCm)); + if(id==0) + { + //第一道,默认减掉空井宽g_iOneWidth + s_NewTrackChangeWidth(strWellName, nW * g_dPixelPerCm - g_iOneWidth); + } + else + { + s_NewTrackChangeWidth(strWellName, nW * g_dPixelPerCm); + } //mainWindowCurve->s_NewTrackChangeWidth(strWellName); } } diff --git a/logPlus/mainwindowcurve.h b/logPlus/mainwindowcurve.h index cc22bed..f2d361d 100644 --- a/logPlus/mainwindowcurve.h +++ b/logPlus/mainwindowcurve.h @@ -136,7 +136,7 @@ public: QStringList getLineList(QString strWellName, QString strTrackName); signals: - void sig_NewTrackChangeWidth(QString strWellName, int nW=0);//新建道后,改变井宽 + void sig_NewTrackChangeWidth(QString strWellName, double nW=0);//新建道后,改变井宽 void sig_NewWell(QString strWellName); public slots: @@ -168,7 +168,7 @@ public slots: public slots: void s_NewWell(QString strWellName, QString strSlfName);//新建井 - void s_NewTrackChangeWidth(QString strWellName, int nW=0);//新建道后,改变井宽 + void s_NewTrackChangeWidth(QString strWellName, double nW=0);//新建道后,改变井宽 void s_NewTrack_No_Line(QString strWellName, QString strTrackName);//新建空白道,没有曲线 void s_NewTrack_No_Line(QJsonObject topObj, QJsonObject infoObj);//新建空白道,没有曲线 diff --git a/logPlus/qmycustomplot.cpp b/logPlus/qmycustomplot.cpp index 3697218..fa8560a 100644 --- a/logPlus/qmycustomplot.cpp +++ b/logPlus/qmycustomplot.cpp @@ -3010,10 +3010,10 @@ void QMyCustomPlot::addItem_SWallCore() int CoreColor=0; if (liths.size()>=CoreLith) { - LithologyImage=::GetSymbolDir()+"/取心岩性符号/"+liths[CoreLith-1]+".svg"; + LithologyImage=::GetSymbolDir()+"取心岩性符号/"+liths[CoreLith-1]+".svg"; QDir ss(LithologyImage); if(!ss.exists()) { - LithologyImage=::GetSymbolDir()+"/取心岩性符号/"+liths[CoreLith-1]+".png"; + LithologyImage=::GetSymbolDir()+"取心岩性符号/"+liths[CoreLith-1]+".png"; } } if (CoreOil>0&&oils.size()>=CoreOil) @@ -3174,10 +3174,10 @@ void QMyCustomPlot::AddItem_SWallCore(QStringList lists) } else if (liths_SWallCore.size()>=m_Result.CoreLith) { - LithologyImage=::GetSymbolDir()+"/取心岩性符号/"+liths_SWallCore[m_Result.CoreLith-1]+".svg"; + LithologyImage=::GetSymbolDir()+"取心岩性符号/"+liths_SWallCore[m_Result.CoreLith-1]+".svg"; QDir ss(LithologyImage); if(!ss.exists()) { - LithologyImage=::GetSymbolDir()+"/取心岩性符号/"+liths_SWallCore[m_Result.CoreLith-1]+".png"; + LithologyImage=::GetSymbolDir()+"取心岩性符号/"+liths_SWallCore[m_Result.CoreLith-1]+".png"; } } if (m_Result.CoreOil>0&&oils_SWallCore.size()>=m_Result.CoreOil) @@ -3661,10 +3661,10 @@ bool QMyCustomPlot::LoadFromSLF_SwallCore(QString strSlfName, QString strLineNam } else if (liths_SWallCore.size()>=m_Result.CoreLith) { - LithologyImage=::GetSymbolDir()+"/取心岩性符号/"+liths_SWallCore[m_Result.CoreLith-1]+".svg"; + LithologyImage=::GetSymbolDir()+"取心岩性符号/"+liths_SWallCore[m_Result.CoreLith-1]+".svg"; QDir ss(LithologyImage); if(!ss.exists()) { - LithologyImage=::GetSymbolDir()+"/取心岩性符号/"+liths_SWallCore[m_Result.CoreLith-1]+".png"; + LithologyImage=::GetSymbolDir()+"取心岩性符号/"+liths_SWallCore[m_Result.CoreLith-1]+".png"; } } if (m_Result.CoreOil>0&&oils_SWallCore.size()>=m_Result.CoreOil) @@ -6840,7 +6840,7 @@ void QMyCustomPlot::DrawTubing() } if(m_bDrawTubing_Tubing) { - QString shotimgfile=GetSymbolDir()+"\\管柱组件\\管柱.png"; + QString shotimgfile=GetSymbolDir()+"管柱组件\\管柱.png"; double lY1 = 0;//this->yAxis->range().lower;//+10 double lY2 = m_OutD_Tubing;//this->yAxis->range().upper - this->yAxis->range().lower; //this->yAxis->range().upper; @@ -8998,7 +8998,7 @@ bool QMyCustomPlot::LoadFromSLF_Tubing(QString strSlfName, QString csCurve) { m_pResultList_Tubing.clear(); - cclimgpath_Tubing=GetSymbolDir()+"\\管柱组件\\"; + cclimgpath_Tubing=GetSymbolDir()+"管柱组件\\"; //先删除 if(mPixmap_Tubing) { @@ -9139,7 +9139,7 @@ void QMyCustomPlot::drawOne_Tubing(Slf_JIEGUPOS result) bool QMyCustomPlot::LoadFromSLF_ReDrawTubing(QString strSlfName, QString csCurve) { - cclimgpath_Tubing=GetSymbolDir()+"\\管柱组件\\"; + cclimgpath_Tubing=GetSymbolDir()+"管柱组件\\"; Slf_JIEGUPOS *m_pResult=NULL; CMemRdWt *logio=new CMemRdWt(); From e5c0c52a0cdd632f425610efd8d407f6c5b3b4a9 Mon Sep 17 00:00:00 2001 From: crqiqi77 Date: Mon, 30 Mar 2026 16:58:04 +0800 Subject: [PATCH 6/7] =?UTF-8?q?=E5=B2=A9=E5=BF=83=E5=88=86=E6=9E=90=20?= =?UTF-8?q?=E5=B2=A9=E5=BF=83=E7=85=A7=E7=89=87=20=E5=85=A8=E9=83=A8?= =?UTF-8?q?=E6=B8=85=E7=A9=BA=20=E5=88=B7=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- logPlus/TransparentDraggableCorePhysics.cpp | 6 +- logPlus/formdraw.cpp | 280 +++++++++----------- logPlus/formdraw.h | 2 +- logPlus/qmycustomplot.cpp | 225 +++++++++++++++- logPlus/qmycustomplot.h | 2 + 5 files changed, 354 insertions(+), 161 deletions(-) diff --git a/logPlus/TransparentDraggableCorePhysics.cpp b/logPlus/TransparentDraggableCorePhysics.cpp index 3312fc5..28165a7 100644 --- a/logPlus/TransparentDraggableCorePhysics.cpp +++ b/logPlus/TransparentDraggableCorePhysics.cpp @@ -49,8 +49,8 @@ void TransparentDraggableCorePhysics::setRange(double left_Low, double right_Hig } } m_lY1 = lY1; - // lY2除以实际左到右刻度数值 -// lY2 = lY2 / (getCpRightScale() - getCpLeftScale()) * 100; + + double minV = getCpLeftScale(); double maxV = getCpRightScale(); @@ -59,7 +59,7 @@ void TransparentDraggableCorePhysics::setRange(double left_Low, double right_Hig int scaleType = getCpScaleType(); // 0=线性 1=对数 2=倾角 if (scaleType == 0) { - // 线性(原来的公式) + // 线性(原来的公式) // lY2除以实际左到右刻度数值 finalValue = (value - minV) / (maxV - minV) * 100.0; } else if (scaleType == 1) diff --git a/logPlus/formdraw.cpp b/logPlus/formdraw.cpp index f4a00cc..df03f79 100644 --- a/logPlus/formdraw.cpp +++ b/logPlus/formdraw.cpp @@ -5492,7 +5492,7 @@ void FormDraw::initIMAGE_DATA(QMyCustomPlot *widget, QString strSlfName, QString widget->xAxis2->setTicks(false); widget->yAxis2->setTicks(false); // - LoadFromIMAGE_SLF(widget, strSlfName, strLineName); + widget->LoadFromIMAGE_SLF(strSlfName, strLineName); //显示文本 QString strAliasName = "岩心图片"; if(stringList.size() >= 1) @@ -5509,61 +5509,61 @@ void FormDraw::initIMAGE_DATA(QMyCustomPlot *widget, QString strSlfName, QString m_RightVal, m_LeftVal, strScaleType, "tableObject", stringList);//yanxinImageObject } -bool FormDraw::LoadFromIMAGE_SLF(QMyCustomPlot *widget, QString strSlfName, QString strLineName) -{ - { - QString ss=strSlfName; - CMemRdWt *logio=new CMemRdWt(); - if(ss==""||!logio->Open(ss.toStdString().c_str(),CSlfIO::modeRead)) - { - delete logio; - // QMessageBox::information(NULL,"提示","SLF文件打开失败,请检查!!",QMessageBox::Yes); - return false; - } - int iIndex=logio->OpenTable(strLineName.toStdString().c_str()); - if(iIndex>-1) { - int len=logio->GetTableRecordLength(iIndex); - if(lenOpen(ss.toStdString().c_str(),CSlfIO::modeRead)) +// { +// delete logio; +// // QMessageBox::information(NULL,"提示","SLF文件打开失败,请检查!!",QMessageBox::Yes); +// return false; +// } +// int iIndex=logio->OpenTable(strLineName.toStdString().c_str()); +// if(iIndex>-1) { +// int len=logio->GetTableRecordLength(iIndex); +// if(lenGetTableRecordCount(iIndex); - for(int i=0;iReadTable(iIndex,i+1,m_Result); - // WelllogItem* item=AddItem(m_Result->StartDepth,m_Result->EndDepth); - // if(!item) continue; - // OGWordsResultItem* pResult = dynamic_cast(item); - //logio->GetTableFieldData(iIndex,(char*)FieldName.toStdString().c_str(),m_Result->Image,i+1); +// int count=logio->GetTableRecordCount(iIndex); +// for(int i=0;iReadTable(iIndex,i+1,m_Result); +// // WelllogItem* item=AddItem(m_Result->StartDepth,m_Result->EndDepth); +// // if(!item) continue; +// // OGWordsResultItem* pResult = dynamic_cast(item); +// //logio->GetTableFieldData(iIndex,(char*)FieldName.toStdString().c_str(),m_Result->Image,i+1); - // SetCharacters(m_Result->Words); +// // SetCharacters(m_Result->Words); - // fontColor=QColor(0,0,0,255); - // backgroundColor=QColor(255,255,255,255); - // wordfont.setFamily("黑体"); - // wordfont.setPointSize(10); +// // fontColor=QColor(0,0,0,255); +// // backgroundColor=QColor(255,255,255,255); +// // wordfont.setFamily("黑体"); +// // wordfont.setPointSize(10); - //显示图片Image - QString filename=QString::fromLocal8Bit(m_Result->Image); - int pos=filename.lastIndexOf("\\"); - int pos1=filename.lastIndexOf("/"); - if(pos1>pos) pos=pos1; - if(filename.lastIndexOf(".")>-1) { - int aa=filename.lastIndexOf("."); - if(aaaddImageToPlot(-m_Result->EndDepth, -m_Result->StartDepth, filename, static_cast(m_Result->Left), static_cast(m_Result->Width)); - } - logio->CloseTable(iIndex); - delete buf; - } - delete logio; - } - return true; -} +// //显示图片Image +// QString filename=QString::fromLocal8Bit(m_Result->Image); +// int pos=filename.lastIndexOf("\\"); +// int pos1=filename.lastIndexOf("/"); +// if(pos1>pos) pos=pos1; +// if(filename.lastIndexOf(".")>-1) { +// int aa=filename.lastIndexOf("."); +// if(aaaddImageToPlot(-m_Result->EndDepth, -m_Result->StartDepth, filename, static_cast(m_Result->Left), static_cast(m_Result->Width)); +// } +// logio->CloseTable(iIndex); +// delete buf; +// } +// delete logio; +// } +// return true; +//} //解释结论 void FormDraw::initResult(QMyCustomPlot *widget, QString strSlfName, QString strLineName) @@ -6961,107 +6961,90 @@ void FormDraw::initCorePhysics(QMyCustomPlot *widget, QString strSlfName, QStrin widget->xAxis2->setTicks(false); 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); - - - // 加载slf文件 开始 QVector x, y; - Slf_CORE_PHYSICS *m_pResult=NULL; - CMemRdWt *logio=new CMemRdWt(); - if(strSlfName==""||!logio->Open(strSlfName.toStdString().c_str(),CSlfIO::modeRead)) - { - delete logio; - // QMessageBox::information(NULL,"提示","SLF文件打开失败,请检查!!",QMessageBox::Yes); - return; - } - int iIndex=logio->OpenTable(strLineName.toStdString().c_str()); - if(iIndex>-1) { - int FieldNo=0; - int count=logio->GetTableRecordCount(iIndex); - QString FieldName = "AC"; +// // 加载slf文件 开始 +// QVector x, y; +// Slf_CORE_PHYSICS *m_pResult=NULL; +// CMemRdWt *logio=new CMemRdWt(); +// if(strSlfName==""||!logio->Open(strSlfName.toStdString().c_str(),CSlfIO::modeRead)) +// { +// delete logio; +// // QMessageBox::information(NULL,"提示","SLF文件打开失败,请检查!!",QMessageBox::Yes); +// return; +// } +// int iIndex=logio->OpenTable(strLineName.toStdString().c_str()); +// if(iIndex>-1) { +// int FieldNo=0; +// int count=logio->GetTableRecordCount(iIndex); - if(!FieldName.isEmpty()) { - static int err=0; - FieldNo=logio->GetTableFieldNo(iIndex,(char *)FieldName.toStdString().c_str()); - if(FieldNo<0) { - if(!err)QMessageBox::information(nullptr, "提示", "岩心试验数据模块初始加载数据不成功,因为隐含"+FieldName+"字段在实际数据表中不存在,稍后请您重新选择有效字段!"); - err++; - delete logio; - return; - } - else err=0; - } - else { - delete logio; - return; - } - int len=logio->GetTableRecordLength(iIndex); - m_pResult=(Slf_CORE_PHYSICS *)new char[len+1]; - char buf[100]; - for(int i=0;iGetTableFieldData(iIndex,1,buf,i+1); - sscanf(buf,"%f",&m_pResult->Depth); - logio->GetTableFieldData(iIndex,2,buf,i+1); - sscanf(buf,"%f",&m_pResult->CorrDepth); - // logio->ReadTable(iIndex,i+1,m_pResult); +// QString FieldName = "AC"; - int Order = m_pResult->Order; - float depth = m_pResult->Depth; - float CorrDepth = m_pResult->CorrDepth; - float CoreValue = m_pResult->CoreValue; - logio->GetTableFieldData(iIndex,FieldNo,buf,i+1); +// if(!FieldName.isEmpty()) { +// static int err=0; +// FieldNo=logio->GetTableFieldNo(iIndex,(char *)FieldName.toStdString().c_str()); +// if(FieldNo<0) { +// if(!err)QMessageBox::information(nullptr, "提示", "岩心试验数据模块初始加载数据不成功,因为隐含"+FieldName+"字段在实际数据表中不存在,稍后请您重新选择有效字段!"); +// err++; +// delete logio; +// return; +// } +// else err=0; +// } +// else { +// delete logio; +// return; +// } +// int len=logio->GetTableRecordLength(iIndex); +// m_pResult=(Slf_CORE_PHYSICS *)new char[len+1]; +// char buf[100]; +// for(int i=0;iGetTableFieldData(iIndex,1,buf,i+1); +// sscanf(buf,"%f",&m_pResult->Depth); +// logio->GetTableFieldData(iIndex,2,buf,i+1); +// sscanf(buf,"%f",&m_pResult->CorrDepth); +// // logio->ReadTable(iIndex,i+1,m_pResult); - CoreValue=0; - sscanf(buf,"%f",&CoreValue); - // +// int Order = m_pResult->Order; +// float depth = m_pResult->Depth; +// float CorrDepth = m_pResult->CorrDepth; +// float CoreValue = m_pResult->CoreValue; +// logio->GetTableFieldData(iIndex,FieldNo,buf,i+1); - if(i==0) - { - //最大值,最小值默认采用第一个有效值 - //vmax = vmin = CoreValue; +// CoreValue=0; +// sscanf(buf,"%f",&CoreValue); +// // - //默认采用0-100范围 - if(vmaxCoreValue)vmin=CoreValue; - } - else - { - // - if(vmaxCoreValue)vmin=CoreValue; - } - // - x.append(-CorrDepth); - y.append(CoreValue); - // 已经加载了slf文件内容 显示界面上 - widget->addCorePhysicsWithParam(Order, static_cast(-depth), static_cast(-CorrDepth), static_cast(-CoreValue)); - } - logio->CloseTable(iIndex); - delete m_pResult; - } - delete logio; - // 加载slf文件结束 +// if(i==0) +// { +// //最大值,最小值默认采用第一个有效值 +// //vmax = vmin = CoreValue; + +// //默认采用0-100范围 +// if(vmaxCoreValue)vmin=CoreValue; +// } +// else +// { +// // +// if(vmaxCoreValue)vmin=CoreValue; +// } +// // +// x.append(-CorrDepth); +// y.append(CoreValue); +// // 已经加载了slf文件内容 显示界面上 +// widget->addCorePhysicsWithParam(Order, static_cast(-depth), static_cast(-CorrDepth), static_cast(-CoreValue)); +// } +// logio->CloseTable(iIndex); +// delete m_pResult; +// } +// delete logio; +// // 加载slf文件结束 + + // 加载slf文件 + widget->loadFromSLFCorePhysics(strSlfName, strLineName); QString strAliasName = "岩心实验数据"; QString strUnit = ""; @@ -7077,15 +7060,6 @@ void FormDraw::initCorePhysics(QMyCustomPlot *widget, QString strSlfName, QStrin addRandomGraph(widget, x, y, strSlfName, strLineName, strAliasName, strUnit, newLeftScale, newRightScale, strScaleType, lineColor, width, lineStyle, stringList); -// if(stringList.size() >= 1) -// { - -// } -// else -// { -// addRandomGraph(widget, x, y, strSlfName, strLineName, strAliasName, strUnit); -// } - //支持框选------------------ // widget->setSelectionRectMode(QCP::SelectionRectMode::srmSelect); widget->graph(0)->setSelectable(QCP::SelectionType::stMultipleDataRanges);// stSingleData diff --git a/logPlus/formdraw.h b/logPlus/formdraw.h index df788ec..5dfb59a 100644 --- a/logPlus/formdraw.h +++ b/logPlus/formdraw.h @@ -229,7 +229,7 @@ public: //岩心图片数据 void initIMAGE_DATA(QMyCustomPlot *widget, QString strSlfName, QString strLineName, QStringList listOtherProperty={}); - bool LoadFromIMAGE_SLF(QMyCustomPlot *widget, QString strSlfName, QString strLineName); +// bool LoadFromIMAGE_SLF(QMyCustomPlot *widget, QString strSlfName, QString strLineName); //深度 void initDepth(QMyCustomPlot *widget); diff --git a/logPlus/qmycustomplot.cpp b/logPlus/qmycustomplot.cpp index 3697218..6ab268e 100644 --- a/logPlus/qmycustomplot.cpp +++ b/logPlus/qmycustomplot.cpp @@ -1917,8 +1917,47 @@ void QMyCustomPlot::addItemsImage(){ //属性清空 PropertyService()->InitCurrentViewInfo(); } -void QMyCustomPlot::deleteItemsImage(){} -void QMyCustomPlot::refreshItemsImage(){} +void QMyCustomPlot::deleteItemsImage() +{ + if(QMessageBox::information(NULL,QObject::tr("提示"),QObject::tr("该功能将清除当前组件展示的全部信息,清除后无法恢复,但会备份到对应的\"_BAK\"中,确定清除吗?"),QMessageBox::Yes|QMessageBox::No)!=QMessageBox::Yes) return; + QString obj = m_strLineName + "BAK"; + CopyToSLFFile(m_strSlfName, false, (char *)obj.toStdString().c_str()); + AddTableToWellRound(); + + //删除对象 + TransparentDraggableImage *pDraggableRect =NULL; + QMap::Iterator it = m_mapDraggable_Image.begin(); + while( it != m_mapDraggable_Image.end() ) + { + pDraggableRect = (TransparentDraggableImage*)it.value(); + it++; + pDraggableRect->deleteRect(); + } + this->replot(); + + //保存 + SaveToSLFImage(); + //属性清空 + PropertyService()->InitCurrentViewInfo(); +} +void QMyCustomPlot::refreshItemsImage() +{ + //删除对象 + TransparentDraggableImage *pDraggableRect =NULL; + QMap::Iterator it = m_mapDraggable_Image.begin(); + while( it != m_mapDraggable_Image.end() ) + { + pDraggableRect = (TransparentDraggableImage*)it.value(); + it++; + pDraggableRect->deleteRect(); + } + + //重新加载 + this->LoadFromIMAGE_SLF(m_strSlfName, m_strLineName); + this->replot(); + //属性清空 + PropertyService()->InitCurrentViewInfo(); +} // 增加 void QMyCustomPlot::addCorePhysics() @@ -1952,10 +1991,46 @@ void QMyCustomPlot::pasteCorePhysics() {} //全部清空 void QMyCustomPlot::deleteCorePhysics() -{} +{ + if(QMessageBox::information(NULL,QObject::tr("提示"),QObject::tr("该功能将清除当前组件展示的全部信息,清除后无法恢复,但会备份到对应的\"_BAK\"中,确定清除吗?"),QMessageBox::Yes|QMessageBox::No)!=QMessageBox::Yes) return; + QString obj = m_strLineName + "BAK"; + CopyToSLFFile(m_strSlfName, false, (char *)obj.toStdString().c_str()); + AddTableToWellRound(); + + //删除对象 + TransparentDraggableCorePhysics *pDraggableRect =NULL; + QMap::Iterator it = m_mapDraggable_CorePhysics.begin(); + while( it != m_mapDraggable_CorePhysics.end() ) + { + pDraggableRect = (TransparentDraggableCorePhysics*)it.value(); + it++; + pDraggableRect->deleteRect(); + } + this->replot(); + + //保存 + saveToSLFCorePhysics(); + //属性清空 + PropertyService()->InitCurrentViewInfo(); +} //刷新数据 void QMyCustomPlot::refreshCorePhysics() -{} +{ + //删除对象 + TransparentDraggableCorePhysics *pDraggableRect =NULL; + QMap::Iterator it = m_mapDraggable_CorePhysics.begin(); + while( it != m_mapDraggable_CorePhysics.end() ) + { + pDraggableRect = (TransparentDraggableCorePhysics*)it.value(); + it++; + pDraggableRect->deleteRect(); + } + //重新加载 + this->loadFromSLFCorePhysics(m_strSlfName, m_strLineName); + this->replot(); + //属性清空 + PropertyService()->InitCurrentViewInfo(); +} //右键--添加录井剖面 void QMyCustomPlot::onEditGeoLith() @@ -3600,6 +3675,148 @@ void QMyCustomPlot::RefreshItems_GeoLith() PropertyService()->InitCurrentViewInfo(); } +bool QMyCustomPlot::LoadFromIMAGE_SLF(QString strSlfName, QString strLineName) +{ + { + QString ss=strSlfName; + CMemRdWt *logio=new CMemRdWt(); + if(ss==""||!logio->Open(ss.toStdString().c_str(),CSlfIO::modeRead)) + { + delete logio; + // QMessageBox::information(NULL,"提示","SLF文件打开失败,请检查!!",QMessageBox::Yes); + return false; + } + int iIndex=logio->OpenTable(strLineName.toStdString().c_str()); + if(iIndex>-1) { + int len=logio->GetTableRecordLength(iIndex); + if(lenGetTableRecordCount(iIndex); + for(int i=0;iReadTable(iIndex,i+1,m_Result); + // WelllogItem* item=AddItem(m_Result->StartDepth,m_Result->EndDepth); + // if(!item) continue; + // OGWordsResultItem* pResult = dynamic_cast(item); + //logio->GetTableFieldData(iIndex,(char*)FieldName.toStdString().c_str(),m_Result->Image,i+1); + + + // SetCharacters(m_Result->Words); + + // fontColor=QColor(0,0,0,255); + // backgroundColor=QColor(255,255,255,255); + // wordfont.setFamily("黑体"); + // wordfont.setPointSize(10); + + //显示图片Image + QString filename=QString::fromLocal8Bit(m_Result->Image); + int pos=filename.lastIndexOf("\\"); + int pos1=filename.lastIndexOf("/"); + if(pos1>pos) pos=pos1; + if(filename.lastIndexOf(".")>-1) { + int aa=filename.lastIndexOf("."); + if(aaaddImageToPlot(-m_Result->EndDepth, -m_Result->StartDepth, filename, static_cast(m_Result->Left), static_cast(m_Result->Width)); + } + logio->CloseTable(iIndex); + delete buf; + } + delete logio; + } + return true; +} + +bool QMyCustomPlot::loadFromSLFCorePhysics(QString strSlfName, QString strLineName) +{ + float vmax = 100; + float vmin = 0; + // 加载slf文件 开始 + QVector x, y; + Slf_CORE_PHYSICS *m_pResult=NULL; + CMemRdWt *logio=new CMemRdWt(); + if(strSlfName==""||!logio->Open(strSlfName.toStdString().c_str(),CSlfIO::modeRead)) + { + delete logio; + // QMessageBox::information(NULL,"提示","SLF文件打开失败,请检查!!",QMessageBox::Yes); + return false; + } + int iIndex=logio->OpenTable(strLineName.toStdString().c_str()); + if(iIndex>-1) { + int FieldNo=0; + int count=logio->GetTableRecordCount(iIndex); + + QString FieldName = "AC"; + + if(!FieldName.isEmpty()) { + static int err=0; + FieldNo=logio->GetTableFieldNo(iIndex,(char *)FieldName.toStdString().c_str()); + if(FieldNo<0) { + if(!err)QMessageBox::information(nullptr, "提示", "岩心试验数据模块初始加载数据不成功,因为隐含"+FieldName+"字段在实际数据表中不存在,稍后请您重新选择有效字段!"); + err++; + delete logio; + return false; + } + else err=0; + } + else { + delete logio; + return false; + } + int len=logio->GetTableRecordLength(iIndex); + m_pResult=(Slf_CORE_PHYSICS *)new char[len+1]; + char buf[100]; + for(int i=0;iGetTableFieldData(iIndex,1,buf,i+1); + sscanf(buf,"%f",&m_pResult->Depth); + logio->GetTableFieldData(iIndex,2,buf,i+1); + sscanf(buf,"%f",&m_pResult->CorrDepth); + // logio->ReadTable(iIndex,i+1,m_pResult); + + int Order = m_pResult->Order; + float depth = m_pResult->Depth; + float CorrDepth = m_pResult->CorrDepth; + float CoreValue = m_pResult->CoreValue; + logio->GetTableFieldData(iIndex,FieldNo,buf,i+1); + + CoreValue=0; + sscanf(buf,"%f",&CoreValue); + // + + if(i==0) + { + //最大值,最小值默认采用第一个有效值 + //vmax = vmin = CoreValue; + + //默认采用0-100范围 + if(vmaxCoreValue)vmin=CoreValue; + } + else + { + // + if(vmaxCoreValue)vmin=CoreValue; + } + // + x.append(-CorrDepth); + y.append(CoreValue); + // 已经加载了slf文件内容 显示界面上 + this->addCorePhysicsWithParam(Order, static_cast(-depth), static_cast(-CorrDepth), static_cast(-CoreValue)); + } + logio->CloseTable(iIndex); + delete m_pResult; + } + delete logio; + // 加载slf文件结束 + + return true; +} + bool QMyCustomPlot::LoadFromSLF_SwallCore(QString strSlfName, QString strLineName) { WALLCORE_DATA m_Result; diff --git a/logPlus/qmycustomplot.h b/logPlus/qmycustomplot.h index 7d17e2b..7ea8367 100644 --- a/logPlus/qmycustomplot.h +++ b/logPlus/qmycustomplot.h @@ -227,10 +227,12 @@ public: // 岩心图片 QMap zoneOrderImage; bool SaveToSLFImage(); + bool LoadFromIMAGE_SLF(QString strSlfName, QString strLineName); // 岩心分析 QMap zoneOrderCorePhysics; bool saveToSLFCorePhysics(); + bool loadFromSLFCorePhysics(QString strSlfName, QString strLineName); //井壁取心 QStringList liths_SWallCore; From 0ddd73f8bd07199741e14fa34de71b66d5e535b2 Mon Sep 17 00:00:00 2001 From: crqiqi77 Date: Tue, 31 Mar 2026 09:31:15 +0800 Subject: [PATCH 7/7] =?UTF-8?q?=E5=B2=A9=E5=BF=83=E5=88=86=E6=9E=90=20?= =?UTF-8?q?=E5=B1=9E=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- logPlus/PropertyWidget.cpp | 1064 +++++++------------ logPlus/TransparentDraggableCorePhysics.cpp | 57 +- logPlus/TransparentDraggableCorePhysics.h | 7 +- logPlus/qmycustomplot.cpp | 8 +- 4 files changed, 453 insertions(+), 683 deletions(-) diff --git a/logPlus/PropertyWidget.cpp b/logPlus/PropertyWidget.cpp index 9091063..f00f8a2 100644 --- a/logPlus/PropertyWidget.cpp +++ b/logPlus/PropertyWidget.cpp @@ -30,11 +30,11 @@ PropertyWidget::PropertyWidget(const QString &title, QWidget *parent , Qt::Windo connect( m_pVariantManager,SIGNAL(valueChanged(QtProperty *, const QVariant &)), this,SLOT(SlotPropertyChanged(QtProperty *, const QVariant &)) ); - QtColorSchemeComboBoxFactory * colorSchemeComboBoxFactory = new QtColorSchemeComboBoxFactory(); - m_pColorSchemeManager = new QtColorSchemeComboBoxPropertyManager(); - m_pPropertyBrowser->setFactoryForManager(m_pColorSchemeManager, colorSchemeComboBoxFactory); - connect(m_pColorSchemeManager, SIGNAL(valueChanged(QtProperty *, const int &, bool)), this, - SLOT(SlotPropertyChanged(QtProperty *, const int &, bool))); + QtColorSchemeComboBoxFactory * colorSchemeComboBoxFactory = new QtColorSchemeComboBoxFactory(); + m_pColorSchemeManager = new QtColorSchemeComboBoxPropertyManager(); + m_pPropertyBrowser->setFactoryForManager(m_pColorSchemeManager, colorSchemeComboBoxFactory); + connect(m_pColorSchemeManager, SIGNAL(valueChanged(QtProperty *, const int &, bool)), this, + SLOT(SlotPropertyChanged(QtProperty *, const int &, bool))); } PropertyWidget::~PropertyWidget() @@ -72,24 +72,24 @@ void PropertyWidget::InitCurrentViewInfo(bool bAll) m_propertyData.clear(); m_mapGroupItem.clear(); - if (bAll) - { - m_fromTop = NULL; - m_formInfo = NULL; - m_formHead = NULL; - m_tableWidget = NULL; - m_item = NULL; + if (bAll) + { + m_fromTop = NULL; + m_formInfo = NULL; + m_formHead = NULL; + m_tableWidget = NULL; + m_item = NULL; m_tdGujing = NULL; // - m_strUuid = ""; - m_strTrackUuid = ""; - m_strSlfName = ""; - m_strWellName = ""; - m_strTrackName = ""; - m_strLineName = ""; - // - m_strCurrentProperty = ""; - } + m_strUuid = ""; + m_strTrackUuid = ""; + m_strSlfName = ""; + m_strWellName = ""; + m_strTrackName = ""; + m_strLineName = ""; + // + m_strCurrentProperty = ""; + } } //处理通用属性 @@ -472,7 +472,6 @@ void PropertyWidget::changedCorePhysicsProperty(QtProperty *qtProperty, const QV else if("数值" == m_propertyData[qtProperty]) { double temp = variant.toDouble(); -// this->m_formInfo->m_cp_coreValue = temp; this->m_tdCorePhysics->setCpCoreValue(temp); this->m_tdCorePhysics->mPlot->saveToSLFCorePhysics(); } @@ -587,36 +586,36 @@ void PropertyWidget::SlotPropertyChanged( QtProperty *pProperty, const QVariant } if (m_strCurrentProperty == Table_Property)//解释结论 - { - bool bDraw = false; - QStringList slist; - slist << "显示名称" << "垂向绘制" << "旋转角度(°)" << "字体" << "颜色" - << "结论占比%" << "显示位置(cm)" << "显示层号" << "层号字体" << "层号旋转"; - for (int i = 0; i < slist.length(); i++) - { - if (slist.at(i) == m_propertyData[pProperty]) - { - bDraw = m_formInfo->setInfoProperty(m_propertyData[pProperty], variant); - break; - } - } + { + bool bDraw = false; + QStringList slist; + slist << "显示名称" << "垂向绘制" << "旋转角度(°)" << "字体" << "颜色" + << "结论占比%" << "显示位置(cm)" << "显示层号" << "层号字体" << "层号旋转"; + for (int i = 0; i < slist.length(); i++) + { + if (slist.at(i) == m_propertyData[pProperty]) + { + bDraw = m_formInfo->setInfoProperty(m_propertyData[pProperty], variant); + break; + } + } - if (!slist.contains(m_propertyData[pProperty])) - bDraw = true; + if (!slist.contains(m_propertyData[pProperty])) + bDraw = true; - if (bDraw) - { - QVariantList listCond; - listCond << m_strUuid; - listCond << m_strSlfName; - listCond << m_strWellName; - listCond << m_strTrackName; - listCond << m_strLineName; - listCond << m_propertyData[pProperty]; - listCond << variant; - emit CallManage::getInstance()->sig_changeDrawProperty(listCond); - } - } + if (bDraw) + { + QVariantList listCond; + listCond << m_strUuid; + listCond << m_strSlfName; + listCond << m_strWellName; + listCond << m_strTrackName; + listCond << m_strLineName; + listCond << m_propertyData[pProperty]; + listCond << variant; + emit CallManage::getInstance()->sig_changeDrawProperty(listCond); + } + } else if(m_strCurrentProperty == Track_Property) { if(m_fromTop == NULL) @@ -652,46 +651,46 @@ void PropertyWidget::SlotPropertyChanged( QtProperty *pProperty, const QVariant } return; } - else if (m_strCurrentProperty == Wave_Property) - { - bool bDraw = false; - QStringList slist; - slist << "显示名称" << "显示单位" << "曲线名称" << "曲线单位" << "曲线刻度" - << "类型" << "方式" << "左刻度" << "右刻度" << "幅度刻度" << "最大振幅" << "颜色" << "线宽" - << "绘制波深度" << "绘制波基线" << "奇偶配色" - << "波列基值" << "波形间隔" << "波形高度" << "显示刻度" << "色板" << "变密度颜色级数"; - for (int i = 0; i < slist.length(); i++) - { - if (slist.at(i) == m_propertyData[pProperty]) - { - bDraw = m_formInfo->setInfoProperty(m_propertyData[pProperty], variant); - break; - } - } + else if (m_strCurrentProperty == Wave_Property) + { + bool bDraw = false; + QStringList slist; + slist << "显示名称" << "显示单位" << "曲线名称" << "曲线单位" << "曲线刻度" + << "类型" << "方式" << "左刻度" << "右刻度" << "幅度刻度" << "最大振幅" << "颜色" << "线宽" + << "绘制波深度" << "绘制波基线" << "奇偶配色" + << "波列基值" << "波形间隔" << "波形高度" << "显示刻度" << "色板" << "变密度颜色级数"; + for (int i = 0; i < slist.length(); i++) + { + if (slist.at(i) == m_propertyData[pProperty]) + { + bDraw = m_formInfo->setInfoProperty(m_propertyData[pProperty], variant); + break; + } + } - if(!slist.contains(m_propertyData[pProperty])) - bDraw = true; + if(!slist.contains(m_propertyData[pProperty])) + bDraw = true; - if (bDraw) - { - QVariantList listCond; - listCond << m_strUuid; - listCond << m_strSlfName; - listCond << m_strWellName; - listCond << m_strTrackName; - listCond << m_strLineName; - listCond << m_propertyData[pProperty]; - listCond << variant; - emit CallManage::getInstance()->sig_changeDrawProperty(listCond); - } + if (bDraw) + { + QVariantList listCond; + listCond << m_strUuid; + listCond << m_strSlfName; + listCond << m_strWellName; + listCond << m_strTrackName; + listCond << m_strLineName; + listCond << m_propertyData[pProperty]; + listCond << variant; + emit CallManage::getInstance()->sig_changeDrawProperty(listCond); + } - if ("类型" == m_propertyData[pProperty]) - { - this->InitCurrentViewInfo(false); - initWaveProperty(m_formInfo, variant.toInt()); - } - return; - } + if ("类型" == m_propertyData[pProperty]) + { + this->InitCurrentViewInfo(false); + initWaveProperty(m_formInfo, variant.toInt()); + } + return; + } else if (m_strCurrentProperty == Gujing_Property)//固井结论道 { //先处理通用属性 @@ -874,7 +873,7 @@ void PropertyWidget::SlotPropertyChanged( QtProperty *pProperty, const QVariant } } else if (m_strCurrentProperty == LayerItem_Property) - { + { //先处理通用属性 CommonPropertyChanged(pProperty, variant); @@ -942,68 +941,54 @@ void PropertyWidget::SlotPropertyChanged( QtProperty *pProperty, const QVariant else if("岩性" == m_propertyData[pProperty]) { QString newResult = variant.value(); - - //只能选择自己的符号,不能选择其他。 - QString strDefaultPath = ::GetLithSymbolDir(); - //符号统一 - strDefaultPath.replace("\\","/"); - newResult.replace("\\","/"); + m_tdLayer->setLith(newResult); // - if(newResult.contains(strDefaultPath)) + QCPRange currentRange = m_tdLayer->getRange(); + m_tdLayer->setRange(currentRange.lower, currentRange.upper); + } + } + else if (m_strCurrentProperty == JieshiItem_Property) + { + if (m_tdJieshi) + { + if ("顶深(m)" == m_propertyData[pProperty]) { - m_tdLayer->setLith(newResult); - // - QCPRange currentRange = m_tdLayer->getRange(); - m_tdLayer->setRange(currentRange.lower, currentRange.upper); + double upper = variant.value(); + m_tdJieshi->setDragRect(2, -upper); } - else { - QMessageBox::information(nullptr,"提示","所选目录不支持"); - return; + else if ("底深(m)" == m_propertyData[pProperty]) + { + double lower = variant.value(); + m_tdJieshi->setDragRect(1, -lower); + } + else + { + QString strProperty = m_propertyData[pProperty]; + if (strProperty == "油气结论") + { + m_tdJieshi->setDragResult(0, variant.toString()); + return; + } + int nidx = strProperty.indexOf("油气结论"); + if (nidx >= 0) + { + int nret = extractNumbers("油气结论(\\d+)", strProperty); + m_tdJieshi->setDragResult(nret, variant.toString()); + return; + } + nidx = strProperty.indexOf("分段点"); + if (nidx >= 0) + { + int nret = extractNumbers("分段点(\\d+)深度", strProperty); + m_tdJieshi->setDragDepth(nret, variant.toDouble()); + + return; + } } } } - else if (m_strCurrentProperty == JieshiItem_Property) - { - if (m_tdJieshi) - { - if ("顶深(m)" == m_propertyData[pProperty]) - { - double upper = variant.value(); - m_tdJieshi->setDragRect(2, -upper); - } - else if ("底深(m)" == m_propertyData[pProperty]) - { - double lower = variant.value(); - m_tdJieshi->setDragRect(1, -lower); - } - else - { - QString strProperty = m_propertyData[pProperty]; - if (strProperty == "油气结论") - { - m_tdJieshi->setDragResult(0, variant.toString()); - return; - } - int nidx = strProperty.indexOf("油气结论"); - if (nidx >= 0) - { - int nret = extractNumbers("油气结论(\\d+)", strProperty); - m_tdJieshi->setDragResult(nret, variant.toString()); - return; - } - nidx = strProperty.indexOf("分段点"); - if (nidx >= 0) - { - int nret = extractNumbers("分段点(\\d+)深度", strProperty); - m_tdJieshi->setDragDepth(nret, variant.toDouble()); - - return; - } - } - } - } else if (m_strCurrentProperty == GujingItem_Property) - { + { //先处理通用属性 CommonPropertyChanged(pProperty, variant); @@ -1036,26 +1021,12 @@ void PropertyWidget::SlotPropertyChanged( QtProperty *pProperty, const QVariant if(m_tdGujing) { QString newResult = variant.value(); - - //只能选择自己的符号,不能选择其他。 - QString strDefaultPath = ::GetGujingSymbolDir(); - //符号统一 - strDefaultPath.replace("\\","/"); - newResult.replace("\\","/"); + m_tdGujing->setResult(newResult); // - if(newResult.contains(strDefaultPath)) - { - m_tdGujing->setResult(newResult); - // - QCPRange currentRange = m_tdGujing->getRange(); - m_tdGujing->setRange(currentRange.lower, currentRange.upper); - //保存 - m_tdGujing->mPlot->SaveToSLF_Gujing(); - } - else { - QMessageBox::information(nullptr,"提示","所选目录不支持"); - return; - } + QCPRange currentRange = m_tdGujing->getRange(); + m_tdGujing->setRange(currentRange.lower, currentRange.upper); + //保存 + m_tdGujing->mPlot->SaveToSLF_Gujing(); } } } @@ -1105,26 +1076,12 @@ void PropertyWidget::SlotPropertyChanged( QtProperty *pProperty, const QVariant if(m_tdSwallCore) { QString newResult = variant.value(); - - //只能选择自己的符号,不能选择其他。 - QString strDefaultPath = ::GetSymbolDir()+"取心岩性符号"; - //符号统一 - strDefaultPath.replace("\\","/"); - newResult.replace("\\","/"); + m_tdSwallCore->setLith(newResult); // - if(newResult.contains(strDefaultPath)) - { - m_tdSwallCore->setLith(newResult); - // - QCPRange currentRange = m_tdSwallCore->getRange(); - m_tdSwallCore->setRange(currentRange.lower, currentRange.upper); - //保存 - m_tdSwallCore->mPlot->SaveToSLF_SwallCore(); - } - else { - QMessageBox::information(nullptr,"提示","所选目录不支持"); - return; - } + QCPRange currentRange = m_tdSwallCore->getRange(); + m_tdSwallCore->setRange(currentRange.lower, currentRange.upper); + //保存 + m_tdSwallCore->mPlot->SaveToSLF_SwallCore(); } } else if("油气" == m_propertyData[pProperty]) @@ -1133,26 +1090,12 @@ void PropertyWidget::SlotPropertyChanged( QtProperty *pProperty, const QVariant if(m_tdSwallCore) { QString newResult = variant.value(); - - //只能选择自己的符号,不能选择其他。 - QString strDefaultPath = ::GetGasSymbolDir(); - //符号统一 - strDefaultPath.replace("\\","/"); - newResult.replace("\\","/"); + m_tdSwallCore->setOil(newResult); // - if(newResult.contains(strDefaultPath)) - { - m_tdSwallCore->setOil(newResult); - // - QCPRange currentRange = m_tdSwallCore->getRange(); - m_tdSwallCore->setRange(currentRange.lower, currentRange.upper); - //保存 - m_tdSwallCore->mPlot->SaveToSLF_SwallCore(); - } - else { - QMessageBox::information(nullptr,"提示","所选目录不支持"); - return; - } + QCPRange currentRange = m_tdSwallCore->getRange(); + m_tdSwallCore->setRange(currentRange.lower, currentRange.upper); + //保存 + m_tdSwallCore->mPlot->SaveToSLF_SwallCore(); } } else if("颜色" == m_propertyData[pProperty]) @@ -1162,37 +1105,24 @@ void PropertyWidget::SlotPropertyChanged( QtProperty *pProperty, const QVariant { QString ColorImage = variant.value(); - //只能选择自己的符号,不能选择其他。 - QString strDefaultPath = ::GetColorSymbolDir(); - //符号统一 - strDefaultPath.replace("\\","/"); + QString name = ""; + int CoreColor = 0; ColorImage.replace("\\","/"); + int l=ColorImage.lastIndexOf("/"); + if(l>-1) name=ColorImage.mid(l+1); + + l=name.indexOf("."); + if(l>-1)name=name.left(l); + int ind=m_tdSwallCore->mPlot->colors_SWallCore.indexOf(name); + if(ind<0||ind>=m_tdSwallCore->mPlot->colorinds_SWallCore.size()) CoreColor=0; + else CoreColor=m_tdSwallCore->mPlot->colorinds_SWallCore[ind].toInt(); + + m_tdSwallCore->setTitle(QString::number(CoreColor)); // - if(ColorImage.contains(strDefaultPath)) - { - QString name = ""; - int CoreColor = 0; - ColorImage.replace("\\","/"); - int l=ColorImage.lastIndexOf("/"); - if(l>-1) name=ColorImage.mid(l+1); - - l=name.indexOf("."); - if(l>-1)name=name.left(l); - int ind=m_tdSwallCore->mPlot->colors_SWallCore.indexOf(name); - if(ind<0||ind>=m_tdSwallCore->mPlot->colorinds_SWallCore.size()) CoreColor=0; - else CoreColor=m_tdSwallCore->mPlot->colorinds_SWallCore[ind].toInt(); - - m_tdSwallCore->setTitle(QString::number(CoreColor)); - // - QCPRange currentRange = m_tdSwallCore->getRange(); - m_tdSwallCore->setRange(currentRange.lower, currentRange.upper); - //保存 - m_tdSwallCore->mPlot->SaveToSLF_SwallCore(); - } - else { - QMessageBox::information(nullptr,"提示","所选目录不支持"); - return; - } + QCPRange currentRange = m_tdSwallCore->getRange(); + m_tdSwallCore->setRange(currentRange.lower, currentRange.upper); + //保存 + m_tdSwallCore->mPlot->SaveToSLF_SwallCore(); } } else if("起始位置" == m_propertyData[pProperty]) @@ -1244,26 +1174,12 @@ void PropertyWidget::SlotPropertyChanged( QtProperty *pProperty, const QVariant if(m_tdGeoLith) { QString newResult = variant.value(); - - //只能选择自己的符号,不能选择其他。 - QString strDefaultPath = ::GetMudSymbolDir(); - //符号统一 - strDefaultPath.replace("\\","/"); - newResult.replace("\\","/"); + m_tdGeoLith->setLith(newResult, m_tdGeoLith->m_Color); // - if(newResult.contains(strDefaultPath)) - { - m_tdGeoLith->setLith(newResult, m_tdGeoLith->m_Color); - // - QCPRange currentRange = m_tdGeoLith->getRange(); - m_tdGeoLith->setRange(currentRange.lower, currentRange.upper); - //保存 - m_tdGeoLith->mPlot->SaveToSLF_GeoLith(); - } - else { - QMessageBox::information(nullptr,"提示","所选目录不支持"); - return; - } + QCPRange currentRange = m_tdGeoLith->getRange(); + m_tdGeoLith->setRange(currentRange.lower, currentRange.upper); + //保存 + m_tdGeoLith->mPlot->SaveToSLF_GeoLith(); } } else if("油气" == m_propertyData[pProperty]) @@ -1272,26 +1188,12 @@ void PropertyWidget::SlotPropertyChanged( QtProperty *pProperty, const QVariant if(m_tdGeoLith) { QString newResult = variant.value(); - - //只能选择自己的符号,不能选择其他。 - QString strDefaultPath = ::GetGasSymbolDir(); - //符号统一 - strDefaultPath.replace("\\","/"); - newResult.replace("\\","/"); + m_tdGeoLith->setOil(newResult); // - if(newResult.contains(strDefaultPath)) - { - m_tdGeoLith->setOil(newResult); - // - QCPRange currentRange = m_tdGeoLith->getRange(); - m_tdGeoLith->setRange(currentRange.lower, currentRange.upper); - //保存 - m_tdGeoLith->mPlot->SaveToSLF_GeoLith(); - } - else { - QMessageBox::information(nullptr,"提示","所选目录不支持"); - return; - } + QCPRange currentRange = m_tdGeoLith->getRange(); + m_tdGeoLith->setRange(currentRange.lower, currentRange.upper); + //保存 + m_tdGeoLith->mPlot->SaveToSLF_GeoLith(); } } else if("颜色" == m_propertyData[pProperty]) @@ -1300,26 +1202,12 @@ void PropertyWidget::SlotPropertyChanged( QtProperty *pProperty, const QVariant if(m_tdGeoLith) { QString newResult = variant.value(); - - //只能选择自己的符号,不能选择其他。 - QString strDefaultPath = ::GetColorSymbolDir(); - //符号统一 - strDefaultPath.replace("\\","/"); - newResult.replace("\\","/"); + m_tdGeoLith->setLith(m_tdGeoLith->m_Lith, newResult); // - if(newResult.contains(strDefaultPath)) - { - m_tdGeoLith->setLith(m_tdGeoLith->m_Lith, newResult); - // - QCPRange currentRange = m_tdGeoLith->getRange(); - m_tdGeoLith->setRange(currentRange.lower, currentRange.upper); - //保存 - m_tdGeoLith->mPlot->SaveToSLF_GeoLith(); - } - else { - QMessageBox::information(nullptr,"提示","所选目录不支持"); - return; - } + QCPRange currentRange = m_tdGeoLith->getRange(); + m_tdGeoLith->setRange(currentRange.lower, currentRange.upper); + //保存 + m_tdGeoLith->mPlot->SaveToSLF_GeoLith(); } } else if("含油占比(1~8)" == m_propertyData[pProperty]) @@ -1787,38 +1675,24 @@ void PropertyWidget::SlotPropertyChanged( QtProperty *pProperty, const QVariant //-------------------------- QString newResult = variant.value(); - - //只能选择自己的符号,不能选择其他。 - QString strDefaultPath = GetSymbolDir()+"管柱组件"; - //符号统一 - strDefaultPath.replace("\\","/"); - newResult.replace("\\","/"); + m_tdGuan->setResult(newResult); // - if(newResult.contains(strDefaultPath)) - { - m_tdGuan->setResult(newResult); - // - QCPRange currentRange = m_tdGuan->getRange(); - m_tdGuan->setRange(currentRange.lower, currentRange.upper); - //保存 - m_tdGuan->mPlot->SaveToSLF_Tubing(); + QCPRange currentRange = m_tdGuan->getRange(); + m_tdGuan->setRange(currentRange.lower, currentRange.upper); + //保存 + m_tdGuan->mPlot->SaveToSLF_Tubing(); - //--------- - bool bReDrawNew = m_tdGuan->mPlot->checkTubingName(m_tdGuan->m_Result); - if(bReDrawOld || bReDrawNew) - { - //组件改变后,重绘管柱 - m_tdGuan->mPlot->LoadFromSLF_ReDrawTubing(m_tdGuan->mPlot->m_strSlfName, m_tdGuan->mPlot->m_strLineName); - } - } - else { - QMessageBox::information(nullptr,"提示","所选目录不支持"); - return; + //--------- + bool bReDrawNew = m_tdGuan->mPlot->checkTubingName(m_tdGuan->m_Result); + if(bReDrawOld || bReDrawNew) + { + //组件改变后,重绘管柱 + m_tdGuan->mPlot->LoadFromSLF_ReDrawTubing(m_tdGuan->mPlot->m_strSlfName, m_tdGuan->mPlot->m_strLineName); } } } } - else if (m_strCurrentProperty == Depth_Property) // 深度 + else if (m_strCurrentProperty == Depth_Property) // 深度 { //先处理通用属性 CommonPropertyChanged(pProperty, variant); @@ -2295,7 +2169,7 @@ void PropertyWidget::SlotPropertyChanged( QtProperty *pProperty, const QVariant m_item->setFont(newFont); } } - + @@ -2304,22 +2178,22 @@ void PropertyWidget::SlotPropertyChanged( QtProperty *pProperty, const QVariant void PropertyWidget::SlotPropertyChanged(QtProperty *property, const int &val, bool islinestyle) { - QString str = m_propertyData[property]; - if (m_strCurrentProperty == Wave_Property) - { - m_formInfo->setInfoProperty(str, val); + QString str = m_propertyData[property]; + if (m_strCurrentProperty == Wave_Property) + { + m_formInfo->setInfoProperty(str, val); - QVariantList listCond; - listCond << m_strUuid; - listCond << m_strSlfName; - listCond << m_strWellName; - listCond << m_strTrackName; - listCond << m_strLineName; - listCond << str; - listCond << val; - emit CallManage::getInstance()->sig_changeDrawProperty(listCond); - } - return; + QVariantList listCond; + listCond << m_strUuid; + listCond << m_strSlfName; + listCond << m_strWellName; + listCond << m_strTrackName; + listCond << m_strLineName; + listCond << str; + listCond << val; + emit CallManage::getInstance()->sig_changeDrawProperty(listCond); + } + return; } void PropertyWidget::ChangHeadItemProperty() @@ -2547,14 +2421,14 @@ QtVariantProperty* PropertyWidget::_CreateVariantPropertyItem(QString strGroup, m_propertyData[item] = strPropertyCaption; pGroupItem->addSubProperty(item); - // 字体不展开 - if (QVariant::Font == propertyType || QVariant::Color == propertyType) - { - QList list = m_pPropertyBrowser->items(item); - if (list.size() > 0) - m_pPropertyBrowser->setExpanded(list.at(0), false); - } - return item; + // 字体不展开 + if (QVariant::Font == propertyType || QVariant::Color == propertyType) + { + QList list = m_pPropertyBrowser->items(item); + if (list.size() > 0) + m_pPropertyBrowser->setExpanded(list.at(0), false); + } + return item; } void PropertyWidget::_CreateVariantPropertyItem(QString strGroup, QString strPropertyCaption, QVariant vtPropertyValue, int propertyType, double dMin, double dMax) @@ -2607,33 +2481,33 @@ void PropertyWidget::_CreateEnumPropertyItem(QString strGroup, QString strProper void PropertyWidget::_CreateColorSchemePropertyItem(QString strGroup, QString strPropertyCaption, QVariant vtPropertyValue) { - QtProperty *pGroupItem = NULL; - { - QMap::Iterator it = m_mapGroupItem.find(strGroup); - if (it != m_mapGroupItem.end()) - { - pGroupItem = it.value(); - } - else - { - pGroupItem = m_pVariantManager->addProperty(QtVariantPropertyManager::groupTypeId(), strGroup); - m_mapGroupItem[strGroup] = pGroupItem; - m_pPropertyBrowser->addProperty(pGroupItem); - } - } + QtProperty *pGroupItem = NULL; + { + QMap::Iterator it = m_mapGroupItem.find(strGroup); + if (it != m_mapGroupItem.end()) + { + pGroupItem = it.value(); + } + else + { + pGroupItem = m_pVariantManager->addProperty(QtVariantPropertyManager::groupTypeId(), strGroup); + m_mapGroupItem[strGroup] = pGroupItem; + m_pPropertyBrowser->addProperty(pGroupItem); + } + } - QtProperty *colorSchemeProperty = m_pColorSchemeManager->addProperty(strPropertyCaption); - m_pColorSchemeManager->setLinear(colorSchemeProperty); - if (colorSchemeProperty) - { - m_propertyData[colorSchemeProperty] = strPropertyCaption; - pGroupItem->addSubProperty(colorSchemeProperty); - m_pColorSchemeManager->setValue(colorSchemeProperty, vtPropertyValue.toInt(), false); - //if (pMetaProperty) - //{ - // m_mapProperty[colorSchemeProperty] = pMetaProperty; - //} - } + QtProperty *colorSchemeProperty = m_pColorSchemeManager->addProperty(strPropertyCaption); + m_pColorSchemeManager->setLinear(colorSchemeProperty); + if (colorSchemeProperty) + { + m_propertyData[colorSchemeProperty] = strPropertyCaption; + pGroupItem->addSubProperty(colorSchemeProperty); + m_pColorSchemeManager->setValue(colorSchemeProperty, vtPropertyValue.toInt(), false); + //if (pMetaProperty) + //{ + // m_mapProperty[colorSchemeProperty] = pMetaProperty; + //} + } } void PropertyWidget::initWidgetProperty(QString strUuid, int iScale) @@ -2731,7 +2605,7 @@ void PropertyWidget::initCurveProperty(FormInfo *formInfo, QStringList strListOt //初始化,清空 InitCurrentViewInfo(); m_strUuid = formInfo->m_strUuid; - m_strTrackUuid = formInfo->m_strTrackUuid; + m_strTrackUuid = formInfo->m_strTrackUuid; m_formInfo = formInfo; // @@ -2810,8 +2684,8 @@ void PropertyWidget::initCurveProperty(FormInfo *formInfo, QStringList strListOt _CreateVariantPropertyItem("刻度设置", "左刻度", formInfo->m_vmin, QVariant::Double); _CreateVariantPropertyItem("刻度设置", "右刻度", formInfo->m_vmax, QVariant::Double); _CreateEnumPropertyItem("刻度设置", "刻度类型", listScaleType.indexOf(formInfo->m_strScaleType), listScaleType); - _CreateVariantPropertyItem("刻度设置", "左跨道个数", formInfo->m_nLeftCross, QVariant::Int); - _CreateVariantPropertyItem("刻度设置", "右跨道个数", formInfo->m_nRightCross, QVariant::Int); + _CreateVariantPropertyItem("刻度设置", "左跨道个数", formInfo->m_nLeftCross, QVariant::Int); + _CreateVariantPropertyItem("刻度设置", "右跨道个数", formInfo->m_nRightCross, QVariant::Int); // _CreateVariantPropertyItem("曲线线型", "线宽", formInfo->m_dWidth, QVariant::Double, 1, 20); _CreateVariantPropertyItem("曲线线型", "颜色", formInfo->m_lineColor, QVariant::Color); @@ -2840,8 +2714,8 @@ void PropertyWidget::initCurveProperty(FormInfo *formInfo, QStringList strListOt _CreateVariantPropertyItem("岩性填充", "岩性前景色", formInfo->m_frontColor, QVariant::Color); _CreateVariantPropertyItem("岩性填充", "岩性背景色", formInfo->m_backColor, QVariant::Color); - //当前属性类型 - m_strCurrentProperty = Curve_Property; + //当前属性类型 + m_strCurrentProperty = Curve_Property; } @@ -2907,21 +2781,21 @@ void PropertyWidget::initHeadProperty(FormHead *formHead, QTableWidget *tableWid void PropertyWidget::initTableProperty(FormInfo *formInfo) { - _CreateVariantPropertyItem("通常", "选择井曲线", m_strLineName + "@" + m_strSlfName, QVariant::String); + _CreateVariantPropertyItem("通常", "选择井曲线", m_strLineName + "@" + m_strSlfName, QVariant::String); - _CreateVariantPropertyItem("名称", "显示名称", formInfo->m_strLineName, QVariant::String); - _CreateVariantPropertyItem("名称", "垂向绘制", formInfo->m_bVerticaDrawing, QVariant::Bool); - _CreateVariantPropertyItem("名称", "旋转角度(°)", formInfo->m_nRotationAngle, QVariant::Int); - _CreateVariantPropertyItem("名称", "字体", formInfo->m_curveNameFont, QVariant::Font); - _CreateVariantPropertyItem("名称", "颜色", formInfo->m_lineColor, QVariant::Color); + _CreateVariantPropertyItem("名称", "显示名称", formInfo->m_strLineName, QVariant::String); + _CreateVariantPropertyItem("名称", "垂向绘制", formInfo->m_bVerticaDrawing, QVariant::Bool); + _CreateVariantPropertyItem("名称", "旋转角度(°)", formInfo->m_nRotationAngle, QVariant::Int); + _CreateVariantPropertyItem("名称", "字体", formInfo->m_curveNameFont, QVariant::Font); + _CreateVariantPropertyItem("名称", "颜色", formInfo->m_lineColor, QVariant::Color); - _CreateVariantPropertyItem("显示", "结论占比%", formInfo->m_nConclusionProportion, QVariant::Int); - _CreateVariantPropertyItem("显示", "显示位置(cm)", formInfo->m_nShowPos, QVariant::Int); - _CreateVariantPropertyItem("显示", "显示层号", formInfo->m_bShowLayerNo, QVariant::Bool); - _CreateVariantPropertyItem("显示", "层号字体", formInfo->m_layerFont, QVariant::Font); - _CreateVariantPropertyItem("显示", "层号旋转", formInfo->m_fLayerRotate, QVariant::Double); + _CreateVariantPropertyItem("显示", "结论占比%", formInfo->m_nConclusionProportion, QVariant::Int); + _CreateVariantPropertyItem("显示", "显示位置(cm)", formInfo->m_nShowPos, QVariant::Int); + _CreateVariantPropertyItem("显示", "显示层号", formInfo->m_bShowLayerNo, QVariant::Bool); + _CreateVariantPropertyItem("显示", "层号字体", formInfo->m_layerFont, QVariant::Font); + _CreateVariantPropertyItem("显示", "层号旋转", formInfo->m_fLayerRotate, QVariant::Double); - m_strCurrentProperty = Table_Property; + m_strCurrentProperty = Table_Property; } void PropertyWidget::initDepthProperty(FormInfo *formInfo) @@ -2965,24 +2839,24 @@ void PropertyWidget::initDepthProperty(FormInfo *formInfo) void PropertyWidget::initProperty(FormInfo *formInfo) { - if (formInfo == NULL) - return; + if (formInfo == NULL) + return; - //初始化,清空 - InitCurrentViewInfo(); + //初始化,清空 + InitCurrentViewInfo(); - m_formInfo = formInfo; + m_formInfo = formInfo; - m_strUuid = formInfo->m_strUuid; - m_strTrackUuid = formInfo->m_strTrackUuid; - // - m_strSlfName = formInfo->m_strSlfName; - m_strWellName = formInfo->m_strWellName; - m_strTrackName = formInfo->m_strTrackName; - m_strLineName = formInfo->m_strLineName; + m_strUuid = formInfo->m_strUuid; + m_strTrackUuid = formInfo->m_strTrackUuid; + // + m_strSlfName = formInfo->m_strSlfName; + m_strWellName = formInfo->m_strWellName; + m_strTrackName = formInfo->m_strTrackName; + m_strLineName = formInfo->m_strLineName; - if (formInfo->m_strType == "tableObject") - { + if (formInfo->m_strType == "tableObject") + { if (m_strLineName == "GUJING1_RESULT" || m_strLineName == "GUJING2_RESULT" || m_strLineName == "GUJING3_RESULT") { //固井结论 @@ -3022,18 +2896,18 @@ void PropertyWidget::initProperty(FormInfo *formInfo) { this->initTableProperty(formInfo); } - } - else if (formInfo->m_strType == "depthObject") - { - this->initDepthProperty(formInfo); - } - else if (formInfo->m_strType == "roseObject") - { - this->initRoseProperty(formInfo); - } - else if (formInfo->m_strType == "waveObject") - { - this->initWaveProperty(formInfo, formInfo->m_nDrawType); + } + else if (formInfo->m_strType == "depthObject") + { + this->initDepthProperty(formInfo); + } + else if (formInfo->m_strType == "roseObject") + { + this->initRoseProperty(formInfo); + } + else if (formInfo->m_strType == "waveObject") + { + this->initWaveProperty(formInfo, formInfo->m_nDrawType); } else if (formInfo->m_strType == "JiegutextObject") { @@ -3045,7 +2919,7 @@ void PropertyWidget::initProperty(FormInfo *formInfo) //沉积相 this->initFacProperty(formInfo); } - else if(formInfo->m_strType=="SantuyibiaoObject") + else if(formInfo->m_strType=="SantuyibiaoObject") { this->initTvdProperty(formInfo); } @@ -3058,152 +2932,152 @@ void PropertyWidget::initProperty(FormInfo *formInfo) void PropertyWidget::initRoseProperty(FormInfo *formInfo) { - // - _CreateVariantPropertyItem("数据", "名称", formInfo->m_strAliasName, QVariant::String); + // + _CreateVariantPropertyItem("数据", "名称", formInfo->m_strAliasName, QVariant::String); - QStringList listType; - listType.append("曲线型数据"); - listType.append("表格型数据"); - _CreateEnumPropertyItem("数据", "数据类型", listType.indexOf("曲线型数据"), listType); - _CreateVariantPropertyItem("数据", "显示单位", "°", QVariant::String); - _CreateVariantPropertyItem("数据", "井文件名称", m_strSlfName, QVariant::String); - _CreateVariantPropertyItem("数据", "方位曲线", "STRDIR", QVariant::String); - _CreateVariantPropertyItem("数据", "倾角曲线", "CALM", QVariant::String); - // - _CreateVariantPropertyItem("玫瑰图", "扇形", 36, QVariant::Int); - _CreateVariantPropertyItem("玫瑰图", "圆半径(cm)", 1, QVariant::Int); - _CreateVariantPropertyItem("玫瑰图", "辐射圈", 9, QVariant::Int); - _CreateVariantPropertyItem("玫瑰图", "方位打印间隔", 3, QVariant::Int); - _CreateVariantPropertyItem("玫瑰图", "圆线颜色", QColor(0,0,0), QVariant::Color); - _CreateVariantPropertyItem("玫瑰图", "圆线宽度", 2, QVariant::Int); - _CreateVariantPropertyItem("玫瑰图", "应力线颜色", QColor(255, 170, 0), QVariant::Color); - _CreateVariantPropertyItem("玫瑰图", "垮塌线颜色", QColor(0, 0, 255), QVariant::Color); - _CreateVariantPropertyItem("玫瑰图", "绘制辐射线?", true, QVariant::Bool); - _CreateVariantPropertyItem("玫瑰图", "绘制井眼垮塌", true, QVariant::Bool); - _CreateVariantPropertyItem("玫瑰图", "是否填充", true, QVariant::Bool); - _CreateVariantPropertyItem("玫瑰图", "是否绘制标注?", true, QVariant::Bool); + QStringList listType; + listType.append("曲线型数据"); + listType.append("表格型数据"); + _CreateEnumPropertyItem("数据", "数据类型", listType.indexOf("曲线型数据"), listType); + _CreateVariantPropertyItem("数据", "显示单位", "°", QVariant::String); + _CreateVariantPropertyItem("数据", "井文件名称", m_strSlfName, QVariant::String); + _CreateVariantPropertyItem("数据", "方位曲线", "STRDIR", QVariant::String); + _CreateVariantPropertyItem("数据", "倾角曲线", "CALM", QVariant::String); + // + _CreateVariantPropertyItem("玫瑰图", "扇形", 36, QVariant::Int); + _CreateVariantPropertyItem("玫瑰图", "圆半径(cm)", 1, QVariant::Int); + _CreateVariantPropertyItem("玫瑰图", "辐射圈", 9, QVariant::Int); + _CreateVariantPropertyItem("玫瑰图", "方位打印间隔", 3, QVariant::Int); + _CreateVariantPropertyItem("玫瑰图", "圆线颜色", QColor(0,0,0), QVariant::Color); + _CreateVariantPropertyItem("玫瑰图", "圆线宽度", 2, QVariant::Int); + _CreateVariantPropertyItem("玫瑰图", "应力线颜色", QColor(255, 170, 0), QVariant::Color); + _CreateVariantPropertyItem("玫瑰图", "垮塌线颜色", QColor(0, 0, 255), QVariant::Color); + _CreateVariantPropertyItem("玫瑰图", "绘制辐射线?", true, QVariant::Bool); + _CreateVariantPropertyItem("玫瑰图", "绘制井眼垮塌", true, QVariant::Bool); + _CreateVariantPropertyItem("玫瑰图", "是否填充", true, QVariant::Bool); + _CreateVariantPropertyItem("玫瑰图", "是否绘制标注?", true, QVariant::Bool); // _CreateVariantPropertyItem("玫瑰图", "道头字体", fromTop->m_font, QVariant::Font); // _CreateVariantPropertyItem("玫瑰图", "道头字颜色", fromTop->m_fontColor, QVariant::Color); } void PropertyWidget::initWaveProperty(FormInfo *formInfo, int nType) { - if (formInfo == NULL) - return; + if (formInfo == NULL) + return; - _CreateVariantPropertyItem("通常", "选择井曲线", m_strLineName + "@" + m_strSlfName, QVariant::String); - _CreateVariantPropertyItem("通常", "显示名称", formInfo->m_strLineName, QVariant::String); - //_CreateVariantPropertyItem("通常", "例区高度(cm)", formInfo->m_strUnit, QVariant::Double); - QStringList lineType; - lineType.append("线性"); - lineType.append("对数"); - lineType.append("核磁对数"); - lineType.append("二维核磁"); - lineType.append("色级图"); - lineType.append("时间对数"); - lineType.append("时间指数"); - _CreateEnumPropertyItem("通常", "曲线类型", lineType.indexOf("线性"), lineType); + _CreateVariantPropertyItem("通常", "选择井曲线", m_strLineName + "@" + m_strSlfName, QVariant::String); + _CreateVariantPropertyItem("通常", "显示名称", formInfo->m_strLineName, QVariant::String); + //_CreateVariantPropertyItem("通常", "例区高度(cm)", formInfo->m_strUnit, QVariant::Double); + QStringList lineType; + lineType.append("线性"); + lineType.append("对数"); + lineType.append("核磁对数"); + lineType.append("二维核磁"); + lineType.append("色级图"); + lineType.append("时间对数"); + lineType.append("时间指数"); + _CreateEnumPropertyItem("通常", "曲线类型", lineType.indexOf("线性"), lineType); - _CreateVariantPropertyItem("曲线单位", "显示单位", formInfo->m_strUnit, QVariant::String); + _CreateVariantPropertyItem("曲线单位", "显示单位", formInfo->m_strUnit, QVariant::String); - _CreateVariantPropertyItem("字体", "曲线名称", formInfo->m_curveNameFont, QVariant::Font); - _CreateVariantPropertyItem("字体", "曲线单位", formInfo->m_curveUnitFont, QVariant::Font); - _CreateVariantPropertyItem("字体", "曲线刻度", formInfo->m_curveScaleFont, QVariant::Font); + _CreateVariantPropertyItem("字体", "曲线名称", formInfo->m_curveNameFont, QVariant::Font); + _CreateVariantPropertyItem("字体", "曲线单位", formInfo->m_curveUnitFont, QVariant::Font); + _CreateVariantPropertyItem("字体", "曲线刻度", formInfo->m_curveScaleFont, QVariant::Font); - QStringList drawType; - drawType.append("波形"); - drawType.append("填充"); - drawType.append("变密度(成像)"); - drawType.append("全阵列"); - drawType.append("奇数阵列"); - drawType.append("偶数阵列"); - drawType.append("变密度(镜像)"); - drawType.append("自选阵列"); - drawType.append("三维图像"); - drawType.append("多臂井径"); - _CreateEnumPropertyItem("绘图类型", "类型", formInfo->m_nDrawType, drawType); + QStringList drawType; + drawType.append("波形"); + drawType.append("填充"); + drawType.append("变密度(成像)"); + drawType.append("全阵列"); + drawType.append("奇数阵列"); + drawType.append("偶数阵列"); + drawType.append("变密度(镜像)"); + drawType.append("自选阵列"); + drawType.append("三维图像"); + drawType.append("多臂井径"); + _CreateEnumPropertyItem("绘图类型", "类型", formInfo->m_nDrawType, drawType); - if (nType == 2) - { - QStringList fillType; - fillType.append("全周"); - fillType.append("正半周"); - fillType.append("负半周"); - _CreateEnumPropertyItem("填充方式", "方式", formInfo->m_nFillType, fillType); - } + if (nType == 2) + { + QStringList fillType; + fillType.append("全周"); + fillType.append("正半周"); + fillType.append("负半周"); + _CreateEnumPropertyItem("填充方式", "方式", formInfo->m_nFillType, fillType); + } - if (nType == 0 || nType == 1) - { - _CreateVariantPropertyItem("波形绘制参数", "绘制波深度", formInfo->m_bDrawDepth, QVariant::Bool); - _CreateVariantPropertyItem("波形绘制参数", "绘制波基线", formInfo->m_bDrawBase, QVariant::Bool); - _CreateVariantPropertyItem("波形绘制参数", "奇偶配色", formInfo->m_bOddEven, QVariant::Bool); - } - //_CreateVariantPropertyItem("波形绘制参数", "自动平滑", true, QVariant::Bool); - _CreateVariantPropertyItem("波形绘制参数", "左刻度", formInfo->m_vmin, QVariant::Double); - _CreateVariantPropertyItem("波形绘制参数", "右刻度", formInfo->m_vmax, QVariant::Double); - _CreateVariantPropertyItem("波形绘制参数", "幅度刻度", formInfo->m_strAmp, QVariant::String); - _CreateVariantPropertyItem("波形绘制参数", "最大振幅", formInfo->m_fMaxAmp, QVariant::Double); - _CreateVariantPropertyItem("波形绘制参数", "显示刻度", formInfo->m_bShowScale, QVariant::Bool); - _CreateVariantPropertyItem("波形绘制参数", "波列基值", formInfo->m_fWaveBase, QVariant::Double); - _CreateVariantPropertyItem("波形绘制参数", "波形间隔", formInfo->m_nWaveJg, QVariant::Int); - _CreateVariantPropertyItem("波形绘制参数", "波形高度", formInfo->m_fWaveHei, QVariant::Double); - if (nType == 0 || nType == 1) - { - _CreateVariantPropertyItem("波形绘制参数", "线宽", formInfo->m_dWidth, QVariant::Int); - _CreateVariantPropertyItem("波形绘制参数", "颜色", formInfo->m_lineColor, QVariant::Color); - } - //_CreateVariantPropertyItem("成像显示", "RGBA数据", false, QVariant::Bool); - //_CreateVariantPropertyItem("成像显示", "绘制阵列数", 1, QVariant::Int); - //_CreateVariantPropertyItem("成像显示", "是否顶底倒置", false, QVariant::Bool); - //_CreateVariantPropertyItem("成像显示", "是否行列互换", false, QVariant::Bool); - //_CreateVariantPropertyItem("成像显示", "无效值跳过", false, QVariant::Bool); - //_CreateVariantPropertyItem("成像显示", "是否方位校正", false, QVariant::Bool); - //_CreateVariantPropertyItem("成像显示", "是否深度校正", false, QVariant::Bool); - //_CreateVariantPropertyItem("成像显示", "是否自动计算波参数", "", QVariant::String); + if (nType == 0 || nType == 1) + { + _CreateVariantPropertyItem("波形绘制参数", "绘制波深度", formInfo->m_bDrawDepth, QVariant::Bool); + _CreateVariantPropertyItem("波形绘制参数", "绘制波基线", formInfo->m_bDrawBase, QVariant::Bool); + _CreateVariantPropertyItem("波形绘制参数", "奇偶配色", formInfo->m_bOddEven, QVariant::Bool); + } + //_CreateVariantPropertyItem("波形绘制参数", "自动平滑", true, QVariant::Bool); + _CreateVariantPropertyItem("波形绘制参数", "左刻度", formInfo->m_vmin, QVariant::Double); + _CreateVariantPropertyItem("波形绘制参数", "右刻度", formInfo->m_vmax, QVariant::Double); + _CreateVariantPropertyItem("波形绘制参数", "幅度刻度", formInfo->m_strAmp, QVariant::String); + _CreateVariantPropertyItem("波形绘制参数", "最大振幅", formInfo->m_fMaxAmp, QVariant::Double); + _CreateVariantPropertyItem("波形绘制参数", "显示刻度", formInfo->m_bShowScale, QVariant::Bool); + _CreateVariantPropertyItem("波形绘制参数", "波列基值", formInfo->m_fWaveBase, QVariant::Double); + _CreateVariantPropertyItem("波形绘制参数", "波形间隔", formInfo->m_nWaveJg, QVariant::Int); + _CreateVariantPropertyItem("波形绘制参数", "波形高度", formInfo->m_fWaveHei, QVariant::Double); + if (nType == 0 || nType == 1) + { + _CreateVariantPropertyItem("波形绘制参数", "线宽", formInfo->m_dWidth, QVariant::Int); + _CreateVariantPropertyItem("波形绘制参数", "颜色", formInfo->m_lineColor, QVariant::Color); + } + //_CreateVariantPropertyItem("成像显示", "RGBA数据", false, QVariant::Bool); + //_CreateVariantPropertyItem("成像显示", "绘制阵列数", 1, QVariant::Int); + //_CreateVariantPropertyItem("成像显示", "是否顶底倒置", false, QVariant::Bool); + //_CreateVariantPropertyItem("成像显示", "是否行列互换", false, QVariant::Bool); + //_CreateVariantPropertyItem("成像显示", "无效值跳过", false, QVariant::Bool); + //_CreateVariantPropertyItem("成像显示", "是否方位校正", false, QVariant::Bool); + //_CreateVariantPropertyItem("成像显示", "是否深度校正", false, QVariant::Bool); + //_CreateVariantPropertyItem("成像显示", "是否自动计算波参数", "", QVariant::String); - if (nType == 2) - { - _CreateColorSchemePropertyItem("调色板参数设置", "色板", formInfo->m_nSchemeIndex); - _CreateVariantPropertyItem("调色板参数设置", "变密度颜色级数", formInfo->m_nColorNum, QVariant::Int); - } + if (nType == 2) + { + _CreateColorSchemePropertyItem("调色板参数设置", "色板", formInfo->m_nSchemeIndex); + _CreateVariantPropertyItem("调色板参数设置", "变密度颜色级数", formInfo->m_nColorNum, QVariant::Int); + } // _CreateVariantPropertyItem("调色板参数设置", "图例置顶", false, QVariant::Bool); // _CreateVariantPropertyItem("调色板参数设置", "反转显示", false, QVariant::Bool); - - m_strCurrentProperty = Wave_Property; + + m_strCurrentProperty = Wave_Property; } void PropertyWidget::initJieshiItemProperty(TransparentGroupResult* tdJieshi, double lower, double upper, QString strResult) { - //初始化,清空 - InitCurrentViewInfo(); + //初始化,清空 + InitCurrentViewInfo(); - m_tdJieshi = tdJieshi; + m_tdJieshi = tdJieshi; - // - _CreateVariantPropertyItem("当前项", "顶深(m)", -upper, QVariant::Double); - _CreateVariantPropertyItem("当前项", "底深(m)", -lower, QVariant::Double); - _CreateVariantPropertyItem("当前项", "解释层号", tdJieshi->getTitle(), QVariant::String); - QtVariantProperty* pItem = _CreateVariantPropertyItem("当前项", "油气结论", tdJieshi->getOilGasConclusion(0), VariantManager::filePathTypeId()); - m_pVariantManager->setAttribute(pItem, "filepath", GetOilSymbolDir()); - m_pVariantManager->setAttribute(pItem, "filter", "图片(*.png *.svg)"); + // + _CreateVariantPropertyItem("当前项", "顶深(m)", -upper, QVariant::Double); + _CreateVariantPropertyItem("当前项", "底深(m)", -lower, QVariant::Double); + _CreateVariantPropertyItem("当前项", "解释层号", tdJieshi->getTitle(), QVariant::String); + QtVariantProperty* pItem = _CreateVariantPropertyItem("当前项", "油气结论", tdJieshi->getOilGasConclusion(0), VariantManager::filePathTypeId()); + m_pVariantManager->setAttribute(pItem, "filepath", GetOilSymbolDir()); + m_pVariantManager->setAttribute(pItem, "filter", "图片(*.png *.svg)"); - _CreateVariantPropertyItem("当前项", "备注", tdJieshi->getRemark(), QVariant::String); - for (int i = 1; i <= 10; i++) - { - QString s = tdJieshi->getOilGasConclusion(i); - QtVariantProperty* pItem = _CreateVariantPropertyItem("当前项", QString("油气结论%1").arg(i), s, VariantManager::filePathTypeId()); - //pItem->setAttribute("FilePath", "123542"); - m_pVariantManager->setAttribute(pItem, "filepath", GetOilSymbolDir()); - m_pVariantManager->setAttribute(pItem, "filter", "图片(*.png *.svg)"); - } - for (int i = 1; i <= 10; i++) - { - QString s = tdJieshi->getOilGasDepth(i); - _CreateVariantPropertyItem("当前项", QString("分段点%1深度").arg(i), s, QVariant::Double); - } - //当前属性类型 - m_strCurrentProperty = JieshiItem_Property; + _CreateVariantPropertyItem("当前项", "备注", tdJieshi->getRemark(), QVariant::String); + for (int i = 1; i <= 10; i++) + { + QString s = tdJieshi->getOilGasConclusion(i); + QtVariantProperty* pItem = _CreateVariantPropertyItem("当前项", QString("油气结论%1").arg(i), s, VariantManager::filePathTypeId()); + //pItem->setAttribute("FilePath", "123542"); + m_pVariantManager->setAttribute(pItem, "filepath", GetOilSymbolDir()); + m_pVariantManager->setAttribute(pItem, "filter", "图片(*.png *.svg)"); + } + for (int i = 1; i <= 10; i++) + { + QString s = tdJieshi->getOilGasDepth(i); + _CreateVariantPropertyItem("当前项", QString("分段点%1深度").arg(i), s, QVariant::Double); + } + //当前属性类型 + m_strCurrentProperty = JieshiItem_Property; } void PropertyWidget::initSwallCoreProperty(FormInfo *formInfo) @@ -3251,51 +3125,9 @@ void PropertyWidget::initSwallCoreItemProperty(TransparentDraggableSwallCore* td // _CreateVariantPropertyItem("当前项", "深度", -Depth, QVariant::Double); - - //只能选择自己的符号,不能选择其他。 - QString strDefaultPath = ::GetSymbolDir()+"取心岩性符号"; - //符号统一 - strDefaultPath.replace("\\","/"); - LithologyImage.replace("\\","/"); - // - if(LithologyImage.contains(strDefaultPath)) - { - _CreateVariantPropertyItem("当前项", "岩性", LithologyImage, VariantManager::filePathTypeId()); - } - else{ - _CreateVariantPropertyItem("当前项", "岩性", strDefaultPath, VariantManager::filePathTypeId()); - } - - //只能选择自己的符号,不能选择其他。 - strDefaultPath = ::GetGasSymbolDir(); - //符号统一 - strDefaultPath.replace("\\","/"); - OilGasImage.replace("\\","/"); - // - if(OilGasImage.contains(strDefaultPath)) - { - _CreateVariantPropertyItem("当前项", "油气", OilGasImage, VariantManager::filePathTypeId()); - } - else - { - _CreateVariantPropertyItem("当前项", "油气", strDefaultPath, VariantManager::filePathTypeId()); - } - - //只能选择自己的符号,不能选择其他。 - strDefaultPath = ::GetColorSymbolDir(); - //符号统一 - strDefaultPath.replace("\\","/"); - ColorImage.replace("\\","/"); - // - if(ColorImage.contains(strDefaultPath)) - { - _CreateVariantPropertyItem("当前项", "颜色", ColorImage, VariantManager::filePathTypeId()); - } - else - { - _CreateVariantPropertyItem("当前项", "颜色", strDefaultPath, VariantManager::filePathTypeId()); - } - + _CreateVariantPropertyItem("当前项", "岩性", LithologyImage, VariantManager::filePathTypeId()); + _CreateVariantPropertyItem("当前项", "油气", OilGasImage, VariantManager::filePathTypeId()); + _CreateVariantPropertyItem("当前项", "颜色", ColorImage, VariantManager::filePathTypeId()); _CreateVariantPropertyItem("当前项", "起始位置", Sideleft, QVariant::Double); //_CreateVariantPropertyItem("当前项", "宽度", -Depth, QVariant::Double); } @@ -3404,7 +3236,7 @@ void PropertyWidget::initLayerItemProperty(TransparentDraggableLayer* tdLayer, d // _CreateVariantPropertyItem("当前项", "顶深(m)", -upper, QVariant::Double); _CreateVariantPropertyItem("当前项", "底深(m)", -lower, QVariant::Double); - _CreateVariantPropertyItem("当前项", "文字结论", strResult, QVariant::String); + _CreateVariantPropertyItem("当前项", "文字结论", strResult, QVariant::String); QFont myFont = tdLayer->wordfont; //("Arial", 12, QFont::Bold); // 名称字体 QColor myColor = tdLayer->fontColor; //Qt::black; //颜色 @@ -3462,21 +3294,7 @@ void PropertyWidget::initGujingItemProperty(TransparentDraggableGujing* tdGujing // _CreateVariantPropertyItem("当前项", "顶深(m)", -upper, QVariant::Double); _CreateVariantPropertyItem("当前项", "底深(m)", -lower, QVariant::Double); - - //只能选择自己的符号,不能选择其他。 - QString strDefaultPath = ::GetGujingSymbolDir(); - //符号统一 - strDefaultPath.replace("\\","/"); - strResult.replace("\\","/"); - // - if(strResult.contains(strDefaultPath)) - { - _CreateVariantPropertyItem("当前项", "固井结论", strResult, VariantManager::filePathTypeId()); - } - else - { - _CreateVariantPropertyItem("当前项", "固井结论", strDefaultPath, VariantManager::filePathTypeId()); - } + _CreateVariantPropertyItem("当前项", "固井结论", strResult, VariantManager::filePathTypeId()); } void PropertyWidget::initImageProperty(FormInfo *formInfo) @@ -3794,7 +3612,7 @@ void PropertyWidget::initTvdProperty(FormInfo *formInfo) m_strCurrentProperty = Tvd_Property; } -void PropertyWidget::initGeoLithItemProperty(TransparentDraggableGeoLith* tdGeoLith, double lower, double upper, QString myLith, QString myOil, QString myColor) +void PropertyWidget::initGeoLithItemProperty(TransparentDraggableGeoLith* tdGeoLith, double lower, double upper, const QString myLith, const QString myOil, const QString myColor) { //初始化,清空 InitCurrentViewInfo(); @@ -3836,54 +3654,9 @@ void PropertyWidget::initGeoLithItemProperty(TransparentDraggableGeoLith* tdGeoL // _CreateVariantPropertyItem("当前项", "顶深(m)", -upper, QVariant::Double); _CreateVariantPropertyItem("当前项", "底深(m)", -lower, QVariant::Double); - - //只能选择自己的符号,不能选择其他。 - QString strDefaultPath = ::GetMudSymbolDir(); - //符号统一 - strDefaultPath.replace("\\","/"); - myLith.replace("\\","/"); - // - if(myLith.contains(strDefaultPath)) - { - _CreateVariantPropertyItem("当前项", "岩性", myLith, VariantManager::filePathTypeId()); - } - else{ - _CreateVariantPropertyItem("当前项", "岩性", strDefaultPath, VariantManager::filePathTypeId()); - } - - //只能选择自己的符号,不能选择其他。 - strDefaultPath = ::GetGasSymbolDir(); - //符号统一 - strDefaultPath.replace("\\","/"); - myOil.replace("\\","/"); - // - if(myOil.contains(strDefaultPath)) - { - _CreateVariantPropertyItem("当前项", "油气", myOil, VariantManager::filePathTypeId()); - } - else - { - _CreateVariantPropertyItem("当前项", "油气", strDefaultPath, VariantManager::filePathTypeId()); - } - - //只能选择自己的符号,不能选择其他。 - strDefaultPath = ::GetColorSymbolDir(); - //符号统一 - strDefaultPath.replace("\\","/"); - myColor.replace("\\","/"); - // - if(myColor.contains(strDefaultPath)) - { - _CreateVariantPropertyItem("当前项", "颜色", myColor, VariantManager::filePathTypeId()); - } - else - { - _CreateVariantPropertyItem("当前项", "颜色", strDefaultPath, VariantManager::filePathTypeId()); - } - -// _CreateVariantPropertyItem("当前项", "岩性", myLith, VariantManager::filePathTypeId()); -// _CreateVariantPropertyItem("当前项", "油气", myOil, VariantManager::filePathTypeId()); -// _CreateVariantPropertyItem("当前项", "颜色", myColor, VariantManager::filePathTypeId()); + _CreateVariantPropertyItem("当前项", "岩性", myLith, VariantManager::filePathTypeId()); + _CreateVariantPropertyItem("当前项", "油气", myOil, VariantManager::filePathTypeId()); + _CreateVariantPropertyItem("当前项", "颜色", myColor, VariantManager::filePathTypeId()); } //气测/FMT/射孔/文本 @@ -4042,20 +3815,7 @@ void PropertyWidget::initTubingItemProperty(TransparentDraggableGuan* tdGuan, do // _CreateVariantPropertyItem("当前项", "深度(m)", -(upper+lower)/2.0, QVariant::Double); - - //只能选择自己的符号,不能选择其他。 - QString strDefaultPath = GetSymbolDir()+"管柱组件"; - //符号统一 - strDefaultPath.replace("\\","/"); - strResult.replace("\\","/"); - // - if(strResult.contains(strDefaultPath)) - { - _CreateVariantPropertyItem("当前项", "组件类型", strResult, VariantManager::filePathTypeId()); - } - else { - _CreateVariantPropertyItem("当前项", "组件类型", strDefaultPath, VariantManager::filePathTypeId()); - } + _CreateVariantPropertyItem("当前项", "组件类型", strResult, VariantManager::filePathTypeId()); } void PropertyWidget::changedDepthProperty(QString strProperty, QVariant varVal) diff --git a/logPlus/TransparentDraggableCorePhysics.cpp b/logPlus/TransparentDraggableCorePhysics.cpp index 28165a7..0423273 100644 --- a/logPlus/TransparentDraggableCorePhysics.cpp +++ b/logPlus/TransparentDraggableCorePhysics.cpp @@ -130,6 +130,8 @@ void TransparentDraggableCorePhysics::update() void TransparentDraggableCorePhysics::initRect() { + + // 连接鼠标事件 connect(mPlot, &QCustomPlot::mousePress, this, &TransparentDraggableCorePhysics::onMousePress); connect(mPlot, &QCustomPlot::mouseMove, this, &TransparentDraggableCorePhysics::onMouseMove); @@ -197,17 +199,13 @@ void TransparentDraggableCorePhysics::onMousePress(QMouseEvent *event) { //之前的选中线段,恢复黑色 TransparentDraggableCorePhysics *tmpLine = (TransparentDraggableCorePhysics*)mPlot->m_SelectShiftLine; - QPen pen = tmpLine->qcpItemLine->pen(); -// pen.setWidth(getCpLineWidth()); - pen.setColor(this->getCpLineColor()); // 线宽 + QPen pen = tmpLine->qcpItemLine->pen(); // 现在这里绝对安全 + pen.setColor(this->getCpLineColor()); tmpLine->qcpItemLine->setPen(pen); -// tmpLine->qcpItemLine->setPen(QPen(Qt::black)); } - //重新设置选中线段 mPlot->m_SelectShiftLine = this; QPen pen = qcpItemLine->pen(); -// pen.setWidth(getCpLineWidth()); pen.setColor(Qt::red); qcpItemLine->setPen(pen); @@ -544,17 +542,28 @@ bool TransparentDraggableCorePhysics::getCpLeftBoundary() const void TransparentDraggableCorePhysics::setCpLeftBoundary(bool value) { this->m_cp_leftBoundary = value; - // 由于 X轴↔Y轴 互换,"水平翻转"变成关于 Y轴中心对称 - double y_center = (this->mPlot->yAxis->range().lower + this->mPlot->yAxis->range().upper) / 2; - // 获取原坐标(注意:此时 coords() 返回的是互换后的坐标) - QPointF start = this->qcpItemLine->start->coords(); - QPointF end = this->qcpItemLine->end->coords(); - - // 翻转:Y轴不变(实际是视觉上的X轴),X轴镜像(实际是视觉上的Y轴) - // 但由于轴互换了,我们需要翻转的是 y 坐标 - this->qcpItemLine->start->setCoords(start.x(), 2 * y_center - start.y()); - this->qcpItemLine->end->setCoords(end.x(), 2 * y_center - end.y()); + double y_min = mPlot->yAxis->range().lower; + double y_max = mPlot->yAxis->range().upper; + double y_center = (y_min + y_max) / 2; + QPointF start = qcpItemLine->start->coords(); + QPointF end = qcpItemLine->end->coords(); + double targetYStart, targetYEnd; + if (value) { + // ====================================== + // ✅ TRUE = 强制回到左边(固定公式) + // ====================================== + targetYStart = y_min + (y_max - start.y()); + targetYEnd = y_min + (y_max - end.y()); + } else { + // ====================================== + // ✅ FALSE = 强制去到右边(固定公式) + // ====================================== + targetYStart = 2 * y_center - start.y(); + targetYEnd = 2 * y_center - end.y(); + } + qcpItemLine->start->setCoords(start.x(), targetYStart); + qcpItemLine->end->setCoords(end.x(), targetYEnd); } bool TransparentDraggableCorePhysics::getCpSkipZeroInvalidValues() const @@ -680,12 +689,12 @@ void TransparentDraggableCorePhysics::setCpSymbolFillColor(QColor value) } } -int TransparentDraggableCorePhysics::getCpFieldName() const -{ - return this->m_cp_fieldName; -} +//int TransparentDraggableCorePhysics::getCpFieldName() const +//{ +// return this->m_cp_fieldName; +//} -void TransparentDraggableCorePhysics::setCpFieldName(const int &value) -{ - this->m_cp_fieldName = value; -} +//void TransparentDraggableCorePhysics::setCpFieldName(const int &value) +//{ +// this->m_cp_fieldName = value; +//} diff --git a/logPlus/TransparentDraggableCorePhysics.h b/logPlus/TransparentDraggableCorePhysics.h index 4adf41a..1073482 100644 --- a/logPlus/TransparentDraggableCorePhysics.h +++ b/logPlus/TransparentDraggableCorePhysics.h @@ -114,8 +114,8 @@ public: QColor getCpSymbolFillColor() const; void setCpSymbolFillColor(QColor value); - int getCpFieldName() const; - void setCpFieldName(const int &value); +// int getCpFieldName() const; +// void setCpFieldName(const int &value); signals: void rangeChanged(QCPRange newRange); @@ -143,7 +143,7 @@ private: QColor m_cp_symbolBorderColor; // 边框颜色 int m_cp_symbolSize; // 大小 QColor m_cp_symbolFillColor; // 填充颜色 - int m_cp_fieldName; // 字段名称 +// int m_cp_fieldName; // 字段名称 // 这四个是slf文件保存读取的 int m_cp_order; // 序号 double m_cp_depth; // 深度 @@ -179,7 +179,6 @@ public: double m_lY1 = 0; // 添加最小宽度成员变量 double mMinWidth; - }; #endif // TRANSPARENTDRAGGABLECOREPHYSICS_H diff --git a/logPlus/qmycustomplot.cpp b/logPlus/qmycustomplot.cpp index 8d648e2..e7b98d7 100644 --- a/logPlus/qmycustomplot.cpp +++ b/logPlus/qmycustomplot.cpp @@ -1937,6 +1937,7 @@ void QMyCustomPlot::deleteItemsImage() //保存 SaveToSLFImage(); + m_mapDraggable_Image.clear(); //属性清空 PropertyService()->InitCurrentViewInfo(); } @@ -2006,10 +2007,12 @@ void QMyCustomPlot::deleteCorePhysics() it++; pDraggableRect->deleteRect(); } + m_SelectShiftLine = nullptr; this->replot(); //保存 saveToSLFCorePhysics(); + m_mapDraggable_CorePhysics.clear(); //属性清空 PropertyService()->InitCurrentViewInfo(); } @@ -5122,9 +5125,9 @@ void QMyCustomPlot::s_changeCorePhysicsProperty(QVariantMap variantMap) // 左界 if(variantMap["leftBoundary"].isValid()) { - tdCorePhysics->setCpLeftBoundary(variantMap["leftBoundary"].toBool()); + bool aa = variantMap["leftBoundary"].toBool(); + tdCorePhysics->setCpLeftBoundary(aa); } - // 不绘零等无效值 if(variantMap["skipZeroInvalidValues"].isValid()) { @@ -5171,7 +5174,6 @@ void QMyCustomPlot::s_changeCorePhysicsProperty(QVariantMap variantMap) { tdCorePhysics->setCpRightScale(variantMap["rightScale"].toDouble()); } - // 刻度类型 if(variantMap["scaleType"].isValid()) {