From 7ae0b665c3ed76a99f04da7a540546c3f2cb2089 Mon Sep 17 00:00:00 2001 From: crqiqi77 Date: Wed, 25 Mar 2026 10:43:36 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B2=A9=E5=BF=83=E5=88=86=E6=9E=90=20?= =?UTF-8?q?=E8=AF=BB=E5=8F=96slf?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- logPlus/TransparentDraggableCorePhysics.h | 129 +++++++++++++++++++++- logPlus/formdraw.cpp | 9 +- logPlus/formdraw.h | 2 +- logPlus/qmycustomplot.cpp | 13 ++- logPlus/qmycustomplot.h | 5 +- 5 files changed, 146 insertions(+), 12 deletions(-) diff --git a/logPlus/TransparentDraggableCorePhysics.h b/logPlus/TransparentDraggableCorePhysics.h index 06ea988..5feda37 100644 --- a/logPlus/TransparentDraggableCorePhysics.h +++ b/logPlus/TransparentDraggableCorePhysics.h @@ -30,14 +30,131 @@ public: // 设置矩形颜色 void setColor(const QColor &color); - // 删除框图 void deleteRect(); + // Get / Set 方法声明 + double getSelectedWellCurve() const; + void setSelectedWellCurve(double value); + + double getExampleAreaHeightCm() const; + void setExampleAreaHeightCm(double value); + + double getRotationAngle() const; + void setRotationAngle(double value); + + std::string getDisplayName() const; + void setDisplayName(const std::string& value); + + int getLineWidth() const; + void setLineWidth(int value); + + int getLineColor() const; + void setLineColor(int value); + + int getLineStyle() const; + void setLineStyle(int value); + + double getLeftScale() const; + void setLeftScale(double value); + + double getRightScale() const; + void setRightScale(double value); + + int getScaleType() const; + void setScaleType(int value); + + int getScaleDivisionsOrCustom() const; + void setScaleDivisionsOrCustom(int value); + + std::string getDisplayUnit() const; + void setDisplayUnit(const std::string& value); + + std::string getCurveName() const; + void setCurveName(const std::string& value); + + std::string getCurveUnit() const; + void setCurveUnit(const std::string& value); + + double getCurveScale() const; + void setCurveScale(double value); + + bool getDrawAsBar() const; + void setDrawAsBar(bool value); + + double getLeftBoundary() const; + void setLeftBoundary(double value); + + bool getSkipZeroInvalidValues() const; + void setSkipZeroInvalidValues(bool value); + + bool getDrawEnvelope() const; + void setDrawEnvelope(bool value); + + bool getDrawAsDot() const; + void setDrawAsDot(bool value); + + int getSymbolType() const; + void setSymbolType(int value); + + int getSymbolBorderColor() const; + void setSymbolBorderColor(int value); + + int getSymbolSize() const; + void setSymbolSize(int value); + + int getSymbolFillColor() const; + void setSymbolFillColor(int value); + + std::string getFieldName() const; + void setFieldName(const std::string& value); + + int getSerialNumber() const; + void setSerialNumber(int value); + + double getDepth() const; + void setDepth(double value); + + double getCorrectedDepth() const; + void setCorrectedDepth(double value); + + double getValue() const; + void setValue(double value); + signals: void rangeChanged(QCPRange newRange); private: + QString m_cp_selectedWellCurve; // 选择井曲线 + double m_cp_exampleAreaHeightCm; // 例区高度(cm) + double m_cp_rotationAngle; // 旋转角度 + QString m_cp_displayName; // 显示名称 + int m_cp_lineWidth; // 线宽 + int m_cp_lineColor; // 线条颜色 + int m_cp_lineStyle; // 线型 + double m_cp_leftScale; // 左刻度 + double m_cp_rightScale; // 右刻度 + int m_cp_scaleType; // 刻度类型 + int m_cp_scaleDivisionsOrCustom; // 等分刻度数或自定序列 + QString m_cp_displayUnit; // 显示单位 + QString m_cp_curveName; // 曲线名称 + QString m_cp_curveUnit; // 曲线单位 + double m_cp_curveScale; // 曲线刻度 + bool m_cp_drawAsBar; // 杆状 + double m_cp_leftBoundary; // 左界 + bool m_cp_skipZeroInvalidValues; // 不绘零等无效值 + bool m_cp_drawEnvelope; // 绘制包络线 + bool m_cp_drawAsDot; // 点状 + int m_cp_symbolType; // 符号类型 + int m_cp_symbolBorderColor; // 边框颜色 + int m_cp_symbolSize; // 大小 + int m_cp_symbolFillColor; // 填充颜色 + QString m_cp_fieldName; // 字段名称 + int m_cp_serialNumber; // 序号 + double m_cp_depth; // 深度 + double m_cp_correctedDepth; // 校正深度 + double m_cp_value; // 数值 + void initRect(); void updateHandles() ; @@ -48,23 +165,25 @@ private slots: void onMouseRelease(QMouseEvent *event); public: + // 父级组件 QMyCustomPlot *mPlot; - + // 当前组件 QCPItemLine *qcpItemLine; + + QString mstrTitle=""; QString m_strUuid = ""; - enum DragMode { DragNone, DragLeft, DragRight, DragRect }; DragMode mDragMode = DragNone; //double mDragStartX = 0; double mDragStartY = 0; - double m_left_Low = 0; double m_right_Hight = 0; double m_lY1 = 0; - // 添加最小宽度成员变量 double mMinWidth; + + }; #endif // TRANSPARENTDRAGGABLECOREPHYSICS_H diff --git a/logPlus/formdraw.cpp b/logPlus/formdraw.cpp index d962969..cf589bb 100644 --- a/logPlus/formdraw.cpp +++ b/logPlus/formdraw.cpp @@ -6565,9 +6565,9 @@ void FormDraw::initCorePhysics(QMyCustomPlot *widget, QString strSlfName, QStrin // logio->ReadTable(iIndex,i+1,m_pResult); int Order = m_pResult->Order; - float depth = m_pResult->Depth; - float CorrDepth = m_pResult->CorrDepth; - float CoreValue; + double depth = static_cast(m_pResult->Depth); + double CorrDepth = static_cast(m_pResult->CorrDepth); + double CoreValue = static_cast(m_pResult->CoreValue); logio->GetTableFieldData(iIndex,FieldNo,buf,i+1); CoreValue=0; sscanf(buf,"%f",&CoreValue); @@ -6592,6 +6592,9 @@ void FormDraw::initCorePhysics(QMyCustomPlot *widget, QString strSlfName, QStrin // x.append(-CorrDepth); y.append(CoreValue); + + // 已经加载了slf文件内容 显示界面上 + widget->addCorePhysicsToPlot(Order, depth, CorrDepth, CoreValue); } logio->CloseTable(iIndex); delete m_pResult; diff --git a/logPlus/formdraw.h b/logPlus/formdraw.h index 9b5729b..62d47c6 100644 --- a/logPlus/formdraw.h +++ b/logPlus/formdraw.h @@ -219,7 +219,7 @@ public: //固井结论 void initGujing(QMyCustomPlot *widget, QString strSlfName, QString strLineName, QString strAliasName = "固井结论", QColor newlineColor=QColor(0,0,0), QStringList listOtherProperty={}); - //岩心实验数据 + // 岩心分析 void initCorePhysics(QMyCustomPlot *widget, QString strSlfName, QString strLineName); //岩心图片数据 void initIMAGE_DATA(QMyCustomPlot *widget, QString strSlfName, QString strLineName); diff --git a/logPlus/qmycustomplot.cpp b/logPlus/qmycustomplot.cpp index 641803c..bfc04b4 100644 --- a/logPlus/qmycustomplot.cpp +++ b/logPlus/qmycustomplot.cpp @@ -1914,7 +1914,7 @@ void QMyCustomPlot::deleteItemsImage(){} void QMyCustomPlot::refreshItemsImage(){} // 增加 -void QMyCustomPlot::addCorePhysics() +void QMyCustomPlot::addCorePhysics(int Order, double Depth, double CorrDepth, double CoreValue) { double right_Hight = xAxis->pixelToCoord(m_event->pos().y());//x轴展示深度 double left_Low = right_Hight; @@ -1924,13 +1924,18 @@ void QMyCustomPlot::addCorePhysics() TransparentDraggableCorePhysics *dragRect = new TransparentDraggableCorePhysics(this, strUuid); // 设置初始范围 dragRect->setRange(left_Low, right_Hight); - // dragRect->qcpItemLine + + + + // 可选:设置颜色 // dragRect->setColor(crColor); // 半透明白色 //最小宽度 // dragRect->setMinWidth(0.1); // dragRect->setTitle(strText); m_mapDraggable_CorePhysics[strUuid] = dragRect; + + this->saveToSLFCorePhysics(); } //从剪切板文本数据粘贴 void QMyCustomPlot::pasteCorePhysics() @@ -4229,6 +4234,10 @@ void QMyCustomPlot::addImageToPlot(double left_Low, double right_Hight, const QS m_mapDraggable_Image[strUuid] = dragRect; } +// 岩心分析 +void addCorePhysicsToPlot(int Order, double Depth, double CorrDepth, double CoreValue) +{} + void QMyCustomPlot::addSelectRectToPlot(double left_Low, double right_Hight, int left_Low_Number, int right_Hight_Number) { //qDebug() << "QMyCustomPlot addSelectRectToPlot"; diff --git a/logPlus/qmycustomplot.h b/logPlus/qmycustomplot.h index 90872cf..aec0a45 100644 --- a/logPlus/qmycustomplot.h +++ b/logPlus/qmycustomplot.h @@ -322,6 +322,9 @@ public: // left_Low底, right_Hight高 imagePath图片 left左边距 width宽 mBorderColor边框颜色、 mBorderStyle边框样式 mBorderWidth边框宽 void addImageToPlot(double left_Low, double right_Hight, const QString imagePath, double left, double width, QColor mBorderColor, Qt::PenStyle mBorderStyle, int mBorderWidth); + // 岩心分析 + void addCorePhysicsToPlot(int Order, double Depth, double CorrDepth, double CoreValue); + //曲线 void addRandomGraph(QVector x, QVector y, QString strSlfName, QString strLineName, QString strAliasName, QString strUnit, double newLeftScale, double newRightScale, QString strScaleType, QColor &newlineColor, double width, Qt::PenStyle lineStyle); @@ -444,7 +447,7 @@ public slots: void refreshItemsImage(); //刷新数据 //右键--编辑岩心分析 - void addCorePhysics(); // 增加 + void addCorePhysics(int Order = 0, double Depth = 0.0, double CorrDepth = 0.0, double CoreValue = 0.0); // 增加 void pasteCorePhysics(); //从剪切板文本数据粘贴 void deleteCorePhysics(); //全部清空 void refreshCorePhysics(); //刷新数据