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: