From a8fb96068f121cbec6255813cb6d1847dc0774b6 Mon Sep 17 00:00:00 2001 From: crqiqi77 Date: Thu, 26 Mar 2026 11:38:23 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B2=A9=E5=BF=83=E5=88=86=E6=9E=90=E5=B1=9E?= =?UTF-8?q?=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- logPlus/PropertyWidget.cpp | 52 ++++++++++++++++---- logPlus/PropertyWidget.h | 2 +- logPlus/TransparentDraggableCorePhysics.cpp | 54 +++++++++------------ logPlus/TransparentDraggableCorePhysics.h | 22 +++------ logPlus/TransparentDraggableLine.cpp | 2 +- logPlus/forminfo.h | 4 ++ logPlus/qmycustomplot.cpp | 5 +- 7 files changed, 83 insertions(+), 58 deletions(-) diff --git a/logPlus/PropertyWidget.cpp b/logPlus/PropertyWidget.cpp index 9116f8b..54e3381 100644 --- a/logPlus/PropertyWidget.cpp +++ b/logPlus/PropertyWidget.cpp @@ -413,7 +413,36 @@ void PropertyWidget::changedCorePhysicsProperty(QtProperty *qtProperty, const QV this->m_formInfo->m_cp_symbolFillColor = temp; this->m_tdCorePhysics->setCpSymbolFillColor(temp); } - + 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->m_left_Low = (temp); + // this->m_tdCorePhysics->m_right_Hight = (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(); + } this->m_tdCorePhysics->update(); } @@ -3220,7 +3249,7 @@ void PropertyWidget::initCorePhysicsProperty(FormInfo *formInfo) { } -void PropertyWidget::initCorePhysicsItemProperty(TransparentDraggableCorePhysics* tdImage, double lower, double upper, double strResult, double left) +void PropertyWidget::initCorePhysicsItemProperty(TransparentDraggableCorePhysics* tdImage) { //初始化,清空 InitCurrentViewInfo(); @@ -3259,11 +3288,11 @@ void PropertyWidget::initCorePhysicsItemProperty(TransparentDraggableCorePhysics _CreateVariantPropertyItem("显示设置", "右刻度", formInfo->m_yxzpLabelRotation, QVariant::Int); _CreateVariantPropertyItem("显示设置", "等分刻度数或自定义序列", formInfo->m_yxzpTwoEndDrawing, QVariant::Bool); _CreateVariantPropertyItem("显示设置", "刻度类型", formInfo->m_yxzpDrawColor, QVariant::Bool); - _CreateVariantPropertyItem("显示设置", "显示单位", -upper, QVariant::Double); + _CreateVariantPropertyItem("显示设置", "显示单位", formInfo->m_nRotationAngle, QVariant::Double); _CreateVariantPropertyItem("字体", "曲线名称", formInfo->m_yxzpTwoEndDrawing, QVariant::Bool); _CreateVariantPropertyItem("字体", "曲线单位", formInfo->m_yxzpDrawColor, QVariant::Bool); - _CreateVariantPropertyItem("字体", "曲线刻度", -upper, QVariant::Double); + _CreateVariantPropertyItem("字体", "曲线刻度", formInfo->m_nRotationAngle, QVariant::Double); _CreateVariantPropertyItem("绘制方式", "杆状", formInfo->m_cp_drawAsBar, QVariant::Bool); _CreateVariantPropertyItem("绘制方式", "左界", formInfo->m_cp_leftBoundary, QVariant::Bool); @@ -3281,12 +3310,17 @@ void PropertyWidget::initCorePhysicsItemProperty(TransparentDraggableCorePhysics _CreateVariantPropertyItem("数据点", "大小", formInfo->m_cp_symbolSize, QVariant::Int); _CreateVariantPropertyItem("数据点", "填充颜色", formInfo->m_cp_symbolFillColor, QVariant::Color); - _CreateVariantPropertyItem("表格数据", "字段名称", -upper, QVariant::Double); + QStringList listStyle3; + listStyle3.append("圆形"); + listStyle3.append("矩形"); + listStyle3.append("三角"); + listStyle3.append("菱形"); + _CreateEnumPropertyItem("表格数据", "字段名称", tdImage->getCpOrder(), listStyle3); - _CreateVariantPropertyItem("当前项", "序号", formInfo->m_yxzpLabelRotation, QVariant::Int); - _CreateVariantPropertyItem("当前项", "深度", formInfo->m_yxzpTwoEndDrawing, QVariant::Bool); - _CreateVariantPropertyItem("当前项", "校正深度", formInfo->m_yxzpDrawColor, QVariant::Bool); - _CreateVariantPropertyItem("当前项", "数值", -upper, QVariant::Double); + _CreateVariantPropertyItem("当前项", "序号", tdImage->getCpOrder(), QVariant::Int); + _CreateVariantPropertyItem("当前项", "深度", tdImage->getCpDepth(), QVariant::Double); + _CreateVariantPropertyItem("当前项", "校正深度", tdImage->getCpCorrDepth(), QVariant::Double); + _CreateVariantPropertyItem("当前项", "数值", tdImage->getCpCoreValue(), QVariant::Double); } // 当前属性类型 diff --git a/logPlus/PropertyWidget.h b/logPlus/PropertyWidget.h index 9420639..c5a437d 100644 --- a/logPlus/PropertyWidget.h +++ b/logPlus/PropertyWidget.h @@ -195,7 +195,7 @@ public: // 岩心分析属性 void initCorePhysicsProperty(FormInfo *formInfo); - void initCorePhysicsItemProperty(TransparentDraggableCorePhysics* tdImage, double lower, double upper, double strResult, double left); + void initCorePhysicsItemProperty(TransparentDraggableCorePhysics* tdImage); // 井壁取心属性 void initSwallCoreProperty(FormInfo *formInfo); diff --git a/logPlus/TransparentDraggableCorePhysics.cpp b/logPlus/TransparentDraggableCorePhysics.cpp index 91d94c2..c114b4b 100644 --- a/logPlus/TransparentDraggableCorePhysics.cpp +++ b/logPlus/TransparentDraggableCorePhysics.cpp @@ -53,11 +53,14 @@ void TransparentDraggableCorePhysics::setRange(double left_Low, double right_Hig qcpItemLine->start->setCoords(left_Low, lY1);//圆心位置 qcpItemLine->end->setCoords(right_Hight, lY2);//圆心位置 - //updateHandles(); + this->setCpCorrDepth(right_Hight); + + updateHandles(); //刷新,针对批量修改不在此处刷新,后面统一刷新 if(bReplot) { - } + this->mPlot->replot(); + } } // 获取当前范围 @@ -98,7 +101,7 @@ void TransparentDraggableCorePhysics::initRect() connect(mPlot, &QCustomPlot::mouseRelease, this, &TransparentDraggableCorePhysics::onMouseRelease); qcpItemLine = new QCPItemLine(mPlot); - qcpItemLine->setPen(QPen(Qt::blue, 20)); +// qcpItemLine->setPen(QPen(Qt::blue, 20)); qcpItemLine->setLayer("overlay"); // 确保在最上层 //上下边界 @@ -109,8 +112,6 @@ void TransparentDraggableCorePhysics::initRect() tracer->setGraph(nullptr); // 不关联曲线,自由定位 tracer->setStyle(QCPItemTracer::tsCircle); // 圆形,可选:tsSquare, tsCross, tsPlus等 tracer->setSize(8); // 点的大小(像素) -// tracer->setPen(QPen(QColor(0, 0, 0, 0))); // 边框颜色 -// tracer->setBrush(QBrush(QColor(0, 0, 0, 0))); // 填充颜色 tracer->setPen(QPen(Qt::red)); // 边框颜色 tracer->setBrush(QBrush(Qt::yellow)); // 填充颜色 tracer->setInterpolating(false); @@ -161,7 +162,7 @@ void TransparentDraggableCorePhysics::onMousePress(QMouseEvent *event) { //之前的选中线段,恢复黑色 TransparentDraggableCorePhysics *tmpLine = (TransparentDraggableCorePhysics*)mPlot->m_SelectShiftLine; - tmpLine->qcpItemLine->setPen(QPen(Qt::blue)); + tmpLine->qcpItemLine->setPen(QPen(Qt::black)); } //重新设置选中线段 @@ -190,7 +191,7 @@ void TransparentDraggableCorePhysics::onMousePress(QMouseEvent *event) getRange(); mDragStartY = y; - PropertyService()->initCorePhysicsItemProperty(this, 0, 0, 0, 0); + PropertyService()->initCorePhysicsItemProperty(this); } void TransparentDraggableCorePhysics::onMouseMove(QMouseEvent *event) @@ -223,8 +224,7 @@ void TransparentDraggableCorePhysics::onMouseMove(QMouseEvent *event) default: break; } - - setRange(m_left_Low, m_right_Hight,20); + this->setRange(m_left_Low, m_left_Low,20,true); } void TransparentDraggableCorePhysics::onMouseRelease(QMouseEvent *event) @@ -244,6 +244,11 @@ void TransparentDraggableCorePhysics::onMouseRelease(QMouseEvent *event) mPlot->selectionRect()->cancel(); mPlot->replot(); mPlot->selectionRect()->mActive=true; + +// // 设置回选中之前的颜色 +// this->setCpLineColor(this->getCpLineColor()); + // 保存slf文件 + this->mPlot->saveToSLFCorePhysics(); } } @@ -267,15 +272,15 @@ void TransparentDraggableCorePhysics::setCpDepth(double value) this->m_cp_depth = value; } -//double TransparentDraggableCorePhysics::getCpCorrDepth() const -//{ -// return this->m_cp_corrDepth; -//} +double TransparentDraggableCorePhysics::getCpCorrDepth() const +{ + return this->m_cp_corrDepth; +} -//void TransparentDraggableCorePhysics::setCpCorrDepth(double value) -//{ -// this->m_cp_corrDepth = value; -//} +void TransparentDraggableCorePhysics::setCpCorrDepth(double value) +{ + this->m_cp_corrDepth = value; +} double TransparentDraggableCorePhysics::getCpCoreValue() const { @@ -285,27 +290,12 @@ double TransparentDraggableCorePhysics::getCpCoreValue() const void TransparentDraggableCorePhysics::setCpCoreValue(double value) { this->m_cp_coreValue = value; - -// this->qcpItemLine->end->setCoords(this->qcpItemLine->end->x(), value);//圆心位置 - -// this->qcpItemLine->end->setY(value); - // 获取当前 end 点的坐标 double currentX = qcpItemLine->end->coords().x(); // 只修改 Y 坐标,X 保持不变 qcpItemLine->end->setCoords(currentX, value); } -QString TransparentDraggableCorePhysics::getCpSelectedWellCurve() const -{ - return this->m_cp_selectedWellCurve; -} - -void TransparentDraggableCorePhysics::setCpSelectedWellCurve(const QString &value) -{ - this->m_cp_selectedWellCurve = value; -} - double TransparentDraggableCorePhysics::getCpExampleAreaHeightCm() const { return this->m_cp_exampleAreaHeightCm; diff --git a/logPlus/TransparentDraggableCorePhysics.h b/logPlus/TransparentDraggableCorePhysics.h index 3979eb2..aba0bd7 100644 --- a/logPlus/TransparentDraggableCorePhysics.h +++ b/logPlus/TransparentDraggableCorePhysics.h @@ -24,7 +24,7 @@ public: void setTitle(QString strTitle); // 设置矩形范围 - void setRange(double left_Low, double right_Hight, double lY2, bool bReplot=true); + void setRange(double left_Low, double right_Hight, double lY2, bool bReplot=false); // 获取当前范围 void getRange(); @@ -42,15 +42,12 @@ public: double getCpDepth() const; void setCpDepth(double value); -// double getCpCorrDepth() const; -// void setCpCorrDepth(double value); + double getCpCorrDepth() const; + void setCpCorrDepth(double value); double getCpCoreValue() const; void setCpCoreValue(double value); - QString getCpSelectedWellCurve() const; - void setCpSelectedWellCurve(const QString &value); - double getCpExampleAreaHeightCm() const; void setCpExampleAreaHeightCm(double value); @@ -127,13 +124,6 @@ signals: void rangeChanged(QCPRange newRange); private: - // 这四个是slf文件保存读取的 - int m_cp_order; // 序号 - double m_cp_depth; // 深度 -// double m_cp_corrDepth; // 校正深度 - double m_cp_coreValue; // 数值 - - QString m_cp_selectedWellCurve; // 选择井曲线 double m_cp_exampleAreaHeightCm; // 例区高度(cm) double m_cp_rotationAngle; // 旋转角度 QString m_cp_displayName; // 显示名称 @@ -158,6 +148,11 @@ private: int m_cp_symbolSize; // 大小 QColor m_cp_symbolFillColor; // 填充颜色 QString m_cp_fieldName; // 字段名称 + // 这四个是slf文件保存读取的 + int m_cp_order; // 序号 + double m_cp_depth; // 深度 + double m_cp_corrDepth; // 校正深度 + double m_cp_coreValue; // 数值 void initRect(); void updateHandles() ; @@ -189,7 +184,6 @@ public: // 添加最小宽度成员变量 double mMinWidth; - }; #endif // TRANSPARENTDRAGGABLECOREPHYSICS_H diff --git a/logPlus/TransparentDraggableLine.cpp b/logPlus/TransparentDraggableLine.cpp index 2b5e9cc..4e118c1 100644 --- a/logPlus/TransparentDraggableLine.cpp +++ b/logPlus/TransparentDraggableLine.cpp @@ -95,7 +95,7 @@ void TransparentDraggableLine::initRect() connect(mPlot, &QCustomPlot::mouseRelease, this, &TransparentDraggableLine::onMouseRelease); qcpItemLine = new QCPItemLine(mPlot); - qcpItemLine->setPen(QPen(Qt::blue, 20)); + qcpItemLine->setPen(QPen(Qt::black, 1)); qcpItemLine->setLayer("overlay"); // 确保在最上层 //上下边界 diff --git a/logPlus/forminfo.h b/logPlus/forminfo.h index 35855ea..8716e7f 100644 --- a/logPlus/forminfo.h +++ b/logPlus/forminfo.h @@ -232,6 +232,10 @@ public: QColor m_cp_symbolBorderColor; // 边框颜色 int m_cp_symbolSize = 3; // 大小 QColor m_cp_symbolFillColor; // 填充颜色 + int m_cp_order; // 序号 + double m_cp_depth; // 深度 + double m_cp_corrDepth; // 校正深度 + double m_cp_coreValue; // 数值 public: void setLineWidth(double dWidth); diff --git a/logPlus/qmycustomplot.cpp b/logPlus/qmycustomplot.cpp index 5a28d3b..063d719 100644 --- a/logPlus/qmycustomplot.cpp +++ b/logPlus/qmycustomplot.cpp @@ -1931,9 +1931,12 @@ void QMyCustomPlot::addCorePhysicsWithParam(int Order, double Depth, double Corr QString strUuid = qtCommon->getUUid(); TransparentDraggableCorePhysics *dragRect = new TransparentDraggableCorePhysics(this, strUuid); dragRect->setCpDepth(Depth); - dragRect->setRange(CorrDepth, CorrDepth, 20); + dragRect->setCpCoreValue(CoreValue); + dragRect->setCpCorrDepth(CorrDepth); + dragRect->setRange(CorrDepth, CorrDepth, CoreValue); dragRect->setCpLineColor(Qt::black); dragRect->setCpLineWidth(1); + dragRect->setCpOrder(Order); dragRect->update(); m_mapDraggable_CorePhysics[strUuid] = dragRect; }