深度 属性 垂深

This commit is contained in:
crqiqi77 2026-03-23 09:51:17 +08:00
parent 8af9525efb
commit d476fd714d
5 changed files with 126 additions and 49 deletions

View File

@ -164,9 +164,11 @@ void PropertyWidget::changedYxzpProperty(QtProperty *qtProperty, const QVariant
} }
} }
} }
else if("例区高度(cm)" == m_propertyData[qtProperty]) else if("例区高度" == m_propertyData[qtProperty])
{ {
int temp = variant.toInt();
this->m_formInfo->m_headHeight = temp;
this->m_formInfo->setFixedHeight(temp);
} }
} }
@ -2421,7 +2423,7 @@ void PropertyWidget::initTableProperty(FormInfo *formInfo)
void PropertyWidget::initDepthProperty(FormInfo *formInfo) void PropertyWidget::initDepthProperty(FormInfo *formInfo)
{ {
_CreateVariantPropertyItem("通常", "显示名称", formInfo->m_strAliasName, QVariant::String); _CreateVariantPropertyItem("通常", "显示名称", formInfo->m_strAliasName, QVariant::String);
_CreateVariantPropertyItem("通常", "头部高度(cm)", formInfo->m_headHeight, QVariant::Double); _CreateVariantPropertyItem("通常", "头部高度", formInfo->m_headHeight, QVariant::Double);
_CreateVariantPropertyItem("通常", "垂向绘制", formInfo->m_bVerticaDrawing, QVariant::Bool); _CreateVariantPropertyItem("通常", "垂向绘制", formInfo->m_bVerticaDrawing, QVariant::Bool);
_CreateVariantPropertyItem("通常", "旋转角度(°)", formInfo->m_nRotationAngle, QVariant::Int); _CreateVariantPropertyItem("通常", "旋转角度(°)", formInfo->m_nRotationAngle, QVariant::Int);
_CreateVariantPropertyItem("通常", "显示单位", formInfo->m_strUnit, QVariant::String); _CreateVariantPropertyItem("通常", "显示单位", formInfo->m_strUnit, QVariant::String);
@ -2438,9 +2440,13 @@ void PropertyWidget::initDepthProperty(FormInfo *formInfo)
_CreateVariantPropertyItem("深度标注", "斜深", formInfo->m_sdMeasuredDepth, QVariant::Bool); _CreateVariantPropertyItem("深度标注", "斜深", formInfo->m_sdMeasuredDepth, QVariant::Bool);
_CreateVariantPropertyItem("深度标注", "海拔垂深", formInfo->m_sdElevationVerticalDepth, QVariant::Bool); _CreateVariantPropertyItem("深度标注", "海拔垂深", formInfo->m_sdElevationVerticalDepth, QVariant::Bool);
_CreateVariantPropertyItem("深度标注", "垂深", formInfo->m_sdVerticalDepth, QVariant::Bool); _CreateVariantPropertyItem("深度标注", "垂深", formInfo->m_sdVerticalDepth, QVariant::Bool);
_CreateVariantPropertyItem("深度标注", "斜深位置", formInfo->m_sdMeasuredDepthPosition, QVariant::String); QStringList listStyle;
_CreateVariantPropertyItem("深度标注", "垂深位置", formInfo->m_sdVerticalDepthPosition, QVariant::String); listStyle.append("偏左");
_CreateVariantPropertyItem("深度标注", "海拔垂深位置", formInfo->m_sdElevationVerticalDepthPosition, QVariant::String); listStyle.append("居中");
listStyle.append("偏右");
_CreateEnumPropertyItem("深度标注", "斜深位置", formInfo->m_sdMeasuredDepthPosition, listStyle);
_CreateEnumPropertyItem("深度标注", "垂深位置", formInfo->m_sdVerticalDepthPosition, listStyle);
_CreateEnumPropertyItem("深度标注", "海拔垂深位置", formInfo->m_sdElevationVerticalDepthPosition, listStyle);
_CreateVariantPropertyItem("主刻度线", "主刻度线长度", formInfo->m_sdMajorTickLineLength, QVariant::Int); _CreateVariantPropertyItem("主刻度线", "主刻度线长度", formInfo->m_sdMajorTickLineLength, QVariant::Int);
_CreateVariantPropertyItem("主刻度线", "主刻度线宽度", formInfo->m_sdMajorTickLineWidth, QVariant::Int); _CreateVariantPropertyItem("主刻度线", "主刻度线宽度", formInfo->m_sdMajorTickLineWidth, QVariant::Int);
@ -2448,6 +2454,8 @@ void PropertyWidget::initDepthProperty(FormInfo *formInfo)
_CreateVariantPropertyItem("次刻度线", "次刻度线长度", formInfo->m_sdMinorTickLineLength, QVariant::Int); _CreateVariantPropertyItem("次刻度线", "次刻度线长度", formInfo->m_sdMinorTickLineLength, QVariant::Int);
_CreateVariantPropertyItem("次刻度线", "次刻度线宽度", formInfo->m_sdMinorTickLineWidth, QVariant::Int); _CreateVariantPropertyItem("次刻度线", "次刻度线宽度", formInfo->m_sdMinorTickLineWidth, QVariant::Int);
m_strCurrentProperty = Depth_Property; m_strCurrentProperty = Depth_Property;
} }
@ -2910,7 +2918,7 @@ void PropertyWidget::initImageProperty(FormInfo *formInfo)
{ {
_CreateVariantPropertyItem("通常", "选择井曲线", m_strLineName + "@" + m_strSlfName, QVariant::String); _CreateVariantPropertyItem("通常", "选择井曲线", m_strLineName + "@" + m_strSlfName, QVariant::String);
_CreateVariantPropertyItem("通常", "显示名称", formInfo->m_strAliasName, QVariant::String); _CreateVariantPropertyItem("通常", "显示名称", formInfo->m_strAliasName, QVariant::String);
_CreateVariantPropertyItem("通常", "例区高度(cm)", formInfo->m_yxzpExampleAreaHeight, QVariant::Int); _CreateVariantPropertyItem("通常", "例区高度", formInfo->m_headHeight, QVariant::Int);
_CreateVariantPropertyItem("通常", "垂向绘制", formInfo->m_bVerticaDrawing, QVariant::Bool); _CreateVariantPropertyItem("通常", "垂向绘制", formInfo->m_bVerticaDrawing, QVariant::Bool);
_CreateVariantPropertyItem("通常", "旋转角度(°)", formInfo->m_nRotationAngle, QVariant::Int); _CreateVariantPropertyItem("通常", "旋转角度(°)", formInfo->m_nRotationAngle, QVariant::Int);
_CreateVariantPropertyItem("通常", "字体", formInfo->m_curveNameFont, QVariant::Font); _CreateVariantPropertyItem("通常", "字体", formInfo->m_curveNameFont, QVariant::Font);
@ -2944,7 +2952,7 @@ void PropertyWidget::initImageItemProperty(TransparentDraggableImage* tdImage, d
_CreateVariantPropertyItem("通常", "选择井曲线", m_strLineName + "@" + m_strSlfName, QVariant::String); _CreateVariantPropertyItem("通常", "选择井曲线", m_strLineName + "@" + m_strSlfName, QVariant::String);
_CreateVariantPropertyItem("通常", "显示名称", formInfo->m_strAliasName, QVariant::String); _CreateVariantPropertyItem("通常", "显示名称", formInfo->m_strAliasName, QVariant::String);
_CreateVariantPropertyItem("通常", "例区高度(cm)", formInfo->m_yxzpExampleAreaHeight, QVariant::Int); _CreateVariantPropertyItem("通常", "例区高度", formInfo->m_headHeight, QVariant::Int);
_CreateVariantPropertyItem("通常", "垂向绘制", formInfo->m_bVerticaDrawing, QVariant::Bool); _CreateVariantPropertyItem("通常", "垂向绘制", formInfo->m_bVerticaDrawing, QVariant::Bool);
_CreateVariantPropertyItem("通常", "旋转角度(°)", formInfo->m_nRotationAngle, QVariant::Int); _CreateVariantPropertyItem("通常", "旋转角度(°)", formInfo->m_nRotationAngle, QVariant::Int);
_CreateVariantPropertyItem("通常", "字体", formInfo->m_curveNameFont, QVariant::Font); _CreateVariantPropertyItem("通常", "字体", formInfo->m_curveNameFont, QVariant::Font);
@ -2962,7 +2970,6 @@ void PropertyWidget::initImageItemProperty(TransparentDraggableImage* tdImage, d
_CreateVariantPropertyItem("边框属性", "线宽", borderWidth, QVariant::Int); _CreateVariantPropertyItem("边框属性", "线宽", borderWidth, QVariant::Int);
_CreateVariantPropertyItem("边框属性", "颜色", borderColor, QVariant::Color); _CreateVariantPropertyItem("边框属性", "颜色", borderColor, QVariant::Color);
// _CreateVariantPropertyItem("边框属性", "线型", borderStyle, QVariant::String);
QStringList listStyle; QStringList listStyle;
listStyle.append(""); listStyle.append("");
listStyle.append("实线"); listStyle.append("实线");
@ -3322,12 +3329,31 @@ void PropertyWidget::changedDepthProperty(QString strProperty, QVariant varVal)
this->m_formInfo->m_strUnitFont = temp; this->m_formInfo->m_strUnitFont = temp;
this->m_formInfo->repaint(); this->m_formInfo->repaint();
} }
else if ("头部高度(cm)" == strProperty) else if ("头部高度" == strProperty)
{ {
int temp = varVal.toInt(); int temp = varVal.toInt();
this->m_formInfo->m_headHeight = temp; this->m_formInfo->m_headHeight = temp;
this->m_formInfo->setFixedHeight(temp); this->m_formInfo->setFixedHeight(temp);
} }
else if ("斜深位置" == strProperty)
{
int temp = varVal.toInt();
int newStyle = 0;
switch(temp)
{
case 0:
// 偏左
newStyle = Qt::NoPen;
break;
case 1:
// 居中
newStyle = Qt::SolidLine;
break;
case 2:
// 偏右
newStyle = Qt::DashLine;
break;
}
this->m_formInfo->m_sdMeasuredDepthPosition = newStyle;
}
} }

View File

@ -184,9 +184,7 @@ void FormDraw::setDrawData(QStringList listdt, QJsonObject objInfo)
{ {
// 在s_addDepth方法设置单位无效 // 在s_addDepth方法设置单位无效
pInfo->m_strUnit = "(米)"; pInfo->m_strUnit = "(米)";
pInfo->m_strUnitFont = QFont("微软雅黑", 12); pInfo->m_strUnitFont = QFont("微软雅黑", 8);
initDepth(curv); initDepth(curv);
} }
else if("plObject" == strType) else if("plObject" == strType)
@ -4390,7 +4388,7 @@ void FormDraw::initDepth(QMyCustomPlot *curv)
curv->yAxis->setTickLabels(true); curv->yAxis->setTickLabels(true);
curv->yAxis->setTickLabelSide(QCPAxis::lsInside); curv->yAxis->setTickLabelSide(QCPAxis::lsInside);
QFont font1("微软雅黑", 16); //fontSize 16 QFont font1("微软雅黑", 8);
curv->yAxis->setTickLabelFont(font1); curv->yAxis->setTickLabelFont(font1);
curv->yAxis->setRange(m_iY1, m_iY2); curv->yAxis->setRange(m_iY1, m_iY2);
curv->axisRect()->setupFullAxesBox(); curv->axisRect()->setupFullAxesBox();
@ -4398,30 +4396,6 @@ void FormDraw::initDepth(QMyCustomPlot *curv)
curv->m_bX2Y = false; curv->m_bX2Y = false;
} }
//void FormDraw::initDepth(QMyCustomPlot *curv)
//{
// curv->xAxis->setTicks(true); // 显示X轴主刻度默认true
// curv->yAxis->setTicks(false); // 隐藏Y轴主刻度
// curv->xAxis->setSubTicks(true); // 显示X轴副刻度
// curv->yAxis->setSubTicks(false); // 隐藏Y轴副刻度
// curv->xAxis->setTickLabels(true);
// curv->yAxis->setTickLabels(false);
// curv->xAxis->setTickLabelSide(QCPAxis::lsInside);
//// curv->yAxis->setTickLabelSide(QCPAxis::lsInside);
// curv->xAxis->setTickLength(25, 0); // X轴主刻度内侧15px外侧0px隐藏
//// curv->yAxis->setTickLength(25, 0);
// QPen tickPen;
// tickPen.setColor(Qt::red); // 主刻度颜色(红色)
// tickPen.setWidth(2); // 主刻度线宽2像素
// tickPen.setStyle(Qt::SolidLine); // 刻度线样式实线可选虚线Qt::DashLine
// curv->xAxis->setTickPen(tickPen); // 应用到X轴主刻度
// //对调XY轴在最前面设置
// QCPAxis *yAxis = curv->yAxis;
// QCPAxis *xAxis = curv->xAxis;
// curv->xAxis = yAxis;
// curv->yAxis = xAxis;
//}
void FormDraw::initFgrq(QMyCustomPlot *widget) void FormDraw::initFgrq(QMyCustomPlot *widget)
{ {
widget->m_iX1 = 0; widget->m_iX1 = 0;

View File

@ -220,12 +220,12 @@ public:
double m_sdRotationAngle = 0.0; // 旋转(°) double m_sdRotationAngle = 0.0; // 旋转(°)
double m_sdDrawStartDepth; // 绘制起点深度 double m_sdDrawStartDepth; // 绘制起点深度
double m_sdDrawEndDepth; // 绘制终点深度 double m_sdDrawEndDepth; // 绘制终点深度
double m_sdMeasuredDepth; // 斜深 double m_sdMeasuredDepth = true; // 斜深
double m_sdElevationVerticalDepth; // 海拔垂深 double m_sdElevationVerticalDepth; // 海拔垂深
double m_sdVerticalDepth; // 垂深 double m_sdVerticalDepth; // 垂深
QPointF m_sdMeasuredDepthPosition; // 斜深位置 int m_sdMeasuredDepthPosition = 0; // 斜深位置
QPointF m_sdVerticalDepthPosition; // 垂深位置 int m_sdVerticalDepthPosition = 0; // 垂深位置
QPointF m_sdElevationVerticalDepthPosition; // 海拔垂深位置 int m_sdElevationVerticalDepthPosition; // 海拔垂深位置
int m_sdMajorTickLineLength = 3; // 主刻度线长度 int m_sdMajorTickLineLength = 3; // 主刻度线长度
int m_sdMajorTickLineWidth = 1; // 主刻度线宽度 int m_sdMajorTickLineWidth = 1; // 主刻度线宽度
int m_sdMinorTickLineLength = 1; // 次刻度线长度 int m_sdMinorTickLineLength = 1; // 次刻度线长度

View File

@ -4576,11 +4576,85 @@ void QMyCustomPlot::s_changeDepthProperty(QVariantList vlist)
bool temp = varVal.toBool(); bool temp = varVal.toBool();
this->yAxis->setTickLabels(temp); this->yAxis->setTickLabels(temp);
} }
else if ("斜深位置" == strProperty)
{
// 没有直接设置偏移方法 动态计算太麻烦
int temp = varVal.toInt();
switch(temp)
{
case 0:
// 偏左
this->yAxis->setTickLabelPadding(5);
break;
case 1:
// 居中
this->yAxis->setTickLabelPadding(30);
break;
case 2:
this->yAxis->setTickLabelPadding(50);
break;
}
}
else if ("海拔垂深" == strProperty)
{
bool temp = varVal.toBool();
this->yAxis2->setTickLabels(temp);
this->yAxis2->setVisible(temp);
this->yAxis2->setTickLabelSide(QCPAxis::lsInside);
// this->yAxis2->setAxisType(QCPAxis::atLeft);
// this->yAxis2->setPosition(QCPAxis::atLeft);
}
else if ("垂深" == strProperty)
{
bool temp = varVal.toBool();
if(!this->m_yAxis3)
{
this->m_yAxis3 = new QCPAxis(this->axisRect(), QCPAxis::atLeft);
this->axisRect()->addAxis(QCPAxis::atLeft, this->m_yAxis3);
this->m_yAxis3->setRange(0, 100);
this->m_yAxis3->setOffset(40);
this->m_yAxis3->setTickLabelPadding(10);
}
this->m_yAxis3->setVisible(temp); // 显示第三个Y轴
this->m_yAxis3->setTickLabels(temp);
this->m_yAxis3->setTickLabelSide(QCPAxis::lsInside);
}
else if ("海拔垂深位置" == strProperty)
{
int temp = varVal.toInt();
switch(temp)
{
case 0:
// 偏左
this->yAxis2->setTickLabelPadding(50);
break;
case 1:
// 居中
this->yAxis2->setTickLabelPadding(30);
break;
case 2:
this->yAxis2->setTickLabelPadding(5);
break;
}
}
else if ("垂深位置" == strProperty)
{
int temp = varVal.toInt();
switch(temp)
{
case 0:
// 偏左
this->m_yAxis3->setTickLabelPadding(5 + 10);
break;
case 1:
// 居中
this->m_yAxis3->setTickLabelPadding(30 + 10);
break;
case 2:
this->m_yAxis3->setTickLabelPadding(50 + 10);
break;
}
}
this->replot(); this->replot();
} }
} }

View File

@ -157,6 +157,9 @@ public:
float m_MaxRange = 1023.0f; float m_MaxRange = 1023.0f;
int m_nWaveJg = 100; int m_nWaveJg = 100;
int m_nWaveHei = 1; int m_nWaveHei = 1;
// 深度 第三个轴
QCPAxis *m_yAxis3 = nullptr; // 保存指针
public: public:
bool m_bEditor = false; // 编辑状态 bool m_bEditor = false; // 编辑状态
QCPItemStraightLine* m_pAddLine1 = NULL; QCPItemStraightLine* m_pAddLine1 = NULL;