diff --git a/logPlus/PropertyWidget.cpp b/logPlus/PropertyWidget.cpp index 98fd723..06ce4fe 100644 --- a/logPlus/PropertyWidget.cpp +++ b/logPlus/PropertyWidget.cpp @@ -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) { _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_nRotationAngle, QVariant::Int); _CreateVariantPropertyItem("通常", "显示单位", formInfo->m_strUnit, QVariant::String); @@ -2438,9 +2440,13 @@ void PropertyWidget::initDepthProperty(FormInfo *formInfo) _CreateVariantPropertyItem("深度标注", "斜深", formInfo->m_sdMeasuredDepth, QVariant::Bool); _CreateVariantPropertyItem("深度标注", "海拔垂深", formInfo->m_sdElevationVerticalDepth, QVariant::Bool); _CreateVariantPropertyItem("深度标注", "垂深", formInfo->m_sdVerticalDepth, QVariant::Bool); - _CreateVariantPropertyItem("深度标注", "斜深位置", formInfo->m_sdMeasuredDepthPosition, QVariant::String); - _CreateVariantPropertyItem("深度标注", "垂深位置", formInfo->m_sdVerticalDepthPosition, QVariant::String); - _CreateVariantPropertyItem("深度标注", "海拔垂深位置", formInfo->m_sdElevationVerticalDepthPosition, QVariant::String); + QStringList listStyle; + listStyle.append("偏左"); + 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_sdMajorTickLineWidth, QVariant::Int); @@ -2448,6 +2454,8 @@ void PropertyWidget::initDepthProperty(FormInfo *formInfo) _CreateVariantPropertyItem("次刻度线", "次刻度线长度", formInfo->m_sdMinorTickLineLength, QVariant::Int); _CreateVariantPropertyItem("次刻度线", "次刻度线宽度", formInfo->m_sdMinorTickLineWidth, QVariant::Int); + + m_strCurrentProperty = Depth_Property; } @@ -2910,7 +2918,7 @@ void PropertyWidget::initImageProperty(FormInfo *formInfo) { _CreateVariantPropertyItem("通常", "选择井曲线", m_strLineName + "@" + m_strSlfName, 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_nRotationAngle, QVariant::Int); _CreateVariantPropertyItem("通常", "字体", formInfo->m_curveNameFont, QVariant::Font); @@ -2944,7 +2952,7 @@ void PropertyWidget::initImageItemProperty(TransparentDraggableImage* tdImage, d _CreateVariantPropertyItem("通常", "选择井曲线", m_strLineName + "@" + m_strSlfName, 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_nRotationAngle, QVariant::Int); _CreateVariantPropertyItem("通常", "字体", formInfo->m_curveNameFont, QVariant::Font); @@ -2962,7 +2970,6 @@ void PropertyWidget::initImageItemProperty(TransparentDraggableImage* tdImage, d _CreateVariantPropertyItem("边框属性", "线宽", borderWidth, QVariant::Int); _CreateVariantPropertyItem("边框属性", "颜色", borderColor, QVariant::Color); -// _CreateVariantPropertyItem("边框属性", "线型", borderStyle, QVariant::String); QStringList listStyle; listStyle.append("无"); listStyle.append("实线"); @@ -3322,12 +3329,31 @@ void PropertyWidget::changedDepthProperty(QString strProperty, QVariant varVal) this->m_formInfo->m_strUnitFont = temp; this->m_formInfo->repaint(); } - else if ("头部高度(cm)" == strProperty) + else if ("头部高度" == strProperty) { int temp = varVal.toInt(); this->m_formInfo->m_headHeight = 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; + } } diff --git a/logPlus/formdraw.cpp b/logPlus/formdraw.cpp index 23d498b..96becd5 100644 --- a/logPlus/formdraw.cpp +++ b/logPlus/formdraw.cpp @@ -184,9 +184,7 @@ void FormDraw::setDrawData(QStringList listdt, QJsonObject objInfo) { // 在s_addDepth方法设置单位无效 pInfo->m_strUnit = "(米)"; - pInfo->m_strUnitFont = QFont("微软雅黑", 12); - - + pInfo->m_strUnitFont = QFont("微软雅黑", 8); initDepth(curv); } else if("plObject" == strType) @@ -4390,7 +4388,7 @@ void FormDraw::initDepth(QMyCustomPlot *curv) curv->yAxis->setTickLabels(true); curv->yAxis->setTickLabelSide(QCPAxis::lsInside); - QFont font1("微软雅黑", 16); //fontSize 16 + QFont font1("微软雅黑", 8); curv->yAxis->setTickLabelFont(font1); curv->yAxis->setRange(m_iY1, m_iY2); curv->axisRect()->setupFullAxesBox(); @@ -4398,30 +4396,6 @@ void FormDraw::initDepth(QMyCustomPlot *curv) 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) { widget->m_iX1 = 0; diff --git a/logPlus/forminfo.h b/logPlus/forminfo.h index 95e73b6..1eaec1e 100644 --- a/logPlus/forminfo.h +++ b/logPlus/forminfo.h @@ -220,12 +220,12 @@ public: double m_sdRotationAngle = 0.0; // 旋转(°) double m_sdDrawStartDepth; // 绘制起点深度 double m_sdDrawEndDepth; // 绘制终点深度 - double m_sdMeasuredDepth; // 斜深 + double m_sdMeasuredDepth = true; // 斜深 double m_sdElevationVerticalDepth; // 海拔垂深 double m_sdVerticalDepth; // 垂深 - QPointF m_sdMeasuredDepthPosition; // 斜深位置 - QPointF m_sdVerticalDepthPosition; // 垂深位置 - QPointF m_sdElevationVerticalDepthPosition; // 海拔垂深位置 + int m_sdMeasuredDepthPosition = 0; // 斜深位置 + int m_sdVerticalDepthPosition = 0; // 垂深位置 + int m_sdElevationVerticalDepthPosition; // 海拔垂深位置 int m_sdMajorTickLineLength = 3; // 主刻度线长度 int m_sdMajorTickLineWidth = 1; // 主刻度线宽度 int m_sdMinorTickLineLength = 1; // 次刻度线长度 diff --git a/logPlus/qmycustomplot.cpp b/logPlus/qmycustomplot.cpp index 95be37a..15a963c 100644 --- a/logPlus/qmycustomplot.cpp +++ b/logPlus/qmycustomplot.cpp @@ -4576,11 +4576,85 @@ void QMyCustomPlot::s_changeDepthProperty(QVariantList vlist) bool temp = varVal.toBool(); 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(); } } diff --git a/logPlus/qmycustomplot.h b/logPlus/qmycustomplot.h index 248f7aa..fc93a42 100644 --- a/logPlus/qmycustomplot.h +++ b/logPlus/qmycustomplot.h @@ -157,6 +157,9 @@ public: float m_MaxRange = 1023.0f; int m_nWaveJg = 100; int m_nWaveHei = 1; + + // 深度 第三个轴 + QCPAxis *m_yAxis3 = nullptr; // 保存指针 public: bool m_bEditor = false; // 编辑状态 QCPItemStraightLine* m_pAddLine1 = NULL;