Compare commits

...

2 Commits

Author SHA1 Message Date
crqiqi77
6cc5be18c3 Merge branch 'main' of http://git.hivekion.com:3000/jiayulong/logplus 2026-03-26 09:17:56 +08:00
crqiqi77
3896dc1cf6 岩心分析 属性 2026-03-26 09:17:07 +08:00
8 changed files with 736 additions and 220 deletions

View File

@ -283,6 +283,140 @@ void PropertyWidget::changedYxzpItemProperty(QtProperty *qtProperty, const QVari
}
}
void PropertyWidget::changedCorePhysicsProperty(QtProperty *qtProperty, const QVariant &variant)
{
if("例区高度" == m_propertyData[qtProperty])
{
int temp = variant.toInt();
this->m_formInfo->m_headHeight = temp;
this->m_formInfo->setFixedHeight(temp);
}
else if("线宽" == m_propertyData[qtProperty])
{
int temp = variant.toInt();
this->m_formInfo->m_cp_lineWidth = temp;
this->m_tdCorePhysics->setCpLineWidth(temp);
}
else if("颜色" == m_propertyData[qtProperty])
{
QColor temp = variant.value<QColor>();
this->m_formInfo->m_cp_lineColor = temp;
this->m_tdCorePhysics->setCpLineColor(temp);
}
else if("线型" == m_propertyData[qtProperty])
{
Qt::PenStyle newStyle = Qt::SolidLine;
int iStyle = variant.value<int>();
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;
}
this->m_formInfo->m_cp_lineStyle = newStyle;
this->m_tdCorePhysics->setCpLineStyle(newStyle);
}
else if("杆状" == m_propertyData[qtProperty])
{
bool temp = variant.toBool();
this->m_formInfo->m_cp_drawAsBar = temp;
this->m_tdCorePhysics->setCpDrawAsBar(temp);
}
else if("左界" == m_propertyData[qtProperty])
{
bool temp = variant.toBool();
this->m_formInfo->m_cp_leftBoundary = temp;
this->m_tdCorePhysics->setCpLeftBoundary(temp);
}
else if("不绘零等无效值" == m_propertyData[qtProperty])
{
bool temp = variant.toBool();
this->m_formInfo->m_cp_skipZeroInvalidValues = temp;
this->m_tdCorePhysics->setCpSkipZeroInvalidValues(temp);
}
else if("绘制包络线" == m_propertyData[qtProperty])
{
bool temp = variant.toBool();
this->m_formInfo->m_cp_drawEnvelope = temp;
this->m_tdCorePhysics->setCpDrawEnvelope(temp);
}
else if("点状" == m_propertyData[qtProperty])
{
bool temp = variant.toBool();
this->m_formInfo->m_cp_drawAsDot = temp;
this->m_tdCorePhysics->setCpDrawAsDot(temp);
}
else if("符号类型" == m_propertyData[qtProperty])
{
int newStyle = 0;
int iStyle = variant.value<int>();
switch(iStyle)
{
case 0:
// 圆形
newStyle = 0;
break;
case 1:
// 矩形
newStyle = 1;
break;
case 2:
// 三角
newStyle = 2;
break;
case 3:
// 菱形
newStyle = 3;
break;
}
this->m_formInfo->m_cp_symbolType = newStyle;
this->m_tdCorePhysics->setCpSymbolType(newStyle);
}
else if("边框颜色" == m_propertyData[qtProperty])
{
QColor temp = variant.value<QColor>();
this->m_formInfo->m_cp_symbolBorderColor = temp;
this->m_tdCorePhysics->setCpSymbolBorderColor(temp);
}
else if("大小" == m_propertyData[qtProperty])
{
int temp = variant.toInt();
this->m_formInfo->m_cp_symbolSize = temp;
this->m_tdCorePhysics->setCpSymbolSize(temp);
}
else if("填充颜色" == m_propertyData[qtProperty])
{
QColor temp = variant.value<QColor>();
this->m_formInfo->m_cp_symbolFillColor = temp;
this->m_tdCorePhysics->setCpSymbolFillColor(temp);
}
this->m_tdCorePhysics->update();
}
void PropertyWidget::SlotPropertyChanged( QtProperty *pProperty, const QVariant &variant )
{
if(m_strCurrentProperty == "")
@ -740,12 +874,18 @@ void PropertyWidget::SlotPropertyChanged( QtProperty *pProperty, const QVariant
}
}
}
else if (m_strCurrentProperty == ImageItem_Property)
else if (m_strCurrentProperty == ImageItem_Property) // 岩心图片
{
//先处理通用属性
CommonPropertyChanged(pProperty, variant);
changedYxzpItemProperty(pProperty, variant);
}
else if (m_strCurrentProperty == CORE_PHYSICS_ITEM_PROPERTY) // 岩心分析
{
//先处理通用属性
CommonPropertyChanged(pProperty, variant);
changedCorePhysicsProperty(pProperty, variant);
}
else if (m_strCurrentProperty == SwallCoreItem_Property)
{
//先处理通用属性
@ -3080,7 +3220,7 @@ void PropertyWidget::initCorePhysicsProperty(FormInfo *formInfo)
{
}
void PropertyWidget::initCorePhysicsItemProperty(TransparentDraggableCorePhysics* tdImage, double lower, double upper, QString strResult, double left)
void PropertyWidget::initCorePhysicsItemProperty(TransparentDraggableCorePhysics* tdImage, double lower, double upper, double strResult, double left)
{
//初始化,清空
InitCurrentViewInfo();
@ -3104,9 +3244,16 @@ void PropertyWidget::initCorePhysicsItemProperty(TransparentDraggableCorePhysics
_CreateVariantPropertyItem("对象", "显示名称", formInfo->m_strAliasName, QVariant::String);
_CreateVariantPropertyItem("曲线线型", "线宽", formInfo->m_bVerticaDrawing, QVariant::Bool);
_CreateVariantPropertyItem("曲线线型", "颜色", formInfo->m_curveNameFont, QVariant::Font);
_CreateVariantPropertyItem("曲线线型", "线型", formInfo->m_lineColor, QVariant::Color);
_CreateVariantPropertyItem("曲线线型", "线宽", formInfo->m_cp_lineWidth, QVariant::Int);
_CreateVariantPropertyItem("曲线线型", "颜色", formInfo->m_cp_lineColor, QVariant::Color);
QStringList listStyle;
listStyle.append("");
listStyle.append("实线");
listStyle.append("虚线");
listStyle.append("点线");
listStyle.append("虚点线");
listStyle.append("虚点点线");
_CreateEnumPropertyItem("曲线线型", "线型", (int)formInfo->m_cp_lineStyle, listStyle);
_CreateVariantPropertyItem("显示设置", "左刻度", formInfo->m_yxzpLabelFont, QVariant::Font);
_CreateVariantPropertyItem("显示设置", "右刻度", formInfo->m_yxzpLabelRotation, QVariant::Int);
@ -3118,16 +3265,21 @@ void PropertyWidget::initCorePhysicsItemProperty(TransparentDraggableCorePhysics
_CreateVariantPropertyItem("字体", "曲线单位", formInfo->m_yxzpDrawColor, QVariant::Bool);
_CreateVariantPropertyItem("字体", "曲线刻度", -upper, QVariant::Double);
_CreateVariantPropertyItem("绘制方式", "杆状", formInfo->m_yxzpLabelFont, QVariant::Font);
_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_cp_drawAsBar, QVariant::Bool);
_CreateVariantPropertyItem("绘制方式", "左界", formInfo->m_cp_leftBoundary, QVariant::Bool);
_CreateVariantPropertyItem("绘制方式", "不绘零等无效值", formInfo->m_cp_skipZeroInvalidValues, QVariant::Bool);
_CreateVariantPropertyItem("绘制方式", "绘制包络线", formInfo->m_cp_drawEnvelope, QVariant::Bool);
_CreateVariantPropertyItem("绘制方式", "点状", formInfo->m_cp_drawAsDot, QVariant::Bool);
_CreateVariantPropertyItem("数据点", "符号类型", formInfo->m_yxzpLabelRotation, QVariant::Int);
_CreateVariantPropertyItem("数据点", "边框颜色", formInfo->m_yxzpTwoEndDrawing, QVariant::Bool);
_CreateVariantPropertyItem("数据点", "大小", formInfo->m_yxzpDrawColor, QVariant::Bool);
_CreateVariantPropertyItem("数据点", "填充颜色", -upper, QVariant::Double);
QStringList listStyle2;
listStyle2.append("圆形");
listStyle2.append("矩形");
listStyle2.append("三角");
listStyle2.append("菱形");
_CreateEnumPropertyItem("数据点", "符号类型", formInfo->m_cp_symbolType, listStyle2);
_CreateVariantPropertyItem("数据点", "边框颜色", formInfo->m_cp_symbolBorderColor, QVariant::Color);
_CreateVariantPropertyItem("数据点", "大小", formInfo->m_cp_symbolSize, QVariant::Int);
_CreateVariantPropertyItem("数据点", "填充颜色", formInfo->m_cp_symbolFillColor, QVariant::Color);
_CreateVariantPropertyItem("表格数据", "字段名称", -upper, QVariant::Double);
@ -3135,22 +3287,9 @@ void PropertyWidget::initCorePhysicsItemProperty(TransparentDraggableCorePhysics
_CreateVariantPropertyItem("当前项", "深度", formInfo->m_yxzpTwoEndDrawing, QVariant::Bool);
_CreateVariantPropertyItem("当前项", "校正深度", formInfo->m_yxzpDrawColor, QVariant::Bool);
_CreateVariantPropertyItem("当前项", "数值", -upper, QVariant::Double);
QStringList listStyle;
listStyle.append("");
listStyle.append("实线");
listStyle.append("虚线");
listStyle.append("点线");
listStyle.append("虚点线");
listStyle.append("虚点点线");
// _CreateEnumPropertyItem("边框属性", "线型", (int)borderStyle, listStyle);
}
//当前属性类型
// 当前属性类型
m_strCurrentProperty = CORE_PHYSICS_ITEM_PROPERTY;
m_tdCorePhysics = tdImage;
}

View File

@ -195,7 +195,7 @@ public:
// 岩心分析属性
void initCorePhysicsProperty(FormInfo *formInfo);
void initCorePhysicsItemProperty(TransparentDraggableCorePhysics* tdImage, double lower, double upper, QString strResult, double left);
void initCorePhysicsItemProperty(TransparentDraggableCorePhysics* tdImage, double lower, double upper, double strResult, double left);
// 井壁取心属性
void initSwallCoreProperty(FormInfo *formInfo);
@ -240,6 +240,9 @@ public:
// 深度
void changedDepthProperty(QString strProName, QVariant val);
// 岩心分析
void changedCorePhysicsProperty(QtProperty *pProperty, const QVariant &variant);
public slots:
void SlotPropertyChanged(QtProperty *property, const QVariant &variant);
void SlotPropertyChanged(QtProperty *property, const int &val, bool islinestyle);

View File

@ -1,5 +1,5 @@
#include "TransparentDraggableCorePhysics.h"
#include "PropertyWidget.h"
extern double g_dPixelPerCm;//每厘米像素数
//static GeoIndicatorGenerator m_drawGeo;
@ -32,13 +32,13 @@ void TransparentDraggableCorePhysics::setTitle(QString strTitle)
}
// 设置矩形范围
void TransparentDraggableCorePhysics::setRange(double left_Low, double right_Hight, bool bReplot)
void TransparentDraggableCorePhysics::setRange(double left_Low, double right_Hight, double lY2, bool bReplot)
{
m_left_Low = left_Low;
m_right_Hight = right_Hight;
double lY1 = mPlot->yAxis->range().lower;//+10
double lY2 = mPlot->yAxis->range().upper;
// double lY2 = mPlot->yAxis->range().upper;
for(int i =0; i<mPlot->m_x.size(); i++)
{
@ -51,35 +51,20 @@ void TransparentDraggableCorePhysics::setRange(double left_Low, double right_Hig
m_lY1 = lY1;
qcpItemLine->start->setCoords(left_Low, lY1);//圆心位置
qcpItemLine->end->setCoords(right_Hight, 30);//圆心位置
qcpItemLine->end->setCoords(right_Hight, lY2);//圆心位置
//updateHandles();
//刷新,针对批量修改不在此处刷新,后面统一刷新
if(bReplot)
{
mPlot->replot();
}
}
// 获取当前范围
//void TransparentDraggableCorePhysics::getRange()
//{
// m_left_Low = qcpItemLine->start->coords().x();
// m_right_Hight = qcpItemLine->end->coords().x();
//}
QCPRange TransparentDraggableCorePhysics::getRange()
void TransparentDraggableCorePhysics::getRange()
{
// 获取线段起点和终点的 X 坐标
double startX = qcpItemLine->start->coords().x();
double endX = qcpItemLine->end->coords().x();
// 自动处理左右顺序,确保最小值 <= 最大值
double lower = qMin(startX, endX);
double upper = qMax(startX, endX);
// 返回构造好的 QCPRange
return QCPRange(lower, upper);
m_left_Low = qcpItemLine->start->coords().x();
m_right_Hight = qcpItemLine->end->coords().x();
}
// 设置矩形颜色
@ -91,7 +76,7 @@ void TransparentDraggableCorePhysics::setColor(const QColor &color)
void TransparentDraggableCorePhysics::deleteRect()
{
if(mPlot) {
mPlot->m_mapDraggable_CorePhysics.remove(m_strUuid);
mPlot->m_mapDraggable_Line.remove(m_strUuid);
mPlot->removeItem(qcpItemLine);
@ -100,6 +85,10 @@ void TransparentDraggableCorePhysics::deleteRect()
}
}
void TransparentDraggableCorePhysics::update()
{
this->mPlot->replot();
}
void TransparentDraggableCorePhysics::initRect()
{
@ -109,11 +98,27 @@ void TransparentDraggableCorePhysics::initRect()
connect(mPlot, &QCustomPlot::mouseRelease, this, &TransparentDraggableCorePhysics::onMouseRelease);
qcpItemLine = new QCPItemLine(mPlot);
qcpItemLine->setPen(QPen(Qt::black, 10));
qcpItemLine->setPen(QPen(Qt::blue, 20));
qcpItemLine->setLayer("overlay"); // 确保在最上层
//上下边界
updateHandles();
// 创建追踪点,自动跟随线条终点
tracer = new QCPItemTracer(this->mPlot);
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);
// 绑定到线条终点(关键!)
tracer->position->setParentAnchor(this->qcpItemLine->end);
tracer->setVisible(false);
qDebug() << "Creating qcpItemLine";
}
void TransparentDraggableCorePhysics::updateHandles()
@ -183,8 +188,9 @@ void TransparentDraggableCorePhysics::onMousePress(QMouseEvent *event)
}
getRange();
mDragStartY = y;
PropertyService()->initCorePhysicsItemProperty(this, 0, 0, 0, 0);
}
void TransparentDraggableCorePhysics::onMouseMove(QMouseEvent *event)
@ -218,7 +224,7 @@ void TransparentDraggableCorePhysics::onMouseMove(QMouseEvent *event)
break;
}
setRange(m_left_Low, m_right_Hight);
setRange(m_left_Low, m_right_Hight,20);
}
void TransparentDraggableCorePhysics::onMouseRelease(QMouseEvent *event)
@ -241,3 +247,385 @@ void TransparentDraggableCorePhysics::onMouseRelease(QMouseEvent *event)
}
}
int TransparentDraggableCorePhysics::getCpOrder() const
{
return this->m_cp_order;
}
void TransparentDraggableCorePhysics::setCpOrder(int value)
{
this->m_cp_order = value;
}
double TransparentDraggableCorePhysics::getCpDepth() const
{
return this->m_cp_depth;
}
void TransparentDraggableCorePhysics::setCpDepth(double value)
{
this->m_cp_depth = value;
}
//double TransparentDraggableCorePhysics::getCpCorrDepth() const
//{
// return this->m_cp_corrDepth;
//}
//void TransparentDraggableCorePhysics::setCpCorrDepth(double value)
//{
// this->m_cp_corrDepth = value;
//}
double TransparentDraggableCorePhysics::getCpCoreValue() const
{
return this->m_cp_coreValue;
}
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;
}
void TransparentDraggableCorePhysics::setCpExampleAreaHeightCm(double value)
{
this->m_cp_exampleAreaHeightCm = value;
}
double TransparentDraggableCorePhysics::getCpRotationAngle() const
{
return this->m_cp_rotationAngle;
}
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;
}
int TransparentDraggableCorePhysics::getCpLineWidth() const
{
return this->m_cp_lineWidth;
}
void TransparentDraggableCorePhysics::setCpLineWidth(int value)
{
this->m_cp_lineWidth = value;
QPen pen = this->qcpItemLine->pen();
pen.setWidth(value); // 线宽
this->qcpItemLine->setPen(pen);
}
QColor TransparentDraggableCorePhysics::getCpLineColor() const
{
return this->m_cp_lineColor;
}
void TransparentDraggableCorePhysics::setCpLineColor(QColor value)
{
this->m_cp_lineColor = value;
QPen pen = this->qcpItemLine->pen();
pen.setColor(value); // 颜色
this->qcpItemLine->setPen(pen);
}
Qt::PenStyle TransparentDraggableCorePhysics::getCpLineStyle() const
{
return this->m_cp_lineStyle;
}
void TransparentDraggableCorePhysics::setCpLineStyle(Qt::PenStyle value)
{
this->m_cp_lineStyle = value;
QPen pen = this->qcpItemLine->pen();
pen.setStyle(value); // 线形
this->qcpItemLine->setPen(pen);
}
double TransparentDraggableCorePhysics::getCpLeftScale() const
{
return this->m_cp_leftScale;
}
void TransparentDraggableCorePhysics::setCpLeftScale(double value)
{
this->m_cp_leftScale = value;
}
double TransparentDraggableCorePhysics::getCpRightScale() const
{
return this->m_cp_rightScale;
}
void TransparentDraggableCorePhysics::setCpRightScale(double value)
{
this->m_cp_rightScale = value;
}
int TransparentDraggableCorePhysics::getCpScaleType() const
{
return this->m_cp_scaleType;
}
void TransparentDraggableCorePhysics::setCpScaleType(int value)
{
this->m_cp_scaleType = value;
}
int TransparentDraggableCorePhysics::getCpScaleDivisionsOrCustom() const
{
return this->m_cp_scaleDivisionsOrCustom;
}
void TransparentDraggableCorePhysics::setCpScaleDivisionsOrCustom(int value)
{
this->m_cp_scaleDivisionsOrCustom = value;
}
QString TransparentDraggableCorePhysics::getCpDisplayUnit() const
{
return this->m_cp_displayUnit;
}
void TransparentDraggableCorePhysics::setCpDisplayUnit(const QString &value)
{
this->m_cp_displayUnit = value;
}
QString TransparentDraggableCorePhysics::getCpCurveName() const
{
return this->m_cp_curveName;
}
void TransparentDraggableCorePhysics::setCpCurveName(const QString &value)
{
this->m_cp_curveName = value;
}
QString TransparentDraggableCorePhysics::getCpCurveUnit() const
{
return this->m_cp_curveUnit;
}
void TransparentDraggableCorePhysics::setCpCurveUnit(const QString &value)
{
this->m_cp_curveUnit = value;
}
double TransparentDraggableCorePhysics::getCpCurveScale() const
{
return this->m_cp_curveScale;
}
void TransparentDraggableCorePhysics::setCpCurveScale(double value)
{
this->m_cp_curveScale = value;
}
bool TransparentDraggableCorePhysics::getCpDrawAsBar() const
{
return this->m_cp_drawAsBar;
}
void TransparentDraggableCorePhysics::setCpDrawAsBar(bool value)
{
this->m_cp_drawAsBar = value;
if(value)
{
QPen pen = this->qcpItemLine->pen();
pen.setColor(this->getCpLineColor()); // 完全透明
this->qcpItemLine->setPen(pen);
}
else
{
QPen pen = this->qcpItemLine->pen();
pen.setColor(QColor(0,0,0,0)); // 完全透明
this->qcpItemLine->setPen(pen);
}
}
bool TransparentDraggableCorePhysics::getCpLeftBoundary() const
{
return this->m_cp_leftBoundary;
}
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());
}
bool TransparentDraggableCorePhysics::getCpSkipZeroInvalidValues() const
{
return this->m_cp_skipZeroInvalidValues;
}
void TransparentDraggableCorePhysics::setCpSkipZeroInvalidValues(bool value)
{
this->m_cp_skipZeroInvalidValues = value;
}
bool TransparentDraggableCorePhysics::getCpDrawEnvelope() const
{
return this->m_cp_drawEnvelope;
}
void TransparentDraggableCorePhysics::setCpDrawEnvelope(bool value)
{
this->m_cp_drawEnvelope = value;
}
bool TransparentDraggableCorePhysics::getCpDrawAsDot() const
{
return this->m_cp_drawAsDot;
}
void TransparentDraggableCorePhysics::setCpDrawAsDot(bool value)
{
this->m_cp_drawAsDot = value;
// 获取所有 QCPItemTracer包括子对象的子对象
QList<QCPItemTracer*> tracers = this->mPlot->findChildren<QCPItemTracer*>();
foreach (QCPItemTracer *tracer, tracers) {
// 处理每个 tracer
tracer->setVisible(value); // 例如:全部隐藏
}
}
int TransparentDraggableCorePhysics::getCpSymbolType() const
{
return this->m_cp_symbolType;
}
void TransparentDraggableCorePhysics::setCpSymbolType(int value)
{
this->m_cp_symbolType = value;
QList<QCPItemTracer*> tracers = this->mPlot->findChildren<QCPItemTracer*>();
foreach (QCPItemTracer *tracer, tracers) {
switch(value)
{
case 0:
// 圆形
tracer->setStyle(QCPItemTracer::tsCircle);
break;
case 1:
// 矩形
tracer->setStyle(QCPItemTracer::tsSquare); // ■ 方形(不是矩形)
break;
case 2:
// 三角
tracer->setStyle(QCPItemTracer::tsSquare);
break;
case 3:
// 菱形
tracer->setStyle(QCPItemTracer::tsSquare);
break;
}
}
}
QColor TransparentDraggableCorePhysics::getCpSymbolBorderColor() const
{
return this->m_cp_symbolBorderColor;
}
void TransparentDraggableCorePhysics::setCpSymbolBorderColor(QColor value)
{
this->m_cp_symbolBorderColor = value;
QList<QCPItemTracer*> tracers = this->mPlot->findChildren<QCPItemTracer*>();
foreach (QCPItemTracer *tracer, tracers) {
// 获取当前的 pen
QPen currentPen = tracer->pen();
// 只修改颜色,保留其他属性(宽度、样式等)
currentPen.setColor(value); // 修改颜色
// 设置回去
tracer->setPen(currentPen);
}
}
int TransparentDraggableCorePhysics::getCpSymbolSize() const
{
return this->m_cp_symbolSize;
}
void TransparentDraggableCorePhysics::setCpSymbolSize(int value)
{
this->m_cp_symbolSize = value;
tracer->setSize(value); // 点的大小(像素)
}
QColor TransparentDraggableCorePhysics::getCpSymbolFillColor() const
{
return this->m_cp_symbolFillColor;
}
void TransparentDraggableCorePhysics::setCpSymbolFillColor(QColor value)
{
this->m_cp_symbolFillColor = value;
QList<QCPItemTracer*> tracers = this->mPlot->findChildren<QCPItemTracer*>();
foreach (QCPItemTracer *tracer, tracers) {
// 获取当前 brush
QBrush currentBrush = tracer->brush();
// 只修改颜色,保留其他属性(填充样式、纹理等)
currentBrush.setColor(value); // 修改填充颜色
// 设置回去
tracer->setBrush(currentBrush);
}
}
QString TransparentDraggableCorePhysics::getCpFieldName() const
{
return this->m_cp_fieldName;
}
void TransparentDraggableCorePhysics::setCpFieldName(const QString &value)
{
this->m_cp_fieldName = value;
}

View File

@ -24,114 +24,122 @@ public:
void setTitle(QString strTitle);
// 设置矩形范围
void setRange(double left_Low, double right_Hight, bool bReplot=true);
void setRange(double left_Low, double right_Hight, double lY2, bool bReplot=true);
// 获取当前范围
QCPRange getRange();
void getRange();
// 设置矩形颜色
void setColor(const QColor &color);
// 删除框图
void deleteRect();
// Get / Set 方法声明
double getSelectedWellCurve() const;
void setSelectedWellCurve(double value);
void update();
double getExampleAreaHeightCm() const;
void setExampleAreaHeightCm(double value);
// Getter & Setter
int getCpOrder() const;
void setCpOrder(int value);
double getRotationAngle() const;
void setRotationAngle(double value);
double getCpDepth() const;
void setCpDepth(double value);
std::string getDisplayName() const;
void setDisplayName(const std::string& value);
// double getCpCorrDepth() const;
// void setCpCorrDepth(double value);
int getLineWidth() const;
void setLineWidth(int value);
double getCpCoreValue() const;
void setCpCoreValue(double value);
int getLineColor() const;
void setLineColor(int value);
QString getCpSelectedWellCurve() const;
void setCpSelectedWellCurve(const QString &value);
int getLineStyle() const;
void setLineStyle(int value);
double getCpExampleAreaHeightCm() const;
void setCpExampleAreaHeightCm(double value);
double getLeftScale() const;
void setLeftScale(double value);
double getCpRotationAngle() const;
void setCpRotationAngle(double value);
double getRightScale() const;
void setRightScale(double value);
QString getCpDisplayName() const;
void setCpDisplayName(const QString &value);
int getScaleType() const;
void setScaleType(int value);
int getCpLineWidth() const;
void setCpLineWidth(int value);
int getScaleDivisionsOrCustom() const;
void setScaleDivisionsOrCustom(int value);
QColor getCpLineColor() const;
void setCpLineColor(QColor value);
std::string getDisplayUnit() const;
void setDisplayUnit(const std::string& value);
Qt::PenStyle getCpLineStyle() const;
void setCpLineStyle(Qt::PenStyle value);
std::string getCurveName() const;
void setCurveName(const std::string& value);
double getCpLeftScale() const;
void setCpLeftScale(double value);
std::string getCurveUnit() const;
void setCurveUnit(const std::string& value);
double getCpRightScale() const;
void setCpRightScale(double value);
double getCurveScale() const;
void setCurveScale(double value);
int getCpScaleType() const;
void setCpScaleType(int value);
bool getDrawAsBar() const;
void setDrawAsBar(bool value);
int getCpScaleDivisionsOrCustom() const;
void setCpScaleDivisionsOrCustom(int value);
double getLeftBoundary() const;
void setLeftBoundary(double value);
QString getCpDisplayUnit() const;
void setCpDisplayUnit(const QString &value);
bool getSkipZeroInvalidValues() const;
void setSkipZeroInvalidValues(bool value);
QString getCpCurveName() const;
void setCpCurveName(const QString &value);
bool getDrawEnvelope() const;
void setDrawEnvelope(bool value);
QString getCpCurveUnit() const;
void setCpCurveUnit(const QString &value);
bool getDrawAsDot() const;
void setDrawAsDot(bool value);
double getCpCurveScale() const;
void setCpCurveScale(double value);
int getSymbolType() const;
void setSymbolType(int value);
bool getCpDrawAsBar() const;
void setCpDrawAsBar(bool value);
int getSymbolBorderColor() const;
void setSymbolBorderColor(int value);
bool getCpLeftBoundary() const;
void setCpLeftBoundary(bool value);
int getSymbolSize() const;
void setSymbolSize(int value);
bool getCpSkipZeroInvalidValues() const;
void setCpSkipZeroInvalidValues(bool value);
int getSymbolFillColor() const;
void setSymbolFillColor(int value);
bool getCpDrawEnvelope() const;
void setCpDrawEnvelope(bool value);
std::string getFieldName() const;
void setFieldName(const std::string& value);
bool getCpDrawAsDot() const;
void setCpDrawAsDot(bool value);
int getSerialNumber() const;
void setSerialNumber(int value);
int getCpSymbolType() const;
void setCpSymbolType(int value);
double getDepth() const;
void setDepth(double value);
QColor getCpSymbolBorderColor() const;
void setCpSymbolBorderColor(QColor value);
double getCorrectedDepth() const;
void setCorrectedDepth(double value);
int getCpSymbolSize() const;
void setCpSymbolSize(int value);
double getValue() const;
void setValue(double value);
QColor getCpSymbolFillColor() const;
void setCpSymbolFillColor(QColor value);
QString getCpFieldName() const;
void setCpFieldName(const QString &value);
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; // 显示名称
int m_cp_lineWidth; // 线宽
int m_cp_lineColor; // 线条颜色
int m_cp_lineStyle; // 线型
QColor m_cp_lineColor; // 线条颜色
Qt::PenStyle m_cp_lineStyle; // 线型
double m_cp_leftScale; // 左刻度
double m_cp_rightScale; // 右刻度
int m_cp_scaleType; // 刻度类型
@ -141,19 +149,15 @@ private:
QString m_cp_curveUnit; // 曲线单位
double m_cp_curveScale; // 曲线刻度
bool m_cp_drawAsBar; // 杆状
double m_cp_leftBoundary; // 左界
bool m_cp_leftBoundary; // 左界
bool m_cp_skipZeroInvalidValues; // 不绘零等无效值
bool m_cp_drawEnvelope; // 绘制包络线
bool m_cp_drawAsDot; // 点状
int m_cp_symbolType; // 符号类型
int m_cp_symbolBorderColor; // 边框颜色
QColor m_cp_symbolBorderColor; // 边框颜色
int m_cp_symbolSize; // 大小
int m_cp_symbolFillColor; // 填充颜色
QColor 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() ;
@ -170,6 +174,8 @@ public:
// 当前组件
QCPItemLine *qcpItemLine;
QCPItemTracer *tracer;
QString mstrTitle="";
QString m_strUuid = "";

View File

@ -6572,6 +6572,41 @@ void FormDraw::initCorePhysics(QMyCustomPlot *widget, QString strSlfName, QStrin
float vmax = 100;
float vmin = 0;
// QTimer::singleShot(0, widget, [=]() {
// widget->addCorePhysicsWithParam(0,-2,-2,20);
// });
//赋值
m_vmax = vmax;
m_vmin = vmin;
//----------------------------------
widget->m_iX1 = vmin;
widget->m_iX2 = vmax;
widget->m_iY1 = m_iY1;
widget->m_iY2 = m_iY2;
//
widget->xAxis->setRange(vmin, vmax);
widget->yAxis->setRange(m_iY1, m_iY2);
widget->axisRect()->setupFullAxesBox();
//
widget->xAxis->ticker()->setTickCount(10);//x个主刻度
widget->yAxis->ticker()->setTickCount(60);//y个主刻度
//对调XY轴在最前面设置
QCPAxis *yAxis = widget->yAxis;
QCPAxis *xAxis = widget->xAxis;
widget->xAxis = yAxis;
widget->yAxis = xAxis;
// //隐藏刻度
widget->xAxis->setTicks(false);
widget->yAxis->setTicks(false);
widget->xAxis2->setTicks(false);
widget->yAxis2->setTicks(false);
QVector<double> x, y;
Slf_CORE_PHYSICS *m_pResult=NULL;
@ -6615,10 +6650,11 @@ void FormDraw::initCorePhysics(QMyCustomPlot *widget, QString strSlfName, QStrin
// logio->ReadTable(iIndex,i+1,m_pResult);
int Order = m_pResult->Order;
double depth = static_cast<double>(m_pResult->Depth);
double CorrDepth = static_cast<double>(m_pResult->CorrDepth);
double CoreValue = static_cast<double>(m_pResult->CoreValue);
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);
//
@ -6638,55 +6674,24 @@ void FormDraw::initCorePhysics(QMyCustomPlot *widget, QString strSlfName, QStrin
if(vmax<CoreValue)vmax=CoreValue;
if(vmin>CoreValue)vmin=CoreValue;
}
//
x.append(-CorrDepth);
y.append(CoreValue);
// 已经加载了slf文件内容 显示界面上
// widget->addCorePhysicsToPlot(Order, depth, CorrDepth, CoreValue);
widget->addCorePhysicsWithParam(Order, static_cast<double>(-depth), static_cast<double>(-CorrDepth), static_cast<double>(-CoreValue));
}
logio->CloseTable(iIndex);
delete m_pResult;
}
delete logio;
//赋值
m_vmax = vmax;
m_vmin = vmin;
//----------------------------------
widget->m_iX1 = vmin;
widget->m_iX2 = vmax;
widget->m_iY1 = m_iY1;
widget->m_iY2 = m_iY2;
//
widget->xAxis->setRange(vmin, vmax);
widget->yAxis->setRange(m_iY1, m_iY2);
widget->axisRect()->setupFullAxesBox();
//
widget->xAxis->ticker()->setTickCount(10);//x个主刻度
widget->yAxis->ticker()->setTickCount(60);//y个主刻度
//对调XY轴在最前面设置
QCPAxis *yAxis = widget->yAxis;
QCPAxis *xAxis = widget->xAxis;
widget->xAxis = yAxis;
widget->yAxis = xAxis;
// //隐藏刻度
// widget->xAxis->setTicks(false);
// widget->yAxis->setTicks(false);
// widget->xAxis2->setTicks(false);
// widget->yAxis2->setTicks(false);
//
QString strAliasName = "";
QString strAliasName = "岩心实验数据";
QString strUnit = "";
// widget->m_bDrawCore_PHYSICS = true;
// widget->m_bDrawCore_PHYSICS = true;
addRandomGraph(widget, x, y, strSlfName, strLineName, strAliasName, strUnit);
//支持框选------------------
// widget->setSelectionRectMode(QCP::SelectionRectMode::srmSelect);
// widget->setSelectionRectMode(QCP::SelectionRectMode::srmSelect);
widget->graph(0)->setSelectable(QCP::SelectionType::stMultipleDataRanges);// stSingleData
widget->setInteractions(QCP::iSelectAxes | QCP::iSelectLegend | QCP::iSelectPlottables | QCP::iMultiSelect); // 轴、图例、图表可以被选择,并且是多选的方式

View File

@ -657,7 +657,7 @@ void FormInfo::paintEvent(QPaintEvent* event)
else if(m_strLineName=="CORE_PHYSICS")
{
//岩心分析,不绘制左右范围
strShowTxt = "岩心实验数据";
// strShowTxt = "岩心实验数据";
}
else if(m_strLineName=="FRAC_HOLE.TABLE" && m_strType=="tableObject")
{

View File

@ -219,6 +219,20 @@ public:
int m_sdMinorTickLineLength = 1; // 次刻度线长度
int m_sdMinorTickLineWidth = 1; // 次刻度线宽度
// 岩心分析
int m_cp_lineWidth = 1; // 线宽
QColor m_cp_lineColor; // 线条颜色
Qt::PenStyle m_cp_lineStyle; // 线型
bool m_cp_drawAsBar = true; // 杆状
bool m_cp_leftBoundary = true; // 左界
bool m_cp_skipZeroInvalidValues = false; // 不绘零等无效值
bool m_cp_drawEnvelope = false; // 绘制包络线
bool m_cp_drawAsDot = false; // 点状
int m_cp_symbolType = 0; // 符号类型
QColor m_cp_symbolBorderColor; // 边框颜色
int m_cp_symbolSize = 3; // 大小
QColor m_cp_symbolFillColor; // 填充颜色
public:
void setLineWidth(double dWidth);
double getLineWidth();

View File

@ -1921,49 +1921,21 @@ void QMyCustomPlot::refreshItemsImage(){}
void QMyCustomPlot::addCorePhysics()
{
double right_Hight = xAxis->pixelToCoord(m_event->pos().y());//x轴展示深度
double left_Low = right_Hight;
QtCommonClass *qtCommon = new QtCommonClass(this);
QString strUuid = qtCommon->getUUid();
TransparentDraggableCorePhysics *dragRect = new TransparentDraggableCorePhysics(this, strUuid);
// 设置初始范围
dragRect->setRange(left_Low, right_Hight);
// 可选:设置颜色
// dragRect->setColor(crColor); // 半透明白色
//最小宽度
// dragRect->setMinWidth(0.1);
// dragRect->setTitle(strText);
m_mapDraggable_CorePhysics[strUuid] = dragRect;
this->addCorePhysicsWithParam(0,right_Hight,right_Hight,20);
this->saveToSLFCorePhysics();
}
void QMyCustomPlot::addCorePhysicsWithParam(int Order, double Depth, double CorrDepth, double CoreValue)
{
double right_Hight = xAxis->pixelToCoord(m_event->pos().y());//x轴展示深度
double left_Low = right_Hight;
QtCommonClass *qtCommon = new QtCommonClass(this);
QString strUuid = qtCommon->getUUid();
TransparentDraggableCorePhysics *dragRect = new TransparentDraggableCorePhysics(this, strUuid);
// 设置初始范围
dragRect->setRange(left_Low, right_Hight);
// 可选:设置颜色
// dragRect->setColor(crColor); // 半透明白色
//最小宽度
// dragRect->setMinWidth(0.1);
// dragRect->setTitle(strText);
dragRect->setCpDepth(Depth);
dragRect->setRange(CorrDepth, CorrDepth, 20);
dragRect->setCpLineColor(Qt::black);
dragRect->setCpLineWidth(1);
dragRect->update();
m_mapDraggable_CorePhysics[strUuid] = dragRect;
this->saveToSLFCorePhysics();
}
//从剪切板文本数据粘贴
void QMyCustomPlot::pasteCorePhysics()
@ -2910,7 +2882,7 @@ bool QMyCustomPlot::saveToSLFCorePhysics()
bool isfirst=false;
if (iIndex < 0)
{
if(!m_mapDraggable_Image.size()) {
if(!m_mapDraggable_CorePhysics.size()) {
delete logio;
isrun=false;
return false;
@ -2922,9 +2894,9 @@ bool QMyCustomPlot::saveToSLFCorePhysics()
"0,0,0,2");//字段备注
isfirst=true;
}
logio->SetTableRecordCount(iIndex,m_mapDraggable_Image.size());
logio->SetTableRecordCount(iIndex,m_mapDraggable_CorePhysics.size());
//int j=0;
if(!m_mapDraggable_Image.size()) {
if(!m_mapDraggable_CorePhysics.size()) {
delete logio;
if(isfirst)AddTableToWellRound();
isrun=false;
@ -2935,13 +2907,13 @@ bool QMyCustomPlot::saveToSLFCorePhysics()
//排序
QList<float> listSDepth;
for (QMap<QString,QObject *>::Iterator iter = m_mapDraggable_Image.begin(); iter != m_mapDraggable_Image.end(); iter++)
for (QMap<QString,QObject *>::Iterator iter = m_mapDraggable_CorePhysics.begin(); iter != m_mapDraggable_CorePhysics.end(); iter++)
{
pDraggableRect = (TransparentDraggableCorePhysics*)iter.value();
//
QCPRange tmpRange = pDraggableRect->getRange();
// QCPRange tmpRange = pDraggableRect->m_right_Hight;
//
float fSDepth = -tmpRange.upper;
float fSDepth = -pDraggableRect->m_right_Hight;
listSDepth.append(fSDepth);
}
qSort(listSDepth);
@ -2949,28 +2921,17 @@ bool QMyCustomPlot::saveToSLFCorePhysics()
//
for(int i=0; i<listSDepth.size(); i++)
{
for (QMap<QString,QObject *>::Iterator iter = m_mapDraggable_Image.begin(); iter != m_mapDraggable_Image.end(); iter++)
for (QMap<QString,QObject *>::Iterator iter = m_mapDraggable_CorePhysics.begin(); iter != m_mapDraggable_CorePhysics.end(); iter++)
{
pDraggableRect = (TransparentDraggableCorePhysics*)iter.value();
QCPRange tmpRange = pDraggableRect->getRange();
float fSDepth = -tmpRange.upper;
float fSDepth = -pDraggableRect->m_right_Hight;
if(fSDepth == listSDepth[i])//按顺序写入
{
memset(&m_Result,0,sizeof(GUJING_DATA));
m_Result.Order = i + 1;
m_Result.Depth = -tmpRange.lower;
m_Result.CorrDepth = -tmpRange.lower;
// 获取长度
m_Result.CoreValue = 20;
// m_Result.StartDepth = -tmpRange.upper;
// m_Result.EndDepth = -tmpRange.lower;
// m_Result.Order=i+1;
// // 拷贝字符串到数组,长度为数组长度-1留1位存'\0'结束符)
// strncpy(m_Result.Image, pDraggableRect->getMResult().toLocal8Bit().constData(), sizeof(m_Result.Image) - 1);
// // 手动添加结束符(确保字符串合法)
// m_Result.Image[sizeof(m_Result.Image) - 1] = '\0';
// m_Result.Left = static_cast<float>(pDraggableRect->getLeft());
// m_Result.Width = static_cast<float>(pDraggableRect->getWidth());
m_Result.CoreValue = -pDraggableRect->getCpCoreValue();
m_Result.Depth = -pDraggableRect->m_right_Hight;
m_Result.CorrDepth = -pDraggableRect->m_right_Hight;
//写入
logio->WriteTable(iIndex,i+1,&m_Result);
break;