From bd8c1ea18fdc441ed6b2d85a8854b8add15a49bd Mon Sep 17 00:00:00 2001 From: crqiqi77 Date: Thu, 9 Apr 2026 15:18:52 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E7=8E=AB=E7=91=B0=E5=9B=BE=E5=B1=9E?= =?UTF-8?q?=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- logPlus/PropertyWidget.cpp | 57 +++++++++----- logPlus/formdraw.cpp | 38 ++++++++- logPlus/forminfo.cpp | 19 ++++- logPlus/forminfo.h | 8 +- logPlus/qmycustomplot.cpp | 154 +++++++++++++++++++++++++------------ logPlus/qmycustomplot.h | 7 +- 6 files changed, 202 insertions(+), 81 deletions(-) diff --git a/logPlus/PropertyWidget.cpp b/logPlus/PropertyWidget.cpp index 4a60479..be6e9ef 100644 --- a/logPlus/PropertyWidget.cpp +++ b/logPlus/PropertyWidget.cpp @@ -4455,10 +4455,11 @@ void PropertyWidget::changedPlObjectProperty(QString strProperty, QVariant varVa variantMap["m_pl_dataType"] = this->m_formInfo->m_pl_dataType; variantMap["m_pl_azimuthCurve"] = this->m_formInfo->m_pl_azimuthCurve; variantMap["m_pl_inclinationCurve"] = this->m_formInfo->m_pl_inclinationCurve; - + // 控制曲线 variantMap["m_pl_controlCurveName"] = this->m_formInfo->m_pl_controlCurveName; variantMap["m_pl_controlMinValue"] = this->m_formInfo->m_pl_controlMinValue; variantMap["m_pl_controlMaxValue"] = this->m_formInfo->m_pl_controlMaxValue; + variantMap["m_pl_sectorCount"] = this->m_formInfo->m_pl_sectorCount; variantMap["m_pl_circleRadius"] = this->m_formInfo->m_pl_circleRadius; variantMap["m_pl_circleColor"] = this->m_formInfo->m_pl_circleColor; @@ -4600,9 +4601,8 @@ void PropertyWidget::changedRoseProperty(QString strProperty, QVariant varVal) } else if ("刻度" == strProperty) { - QFont temp = varVal.value(); - this->m_formInfo->m_pl_fontScale = temp; - this->m_formInfo->repaint(); + this->m_formInfo->m_pl_fontScale = varVal.value(); + flag = true; } // 控制曲线 else if ("曲线名" == strProperty) @@ -4701,67 +4701,83 @@ void PropertyWidget::changedRoseProperty(QString strProperty, QVariant varVal) else if ("深度字段" == strProperty) { this->m_formInfo->m_rose_depth_field = varVal.toString(); + flag = true; } else if ("方位字段" == strProperty) { this->m_formInfo->m_rose_azimuth_field = varVal.toString(); + flag = true; } else if ("倾角字段" == strProperty) { this->m_formInfo->m_rose_dip_field = varVal.toString(); + flag = true; } else if ("属性字段" == strProperty) { this->m_formInfo->m_rose_attribute_field = varVal.toString(); + flag = true; } // 玫瑰图 else if ("扇形" == strProperty) { this->m_formInfo->m_rose_sector_enabled = varVal.toInt(); + flag = true; } else if ("圆半径(cm)" == strProperty) { this->m_formInfo->m_rose_circle_radius_cm = varVal.toInt(); + flag = true; } else if ("辐射圈" == strProperty) { this->m_formInfo->m_rose_radiation_circle_enabled = varVal.toInt(); + flag = true; } else if ("方位打印间隔" == strProperty) { this->m_formInfo->m_rose_azimuth_print_interval = varVal.toInt(); + flag = true; } else if ("圆线颜色" == strProperty) { this->m_formInfo->m_rose_circle_line_color = varVal.value(); + flag = true; } else if ("圆线宽度" == strProperty) { this->m_formInfo->m_rose_circle_line_width = varVal.toInt(); + flag = true; } else if ("应力线颜色" == strProperty) { this->m_formInfo->m_rose_stress_line_color = varVal.value(); + flag = true; } else if ("垮塌线颜色" == strProperty) { this->m_formInfo->m_rose_collapse_line_color = varVal.value(); + flag = true; } else if ("绘制辐射线?" == strProperty) { this->m_formInfo->m_rose_draw_radiation_line = varVal.toBool(); + flag = true; } else if ("绘制井眼垮塌" == strProperty) { this->m_formInfo->m_rose_draw_wellbore_collapse = varVal.toBool(); + flag = true; } else if ("是否填充" == strProperty) { this->m_formInfo->m_rose_fill_enabled = varVal.toBool(); + flag = true; } else if ("是否绘制标注?" == strProperty) { this->m_formInfo->m_rose_draw_annotation = varVal.toBool(); + flag = true; } if(flag) @@ -4778,26 +4794,25 @@ void PropertyWidget::changedRoseProperty(QString strProperty, QVariant varVal) variantMap["m_rose_azimuth_field"] = this->m_formInfo->m_rose_azimuth_field; variantMap["m_rose_dip_field"] = this->m_formInfo->m_rose_dip_field; variantMap["m_rose_attribute_field"] = this->m_formInfo->m_rose_attribute_field; - - + // 控制曲线 variantMap["m_pl_controlCurveName"] = this->m_formInfo->m_pl_controlCurveName; variantMap["m_pl_controlMinValue"] = this->m_formInfo->m_pl_controlMinValue; variantMap["m_pl_controlMaxValue"] = this->m_formInfo->m_pl_controlMaxValue; - variantMap["m_pl_sectorCount"] = this->m_formInfo->m_pl_sectorCount; - variantMap["m_pl_circleRadius"] = this->m_formInfo->m_pl_circleRadius; - variantMap["m_pl_circleColor"] = this->m_formInfo->m_pl_circleColor; - variantMap["m_pl_circleLineWidth"] = this->m_formInfo->m_pl_circleLineWidth; - variantMap["m_pl_isFillEnabled"] = this->m_formInfo->m_pl_isFillEnabled; - variantMap["m_pl_fillColor"] = this->m_formInfo->m_pl_fillColor; - // 线数 - variantMap["m_pl_lineNumber"] = this->m_formInfo->m_pl_lineNumber; - variantMap["m_pl_lineHeight"] = this->m_formInfo->m_pl_lineHeight; - variantMap["m_pl_lineThickness"] = this->m_formInfo->m_pl_lineThickness; - variantMap["m_pl_lineColor"] = this->m_formInfo->m_pl_lineColor; - variantMap["m_pl_drawAnnotation"] = this->m_formInfo->m_pl_drawAnnotation; - variantMap["m_pl_drawHistogram"] = this->m_formInfo->m_pl_drawHistogram; - variantMap["m_pl_baselineWidth"] = this->m_formInfo->m_pl_baselineWidth; - variantMap["m_pl_baselineColor"] = this->m_formInfo->m_pl_baselineColor; + // 字体 + variantMap["m_pl_fontScale"] = this->m_formInfo->m_pl_fontScale; + // 玫瑰图 + variantMap["m_rose_sector_enabled"] = this->m_formInfo->m_rose_sector_enabled; + variantMap["m_rose_circle_radius_cm"] = this->m_formInfo->m_rose_circle_radius_cm; + variantMap["m_rose_radiation_circle_enabled"] = this->m_formInfo->m_rose_radiation_circle_enabled; + variantMap["m_rose_azimuth_print_interval"] = this->m_formInfo->m_rose_azimuth_print_interval; + variantMap["m_rose_circle_line_color"] = this->m_formInfo->m_rose_circle_line_color; + variantMap["m_rose_circle_line_width"] = this->m_formInfo->m_rose_circle_line_width; + variantMap["m_rose_stress_line_color"] = this->m_formInfo->m_rose_stress_line_color; + variantMap["m_rose_collapse_line_color"] = this->m_formInfo->m_rose_collapse_line_color; + variantMap["m_rose_draw_radiation_line"] = this->m_formInfo->m_rose_draw_radiation_line; + variantMap["m_rose_draw_wellbore_collapse"] = this->m_formInfo->m_rose_draw_wellbore_collapse; + variantMap["m_rose_fill_enabled"] = this->m_formInfo->m_rose_fill_enabled; + variantMap["m_rose_draw_annotation"] = this->m_formInfo->m_rose_draw_annotation; // 统计间隔 variantMap["m_pl_statInterval"] = this->m_formInfo->m_pl_statInterval; variantMap["m_pl_minInclination"] = this->m_formInfo->m_pl_minInclination; diff --git a/logPlus/formdraw.cpp b/logPlus/formdraw.cpp index bae1f7b..41ead81 100644 --- a/logPlus/formdraw.cpp +++ b/logPlus/formdraw.cpp @@ -376,10 +376,42 @@ void FormDraw::setDrawData(QStringList listdt, QJsonObject objInfo) 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; // 扇形(启用开关) + int m_rose_circle_radius_cm = pInfo->m_rose_circle_radius_cm; // 圆半径(cm) + 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); - - + 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("dcaObject" == strType) { diff --git a/logPlus/forminfo.cpp b/logPlus/forminfo.cpp index 8c2ccf4..8072acf 100644 --- a/logPlus/forminfo.cpp +++ b/logPlus/forminfo.cpp @@ -184,7 +184,24 @@ void FormInfo::initProperty(QJsonObject obj) } else if ("roseObject" == strType) { -// this->m_pl_baselineColor = QColor(obj["m_pl_baselineColor"].toString()); // 颜色 + // 表数据字段 + this->m_rose_depth_field = obj["m_rose_depth_field"].toString(); // 深度字段 + this->m_rose_azimuth_field = obj["m_rose_azimuth_field"].toString(); // 方位字段 + this->m_rose_dip_field = obj["m_rose_dip_field"].toString(); // 倾角字段 + this->m_rose_attribute_field = obj["m_rose_attribute_field"].toString(); // 属性字段 + // 玫瑰图 + this->m_rose_sector_enabled = obj["m_rose_sector_enabled"].toInt(); // 扇形(启用开关) + this->m_rose_circle_radius_cm = obj["m_rose_circle_radius_cm"].toInt(); // 圆半径(cm) + this->m_rose_radiation_circle_enabled = obj["m_rose_radiation_circle_enabled"].toInt(); // 辐射圈(启用开关) + this->m_rose_azimuth_print_interval = obj["m_rose_azimuth_print_interval"].toInt(); // 方位打印间隔 + this->m_rose_circle_line_color = QColor(obj["m_rose_circle_line_color"].toString()); // 圆线颜色 + this->m_rose_circle_line_width = obj["m_rose_circle_line_width"].toInt(); // 圆线宽度 + this->m_rose_stress_line_color = QColor(obj["m_rose_stress_line_color"].toString()); // 应力线颜色 + this->m_rose_collapse_line_color = QColor(obj["m_rose_collapse_line_color"].toString()); // 垮塌线颜色 + this->m_rose_draw_radiation_line = obj["m_rose_draw_radiation_line"].toBool(); // 绘制辐射线? + this->m_rose_draw_wellbore_collapse = obj["m_rose_draw_wellbore_collapse"].toBool(); // 绘制井眼垮塌 + this->m_rose_fill_enabled = obj["m_rose_fill_enabled"].toBool(); // 是否填充 + this->m_rose_draw_annotation = obj["m_rose_draw_annotation"].toBool(); // 是否绘制标注? } if ("plObject" == strType || ("roseObject" == strType)) diff --git a/logPlus/forminfo.h b/logPlus/forminfo.h index 959e8e6..0527221 100644 --- a/logPlus/forminfo.h +++ b/logPlus/forminfo.h @@ -257,7 +257,7 @@ public: double m_pl_controlMinValue = 0; // 控制最小值 double m_pl_controlMaxValue = 100; // 控制最大值 // 统计参数(频率统计图、玫瑰图) - int m_pl_statInterval = 10; // 统计间隔 + int m_pl_statInterval = 20; // 统计间隔 double m_pl_minInclination = 0; // 最小倾角 double m_pl_maxInclination = 90; // 最大倾角 // 分类(频率统计图、玫瑰图) @@ -303,9 +303,9 @@ public: QString m_rose_dip_field = "DIPorS"; // 倾角字段 QString m_rose_attribute_field = "ID"; // 属性字段 // 玫瑰图 - int m_rose_sector_enabled = 36; // 扇形(启用开关) - int m_rose_circle_radius_cm = 1; // 圆半径(cm) - int m_rose_radiation_circle_enabled = 9; // 辐射圈(启用开关) + int m_rose_sector_enabled = 36; // 扇形 + int m_rose_circle_radius_cm = 50; // 圆半径(cm) + int m_rose_radiation_circle_enabled = 9; // 辐射圈 int m_rose_azimuth_print_interval = 3; // 方位打印间隔 QColor m_rose_circle_line_color = Qt::black; // 圆线颜色 int m_rose_circle_line_width = 2; // 圆线宽度 diff --git a/logPlus/qmycustomplot.cpp b/logPlus/qmycustomplot.cpp index 72f3a9a..f7c30f2 100644 --- a/logPlus/qmycustomplot.cpp +++ b/logPlus/qmycustomplot.cpp @@ -9996,6 +9996,7 @@ void QMyCustomPlot::s_changePlObjectProperty(QVariantMap variantMap) QString csCurveGrad = variantMap["m_pl_controlCurveName"].toString(); double LeftVal3 = variantMap["m_pl_controlMinValue"].toDouble(); double RightVal3 = variantMap["m_pl_controlMaxValue"].toDouble(); + int nArc = variantMap["m_pl_sectorCount"].toInt(); double nR = variantMap["m_pl_circleRadius"].toDouble(); QColor crArc = variantMap["m_pl_circleColor"].value(); @@ -10031,7 +10032,8 @@ void QMyCustomPlot::s_changePlObjectProperty(QVariantMap variantMap) void QMyCustomPlot::drawFgrq (bool bTableData, QString csCurveDDIR, QString csCurveDANG, - QString csCurveGrad, double LeftVal3, double RightVal3, int nArc, + QString csCurveGrad, double LeftVal3, double RightVal3, + int nArc, double nR, QColor crArc, int nArcLineWidth, bool bFill, QColor crFill, int lineNumber, double lineHeight, int lineThickness, QColor lineColor, bool drawAnnotation, bool drawHistogram, int baselineWidth, QColor baselineColor, int nstep, double LeftVal, double RightVal) @@ -10554,67 +10556,95 @@ void QMyCustomPlot::s_changeRoseProperty(QVariantMap variantMap) QString m_rose_azimuth_field = variantMap["m_rose_azimuth_field"].toString(); QString m_rose_dip_field = variantMap["m_rose_dip_field"].toString(); QString m_rose_attribute_field = variantMap["m_rose_attribute_field"].toString(); + // 控制曲线 + QString csCurveGrad = variantMap["m_pl_controlCurveName"].toString(); + double LeftVal3 = variantMap["m_pl_controlMinValue"].toDouble(); + double RightVal3 = variantMap["m_pl_controlMaxValue"].toDouble(); + // 字体 + QFont m_pl_fontScale = variantMap["m_pl_fontScale"].value(); + // 玫瑰图 + int m_rose_sector_enabled = variantMap["m_rose_sector_enabled"].toInt(); + int m_rose_circle_radius_cm = variantMap["m_rose_circle_radius_cm"].toInt(); + int m_rose_radiation_circle_enabled = variantMap["m_rose_radiation_circle_enabled"].toInt(); + int m_rose_azimuth_print_interval = variantMap["m_rose_azimuth_print_interval"].toInt(); + QColor m_rose_circle_line_color = variantMap["m_rose_circle_line_color"].value(); + int m_rose_circle_line_width = variantMap["m_rose_circle_line_width"].toInt(); + QColor m_rose_stress_line_color = variantMap["m_rose_stress_line_color"].value(); + QColor m_rose_collapse_line_color = variantMap["m_rose_collapse_line_color"].value(); + bool m_rose_draw_radiation_line = variantMap["m_rose_draw_radiation_line"].toBool(); + bool m_rose_draw_wellbore_collapse = variantMap["m_rose_draw_wellbore_collapse"].toBool(); + bool m_rose_fill_enabled = variantMap["m_rose_fill_enabled"].toBool(); + bool m_rose_draw_annotation = variantMap["m_rose_draw_annotation"].toBool(); + // 统计间隔 + int m_pl_statInterval = variantMap["m_pl_statInterval"].toInt(); + double m_pl_minInclination = variantMap["m_pl_minInclination"].toDouble(); + double m_pl_maxInclination = variantMap["m_pl_maxInclination"].toDouble(); + +// int nstep, double LeftVal, double RightVal this->drawRose(bTableData, azimuthCurve, inclinationCurve, - m_rose_depth_field, m_rose_azimuth_field, m_rose_dip_field, m_rose_attribute_field); + 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); } void QMyCustomPlot::drawRose(bool bTableData, QString csCurveDDIR, QString csCurveDANG, - QString qsDepth, QString qsDIR, QString qsDIP, QString qsID) + QString qsDepth, QString qsDIR, QString qsDIP, QString qsID, + QString csCurveGrad, double m_LeftVal3, double m_RightVal3, QFont m_pl_fontScale, + int m_nArc, int nR, int m_nCircle, int m_nAzimStep, QColor m_rose_circle_line_color, + int m_rose_circle_line_width, QColor m_rose_stress_line_color, QColor m_rose_collapse_line_color, bool m_bGrid, bool m_bJykt, + bool m_rose_fill_enabled, bool m_bHint, int nstep, float m_LeftVal, float m_RightVal) { + // 这个是防止读取为错误 导致软件闪退 读取失败返回false直接退出 bool flag = true; this->clearGraphs(); this->clearItems(); - double m_LeftVal = 0.0f; - double m_RightVal = 90.0f; - // if(m_Value == NULL) { m_bTableData = bTableData; // 表格 曲线 m_csCurveDDIR = csCurveDDIR; // 方位曲线 m_csCurveDANG = csCurveDANG; //倾角曲线 - m_csCurveGrad = "GRAD"; + m_csCurveGrad = csCurveGrad; - m_qsDepth="DEPT"; // 深度字段 - m_qsDIR="DDIR"; // 方位字段 - m_qsDIP="DANG";// 倾角字段 - m_qsID = "ID"; +// m_qsDepth="DEPT"; // 深度字段 +// m_qsDIR="DDIR"; // 方位字段 +// m_qsDIP="DANG";// 倾角字段 +// m_qsID = "ID"; + m_qsDepth= qsDepth; // 深度字段 + m_qsDIR= qsDIR; // 方位字段 + m_qsDIP= qsDIP;// 倾角字段 + m_qsID = qsID; m_qsTable="FRAC_HOLE.TABLE"; - - - - flag = Refurbish(); if(!flag) { return; } } - - double nR = 40; - - QPen wPen(Qt::black, 2); + QPen wPen(m_rose_circle_line_color, 2); double centerX = this->m_iX2/2; - float flVal = 0.0f; float x,y,x1,y1,x2,y2; float ifdir[360]; - int m_nArc = 36; - float m_LeftVal3 = 0; - float m_RightVal3 = 100.0; - m_LeftVal = 0.0f; - m_RightVal = 90.0f; + + +// int nstep = 5; +// float m_LeftVal3 = 0; +// float m_RightVal3 = 100.0; + float mind=min(m_RightVal , m_LeftVal); float maxd=max(m_RightVal , m_LeftVal); float dirmax,dipmax,dr; - float deps; - float ftmpSdep = 2890;//m_SDep; float ftmpEdep = m_EDep; + if (m_bTableData) { ReadFracDef(); @@ -10629,18 +10659,16 @@ void QMyCustomPlot::drawRose(bool bTableData, QString csCurveDDIR, QString csCur int nPointNum = m_FracTabList.count(); int n = m_FracDefList.count(); - int nstep = 5; int tmp = ftmpSdep / nstep; float flDep = tmp * nstep; double pi = 3.1415926535; // 射线 - bool m_bGrid = true; +// bool m_bGrid = true; // 井眼垮塌 - bool m_bJykt = true; +// bool m_bJykt = true; // 标注 - bool m_bHint = true; - int m_nAzimStep = 3; +// bool m_bHint = true; m_Curve.DepLevel = 0.5; while ( 1) @@ -10650,15 +10678,16 @@ void QMyCustomPlot::drawRose(bool bTableData, QString csCurveDDIR, QString csCur double tempf = flDep+(float)(nstep)/2.; double centerY = tempf * -1.0; - wPen.setWidth(2); - wPen.setColor(Qt::black); + // 最外层圆 QCPItemEllipse* pEse = new QCPItemEllipse(this); + wPen.setWidth(m_rose_circle_line_width); pEse->setPen(wPen); pEse->m_bCustom = true; pEse->m_nRadius = nR; pEse->topLeft->setCoords(centerY, centerX); pEse->bottomRight->setCoords(centerY, centerX); + // 圆里面的十字 for(int k = 0; k < 4; k++) { QCPItemLine* pLine1 = new QCPItemLine(this); @@ -10672,9 +10701,9 @@ void QMyCustomPlot::drawRose(bool bTableData, QString csCurveDDIR, QString csCur } // 写标注 - if ( m_bHint ) + if (m_bHint) { - int psize = 10; + int psize = 15; flVal = m_nAzimStep*360./m_nArc; for (int i=0 ;i<360; i+=(int)(flVal)) { @@ -10682,21 +10711,19 @@ void QMyCustomPlot::drawRose(bool bTableData, QString csCurveDDIR, QString csCur mItemTitle->position->setCoords(centerY,centerX); mItemTitle->setText(QString::number(i)); //mItemTitle->setBrush(QBrush(Qt::red)); - mItemTitle->setFont(QFont("Arial", 10)); - mItemTitle->setColor(Qt::black); - + mItemTitle->setFont(m_pl_fontScale); + mItemTitle->setColor(m_rose_circle_line_color); dr = i*2* 3.1415926535/ 360.; mItemTitle->m_fx = (nR+psize*0.85)*sin(dr); mItemTitle->m_fy = (nR+psize*0.85)*cos(dr); mItemTitle->m_bCustom = true; } - } + // 画辐射线 if(m_bGrid) { wPen.setWidth(1); - double st = 360/m_nArc; for(int i = 0; i < m_nArc; i++) { @@ -10715,6 +10742,22 @@ void QMyCustomPlot::drawRose(bool bTableData, QString csCurveDDIR, QString csCur } } + // 画辐射圈 + if (m_bGrid) + { + qreal currentRadius = 0; + for (int i = 0; i < m_nCircle; i++) + { + QCPItemEllipse* pEse = new QCPItemEllipse(this); + pEse->setPen(wPen); + pEse->m_bCustom = true; + currentRadius -= nR / m_nCircle; + pEse->m_nRadius = currentRadius; + pEse->topLeft->setCoords(centerY, centerX); + pEse->bottomRight->setCoords(centerY , centerX ); + } + } + for(int i=0;i<=m_nArc;i++) ifdir[i]=0.; x1 = 360./m_nArc; @@ -10828,7 +10871,15 @@ void QMyCustomPlot::drawRose(bool bTableData, QString csCurveDDIR, QString csCur pol->topLeft->setCoords(x, y); pol->bottomRight->setCoords(x, y); pol->setPoints(myPolygon); - pol->setBrushColor(QColor(255,170,0)); + if(m_rose_fill_enabled) + { + m_rose_stress_line_color.setAlpha(255); + } + else + { + m_rose_stress_line_color.setAlpha(0); + } + pol->setBrushColor(QColor(m_rose_stress_line_color)); } myPolygon.clear(); @@ -10861,6 +10912,7 @@ void QMyCustomPlot::drawRose(bool bTableData, QString csCurveDDIR, QString csCur oldy = y2; } } + // 垮塌线 if (iIndex >=0/*&&m_bFill*/ ) { x = centerY; @@ -10869,10 +10921,11 @@ void QMyCustomPlot::drawRose(bool bTableData, QString csCurveDDIR, QString csCur pol->topLeft->setCoords(x, y); pol->bottomRight->setCoords(x, y); pol->setPoints(myPolygon); - pol->setBrushColor(QColor(255,170,0)); + pol->setBrushColor(QColor(m_rose_stress_line_color)); } + if ( m_bJykt && iIndex >=0 ) { // 绘制垮塌方向 @@ -10886,28 +10939,27 @@ void QMyCustomPlot::drawRose(bool bTableData, QString csCurveDDIR, QString csCur x2 = ifdir[iIndex]*nR*sin(dr)/dirmax; y2 = ifdir[iIndex]*nR*cos(dr)/dirmax; - wPen.setWidth(2); - wPen.setColor(QColor(0,85,255)); - this->addQCPItemLine(this, centerY,centerX, QPointF(x1, y1), QPointF(x2, y2), wPen); + QPen collapsePen(m_rose_collapse_line_color, 2); + this->addQCPItemLine(this, centerY,centerX, QPointF(x1, y1), QPointF(x2, y2), collapsePen); dr=iIndex*flVal; float x3 = 0.1*ifdir[iIndex]*nR*sin(dr)/dirmax; float y3 = 0.1*ifdir[iIndex]*nR*cos(dr)/dirmax; - this->addQCPItemLine(this, centerY,centerX, QPointF(x1, y1), QPointF(x3, y3), wPen); - this->addQCPItemLine(this, centerY,centerX, QPointF(x3, y3), QPointF(x2, y2), wPen); + this->addQCPItemLine(this, centerY,centerX, QPointF(x1, y1), QPointF(x3, y3), collapsePen); + this->addQCPItemLine(this, centerY,centerX, QPointF(x3, y3), QPointF(x2, y2), collapsePen); dr=iIndex*flVal; dr = dr-pi;//18*flVal;//m1_nArc*flVal/2; x3 = 0.1*ifdir[iIndex]*nR*sin(dr)/dirmax; y3 = 0.1*ifdir[iIndex]*nR*cos(dr)/dirmax; - this->addQCPItemLine(this, centerY,centerX, QPointF(x1, y1), QPointF(x3, y3), wPen); - this->addQCPItemLine(this, centerY,centerX, QPointF(x3, y3), QPointF(x2, y2), wPen); - + this->addQCPItemLine(this, centerY,centerX, QPointF(x1, y1), QPointF(x3, y3), collapsePen); + this->addQCPItemLine(this, centerY,centerX, QPointF(x3, y3), QPointF(x2, y2), collapsePen); } flDep += nstep; } + this->replot(); } void QMyCustomPlot::addQCPItemLine(QMyCustomPlot *widget, float cx, float cy, const QPointF& p1, const QPointF& p2, const QPen& wPen) diff --git a/logPlus/qmycustomplot.h b/logPlus/qmycustomplot.h index 7ad9307..67dd75e 100644 --- a/logPlus/qmycustomplot.h +++ b/logPlus/qmycustomplot.h @@ -656,8 +656,13 @@ public: bool ReadData(QString strSlfName, QString strLineName, int iCurve, Slf_CURVE *curve); bool ReadData(QString strSlfName, QString strLineName); + // void drawRose(bool bTableData, QString csCurveDDIR, QString csCurveDANG, - QString qsDepth, QString qsDIR, QString qsDIP, QString qsID); + QString qsDepth, QString qsDIR, QString qsDIP, QString qsID, + QString csCurveGrad, double m_LeftVal3, double m_RightVal3, QFont m_pl_fontScale, + int m_nArc, int m_rose_circle_radius_cm, int m_rose_radiation_circle_enabled, int m_rose_azimuth_print_interval, QColor m_rose_circle_line_color, + int m_rose_circle_line_width, QColor m_rose_stress_line_color, QColor m_rose_collapse_line_color, bool m_rose_draw_radiation_line, bool m_rose_draw_wellbore_collapse, + bool m_rose_fill_enabled, bool m_rose_draw_annotation, int nstep, float m_LeftVal, float m_RightVal); void addQCPItemLine(QMyCustomPlot *widget, float cx, float cy, const QPointF& p1, const QPointF& p2, const QPen& wPen); private: From 458e342d93afe5de54d1648807f943033ed4131f Mon Sep 17 00:00:00 2001 From: crqiqi77 Date: Thu, 9 Apr 2026 16:17:38 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E7=8E=AB=E7=91=B0=E5=9B=BE=E5=B1=9E?= =?UTF-8?q?=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- logPlus/qmycustomplot.cpp | 374 +++++++++++++++++++++++++++++++++----- logPlus/qmycustomplot.h | 28 +++ 2 files changed, 352 insertions(+), 50 deletions(-) diff --git a/logPlus/qmycustomplot.cpp b/logPlus/qmycustomplot.cpp index d1b7304..3a1168f 100644 --- a/logPlus/qmycustomplot.cpp +++ b/logPlus/qmycustomplot.cpp @@ -10035,8 +10035,7 @@ void QMyCustomPlot::s_changePlObjectProperty(QVariantMap variantMap) void QMyCustomPlot::drawFgrq (bool bTableData, QString csCurveDDIR, QString csCurveDANG, - QString csCurveGrad, double LeftVal3, double RightVal3, - int nArc, + QString csCurveGrad, double LeftVal3, double RightVal3, int nArc, double nR, QColor crArc, int nArcLineWidth, bool bFill, QColor crFill, int lineNumber, double lineHeight, int lineThickness, QColor lineColor, bool drawAnnotation, bool drawHistogram, int baselineWidth, QColor baselineColor, int nstep, double LeftVal, double RightVal) @@ -10064,14 +10063,11 @@ void QMyCustomPlot::drawFgrq (bool bTableData, QString csCurveDDIR, QString csCu return; } } - -// double nR = 50; QPen wPen(crArc, nArcLineWidth); double centerX = this->m_iX2/2; float flVal = 0.0f; float x,y,x1,y1,x2,y2; float ifdir[360]; - float mind=min(RightVal , LeftVal); float maxd=max(RightVal , LeftVal); float dirmax,dipmax,dr; @@ -10079,21 +10075,17 @@ void QMyCustomPlot::drawFgrq (bool bTableData, QString csCurveDDIR, QString csCu float ftmpSdep = m_SDep; float ftmpEdep = m_EDep; - if (m_bTableData) { // ReadFracDef(); - for (int i = 0 ; i < iFracType ; i++) { m_bTypeDraw[i] = true; } - ftmpSdep = -m_iY2; ftmpEdep = -m_iY1; } - int nPointNum = m_FracTabList.count(); int n = m_FracDefList.count(); int tmp = ftmpSdep / nstep; @@ -10225,7 +10217,7 @@ void QMyCustomPlot::drawFgrq (bool bTableData, QString csCurveDDIR, QString csCu } } - int iIndex; + int iIndex; flVal = 3.1415926535 *2./ nArc ; dirmax=0; dipmax=0; for(i=0;i<=nArc;i++) @@ -10235,7 +10227,6 @@ void QMyCustomPlot::drawFgrq (bool bTableData, QString csCurveDDIR, QString csCu dirmax=ifdir[i]; } - if (dirmax == 0 ) dirmax=1; for(i=0;i<=nArc;i++) @@ -10243,10 +10234,8 @@ void QMyCustomPlot::drawFgrq (bool bTableData, QString csCurveDDIR, QString csCu // ifdir[i]=ifdir[i]*(nRadius-GetLineWidth(pDC,m_nArcLineWidth/2.))/dirmax;//-m_nArcLineWidth/2.whp add 2016.10.21 for线粗时扇叶超界 ifdir[nArc+1]=ifdir[1]; - //方位频率 float x0,y0; - x = centerY; y = centerX; for(int i=0;i<=nArc;i++) @@ -10276,24 +10265,16 @@ void QMyCustomPlot::drawFgrq (bool bTableData, QString csCurveDDIR, QString csCu myPolygon << QPointF(0, 0); pol->setPoints(myPolygon); } - -// QCPItemRect* prt = new QCPItemRect(this); -// prt->topLeft->setCoords(x, y); -// prt->bottomRight->setCoords(x, y); } //float ifdir[360], int iIndex, float dirmax - if(drawAnnotation) { this->drawDipAngle(centerX, centerY, ifdir, dirmax, lineNumber, lineHeight, lineThickness, lineColor, drawHistogram, baselineWidth, baselineColor, LeftVal, RightVal); } - flDep += nstep; } - - this->replot(); } @@ -10550,7 +10531,7 @@ void QMyCustomPlot::s_changeRoseProperty(QVariantMap variantMap) bool bTableData = false; if(dataType == 1) { - dataType = true; + bTableData = true; } QString azimuthCurve = variantMap["m_pl_azimuthCurve"].toString(); QString inclinationCurve = variantMap["m_pl_inclinationCurve"].toString(); @@ -10585,14 +10566,20 @@ void QMyCustomPlot::s_changeRoseProperty(QVariantMap variantMap) // int nstep, double LeftVal, double RightVal - this->drawRose(bTableData, 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); + + this->drawRose(bTableData, 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); + + + + } + void QMyCustomPlot::drawRose(bool bTableData, QString csCurveDDIR, QString csCurveDANG, QString qsDepth, QString qsDIR, QString qsDIP, QString qsID, QString csCurveGrad, double m_LeftVal3, double m_RightVal3, QFont m_pl_fontScale, @@ -10612,16 +10599,10 @@ void QMyCustomPlot::drawRose(bool bTableData, QString csCurveDDIR, QString csCur m_csCurveDDIR = csCurveDDIR; // 方位曲线 m_csCurveDANG = csCurveDANG; //倾角曲线 m_csCurveGrad = csCurveGrad; - -// m_qsDepth="DEPT"; // 深度字段 -// m_qsDIR="DDIR"; // 方位字段 -// m_qsDIP="DANG";// 倾角字段 -// m_qsID = "ID"; m_qsDepth= qsDepth; // 深度字段 m_qsDIR= qsDIR; // 方位字段 m_qsDIP= qsDIP;// 倾角字段 m_qsID = qsID; - m_qsTable="FRAC_HOLE.TABLE"; flag = Refurbish(); @@ -10635,12 +10616,6 @@ void QMyCustomPlot::drawRose(bool bTableData, QString csCurveDDIR, QString csCur float flVal = 0.0f; float x,y,x1,y1,x2,y2; float ifdir[360]; - - -// int nstep = 5; -// float m_LeftVal3 = 0; -// float m_RightVal3 = 100.0; - float mind=min(m_RightVal , m_LeftVal); float maxd=max(m_RightVal , m_LeftVal); float dirmax,dipmax,dr; @@ -10658,6 +10633,9 @@ void QMyCustomPlot::drawRose(bool bTableData, QString csCurveDDIR, QString csCur ftmpSdep = -m_iY2; ftmpEdep = -m_iY1; + + m_rose_fill_enabled = false; + m_bJykt = false; } int nPointNum = m_FracTabList.count(); @@ -10666,13 +10644,6 @@ void QMyCustomPlot::drawRose(bool bTableData, QString csCurveDDIR, QString csCur float flDep = tmp * nstep; double pi = 3.1415926535; - // 射线 -// bool m_bGrid = true; - // 井眼垮塌 -// bool m_bJykt = true; - // 标注 -// bool m_bHint = true; - m_Curve.DepLevel = 0.5; while ( 1) { @@ -10927,8 +10898,6 @@ void QMyCustomPlot::drawRose(bool bTableData, QString csCurveDDIR, QString csCur pol->setBrushColor(QColor(m_rose_stress_line_color)); } - - if ( m_bJykt && iIndex >=0 ) { // 绘制垮塌方向 @@ -10959,9 +10928,314 @@ void QMyCustomPlot::drawRose(bool bTableData, QString csCurveDDIR, QString csCur this->addQCPItemLine(this, centerY,centerX, QPointF(x1, y1), QPointF(x3, y3), collapsePen); this->addQCPItemLine(this, centerY,centerX, QPointF(x3, y3), QPointF(x2, y2), collapsePen); } + flDep += nstep; + } + this->replot(); +} + +void QMyCustomPlot::drawTabRose( + bool bTableData, + QString csCurveDDIR, + QString csCurveDANG, + QString qsDepth, + QString qsDIR, + QString qsDIP, + QString qsID, + QString csCurveGrad, + double m_LeftVal3, + double m_RightVal3, + QFont m_pl_fontScale, + int m_nArc, + int nR, + int m_nCircle, + int m_nAzimStep, + QColor m_rose_circle_line_color, + int m_rose_circle_line_width, + QColor m_rose_stress_line_color, + QColor m_rose_collapse_line_color, + bool m_bGrid, + bool m_bJykt, + bool m_rose_fill_enabled, + bool m_bHint, + int nstep, + float m_LeftVal, + float m_RightVal +) +{ + bool flag = true; + + this->clearGraphs(); + this->clearItems(); + + m_bTableData = bTableData; + m_csCurveDDIR = csCurveDDIR; + m_csCurveDANG = csCurveDANG; + m_csCurveGrad = csCurveGrad; + m_qsDepth = qsDepth; + m_qsDIR = qsDIR; + m_qsDIP = qsDIP; + m_qsID = qsID; + m_qsTable = "FRAC_HOLE.TABLE"; + + flag = Refurbish(); + if (!flag) return; + + // 必须读取裂缝表 + 裂缝定义 + ReadFracDef(); + int nPointNum = m_FracTabList.count(); + int nFracType = m_FracDefList.count(); + + if (nPointNum < 1) return; + + // 初始化裂缝类型默认全部绘制 + for (int i = 0; i < nFracType; i++) { + m_bTypeDraw[i] = true; + } + + QPen wPen(m_rose_circle_line_color, m_rose_circle_line_width); + double centerX = this->m_iX2 / 2; + float flVal = 0.0f; + float x, y, x1, y1, x2, y2; + float ifdir[360] = {0}; + float mind = qMin(m_RightVal, m_LeftVal); + float maxd = qMax(m_RightVal, m_LeftVal); + float dirmax, dr; + float deps; + + // 深度范围(表格数据使用屏幕坐标) + float ftmpSdep = -m_iY2; + float ftmpEdep = -m_iY1; + + int tmp = ftmpSdep / nstep; + float flDep = tmp * nstep; + double pi = 3.1415926535; + + while (1) { + if ((flDep >= ftmpEdep + nstep) || flDep >= ftmpEdep) break; + + double tempf = flDep + nstep / 2.0; + double centerY = tempf * -1.0; + + // ====================== 1. 画最外层圆 ====================== + QCPItemEllipse* pEse = new QCPItemEllipse(this); + wPen.setWidth(m_rose_circle_line_width); + pEse->setPen(wPen); + pEse->m_bCustom = true; + pEse->m_nRadius = nR; + pEse->topLeft->setCoords(centerY, centerX); + pEse->bottomRight->setCoords(centerY, centerX); + + // ====================== 2. 画十字线 ====================== + for (int k = 0; k < 4; k++) { + QCPItemLine* pLine1 = new QCPItemLine(this); + pLine1->m_bCustom = true; + pLine1->m_dr = qDegreesToRadians(k * 90.0); + pLine1->m_nRadius = 0; + pLine1->m_nTailLen = nR; + pLine1->setPen(wPen); + pLine1->start->setCoords(centerY, centerX); + pLine1->end->setCoords(centerY, centerX); + } + + // ====================== 3. 方位标注 ====================== + if (m_bHint) { + int psize = 15; + flVal = m_nAzimStep * 360.0 / m_nArc; + for (int i = 0; i < 360; i += (int)flVal) { + QCPItemText* mItemTitle = new QCPItemText(this); + mItemTitle->position->setCoords(centerY, centerX); + mItemTitle->setText(QString::number(i)); + mItemTitle->setFont(m_pl_fontScale); + mItemTitle->setColor(m_rose_circle_line_color); + dr = i * 2 * pi / 360.0; + mItemTitle->m_fx = (nR + psize * 0.85) * sin(dr); + mItemTitle->m_fy = (nR + psize * 0.85) * cos(dr); + mItemTitle->m_bCustom = true; + } + } + + // ====================== 4. 辐射线 ====================== + if (m_bGrid) { + wPen.setWidth(1); + double st = 360.0 / m_nArc; + for (int i = 0; i < m_nArc; i++) { + int ntmp = i % 9; + if (ntmp != 0) { + QCPItemLine* pLine = new QCPItemLine(this); + pLine->m_bCustom = true; + pLine->m_dr = qDegreesToRadians(i * st); + pLine->m_nRadius = 0; + pLine->m_nTailLen = nR; + pLine->setPen(wPen); + pLine->start->setCoords(centerY, centerX); + pLine->end->setCoords(centerY, centerX); + } + } + } + + // ====================== 5. 辐射圈(同心圆) ====================== + if (m_bGrid) { + qreal currentRadius = 0; + for (int i = 0; i < m_nCircle; i++) { + QCPItemEllipse* pEseInner = new QCPItemEllipse(this); + pEseInner->setPen(wPen); + pEseInner->m_bCustom = true; + currentRadius -= nR * 1.0 / m_nCircle; + pEseInner->m_nRadius = currentRadius; + pEseInner->topLeft->setCoords(centerY, centerX); + pEseInner->bottomRight->setCoords(centerY, centerX); + } + } + + // ====================== 6. 表格数据统计方位 ====================== + memset(ifdir, 0, sizeof(ifdir)); + float x1Step = 360.0 / m_nArc; + + // 遍历所有裂缝点 + for (int i = 0; i < nPointNum; i++) { + FRAC_TABLE frac = m_FracTabList.at(i); + bool bDraw = false; + + // 匹配裂缝类型 + for (int j = 0; j < nFracType; j++) { + FRAC_DEF fd = m_FracDefList.at(j); + if ((int)frac.ID == fd.iCode) { + bDraw = m_bTypeDraw[j]; + break; + } + } + + if (!bDraw) continue; + + deps = frac.DEP; + + // 判断是否在当前统计深度段内 + if (deps >= flDep && deps < flDep + nstep) { + float dipVal = frac.DIPorS; + if (dipVal > maxd || dipVal < mind) continue; + + float dirVal = frac.DIR; + int j = dirVal / x1Step; + if (j >= 0 && j < m_nArc + 1) { + ifdir[j]++; + } + } + } + + // ====================== 7. 找最大值 ====================== + dirmax = 0; + int iIndex = -1; + for (int i = 0; i <= m_nArc; i++) { + if (dirmax < ifdir[i]) { + iIndex = i; + dirmax = ifdir[i]; + } + } + if (dirmax == 0) dirmax = 1; + + // ====================== 8. 绘制玫瑰瓣 ====================== + flVal = 2 * pi / m_nArc; + QPolygonF myPolygon; + float oldx = 9999, oldy = 9999; + + for (int i = 0; i <= m_nArc; i++) { + dr = i * flVal; + float px = ifdir[i] * nR * sin(dr) / dirmax; + float py = ifdir[i] * nR * cos(dr) / dirmax; + + if (oldx != px || oldy != py) { + myPolygon << QPointF(px, py); + oldx = px; oldy = py; + } + + dr = (i + 1) * flVal; + px = ifdir[i] * nR * sin(dr) / dirmax; + py = ifdir[i] * nR * cos(dr) / dirmax; + + if (oldx != px || oldy != py) { + myPolygon << QPointF(px, py); + oldx = px; oldy = py; + } + } + + // 绘制第一个玫瑰瓣 + if (iIndex >= 0) { + QCPItemPolygon* pol = new QCPItemPolygon(this); + pol->topLeft->setCoords(centerY, centerX); + pol->bottomRight->setCoords(centerY, centerX); + pol->setPoints(myPolygon); + + if (m_rose_fill_enabled) + m_rose_stress_line_color.setAlpha(255); + else + m_rose_stress_line_color.setAlpha(0); + + pol->setBrushColor(m_rose_stress_line_color); + } + + // ====================== 9. 绘制反向玫瑰瓣 ====================== + myPolygon.clear(); + float tempfArc = m_nArc / 2.0; + + for (int i = 0; i <= m_nArc; i++) { + dr = i * flVal - tempfArc * flVal; + float px = ifdir[i] * nR * sin(dr) / dirmax; + float py = ifdir[i] * nR * cos(dr) / dirmax; + + if (oldx != px || oldy != py) { + myPolygon << QPointF(px, py); + oldx = px; oldy = py; + } + + dr = (i + 1) * flVal - tempfArc * flVal; + px = ifdir[i] * nR * sin(dr) / dirmax; + py = ifdir[i] * nR * cos(dr) / dirmax; + + if (oldx != px || oldy != py) { + myPolygon << QPointF(px, py); + oldx = px; oldy = py; + } + } + + if (iIndex >= 0) { + QCPItemPolygon* pol2 = new QCPItemPolygon(this); + pol2->topLeft->setCoords(centerY, centerX); + pol2->bottomRight->setCoords(centerY, centerX); + pol2->setPoints(myPolygon); + pol2->setBrushColor(m_rose_stress_line_color); + } + + // ====================== 10. 绘制垮塌方向线 ====================== + if (m_bJykt && iIndex >= 0) { + QPen collapsePen(m_rose_collapse_line_color, 2); + + dr = iIndex * flVal - pi / 2; + x1 = ifdir[iIndex] * nR * sin(dr) / dirmax; + y1 = ifdir[iIndex] * nR * cos(dr) / dirmax; + + dr = iIndex * flVal + pi / 2; + x2 = ifdir[iIndex] * nR * sin(dr) / dirmax; + y2 = ifdir[iIndex] * nR * cos(dr) / dirmax; + + this->addQCPItemLine(this, centerY, centerX, QPointF(x1, y1), QPointF(x2, y2), collapsePen); + + // 小箭头 + dr = iIndex * flVal; + float x3 = 0.1 * ifdir[iIndex] * nR * sin(dr) / dirmax; + float y3 = 0.1 * ifdir[iIndex] * nR * cos(dr) / dirmax; + this->addQCPItemLine(this, centerY, centerX, QPointF(x1, y1), QPointF(x3, y3), collapsePen); + this->addQCPItemLine(this, centerY, centerX, QPointF(x3, y3), QPointF(x2, y2), collapsePen); + + dr = iIndex * flVal - pi; + x3 = 0.1 * ifdir[iIndex] * nR * sin(dr) / dirmax; + y3 = 0.1 * ifdir[iIndex] * nR * cos(dr) / dirmax; + this->addQCPItemLine(this, centerY, centerX, QPointF(x1, y1), QPointF(x3, y3), collapsePen); + this->addQCPItemLine(this, centerY, centerX, QPointF(x3, y3), QPointF(x2, y2), collapsePen); + } flDep += nstep; } + this->replot(); } diff --git a/logPlus/qmycustomplot.h b/logPlus/qmycustomplot.h index 67dd75e..ab79b31 100644 --- a/logPlus/qmycustomplot.h +++ b/logPlus/qmycustomplot.h @@ -663,6 +663,34 @@ public: int m_nArc, int m_rose_circle_radius_cm, int m_rose_radiation_circle_enabled, int m_rose_azimuth_print_interval, QColor m_rose_circle_line_color, int m_rose_circle_line_width, QColor m_rose_stress_line_color, QColor m_rose_collapse_line_color, bool m_rose_draw_radiation_line, bool m_rose_draw_wellbore_collapse, bool m_rose_fill_enabled, bool m_rose_draw_annotation, int nstep, float m_LeftVal, float m_RightVal); + void drawTabRose( + bool bTableData, + QString csCurveDDIR, + QString csCurveDANG, + QString qsDepth, + QString qsDIR, + QString qsDIP, + QString qsID, + QString csCurveGrad, + double m_LeftVal3, + double m_RightVal3, + QFont m_pl_fontScale, + int m_nArc, + int nR, + int m_nCircle, + int m_nAzimStep, + QColor m_rose_circle_line_color, + int m_rose_circle_line_width, + QColor m_rose_stress_line_color, + QColor m_rose_collapse_line_color, + bool m_bGrid, + bool m_bJykt, + bool m_rose_fill_enabled, + bool m_bHint, + int nstep, + float m_LeftVal, + float m_RightVal + ); void addQCPItemLine(QMyCustomPlot *widget, float cx, float cy, const QPointF& p1, const QPointF& p2, const QPen& wPen); private: From c8691b3983084812fa583c6cba309c3f38417e5a Mon Sep 17 00:00:00 2001 From: zhaolei <353719554@qq.com> Date: Fri, 10 Apr 2026 06:38:45 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E5=AF=BC=E5=85=A5lis=E6=A0=BC=E5=BC=8F?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E3=80=81=E5=90=8D=E7=A7=B0=E6=8E=92=E5=BA=8F?= =?UTF-8?q?=E3=80=81=E9=87=8D=E5=91=BD=E5=90=8D=E3=80=81=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E4=BA=95=E6=AC=A1=E3=80=81=E5=88=A0=E9=99=A4=E4=BA=95=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- logPlus/qmytreewidget.cpp | 30 +- logPlus/qmytreewidget.h | 3 + logPlus/qtprojectwidgets.cpp | 198 ++- logPlus/qtprojectwidgets.h | 5 + logPlusAll.pro | 3 + tran/LISConvertor/include/CStringType.h | 166 +++ tran/LISConvertor/include/LisConvertor.h | 64 + tran/LISConvertor/src/CStringType.cpp | 326 +++++ tran/LISConvertor/src/LisConvertor.cpp | 1428 ++++++++++++++++++++++ tran/LISConvertor/src/LisConvertor.pro | 77 ++ tran/LISConvertor/src/sub.cpp | 1361 +++++++++++++++++++++ tran/LISConvertor/src/sub.h | 28 + 12 files changed, 3672 insertions(+), 17 deletions(-) create mode 100644 tran/LISConvertor/include/CStringType.h create mode 100644 tran/LISConvertor/include/LisConvertor.h create mode 100644 tran/LISConvertor/src/CStringType.cpp create mode 100644 tran/LISConvertor/src/LisConvertor.cpp create mode 100644 tran/LISConvertor/src/LisConvertor.pro create mode 100644 tran/LISConvertor/src/sub.cpp create mode 100644 tran/LISConvertor/src/sub.h diff --git a/logPlus/qmytreewidget.cpp b/logPlus/qmytreewidget.cpp index cd07441..299bc46 100644 --- a/logPlus/qmytreewidget.cpp +++ b/logPlus/qmytreewidget.cpp @@ -58,22 +58,28 @@ void QMyTreeWidget::closeEditor ( QWidget * editor, QAbstractItemDelegate::EndEd return; } QString strTreeTag = item->data(0, Qt::UserRole).toString(); - CObjWellLog* pcopyingwelllog= new CObjWellLog(); - pcopyingwelllog->SetSlfFileName(strSlfName); - pcopyingwelllog->SetName(strOldName); - if(!pcopyingwelllog->RenName(strNewName)) - { - this->currentItem()->setText(0,strOldName); + if (strTreeTag != "wellItem" && strTreeTag != "wellname")//重命名表格、曲线、波列、参数表 + { + CObjWellLog* pcopyingwelllog= new CObjWellLog(); + pcopyingwelllog->SetSlfFileName(strSlfName); + pcopyingwelllog->SetName(strOldName); + if(!pcopyingwelllog->RenName(strNewName)) + { + this->currentItem()->setText(0,strOldName); // pObj->SetName(strOldName); // AfxMessageBox("无法改名,可能因重名等问题所致!"); QMessageBox::information(NULL, "提示", "无法改名,可能因重名等问题所致!"); } - //else { - //::GetObjectEvent().OnDeAttchData(pObj->GetSlfFileName(),strOldName); - //::GetObjectEvent().OnRefreshData(pObj->GetSlfFileName(),strNewName); - //} - delete pcopyingwelllog; - item->setData(0, Qt::UserRole + 3, strNewName); // 存储额外数据,波列卡 + //else { + //::GetObjectEvent().OnDeAttchData(pObj->GetSlfFileName(),strOldName); + //::GetObjectEvent().OnRefreshData(pObj->GetSlfFileName(),strNewName); + //} + delete pcopyingwelllog; + item->setData(0, Qt::UserRole + 3, strNewName); // 存储额外数据,波列卡 + } + + if (strTreeTag == "wellItem" || strTreeTag == "wellname")//井次或井名 + emit closeTreeEditor(); return; } void QMyTreeWidget::startDrag(Qt::DropActions supportedActions) diff --git a/logPlus/qmytreewidget.h b/logPlus/qmytreewidget.h index 5be8a9a..64bb7a7 100644 --- a/logPlus/qmytreewidget.h +++ b/logPlus/qmytreewidget.h @@ -18,6 +18,9 @@ public: ~QMyTreeWidget(); QString getCurrentItemString(); +Q_SIGNALS: + void closeTreeEditor(); + protected: virtual void startDrag(Qt::DropActions supportedActions); virtual void closeEditor ( QWidget * editor, QAbstractItemDelegate::EndEditHint hint ); diff --git a/logPlus/qtprojectwidgets.cpp b/logPlus/qtprojectwidgets.cpp index 5690d95..a9a89ff 100644 --- a/logPlus/qtprojectwidgets.cpp +++ b/logPlus/qtprojectwidgets.cpp @@ -11,6 +11,7 @@ #include "InDefTableDlg.h" #include "qtcommonclass.h" #include "CallManage.h" +#include "qmytreewidget.h" // #include "geometryutils.h" #include "LogIO.h" @@ -60,6 +61,8 @@ QtProjectWidgets::QtProjectWidgets(QWidget *parent) //为树 tree 创建信号槽,鼠标press时会触发对应的信号。 connect(ui->treeWidget, &QTreeWidget::itemPressed, this, &QtProjectWidgets::onItemClicked); + connect(ui->treeWidget, SIGNAL(closeTreeEditor()), this, SLOT(oncloseTreeEditor())); + //connect(ui->treeWidget, &QTreeWidget::itemChanged, this, &QtProjectWidgets::onItemChanged); // 设置选择模式为多选模式 @@ -90,6 +93,22 @@ void QtProjectWidgets::slotButtonNo() m_ReFlag=QDialogButtonBox::StandardButton::No; } +void QtProjectWidgets::slotAsendSort() +{ + foreach(QTreeWidgetItem *pItem, ui->treeWidget->selectedItems()) + { + pItem->sortChildren(0,Qt::AscendingOrder); + } +} + +void QtProjectWidgets::slotDesendSort() +{ + foreach(QTreeWidgetItem *pItem, ui->treeWidget->selectedItems()) + { + pItem->sortChildren(0,Qt::DescendingOrder); + } +} + ////初始化树图控件 //void QtProjectWidgets::initTreeWidget(QString fullPath, QString strProjectName) //{ @@ -351,6 +370,7 @@ void QtProjectWidgets::loadIndexSysTree(QTreeWidgetItem *parent, QString fileFul itemIndex->setText(0, wellname); itemIndex->setData(0, Qt::UserRole, "wellname"); // 存储额外数据,如ID itemIndex->setData(0, Qt::UserRole + 1, wellFile1); // 存储额外数据,项目名 + itemIndex->setData(0, Qt::UserRole + 2, wellname); // 存储额外数据,井名 // QIcon icon; icon.addPixmap(QPixmap(GetImagePath() + "well.png"), QIcon::Selected); @@ -873,6 +893,11 @@ void QtProjectWidgets::initWellNameTreeMenu(QMenu *menu, QTreeWidget *treeWidget connect(action_New, SIGNAL(triggered(bool)), this, SLOT(onEditWelllogRound())); menu->addAction(action_New); + QAction* action_ReName = new QAction("重命名", treeWidget); + action_ReName->setIcon(QIcon(GetImagePath() + "icon/Rename.png")); // 设置图标":/image/u174.png" + connect(action_ReName, SIGNAL(triggered()), this, SLOT(onReNameObject())); + menu->addAction(action_ReName); + action_New = new QAction("输出数据", treeWidget); action_New->setIcon(QIcon(GetImagePath() + "icon/outcurves.png")); // 设置图标 connect(action_New, SIGNAL(triggered(bool)), this, SLOT(onOutWellLogRound())); @@ -914,6 +939,11 @@ void QtProjectWidgets::initSlfNameTreeMenu(QMenu *menu, QTreeWidget *treeWidget) connect(action_New, SIGNAL(triggered(bool)), this, SLOT(onWelllogInformation())); menu->addAction(action_New); + QAction* action_ReName = new QAction("重命名", treeWidget); + action_ReName->setIcon(QIcon(GetImagePath() + "icon/Rename.png")); // 设置图标":/image/u174.png" + connect(action_ReName, SIGNAL(triggered()), this, SLOT(onReNameObject())); + menu->addAction(action_ReName); + menu->addAction(m_action_Paste); // @@ -934,6 +964,16 @@ void QtProjectWidgets::initTableFolderTreeMenu(QMenu *menu, QTreeWidget *treeWid QAction* action_New = new QAction("创建新表", treeWidget); action_New->setIcon(QIcon(GetImagePath() + "icon/CreateTable.png")); // 设置图标 connect(action_New, SIGNAL(triggered(bool)), this, SLOT(onCreateNewTable())); + menu->addAction(action_New); + + action_New = new QAction("升序", treeWidget); + action_New->setIcon(QIcon(GetImagePath() + "icon/AscendingOrder.png")); // 设置图标 + connect(action_New, SIGNAL(triggered(bool)), this, SLOT(slotAsendSort())); + menu->addAction(action_New); + + action_New = new QAction("降序", treeWidget); + action_New->setIcon(QIcon(GetImagePath() + "icon/DescendingOrder.png")); // 设置图标 + connect(action_New, SIGNAL(triggered(bool)), this, SLOT(slotDesendSort())); menu->addAction(action_New); menu->addAction(m_action_Paste); @@ -941,16 +981,46 @@ void QtProjectWidgets::initTableFolderTreeMenu(QMenu *menu, QTreeWidget *treeWid //初始化根节点(曲线表目录)-右键菜单 void QtProjectWidgets::initCurveFolderTreeMenu(QMenu *menu, QTreeWidget *treeWidget) { + QAction* action_New = new QAction("升序", treeWidget); + action_New->setIcon(QIcon(GetImagePath() + "icon/AscendingOrder.png")); // 设置图标 + connect(action_New, SIGNAL(triggered(bool)), this, SLOT(slotAsendSort())); + menu->addAction(action_New); + + action_New = new QAction("降序", treeWidget); + action_New->setIcon(QIcon(GetImagePath() + "icon/DescendingOrder.png")); // 设置图标 + connect(action_New, SIGNAL(triggered(bool)), this, SLOT(slotDesendSort())); + menu->addAction(action_New); + menu->addAction(m_action_Paste); } //初始化根节点(参数卡目录)-右键菜单 void QtProjectWidgets::initParCardFolderTreeMenu(QMenu *menu, QTreeWidget *treeWidget) { + QAction* action_New = new QAction("升序", treeWidget); + action_New->setIcon(QIcon(GetImagePath() + "icon/AscendingOrder.png")); // 设置图标 + connect(action_New, SIGNAL(triggered(bool)), this, SLOT(slotAsendSort())); + menu->addAction(action_New); + + action_New = new QAction("降序", treeWidget); + action_New->setIcon(QIcon(GetImagePath() + "icon/DescendingOrder.png")); // 设置图标 + connect(action_New, SIGNAL(triggered(bool)), this, SLOT(slotDesendSort())); + menu->addAction(action_New); + menu->addAction(m_action_Paste); } //初始化根节点(波列目录)-右键菜单 void QtProjectWidgets::initWaveFolderTreeMenu(QMenu *menu, QTreeWidget *treeWidget) { + QAction* action_New = new QAction("升序", treeWidget); + action_New->setIcon(QIcon(GetImagePath() + "icon/AscendingOrder.png")); // 设置图标 + connect(action_New, SIGNAL(triggered(bool)), this, SLOT(slotAsendSort())); + menu->addAction(action_New); + + action_New = new QAction("降序", treeWidget); + action_New->setIcon(QIcon(GetImagePath() + "icon/DescendingOrder.png")); // 设置图标 + connect(action_New, SIGNAL(triggered(bool)), this, SLOT(slotDesendSort())); + menu->addAction(action_New); + menu->addAction(m_action_Paste); } //新建项目 @@ -1763,16 +1833,24 @@ void QtProjectWidgets::onImportSingleWellLogData() // InterfaceWidget *pInterfaceWidget = new InterfaceWidget();//中间工作区 // pMainWindow->m_centerWidgets->addTab(pInterfaceWidget, "导入数据"); pai::datamodel::LoadAllPlugin("windows"); - QStringList listFiles;//=GetFileNames("选择数据文件",fileSuffix,QFileDialog::ExistingFiles); - QString file_name = QFileDialog::getOpenFileName(this,tr("打开测井数据文件"), "","*.txt", 0); - // listFiles.append(QString("D:/LogPlus/OutData/jph-307.txt")); - listFiles.append(file_name); DiDepthProgress DepthProgress; ConvertorManager::GetInstance().LoadAllConvertorPlugin(); ConvertorManager &pManager=ConvertorManager::GetInstance(); pManager.all=0; QVectorvSuffix=pManager.GetSupportFileExtensions(); QString fileSuffix("数据文件("); + for (int i=0;i vConvertor=pManager.GetSupportConvertors(listFiles[0], &DepthProgress); // if (vConvertor.empty()) return ; if (vConvertor.empty()) @@ -1982,7 +2060,7 @@ void QtProjectWidgets::onItemClicked(QTreeWidgetItem* item, int index) else if (strTreeTag == "Curve") { //曲线数据-右键菜单 - popMenu = _menuTableFolder; + popMenu = _menuCurveFolder; m_strSlfName = item->parent()->data(0, Qt::UserRole+1).toString();//从父节点(井次)获取slf } @@ -2030,6 +2108,116 @@ void QtProjectWidgets::onItemChanged(QTreeWidgetItem* item, int index) // } } +//勾选/不勾选树图节点 +void QtProjectWidgets::oncloseTreeEditor() +{ + QString newWellName,strTreeTag; + foreach(QTreeWidgetItem *pItem, ui->treeWidget->selectedItems()) + { + strTreeTag = pItem->data(0, Qt::UserRole).toString(); + } + + if(!m_strSlfName.isEmpty()&&strTreeTag == "wellItem") + { + QString path,Slfname, newSlfname; + foreach(QTreeWidgetItem *pItem, ui->treeWidget->selectedItems()) + { + QTreeWidgetItem *parentItem = pItem; + if (parentItem && m_strSlfName == parentItem->data(0, Qt::UserRole+1).toString()) + { + newWellName = parentItem->parent()->text(0); + newSlfname = parentItem->text(0); + } + } + GetWellNameAndPath(m_strSlfName,Slfname,path); + // QString newfile=path+"/"+Slfname+"_backup.slf"; + QString newfile=path+"/"+newSlfname+".slf"; + if(!QFile::rename(m_strSlfName,newfile)) + { + QMessageBox::information(NULL,"提示","重命名失败!"); + return ; + } + } + else if (strTreeTag == "wellname") + { + QString path,strWellName,Wellpath, newWellpath; + foreach(QTreeWidgetItem *pItem, ui->treeWidget->selectedItems()) + { + QTreeWidgetItem *parentItem = pItem; + if (parentItem && "wellname" == parentItem->data(0, Qt::UserRole).toString()) + { + strWellName = parentItem->data(0, Qt::UserRole + 2).toString(); + newWellName = parentItem->text(0); + } + } + + QString pathTmp=GetLogdataPath(); + Wellpath = pathTmp + g_prjname+"/#"+strWellName; + newWellpath = pathTmp + g_prjname+"/#"+newWellName; + + QDir ss; + if(ss.rename(Wellpath,newWellpath))//改目录名 + { + QString oldPath = newWellpath + "/" + strWellName + ".well"; + QString newPath = newWellpath + "/" + newWellName + ".well"; + if(ss.rename(oldPath,newPath)) + { + SetWellRoundWellName(newPath, newWellName); + + QStringList slffiles; + chakan(newWellpath, slffiles, "*.slf"); + foreach(QString slfFile1, slffiles ) + { + SetWellRoundWellName(slfFile1, newWellName); + } + } + else + { + QMessageBox::warning(NULL,"提示","改目文件名不成功:\n"+oldPath+"\n 到 \n"+newWellpath); + return; + } + } + else { + QMessageBox::warning(NULL,"提示","改目录名不成功:\n"+Wellpath+"\n 到 \n"+newWellpath); + return; + } + } + + QString strProjectFolder = GetProjectFolder(); + QString strProjectFile = strProjectFolder + g_prjname; + strProjectFile += ".wwl"; + s_OpenProject(strProjectFile); + + int topCount = ui->treeWidget->topLevelItemCount(); // 获取顶级节点数量 + if(topCount<1) + { + return; + } + + QTreeWidgetItem *item = ui->treeWidget->topLevelItem(0); + int childCount = item->childCount(); // 获取子节点数量 + for (int i = 0; i < childCount; ++i) + { + //井组,数据分析... + QTreeWidgetItem *wellGroupItem = item->child(i); + QString wellGroupname = wellGroupItem->text(0); + if (wellGroupname == "井组") + { + int wellCount = wellGroupItem->childCount(); // 获取井节点数量 + for (int j = 0; j < wellCount; ++j) + { + //井组,数据分析... + QTreeWidgetItem *wellItem = wellGroupItem->child(j); + QString wellname = wellItem->text(0); + if(wellname==newWellName)//井 + { + wellItem->setExpanded(true); + } + } + } + } +} + //向左侧树图,追加固井结论表格 void QtProjectWidgets::s_AddGujingToTree(QString strSlfName, QString strWellName, QString strLineName) { diff --git a/logPlus/qtprojectwidgets.h b/logPlus/qtprojectwidgets.h index b38893e..7bf42b7 100644 --- a/logPlus/qtprojectwidgets.h +++ b/logPlus/qtprojectwidgets.h @@ -23,16 +23,21 @@ public: private: Ui::QtProjectWidgetsClass *ui; +Q_SIGNALS: + void closeTreeEditor(); public slots: void slotButtonOk(); void slotButtonNo(); void slotButtonCancel(); + void slotAsendSort(); + void slotDesendSort(); //void s_initTreeWidget(QString strName);//初始化树图控件 void s_loadTreeWidget(QString fileFull);//加载树图 void onItemClicked(QTreeWidgetItem* item, int index);//鼠标点击tree菜单项 void onItemChanged(QTreeWidgetItem* item, int index);//勾选/不勾选 + void oncloseTreeEditor(); //重命名 //工区管理(项目) void onNewProject(bool checked = false); //新建项目 diff --git a/logPlusAll.pro b/logPlusAll.pro index cadf55c..64e13f9 100644 --- a/logPlusAll.pro +++ b/logPlusAll.pro @@ -21,6 +21,7 @@ SUBDIRS = \ ConvertorManager \ DataOutput \ SLFAscIIConvertor \ + LISConvertor \ DrawBase \ EditPlotHeader \ logPlus @@ -44,6 +45,7 @@ appDllTest.file = appDllTest/src/appDllTest.pro ConvertorManager.file = ConvertorManager/src/ConvertorManager.pro DataOutput.file = DataOutput/src/DataOutput.pro SLFAscIIConvertor.file = tran/SLFAscIIConvertor/src/SLFAsciiConvertor.pro +LISConvertor.file = tran/LISConvertor/src/LISConvertor.pro DrawBase.file = DrawBase/src/DrawBase.pro EditPlotHeader.file = EditPlotHeader/src/EditPlotHeader.pro logPlus.file = logPlus/logPlus.pro @@ -64,6 +66,7 @@ appDllTest.depends = Slfio ConvertorManager.depends = Slfio BaseFun OSGDataModel WellLogUI DataOutput.depends = Slfio BaseFun ConvertorManager SLFAscIIConvertor.depends = Slfio BaseFun OSGDataModel WellLogUI ConvertorManager +LISConvertor.depends = Slfio BaseFun OSGDataModel WellLogUI ConvertorManager DrawBase.depends = Slfio EditPlotHeader.depends = Slfio OSGDataModel logPlus.depends = Slfio BaseFun WellLogUI qtpropertybrowser ConvertorManager OSGDataModel DataOutput HPluginManage CallPlugin DataMgr DrawBase ModuleConsole WFEngine EditPlotHeader diff --git a/tran/LISConvertor/include/CStringType.h b/tran/LISConvertor/include/CStringType.h new file mode 100644 index 0000000..462f6f4 --- /dev/null +++ b/tran/LISConvertor/include/CStringType.h @@ -0,0 +1,166 @@ +/** +* @file CStringTyle.h +* @brief CString数据自定义、井以及井次结构体 +* @date 2014-10-10 +* @author: ZhouWenfei +*/ + +#ifndef PAI_FRAME_CSTRING_H__ +#define PAI_FRAME_CSTRING_H__ +#pragma once +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#pragma warning( push ,0) +//#include "BaseFunExport.h" +#pragma warning( pop ) +//#ifdef MessageBox +//#define MessageBox MessageBox +//#endif +#define MAX_PATH 1024 +//#define _MAX_PATH 1024 +#define MaxCurve 1024 +#define curve_name_len 256 +#define curve_unit_len 256 +#define MIN_RANK rank_char +#define MAX_RANK rank_longlong + +#define INTMAX_RANK rank_longlong +#define SIZE_T_RANK rank_long +#define PTRDIFF_T_RANK rank_long +#define MB_OK QMessageBox::Ok +typedef unsigned short WORD; +#ifdef WIN32 +typedef unsigned long DWORD; +typedef DWORD *LPDWORD; +typedef void *HANDLE; +#else +typedef unsigned int DWORD; +typedef DWORD *LPDWORD; +typedef void *HANDLE; +#endif +typedef unsigned char BYTE; +typedef char* LPSTR; +typedef void* LPVOID; + +class CString; +typedef QList CStringList; + +using namespace std; + + + +//#define REPR_INT 1 +//#define REPR_SHORT 2 +//#define REPR_LONG 3 +//#define REPR_FLOAT 4 +//#define REPR_DOUBLE 5 +//#define REPR_STRING 6 +//#define REPR_CHAR 7 +//#define REPR_UCHAR 8 +//#define REPR_USHORT 9 +//#define REPR_UINT 10 +//#define REPR_ULONG 11 +//class BASEFUN_EXPORT CString; + +//构建CString +class CString +{ +public: + CString(const char *str = nullptr); + CString(const QString str); + CString(const CString &other); + ~CString(); + + int GetLength()const; + int Find(char *str); + int Find(char str); + int Find(CString &another); + int Find(char str[],int start); + int ReverseFind(char ch); + int Insert(int pos ,const CString Sctr); + int Replace(const char *Src,const char *Dest); + CString & TrimLeft(); + CString & MakeUpper(); + CString& MakeLower(); + CString & TrimRight(); + bool operator==(const char* other ); + bool operator!=(const char* other ); + bool operator==(const CString& other ); + bool operator!=(const CString& other ); + char operator[](int i); + CString Right(int count)const; + CString Left(int count)const; +// CString operator = (const QString& SrcStr) ; + CString operator + (const CString& SrcStr) ; + CString operator += (CString& SrcStr) ; + CString operator += (const CString& SrcStr) ; + char* GetString()const; + char GetChar(int n); + char GetAt(int n); + CString Mid(int pos,int count)const; + CString Mid(int pos)const; + void Format(const char *format,...); + void Delete(int fromIndex,int length); +// const char *m_temp; + void Alloc(int len); + void Empty(); +private: + QString m_data; +}; + + + + + +enum flags { +FL_SPLAT0 = 0x00,/* Drop the value, do not assign */ + +FL_SPLAT = 0x01,/* Drop the value, do not assign */ +FL_INV = 0x02,/* Character-set with inverse */ +FL_WIDTH = 0x04,/* Field width specified */ +FL_MINUS = 0x08,/* Negative number */ + +}; + +enum ranks { + +rank_char = -2, +rank_short = -1, +rank_int = 0, +rank_long = 1, +rank_longlong = 2, +rank_ptr = INT_MAX/* Special value used for pointers */ + +}; + + + +enum bail { + + bail_none = 0,/* No error condition */ + bail_eof,/* Hit EOF */ + bail_err/* Conversion mismatch */ + +}; +int AfxMessageBox(CString str); +int MessageBox(QWidget *parent,char lpText[128],char*lpCaption, int UINTuType); +void ShowMessage(QString mess); + +//构建AfxMessageBox()函数 +//extern int BASEFUN_EXPORT AfxMessageBox(CString str); +//extern int BASEFUN_EXPORT MessageBox(QWidget *parent,char lpText[128],char*lpCaption, int UINTuType); +// using namespace pai::graphics; +#endif + diff --git a/tran/LISConvertor/include/LisConvertor.h b/tran/LISConvertor/include/LisConvertor.h new file mode 100644 index 0000000..db21e06 --- /dev/null +++ b/tran/LISConvertor/include/LisConvertor.h @@ -0,0 +1,64 @@ +/** +* @file CLisConvertor.h +* @brief LisConvertor格式解析器(解析Forward的txt格式文件) +* @date 2014-7-29 +* @author: ZhouWenfei +*/ +#ifndef PAI_FRAME_FOWWARDCONVERTOR_H__ +#define PAI_FRAME_FOWWARDCONVERTOR_H__ + +#pragma warning( push ,0) + +#include "IConvertor.h" +#include "ConvertorManager.h" +#include "ObjectID.h" +#include "InterIConvertor.h" + +#pragma execution_character_set("utf-8") + +#pragma warning( pop ) +BEGIN_OSGGRAPHICS_NAMESPACE; + +class CLisConvertor :public InterIConvertor +{ + +public: + + CLisConvertor(); + + ~CLisConvertor(); + +public: + + virtual int ScanLogFile(char *FileName,char *Message,char **CurveName,char **CurveUnit); + virtual bool Transfer(char *FileName,char *outfile,int *OutCurveNo,char **OutCurve,char **strChineseName,char **strUnit,int dCurveNum); + + /** + * @brief 该格式解析器支持的文件后缀名 + * @return QVector this convertor support all suffix file + */ + virtual QVectorGetSupportFileExtensions(); + +private: + + + /** + * @brief 初始化格式解析器支持的文件所有的后缀名 + */ + + virtual void InitFormatSuffixName(); + + + +private: + bool isSpLis; + int ngapbyteSpFirst; + +private: + + QVectorm_vFileFormatSuffixName; + QVectorm_vCurvefileName; +}; +END_OSGGRAPHICS_NAMESPACE +using namespace pai::graphics; +#endif diff --git a/tran/LISConvertor/src/CStringType.cpp b/tran/LISConvertor/src/CStringType.cpp new file mode 100644 index 0000000..346f5dd --- /dev/null +++ b/tran/LISConvertor/src/CStringType.cpp @@ -0,0 +1,326 @@ +#include "CStringType.h" +#include +char *m_temp=NULL; +CString::CString(const char *str) +{ + m_temp=NULL; + if(str==NULL) + m_data =""; + else + m_data=QString::fromLocal8Bit(str); +} +CString::CString(const QString str) +{ + m_temp=NULL; + if(str==NULL) + m_data =""; + else + m_data=str; +} + +CString::~CString() +{ + if(m_temp) delete m_temp; + m_temp=NULL; +}; +void CString::Empty() +{ + m_data =""; +} + +CString::CString(const CString &other) +{ + m_temp=NULL; + m_data=other.m_data; +} +int CString::GetLength()const +{ + return m_data.length(); +} +int CString::Find(char *str) +{ + std::string dataStr=m_data.toStdString(); + return dataStr.find(str); +} +int CString::Find(CString &another) +{ + return m_data.toStdString().find(another.m_data.toStdString()); +} +int CString::Find(char str) +{ + std::string dataStr=m_data.toStdString(); + return dataStr.find(str); +} +/* + +*/ +int CString::Find(char str[],int start) +{ + std::string dataStr=m_data.toStdString(); + int npos=dataStr.find(str); + if(npos==-1) + return -1; + if(nposStrVector; + int left=0; + for (int i=0;i-1;i--) + { + if(tempstr[i]==findStr.at(0)) { + continue; + } + else { + flag=i; + break; + } + } + m_data=temp.left(flag+1); + return *this; +} +bool CString::operator==(const char* other ) +{ + QString srcStr=QString::fromLocal8Bit(other); + if(this->m_data==srcStr) + return true; + return false; +} +bool CString::operator!=(const char* other ) +{ + QString srcStr=QString::fromLocal8Bit(other); + if(this->m_data!=srcStr) + return true; + return false; +} +char CString::operator[](int i) +{ + char ch=GetChar(i); + return ch; +} +CString CString::Right(int count)const +{ + if (count<0) + { + count=0; + } + if (count>m_data.length()) + { + return *this; + } + int length=m_data.length(); + QString temp=m_data; + QString lastdata=temp.remove(0,length-count); + CString RightStr(lastdata); + return RightStr; +} +CString CString::Mid(int pos,int count)const +{ + if (count<0) + { + count=0; + } + QString temp=m_data.mid(pos,count); + CString mstr(temp); + return mstr; +} +CString CString::Mid(int pos)const +{ + QString temp=m_data.mid(pos); + CString mstr(temp); + return mstr; +} + +CString CString::Left(int count)const +{ + if (count<0) + { + count=0; + } + if (count>m_data.length()) + { + return *this; + } + int length=m_data.length(); + QString temp=m_data; + QString lastdata=temp.remove(count,length-count); + CString leftStr(lastdata); + return leftStr; +} + +CString CString::operator + (const CString& SrcStr) +{ + CString str; + str.m_data=m_data+SrcStr.m_data; + return str; +} +/* +CString CString::operator = (const QString& SrcStr) +{ +CString str; +str.m_data=SrcStr; +return str; +} +*/ +CString CString::operator += (CString& SrcStr) +{ + m_data = m_data+SrcStr.m_data ; + return *this; +} +CString CString::operator += (const CString& SrcStr) +{ + m_data = m_data+SrcStr.m_data ; + return *this; +} +bool CString::operator!=(const CString& other ) +{ + return m_data!=other.m_data; +} +bool CString::operator==(const CString& other ) +{ + return m_data==other.m_data; +} + +void CString::Alloc(int len) +{ +} +char* CString::GetString() const +{ + int length=((string)(m_data.toLocal8Bit().data())).length(); + if(m_temp) delete m_temp; + m_temp=new char[length+1]; + // Alloc(length); + strcpy(m_temp,m_data.toLocal8Bit().data()); + return m_temp; +} +char CString::GetChar(int n) +{ + return GetString()[n]; +} +char CString::GetAt(int n) +{ + return GetChar(n); +} + +void CString::Format(const char *format,...) +{ + //char *str=GetString(); + va_list args; + va_start(args,format); + m_data.vsprintf(format,args); + char *buf=new char[2*strlen(m_data.toStdString().c_str())+1]; + vsprintf(buf,format,args); + m_data=buf; + delete buf; + va_end(args); +} +void ShowMessage(QString mess) +{ + QDialog dialog(NULL); + dialog.setModal(false); + Qt::WindowFlags flags = dialog.windowFlags(); + flags |= Qt::WindowStaysOnTopHint; + flags &= ~Qt::WindowContextHelpButtonHint; + dialog.setWindowFlags(flags); + dialog.setWindowTitle("提示"); + QFormLayout form(&dialog); + QLabel edit(&dialog); + form.addRow(&edit); + edit.setText(mess); +// QDialogButtonBox buttonBox(QDialogButtonBox::Yes,Qt::Horizontal, &dialog); +// form.addRow(&buttonBox); +// if(buttonBox.button(QDialogButtonBox::Yes)) buttonBox.button(QDialogButtonBox::Yes)->setText("退出"); +// QObject::connect(buttonBox.button(QDialogButtonBox::Yes), SIGNAL(clicked()), NULL, SLOT(reject())); + dialog.show(); + dialog.exec(); +} +int AfxMessageBox(CString str) +{ + QDialog dialog(NULL); + dialog.setModal(false); + Qt::WindowFlags flags = dialog.windowFlags(); + flags |= Qt::WindowStaysOnTopHint; + flags &= ~Qt::WindowContextHelpButtonHint; + dialog.setWindowFlags(flags); + dialog.setWindowTitle("提示"); + QFormLayout form(&dialog); + form.addWidget(new QLabel(str.GetString())); +// dialog.show(); + if (dialog.exec() == QDialog::Accepted) { + // Do something here + } +// return MessageBox(NULL,"提示",str.GetString(),NULL ); +// QString cstr=str.GetString(); +// QMessageBox msgBox; +// msgBox.setText(cstr); +// return msgBox.exec(); + return 1; +} + +int MessageBox(QWidget *parent,char lpText[128],char*lpCaption, int UINTuType) +{ + if (!parent) + { + char *tempName=lpCaption; + QString addStr=QString::fromLocal8Bit(tempName); + return QMessageBox::information(NULL,lpText,addStr,QMessageBox::Ok); + } + return 0; +} diff --git a/tran/LISConvertor/src/LisConvertor.cpp b/tran/LISConvertor/src/LisConvertor.cpp new file mode 100644 index 0000000..7c569df --- /dev/null +++ b/tran/LISConvertor/src/LisConvertor.cpp @@ -0,0 +1,1428 @@ +#pragma warning( push ,0) +#include"LisConvertor.h" +#include +#include + +#include "CStringType.h" +#include "MemRdWt.h"/*..\..\Slfio\*/ +#include "BaseFun.h" +// #include "WellBaseInfo.h" +#include "DepthProgress.h" +#include "sub.h" +#include "qdir.h" +#define IREEL 0x0084 +#define ITAPE 0x0082 //130 +#define IFILE 0x0080 //128 +#define IFORM 0x0040 //64 +#define IDATA 0x0000 +#define IFAIL 0x0081 //129 +#define ITRAIL 0x0083 //131 +#define IRAIL 0x0085 //133 +#define ISL 0x42FF //17151 +#define IDEP1 0x4954 //18772 +#define IDEP2 0x454D // 17741 + +//20201216 GZL add +#define EACHCALNUM 1 +//132 Vol.(REEL)_HEADER information +//133 Vol.(REEL)_TRAIL information +//130 TAPE_HEADER information +//131 TAPE_TRAIL information +//128 FILE_HEADER information +//129 FILE_TRAIL information +//232 COMMENT record information +//34 INFORMATION record information +//64 FORMAT SPECIFICATION record information +//0 data +float rlev,dep,sdep,edep; +char curvnms[3000][5],units[3000][5],depunit[5],levunit[5]; +int ircodes[3000],npoints[3000],nsamps[3000],ipost[3000],iexst[3000],ndim[3000]; +int ncurvs,lframe,nframe,modep; +FILE *fp; +int Numlog; +int skip,TapeRlev; +int neofbyte,ngapbyte; +unsigned char buff[400000]; +float value[100000]; +WELL_DYNAMIC_INFO *mWellDynamicInfo; +#pragma warning( pop) +BEGIN_OSGGRAPHICS_NAMESPACE; +#define GetLisConvertorTypeID() "{75B4CBA4-AF9D-4FEF-AA81-49CE697E158C}" + +Slf_FILE_MESSAGE FILE_MESSAGE={}; + +BEGIN_REGISTER_ID_DESCRIPTION() + ID_ITEM_DATA(GetLisConvertorTypeID(),"LisConvertor") +END_REGISTER_ID_DESCRIPTION(); + +int intMax(int *arr, int arrnum){ + int maxTemp = 0; + for(int i; i < arrnum; i++) + if (maxTemp < arr[i]) + maxTemp = arr[i]; + return maxTemp; +} + +template +void removeRedunant(T1& r_v, const T2 Re_v) +{ + if(Re_v == 0) return; + bool isNeg = (r_v < 0) ? true : false; + r_v = float(int(abs(r_v) * Re_v + 0.5)) / Re_v; + r_v = (isNeg) ? -r_v : r_v; +} + +template +bool cal_SaveNumInf(const OT1 outsdep,const OT1 outedep,const OT1 outrlev, OT1 eachStartDep,IT2& value2Index,IT2& realSaveNum,OT1& saveStartDep) +{ + removeRedunant(eachStartDep, 1000); + + if(eachStartDep >outsdep-outrlev && eachStartDep temp_MaxSaveNum) ? temp_MaxSaveNum : realSaveNum; //本轮可容纳点数 + value2Index = 0; //从起始位置即可 + saveStartDep = eachStartDep; + + return true; + } + else if(eachStartDep < outsdep) //处于输出范围前侧 + { + value2Index = abs((outsdep - eachStartDep) / outrlev); //范围内位置 + + if(value2Index <= realSaveNum) //包含有效数据 + { + realSaveNum = realSaveNum - value2Index; + saveStartDep = outsdep; + + return true; + } + else //不包含有效数据 + { + realSaveNum = 0; + saveStartDep = outsdep; + + return false; + } + } + + return false; +} + +CLisConvertor::CLisConvertor() +{ + m_thisModuleName="LisConvertor"; + isSpLis = false; + m_CurveData.Curve_Num=0; + m_CurveData.Curve_Step=0.0; + m_CurveData.Curve_StartDepth=0.0; + m_CurveData.Curver_EndDepth=0.0; + m_CurveData.Curver_MaxDim=0; + InitFormatSuffixName(); +} +CLisConvertor::~CLisConvertor() +{ +} +QVector CLisConvertor::GetSupportFileExtensions() +{ + return m_vFileFormatSuffixName; +} + +void CLisConvertor::InitFormatSuffixName() +{ + m_vFileFormatSuffixName.clear(); + m_vFileFormatSuffixName.push_back("lis"); + m_vFileFormatSuffixName.push_back("dat"); + m_vFileFormatSuffixName.push_back("nti"); + QVector suffixname=InterIConvertor::GetSupportFileExtensions(); + m_vFileFormatSuffixName+=suffixname; +} + +int CLisConvertor::ScanLogFile(char *FileName,char *Message,char **CurveName,char **CurveUnit) +{ + isSpLis = false; + char szTemp[128]; + strcpy(szTemp, "[LIS]"); + int pos1=GetBeginPosit(FileName,szTemp); + mWellDynamicInfo=&WellDynamicInfo; + if((fp=fopen(FileName,"rb"))==NULL) { + strcpy(szTemp, "Open Not File:"); + MessageBox(NULL,FileName,szTemp,MB_OK); + return 0; + } + char path[256]; + //CString TempPath=GetBinDir(path);; + CString TempPath=GetLogdataPath(); + TempPath=TempPath+"\\Temp"; + + QDir *temp=new QDir; + bool bWorking=temp->exists(TempPath.GetString()); + if(!bWorking) + { + bWorking=temp->mkdir(TempPath.GetString()); + CString aaa; + aaa.Format("创建临时文件路径%s失败",TempPath); + if(!bWorking) + { + AfxMessageBox(aaa); + fclose(fp); + return -1; + } + } + delete temp; + CString te="\\"; + TempPath+=te; + char filename[128]; + sprintf(filename,"%stemp",TempPath.GetString()); + //FILE *out; + //out=fopen(filename,"w+t"); + int maxrl=8196 ; + float abstrv=-999.25; + + char mbuf[5000]; + //float value[100000]; + int len=maxrl,idrt,lrtype; + //whp add 2019.8.6 for:后缀为dat的数据很多,首先根据LIS数据特征精确判断是否为LIS数据 + QString ext; + ext=QString(QLatin1String(FileName)); + ext=ext.toUpper(); + if(ext.endsWith(".DAT")) + { + len=fread(buff,336,1,fp); + if(len<=0){ + fclose(fp); + return -1; + } + int i1=-1,i2=-1,i3=-1; + for(int i=0;i<336;i++) + { + if(buff[i]=='\/') + { + i1=i;break; + } + } + if(i1<30){ + fclose(fp); + return -1; + } + for(int i=0;i<336;i++) + { + if(buff[i]>=48&&buff[i]<=57) + { + i2=i;break; + } + } + if(i2<0){ + fclose(fp); + return -1; + } + for(int i=i1-30;i<336;i++) + { + if(buff[i]==128) + { + i3=i;break; + } + } + if(i3<0){ + fclose(fp); + return -1; + } + if(((buff[4] >= 65 && buff[4] <= 122) ||buff[4]==32) && ((buff[5] >= 65 && buff[5] <= 122)||buff[5]==32)) + { + fclose(fp); + return -1; + } + fseek(fp,0L,0); + } + BOOL HaveFileTailRec=0;//有的文件没有文件尾记录 + //add end + int istat=fread(buff,len,1,fp); + for(int i=0;i0) + { + //特殊lis检查 + int lrtypeSp; + lrcls(buff[k+2],&idrt,&lrtypeSp); + if(lrtype==128 && lrtypeSp == 128){ + i+=2; + ngapbyteSpFirst = i; + isSpLis = true; + } + + ngapbyte=i; + neofbyte=ngapbyte; + goto L10; + } + } + } +L10:skip=0,TapeRlev=0; + if(neofbyte==22)//&&strstr(buff,"FORWARD TAPE IMAGE")) this is FORWARD TAPE IMAGE + { + TapeRlev=8; + skip=22-8; + ngapbyte=TapeRlev; + } +//for 进度条 + fseek(fp,0,SEEK_END); + DWORD fl=ftell(fp); + DWORD FileLength=fl; + //MyDepthProgress.CreatProgress(0,fl/100000,"扫描LIS格式文件"); + + if(m_pDepthProgress) m_pDepthProgress->SetShowName("格式类型:LIS",0); + if(m_pDepthProgress) { + m_pDepthProgress->CreatProgress(0,100,"信息提取..",1);//m_pDepthProgress->CreatProgress(0,fl,"信息提取..",1); + m_pDepthProgress->SetDepth(0,1); + } + + fseek(fp,skip,0);//跳过字节数,如forward下载的lis文件就有22个字符的说明信息 + int ntbyte=0; + int lrtype0=-99; + int nlr=0; + int nfile=0; + // read a logical record (many physical record). + int lbuff,istats,nbyte; + float rlevfc,depfc,rlevd,vsdep,vedep; + int ifged=0,ifgst=0,irec=0,nlrdat=0; + CString str; + strcpy(Message,"\r\n---------------------SCHLUMBERGER LIS 格式文件信息---------------------------\r\n"); + ncurvs=0; + int rec=0; + while(1) + { + rec++; + int f=ftell(fp); + if(f<0) break; + rdbuf(fp,buff,&lbuff,&lrtype,&istats,maxrl,&nbyte,ngapbyte); + + //20210115 GZL ADD + if(isSpLis)ngapbyte=8; + int percent=(float)f*100./(float)FileLength; + if(m_pDepthProgress) + { + if(!(m_pDepthProgress->SetDepth(percent,1))) { + fclose(fp); + return -1;//if(!(m_pDepthProgress->SetDepth(f,1))) return -1; + } + } + if(istats<=0)break; + if(lrtype!=lrtype0) + { + //str.Format("lbuff,lrtype,nrecs=%d,%d,%d\r\n",lbuff,lrtype,nlr); + //sprintf(Message,"%s%s",Message,str); + //AfxMessageBox(str); + str=""; + } + lrtype0=lrtype; + // write vol.(reel)_header information. + if(lrtype==132) + { + str=reelhd((char *)buff); + } + // write vol.(reel)_trail information. + else if(lrtype==133) + { + + strncpy(mbuf,(char *)&buff[2],lbuff-3+1); + mbuf[lbuff-3+1]=0; + str.Format("*** reel trail *** %s",mbuf); + // skip vol.(reel) trail bytes (2 eof) + len=neofbyte*2; + if(len>0) + { + istat=fread(buff,len,1,fp); + if(istat<=0) break; + } + ntbyte=ntbyte+neofbyte*2; + sprintf(mbuf,"ntbytes = %d\r\n two eof \r\n",ntbyte); + str+=CharToCstring(mbuf,strlen(mbuf)); + } + // write tape_header information. + else if(lrtype==130) + { + str=tapehd((char *)buff); + // skip eof(file end) bytes(a eof). + len=neofbyte; + if(len>0) { + istat=fread(buff,len,1,fp); + if(istat<=0)break; + } + ntbyte=ntbyte+neofbyte; + str.Format(str.GetString(),"ntbytes = %d\r\n a eof \r\n",str,ntbyte); + } + // write tape_trail information. + else if(lrtype==131) + { + + strncpy(mbuf,(char *)&buff[2],lbuff-3+1); + mbuf[lbuff-3+1]=0; + str.Format("*** tape trail *** %s\r\n",mbuf); + } + // write file_header information. + else if(lrtype==128) + { + nfile=nfile+1; + str.Format("\r\n *** file number:%d\r\n",nfile); + str+=CString("\r\n *** file header ***\r\n\r\n-----------------------------------\r\n")+filehd((char *)buff,&maxrl); + // str.Format("%s maxrl=%d\r\n",str,maxrl) ; + // AfxMessageBox(str); + } + // write file_trail information. + else if(lrtype==129) + { + HaveFileTailRec=1; + rlev=rlev*rlevfc; + rlevd=(vedep-vsdep)/float(ifged-ifgst); + if(fabs(rlev-rlevd)>0.0001&&fabs(rlev)<0.0001) + { + rlev=rlevd; + } + + //20220815 + if(rlev<0) + rlev=float(int((rlevd-0.000005)*100000))/100000; + else + { + float temp_rlev = float(int((rlevd+0.000005)*100000))/100000; + if(temp_rlev != float(int(rlevd*100000)/100000) && temp_rlev > rlev) + { + rlev = temp_rlev; + } + } + + + + //3???modep=0时,space没赋值,rlev就不能满足条件if(fabs(rlev-rlevd)>0.0001&&fabs(rlev)<0.0001),所以得到的rlev值是不正确的 + //whp add + if(modep==0&&rlev<-9999) + { + rlev=rlevd; + float del=fabs(fabs(rlev)-0.1); + if(del<0.001)rlev=0.1; + }//add end + sdep=vsdep; + edep=vedep; + // str.Format(("irec,nlrdat=%d %d\r\nvsdep,vedep=%f% f\r\nifgst,ifged=%d %d\r\nsdep,edep,rlev=%f %f %f\r\n"),irec,nlrdat,vsdep,vedep,ifgst,ifged,sdep,edep,rlev); + + strncpy(mbuf,(char *)&buff[2],lbuff-3+1); + + str+=CString("\r\n\r\n*** file trail ***\r\n\r\n----------------------------------\r\n"); + str+=filehd((char *)buff,&maxrl); + // skip eof (file end) bytes(a eof). + len=neofbyte; + if(len>0) + { + istat=fread(buff,len,1,fp); + if(istat<=0)break; + } + ntbyte=ntbyte+neofbyte; + str+=CString("\r\na eof !\r\na eof !\r\n"); + } + // write comment record information. + else if(lrtype==232) + { + //strncpy(mbuf,(char *)&buff[2],lbuff-3+1); + //str.Format("*** comment: ***%s",mbuf); + } + // write information record information. + else if(lrtype==34) + { + //iswinft=1; + // infrec(nu,buff,lbuff,iswinft); + str=infrec((char *)buff,lbuff,0); + str=""; + } + // write format specification record information. + else if(lrtype==64) + { + str=formsp((char*)buff,lbuff,1); + depfc=unitfactor(depunit,4); + rlevfc=unitfactor(levunit,4); + } + else if(lrtype==0) + { + nlrdat=nlrdat+1; + int nfrm=(lbuff-2)/lframe; + if(nfrm!=nframe) + { + nframe=nfrm; + CString ss; + ss.Format(("nrecs,lbuff,nframe=%d %d %d\r\n"),lrtype,lbuff-2,nframe); + str+=ss; + } + else str=""; + float dep0;//whp add + for(int i=0;i0.01&&ifgst==0&&fabs(dep+9999.)>0.01) + { + ifgst=irec; + vsdep=dep; + if(irec!=1) + { + CString ss; + ss.Format("irec=%d,warning! depth track value error.",irec); + AfxMessageBox(ss); + } + } + if(abs(dep+abstrv)>0.01&&abs(dep+9999.)>0.01) + { + ifged=irec ; + vedep=dep; + } + } + } + sprintf(Message,"%s%s",Message,str.GetString()); + } + Numlog=ncurvs;//+1; + sprintf(&Message[strlen(Message)],"\r\n曲线条数:%d\r\n\r\n起始深度:%g 终止深度:%g \r\n采样间隔:%g\r\n\r\n",Numlog,sdep,edep,rlev); + fclose(fp); + //whp add 2019.8.8 for 有的文件没有文件尾记录 + if(HaveFileTailRec==0)//如果没有文件尾记录 + { + AfxMessageBox("该文件没有文件尾记录"); + rlev=rlev*rlevfc; + rlevd=(vedep-vsdep)/float(ifged-ifgst); + double gg=fabs(rlev-rlevd); + if(fabs(rlev-rlevd)>0.0000000001&&fabs(rlev)<0.1) + { + rlev=rlevd; + } + //20210115 GZL ADD + if(1) + if(rlev<0) + rlev=float(int((rlevd-0.000005)*100000))/100000; + else + rlev=float(int((rlevd+0.000005)*100000))/100000; + + //modep=0时,space没赋值,rlev就不能满足条件if(fabs(rlev-rlevd)>0.0001&&fabs(rlev)<0.0001),所以得到的rlev值是不正确的 + if(modep==0&&rlev<-9999) + { + rlev=rlevd; + float del=fabs(fabs(rlev)-0.1); + if(del<0.001)rlev=0.1; + } + sdep=vsdep; + edep=vedep; + if(sdep>edep) + { + float temp=sdep; + sdep=edep; + edep=temp; + } + str.Format(("\r\n\r\n曲线条数=%d\r\n起始深度:%g 终止深度:%g \r\n采样间隔:%g\r\n\r\n"),ncurvs,sdep,edep,rlev); + str+="\r\na eof !\r\na eof !\r\n"; + sprintf(Message,"%s%s",Message,str.GetString()); + for(int i=0;iedep) + { + float temp=sdep; + sdep=edep; + edep=temp; + rlev=-1*fabs(rlev); + } + + PutScanDepthMes(Message,sdep,edep); + //fclose(out); + return Numlog; +} +bool CLisConvertor::Transfer(char *FileName,char *outfile,int *OutCurveNo,char **OutCurve,char **strChineseName,char **strUnit,int dCurveNum) +{ + if(HaveSameCurve(Numlog,OutCurveNo,OutCurve)) + return 0; + + removeRedunant(rlev, int(10000)); + + float xCoord = 0, yCoord = 0, outsdep = -99999, outedep = -99999, outrlev = rlev; + char *p; + p = outfile; + int len = strlen(p) + 1; + p += len; + GetTranMes(p, &xCoord, &yCoord, &outsdep, &outedep); + + outsdep = (outsdep == -99999.) ? sdep : outsdep; + outedep = (outedep == -99999.) ? edep : outedep; + if(outsdep > outedep) + { + swap(outsdep, outedep); + } + + CMemRdWt m_SlfFile(outfile); + if(m_SlfFile.mFile == NULL) return 0; + + Slf_CURVE myCurve; + Slf_WAVE myWave; + Slf_CHANNEL m_Channel; + Slf_WAVE **tslfwave = NULL; + + if(xCoord != -99999 && yCoord != -99999) + { + char buf[256]; + QString strWellInfo= "井基本信息"; + strcpy(buf, strWellInfo.toLocal8Bit().data()); + int index = m_SlfFile.FindObjectIndex(buf); + int indexSTable = m_SlfFile.OpenSTATIC(buf); + + m_SlfFile.WriteTable(indexSTable, 1, &WellStaticInfo); + m_SlfFile.CloseTable(indexSTable); + int indexDTable=m_SlfFile.OpenDYNAMIC(buf); + m_SlfFile.WriteTable(indexDTable, 1, &WellDynamicInfo); + m_SlfFile.CloseTable(indexDTable); + } + + int pointnum = 0; + + for(int i = 0; i < ncurvs; i++) + { + if(OutCurveNo[i] > -1) + { + #pragma region 获取name + char name[20]; + strncpy(name, OutCurve[i], 16); + for(int ij = 1; ij < 16; ij++) + { + if(name[ij] == ' ') + name[ij] = '\0'; + else + name[ij] = toupper(name[ij]); + } + #pragma endregion + + #pragma region 初始化曲线进slf + if(ndim[i] <= 1) + { + int index = m_SlfFile.OpenCurve(name); + if(index < 0) + { + strcpy(myCurve.Name,name); + strcpy(myCurve.AliasName,strChineseName[i]); + strcpy(myCurve.Unit,strUnit[i]); + strcpy(myCurve.AliasUnit,strUnit[i]); + + if(ircodes[i]==79) myCurve.RepCode=REPR_SHORT; + else if(ircodes[i]==73) myCurve.RepCode=REPR_INT; + else myCurve.RepCode=REPR_FLOAT; + + myCurve.CodeLen=RepSize[myCurve.RepCode]; + myCurve.MinValue=99999.0; + myCurve.MaxValue=-99999.0; + myCurve.DefVal=-9999; + myCurve.StartDepth=outsdep; + myCurve.EndDepth =outedep; + myCurve.DepLevel =fabs(rlev)/npoints[i]; + strcpy(myCurve.DepthUnit,"m"); + + OutCurveNo[i] = m_SlfFile.OpenCurve((Slf_CURVE *)&myCurve); + } + else + OutCurveNo[i] = m_SlfFile.OpenCurve(name); + + //pointnum 所需数据点个数 + pointnum = (myCurve.EndDepth - myCurve.StartDepth) / myCurve.DepLevel + 1.5; + + //仅为该曲线开空间 --> curvebuf + char *curvebuf = new char[myCurve.CodeLen * pointnum + 1]; + memset(curvebuf, 0, myCurve.CodeLen * pointnum); + + //先写假cur值0 + if(OutCurveNo[i] > -1) + m_SlfFile.WriteCurve(OutCurveNo[i], outsdep, pointnum, (void *)curvebuf); + + delete curvebuf; + + } + else //ndim > 1 + { + if(!tslfwave) { + tslfwave=new Slf_WAVE*[ncurvs]; + for(int k=0;k -1) + m_SlfFile.WriteWave(OutCurveNo[i], outsdep, pointnum, (void *)curvebuf); + + delete curvebuf; + } + else + OutCurveNo[i] = m_SlfFile.OpenWave(name); + } + #pragma endregion + } + } + + //char cchans[10000],tcurvnm[48]; + char mbuf[5000]; + // idir=0 orgin depth direction(decoded data depth) + // =1 up[small] - bottom[large] [depth] + //float sdepob[40],edepob[40],rlevob[40],nchans[40],lchanv[1000]; + //int norg[1000],ncopy[1000], + int nele[6], lrecf[40], npfrmob[40]; + float rlevfc,depfc,rlevd,vsdep,vedep; + //unsigned char buff[40000]; + //float value[100000]; + int idrt,lrtype,lbuff,istats,nbyte;; + int istat; + int idir=1; + int maxrl=1024; + float abstrv=-999.25; + int maxcurv=100; + // format spcification number + int nfmsp=0 ,nfrmob; + + char szTemp[128]; + strcpy(szTemp, "Open Not File:"); + if((fp=fopen(FileName,"rb")) == NULL) { + MessageBox(NULL,FileName,szTemp,MB_OK); + return 0; + } + + char path[256]; + + //CString TempPath=GetBinDir(path); + CString TempPath = GetLogdataPath(); + TempPath = TempPath+"Temp"; + QDir *temp=new QDir; + bool bWorking=temp->exists(TempPath.GetString()); + if(!bWorking) + { + bWorking=temp->mkdir(TempPath.GetString()); + CString aaa; + aaa.Format("创建临时文件路径%s失败",TempPath); + if(!bWorking) + { + AfxMessageBox(aaa); + return -1; + } + } + delete temp; + TempPath+=CString("\\"); + char filename[128]; + sprintf(filename,"%slistraninfo.txt",TempPath.GetString()); +// FILE *out; +// out=fopen(filename,"w+t"); + int ntbyte=0; + int lrtype0=-99; + int nlr=0; + int nlrdat=0; + int irec=0; + int ifgst=0; + int ifged=0; + int ipfile=0; + int iprdfl=1; + fseek(fp, skip, 0);//跳过字节数,如forward下载的lis文件就有22个字符的说明信息 +// CString str; + + //当前仅适用于处理常规曲线 + float **value2 = new float*[ncurvs]; + for(int value2ColNum = 0; value2ColNum < ncurvs; value2ColNum++){ + if(OutCurveNo[value2ColNum]>-1) + { + value2[value2ColNum] = new float [EACHCALNUM * npoints[value2ColNum] * 2+1000]; + memset(value2[value2ColNum],0,EACHCALNUM * npoints[value2ColNum] * 2*sizeof(float)); + } + } + char **value2forWave = new char*[ncurvs]; + for(int value2ColNum = 0; value2ColNum < ncurvs; value2ColNum++){ + if(ndim[value2ColNum] > 1&&OutCurveNo[value2ColNum]>-1) + { + value2forWave[value2ColNum] = new char [tslfwave[value2ColNum]->CodeLen * EACHCALNUM * (npoints[value2ColNum] + 1)]; + memset(value2forWave[value2ColNum],0,tslfwave[value2ColNum]->CodeLen * EACHCALNUM * (npoints[value2ColNum] + 1)); + } + } + int *eachCurdataNum = new int[ncurvs]; //记录每轮各个曲线保存在value2中的数值个数 + for(int i = 0; i < ncurvs; i++){ + eachCurdataNum[i] = 0; + } + float firstDep; + float eachStartDep; + float lastStartDep; + int rNum = 0; + + DepthProgress MyDepthProgress; + MyDepthProgress.CreatProgress(outsdep,outedep,"解编LIS数据"); + + if(isSpLis)ngapbyte = ngapbyteSpFirst; + int nn=0; + while(1) + { + // read a logical record (many physical record). + DWORD f = ftell(fp); + rdbuf(fp,buff,&lbuff,&lrtype,&istats,maxrl,&nbyte,ngapbyte); + + if(isSpLis)ngapbyte=8; + + f = ftell(fp); + if(f < 0) { + break; + } + ntbyte = ntbyte + nbyte; + if(istats<=0) { + break; + } + // if(lrtype!=lrtype0) write(0,*) "lbuff,lrtype,nrecs=",lbuff,lrtype,nlr; + lrtype0=lrtype; + + #pragma region write vol.(reel)_header information. + if(lrtype == 132) + { +// str=reelhd((char *)&buff[0]); + } + #pragma endregion + #pragma region write vol.(reel)_trail information. + else if(lrtype==133) + { + strncpy(mbuf,(char *)&buff[2],lbuff-3+1); + mbuf[lbuff-3+1]=0; +// str.Format("*** reel trail *** %s",mbuf); + // skip vol.(reel) trail bytes (2 eof) + len = neofbyte * 2; + if(len > 0) + { + istat = fread(buff, len, 1, fp); + if(istat<=0) { + break; + } + } + ntbyte=ntbyte+neofbyte*2; + sprintf(mbuf,"ntbytes = %d\r\n two eof \r\n",ntbyte); +// str+=CharToCstring(mbuf,strlen(mbuf)); + // skip vol.(reel) trail bytes (2 eof) + len=neofbyte*2; + if(len>0) + { + istat=fread(buff,len,1,fp); + + if(istat<=0) { + break; + } + } + ntbyte=ntbyte+neofbyte*2; + } + #pragma endregion + #pragma region write tape_header information. + else if(lrtype==130) + { +// str= + tapehd((char *)buff); + // skip eof(file end) bytes(a eof). + len=neofbyte; + if(len > 0) { + istat = fread(buff,len,1,fp); + + if(istat<=0) { + break; + } + } + ntbyte=ntbyte+neofbyte; +// str.Format(str.GetString(),"ntbytes = %d\r\n a eof \r\n",str,ntbyte); + } + #pragma endregion + #pragma region write tape_trail information. + else if(lrtype == 131) + { + if(lbuff-3+1<5000) + { + strncpy(mbuf, (char *)&buff[2], lbuff - 3 + 1); +// str.Format("*** tape trail *** %s",mbuf); + } + } + #pragma endregion + #pragma region write file_header information. + else if(lrtype == 128) + { + ipfile = ipfile + 1; + if(ipfile > iprdfl) + break; + //str=CString(" *** file header ***\r\n-----------------------------------\r\n")+ + filehd((char *)buff, &maxrl); + //str.Format("%s maxrl=%d\r\n",str,maxrl) ; + } + #pragma endregion + #pragma region write file_trail information. + else if(lrtype==129) + {//whp add + if(ipfile==iprdfl) + { + filehd((char *)buff,&maxrl); + } + // skip eof (file end) bytes(a eof). + len=neofbyte; + if(len>0) + { + istat=fread(buff,len,1,fp); + + if(istat<=0) { + break; + } + } + ntbyte=ntbyte+neofbyte; + if(ipfile==iprdfl)break; + } + #pragma endregion + #pragma region write comment record information. + else if(lrtype==232) + { + if(ipfile!=iprdfl)continue; + if(lbuff-3+1<5000) + { + strncpy(mbuf,(char *)&buff[2],lbuff-3+1); +// str.Format("*** comment: ***%s",mbuf); + } + } + #pragma endregion + #pragma region write information record information. + else if(lrtype==34) + { + if(ipfile!=iprdfl)continue; + infrec((char *)buff,lbuff,0); + } + #pragma endregion + #pragma region write format specification record information. + else if(lrtype==64) + { + if(ipfile!=iprdfl) continue; + nfmsp=nfmsp+1; + if(nfmsp>1)continue;// goto L119; + int iswfmtb=0; + iswfmtb=1; + for(int i=0;i255) nfrm=255; + if(nfrm != nframe) + nframe = nfrm; +// nframe=buff[0]*0x100+buff[1]; + for(int i = 0; i < nframe; i++) + { + #pragma region 深度值dep更新 + if(modep == 1) + { + ips=3; + nsamp=1; + icode=ircodes[ncurvs] ; + convrt(&value[0], buff, lbuff, ips, icode, nsamp); + dep = value[0] * depfc + outrlev * i; + } + else + { + ips=2+ipost[ncurvs]+(i)*lframe; + nsamp=1; + icode=ircodes[ncurvs]; + convrt(&value[0],buff,lbuff,ips,icode,nsamp); + dep=value[0]*depfc ; + } + irec=irec+1; + + if(abs(dep + abstrv) > 0.01 && ifgst == 0 && abs(dep + 9999.) > 0.01) + { + ifgst = irec; + vsdep = dep; + if(irec != 1) + { +// CString ss; +// ss.Format("irec=d,warning! depth track value error.",irec); + } + } + + if(abs(dep + abstrv) > 0.01 && abs(dep + 9999.) > 0.01) + { + ifged = irec; + vedep = dep; + } + #pragma endregion + + if(outrlev < 0){ + if(rNum == 0) + firstDep = dep; + rNum++; + if(rNum == EACHCALNUM) + eachStartDep = dep; //更新一次起始深度值 + } + else if(outrlev > 0){ + if(rNum == 0) + eachStartDep = dep; + rNum++; + if(rNum == EACHCALNUM) + firstDep = dep; + } + lastStartDep = dep; + + for(int l = 0; l <= nfrmob; l++) + { + int ipw=4; + #pragma region write curve value to buft. + for(int j = 0; j < ncurvs; j++) //针对于每个曲线 + { + if(OutCurveNo[j] > -1 && npfrmob[l] == nsamps[j]) + { + if(modep==1) + ips = 6 + ipost[j] + (i) * lframe; + else + ips=2+ipost[j]+(i)*lframe; + + nsamp=npoints[j]; + icode=ircodes[j]; + convrt(&value[0],buff,lbuff,ips,icode,nsamp); + nn++; + for(int k = 0; k < nsamp; k++) + { + if(abs(value[k]+9999.) < 0.001|| + value[k]>=1.312924e+030|| + fabs(value[k]+431602048.0)==0 + || + value[0]>=1.1424783e+009 + ) + { + value[k]=-999.25; + } + } + if(nsamp > 1 && outrlev < 0) + { + #pragma region 存放curdata --> value[] + if(ndim[j]<=1)//curve + { + float *temp; + temp = new float[nsamp]; + memcpy(&temp[0], &value[0], nsamp*sizeof(float)); + for(int k = 0; k < nsamp; k++) + { + value[k] = temp[nsamp-k-1]; + } + delete temp; + } + else if(ndim[j] > 1)//wave + { + int num = nsamp / ndim[j]; + if(num > 1) + { + float *temp; + temp = new float[nsamp]; + memcpy(&temp[0], &value[0], nsamp * sizeof(float)); + for(int m=0;m edep || dep < sdep) + { + //sdep--edep在输出深度段外,无需操作 + } + else + { + if(ndim[j] <= 1) //常规曲线 + { + float StartDep = dep; + int NumPoint = nsamp, StartPoint = 0; + + if(dep < sdep) + { + #pragma region 起始深度在段外 + for(int m = 0; m < nsamp; m++) + { + if(dep + m * mrlev >= sdep) + { + StartDep += m * mrlev; + StartPoint = m; + NumPoint -= m; + break; + } + } + #pragma endregion + } + if(dep + (nsamp - 1) * mrlev > edep) + { + #pragma region 终止深度在段外 + for(int m = 0; m < nsamp; m++) + { + if(dep + m * mrlev >= edep) + { + NumPoint = m + 1; + break; + } + } + #pragma endregion + } + //int po = (StartDep - myCurve.StartDepth) / myCurve.DepLevel + 0.5; + + if(outrlev < 0) + { + for (int NumPointn = 0; NumPointn < NumPoint; NumPointn++) + { + if(NumPoint > 1) + value2[j][(EACHCALNUM - eachCurdataNum[j] - 1) * NumPoint + NumPointn] = value[StartPoint + NumPointn]; + else + value2[j][EACHCALNUM - eachCurdataNum[j] - NumPointn - 1] = value[StartPoint + NumPointn]; + } + eachCurdataNum[j] ++; + + } + else + { + for (int NumPointn = 0; NumPointn < NumPoint; NumPointn++) + value2[j][ eachCurdataNum[j] * NumPoint + NumPointn ] = value[StartPoint + NumPointn]; + + eachCurdataNum[j] ++; + + } + } + else //波列数据 + { + int num = nsamp / ndim[j]; + + int lb=lbytes(ircodes[j]); + float StartDep=dep; + + int po=(StartDep-myWave.StartDepth)/myWave.DepLevel+0.5; + + int NumPoint=num,StartPoint=0; + if(dep=sdep) + { + StartDep+=m*mrlev; + StartPoint=m; + NumPoint-=m; + break; + } + } + } + if(dep + (num - 1) * mrlev > edep)//终止深度在段外 + { + for(int m = 0; m < num; m++) + { + if(dep + m * mrlev >= edep) + { + NumPoint = m + 1; + break; + } + } + } + + if(outrlev < 0){ + for (int NumPointn = 0; NumPointn < num * ndim[j]; NumPointn++) + m_SlfFile.SetData(tslfwave[j]->RepCode,&value2forWave[j][tslfwave[j]->CodeLen*((EACHCALNUM - eachCurdataNum[j] - 1) * nsamp + NumPointn)],&value[StartPoint * ndim[j] + NumPointn]); + + eachCurdataNum[j]++; + } + else{ + for (int NumPointn = 0; NumPointn < num * ndim[j]; NumPointn++) + m_SlfFile.SetData(tslfwave[j]->RepCode,&value2forWave[j][tslfwave[j]->CodeLen*(eachCurdataNum[j] * nsamp + NumPointn) ],&value[StartPoint * ndim[j] + NumPointn]); + + eachCurdataNum[j]++; + } + } + } + } + } + #pragma endregion + + int iprec = irec - ifgst + 1; + } + rNum=0; + if(rNum != EACHCALNUM); +// continue; + + #pragma region 完成一轮次的数据获取,进行一轮次的录入 + for(int j = 0; j < ncurvs; j++) + { + if(OutCurveNo[j] > -1 && ndim[j] <= 1) //常规数据 + { + //实际所需录入个数计算 + int realSaveNum = abs((firstDep - eachStartDep) / outrlev) + 1.5; + realSaveNum += 1; //补一个临点 + /* + //补差 + int cNum = realSaveNum - eachCurdataNum[j]; + for(int c = 0; c < cNum; c++) + { + for(int cnpoints = 0; cnpoints < npoints[j]; cnpoints++) + { + int temp_newIndex = abs(eachCurdataNum[j] * npoints[j] + c * npoints[j] + cnpoints); + int temp_oldIndex = abs(eachCurdataNum[j] * npoints[j] - npoints[j] + cnpoints); + value2[j][temp_newIndex] = value2[j][temp_oldIndex]; + } + } + */ + //录入 + int value2Index = 0; + float saveStartDep = 0.0; + //if(cal_SaveNumInf(outsdep, outedep, outrlev, eachStartDep, value2Index, realSaveNum, saveStartDep)) + { + if(npoints[j]>1) + { + m_SlfFile.WriteCurve(OutCurveNo[j], dep-rlev+rlev/npoints[j], npoints[j], &value2[j][value2Index * npoints[j]]); + } + else m_SlfFile.WriteCurve(OutCurveNo[j], dep, npoints[j], &value2[j][value2Index * npoints[j]]); + } + } + else if(OutCurveNo[j] > -1 && ndim[j] > 1) //波形数据 + { + int num = npoints[j] / ndim[j]; + int value2Index = 0; + float saveStartDep = 0.0; + int realSaveNum = eachCurdataNum[j]; + + //if(cal_SaveNumInf(outsdep, outedep, outrlev, eachStartDep, value2Index, realSaveNum, saveStartDep)) + { + if(num>1) + { + m_SlfFile.WriteCurve(OutCurveNo[j], dep-rlev+rlev/num,eachCurdataNum[j] * num, &value2[j][value2Index * npoints[j]]); + } + else m_SlfFile.WriteWave(OutCurveNo[j], dep, eachCurdataNum[j] * num, (void*)&value2forWave[j][0]); + } + } + } + + // 初始化 + for(int i = 0; i < ncurvs; i++) + eachCurdataNum[i] = 0; + rNum = 0; + + //进度条刷新 + if(outrlev < 0) + MyDepthProgress.SetDepth(outedep - eachStartDep + outsdep); + else + MyDepthProgress.SetDepth(dep); + #pragma endregion + } + } + #pragma endregion + + nlr = nlr + 1; // skip vol trail + } + fclose(fp); + + // 剩余数据录入 + if(rNum != 0 && outrlev < 0) + { + for(int j = 0; j < ncurvs; j++) + { + if(OutCurveNo[j] <= -1) continue; + if(ndim[j] <= 1) //curve + { + int value2Index = 0, realSaveNum = eachCurdataNum[j]; + float saveStartDep = 0.0; + + if(cal_SaveNumInf(outsdep, outedep, outrlev, lastStartDep, value2Index, realSaveNum, saveStartDep)) + { + value2Index = abs(EACHCALNUM - realSaveNum); + m_SlfFile.WriteCurve(OutCurveNo[j], saveStartDep, realSaveNum * npoints[j], &value2[j][value2Index * npoints[j]]); + } + + } + else //wave + { + int num = npoints[j] / ndim[j]; + int value2Index = 0, realSaveNum = eachCurdataNum[j]; + float saveStartDep = 0.0; + + if(cal_SaveNumInf(outsdep, outedep, outrlev, eachStartDep, value2Index, realSaveNum, saveStartDep)) + { + value2Index = abs(EACHCALNUM - realSaveNum); + m_SlfFile.WriteWave(OutCurveNo[j], saveStartDep, realSaveNum * num, (void*)&value2forWave[j][tslfwave[j]->CodeLen * (value2Index * npoints[j])] ); + } + //m_SlfFile.WriteWave(OutCurveNo[j], lastStartDep, eachCurdataNum[j]*num,(void*)&value2forWave[j][tslfwave[j]->CodeLen*((EACHCALNUM - eachCurdataNum[j]) * npoints[j])]); + } + } + } + else if(rNum != 0 && outrlev > 0) + { + for(int j = 0; j < ncurvs; j++) + { + if(OutCurveNo[j] <= -1) continue; + if(ndim[j] <= 1) + { + int value2Index = 0, realSaveNum = eachCurdataNum[j]; + float saveStartDep = 0.0; + if(cal_SaveNumInf(outsdep, outedep, outrlev, eachStartDep, value2Index, realSaveNum, saveStartDep)) + { + m_SlfFile.WriteCurve(OutCurveNo[j], saveStartDep, realSaveNum * npoints[j], &value2[j][value2Index * npoints[j]]); + } + } + else + { + int num = npoints[j] / ndim[j]; + int value2Index = 0; + float saveStartDep = 0.0; + int realSaveNum = eachCurdataNum[j]; + + if(cal_SaveNumInf(outsdep, outedep, outrlev, eachStartDep, value2Index, realSaveNum, saveStartDep)) + m_SlfFile.WriteWave(OutCurveNo[j], saveStartDep, realSaveNum * num, (void*)&value2forWave[j][value2Index * npoints[j]]); + + //m_SlfFile.WriteWave(OutCurveNo[j], eachStartDep, eachCurdataNum[j] * num, (void*)&value2forWave[j][0]); + } + } + } + + delete eachCurdataNum; + + for (int i = 0; i < ncurvs; i++) + { + if(OutCurveNo[i]>-1) + { + if(tslfwave&&tslfwave[i]) delete tslfwave[i]; + delete[] value2[i]; + } + } + delete[] value2; + if(tslfwave) delete[] tslfwave; + for (int i = 0; i < ncurvs; i++) + { + if(OutCurveNo[i] > -1 && ndim[i] > 1) + delete[] value2forWave[i]; + } + delete[] value2forWave; + + for(int j = 0; j < ncurvs; j++) + { + if(OutCurveNo[j] > -1) + if(ndim[j] <= 1) + m_SlfFile.CloseCurve(OutCurveNo[j]); + else + m_SlfFile.CloseWave(OutCurveNo[j]); + } + + m_SlfFile.Close(); + return TRUE; +} + + + +BEGIN_REGISTER_ICONVERTOR(CLisConvertor) + sConvertorKey(GetLisConvertorTypeID(),"Lis Well Log Convertor") +END_REGISTER_ICONVERTOR(CLisConvertor ); + +END_OSGGRAPHICS_NAMESPACE diff --git a/tran/LISConvertor/src/LisConvertor.pro b/tran/LISConvertor/src/LisConvertor.pro new file mode 100644 index 0000000..8bf3998 --- /dev/null +++ b/tran/LISConvertor/src/LisConvertor.pro @@ -0,0 +1,77 @@ +TEMPLATE = lib +TARGET = LisConvertor +QT += core \ + gui \ + opengl\ + + +INCLUDEPATH += $(OSGHOME)/include \ +../include \ +../../OSGParts/include \ +../../../WellLogUI/include \ +../../../OSGFramework/include \ +../../../common\ +../../../BaseFun/include\ +../../../Slfio/include\ +../../../ConvertorManager/include\ +../../../OSGDataModel/include\ +./GeneratedFiles + +#include(../../OSGDataModel/paiobjectmodel.libinfo) + +HEADERS += ../include/*.h \ + ../../../common/geometryutils.h + +SOURCES += *.cpp \ + ../../../common/geometryutils.cpp + + + +OBJECTS_DIR = ../obj +DESTDIR = ../bin +CONFIG += qt \ + debug_and_release +DEFINES += QT_DLL + +CONFIG(debug, debug|release){ + LIBS += -L$$PWD/../../../Bin -lOSGDataModeld + LIBS += -L$$PWD/../../../Bin -lBaseFund + LIBS += -L$$PWD/../../../Bin -lslfiod + LIBS += -L$$PWD/../../../Bin -lWellLogUId + LIBS += -L$$PWD/../../../Bin -lConvertorManagerd +} else { + LIBS += -L$$PWD/../../../BinR -lOSGDataModel + LIBS += -L$$PWD/../../../BinR -lBaseFun + LIBS += -L$$PWD/../../../BinR -lslfio + LIBS += -L$$PWD/../../../BinR -lWellLogUI + LIBS += -L$$PWD/../../../BinR -lConvertorManager +} +#include(../../OSGParts/src/osg.LibInfo) + +#LIBS += -lOSGParts \ +# -L../../OSGParts/bin + +#LIBS += -lOSGFramework \ +# -L../../OSGFramework/bin + +#LIBS += -L$$(PAI_HOME)/lib -lOSGDataModel + +#LIBS += -L$$(PAI_HOME)/lib -lConvertorManager + + + + + + +#RESOURCES += +#QMAKE_POST_LINK = cp ../bin/*.* /opt/pi/bin +#QMAKE_POST_LINK = cp ../bin/*.so $(PAI_HOME)/lib/ + +CONFIG(debug, debug|release){ + DESTDIR = $$PWD/../../../Bin/convertor + TARGET = $$join(TARGET,,,d) #为debug版本生成的文件增加d的后缀 +} else { + DESTDIR = $$PWD/../../../BinR/convertor + TARGET = $$join(TARGET,,,) +} + diff --git a/tran/LISConvertor/src/sub.cpp b/tran/LISConvertor/src/sub.cpp new file mode 100644 index 0000000..0854ffb --- /dev/null +++ b/tran/LISConvertor/src/sub.cpp @@ -0,0 +1,1361 @@ +#include "sub.h" +extern float rlev,dep,sdep,edep; +extern char curvnms[3000][5],units[3000][5],depunit[5],levunit[5]; +extern int ircodes[3000],npoints[3000],nsamps[3000],ipost[3000],iexst[3000],ndim[3000]; +extern int ncurvs,lframe,nframe,modep; +extern WELL_DYNAMIC_INFO *mWellDynamicInfo; +void lrcls(unsigned char ctype,int *idrt,int *lrtype) +{ + int ityp[11]={0,34,47,64,128,129,130,131,132,133,232}; + *lrtype=ctype; + *idrt=-1; + for(int i=0;i<10;i++) + { + if(*lrtype!=ityp[i]) continue; + *idrt=i; + break; + } + if(*idrt<0)*idrt=12; +} +void pratr(unsigned char chatr1,unsigned char chatr2,int *pmatr) +{ + int matr[16]; + int icha1=chatr1; + int icha2=chatr2; + for(int i=0;i<8;i++) + { + int imx=pow(2.f,(8-i-1)); + matr[i]=0; + if(icha1>=imx) + { + matr[i]=1; + icha1=icha1-imx; + } + matr[i+8]=0; + if(icha2>=imx) + { + matr[i+8] = 1; + icha2=icha2-imx; + } + } + memcpy(pmatr,&matr[0],16*sizeof(int)); +} +void rdbufp(FILE *fp,unsigned char *buff,int lbuff,int lrtype,int istats,int maxrl,int nbyte,int ngpbyte) +{ + unsigned char buft[90000]; + char buf4[4]; + int fd[2],bread[2]; + int matr[16]; + //-------------------------------------------------------------------- + //- nlrs, number of segments of each logical record. + ///////let's begin + int nlrs=0; + lbuff=0; + nbyte=0; + int len=40000; + istats=0; + int lprl; + while(1) + { + // read a physical record. + int istat=fread(buft,1,len,fp); + if(istat==0) + { + if(istats==0) + { + istats=-1; + return; + } + istats=0; + return; + } + istats=istat; + nbyte=nbyte+istat; + for(int i=0;i<4;i++){ + buf4[i]=buft[i]; + } + lprl=buf4[0]*256+buf4[1]; + if(lprl<=0) + { + CString str; + str.Format(" logical record length error!lprl < 0",lprl); + AfxMessageBox(str); + } + if(lprl>maxrl) + { + CString str; + str.Format(" logical record length error!lprl > maxrl %d %d",lprl,maxrl); + AfxMessageBox(str); + } + //- get logical record segment attributions + int matr[16]; + pratr(buf4[2],buf4[3],&matr[0]); + // write(0,*)(matr[i],i=1,16) + //- cut bytes of logical record trail + int npad=0; + if(matr[2]==0&&matr[3]==1) + { + npad=npad+2; + } + if(matr[5]==1) + { + npad=npad+2; + } + if(matr[6]==1) + { + npad=npad+2; + } + for(int i=0;imaxrl) + { + CString str; + str.Format(" lrtype=%d",lrtype); + //AfxMessageBox(str); + } + if(idrt>=12) { + // istats=0; + // stop 9999; + // write(0,*) + // write(0,*)" idrt > 12"; + // write(0,*)" lrtype=",lrtype; + } +} +// +//- read a logical record length from disk file. +// +static int RecNum=0; +void rdbuf(FILE *fp,unsigned char *buff,int *lbuff,int *lrtype,int *istats,int maxrl,int *nbyte,int ngpbyte) +{ + unsigned char buft[90000]; + unsigned char buf4[4],buf2[2]; + int matr[16]; + *istats=1; + *nbyte=0; + //- nlrs, number of segments of each logical record. + int nlrs=0 ; + *lbuff=0; + int lprl; + int pos,type; + while(1) + { + // skip gap bytes. + int len=ngpbyte; + if(len>0) + { + int istat=fread(buft,len,1,fp); + if(istat<=0) goto L100; + } + *nbyte=*nbyte+ngpbyte; + // read physical record header. + len=4; + int istat=fread(buf4,len,1,fp); + if(istat<=0) goto L100; + *nbyte=*nbyte+4; + lprl=buf4[0]*256+buf4[1]; + if(lprl==0) + { + len=2; + istat=fread(buf2,len,1,fp); + if(istat<=0) goto L100; + *nbyte=*nbyte+2; + buf4[0]=buf4[2]; + buf4[1]=buf4[3]; + buf4[2]=buf2[0]; + buf4[3]=buf2[1]; + lprl=buf4[0]*256+buf4[1]; + } + if(lprl<=0) + { + CString str; + str.Format(" logical record length error!lprl < 0",lprl); + // AfxMessageBox(str); + } + if(lprl>maxrl) + { + CString str; + str.Format(" logical record length error!lprl > maxrl %d %d",lprl,maxrl); + //AfxMessageBox(str); + } + //- get logical record segment attributions + int matr[16]; + pratr(buf4[2],buf4[3],matr);//&matr[0]); + // write(0,*)(matr[i],i=1,16); + // read a physical record. + + len=lprl-4 ; //2???ļm5_DIL.datʱΪ42ļ¼е˴lprl=4ʱlen=0istat<=0breakϢ޷ȷɨ + pos=ftell(fp); + istat=fread(buft,len,1,fp); + + if(istat<=0) goto L100; + *nbyte=*nbyte+lprl-4; + //- cut bytes of logical record trail + int npad=0; + if(matr[2]==0&&matr[3]==1) + { + npad=npad+2; + } + if(matr[5]==1) + { + npad=npad+2; + } + if(matr[6]==1) + { + npad=npad+2; + } + for(int i=0;imaxrl) + { + CString str; + str.Format(" lrtype=%d",*lrtype); + //AfxMessageBox(str); + } + if(idrt>=12) { + // istats=0; + // stop 9999; + // write(0,*) + // write(0,*)" idrt > 12"; + // write(0,*)" lrtype=",lrtype; + } + // write(0,"(5x,a,i5)")"successive segments total sum :",nlrs; + return; +L100: *istats=-1; +} +// output vol.(reel) header information +// +CString reelhd(char *buff) +{ + /*char cvalue[10000]; + for(int i=0;i<500;i++) + { + cvalue[i]=buff[i]; + }*/ + char buffer[5000]; + char mes[128]; + char sn[8],crdate[8],ds[8],vn[8],ln[8]; + int nele[6],value[100],lcval[1000]; + CString smes,str=" *** vol. header ***\r\n-----------------------------------\r\n"; + sprintf(buffer," *** vol. header ***\r\n-----------------------------------\r\n"); + strncpy(mes,&buff[2],6);mes[6]=0; + sprintf(buffer,"%ssevice name: %s\r\n",buffer,mes); + //str.Format("%ssevice name: %s\r\n",str,mes); + strncpy(mes,&buff[14],22-15+1);mes[22-15+1]=0; + //str.Format("%screate datee: %s\r\n",str,mes); + sprintf(buffer,"%screate datee: %s\r\n",buffer,mes); + + strncpy(mes,&buff[24],4);mes[4]=0; + //str.Format("%sdata source: %s\r\n",str,mes); + sprintf(buffer,"%sdata source: %s\r\n",buffer,mes); + + strncpy(mes,&buff[30],8);mes[8]=0; + //str.Format("%svolumn name: %s\r\n",str,mes); + sprintf(buffer,"%svolumn name: %s\r\n",buffer,mes); + + strncpy(mes,&buff[42],2);mes[2]=0; + //str.Format("%slink number: %s\r\n",str,mes); + sprintf(buffer,"%slink number: %s\r\n",buffer,mes); + + strncpy(mes,&buff[44],8);mes[8]=0; + //str.Format("%sbefore vol.: %s\r\n",str,mes); + sprintf(buffer,"%sbefore vol.: %s\r\n",buffer,mes); + + strncpy(mes,&buff[54],128-55+1);mes[128-55+1]=0; + //str.Format("%scomment: %s\r\n",str,mes); + sprintf(buffer,"%scomment: %s\r\n",buffer,mes); + str.Format("%s",buffer); + int ndim=1; + nele[0]=1; + int ivorg=0; + int ivcopy=0; + //strcpy(cvalue," "); + strncpy(sn,&buff[2],6);sn[6]=0; + lcval[0]=strlen(sn);//lenstr(sn,8); + // wparfl("sn","sevice name","asci",ndim,nele,ivorg,ivcopy," ",value,sn,lcval); + smes.Format("sn sevice name","asci",ndim,nele,ivorg,ivcopy," ",value,sn,lcval); + strcpy(crdate,""); + for(int l=0;l<8;l++) + { + crdate[l]=buff[l+14]; + } + lcval[0]=strlen(crdate); + // wparfl("crdate","create date","asci",ndim,nele,ivorg, + //$ ivcopy," ",value,crdate,lcval); + strcpy(ds,""); + for(int l=0;l<4;l++)ds[l]=buff[l+24]; + lcval[0]=strlen(ds); + // wparfl("ds","data source","asci",ndim,nele,ivorg, + // $ ivcopy," ",value,ds,lcval); + strcpy(vn,""); + for(int l=0;l<8;l++){ + vn[l]=buff[l+30]; + } + lcval[0]=strlen(vn); + // wparfl("vn","volumn name","asci",ndim,nele,ivorg, + // $ ivcopy," ",value,vn,lcval); + strcpy(ln,""); + for(int l=0;l<2;l++){ + ln[l]=buff[l+40]; + } + lcval[0]=strlen(ln); + // wparfl("ln","link number","asci",ndim,nele,ivorg, + // $ ivcopy," ",value,ln,lcval); + return str;//mes; +} +// +// output tape header information +// +CString tapehd(char *buff) +{ + char mes[128]; + char buffer[5000]; + //char cvalue[10000]; + char sn[8],crdate[8],ds[8],tn[8],ln[8]; + int nele[6],lcval[1000]; + float value[100]; + CString smes,str=" *** tape header ***\r\n-----------------------------------\r\n"; + sprintf(buffer," *** tape header ***\r\n-----------------------------------\r\n"); + strncpy(mes,&buff[2],6);mes[6]=0; + //str.Format("%ssevice name: %s\r\n",str,mes); + sprintf(buffer,"%ssevice name: %s\r\n",buffer,mes); + strncpy(mes,&buff[14],22-15+1);mes[22-15+1]=0; + //str.Format("%screate datee: %s\r\n",str,mes); + sprintf(buffer,"%screate datee: %s\r\n",buffer,mes); + + strncpy(mes,&buff[24],4);mes[4]=0; + // str.Format("%sdata source: %s\r\n",str,mes); + sprintf(buffer,"%ssdata source: %s\r\n",buffer,mes); + + strncpy(mes,&buff[30],8);mes[8]=0; + //str.Format("%svolumn name: %s\r\n",str,mes); + sprintf(buffer,"%svolumn name: %s\r\n",buffer,mes); + + strncpy(mes,&buff[42],2);mes[2]=0; + //str.Format("%slink number: %s\r\n",str,mes); + sprintf(buffer,"%slink number: %s\r\n",buffer,mes); + + strncpy(mes,&buff[44],8);mes[8]=0; + //str.Format("%sbefore vol.: %s\r\n",str,mes); + sprintf(buffer,"%sbefore vol.: %s\r\n",buffer,mes); + + strncpy(mes,&buff[54],128-55+1);mes[128-55+1]=0; + //str.Format("%scomment: %s\r\n",str,mes); + sprintf(buffer,"%scomment: %s\r\n",buffer,mes); + str.Format("%s",buffer); + int ndim=1; + nele[0]=1; + int ivorg=0; + int ivcopy=1; + //strcpy(cvalue," "); + strncpy(sn,&buff[2],6);sn[6]=0; + lcval[0]=strlen(sn);//lenstr(sn,8); + // wparfl("sn","sevice name","asci",ndim,nele,ivorg,ivcopy," ",value,sn,lcval); + smes.Format("sn sevice name","asci",ndim,nele,ivorg,ivcopy," ",value,sn,lcval); + strcpy(crdate,""); + for(int l=0;l<8;l++) + { + crdate[l]=buff[l+14]; + } + lcval[0]=strlen(crdate); + // wparfl("crdate","create date","asci",ndim,nele,ivorg, + //$ ivcopy," ",value,crdate,lcval); + strcpy(ds,""); + for(int l=0;l<4;l++)ds[l]=buff[l+24]; + lcval[0]=strlen(ds); + // wparfl("ds","data source","asci",ndim,nele,ivorg, + // $ ivcopy," ",value,ds,lcval); + strcpy(tn,""); + for(int l=0;l<8;l++){ + tn[l]=buff[l+30]; + } + lcval[0]=strlen(tn); + // wparfl("vn","volumn name","asci",ndim,nele,ivorg, + // $ ivcopy," ",value,tn,lcval); + strcpy(ln,""); + for(int l=0;l<2;l++){ + ln[l]=buff[l+40]; + } + lcval[0]=strlen(ln); + // wparfl("ln","link number","asci",ndim,nele,ivorg, + // $ ivcopy," ",value,ln,lcval); + return str;//mes; +} +CString CharToCstring(char *buf,int len) +{ + char *mes; + mes=new char[len+1]; + strncpy(mes,buf,len); + for(int i=0;iDate,&buff[28],36-29+1); + smes=CString("MAX. RECORD LENGTH :")+CharToCstring(&buff[37],42-38+1);str+=smes+"\r\n"; + smes=CString("FILE TYPE :")+CharToCstring(&buff[43],3);str+=smes+"\r\n";//smes="FILE TYPE :"+CharToCstring(&buff[43],2);str+=smes+"\r\n"; + smes=CString("BEFORE FILE NAME :")+CharToCstring(&buff[45],55-46+1);str+=smes+"\r\n"; + // get maximum logical record length(maxrl). + for(int i=0;i<5;i++) + { + buft[i]=buff[37+i]; + } + sscanf(buft,"%d",maxrl); + //read(buft,*) + /* int ndim=1; + nele[0]=1; + int ivorg=0; + int ivcopy=0; + strcpy(cvalue," "); + strcpy(fileid,""); + for(int l=0;l<8;l++) + { + fileid[l]=buff[l+2]; + } + lcval[0]=strlen(fileid); + // wparfl("fileid","file name","asci",ndim,nele,ivorg, + // $ ivcopy," ",value,fileid,lcval); + strcpy(ssn,""); + for(int l=0;l<6;l++){ + ssn[l]=buff[l+14]; + } + lcval[0]=strlen(ssn); + // wparfl("ssn","second sevice name","asci",ndim,nele,ivorg, + // $ ivcopy," ",value,ssn,lcval); + strcpy(fileno,""); + for(int l=0;l<6;l++) + { + fileno[l]=buff[l+21]; + } + lcval[0]=strlen(fileno); + // wparfl("fileno","file number","asci",ndim,nele,ivorg, + // $ ivcopy," ",value,fileno,lcval); + strcpy(date,""); + for(int l=0;l<8;l++){ + date[l]=buff[l+28]; + } + lcval[1]=strlen(date); + //wparfl("date","create date","asci",ndim,nele,ivorg, + // $ ivcopy," ",value,date,lcval); + strcpy(filety,""); + for(int l=0;l<2;l++){ + filety[l]=buff[l+43]; + } + lcval[0]=strlen(filety);*/ + // wparfl("filety","file type","asci",ndim,nele,ivorg, + // $ ivcopy," ",value,filety,lcval); + return str; +} +float unitfactor(char *depunit,int len) +{ + char unit[8]; + float unitfactor=1.; + int i; + for(i=0;i=128) + { + is=-1; + ie=(iv1-128)*2+iv/128; + } + else + { + is=1 ; + ie=iv1*2+iv/128 ; + } + v4.cha4[3]=buff[ips+(i)*4]; + v4.cha4[2]=buff[ips+(i)*4+1]; + v4.cha4[1]=buff[ips+(i)*4+2]; + v4.cha4[0]=buff[ips+(i)*4+3]; + if(is>0) value[i]=0.5*v4.vg4-pow(2.f,(ie-128)); + else value[i]=-v4.vg4*pow(2.f,(254-2*ie))-pow(2.f,(128-ie)); + } + // write(0,*)"value=",value[i],vals,vg4,ie; + } + else if(irecod==70) + { + for(int i=0;i0&&spacing-0.099999994<0.000000006) spacing=0.1; + else if(spacing-0.0024>0&&spacing-0.0024<0.0001) spacing=0.0025; + } + else if(itype==9) + { + notes="level unit."; + for(int i=0;i=lbuff-2) break ; + }//while end + str+=CString("-----------------------------------\r\n"); + if(iswitab==0)str+=CString("no. curve_nm tool_nm sevice unit log_typ cv_typ cv_lev cv_mod fn len_smp 0_1 proc num_smp re_code 0_2 0_3 ndim\r\n"); + else str+=CString("no. curve_nm unit cv_mod len_smp num_smp re_code ndim Process Indicators\r\n"); + for(int i=0;i>m)&0x1)CIndicators[24-m-1]='1'; + else CIndicators[24-m-1]='0'; + } + if(iswitab==0)ss.Format(("%5d,%4s %8s %8s %4s %6d %6d %6d %6d %6d %6d %6d %6d %6d %6d %6d %6d %6d\r\n"), + ncurv, curvnm,toolnm,sevice,unit,itylog,itycuv,icvlev,icvmod,ifn,lensmp,i1l0,ipclev,nsmap,ircode,i2l0,i3l0,lensmp/lbytes(ircode)/nsmap); + else ss.Format(("%5d,%4s %4s %6d %6d %6d %6d %6d %s\r\n"),ncurv,curvnm,unit,icvmod,lensmp,nsmap,ircode,lensmp/lbytes(ircode)/nsmap,CIndicators ); + if(ncurvs==0) + { + strcpy(curvnms[ncurv],curvnm); + iexst[ncurv]=1; + strcpy(units[ncurv],unit) ; + ircodes[ncurv]=ircode; + nsamps[ncurv]=nsmap; + npoints[ncurv]=lensmp/lbytes(ircode) ; + if(npoints[ncurv]>1) + { + int a=1; + } + ipost[ncurv]=nfbyte+1; + ndim[ncurv]=lensmp/lbytes(ircode)/nsmap; + } + else + { + for(int i=0;i0) + { + iexst[i]=1; + strcpy(units[i],unit); + ircodes[i]=ircode; + nsamps[i]=nsmap; + npoints[i]=lensmp/lbytes(ircode); + ipost[i]=nfbyte+1; + ndim[ncurv]=lensmp/lbytes(ircode)/nsmap; + } + } + } + if(modep ==0) + { + if(strcmp(curvnm,"dept")==0||strcmp(curvnm,"DEPT")==0) + { + if(ncurvs==0) + { + strcpy(curvnms[2999],"DEPT"); + iexst[2999]=1; + strcpy(units[2999],unit); + strcpy(depunit,unit); + ircodes[2999]=ircode; + nsamps[2999]=nsmap; + npoints[2999]=lensmp/lbytes(ircode); + ipost[2999]=nfbyte+1; + ndim[ncurv]=lensmp/lbytes(ircode)/nsmap; + } + else + { + strcpy(curvnms[ncurvs],"DEPT"); + iexst[ncurvs]=1; + strcpy(units[ncurvs],unit); + strcpy(depunit,unit); + ircodes[ncurvs]=ircode; + nsamps[ncurvs]=nsmap; + npoints[ncurvs]=lensmp/lbytes(ircode) ; + ipost[ncurvs]=nfbyte+1; + ndim[ncurv]=lensmp/lbytes(ircode)/nsmap; + } + } + } + nfbyte=nfbyte+abs(lensmp); + str+=ss; + if(ip>=lbuff-2)break; + } + CString sys[18]={ " 0 23456789012345 23", + "0 Original logging direction ________________| |||||||||||||| ||", + "2 TRUE vertical depth correction ______________|||||||||||||| ||", + "3 Data channel not on depth ____________________||||||||||||| ||", + "4 Data channel is filtered ______________________|||||||||||| ||", + "5 Data channel is calibrated _____________________||||||||||| ||", + "6 Computed (processed through a function former)___|||||||||| ||", + "7 Derived (computed from more than one tool) _______||||||||| ||", + "8 Tool defined correction 2 _________________________|||||||| ||", + "9 Tool defined correction 1 __________________________||||||| ||", + "0 Mudcake correction __________________________________|||||| ||", + "1 Lithology correction _________________________________||||| ||", + "2 Inclinometry correction _______________________________|||| ||", + "3 Pressure correction ____________________________________||| ||", + "4 Borehole correction _____________________________________|| ||", + "5 Temperature correction ___________________________________| ||", + "2 Auxiliary data flag _____________________________________________||", + "3 Schlumberger proprietary _________________________________________|"}; + for(int m=0;m<18;m++){ + str+=CString(" ")+sys[m]; + str+=CString("\r\n"); + } + rlev=ldir*abs(spacing); + lframe=nfbyte; + if(ncurvs==0) + { + ncurvs=ncurv+1; + if(modep==0) + { + strcpy(curvnms[ncurv+1],curvnms[2999]); + iexst[ncurv+1]=iexst[2999]; + strcpy(units[ncurv+1],units[2999]); + ircodes[ncurv+1]=ircodes[2999]; + nsamps[ncurv+1]=nsamps[2999]; + npoints[ncurv+1]=npoints[2999]; + ipost[ncurv+1]=ipost[2999]; + } + } + if(modep==1) + { + strcpy(curvnms[ncurvs],"dept"); + iexst[ncurvs]=1; + ipost[ncurvs]=1; + ircodes[ncurvs]=icodep; + strcpy(units[ncurvs],depunit); + } + + //AfxMessageBox(str); + int len=str.GetLength(); + return str; +} + +// output information record. +// +// iswitab, output information table switch. +// =0, vertical table. +// >0, horizontal table. +// <0, not output +// +CString infrec(char *buff,int lbuff,int iswitab) +{ + CString str,mstr;; + char title[5]; + char name[5],unit[5]; + char titls[40][4],cval[40][20],cvtem[200]; + // char cvalue[200]; + float value[100]; + float vcv[40]; + int ircd[40],lcv[40]; + char ccv[40][200]; + str=" *** information record ***\r\n-----------------------------------\r\n"; + int ip=2,ncos=0,nlis=0; + while(1) + { + int itype= (unsigned char)(buff[ip+0]); + int icode= (unsigned char)(buff[ip+1]); + int len= (unsigned char)(buff[ip+2]); + int numb= (unsigned char)(buff[ip+3]); + if(itype==73) + { + char *ss; + ss=new char[len+1]; + strncpy(ss,&buff[ip+12],len); + pchar(ss,len); + str+=CString("information type: ")+CharToCstring(ss,len)+"\r\n"+"-----------------------------------\r\n"; + delete ss; + for(int i=0;i<4;i++)title[i]=buff[ip+12+i]; + pchar(title,4); + mstr.Format("title=%s\r\n",title); + str+=mstr; + if(iswitab==0) + { + str+=CString("type code len number name unit value\r\n"); + } + nlis=0; + } + else if(itype==0) + { + if(ncos>0) + { + str+=CString("ww\r\n"); + for(int k=0;k=1) + { + if(nlis==2) + { + for(int i=0;i=2) + { + for(int i=0;i20) + { + for(int i=0;i<19;i++)cval[ncos][i]=buff[ip+12+i]; + cval[ncos][19]='-'; + } + else + { + strcpy(cval[ncos]," "); + for(int i=0;i=lbuff-4)break; + } + if(iswitab>=0) + { + for(int i=0;i Date: Fri, 10 Apr 2026 09:05:56 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E5=BC=B9=E6=A1=86=E4=B9=B1=E7=A0=81?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BaseFun/src/BaseFun.cpp | 2 ++ BaseFun/src/CStringType.cpp | 2 ++ 2 files changed, 4 insertions(+) diff --git a/BaseFun/src/BaseFun.cpp b/BaseFun/src/BaseFun.cpp index 0e031f9..4334f83 100644 --- a/BaseFun/src/BaseFun.cpp +++ b/BaseFun/src/BaseFun.cpp @@ -19,6 +19,8 @@ #define REPR_USHORT 9 #define REPR_UINT 10 #define REPR_ULONG 11 +#pragma execution_character_set("utf-8") + void removeStr(char* sdes,QString b,QString e) { QString des=sdes; diff --git a/BaseFun/src/CStringType.cpp b/BaseFun/src/CStringType.cpp index 346f5dd..79b21dc 100644 --- a/BaseFun/src/CStringType.cpp +++ b/BaseFun/src/CStringType.cpp @@ -1,5 +1,7 @@ #include "CStringType.h" #include +#pragma execution_character_set("utf-8") + char *m_temp=NULL; CString::CString(const char *str) { From 751a45257ef01a0e7ff099d1a10af8d5a7ee45ec Mon Sep 17 00:00:00 2001 From: crqiqi77 Date: Fri, 10 Apr 2026 09:15:08 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E7=8E=AB=E7=91=B0=E5=9B=BE=E5=B1=9E?= =?UTF-8?q?=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- logPlus/formdraw.cpp | 3 +- logPlus/formdraw.h | 2 +- logPlus/forminfo.h | 2 +- logPlus/qmycustomplot.cpp | 333 ++------------------------------------ logPlus/qmycustomplot.h | 29 +--- 5 files changed, 15 insertions(+), 354 deletions(-) diff --git a/logPlus/formdraw.cpp b/logPlus/formdraw.cpp index 4b87c2b..7a5c7da 100644 --- a/logPlus/formdraw.cpp +++ b/logPlus/formdraw.cpp @@ -389,7 +389,8 @@ void FormDraw::setDrawData(QStringList listdt, QJsonObject objInfo) QFont m_pl_fontScale = pInfo->m_pl_fontScale; // 刻度字体大小 // 玫瑰图 int m_rose_sector_enabled = pInfo->m_rose_sector_enabled; // 扇形(启用开关) - int m_rose_circle_radius_cm = pInfo->m_rose_circle_radius_cm; // 圆半径(cm) + 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; // 圆线颜色 diff --git a/logPlus/formdraw.h b/logPlus/formdraw.h index e79f050..a3b9902 100644 --- a/logPlus/formdraw.h +++ b/logPlus/formdraw.h @@ -230,7 +230,7 @@ public: void initIMAGE_DATA(QMyCustomPlot *widget, QString strSlfName, QString strLineName, QStringList listOtherProperty={}); // bool LoadFromIMAGE_SLF(QMyCustomPlot *widget, QString strSlfName, QString strLineName); - //深度 + // 深度 void initDepth(QMyCustomPlot *widget); //频率统计图 void initFgrq(QMyCustomPlot *widget); diff --git a/logPlus/forminfo.h b/logPlus/forminfo.h index 0527221..b1524de 100644 --- a/logPlus/forminfo.h +++ b/logPlus/forminfo.h @@ -304,7 +304,7 @@ public: QString m_rose_attribute_field = "ID"; // 属性字段 // 玫瑰图 int m_rose_sector_enabled = 36; // 扇形 - int m_rose_circle_radius_cm = 50; // 圆半径(cm) + int m_rose_circle_radius_cm = 1; // 圆半径(cm) int m_rose_radiation_circle_enabled = 9; // 辐射圈 int m_rose_azimuth_print_interval = 3; // 方位打印间隔 QColor m_rose_circle_line_color = Qt::black; // 圆线颜色 diff --git a/logPlus/qmycustomplot.cpp b/logPlus/qmycustomplot.cpp index 3a1168f..3a6bc8d 100644 --- a/logPlus/qmycustomplot.cpp +++ b/logPlus/qmycustomplot.cpp @@ -10028,7 +10028,7 @@ void QMyCustomPlot::s_changePlObjectProperty(QVariantMap variantMap) double maxInclination = variantMap["m_pl_maxInclination"].toDouble(); - this->drawFgrq(dataType, azimuthCurve, inclinationCurve, csCurveGrad, LeftVal3, RightVal3, nArc, nR, crArc, nArcLineWidth, bFill, crFill, + this->drawFgrq(bTableData, azimuthCurve, inclinationCurve, csCurveGrad, LeftVal3, RightVal3, nArc, nR, crArc, nArcLineWidth, bFill, crFill, lineNumber, lineHeight, lineThickness, lineColor, drawAnnotation, drawHistogram, baselineWidth, baselineColor, statInterval, minInclination, maxInclination); } @@ -10311,7 +10311,6 @@ void QMyCustomPlot::drawDipAngle(double centerX, double centerY, float ifdir[360 for (int i = 0; i < lineNumber; ++i) { double currY = startX - i * step; - // 🔥🔥🔥 核心:每个刻度单独计算长度(和你GDI完全一样,每个长度不同) double dynamicLen = 0.1 * ifdir[i] / dirmax + lineHeight; @@ -10548,7 +10547,8 @@ void QMyCustomPlot::s_changeRoseProperty(QVariantMap variantMap) QFont m_pl_fontScale = variantMap["m_pl_fontScale"].value(); // 玫瑰图 int m_rose_sector_enabled = variantMap["m_rose_sector_enabled"].toInt(); - int m_rose_circle_radius_cm = variantMap["m_rose_circle_radius_cm"].toInt(); + double m_rose_circle_radius_cm = variantMap["m_rose_circle_radius_cm"].toInt(); + m_rose_circle_radius_cm *= g_dPixelPerCm; int m_rose_radiation_circle_enabled = variantMap["m_rose_radiation_circle_enabled"].toInt(); int m_rose_azimuth_print_interval = variantMap["m_rose_azimuth_print_interval"].toInt(); QColor m_rose_circle_line_color = variantMap["m_rose_circle_line_color"].value(); @@ -10564,20 +10564,13 @@ void QMyCustomPlot::s_changeRoseProperty(QVariantMap variantMap) double m_pl_minInclination = variantMap["m_pl_minInclination"].toDouble(); double m_pl_maxInclination = variantMap["m_pl_maxInclination"].toDouble(); -// int nstep, double LeftVal, double RightVal - - - this->drawRose(bTableData, 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); - - - - + this->drawRose(bTableData, 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); } void QMyCustomPlot::drawRose(bool bTableData, QString csCurveDDIR, QString csCurveDANG, @@ -10933,312 +10926,6 @@ void QMyCustomPlot::drawRose(bool bTableData, QString csCurveDDIR, QString csCur this->replot(); } -void QMyCustomPlot::drawTabRose( - bool bTableData, - QString csCurveDDIR, - QString csCurveDANG, - QString qsDepth, - QString qsDIR, - QString qsDIP, - QString qsID, - QString csCurveGrad, - double m_LeftVal3, - double m_RightVal3, - QFont m_pl_fontScale, - int m_nArc, - int nR, - int m_nCircle, - int m_nAzimStep, - QColor m_rose_circle_line_color, - int m_rose_circle_line_width, - QColor m_rose_stress_line_color, - QColor m_rose_collapse_line_color, - bool m_bGrid, - bool m_bJykt, - bool m_rose_fill_enabled, - bool m_bHint, - int nstep, - float m_LeftVal, - float m_RightVal -) -{ - bool flag = true; - - this->clearGraphs(); - this->clearItems(); - - m_bTableData = bTableData; - m_csCurveDDIR = csCurveDDIR; - m_csCurveDANG = csCurveDANG; - m_csCurveGrad = csCurveGrad; - m_qsDepth = qsDepth; - m_qsDIR = qsDIR; - m_qsDIP = qsDIP; - m_qsID = qsID; - m_qsTable = "FRAC_HOLE.TABLE"; - - flag = Refurbish(); - if (!flag) return; - - // 必须读取裂缝表 + 裂缝定义 - ReadFracDef(); - int nPointNum = m_FracTabList.count(); - int nFracType = m_FracDefList.count(); - - if (nPointNum < 1) return; - - // 初始化裂缝类型默认全部绘制 - for (int i = 0; i < nFracType; i++) { - m_bTypeDraw[i] = true; - } - - QPen wPen(m_rose_circle_line_color, m_rose_circle_line_width); - double centerX = this->m_iX2 / 2; - float flVal = 0.0f; - float x, y, x1, y1, x2, y2; - float ifdir[360] = {0}; - float mind = qMin(m_RightVal, m_LeftVal); - float maxd = qMax(m_RightVal, m_LeftVal); - float dirmax, dr; - float deps; - - // 深度范围(表格数据使用屏幕坐标) - float ftmpSdep = -m_iY2; - float ftmpEdep = -m_iY1; - - int tmp = ftmpSdep / nstep; - float flDep = tmp * nstep; - double pi = 3.1415926535; - - while (1) { - if ((flDep >= ftmpEdep + nstep) || flDep >= ftmpEdep) break; - - double tempf = flDep + nstep / 2.0; - double centerY = tempf * -1.0; - - // ====================== 1. 画最外层圆 ====================== - QCPItemEllipse* pEse = new QCPItemEllipse(this); - wPen.setWidth(m_rose_circle_line_width); - pEse->setPen(wPen); - pEse->m_bCustom = true; - pEse->m_nRadius = nR; - pEse->topLeft->setCoords(centerY, centerX); - pEse->bottomRight->setCoords(centerY, centerX); - - // ====================== 2. 画十字线 ====================== - for (int k = 0; k < 4; k++) { - QCPItemLine* pLine1 = new QCPItemLine(this); - pLine1->m_bCustom = true; - pLine1->m_dr = qDegreesToRadians(k * 90.0); - pLine1->m_nRadius = 0; - pLine1->m_nTailLen = nR; - pLine1->setPen(wPen); - pLine1->start->setCoords(centerY, centerX); - pLine1->end->setCoords(centerY, centerX); - } - - // ====================== 3. 方位标注 ====================== - if (m_bHint) { - int psize = 15; - flVal = m_nAzimStep * 360.0 / m_nArc; - for (int i = 0; i < 360; i += (int)flVal) { - QCPItemText* mItemTitle = new QCPItemText(this); - mItemTitle->position->setCoords(centerY, centerX); - mItemTitle->setText(QString::number(i)); - mItemTitle->setFont(m_pl_fontScale); - mItemTitle->setColor(m_rose_circle_line_color); - dr = i * 2 * pi / 360.0; - mItemTitle->m_fx = (nR + psize * 0.85) * sin(dr); - mItemTitle->m_fy = (nR + psize * 0.85) * cos(dr); - mItemTitle->m_bCustom = true; - } - } - - // ====================== 4. 辐射线 ====================== - if (m_bGrid) { - wPen.setWidth(1); - double st = 360.0 / m_nArc; - for (int i = 0; i < m_nArc; i++) { - int ntmp = i % 9; - if (ntmp != 0) { - QCPItemLine* pLine = new QCPItemLine(this); - pLine->m_bCustom = true; - pLine->m_dr = qDegreesToRadians(i * st); - pLine->m_nRadius = 0; - pLine->m_nTailLen = nR; - pLine->setPen(wPen); - pLine->start->setCoords(centerY, centerX); - pLine->end->setCoords(centerY, centerX); - } - } - } - - // ====================== 5. 辐射圈(同心圆) ====================== - if (m_bGrid) { - qreal currentRadius = 0; - for (int i = 0; i < m_nCircle; i++) { - QCPItemEllipse* pEseInner = new QCPItemEllipse(this); - pEseInner->setPen(wPen); - pEseInner->m_bCustom = true; - currentRadius -= nR * 1.0 / m_nCircle; - pEseInner->m_nRadius = currentRadius; - pEseInner->topLeft->setCoords(centerY, centerX); - pEseInner->bottomRight->setCoords(centerY, centerX); - } - } - - // ====================== 6. 表格数据统计方位 ====================== - memset(ifdir, 0, sizeof(ifdir)); - float x1Step = 360.0 / m_nArc; - - // 遍历所有裂缝点 - for (int i = 0; i < nPointNum; i++) { - FRAC_TABLE frac = m_FracTabList.at(i); - bool bDraw = false; - - // 匹配裂缝类型 - for (int j = 0; j < nFracType; j++) { - FRAC_DEF fd = m_FracDefList.at(j); - if ((int)frac.ID == fd.iCode) { - bDraw = m_bTypeDraw[j]; - break; - } - } - - if (!bDraw) continue; - - deps = frac.DEP; - - // 判断是否在当前统计深度段内 - if (deps >= flDep && deps < flDep + nstep) { - float dipVal = frac.DIPorS; - if (dipVal > maxd || dipVal < mind) continue; - - float dirVal = frac.DIR; - int j = dirVal / x1Step; - if (j >= 0 && j < m_nArc + 1) { - ifdir[j]++; - } - } - } - - // ====================== 7. 找最大值 ====================== - dirmax = 0; - int iIndex = -1; - for (int i = 0; i <= m_nArc; i++) { - if (dirmax < ifdir[i]) { - iIndex = i; - dirmax = ifdir[i]; - } - } - if (dirmax == 0) dirmax = 1; - - // ====================== 8. 绘制玫瑰瓣 ====================== - flVal = 2 * pi / m_nArc; - QPolygonF myPolygon; - float oldx = 9999, oldy = 9999; - - for (int i = 0; i <= m_nArc; i++) { - dr = i * flVal; - float px = ifdir[i] * nR * sin(dr) / dirmax; - float py = ifdir[i] * nR * cos(dr) / dirmax; - - if (oldx != px || oldy != py) { - myPolygon << QPointF(px, py); - oldx = px; oldy = py; - } - - dr = (i + 1) * flVal; - px = ifdir[i] * nR * sin(dr) / dirmax; - py = ifdir[i] * nR * cos(dr) / dirmax; - - if (oldx != px || oldy != py) { - myPolygon << QPointF(px, py); - oldx = px; oldy = py; - } - } - - // 绘制第一个玫瑰瓣 - if (iIndex >= 0) { - QCPItemPolygon* pol = new QCPItemPolygon(this); - pol->topLeft->setCoords(centerY, centerX); - pol->bottomRight->setCoords(centerY, centerX); - pol->setPoints(myPolygon); - - if (m_rose_fill_enabled) - m_rose_stress_line_color.setAlpha(255); - else - m_rose_stress_line_color.setAlpha(0); - - pol->setBrushColor(m_rose_stress_line_color); - } - - // ====================== 9. 绘制反向玫瑰瓣 ====================== - myPolygon.clear(); - float tempfArc = m_nArc / 2.0; - - for (int i = 0; i <= m_nArc; i++) { - dr = i * flVal - tempfArc * flVal; - float px = ifdir[i] * nR * sin(dr) / dirmax; - float py = ifdir[i] * nR * cos(dr) / dirmax; - - if (oldx != px || oldy != py) { - myPolygon << QPointF(px, py); - oldx = px; oldy = py; - } - - dr = (i + 1) * flVal - tempfArc * flVal; - px = ifdir[i] * nR * sin(dr) / dirmax; - py = ifdir[i] * nR * cos(dr) / dirmax; - - if (oldx != px || oldy != py) { - myPolygon << QPointF(px, py); - oldx = px; oldy = py; - } - } - - if (iIndex >= 0) { - QCPItemPolygon* pol2 = new QCPItemPolygon(this); - pol2->topLeft->setCoords(centerY, centerX); - pol2->bottomRight->setCoords(centerY, centerX); - pol2->setPoints(myPolygon); - pol2->setBrushColor(m_rose_stress_line_color); - } - - // ====================== 10. 绘制垮塌方向线 ====================== - if (m_bJykt && iIndex >= 0) { - QPen collapsePen(m_rose_collapse_line_color, 2); - - dr = iIndex * flVal - pi / 2; - x1 = ifdir[iIndex] * nR * sin(dr) / dirmax; - y1 = ifdir[iIndex] * nR * cos(dr) / dirmax; - - dr = iIndex * flVal + pi / 2; - x2 = ifdir[iIndex] * nR * sin(dr) / dirmax; - y2 = ifdir[iIndex] * nR * cos(dr) / dirmax; - - this->addQCPItemLine(this, centerY, centerX, QPointF(x1, y1), QPointF(x2, y2), collapsePen); - - // 小箭头 - dr = iIndex * flVal; - float x3 = 0.1 * ifdir[iIndex] * nR * sin(dr) / dirmax; - float y3 = 0.1 * ifdir[iIndex] * nR * cos(dr) / dirmax; - this->addQCPItemLine(this, centerY, centerX, QPointF(x1, y1), QPointF(x3, y3), collapsePen); - this->addQCPItemLine(this, centerY, centerX, QPointF(x3, y3), QPointF(x2, y2), collapsePen); - - dr = iIndex * flVal - pi; - x3 = 0.1 * ifdir[iIndex] * nR * sin(dr) / dirmax; - y3 = 0.1 * ifdir[iIndex] * nR * cos(dr) / dirmax; - this->addQCPItemLine(this, centerY, centerX, QPointF(x1, y1), QPointF(x3, y3), collapsePen); - this->addQCPItemLine(this, centerY, centerX, QPointF(x3, y3), QPointF(x2, y2), collapsePen); - } - - flDep += nstep; - } - - this->replot(); -} - void QMyCustomPlot::addQCPItemLine(QMyCustomPlot *widget, float cx, float cy, const QPointF& p1, const QPointF& p2, const QPen& wPen) { QPolygonF myPolygon; diff --git a/logPlus/qmycustomplot.h b/logPlus/qmycustomplot.h index ab79b31..27ef7d6 100644 --- a/logPlus/qmycustomplot.h +++ b/logPlus/qmycustomplot.h @@ -663,34 +663,7 @@ public: int m_nArc, int m_rose_circle_radius_cm, int m_rose_radiation_circle_enabled, int m_rose_azimuth_print_interval, QColor m_rose_circle_line_color, int m_rose_circle_line_width, QColor m_rose_stress_line_color, QColor m_rose_collapse_line_color, bool m_rose_draw_radiation_line, bool m_rose_draw_wellbore_collapse, bool m_rose_fill_enabled, bool m_rose_draw_annotation, int nstep, float m_LeftVal, float m_RightVal); - void drawTabRose( - bool bTableData, - QString csCurveDDIR, - QString csCurveDANG, - QString qsDepth, - QString qsDIR, - QString qsDIP, - QString qsID, - QString csCurveGrad, - double m_LeftVal3, - double m_RightVal3, - QFont m_pl_fontScale, - int m_nArc, - int nR, - int m_nCircle, - int m_nAzimStep, - QColor m_rose_circle_line_color, - int m_rose_circle_line_width, - QColor m_rose_stress_line_color, - QColor m_rose_collapse_line_color, - bool m_bGrid, - bool m_bJykt, - bool m_rose_fill_enabled, - bool m_bHint, - int nstep, - float m_LeftVal, - float m_RightVal - ); + void addQCPItemLine(QMyCustomPlot *widget, float cx, float cy, const QPointF& p1, const QPointF& p2, const QPen& wPen); private: