From 8470531a3a2314371103c8a6880847e2ff85af2c Mon Sep 17 00:00:00 2001 From: "DESKTOP-450PEFP\\mainc" Date: Sat, 27 Dec 2025 10:43:17 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=20=E9=A2=91=E7=8E=87?= =?UTF-8?q?=E7=BB=9F=E8=AE=A1=E5=9B=BE=EF=BC=8C=E8=A1=A8=E6=A0=BC=EF=BC=8C?= =?UTF-8?q?=E6=9B=B2=E7=BA=BF=E7=BB=98=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- logPlus/3rd_qcustomplot/v2_1/qcustomplot.cpp | 63 ++++++ logPlus/3rd_qcustomplot/v2_1/qcustomplot.h | 33 +++ logPlus/formdraw.cpp | 220 ++++++++++++++++++- 3 files changed, 305 insertions(+), 11 deletions(-) diff --git a/logPlus/3rd_qcustomplot/v2_1/qcustomplot.cpp b/logPlus/3rd_qcustomplot/v2_1/qcustomplot.cpp index 5d166a2..2208beb 100644 --- a/logPlus/3rd_qcustomplot/v2_1/qcustomplot.cpp +++ b/logPlus/3rd_qcustomplot/v2_1/qcustomplot.cpp @@ -31412,6 +31412,69 @@ QPen QCPItemBracket::mainPen() const /* end of 'src/items/item-bracket.cpp' */ +QCPItemPolygon::QCPItemPolygon(QCustomPlot *parentPlot) : + QCPAbstractItem(parentPlot), + topLeft(createPosition("topLeft")), + topRight(createPosition("topRight")), + bottomLeft(createPosition("bottomLeft")), + bottomRight(createPosition("bottomRight")) +{ + topLeft->setCoords(0, 1); + topRight->setCoords(1, 1); + bottomLeft->setCoords(0, 0); + bottomRight->setCoords(1, 0); + + // 此处填写真实的坐标! + // vertices << QPointF(-71.8, 5.2) << QPointF(-68.2, -5.2) << QPointF(6.7, 4.9) << QPointF(3.1, 15.3); +} + +void QCPItemPolygon::draw(QCPPainter *painter) +{ + if (ni < 0) + return; + + QPointF center(topLeft->pixelPosition()); + + float x = center.x(); + float y = center.y(); + + float dr=ni*flVal; + float x1 = x + ifdir*sin(dr); + float y1 = y - ifdir*cos(dr); + dr=(ni+1)*flVal; + float x2 = x + ifdir*sin(dr); + float y2 = y - ifdir*cos(dr); + + QPolygonF myPolygon; + myPolygon << QPointF(x, y); + myPolygon << QPointF(x1, y1); + myPolygon << QPointF(x2, y2); + myPolygon << QPointF(x, y); + + painter->setPen(Qt::black); // Set the pen color as needed + painter->setBrush(QBrush(Qt::black)); // Set the brush if needed + painter->drawPolygon(myPolygon); +} + +QPointF QCPItemPolygon::anchorPixelPosition(int anchorId) const +{ + Q_UNUSED(anchorId) + return QPointF(); +} + +void QCPItemPolygon::setPoints(const QVector &vecPoint) +{ + vertices.clear(); + vertices = vecPoint; +} + +void QCPItemPolygon::setPloyVal(int i, float fv, float dir) +{ + ni = i; + flVal = fv; + ifdir = dir; +} + /* including file 'src/polar/radialaxis.cpp' */ /* modified 2021-03-29T02:30:44, size 49415 */ diff --git a/logPlus/3rd_qcustomplot/v2_1/qcustomplot.h b/logPlus/3rd_qcustomplot/v2_1/qcustomplot.h index c6ebb6f..4e50f7f 100644 --- a/logPlus/3rd_qcustomplot/v2_1/qcustomplot.h +++ b/logPlus/3rd_qcustomplot/v2_1/qcustomplot.h @@ -7838,6 +7838,39 @@ Q_DECLARE_METATYPE(QCPItemBracket::BracketStyle) /* end of 'src/items/item-bracket.h' */ +class QCPItemPolygon : public QCPAbstractItem +{ + Q_OBJECT +public: + explicit QCPItemPolygon(QCustomPlot *parentPlot); + double selectTest(const QPointF&, bool, QVariant*) const override { return 0; } + virtual ~QCPItemPolygon() {} + + // 设置真实的点信息 + void setPoints(const QVector& vecPoint); + + void setPloyVal(int i, float fv, float dir); + + // Define position types + QCPItemPosition * const topLeft; + QCPItemPosition * const topRight; + QCPItemPosition * const bottomLeft; + QCPItemPosition * const bottomRight; + + // Define the polygon vertices + QVector vertices; + + int ni = -1; + float flVal; + float ifdir; + float dr; + + +protected: + virtual void draw(QCPPainter *painter) override; + virtual QPointF anchorPixelPosition(int anchorId) const override; +}; + /* including file 'src/polar/radialaxis.h' */ /* modified 2021-03-29T02:30:44, size 12227 */ diff --git a/logPlus/formdraw.cpp b/logPlus/formdraw.cpp index 2af2d01..d27d402 100644 --- a/logPlus/formdraw.cpp +++ b/logPlus/formdraw.cpp @@ -1815,11 +1815,11 @@ void FormDraw::initTableLine(QMyCustomPlot *widget, QString strSlfName, QString m_qsProperty=("ID"); m_iPrecision = 3; // -// ReadFracDef(); -// for (int i = 0 ; i < iFracType ; i++) -// { -// m_bTypeDraw[i] = false; -// } + // ReadFracDef(); + // for (int i = 0 ; i < iFracType ; i++) + // { + // m_bTypeDraw[i] = true; + // } if (m_bTableData) { @@ -2864,8 +2864,20 @@ void FormDraw::initFgrq(QMyCustomPlot *widget) widget->xAxis = yAxis; widget->yAxis = xAxis; - if(m_Value == NULL) + + // if(m_Value == NULL) { + m_bTableData = true; // 表格 曲线 + m_csCurveDDIR = "DDIR"; // 方位 曲线名 + m_csCurveDANG = "DANG";//倾角 + m_csCurveGrad = "GRAD"; + + m_qsTable="FRAC_HOLE.TABLE"; + m_qsDIR=("DDIR"); // 方位 曲线名 + m_qsDIP=("DANG");//倾角 + m_qsDepth="DEPT"; + m_qsID = "ID"; + Refurbish(); } @@ -2874,12 +2886,44 @@ void FormDraw::initFgrq(QMyCustomPlot *widget) QPen wPen(Qt::black, 2); double centerX = widget->m_iX2/2; - int nstep = 10; - int tmp = m_SDep / nstep; + 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; + float mind=min(m_RightVal , m_LeftVal); + float maxd=max(m_RightVal , m_LeftVal); + float dirmax,dipmax,dr; + + float deps; + + float ftmpSdep = m_SDep; + float ftmpEdep = m_EDep; + if (m_bTableData) + { + ReadFracDef(); + for (int i = 0 ; i < iFracType ; i++) + { + m_bTypeDraw[i] = true; + } + + ftmpSdep = -g_iY2; + ftmpEdep = -g_iY1; + } + + int nPointNum = m_FracTabList.count(); + int n = m_FracDefList.count(); + int nstep = 5; + int tmp = ftmpSdep / nstep; float flDep = tmp * nstep; + + m_Curve.DepLevel = 0.5; while ( 1) { - if((flDep>=m_EDep+nstep)||flDep>=m_EDep)break; + if((flDep>=ftmpEdep+nstep)||flDep>=ftmpEdep)break; double tempf = flDep+(float)(nstep)/2.; double centerY = tempf * -1.0; @@ -2903,6 +2947,149 @@ void FormDraw::initFgrq(QMyCustomPlot *widget) pLine1->end->setCoords(centerY,centerX); } + for(int i=0;i<=m_nArc;i++) ifdir[i]=0.; + x1 = 360./m_nArc; + + int i = 0; + if (m_bTableData) + { + int m_nLine = 9; + y1 = (maxd-mind)/m_nLine;//线数 + for (i=0; i= flDep &&deps < (flDep+ nstep) ) + { + flVal = frac.DIR;//方位 + int j = flVal/x1; + if ( j >= 0 && j< m_nArc+1 ) + ifdir[j] ++; + + flVal = frac.DIPorS;//倾角 + //按倾角范围统计 + if(flVal> maxd || flVal < mind) + { + //i++; + continue; + } + // j = (flVal-mind)/y1;//j = flVal/y1+1; + // if ( j >= 0 && j< m_nLine+1 ) + // ifdir[j] ++; + } + } + } + else + { + while ( 1 ) + { + deps = flDep + i * m_Curve.DepLevel; + + tempf = (deps-m_Curve.StartDepth)/m_Curve.DepLevel+0.5; + if (deps >= ftmpEdep|| + deps > m_Curve.EndDepth|| + deps >=( flDep + nstep)) + break; + if(tempf<0) + { + i++; + continue; + } + + if (m_Value3 !=NULL )// for 控制曲线 + { + float tempf3 = (deps-m_Curve3.StartDepth)/m_Curve3.DepLevel+0.5; + if(tempf3<0) + { + i++; + continue; + } + double grad = GetData(m_Curve3.RepCode,(char *)&m_Value3[(int)(tempf3)*m_Curve3.CodeLen]); + if(gradm_RightVal3){i++;continue;} + } + + flVal = GetData(m_Curve.RepCode,(char *)&m_Value[(int)(tempf)*m_Curve.CodeLen]); + flVal=fmod(flVal,360.f); + int j = flVal/x1; + if ( j >= 0 && j< m_nArc+1 ) + ifdir[j] ++; + + tempf = (deps-m_Curve2.StartDepth)/m_Curve2.DepLevel+0.5; + if(tempf<0 ) + { + i++; + continue; + } + + //按倾角范围统计 + if(flVal> maxd || flVal < mind) + { + i++; + continue; + } + i ++; + } + } + + flVal = 3.1415926535 *2./ m_nArc ; + dirmax=0; dipmax=0; + for(i=0;i<=m_nArc;i++) + if (dirmaxtopLeft->setCoords(x, y); + pol->bottomRight->setCoords(x, y); + pol->setPloyVal(i,flVal, ifdir[i]); + // pol->setPoints(myPolygon); + // pol->setPoints(myPolygon); + + // QCPItemRect* prt = new QCPItemRect(widget); + // prt->topLeft->setCoords(x, y); + // prt->bottomRight->setCoords(x, y); + + // if(m_bFill) + // { + // QPainterPath myPath; + // myPath.addPolygon(myPolygon); + // pDC->fillPath(myPath,textBrushFill); + // } + // if(m_nArcLineWidth>=1) + // { + // pDC->setPen(pPenArc); + // // pDC->drawPolygon(myPolygon); + // } + } + flDep += nstep; } @@ -3547,7 +3734,8 @@ void FormDraw::ReadFracDef() QString qs; //sprintf(str,"%sconf\\FRAC.CFG",path); - QString fracFilePath = GetConfPath() + "FRAC_New.CFG"; + // QString fracFilePath = GetConfPath() + "FRAC_New.CFG"; + QString fracFilePath = GetConfPath() + "FRAC.CFG"; fp = fopen(fracFilePath.toStdString().c_str(),"r"); if ( fp !=NULL ) { @@ -3725,7 +3913,17 @@ void FormDraw::ReadData(QString strSlfName, QString strLineName) if ( m_qsDIR.compare(cs)==0) frac.DIR = val; if ( m_qsID.compare(cs)==0) - frac.ID = (int)(val); + { + // frac.ID = (int)(val); + if(Table_Field[j].RepCode == 6) + { + char buf[513]; + memset(buf,0,513); + strncpy(buf,&buffer[len],Table_Field[j].Length); + buf[Table_Field[j].Length]='\0'; + frac.ID = atoi(buf); + } + } len += Table_Field[j].Length; }