This commit is contained in:
DESKTOP-450PEFP\mainc 2026-03-26 17:01:47 +08:00
commit 2d7f3dcf75
7 changed files with 83 additions and 58 deletions

View File

@ -414,7 +414,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();
}
@ -3221,7 +3250,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();
@ -3260,11 +3289,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);
@ -3282,12 +3311,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);
}
// 当前属性类型

View File

@ -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);

View File

@ -53,10 +53,13 @@ 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;

View File

@ -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

View File

@ -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"); // 确保在最上层
//上下边界

View File

@ -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);

View File

@ -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;
}