From 8fbbe54c025623a70b428e9c00d998c5f2cb0a91 Mon Sep 17 00:00:00 2001 From: "DESKTOP-450PEFP\\mainc" Date: Tue, 19 May 2026 11:19:43 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B3=A2=E5=88=97=E5=B1=9E=E6=80=A7=E9=81=93?= =?UTF-8?q?=E9=87=8D=E6=96=B0=E5=AE=9E=E7=8E=B0=E3=80=82=20=E4=BD=BF?= =?UTF-8?q?=E7=94=A8QPainter?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BaseFun/include/BaseFun.h | 4 - DataMgr/src/InDefTableDlg.cpp | 4 +- common/geometryutils.h | 7 + logPlus/CallManage.h | 2 + logPlus/LogmuditemDrawer.h | 6 - logPlus/formdraw.cpp | 672 +++++++------- logPlus/formdraw.h | 1 + logPlus/forminfo.cpp | 7 +- logPlus/forminfo.h | 16 +- logPlus/formwave.cpp | 1447 +++++++++++++++++++++++++++++++ logPlus/formwave.h | 114 +++ logPlus/formwave.ui | 33 + logPlus/formwell.cpp | 1 + logPlus/formwell.h | 1 + logPlus/logPlus.pro | 3 + logPlus/logplus.vcxproj | 3 + logPlus/logplus.vcxproj.filters | 9 + logPlus/mainwindow.h | 2 +- logPlus/mainwindowcurve.cpp | 18 + logPlus/mainwindowcurve.h | 1 + logPlus/mainwindowcurve.ui | 12 +- logPlus/qmycustomplot.cpp | 18 +- logPlus/qmycustomplot.h | 3 + 23 files changed, 2032 insertions(+), 352 deletions(-) create mode 100644 logPlus/formwave.cpp create mode 100644 logPlus/formwave.h create mode 100644 logPlus/formwave.ui diff --git a/BaseFun/include/BaseFun.h b/BaseFun/include/BaseFun.h index c9c3b67..836d6a4 100644 --- a/BaseFun/include/BaseFun.h +++ b/BaseFun/include/BaseFun.h @@ -14,10 +14,6 @@ #define NULL 0 #endif -#ifndef BOOL -#define BOOL bool -#endif - #ifndef FALSE #define FALSE false #endif diff --git a/DataMgr/src/InDefTableDlg.cpp b/DataMgr/src/InDefTableDlg.cpp index cc7d4f9..4b40a08 100644 --- a/DataMgr/src/InDefTableDlg.cpp +++ b/DataMgr/src/InDefTableDlg.cpp @@ -772,14 +772,14 @@ void CInDefTableDlg::InitList1() } } -BOOL CInDefTableDlg::mIsNumber(QString str)//判断字符串是否为数值 +bool CInDefTableDlg::mIsNumber(QString str)//判断字符串是否为数值 { QByteArray ba = str.toLatin1();//QString 转换为 char* const char *buf = ba.data(); int len=strlen(str.toStdString().c_str());//str.length();//whp change 2020.3.16 int dig[30]; int DotNum=0;//小数点个数 - BOOL IsDigital=1; + bool IsDigital=1; for(int i=0;isetDrawDt(listdt, objInfo); - // - QMyCustomPlot *curv = new QMyCustomPlot(this, strSlfName, strWellName, m_strTrackName, strLineName); - //绑定m_formTrack,方便关联formInfo - curv->m_formTrack = m_formTrack; - curv->setDepthY(m_iY1, m_iY2); - curv->initGeometry(m_strUuid, m_iScale, dW); - curv->show(); + if ("waveObject" == strType) + { + FormWave *pwave = new FormWave(this, strSlfName, strWellName, m_strTrackName, strLineName); + pwave->setDepthY(m_iY1, m_iY2); + pwave->initGeometry(m_strUuid, m_iScale, dW, m_nObjDrawH); + pwave->m_formTrack = m_formTrack; + pwave->show(); + } + else + { + // + QMyCustomPlot *curv = new QMyCustomPlot(this, strSlfName, strWellName, m_strTrackName, strLineName); + //绑定m_formTrack,方便关联formInfo + curv->m_formTrack = m_formTrack; + curv->setDepthY(m_iY1, m_iY2); + curv->initGeometry(m_strUuid, m_iScale, dW); + curv->show(); - if ("waveObject" == strType) - { - curv->m_nMode = pInfo->getFillTypeIndex(); - //curv->m_fmin = pInfo->getVMin(); - //curv->m_fmax = pInfo->getVMax(); - curv->m_nDrawType = pInfo->m_nDrawType; - curv->m_bDrawDepth = pInfo->m_bDrawDepth; // 绘制波深度 - curv->m_bDrawBase = pInfo->m_bDrawBase; // 绘制波深度 - curv->m_bOddEven = pInfo->m_bOddEven; // 绘制波深度 + if ("waveObject" == strType) + { + curv->m_nMode = pInfo->getFillTypeIndex(); + //curv->m_fmin = pInfo->getVMin(); + //curv->m_fmax = pInfo->getVMax(); + curv->m_nDrawType = pInfo->m_nDrawType; + curv->m_bDrawDepth = pInfo->m_bDrawDepth; // 绘制波深度 + curv->m_bDrawBase = pInfo->m_bDrawBase; // 绘制波深度 + curv->m_bOddEven = pInfo->m_bOddEven; // 绘制波深度 - curv->m_MaxRange = pInfo->m_fMaxAmp; // 最大振幅 - curv->m_Base = pInfo->m_fWaveBase; // 波列基值 - curv->m_nWaveJg = pInfo->m_nWaveJg; // 波形间隔 - curv->m_nWaveHei = pInfo->m_fWaveHei; // 波形高度 + curv->m_MaxRange = pInfo->m_fMaxAmp; // 最大振幅 + curv->m_Base = pInfo->m_fWaveBase; // 波列基值 + curv->m_nWaveJg = pInfo->m_nWaveJg; // 波形间隔 + curv->m_nWaveHei = pInfo->m_fWaveHei; // 波形高度 - curv->m_nColorNum = pInfo->m_nColorNum; - curv->m_nSchemeIndex = pInfo->m_nSchemeIndex; - curv->m_fScaleV = pInfo->getVMax(); + curv->m_nColorNum = pInfo->m_nColorNum; + curv->m_nSchemeIndex = pInfo->m_nSchemeIndex; + curv->m_fScaleV = pInfo->getVMax(); - int _nSamples = 0; - if (g_iSupport3D) - { - initWave_3D(curv, m_strSlfName, strLineName, _nSamples); - } - else - { - curv->m_bX2Y = false; - //curv->initWave2(m_strSlfName, strLineName); - curv->changePropertyWaveUpdate(); - } - } - // 深度 - else if("depthObject" == strType) - { - initDepth(curv); + int _nSamples = 0; + if (g_iSupport3D) + { + initWave_3D(curv, m_strSlfName, strLineName, _nSamples); + } + else + { + curv->m_bX2Y = false; + //curv->initWave2(m_strSlfName, strLineName); + curv->changePropertyWaveUpdate(); + } + } + // 深度 + else if ("depthObject" == strType) + { + initDepth(curv); - // 在s_addDepth方法设置单位无效 - // 读json后 重新设置样式 - // 设置左侧显示属性 设置界面样式 - if(pInfo->m_strUnit.isEmpty()){ - pInfo->m_strUnit = "(米)"; - pInfo->m_strUnitFont = QFont("微软雅黑", 8); - } - // 头部高度 - pInfo->setFixedHeight(pInfo->m_headHeight); - // 标尺颜色 - curv->yAxis->setTickLabelColor(pInfo->m_sdRulerColor); - // 间隔 - QSharedPointer fixedTicker(new QCPAxisTickerFixed); - fixedTicker->setTickStep(pInfo->m_sdInterval); - fixedTicker->setScaleStrategy(QCPAxisTickerFixed::ssNone); - curv->yAxis->setTicker(fixedTicker); - // 标注字体 - curv->yAxis->setTickLabelFont(pInfo->m_sdLabelFont); - curv->m_yAxis2->setTickLabelFont(pInfo->m_sdLabelFont); - curv->m_yAxis3->setTickLabelFont(pInfo->m_sdLabelFont); - // 旋转(°) - curv->yAxis->setTickLabelRotation(pInfo->m_sdRotationAngle); - curv->m_yAxis2->setTickLabelRotation(pInfo->m_sdRotationAngle); - curv->m_yAxis3->setTickLabelRotation(pInfo->m_sdRotationAngle); - // 斜深 - curv->yAxis->setTickLabels(pInfo->m_sdMeasuredDepth); - // 海拔垂深 - { - bool temp = pInfo->m_sdElevationVerticalDepth; + // 在s_addDepth方法设置单位无效 + // 读json后 重新设置样式 + // 设置左侧显示属性 设置界面样式 + if (pInfo->m_strUnit.isEmpty()) { + pInfo->m_strUnit = "(米)"; + pInfo->m_strUnitFont = QFont("微软雅黑", 8); + } + // 头部高度 + pInfo->setFixedHeight(pInfo->m_headHeight); + // 标尺颜色 + curv->yAxis->setTickLabelColor(pInfo->m_sdRulerColor); + // 间隔 + QSharedPointer fixedTicker(new QCPAxisTickerFixed); + fixedTicker->setTickStep(pInfo->m_sdInterval); + fixedTicker->setScaleStrategy(QCPAxisTickerFixed::ssNone); + curv->yAxis->setTicker(fixedTicker); + // 标注字体 + curv->yAxis->setTickLabelFont(pInfo->m_sdLabelFont); + curv->m_yAxis2->setTickLabelFont(pInfo->m_sdLabelFont); + curv->m_yAxis3->setTickLabelFont(pInfo->m_sdLabelFont); + // 旋转(°) + curv->yAxis->setTickLabelRotation(pInfo->m_sdRotationAngle); + curv->m_yAxis2->setTickLabelRotation(pInfo->m_sdRotationAngle); + curv->m_yAxis3->setTickLabelRotation(pInfo->m_sdRotationAngle); + // 斜深 + curv->yAxis->setTickLabels(pInfo->m_sdMeasuredDepth); + // 海拔垂深 + { + bool temp = pInfo->m_sdElevationVerticalDepth; - curv->m_yAxis2->setVisible(temp); - curv->m_yAxis2->setTickLabels(temp); - curv->m_yAxis2->setTickLabelSide(QCPAxis::lsInside); - } - // 垂深 - bool temp2 = pInfo->m_sdVerticalDepth; - curv->m_yAxis3->setVisible(temp2); // 显示第三个Y轴 - curv->m_yAxis3->setTickLabels(temp2); - curv->m_yAxis3->setTickLabelSide(QCPAxis::lsInside); + curv->m_yAxis2->setVisible(temp); + curv->m_yAxis2->setTickLabels(temp); + curv->m_yAxis2->setTickLabelSide(QCPAxis::lsInside); + } + // 垂深 + bool temp2 = pInfo->m_sdVerticalDepth; + curv->m_yAxis3->setVisible(temp2); // 显示第三个Y轴 + curv->m_yAxis3->setTickLabels(temp2); + curv->m_yAxis3->setTickLabelSide(QCPAxis::lsInside); - QSize size = curv->size(); // 包含宽高的QSize对象 - int width2 = size.width(); - int center = width2 / 2 - pInfo->m_sdLabelFont.pointSize(); - int right = width2 - pInfo->m_sdLabelFont.pointSize() - 5; - // 斜深位置 - switch(pInfo->m_sdMeasuredDepthPosition) - { - case 0: - // 偏左 - curv->yAxis->setTickLabelPadding(5); - break; - case 1: - // 居中 - curv->yAxis->setTickLabelPadding(center); - break; - case 2: - curv->yAxis->setTickLabelPadding(right); - break; - } + QSize size = curv->size(); // 包含宽高的QSize对象 + int width2 = size.width(); + int center = width2 / 2 - pInfo->m_sdLabelFont.pointSize(); + int right = width2 - pInfo->m_sdLabelFont.pointSize() - 5; + // 斜深位置 + switch (pInfo->m_sdMeasuredDepthPosition) + { + case 0: + // 偏左 + curv->yAxis->setTickLabelPadding(5); + break; + case 1: + // 居中 + curv->yAxis->setTickLabelPadding(center); + break; + case 2: + curv->yAxis->setTickLabelPadding(right); + break; + } - // 垂深位置 - switch(pInfo->m_sdVerticalDepthPosition) - { - case 0: - // 偏左 - curv->m_yAxis3->setTickLabelPadding(5); - break; - case 1: - // 居中 - curv->m_yAxis3->setTickLabelPadding(center); - break; - case 2: - curv->m_yAxis3->setTickLabelPadding(right); - break; - } - // 海拔垂深位置 - switch(pInfo->m_sdElevationVerticalDepthPosition) - { - case 0: - // 偏左 - curv->m_yAxis2->setTickLabelPadding(5); - break; - case 1: - // 居中 - curv->m_yAxis2->setTickLabelPadding(center); - break; - case 2: - curv->m_yAxis2->setTickLabelPadding(right); - break; - } - // 主刻度线长度 - { - int temp = pInfo->m_sdMajorTickLineLength; - curv->yAxis->setTickLength(temp, 0); - } - // 主刻度线宽度 - { - int temp = pInfo->m_sdMajorTickLineWidth; - QPen tickPen = curv->yAxis->tickPen(); - tickPen.setWidth(temp); - curv->yAxis->setTickPen(tickPen); - } - // 次刻度线长度 - { - int temp = pInfo->m_sdMinorTickLineLength; - curv->yAxis->setSubTickLength(temp, 0); - } - // 次刻度线宽度 - { - int temp = pInfo->m_sdMinorTickLineWidth; - QPen tickPen = curv->yAxis->subTickPen(); - tickPen.setWidth(temp); - curv->yAxis->setSubTickPen(tickPen); - } - } - else if("plObject" == strType) // 频率统计图 - { - // 读json后 重新设置样式 - // 设置左侧显示属性 设置界面样式 - if(pInfo->m_strUnit.isEmpty()){ - pInfo->m_strUnit = "(°)"; - pInfo->m_strUnitFont = QFont("微软雅黑", 8); - } + // 垂深位置 + switch (pInfo->m_sdVerticalDepthPosition) + { + case 0: + // 偏左 + curv->m_yAxis3->setTickLabelPadding(5); + break; + case 1: + // 居中 + curv->m_yAxis3->setTickLabelPadding(center); + break; + case 2: + curv->m_yAxis3->setTickLabelPadding(right); + break; + } + // 海拔垂深位置 + switch (pInfo->m_sdElevationVerticalDepthPosition) + { + case 0: + // 偏左 + curv->m_yAxis2->setTickLabelPadding(5); + break; + case 1: + // 居中 + curv->m_yAxis2->setTickLabelPadding(center); + break; + case 2: + curv->m_yAxis2->setTickLabelPadding(right); + break; + } + // 主刻度线长度 + { + int temp = pInfo->m_sdMajorTickLineLength; + curv->yAxis->setTickLength(temp, 0); + } + // 主刻度线宽度 + { + int temp = pInfo->m_sdMajorTickLineWidth; + QPen tickPen = curv->yAxis->tickPen(); + tickPen.setWidth(temp); + curv->yAxis->setTickPen(tickPen); + } + // 次刻度线长度 + { + int temp = pInfo->m_sdMinorTickLineLength; + curv->yAxis->setSubTickLength(temp, 0); + } + // 次刻度线宽度 + { + int temp = pInfo->m_sdMinorTickLineWidth; + QPen tickPen = curv->yAxis->subTickPen(); + tickPen.setWidth(temp); + curv->yAxis->setSubTickPen(tickPen); + } + } + else if ("plObject" == strType) // 频率统计图 + { + // 读json后 重新设置样式 + // 设置左侧显示属性 设置界面样式 + if (pInfo->m_strUnit.isEmpty()) { + pInfo->m_strUnit = "(°)"; + pInfo->m_strUnitFont = QFont("微软雅黑", 8); + } - this->initFgrq(curv); + this->initFgrq(curv); - // 数据 - int dataType = pInfo->m_pl_dataType; // 数据类型 - QString azimuthCurve = pInfo->m_pl_azimuthCurve; // 方位曲线 - QString inclinationCurve = pInfo->m_pl_inclinationCurve; // 倾角曲线 - // 通常 - pInfo->setFixedHeight(pInfo->m_headHeight); // 例区高度 - // 控制曲线 - QString csCurveGrad = pInfo->m_pl_controlCurveName; - double LeftVal3 = pInfo->m_pl_controlMinValue; - double RightVal3 = pInfo->m_pl_controlMaxValue; - // 方位频率 - int nArc = pInfo->m_pl_sectorCount; - double nR = pInfo->m_pl_circleRadius; - QColor crArc = pInfo->m_pl_circleColor; - int nArcLineWidth = pInfo->m_pl_circleLineWidth; - bool bFill = pInfo->m_pl_isFillEnabled; - QColor crFill = pInfo->m_pl_fillColor; - // 倾角频率 - int lineNumber = pInfo->m_pl_lineNumber; // 线数 - // 统计线高度 - double lineHeight = pInfo->m_pl_lineHeight; - // 线粗细 - int lineThickness = pInfo->m_pl_lineThickness; - // 线颜色 - QColor lineColor = pInfo->m_pl_lineColor; - // 是否绘制标注? - bool drawAnnotation = pInfo->m_pl_drawAnnotation; - // 绘制直方图? - bool drawHistogram = pInfo->m_pl_drawHistogram; - // 基线参数 - int baselineWidth = pInfo->m_pl_baselineWidth; // 基线宽度 - QColor baselineColor = pInfo->m_pl_baselineColor; // 基线颜色 - // 统计参数 - int statInterval = pInfo->m_pl_statInterval; // 统计间隔 - double minInclination = pInfo->m_pl_minInclination; // 最小倾角 - double maxInclination = pInfo->m_pl_maxInclination; // 最大倾角 - curv->drawFgrq(dataType, azimuthCurve, inclinationCurve, csCurveGrad, LeftVal3, RightVal3, nArc, nR, crArc, nArcLineWidth, bFill, crFill, - lineNumber, lineHeight, lineThickness, lineColor, drawAnnotation, drawHistogram, - baselineWidth, baselineColor, statInterval, minInclination, maxInclination); - } - else if("roseObject" == strType) // 玫瑰图 - { - pInfo->m_pl_azimuthCurve = "STRDIR"; // 方位曲线 - pInfo->m_pl_inclinationCurve = "CALM"; // 倾角曲线 - if(pInfo->m_strUnit.isEmpty()){ - pInfo->m_strUnit = "(°)"; - pInfo->m_strUnitFont = QFont("微软雅黑", 8); - } + // 数据 + int dataType = pInfo->m_pl_dataType; // 数据类型 + QString azimuthCurve = pInfo->m_pl_azimuthCurve; // 方位曲线 + QString inclinationCurve = pInfo->m_pl_inclinationCurve; // 倾角曲线 + // 通常 + pInfo->setFixedHeight(pInfo->m_headHeight); // 例区高度 + // 控制曲线 + QString csCurveGrad = pInfo->m_pl_controlCurveName; + double LeftVal3 = pInfo->m_pl_controlMinValue; + double RightVal3 = pInfo->m_pl_controlMaxValue; + // 方位频率 + int nArc = pInfo->m_pl_sectorCount; + double nR = pInfo->m_pl_circleRadius; + QColor crArc = pInfo->m_pl_circleColor; + int nArcLineWidth = pInfo->m_pl_circleLineWidth; + bool bFill = pInfo->m_pl_isFillEnabled; + QColor crFill = pInfo->m_pl_fillColor; + // 倾角频率 + int lineNumber = pInfo->m_pl_lineNumber; // 线数 + // 统计线高度 + double lineHeight = pInfo->m_pl_lineHeight; + // 线粗细 + int lineThickness = pInfo->m_pl_lineThickness; + // 线颜色 + QColor lineColor = pInfo->m_pl_lineColor; + // 是否绘制标注? + bool drawAnnotation = pInfo->m_pl_drawAnnotation; + // 绘制直方图? + bool drawHistogram = pInfo->m_pl_drawHistogram; + // 基线参数 + int baselineWidth = pInfo->m_pl_baselineWidth; // 基线宽度 + QColor baselineColor = pInfo->m_pl_baselineColor; // 基线颜色 + // 统计参数 + int statInterval = pInfo->m_pl_statInterval; // 统计间隔 + double minInclination = pInfo->m_pl_minInclination; // 最小倾角 + double maxInclination = pInfo->m_pl_maxInclination; // 最大倾角 + curv->drawFgrq(dataType, azimuthCurve, inclinationCurve, csCurveGrad, LeftVal3, RightVal3, nArc, nR, crArc, nArcLineWidth, bFill, crFill, + lineNumber, lineHeight, lineThickness, lineColor, drawAnnotation, drawHistogram, + baselineWidth, baselineColor, statInterval, minInclination, maxInclination); + } + else if ("roseObject" == strType) // 玫瑰图 + { + pInfo->m_pl_azimuthCurve = "STRDIR"; // 方位曲线 + pInfo->m_pl_inclinationCurve = "CALM"; // 倾角曲线 + if (pInfo->m_strUnit.isEmpty()) { + pInfo->m_strUnit = "(°)"; + pInfo->m_strUnitFont = QFont("微软雅黑", 8); + } - this->initRose(curv); + this->initRose(curv); - // 数据 - int dataType = pInfo->m_pl_dataType; // 数据类型 - QString azimuthCurve = pInfo->m_pl_azimuthCurve; // 方位曲线 - QString inclinationCurve = pInfo->m_pl_inclinationCurve; // 倾角曲线 - // 表数据字段 - QString m_rose_depth_field = pInfo->m_rose_depth_field; // 深度字段 - QString m_rose_azimuth_field = pInfo->m_rose_azimuth_field; // 方位字段 - QString m_rose_dip_field = pInfo->m_rose_dip_field; // 倾角字段 - QString m_rose_attribute_field = pInfo->m_rose_attribute_field; // 属性字段 - // 控制曲线 - QString csCurveGrad = pInfo->m_pl_controlCurveName; - double LeftVal3 = pInfo->m_pl_controlMinValue; - double RightVal3 = pInfo->m_pl_controlMaxValue; - // 字体 - QFont m_pl_fontScale = pInfo->m_pl_fontScale; // 刻度字体大小 - // 玫瑰图 - int m_rose_sector_enabled = pInfo->m_rose_sector_enabled; // 扇形(启用开关) - double m_rose_circle_radius_cm = pInfo->m_rose_circle_radius_cm; // 圆半径(cm) - m_rose_circle_radius_cm *= g_dPixelPerCm; - int m_rose_radiation_circle_enabled = pInfo->m_rose_radiation_circle_enabled; // 辐射圈(启用开关) - int m_rose_azimuth_print_interval = pInfo->m_rose_azimuth_print_interval; // 方位打印间隔 - QColor m_rose_circle_line_color = pInfo->m_rose_circle_line_color; // 圆线颜色 - int m_rose_circle_line_width = pInfo->m_rose_circle_line_width; // 圆线宽度 - QColor m_rose_stress_line_color = pInfo->m_rose_stress_line_color; // 应力线颜色 - QColor m_rose_collapse_line_color = pInfo->m_rose_collapse_line_color; // 垮塌线颜色 - bool m_rose_draw_radiation_line = pInfo->m_rose_draw_radiation_line; // 绘制辐射线? - bool m_rose_draw_wellbore_collapse = pInfo->m_rose_draw_wellbore_collapse; // 绘制井眼垮塌 - bool m_rose_fill_enabled = pInfo->m_rose_fill_enabled; // 是否填充 - bool m_rose_draw_annotation = pInfo->m_rose_draw_annotation; // 是否绘制标注? - // 统计间隔 - int m_pl_statInterval = pInfo->m_pl_statInterval; - double m_pl_minInclination = pInfo->m_pl_minInclination; - double m_pl_maxInclination = pInfo->m_pl_maxInclination; + // 数据 + int dataType = pInfo->m_pl_dataType; // 数据类型 + QString azimuthCurve = pInfo->m_pl_azimuthCurve; // 方位曲线 + QString inclinationCurve = pInfo->m_pl_inclinationCurve; // 倾角曲线 + // 表数据字段 + QString m_rose_depth_field = pInfo->m_rose_depth_field; // 深度字段 + QString m_rose_azimuth_field = pInfo->m_rose_azimuth_field; // 方位字段 + QString m_rose_dip_field = pInfo->m_rose_dip_field; // 倾角字段 + QString m_rose_attribute_field = pInfo->m_rose_attribute_field; // 属性字段 + // 控制曲线 + QString csCurveGrad = pInfo->m_pl_controlCurveName; + double LeftVal3 = pInfo->m_pl_controlMinValue; + double RightVal3 = pInfo->m_pl_controlMaxValue; + // 字体 + QFont m_pl_fontScale = pInfo->m_pl_fontScale; // 刻度字体大小 + // 玫瑰图 + int m_rose_sector_enabled = pInfo->m_rose_sector_enabled; // 扇形(启用开关) + double m_rose_circle_radius_cm = pInfo->m_rose_circle_radius_cm; // 圆半径(cm) + m_rose_circle_radius_cm *= g_dPixelPerCm; + int m_rose_radiation_circle_enabled = pInfo->m_rose_radiation_circle_enabled; // 辐射圈(启用开关) + int m_rose_azimuth_print_interval = pInfo->m_rose_azimuth_print_interval; // 方位打印间隔 + QColor m_rose_circle_line_color = pInfo->m_rose_circle_line_color; // 圆线颜色 + int m_rose_circle_line_width = pInfo->m_rose_circle_line_width; // 圆线宽度 + QColor m_rose_stress_line_color = pInfo->m_rose_stress_line_color; // 应力线颜色 + QColor m_rose_collapse_line_color = pInfo->m_rose_collapse_line_color; // 垮塌线颜色 + bool m_rose_draw_radiation_line = pInfo->m_rose_draw_radiation_line; // 绘制辐射线? + bool m_rose_draw_wellbore_collapse = pInfo->m_rose_draw_wellbore_collapse; // 绘制井眼垮塌 + bool m_rose_fill_enabled = pInfo->m_rose_fill_enabled; // 是否填充 + bool m_rose_draw_annotation = pInfo->m_rose_draw_annotation; // 是否绘制标注? + // 统计间隔 + int m_pl_statInterval = pInfo->m_pl_statInterval; + double m_pl_minInclination = pInfo->m_pl_minInclination; + double m_pl_maxInclination = pInfo->m_pl_maxInclination; - curv->drawRose(dataType, azimuthCurve, inclinationCurve, - m_rose_depth_field, m_rose_azimuth_field, m_rose_dip_field, m_rose_attribute_field, - csCurveGrad, LeftVal3, RightVal3, m_pl_fontScale, - m_rose_sector_enabled, m_rose_circle_radius_cm, m_rose_radiation_circle_enabled, m_rose_azimuth_print_interval, m_rose_circle_line_color, - m_rose_circle_line_width, m_rose_stress_line_color, m_rose_collapse_line_color, m_rose_draw_radiation_line, m_rose_draw_wellbore_collapse, - m_rose_fill_enabled, m_rose_draw_annotation, - m_pl_statInterval, m_pl_minInclination, m_pl_maxInclination); - } - else if("CrackObject" == strType) // 裂缝 - { -// qDebug() << "==================== number:" << pInfo; -// pInfo; -// curv; - } - else if("dcaObject" == strType) - { -// m_dca_azimuth_curve异常方位曲线 m_dca_amplitude_curve异常幅度曲线 m_dca_left_azimuth_curve方位曲线左刻度 m_dca_right_azimuth_curve方位曲线右刻度 m_dca_maximum_amplitude最大异常幅度 - initDCA(curv, pInfo->m_dca_azimuth_curve, pInfo->m_dca_amplitude_curve, pInfo->m_dca_left_azimuth_curve, pInfo->m_dca_right_azimuth_curve, pInfo->m_dca_maximum_amplitude); - } - else if("tdtObject" == strType) - { - initTDT(curv); + curv->drawRose(dataType, azimuthCurve, inclinationCurve, + m_rose_depth_field, m_rose_azimuth_field, m_rose_dip_field, m_rose_attribute_field, + csCurveGrad, LeftVal3, RightVal3, m_pl_fontScale, + m_rose_sector_enabled, m_rose_circle_radius_cm, m_rose_radiation_circle_enabled, m_rose_azimuth_print_interval, m_rose_circle_line_color, + m_rose_circle_line_width, m_rose_stress_line_color, m_rose_collapse_line_color, m_rose_draw_radiation_line, m_rose_draw_wellbore_collapse, + m_rose_fill_enabled, m_rose_draw_annotation, + m_pl_statInterval, m_pl_minInclination, m_pl_maxInclination); + } + else if ("CrackObject" == strType) // 裂缝 + { + // qDebug() << "==================== number:" << pInfo; + // pInfo; + // curv; + } + else if ("dcaObject" == strType) + { + // m_dca_azimuth_curve异常方位曲线 m_dca_amplitude_curve异常幅度曲线 m_dca_left_azimuth_curve方位曲线左刻度 m_dca_right_azimuth_curve方位曲线右刻度 m_dca_maximum_amplitude最大异常幅度 + initDCA(curv, pInfo->m_dca_azimuth_curve, pInfo->m_dca_amplitude_curve, pInfo->m_dca_left_azimuth_curve, pInfo->m_dca_right_azimuth_curve, pInfo->m_dca_maximum_amplitude); + } + else if ("tdtObject" == strType) + { + initTDT(curv); - if(m_iY1 == 0.0) - { - QTimer::singleShot(200, this, [=]() { - m_iY2 = -2000; - m_iY1 = -2030; - emit CallManage::getInstance()->sig_changeDepth(m_strUuid, m_strSlfName, m_strWellName, m_iY1, m_iY2); - }); - } + if (m_iY1 == 0.0) + { + QTimer::singleShot(200, this, [=]() { + m_iY2 = -2000; + m_iY1 = -2030; + emit CallManage::getInstance()->sig_changeDepth(m_strUuid, m_strSlfName, m_strWellName, m_iY1, m_iY2); + }); + } - } - else if (strType == "tableObject") - { - //新建表格曲线 - emit CallManage::getInstance()->sig_AddTableLine(m_strUuid, strSlfName, strWellName, m_strTrackName, strLineName); - } - curv->replot(); - - connect(curv, SIGNAL(mouseWheel(QWheelEvent*)), this, SLOT(s_mouseWheel(QWheelEvent*))); + } + else if (strType == "tableObject") + { + //新建表格曲线 + emit CallManage::getInstance()->sig_AddTableLine(m_strUuid, strSlfName, strWellName, m_strTrackName, strLineName); + } + curv->replot(); + connect(curv, SIGNAL(mouseWheel(QWheelEvent*)), this, SLOT(s_mouseWheel(QWheelEvent*))); + } QTimer::singleShot(100, this, [=]() { emit CallManage::getInstance()->sig_ReplotFinished(m_strUuid); }); @@ -3615,51 +3626,59 @@ void FormDraw::s_addWave(QString strUuid, QString strSlfName, QString strWellNam return; } - // - QMyCustomPlot *curv = new QMyCustomPlot(this, strSlfName, strWellName, strTrackName, strWaveName); - //绑定m_formTrack,方便关联formInfo - curv->m_formTrack = m_formTrack; - - curv->setDepthY(m_iY1, m_iY2); + int _nSamples = 0; double nW = m_nTrackW; if (nW <= 0) nW = g_iOneWidth; - curv->initGeometry(m_strUuid, m_iScale, nW); - curv->m_bX2Y = false; + bool bDraw = true; + if (bDraw) + { + FormWave *pwave = new FormWave(this, strSlfName, strWellName, strTrackName, strWaveName); + pwave->setDepthY(m_iY1, m_iY2); + pwave->initGeometry(m_strUuid, m_iScale, nW, m_nObjDrawH); + pwave->m_formTrack = m_formTrack; + pwave->show(); + //pwave->replot(); + _nSamples = 264; + } + else + { - curv->show(); + // + QMyCustomPlot *curv = new QMyCustomPlot(this, strSlfName, strWellName, strTrackName, strWaveName); + //绑定m_formTrack,方便关联formInfo + curv->m_formTrack = m_formTrack; - int _nSamples = 0; - if(g_iSupport3D) - { - initWave_3D(curv, strSlfName, strWaveName, _nSamples); - } - else - { - //此处追加,参照了下方setDrawData函数的处理 - //不然没有设置setRange初始范围,不支持新的右侧滚动条的setRange - curv->m_bX2Y = false; + curv->setDepthY(m_iY1, m_iY2); + curv->initGeometry(m_strUuid, m_iScale, nW); - curv->initWave(strSlfName, strWaveName); + curv->m_bX2Y = false; - // 圆柱渲染器 - // CylindricalImageMap* cylinderMap = new CylindricalImageMap(curv->xAxis, curv->yAxis); - // cylinderMap->setData(curv->m_colorMap->data()); - // cylinderMap->setCylinderRadius(2.0); - // cylinderMap->setSourceColorMap(curv->m_colorMap); // 共享梯度 - // cylinderMap->setAzimuth(45); - // cylinderMap->setElevation(30); - // // 隐藏原始的矩形色图 - // curv->m_colorMap->setVisible(false); - //cylinderMap->rescaleAxes(); + curv->show(); - _nSamples = curv->getScaleV(); - } - curv->replot(); - connect(curv, SIGNAL(mouseWheel(QWheelEvent*)), this, SLOT(s_mouseWheel(QWheelEvent*))); + + if (g_iSupport3D) + { + initWave_3D(curv, strSlfName, strWaveName, _nSamples); + } + else + { + //此处追加,参照了下方setDrawData函数的处理 + //不然没有设置setRange初始范围,不支持新的右侧滚动条的setRange + curv->m_bX2Y = false; - QTimer::singleShot(100, this, [=]() { + curv->initWave(strSlfName, strWaveName); + + + _nSamples = curv->getScaleV(); + } + curv->replot(); + connect(curv, SIGNAL(mouseWheel(QWheelEvent*)), this, SLOT(s_mouseWheel(QWheelEvent*))); + } + m_listLineName.push_back(strWaveName); + + QTimer::singleShot(100, this, [=]() { if (m_iY2 == 0.0) { // ####测试 @@ -3669,10 +3688,8 @@ void FormDraw::s_addWave(QString strUuid, QString strSlfName, QString strWellNam emit CallManage::getInstance()->sig_changeDepth(m_strUuid, m_strSlfName, m_strWellName, m_iY1, m_iY2); }); } - emit CallManage::getInstance()->sig_ReplotFinished(m_strUuid); - }); - // - m_listLineName.push_back(strWaveName); + emit CallManage::getInstance()->sig_ReplotFinished(m_strUuid); + }); QString strAliasName = ""; QString strUnit = "mv"; @@ -3816,6 +3833,15 @@ void FormDraw::setRowHeight(double dHight, QProgressBar *progressBar, int iSplit form->replot();//屏蔽,缩减时间 } } + else if (strObjName == "FormWave") + { + FormWave *formWave = qobject_cast(childWidget); + if (formWave) + { + formWave->updateDepthY(m_iY1, m_iY2); + } + } + } i++; } @@ -6077,7 +6103,7 @@ void FormDraw::initSwallCore(QMyCustomPlot *widget, QString strSlfName, QString widget->yAxis2->setVisible(false); // widget->LoadFromSLF_SwallCore(strSlfName, strLineName); - + if(listOtherProperty.size()>=3) { strAliasName = listOtherProperty[0]; @@ -6624,8 +6650,8 @@ void FormDraw::initDCA(QMyCustomPlot *widget, QString m_csCurveFd, QString m_csC if ( edepc > m_EDep ) edepc = m_EDep; if(edepcupdate(); + if (m_pWave) + { + m_pWave->update(); + } return bDraw; } diff --git a/logPlus/forminfo.h b/logPlus/forminfo.h index 72e0bf9..9cc0f60 100644 --- a/logPlus/forminfo.h +++ b/logPlus/forminfo.h @@ -16,6 +16,7 @@ namespace Ui { class FormInfo; } +class FormWave; class CDrawTvd; class FormInfo : public QWidget { @@ -173,6 +174,7 @@ public: int m_nJg; + int m_nCurveMode=0; // 曲线类型 int m_nDrawType; // 绘图类型 int m_nFillType; // 填充类型 @@ -180,14 +182,23 @@ public: bool m_bDrawBase = false; // 绘制波基线 bool m_bOddEven = false; // 奇偶配色 - QString m_strAmp; // 幅度刻度 + QString m_strAmp = "ABC"; // 幅度刻度 float m_fMaxAmp; // 最大振幅 bool m_bShowScale; // 显示刻度 float m_fWaveBase = 0.0f; // 波列基值 - int m_nWaveJg = 10; // 波形间隔 + int m_nWaveJg = 10; // 波形间隔 float m_fWaveHei = 1; // 波形高度 + int m_FirstRange = 4; // 起始波列 + int m_EndRange = 20; // 终止波列 + + int m_ArrayNum = 1; // 绘制阵列数 + QColor m_FillColor = Qt::black; // 波形填充颜色 + QColor m_WaveColor = Qt::black; // 波列曲线的颜色 + + float m_midValue = 0; // 归一化极值 + int m_nColorNum = 256; // 调色板参数设置-变密度颜色级数 int m_nSchemeIndex = 1; // 调色板参数设置-色板 @@ -240,6 +251,7 @@ public: //斜井三图一表(井斜数据表参数) CDrawTvd *m_pTvd; + FormWave* m_pWave = NULL; // 深度 QColor m_sdRulerColor; // 标尺颜色 diff --git a/logPlus/formwave.cpp b/logPlus/formwave.cpp new file mode 100644 index 0000000..02c1c60 --- /dev/null +++ b/logPlus/formwave.cpp @@ -0,0 +1,1447 @@ +#include "FormWave.h" +#include "ui_FormWave.h" +#include +#include "CallManage.h" +#include "forminfo.h" +#include "formtrack.h" +#include "geometryutils.h" +#include "qtColorSchemeComboBox.h" + +extern double g_dPixelPerCm;//每厘米像素数 + +FormWave::FormWave(QWidget *parent, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName) : + QWidget(parent), + ui(new Ui::FormWave) +{ + ui->setupUi(this); + + m_strSlfName = strSlfName; + m_strWellName = strWellName; + m_strTrackName = strTrackName; + m_strLineName = strLineName; + + QString path = GetConfPath() + "selfcolorrank.ini"; + FILE*fp = fopen(path.toStdString().c_str(), "rt"); + if (fp) + { + float val = 0; + while (!feof(fp)) + { + if (fscanf(fp, "%f\n", &val)) + { + selfcolorrank.append(val); + } + } + fclose(fp); + } + changeColor(schemIndex, colornum); + + LoadFromSLF_wave(); + + + m_parent = parent; + //斜井三图一表 +// connect(CallManage::getInstance(), SIGNAL(sig_ChangeTvdProperty(QString, QString, QString, QString, QString, QString, QString, QVariant)), +// this, SLOT(s_ChangeTvdProperty(QString, QString, QString, QString, QString, QString, QString, QVariant))); + //自定义滚动条 + //connect(CallManage::getInstance(), SIGNAL(sig_vertScrollBarChanged_santuyibiao(QString, double, double, double)), this, SLOT(vertScrollBarChanged(QString, double, double, double))); + //打印 + //connect(CallManage::getInstance(), SIGNAL(sig_vertScrollBarChanged_santu_Print(QString, int, int)), this, SLOT(vertScrollBarChanged_Print(QString, int, int))); + connect(CallManage::getInstance(), SIGNAL(sig_vertScrollBarChanged(QString, double, double, double)), this, SLOT(vertScrollBarChanged(QString, double, double, double))); + connect(CallManage::getInstance(), SIGNAL(sig_vertScrollBarChanged_setGeometry(QString, double, double, double, int)), this, SLOT(vertScrollBarChanged_setGeometry(QString, double, double, double, int))); + connect(CallManage::getInstance(), SIGNAL(sig_ResizeDepth(QString, int, float)), this, SLOT(s_ResizeDepth(QString, int, float))); +} + +FormWave::~FormWave() +{ + delete ui; +} + +void FormWave::initGeometry(QString strUuid, int nscale, double fW, int nH) +{ + if (strUuid.length() > 0) + this->m_strUuid = strUuid; + m_iScale = nscale; + +// double dHight = (m_iY2 - m_iY1)*100.0 / (double)nscale * g_dPixelPerCm; +// // if (g_iShow == 1) +// // { +// // //显示刻度 +// // dHight = dHight + 30; +// // } +// +// qDebug() << "FormWave dHight=" << QString::number((int)dHight); +// if (dHight > 32767) +// { +// dHight = 32767; +// } + + int ntmpw = fW * g_dPixelPerCm; + this->setGeometry(0, 0, ntmpw - 2, (int)nH); + + //修改滚动条,针对新建的 + emit CallManage::getInstance()->sig_changeScrollBar(m_strUuid); +} + +void FormWave::setDepthY(float fy1, float fy2) +{ + this->m_iY1 = fy1; + this->m_iY2 = fy2; + + m_PlotSdep = qAbs(this->m_iY2); + m_fTopY = m_PlotSdep; +} + +void FormWave::updateDepthY(float fy1, float fy2) +{ + this->m_iY1 = fy1; + this->m_iY2 = fy2; + m_fTopY = qAbs(this->m_iY2); + update(); +} + +bool FormWave::LoadFromSLF_wave() +{ + CLogIO * logio = new CLogIO(); + if (!logio->Open(m_strSlfName.toStdString().c_str(), CSlfIO::modeRead)) + { + delete logio; + m_vMD.SetSize(0); + m_vMD.m_vProperty = 0; + m_vProperty.SetSize(0); + m_vProperty.m_vProperty = NULL; + return false; + } + int curveindex = logio->OpenWave(m_strLineName.toStdString().c_str()); + if (curveindex < 0) + { + m_vMD.SetSize(0); + m_vMD.m_vProperty = 0; + m_vProperty.SetSize(0); + m_vProperty.m_vProperty = NULL; + delete logio; + return false; + } + //m_ObjectType = WAVE_OBJECT; + logio->GetWaveInfo(curveindex, &waveinfo); +// if (m_ArrayNum > 1) { +// if (waveinfo.RepCode == REPR_CHAR) waveinfo.RepCode = REPR_UCHAR; +// } +// acurveinfo.RepCode = waveinfo.RepCode; +// acurveinfo.CodeLen = waveinfo.CodeLen; +// acurveinfo.DepLevel = waveinfo.DepLevel; +// acurveinfo.StartDepth = waveinfo.StartDepth; +// acurveinfo.EndDepth = waveinfo.EndDepth; +// isRun = true; + + int samplenum = (waveinfo.EndDepth - waveinfo.StartDepth) / waveinfo.DepLevel + 1.5; + QString name = m_strSlfName + m_strLineName; +// if (m_ArrayNum > 1) { +// name += "Array"; +// } +// key = name; + int nbpp = waveinfo.SamplePoint; + int mlen = 0; + int myWidth = 0; + int chlen = 0; + int nPadZ = 0; + int myWidth1 = waveinfo.SamplePoint; + int shift0 = 0; +// if (m_ArrayNum > 1) { +// shift0 = pMsa->shift0; +// nPadZ = pMsa->nPadZ; +// myWidth = pMsa->Width; +// nbpp = pMsa->nSample; +// m_ArrayNum = pMsa->nPad; +// mlen = myWidth - m_ArrayNum * nbpp;//总盲区宽度 +// mlen /= m_ArrayNum; +// if (mlen % 2 != 0) mlen += 1; +// if (nPadZ < 4) chlen = mlen / 8; +// else chlen = mlen / 4; +// if (chlen % 2 != 0) chlen += 1; +// if (chlen == 0) chlen = 2; +// // mlen=mlen-chlen; +// mlen = m_ArrayNum * chlen / nPadZ; +// if (mlen % 2 != 0) mlen++; +// if (mlen > 20) mlen = 20; +// if (chlen < 4) chlen = 4; +// // chlen=(myWidth-(mlen*m_ArrayNum+nbpp*m_ArrayNum))/nPadZ; +// int klen = pMsa->nPadZ*waveinfo.SamplePoint + mlen + pMsa->nPadZ*chlen; +// myWidth1 = klen * pMsa->nPad / pMsa->nPadZ; +// } +// else + myWidth = waveinfo.SamplePoint; + int nlen = waveinfo.CodeLen*waveinfo.SamplePoint; + int reclen = waveinfo.CodeLen*myWidth*waveinfo.ArrayNum; + + m_SDep = waveinfo.StartDepth; + m_EDep = waveinfo.EndDepth; + m_Rlev = waveinfo.DepLevel; + m_nSamples = waveinfo.SamplePoint*waveinfo.ArrayNum; + m_PointNum = (float)(fabs((m_EDep - m_SDep) / m_Rlev + 0.5)); + + m_sharedMemory.setKey(name); + // 3. 创建或附加到共享内存 + if (m_sharedMemory.isAttached()) + { + m_sharedMemory.detach(); + } + + int nMemnum = 3 * sizeof(float) + sizeof(int) + reclen * (samplenum + 1); + + if (!m_sharedMemory.attach()) + { + // 尝试创建共享内存 + if (!m_sharedMemory.create(nMemnum)) + { + qDebug() << "Failed to create shared memory:" + << m_sharedMemory.errorString(); + return false; + } + + float *buffer = (float*)m_sharedMemory.data(); + buffer[0] = waveinfo.StartDepth; + buffer[1] = waveinfo.EndDepth; + buffer[2] = waveinfo.DepLevel; + ((int *)buffer)[3] = samplenum; + char *pchar = (char *)&buffer[4]; + //double laa = (double)reclen*(double)samplenum / waveinfo.CodeLen; + int num = reclen * samplenum / waveinfo.CodeLen; + float defval = -9999; + if (waveinfo.RepCode == REPR_CHAR || waveinfo.RepCode == REPR_UCHAR) defval = 0; + else if (waveinfo.RepCode == REPR_SHORT || waveinfo.RepCode == REPR_USHORT) defval = 0xffff; + + for (int i = 0; i < num; i++) + { + this->SetData(waveinfo.RepCode, &pchar[i*waveinfo.CodeLen], defval); + } + + logio->ReadWave(curveindex, waveinfo.StartDepth, samplenum, (void *)pchar); + } + + // 4. 锁定共享内存并写入数据 + if (!m_sharedMemory.lock()) + { + qDebug() << "Failed to lock shared memory"; + m_sharedMemory.detach(); + return false; + } + + m_vMD.SetSize(3); + m_vMD.m_vProperty = (float *)m_sharedMemory.data(); + int size = ((int *)m_sharedMemory.data())[3]; + m_vProperty.SetSize(size); + m_vProperty.m_vProperty = &m_vMD.m_vProperty[4]; + + if (m_vMD.size() > 0) { + m_TopDepth = m_vMD.m_vProperty[0]; + m_BottomDepth = m_vMD.m_vProperty[1]; + m_Rlev = m_vMD.m_vProperty[2]; + } + + float val = 0; + valMin.clear(); + valMax.clear(); + valMin.resize((waveinfo.SamplePoint)*waveinfo.ArrayNum); + valMax.resize((waveinfo.SamplePoint)*waveinfo.ArrayNum); + for (int j = 0; j < (waveinfo.SamplePoint)*waveinfo.ArrayNum; j++) { + valMin[j] = 999999999; + valMax[j] = -99999999; + } + char buf[200]; + for (int i = 0; i < samplenum; i++) { + for (int j = 0; j < waveinfo.SamplePoint*waveinfo.ArrayNum; j++) + { + val = GetData(i, j, buf); + if (val == 0 || val == -9999 || val == -999.25 || val == -99999 || val == -32767 || val == 32767) continue; + if (_isnan(val) || !_finite(val)) continue; + if (valMax[j] < val)valMax[j] = val; + if (valMin[j] > val)valMin[j] = val; + } + } + if (waveinfo.MaxValue == -50 || waveinfo.MinValue == 50 || fabs(waveinfo.MaxValue) < 1e-6 || waveinfo.MinValue < 1e-6 || waveinfo.MaxValue == -99999 || waveinfo.MaxValue == -9999 || waveinfo.MinValue == 999999 || waveinfo.MinValue == 999999 || waveinfo.MinValue == 99999 || waveinfo.MinValue == 99999 || waveinfo.MinValue == -9999) + { + float valmin = 99999; + float valmax = -99999; + for (int j = 0; j < waveinfo.SamplePoint*waveinfo.ArrayNum; j++) { + if (valmin > valMax[j]) valmin = valMax[j]; + if (valmin > valMin[j]) valmin = valMin[j]; + if (valmax < valMin[j]) valmin = valMin[j]; + if (valmax < valMax[j]) valmax = valMax[j]; + } + waveinfo.MaxValue = valmax; + waveinfo.MinValue = valmin; + //BWAVEINFO.MaxValue = valmax; + //BWAVEINFO.MinValue = valmin; + //logio->SetWaveInfo(curveindex, &BWAVEINFO); + } + m_sharedMemory.unlock(); + + logio->Clear(); + delete logio; + + return true; +} + +void FormWave::changeColor(int nidx, int ncolorNum) +{ + QList rgbList = QtColorTableData::getInstance()->GetRgb_UseTag(0, nidx, ncolorNum); + for (int i = 0; i < rgbList.size(); i++) + { + QColor acolor = rgbList.at(i); + m_Color[i] = acolor; + } +} + +void FormWave::paintEvent(QPaintEvent*) +{ + // + QPainter painter(this); + QRect rect = this->rect(); + // QRect rect = m_parent->rect(); + //背景透明 + painter.fillRect(rect.left(), rect.top(), rect.width(), rect.height(), QColor(0, 0, 0, 0)); //QColor(67, 67, 67, 100) + if (m_formTrack) + { + this->DrawWave(&painter, rect); + } + +} + +void FormWave::s_ResizeDepth(QString strUuid, int nHeight, float fDepthLowerY) +{ + if (m_strUuid != strUuid) + return; + + this->setFixedHeight(nHeight); + m_fDepthLowerY = qAbs(fDepthLowerY); + m_fAddY = m_fDepthLowerY - m_fTopY; +} + +void FormWave::s_ChangeTvdProperty(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, + QString strGroup, QString strProperty, QVariant variant) +{ + if(m_strUuid != strUuid || + m_strSlfName != strSlfName || + m_strWellName != strWellName || + m_strTrackName != strTrackName || + m_strLineName != strLineName) + { + return; + } + if("通常" == strGroup) + { + + } + if("绘制图形对象" == strGroup) + { + + } + if("边框线型" == strGroup) + { + if ("线宽" == strProperty) + ; + else if ("颜色" == strProperty) + ; + } + + update(); +} + +//自定义滚动条 +void FormWave::vertScrollBarChanged(QString strUuid, double value, double low, double upper) +{ + if(m_strUuid==strUuid) + { + } + else + { + return; + } + m_fTopY = value; + update(); +} + +//打印 +void FormWave::vertScrollBarChanged_Print(QString strUuid, int iNum, int iHeightOfScreen) +{ + if(m_strUuid==strUuid) + { + } + else + { + return; + } + //上移或下移 + QRect geoRect = geometry(); + // + double dDelta = iHeightOfScreen*(iNum-1); + setGeometry(0, -dDelta, geoRect.width(), geoRect.height()); +} + +void FormWave::vertScrollBarChanged_setGeometry(QString strUuid, double value, double low, double upper, int ndepth) +{ + if (m_strUuid == strUuid) + { + } + else + { + return; + } + m_fTopY = ndepth; + update(); +} + +void FormWave::wheelEvent(QWheelEvent *event) // 滚轮事件 +{ + emit CallManage::getInstance()->sig_mouseWheel(event); +} + +/*图像的转置函数*/ +QImage Transpose(QImage* image) +{ + QImage newImage(image->height(), image->width(), QImage::Format_ARGB32); + unsigned char* copyPixel = NULL; + unsigned char* objPixel = NULL; + unsigned int tempJ = 0; + for (int j = 0; j < image->height(); j++) + { + for (int i = 0; i < image->width(); i++) + { + copyPixel = image->bits() + j * image->width() * 4 + i * 4; + objPixel = newImage.bits() + i * image->height() * 4 + j * 4; + memcpy(objPixel, copyPixel, 4); + } + } + return newImage; +} +/*图像的转置函数*/ +QImage TTranspose(QImage* image) +{ + QImage newImage(image->width(), image->height(), QImage::Format_ARGB32); + unsigned char* copyPixel = NULL; + unsigned char* objPixel = NULL; + unsigned int tempJ = 0; + for (int j = 0; j < image->height(); j++) + { + memmove((void *)newImage.constScanLine(j), (void *)image->constScanLine(image->height() - 1 - j), image->bytesPerLine()); + } + return newImage; +} + +void FormWave::DrawWave(QPainter* pdc, QRectF mrt1) +{ + if (m_pInfo == NULL) + { + m_pInfo = m_formTrack->getFormInfoByParameters(m_strUuid, m_strWellName, m_strTrackName, m_strLineName); + } + if (m_pInfo == NULL) + return; + + if (!m_pInfo->m_pWave) + { + m_pInfo->m_pWave = this; + } + + if (m_pInfo->m_nSchemeIndex != schemIndex || m_pInfo->m_nColorNum != colornum) + { + schemIndex = m_pInfo->m_nSchemeIndex; + colornum = m_pInfo->m_nColorNum; + changeColor(schemIndex, colornum); + } + + if (m_vMD.m_vProperty) { + m_EDep = m_vMD.m_vProperty[1]; + m_SDep = m_vMD.m_vProperty[0]; + m_Rlev = m_vMD.m_vProperty[2]; + } + + float m_MaxRange = m_pInfo->m_fMaxAmp; + float m_Base = m_pInfo->m_fWaveBase; + if (fabs(m_MaxRange - /*mWaveMes.*/m_Base) < 1e-6) { + m_MaxRange = waveinfo.MaxValue; + //objViewInfo->m_maxRange = mWaveMes.m_MaxRange; + } + + float m_flRlev2 = waveinfo.TimeLevel; + QColor crColor = qRgb(0, 200, 200); + QPen cPen; + QBrush cBrush; + float sdep, edep, scale, flDepthScale, temp; + int i, j, k, iPoint = 0, nOffset = 0; + float y = 9999999.0; + //POINT *points; + flDepthScale = 1; + float te00 = 0; + + qDebug() << "FormWave : m_fTopY " << m_fTopY; + // 计算显示深度 + float sdepc = m_fTopY, edepc = m_fTopY + m_fAddY; + QRectF rt;// = mrt1; + //GetDepth(pdc, mrt1, rt, sdep, edep, sdepc, edepc); + int SamplePoint = 0; + if (sdep > m_EDep) sdep = m_EDep; + if (edep < m_SDep) edep = m_SDep; + if (sdep < m_SDep) sdep = m_SDep; + if (edep > m_EDep) edep = m_EDep; + if (edep < sdep) edep = sdep; + // 计算开始数据点及数据点数 + temp = (sdep - m_SDep) / m_Rlev; + iPoint = (float)(temp + 0.5); + int nPoint, lpoint, flag, nFillPoint, m, nStep; + int iStartPoint = 0; + float ch, nRep; + int flColorScale; + int m_ArrayNum = 0; + + QRectF mrt = mrt1; + float y0 = mrt1.top();//ConvertY0(sdepc); + float y1 = mrt1.bottom();//ConvertY0(edepc); + float ddep = (y1 - y0); + + rt = mrt; + QRectF rtd = mrt; + QRectF tt; + if (m_flRlev2 <= 0) m_flRlev2 = 0.1; + int Mode = m_pInfo->m_nCurveMode;// objViewInfo->GetLogarithmic(); + //objViewInfo->m_Rlev = waveinfo.DepLevel; + if (Mode == 2 || Mode == 5) { + if (m_pInfo->m_vmin < waveinfo.StartTime)m_pInfo->m_vmin = waveinfo.StartTime; + if (m_pInfo->m_vmax < waveinfo.StartTime)m_pInfo->m_vmax = waveinfo.StartTime; +// if (mWaveMes.m_Left < waveinfo.StartTime)mWaveMes.m_Left = waveinfo.StartTime; +// if (mWaveMes.m_Right < waveinfo.StartTime)mWaveMes.m_Right = waveinfo.StartTime; + temp = m_nSamples; + } + else if (Mode == 3) { + if (m_pInfo->m_ArrayNum > 1) { + m_ArrayNum = m_pInfo->m_ArrayNum; + SamplePoint = m_nSamples / m_ArrayNum; + } + else { + m_ArrayNum = sqrt((double)m_nSamples); + m_pInfo->m_ArrayNum = m_ArrayNum; + SamplePoint = m_ArrayNum; + } + temp = SamplePoint;//(mWaveMes.m_Right - mWaveMes.m_Left) / m_flRlev2; + } + else if (Mode == 6) { + if (m_pInfo->m_vmin < pow(2.f, waveinfo.StartTime))m_pInfo->m_vmin = pow(2.f, waveinfo.StartTime); + if (m_pInfo->m_vmax < pow(2.f, waveinfo.StartTime))m_pInfo->m_vmax = pow(2.f, waveinfo.StartTime); + temp = m_nSamples; + } + else { + temp = (m_pInfo->m_vmax - m_pInfo->m_vmin) / m_flRlev2; + } + if (temp < 0) + temp -= 0.5; + + nPoint = fabs(temp); + QPointF *cPoints = new QPointF[nPoint + 10]; + QPointF *points = new QPointF[nPoint + 10]; + cBrush = QBrush(); + cPen = QPen(); +// osg::Vec4f vco = objViewInfo->GetLineProperty().GetLineColor(); +// if (!m_pWellSceneManager->m_isColorPrint) { +// cPen.setColor(qRgb(0, 0, 0)); +// } + //else + cPen.setColor(m_pInfo->m_lineColor);// QColor::fromRgb(vco[0] * 255, vco[1] * 255, vco[2] * 255, vco[3] * 255)); + cPen.setWidth(m_pInfo->m_dWidth);// objViewInfo->GetLineProperty().GetLineWidth()); + cPen.setStyle(m_pInfo->m_lineStyle); +// osgLineStyle iLineStyle = objViewInfo->GetLineProperty().GetLineStyle(); +// TranslateOSGLineStyleToQtPenStyle(cPen, iLineStyle); + switch (m_pInfo->m_nDrawType) + { + case 1: + switch (m_pInfo->m_nFillType){//mWaveMes.Mode) { + case 1: + case 2: + cBrush = QBrush(m_pInfo->m_FillColor); + break; + } + break; + case 2: + case 6: + case 10: + case 13: + cBrush = QBrush(); + break; + } + j = 0; + + float d = 1; + + if (m_pInfo->m_nDrawType/*mWaveMes.WaveType*/ == 6) { + float w = rt.width(); + if (nPoint > 1) scale = w / (float)(nPoint - 1); + else scale = w; + } + else { + if (nPoint > 1) scale = ((float)rt.right() - (float)rt.left()) / (float)(nPoint - 1);//change by whp 11.13 from nPoint to nPoint-1因为波列画不到头 + else scale = ((float)rt.right() - (float)rt.left()); + } + lpoint = (/*mWaveMes.m_Left*/m_pInfo->m_vmin - waveinfo.StartTime) / m_flRlev2; + + float dpoint = (edepc - sdepc) / m_Rlev; + if (dpoint < 1) { + delete cPoints; + delete points; + return; + } + int v = qRound(dpoint / mrt.height() + 0.5); + if (v < 1) v = 1; + float MH = 0; + if (m_ArrayNum) { + //WellWindowViewInfo *m_pWellWindowViewInfo = dynamic_cast(m_pSceneManager->GetViewInfo(m_pSceneManager->GetVecWindow()->GetWindowID())); + float scale = m_iScale; + //if (m_pWellWindowViewInfo) { + // scale = m_pWellWindowViewInfo->GetYScale(); + //} + MH = 2; + if (scale == 1000) MH = 10; + else if (scale == 2000) MH = 20; + nStep = ((int)(MH / m_Rlev + 0.5)); + // if (objViewInfo) { + // if (objViewInfo->GetisDot()) nStep = mWaveMes.m_WaveSpace; + // } + } + else + nStep = m_pInfo->m_nWaveJg;// .m_WaveSpace; + if (nStep < 1) nStep = 1; + if (nStep < v) nStep = v; + float m_r = m_Rlev * nStep; + float dd = (ddep) / dpoint; + nRep = fabs(dd)*nStep; + if (nRep < 1) nRep = 1; + + pdc->setPen(cPen); + pdc->setBrush(cBrush); + // 绘制 + float Base0; + QRectF wrt; + int dep = 0; + float m_MoveDep = 0; + float m_MoveSdep = -9999; + float m_MoveEdep = -9999; +// if (m_pWellLog) +// { +// m_MoveDep = m_pWellLog->GetShiftOffset(); +// m_MoveSdep = m_pWellLog->GetShiftTopDepth(); +// m_MoveEdep = m_pWellLog->GetShiftBottomDepth(); +// if (m_MoveDep != 0 && m_MoveDep != -9999 && (m_MoveSdep == -9999.0 || m_MoveEdep == -9999.0)) { +// m_MoveSdep = m_SDep; +// m_MoveEdep = m_EDep; +// } +// } + ////////////深度方向比例因子 + float yscale = m_pInfo->m_fWaveHei;// mWaveMes.m_WaveHight; + //if (mWaveMes.WaveType == 0 || mWaveMes.WaveType == 1) + if (m_pInfo->m_nDrawType == 0 || m_pInfo->m_nDrawType == 1) + yscale *= g_dPixelPerCm;// m_pSceneManager->GetCoordinate()->GetPixelPerCm(); + float base = m_pInfo->m_fWaveBase; //mWaveMes.m_Base; + if (Mode == AXIS_LOGARITHMIC) { + if (base < 0) base = 0.1; + if (m_pInfo->m_nDrawType == 6 || m_pInfo->m_nDrawType == 2) { + float DifBase = (log10(/*mWaveMes.m_MaxRange*/m_MaxRange) - log10(base)) / m_pInfo->m_nColorNum; + if (fabs(DifBase) <= 1e-6) DifBase = 1; + yscale = yscale / DifBase; + } + } + else + { + float DifBase = 1; + if (m_pInfo->m_nDrawType == 2 || m_pInfo->m_nDrawType == 6 || m_pInfo->m_nDrawType == 10) { + DifBase = (m_MaxRange - m_Base) / m_pInfo->m_nColorNum; + } + else { + DifBase = (m_MaxRange - m_Base) / 1; + } + if (fabs(DifBase) <= 1e-6) DifBase = 1; + yscale = yscale / DifBase; + } + if (_isnan(m_MaxRange) || !_finite(m_MaxRange)) yscale = 1; + + int mOffset = m_MoveDep / m_Rlev; + float detp = sdepc; + int ppos = 0; + float vval = 0; + if (detp < m_PlotSdep) detp = m_PlotSdep; + detp = sdepc; + int tl = m_pInfo->m_vmin; + int atime = 0; +// if (m_vTimeMD.size()) { +// vTime.vchar = &((char *)m_vTimeProperty.m_vProperty)[0 * TimeCurveInfo.TimeSamples*TimeCurveInfo.CodeLen]; +// float vval = GetData(TimeCurveInfo.RepCode, (char *)&vTime.vchar[0 * TimeCurveInfo.CodeLen]); +// if (vval == -32767) vval = 0; +// for (int i = 1; i < TimeCurveInfo.TimeSamples; i++) { +// float vval1 = GetData(TimeCurveInfo.RepCode, (char *)&vTime.vchar[i*TimeCurveInfo.CodeLen]); +// if (vval == -32767) vval = 0; +// if (tl >= vval && tl < vval1) atime = vval; +// if (tl == vval1) atime = vval1; +// } +// } + //////////////////// 数据值方向 + int left = 0; + int right = 0; + if (Mode == AXIS_LINEAR || Mode == AXIS_LOGARITHMIC || Mode == 4) { + left = (tl - waveinfo.StartTime + atime) / m_flRlev2; + right = (m_pInfo->m_vmax - waveinfo.StartTime) / m_flRlev2; + } + else if (Mode == 2) { + left = 0; + right = m_nSamples; + } + else if (Mode == 3) { + left = 0; + if (m_pInfo->m_ArrayNum > 1) { + right = m_nSamples / m_ArrayNum; + } + else { + right = sqrt((double)m_nSamples); + } + } + else if (Mode == 5) { + if (waveinfo.StartTime <= 0) { + left = log10(m_pInfo->m_vmin / 1) / m_flRlev2 + 0.5; + right = log10(m_pInfo->m_vmax / 1) / m_flRlev2 + 1.5; + } + else { + left = log10(m_pInfo->m_vmin / waveinfo.StartTime) / m_flRlev2 + 0.5; + right = log10(m_pInfo->m_vmax / waveinfo.StartTime) / m_flRlev2 + 1.5; + } + } + else if (Mode == 6) { + left = log10(m_pInfo->m_vmin / waveinfo.StartTime) / m_flRlev2 + 0.5; + right = log10(m_pInfo->m_vmax / waveinfo.StartTime) / m_flRlev2 + 1.5; + } + if (right == left) right = left + 1; + if (m_pInfo->m_nDrawType == 10) { + if (left > m_pInfo->m_FirstRange) left = m_pInfo->m_FirstRange; + if (right < m_pInfo->m_EndRange) right = m_pInfo->m_EndRange; + } + if (m_pInfo->m_nDrawType == 0 || m_pInfo->m_nDrawType == 1) + { + if (abs(right - left) > 1) { + scale = rt.width() / (right - left - 1); + } + else scale = rt.width(); + } + else scale = rt.width() / (right - left); + int left1 = left; + int right1 = right; + if (left > right) { + left1 = right; + right1 = left; + } + if (left1 < 0) left1 = 0; + if (right1 > m_nSamples) right1 = m_nSamples; + + /////////////绘图缓冲区 + int w = right1 - left1; + float yy0 = mrt.top(); + float yy1 = mrt.bottom(); + float curEdep = edepc; + float curSdep = sdepc; + //if (pWellNode->m_curEdep - pWellNode->m_curSdep <= 0) return; + if (curEdep - curSdep <= 0) return; + d = (yy1 - yy0) / (curEdep - curSdep); + wrt.setTop((int)(yy0)); + wrt.setBottom((int)(yy1)); + + if (left > right) { + wrt.setLeft(rt.left() + (left1 - right)*scale); + wrt.setRight(rt.right() - (right1 - left)*scale); + } + else { + wrt.setLeft(rt.left() + (left1 - left)*scale); + wrt.setRight(rt.left() + (right1 - left)*scale); + } + float h = int(wrt.height() / nRep + 0.5); + QRectF srt(0, 0, w, h); + QImage aa(srt.width(), srt.height(), QImage::Format::Format_RGB32); + aa.fill(qRgba(255, 255, 255, 0)); + int mh = srt.bottom(); + float te01 = 0; + float *val = NULL; + int point = (m_EDep - m_SDep) / m_Rlev + 1.5; + if (m_pInfo->m_nDrawType == 10) { + val = new float[point + 1]; + CMemRdWt mrw; + QString wellname(m_strSlfName); + if (mrw.Open(wellname.toStdString().c_str())) // 打开井文件 + { + int index = mrw.OpenCurve("JIEGU"); + if (index > -1) { + mrw.ReadCurve(index, m_SDep, point, val); + } + else { + memset(val, 0, sizeof(float)*(point + 1)); + } + mrw.Clear(); + } + } + int basecolor = m_pInfo->m_nColorNum / 4.0; + QVector vals; + float vmin = waveinfo.MinValue; + float vmax = -waveinfo.MaxValue; + /////////////////////////////////////// + // QRegion qRgn; + // rt.setBottom(rt.top()+ConvertY( eCoord_GEO,edepc,eCoord_GEONormal )); + // 设置裁剪区域,预防画出边界 + // qRgn = pdc->clipRegion(); + // rt.adjust(0,0,0,1); + pdc->setClipRect(rt); + detp = int((detp - m_PlotSdep) / m_r)*m_r + m_PlotSdep; + /* + osg::Vec3d vecSheet; + m_pSceneManager->GetCoordinate()->ConvertCoordDouble(this->GetID(),eCoord_GEO,osg::Vec3d(0,detp,0) ,eCoord_GDIPixel,vecSheet ); + if(m_pWellSceneManager->IsWellSectonHorizonLayout()) yy0=vecSheet[0]; + else yy0=vecSheet[1]; + */ + // yy0=yy0-(pWellNode->m_curSdep-(detp-10*m_r))*d; + pdc->setPen(m_pInfo->m_WaveColor); + int odd = 0; + int ifist = -lpoint, eend = nPoint; + if (ifist < 0) ifist = 0; + if (eend > m_nSamples - lpoint) eend = m_nSamples - lpoint; +// if (objViewInfo->GetisDrawBase()) { +// ifist = 0, eend = nPoint; +// } + int m_Logarithmic = 0; + + int iIndex; + for (float dep1 = detp - 10 * m_r; dep1 < edepc + m_MoveDep + 10 * m_r; dep1 += m_r) + { + odd++; + dep = Slf_Int(dep1, curSdep, m_Rlev); + if (dep1 > m_MoveSdep&&dep1 < m_MoveEdep) { + dep -= mOffset; + if (dep < 0) dep = 0; + if (dep*m_Rlev + m_SDep > m_EDep) dep = (m_EDep - m_SDep) / m_Rlev; + } + if (dep1 >= m_EDep || dep1 + m_r < m_SDep) + { + continue; + } + iIndex = Slf_Int(dep1 + m_MoveDep, m_SDep, m_Rlev); + if (iIndex < 0) { + continue; + } + if (iIndex >= 0 && iIndex < m_PointNum&&iIndex < m_vProperty.size()) + { + short nv = -9999.0f; + vVdl.vchar = &((char *)m_vProperty.m_vProperty)[iIndex*m_nSamples*waveinfo.CodeLen]; +// if (m_vTimeProperty.size()) { +// vTime.vchar = &((char *)m_vTimeProperty.m_vProperty)[iIndex*TimeCurveInfo.TimeSamples*TimeCurveInfo.CodeLen]; +// } +// if (m_vGainProperty.size()) { +// vGain.vchar = &((char *)m_vGainProperty.m_vProperty)[iIndex*GainCurveInfo.TimeSamples*GainCurveInfo.CodeLen]; +// } + } + else { + continue; + } + y = yy0 + dep * dd; + te00 = (int)((y - yy0) / nRep + 0.5); + if (te00 >= mh) { + te00 = mh - 1; + } + if (te01 == 0) te01 = te00; + flag = 1; + int Num = 0; + Base0 = y; + + int i0 = 0; + int pos = 0; + int jpos = 0; + int isVert = 0;// objViewInfo->GetIsVertDraw(); + switch (m_pInfo->m_nDrawType) + { + case 6: // 变密度 + case 2: // 变密度 + case 10: // 电磁探伤 + case 13: // 电磁探伤 + switch (m_pInfo->m_nFillType) + { + case 0: + flag = 0; + break; + case 1: + flag = 1; + break; + case 2: + flag = -1; + } + + if (!m_ArrayNum) { + QRgb rgb = 0; + for (int i = left1; i < right1; i += 1) + { + if (i < 0) continue; + pos = i - left1; + if (left > right || m_pInfo->m_nDrawType == 6) { + pos = aa.width() - pos - 1; + } + if (pos >= aa.width() || pos < 0) continue; + if (waveinfo.RepCode == REPR_CHAR) { + ch = vVdl.vchar[i]; + } + else if (waveinfo.RepCode == REPR_UCHAR) { + ch = vVdl.vuchar[i]; + } + else if (waveinfo.RepCode == REPR_SHORT) { + ch = vVdl.vshort[i]; + if (ch == -32767) { +// if (objViewInfo->Getskipinval()) aa.setPixel(pos, j, qRgba(0, 0, 0, 0)); +// else aa.setPixel(pos, j, qRgb(255, 255, 255)); + continue; + } + } + else if (waveinfo.RepCode == REPR_USHORT) { + ch = vVdl.vushort[i]; + if ((short)ch == -32767) { +// if (objViewInfo->Getskipinval()) aa.setPixel(pos, j, qRgba(0, 0, 0, 0)); +// else aa.setPixel(pos, j, qRgb(255, 255, 255)); + continue; + } + } + else if (waveinfo.RepCode == REPR_FLOAT) { + ch = vVdl.vfloat[i]; + if (ch == -9999.0) { +// if (objViewInfo->Getskipinval()) aa.setPixel(pos, j, qRgba(0, 0, 0, 0)); +// else aa.setPixel(pos, j, qRgb(255, 255, 255)); + continue; + } + } + else ch = GetData(waveinfo.RepCode, (char *)&vVdl.vchar[i*waveinfo.CodeLen]); + if (/*objViewInfo->GetisRGBA() || */m_pInfo->m_nDrawType == 13) { + if (waveinfo.RepCode == REPR_UINT) { + rgb = vVdl.vulong[i]; + } + else rgb = ch; + } + else { +// if (m_vGainProperty.size()) { +// ppos = i / WaveInfo.TimeSamples; +// if (ppos < 0) ppos = 0; +// if (ppos >= GainCurveInfo.TimeSamples) ppos >= GainCurveInfo.TimeSamples - 1; +// vval = GetData(GainCurveInfo.RepCode, (char *)&vGain.vchar[ppos*GainCurveInfo.CodeLen]); +// if (vval == -32767) vval = 0; +// if (vval > 0 && vval < 1000) ch = 10 * ch / powf(1.4142, vval); +// } + if (flag == 0) ch = fabs(ch); + else ch = ch * flag; + if (m_Logarithmic == AXIS_LOGARITHMIC) { + ch = (ch - /*pWave->*/valMin[i]) / (/*pWave->*/valMax[i] - /*pWave->*/valMin[i]) * 100000; + if (ch <= 0) ch = 0; + else ch = log10(ch) - log10(base); + m = (int)(ch*m_pInfo->m_nColorNum / log10(100000.0) + 0.5); + } + else if (m_Logarithmic == 4) + { + ch = ch - m_pInfo->m_bDrawBase; + if (ch < 0) ch = 0; + m = selfcolorrank.size(); + for (int j = 1; j < selfcolorrank.size(); j++) + { + float v0 = selfcolorrank[j - 1]; + float v1 = selfcolorrank[j]; + if (ch >= v0 && ch < v1) + { + m = j - 1; + break; + } + } + } + else + { + if (m_pInfo->m_nDrawType == 10) { + //平滑接箍 + if ((m_pInfo->m_vmax - waveinfo.StartTime) / waveinfo.TimeLevel > i&&i >= (m_pInfo->m_vmin - waveinfo.StartTime) / waveinfo.TimeLevel) { + if (iIndex >= 6 && iIndex + 6 < point) { + if (val && (val[iIndex - 4] || val[iIndex - 3] || val[iIndex - 2] || val[iIndex - 1] || val[iIndex] || val[iIndex + 1] || val[iIndex + 2] || val[iIndex + 3] || val[iIndex + 4])) { + char *p = (char *)m_vProperty.m_vProperty; + int j0 = iIndex - 1; + if (val[iIndex - 4]) j0 = iIndex - 4; + else if (val[iIndex - 3]) j0 = iIndex - 3; + else if (val[iIndex - 2]) j0 = iIndex - 2; + else if (val[iIndex - 1]) j0 = iIndex - 1; + else if (val[iIndex]) j0 = iIndex; + else if (val[iIndex + 1]) j0 = iIndex + 1; + else if (val[iIndex + 2]) j0 = iIndex + 2; + else if (val[iIndex + 3]) j0 = iIndex + 3; + else if (val[iIndex + 4]) j0 = iIndex + 4; + int j2 = j0; + for (j2 = j0; j2 > 0; j2--) { + if (val[j2] < 1) break; + } + int j1 = j0; + for (j1 = j0; j1 < point; j1++) { + if (val[j1] < 1) break; + } + int n = 0; + if (j2 - 4 >= 0) { + ch = GetData(waveinfo.RepCode, &p[(j2 - 4)* waveinfo.SamplePoint*waveinfo.ArrayNum*waveinfo.CodeLen + i * waveinfo.CodeLen]); + n++; + } + if (j1 + 4 < point) { + ch += GetData(waveinfo.RepCode, &p[(j1 + 4)* waveinfo.SamplePoint*waveinfo.ArrayNum*waveinfo.CodeLen + i * waveinfo.CodeLen]); + n++; + } + if (n) ch /= n; + } + } + } + if (valMax[i] - valMin[i] == 0) m = 2 * basecolor; + else { + ch = (ch - valMin[i]) / (valMax[i] - valMin[i])*(m_pInfo->m_nColorNum - 2 * basecolor); + m = ch * m_pInfo->m_fWaveHei + basecolor; + } + } + else if (m_pInfo->m_midValue) { + ch = (ch - valMin[i]) / (valMax[i] - valMin[i])*m_pInfo->m_midValue; + m = (int)((ch - m_pInfo->m_fWaveBase)*yscale + 0.5); + } + else m = (int)((ch - m_pInfo->m_fWaveBase)*yscale + 0.5); + } + if (m >= m_pInfo->m_nColorNum) m = m_pInfo->m_nColorNum - 1; + else if (m < 0) m = 0; + rgb = m_Color[m].rgb(); + } + if (te01 + 1 > te00) { + if (te00 >= 0) { + aa.setPixel(pos, te00, rgb); + } + } + else for (int j = te01 + 1; j <= te00; j++) { + if (j >= 0) { + aa.setPixel(pos, j, rgb); + } + } + } + } + else { + QImage aaa = QImage(right1 - left1, m_ArrayNum, QImage::Format::Format_RGB32); + float cc = 0; + int nu0 = 0; + bool ffg = 0; + float m_LeftVal = 0; + float m_RightVal = 0; + for (int j = 0; j < m_ArrayNum; j++) + { + for (int i = left1; i < right1; i += 1) + { + if (i < 0) continue; + pos = i - left1; + if (m_RightVal < m_LeftVal || m_pInfo->m_nDrawType == 6) + { + pos = aaa.width() - pos - 1; + } + if (pos >= aaa.width() || pos < 0) continue; + if (waveinfo.RepCode == REPR_CHAR) { + ch = vVdl.vchar[j*SamplePoint + i]; + } + else if (waveinfo.RepCode == REPR_UCHAR) { + ch = vVdl.vuchar[j*SamplePoint + i]; + } + else if (waveinfo.RepCode == REPR_SHORT) { + ch = vVdl.vshort[j*SamplePoint + i]; + } + else if (waveinfo.RepCode == REPR_USHORT) { + ch = vVdl.vushort[j*SamplePoint + i]; + } + else if (waveinfo.RepCode == REPR_FLOAT) { + ch = vVdl.vfloat[j*SamplePoint + i]; + } + else ch = GetData(waveinfo.RepCode, (char *)&vVdl.vchar[(j*SamplePoint + i)*waveinfo.CodeLen]); + m = (int)((ch - m_pInfo->m_fWaveBase)*yscale + 0.5); + if (m >= m_pInfo->m_nColorNum) m = m_pInfo->m_nColorNum - 1; + else if (m < 0) m = 0; + jpos = isVert ? m_ArrayNum - j - 1 : j; + if (jpos < aaa.height()) { + if (m_RightVal < m_LeftVal) pos = aaa.width() - pos - 1; + aaa.setPixel(pos, jpos, m_Color[m].rgb()); + } + if (!nu0)cc = ch; + else if (!ffg&&cc != ch) ffg = true; + nu0++; + } + } + bool m_isDot = false; + if (!ffg&&/*objViewInfo->GetisDot()*/m_isDot) continue; + float v11 = MH; + if (dep1 + MH > edepc) { + v11 = dep1 + MH - edepc; + v11 = MH - v11; + } + QRectF wrt1(wrt.left(), y, wrt.width(), v11 / m_Rlev * dd); + int line = 0; + bool m_IsExchange = false; //objViewInfo->m_IsExchange + if (m_IsExchange) { + aaa = Transpose(&aaa); + aaa = TTranspose(&aaa); + int w = aaa.width(); + int h1 = aaa.height(); + for (int i = 0; i < w; i++) aaa.setPixel(i, h1 - 1, qRgb(255, 255, 255)); + line = m_ArrayNum / m_r * v11; + if (line > h1) line = h1; + int line0 = 0; + // if(xban) { + // line0=xban*m_ArrayNum/m_r; + // dep1=vpos; + // } + pdc->drawImage(wrt1, aaa, QRectF(0, line0, w, line - line0)); + } + else { + int w = aaa.width(); + int h1 = aaa.height(); + for (int i = 0; i < w; i++) aaa.setPixel(i, h1 - 1, qRgb(255, 255, 255)); + int line0 = 0; + if (dep1 < sdepc) { + //line0=(sdepc-dep1)*m_ArrayNum/m_r; + h1 = (m_r - (sdepc - dep1)) / m_Rlev * dd; + } + line = m_ArrayNum / m_r * v11; + if (line > m_ArrayNum) line = m_ArrayNum; + + pdc->drawImage(wrt1, aaa, QRectF(0, line0, right1 - left1, line - line0)); + } + } + break; + case 0:// wf + case 1://填充 + { + vals.resize(nPoint); + if (/*objViewInfo->m_Logarithmic==AXIS_LOGARITHMIC||*/ + m_pInfo->m_fMaxAmp == -99999) { + vmin = waveinfo.MinValue; + vmax = waveinfo.MaxValue; + } + for (int i = 0; i < nPoint; i++) + { + if (i + lpoint < 0) ch = 0; + else if (i + lpoint < m_nSamples) { + if (waveinfo.RepCode == REPR_CHAR) { + ch = vVdl.vchar[i + lpoint]; + } + else if (waveinfo.RepCode == REPR_UCHAR) { + ch = vVdl.vuchar[i + lpoint]; + } + else if (waveinfo.RepCode == REPR_SHORT) { + ch = vVdl.vshort[i + lpoint]; + if (ch == -32767) ch = 0; + } + else if (waveinfo.RepCode == REPR_USHORT) { + ch = vVdl.vushort[i + lpoint]; + if ((short)ch == -32767) ch = 0; + } + else if (waveinfo.RepCode == REPR_FLOAT) { + ch = vVdl.vfloat[i + lpoint]; + } + else ch = GetData(waveinfo.RepCode, (char *)&vVdl.vchar[(i + lpoint)*waveinfo.CodeLen]); + if (ch == -9999.0 || ch == -99999.0 || ch == -999.25) ch = 0; + } + else ch = 0; + vals[i] = ch; + if (m_Logarithmic == AXIS_LOGARITHMIC || + m_pInfo->m_fMaxAmp == -99999) { + if (vmin > ch) vmin = ch; + if (vmax < ch) vmax = ch; + } + } + int ffl = 0; + float cc = 0; + for (int i = ifist; i < eend; i++) { + if (left <= right) temp = rt.left() + (i)*scale; + else temp = rt.right() - (i)*scale; + points[i].setX(temp); + if (m_Logarithmic == AXIS_LOGARITHMIC) { + ch = (vals[i] - vmin) / (vmax - vmin)*vmax; + if (ch <= 0) ch = 1; + ch = log10(ch);//-log10(mWaveMes.m_Base); + points[i].setY((log10(vmax) - ch)*yscale + y); + } + else + { + if (m_pInfo->m_fMaxAmp == -99999) + ch = (vals[i] - vmin) / (vmax - vmin)*vmax; + else ch = (vals[i] - m_pInfo->m_fWaveBase); + points[i].setY(-ch * yscale + y); + } + if (points[i].y() < yy0) points[i].setY(yy0); + if (points[i].y() > yy1) points[i].setY(yy1); + if (!i) cc = ch; + else if (!ffl&&cc != ch) ffl = 1; + } + if (!ffl) continue; + if (m_pInfo->m_nDrawType == 0) { + bool isOddColor = false; //objViewInfo->GetisOddColor() + bool isDrawBase0 = false; //objViewInfo->GetisDrawBase0() + bool isDrawDepth = false; //objViewInfo->GetisDrawDepth() + if (isOddColor) { + if (odd % 2) + pdc->setPen(m_pInfo->m_WaveColor); + else pdc->setPen(QColor(255, 0, 0)); + } + pdc->drawPolyline(&points[ifist], eend - ifist); + if (isDrawBase0) { + pdc->drawLine(QPointF(mrt.x(), y), QPointF(mrt.right(), y)); + } + if (isDrawDepth) + { + pdc->drawText(mrt.x(), y, QString::number(dep1)); + } + continue; + } + switch (m_pInfo->m_nFillType) { + case 2: // fill down :波列,下部填充 + flag = -1; + case 1: // fill up :波列,上部填充 + { + nFillPoint = 0; + iStartPoint = 0; + for (i = ifist; i < eend; i++) { + if ((flag == 1 && points[i].y() < y) || (flag == -1 && points[i].y() > Base0)) + { + if (nFillPoint == 0) { + iStartPoint = i; + int i0 = 0; + if (i&&flag == 1 && points[i - 1].y() >= Base0) { + float x = points[i - 1].x() + (points[i].x() - points[i - 1].x()) / (points[i].y() - points[i - 1].y())*(y - points[i - 1].y()); + cPoints[0].setX(x); + i0 = 1; + } + if (i&&flag == -1 && points[i - 1].y() <= Base0) { + float x = points[i - 1].x() + (points[i].x() - points[i - 1].x()) / (points[i].y() - points[i - 1].y())*(y - points[i - 1].y()); + cPoints[0].setX(x); + i0 = 1; + } + if (!i0) { + cPoints[0].setX(points[i].x()); + } + cPoints[0].setY(Base0); + } + nFillPoint++; + } + else + { + if (nFillPoint)///两端已被封闭 + { + if (nFillPoint == 1) cPoints[1] = points[iStartPoint]; + else for (m = 1; m < nFillPoint; m++) + { + cPoints[m] = points[m + iStartPoint - 1]; + } + int i0 = 0; + if (i&&flag == 1 && points[i - 1].y() <= Base0) { + cPoints[nFillPoint] = points[i - 1]; + nFillPoint++; + float x = points[i - 1].x() + (points[i].x() - points[i - 1].x()) / (points[i].y() - points[i - 1].y())*(y - points[i - 1].y()); + cPoints[nFillPoint].setX(x); + i0 = 1; + } + if (i&&flag == -1 && points[i - 1].y() >= Base0) { + cPoints[nFillPoint] = points[i - 1]; + nFillPoint++; + float x = points[i - 1].x() + (points[i].x() - points[i - 1].x()) / (points[i].y() - points[i - 1].y())*(y - points[i - 1].y()); + cPoints[nFillPoint].setX(x); + i0 = 1; + } + if (!i0) { + cPoints[nFillPoint].setX(points[nPoint - 1].x()); + } + cPoints[nFillPoint].setY(Base0); + cPoints[nFillPoint + 1] = cPoints[0]; + QPolygonF cRgn; + for (int j = 0; j < nFillPoint + 2; j++) { + cRgn.push_back(cPoints[j]); + } + QPainterPath path; + path.addPolygon(cRgn); + //paths.append(path); + pdc->fillPath(path, cBrush); + nFillPoint = 0; + } + } + } + //////////////////// + //数据已结束,但尾没被封住 + if (nFillPoint > 1) { + for (m = 1; m < nFillPoint; m++) + { + cPoints[m] = points[m + iStartPoint]; + } + cPoints[nFillPoint].setY(Base0); + cPoints[nFillPoint].setX(cPoints[nFillPoint - 1].x()); + cPoints[nFillPoint + 1] = cPoints[0]; + QPolygonF cRgn; + for (int j = 0; j < nFillPoint + 2; j++) { + cRgn.push_back(cPoints[j]); + } + QPainterPath path; + path.addPolygon(cRgn); + pdc->fillPath(path, cBrush); + } + pdc->drawPolyline(&points[ifist], eend - ifist);//nPoint); + bool isDrawBase0 = false; //objViewInfo->GetisDrawBase0() + if (isDrawBase0) { + pdc->drawLine(QPointF(mrt.x(), y), QPointF(mrt.right(), y)); + } + bool isDrawDepth = false; //objViewInfo->GetisDrawDepth() + if (isDrawDepth) + { + pdc->drawText(mrt.x(), y, QString::number(dep1)); + } + } + break; + } + } + break; + } + te01 = te00; + } + + if (Mode == 3) { + delete[]cPoints; + delete[]points; + //m_Value = 0; + // pdc->setClipRegion(qRgn); + return; + } + + if (m_pInfo->m_nDrawType == 2 || + m_pInfo->m_nDrawType == 6 || + m_pInfo->m_nDrawType == 10 || + m_pInfo->m_nDrawType == 13 + ) { + pdc->setRenderHint(QPainter::SmoothPixmapTransform, true/*m_AutoSmooth*/); + if (m_pInfo->m_nDrawType == 10) { + QRectF srt1 = wrt, srt2 = wrt, + srt12(0.0f, srt.y(), m_pInfo->m_EndRange - m_pInfo->m_FirstRange, srt.height()), + srt22((m_pInfo->m_vmin - waveinfo.StartTime) / waveinfo.TimeLevel - left1, srt.y(), (m_pInfo->m_vmax - m_pInfo->m_vmin) / waveinfo.TimeLevel, srt.height()); + srt1.setWidth(wrt.width() / 2.0); + srt2.setLeft(srt1.right()); + pdc->drawImage(srt1, aa, srt12); + pdc->drawImage(srt2, aa, srt22); + } + else { + int w = aa.width(); + int h = aa.height(); + pdc->drawImage(wrt, aa, srt); + } + } + + delete[]cPoints; + delete[]points; + +} + +double FormWave::GetData(int i, int j, char *buffer) +{ + float yy = -9999; + if (m_vProperty.size() > i) { + int pos = (int)(i*waveinfo.TimeSamples + j); + yy = GetData(waveinfo.RepCode, (char *)&((char *)m_vProperty.m_vProperty)[pos*waveinfo.CodeLen], waveinfo.CodeLen); + } + return yy; +} +double FormWave::GetData(int repCode, char *buffer, int repLen) +{ + double yy = -99999; + if (!buffer) + { + return 0; + } + switch (repCode) + { + case REPR_INT: //0 + yy = (double)(*((int*)buffer)); + break; + case REPR_SHORT: //1 + yy = (double)(*((short *)buffer)); + break; + case REPR_LONG://2 + yy = (double)(*((long *)buffer)); + break; + case REPR_FLOAT://3 + yy = (double)(*((float *)buffer)); + break; + case REPR_DOUBLE://4 + yy = (double)(*((double *)buffer)); + break; + case REPR_CHAR://5 + yy = (double)(*((char *)buffer)); + break; + case REPR_UCHAR://6 + yy = (double)(*((unsigned char *)buffer)); + break; + case REPR_USHORT://7 + yy = (double)(*((unsigned short *)buffer)); + break; + case REPR_UINT://8 + yy = (double)(*((unsigned int *)buffer)); + break; + case REPR_ULONG://9 + yy = (double)(*((unsigned long *)buffer)); + break; + case REPR_STRING://10 + if (repLen >= 200) + repLen = 199; + if (repLen > 0) + { + memmove(m_strValue, buffer, repLen); + m_strValue[repLen] = 0; + } + else + { + m_strValue[0] = 0; + yy = -99999; + } + break; + } + return yy; +} +void FormWave::SetData(int repCode, char *buffer, double yy) +{ + if (!buffer) + { + return; + } + switch (repCode) + { + case REPR_INT: //0 + (*((int*)buffer)) = (int)yy; + break; + case REPR_SHORT: //1 + (*((short *)buffer)) = (short)yy; + break; + case REPR_LONG://2 + (*((long *)buffer)) = (long)yy; + break; + case REPR_FLOAT://3 + (*((float *)buffer)) = yy; + break; + case REPR_DOUBLE://4 + (*((double *)buffer)) = (double)yy; + break; + case REPR_CHAR://5 + (*((char *)buffer)) = (char)yy; + break; + case REPR_UCHAR://6 + (*((unsigned char *)buffer)) = (unsigned char)yy; + break; + case REPR_USHORT://7 + (*((unsigned short *)buffer)) = (unsigned short)yy; + break; + case REPR_UINT://8 + (*((unsigned int *)buffer)) = (unsigned int)yy; + break; + case REPR_ULONG://9 + (*((unsigned long *)buffer)) = (unsigned long)yy; + break; + case REPR_STRING://10 + // *yy=-99999; + break; + } + return; +} diff --git a/logPlus/formwave.h b/logPlus/formwave.h new file mode 100644 index 0000000..cbc368c --- /dev/null +++ b/logPlus/formwave.h @@ -0,0 +1,114 @@ +#ifndef FormWave_H +#define FormWave_H + +#include +#include +#include + +#include "BaseFun.h" +#include "MemRdWt.h" + +#pragma execution_character_set("utf-8") + +namespace Ui { +class FormWave; +} + +class FormTrack; +class FormInfo; +class FormWave : public QWidget +{ + Q_OBJECT + +public: + explicit FormWave(QWidget *parent = nullptr, QString strSlfName="", QString strWellName="", QString strTrackName="", QString strLineName=""); + ~FormWave(); + + void initGeometry(QString strUuid, int nscale, double fW, int nH); + + void setDepthY(float fy1, float fy2); + //改变深度更新绘图 + void updateDepthY(float fy1, float fy2); + + bool LoadFromSLF_wave(); + bool SaveToSLF_LogMud(); + + void changeColor(int nidx, int ncolorNum); +private: + Ui::FormWave *ui; + +protected: + void paintEvent(QPaintEvent *event); + virtual void wheelEvent(QWheelEvent *event); + + void DrawWave(QPainter* pdc, QRectF mrt); + + double GetData(int i, int j, char *buffer); + double GetData(int repCode, char *buffer, int repLen = 0); + void SetData(int repCode, char *buffer, double yy); + + bool IsFiniteNumber(float v) + { + return qIsFinite(v) != 0; + } + +public: + QString m_strUuid; + QString m_strSlfName; + QString m_strWellName; + QString m_strTrackName; + QString m_strLineName; + + QWidget *m_parent; + + FormTrack *m_formTrack = NULL; + FormInfo* m_pInfo = NULL; + + float m_iY1, m_iY2; + int m_iScale = 200; + double m_wellTop = 0.0; + double m_dTopDepth = 0.0; + + QSharedMemory m_sharedMemory; + + PFLOATPROPERTY m_vMD; + PFLOATPROPERTY m_vProperty; + MyDataTypeEnum vVdl; + + Slf_WAVE waveinfo; + float m_SDep, m_EDep, m_Rlev; + float m_PlotSdep = 0.0f; + int m_nSamples; //每深度间隔的数据点 + int m_PointNum; + QVector valMin, valMax; + double m_TopDepth; + double m_BottomDepth; + + QVector selfcolorrank; + QColor m_Color[256]; //定义颜色数组 + char m_strValue[200]; + int CtrlCurve = 0; + int PickFlag = 0; + float m_fTopY = 0.0f; + float m_fDepthLowerY = 0.0f; + float m_fAddY = 29.0f; + + int schemIndex = 1; + int colornum = 256; +public: + //void DrawWave(QPainter* pdc, QRectF mrt1); + +public slots: + void s_ResizeDepth(QString strUuid, int nHeight, float fDepthLowerY); + + //斜井三图一表 + void s_ChangeTvdProperty(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, + QString strGroup, QString strProperty, QVariant variant); + + //滚动条 + void vertScrollBarChanged(QString strUuid, double value, double low, double upper); + void vertScrollBarChanged_Print(QString strUuid, int iNum, int iHeightOfScreen); + void vertScrollBarChanged_setGeometry(QString strUuid, double value, double low, double upper, int ndepth); +}; + +#endif // FormWave_H diff --git a/logPlus/formwave.ui b/logPlus/formwave.ui new file mode 100644 index 0000000..50acc13 --- /dev/null +++ b/logPlus/formwave.ui @@ -0,0 +1,33 @@ + + + FormWave + + + + 0 + 0 + 400 + 300 + + + + Form + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + diff --git a/logPlus/formwell.cpp b/logPlus/formwell.cpp index db2dd8e..bd6b6d4 100644 --- a/logPlus/formwell.cpp +++ b/logPlus/formwell.cpp @@ -299,6 +299,7 @@ QVector FormWell::new_track(QStringList listdt, QString strTrackName) formDraw->m_formTrack = formTrack; formDraw->m_iScale = m_iScale; formDraw->m_nTrackW = dW; + formDraw->m_nObjDrawH = m_nObjDrawH; ui->tableWidget->setCellWidget(i, columnCount, formDraw);//默认用formDraw填充满 } diff --git a/logPlus/formwell.h b/logPlus/formwell.h index 4cddce4..334ab6b 100644 --- a/logPlus/formwell.h +++ b/logPlus/formwell.h @@ -60,6 +60,7 @@ public: QString m_strWellName; QString m_strSlfName=""; int m_nObjLyrH = 100; + int m_nObjDrawH = 0; int m_iScale=200; double m_iY1=0; double m_iY2=0; diff --git a/logPlus/logPlus.pro b/logPlus/logPlus.pro index e7cf481..6fddff4 100644 --- a/logPlus/logPlus.pro +++ b/logPlus/logPlus.pro @@ -70,6 +70,7 @@ SOURCES += \ forminfo.cpp \ formline.cpp \ formlogmud.cpp \ + formwave.cpp \ formmultiheads.cpp \ formtrack.cpp \ formtracktop.cpp \ @@ -142,6 +143,7 @@ HEADERS += \ forminfo.h \ formline.h \ formlogmud.h \ + formwave.h \ formmultiheads.h \ formtrack.h \ formtracktop.h \ @@ -175,6 +177,7 @@ FORMS += \ forminfo.ui \ formline.ui \ formlogmud.ui \ + formwave.ui \ formmultiheads.ui \ formtrack.ui \ formtracktop.ui \ diff --git a/logPlus/logplus.vcxproj b/logPlus/logplus.vcxproj index 7e8c927..e99cb7a 100644 --- a/logPlus/logplus.vcxproj +++ b/logPlus/logplus.vcxproj @@ -11,6 +11,7 @@ + @@ -173,6 +174,7 @@ + @@ -237,6 +239,7 @@ + diff --git a/logPlus/logplus.vcxproj.filters b/logPlus/logplus.vcxproj.filters index 9491a0a..8fca903 100644 --- a/logPlus/logplus.vcxproj.filters +++ b/logPlus/logplus.vcxproj.filters @@ -322,6 +322,9 @@ Header Files + + Header Files + @@ -675,6 +678,9 @@ Source Files + + Source Files + @@ -748,5 +754,8 @@ Form Files + + Form Files + \ No newline at end of file diff --git a/logPlus/mainwindow.h b/logPlus/mainwindow.h index e0fe874..5211c08 100644 --- a/logPlus/mainwindow.h +++ b/logPlus/mainwindow.h @@ -52,7 +52,7 @@ public: public: virtual void closeEvent(QCloseEvent *event); - +protected: //样式 void loadStyle(const QString &qssFile); diff --git a/logPlus/mainwindowcurve.cpp b/logPlus/mainwindowcurve.cpp index 196fc72..3041135 100644 --- a/logPlus/mainwindowcurve.cpp +++ b/logPlus/mainwindowcurve.cpp @@ -215,6 +215,23 @@ MainWindowCurve::~MainWindowCurve() void MainWindowCurve::resizeEvent(QResizeEvent *event) { + int nhei = 0; + Qt::ToolBarArea area = this->toolBarArea(ui->mainToolBar); + if (area == Qt::BottomToolBarArea || area == Qt::TopToolBarArea) + { + nhei = ui->mainToolBar->height(); + if (ui->centralwidget->layout()) + { + int left, top, right, bottom; + ui->centralwidget->layout()->getContentsMargins(&left, &top, &right, &bottom); + nhei += top; + nhei += bottom; + } + } + QSize sz = event->size(); + m_nObjDrawH = sz.height() - nhei - m_nObjLayerH - 100 - 100; + // nhei mainToolBar的高度 m_nObjLyrH,对象单元格高度 100头高度,100井头高度 + emit CallManage::getInstance()->sig_ResizeHeight(m_strUuid, m_nObjDrawH); } QToolBar * MainWindowCurve::getPluginToolBar() @@ -3656,6 +3673,7 @@ void MainWindowCurve::s_NewWell(QString strWellName, QString strSlfName) widgetWell->m_strUuid = m_strUuid; widgetWell->m_strSlfName = strSlfName; widgetWell->m_nObjLyrH = m_nObjLayerH; + widgetWell->m_nObjDrawH = m_nObjDrawH; widgetWell->m_iScale = m_iScale; widgetWell->setWellHeader(wellH); // diff --git a/logPlus/mainwindowcurve.h b/logPlus/mainwindowcurve.h index 3204dbc..34f1a98 100644 --- a/logPlus/mainwindowcurve.h +++ b/logPlus/mainwindowcurve.h @@ -87,6 +87,7 @@ public: QLineEdit *spinbox2; QLineEdit *spinbox3; + int m_nObjDrawH = 0; // 绘制层高度 int m_nObjLayerH = 104; // 对象层高度 int m_iScale=200; double m_iY1=-1000; diff --git a/logPlus/mainwindowcurve.ui b/logPlus/mainwindowcurve.ui index c7dc279..b1165ce 100644 --- a/logPlus/mainwindowcurve.ui +++ b/logPlus/mainwindowcurve.ui @@ -19,7 +19,7 @@ 9 - 9 + 20 9 @@ -46,16 +46,6 @@ - - - - 0 - 0 - 800 - 21 - - - toolBar diff --git a/logPlus/qmycustomplot.cpp b/logPlus/qmycustomplot.cpp index 2de9714..1511766 100644 --- a/logPlus/qmycustomplot.cpp +++ b/logPlus/qmycustomplot.cpp @@ -134,6 +134,8 @@ QMyCustomPlot::QMyCustomPlot(QWidget *parent, QString strSlfName, QString strWel connect(CallManage::getInstance(), SIGNAL(sig_vertScrollBarChanged(QString, double, double, double)), this, SLOT(vertScrollBarChanged(QString, double, double, double))); connect(CallManage::getInstance(), SIGNAL(sig_vertScrollBarChanged_setGeometry(QString, double, double, double, int)), this, SLOT(vertScrollBarChanged_setGeometry(QString, double, double, double, int))); + connect(CallManage::getInstance(), SIGNAL(sig_ResizeHeight(QString, int)), this, SLOT(s_ResizeHeight(QString, int))); + //曲线选中,置顶 connect(CallManage::getInstance(), SIGNAL(sig_Raise(QString, QString, QString, QString, QString, int, QString)), this, SLOT(s_Raise(QString, QString, QString, QString, QString, int, QString))); //颜色 @@ -779,7 +781,7 @@ void QMyCustomPlot::updateImage(float fTopY, FormInfo* pInfo) float flDep; int i, ii, j, nPoint = 0, m; - QRectF rt, wrt; + QRectF wrt; float dep, ch; double ratio; CString cs; @@ -1627,7 +1629,7 @@ void QMyCustomPlot::mouseMoveEvent(QMouseEvent *event) y_val = xAxis->pixelToCoord(y_pos); else y_val = yAxis->pixelToCoord(y_pos); - + //qDebug() << "MouseMove:" << y_pos; emit CallManage::getInstance()->sig_MouseMove(m_strUuid, m_strWellName, m_strTrackName, 0-y_val); } } @@ -12933,6 +12935,18 @@ void QMyCustomPlot::vertScrollBarChanged_setGeometry(QString strUuid, double val return; } +void QMyCustomPlot::s_ResizeHeight(QString strUuid, int nPixVal) +{ + if (m_strUuid == strUuid) + { + if (m_bX2Y) + m_fBottomY = xAxis->pixelToCoord(nPixVal); + else + m_fBottomY = yAxis->pixelToCoord(nPixVal); + emit CallManage::getInstance()->sig_ResizeDepth(m_strUuid, nPixVal, m_fBottomY); + } +} + //自定义滚动条 void QMyCustomPlot::vertScrollBarChanged(QString strUuid, double value, double low, double upper) { diff --git a/logPlus/qmycustomplot.h b/logPlus/qmycustomplot.h index 340c222..56e81b1 100644 --- a/logPlus/qmycustomplot.h +++ b/logPlus/qmycustomplot.h @@ -179,6 +179,7 @@ public: float m_iX1, m_iX2; float m_iY1, m_iY2; float m_fTopY = 0; // 显示深度upper + float m_fBottomY = 0; // 显示深度lower qint8 m_nLeftCross = 0; // 左跨道个数 qint8 m_nRightCross = 0; // 右跨道个数 @@ -424,6 +425,8 @@ public slots: //自定义滚动条 void vertScrollBarChanged(QString strUuid, double value, double low, double upper); void vertScrollBarChanged_setGeometry(QString strUuid, double value, double low, double upper, int ndepth); + + void s_ResizeHeight(QString strUuid, int nPixVal); //信号槽刷新 void slot_replot();