From df9db57d8c9e18ba77e1ad06167b2ff5937b0690 Mon Sep 17 00:00:00 2001 From: jiayulong Date: Tue, 30 Dec 2025 11:18:02 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=95=E5=A3=81=E5=8F=96=E5=BF=83=E5=9B=BE?= =?UTF-8?q?=E5=83=8F=EF=BC=8C=E8=BF=BD=E5=8A=A0=E5=B7=A6=E4=BE=A7=E5=B0=96?= =?UTF-8?q?=E5=A4=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- logPlus/TransparentDraggableSwallCore.cpp | 44 +++++++++++++++++------ logPlus/TransparentDraggableSwallCore.h | 13 +++++++ logPlus/formdraw.cpp | 15 +++----- logPlus/formdraw.h | 1 + 4 files changed, 52 insertions(+), 21 deletions(-) diff --git a/logPlus/TransparentDraggableSwallCore.cpp b/logPlus/TransparentDraggableSwallCore.cpp index 8f02a0e..ea52c5d 100644 --- a/logPlus/TransparentDraggableSwallCore.cpp +++ b/logPlus/TransparentDraggableSwallCore.cpp @@ -94,10 +94,10 @@ void TransparentDraggableSwallCore::drawLith(double left_Low, double right_Hight return; } - double x1 = mPlot->xAxis->coordToPixel(left_Low); + double x1 = mPlot->xAxis->coordToPixel((left_Low+right_Hight)/2)+m_fImageHeight; double x2 = mPlot->xAxis->coordToPixel((left_Low+right_Hight)/2); - double y1 = mPlot->yAxis->coordToPixel(lY1); - double y2 = mPlot->yAxis->coordToPixel(lY1+(lY2-lY1)/5); + double y1 = mPlot->yAxis->coordToPixel(lY1)+(m_fLeftSpace+m_fTriangleLen); + double y2 = mPlot->yAxis->coordToPixel(lY1)+m_fImageWidth+(m_fLeftSpace+m_fTriangleLen); bool bWidthBig = false; double newWidth = y2-y1; @@ -253,9 +253,9 @@ void TransparentDraggableSwallCore::drawOil(double left_Low, double right_Hight, } double x1 = mPlot->xAxis->coordToPixel((left_Low+right_Hight)/2); - double x2 = mPlot->xAxis->coordToPixel(right_Hight); - double y1 = mPlot->yAxis->coordToPixel(lY1); - double y2 = mPlot->yAxis->coordToPixel(lY1+(lY2-lY1)/5); + double x2 = mPlot->xAxis->coordToPixel((left_Low+right_Hight)/2)-m_fImageHeight; + double y1 = mPlot->yAxis->coordToPixel(lY1)+(m_fLeftSpace+m_fTriangleLen); + double y2 = mPlot->yAxis->coordToPixel(lY1)+m_fImageWidth+(m_fLeftSpace+m_fTriangleLen); bool bWidthBig = false; double newWidth = y2-y1; @@ -327,8 +327,8 @@ void TransparentDraggableSwallCore::setRange(double left_Low, double right_Hight double lY1 = mPlot->yAxis->range().lower;//+10 double lY2 = mPlot->yAxis->range().upper; - mRect->topLeft->setCoords(left_Low, lY1); - mRect->bottomRight->setCoords(right_Hight, lY1+(lY2-lY1)/3); + mRect->topLeft->setCoords(left_Low, lY1+(m_fLeftSpace+m_fTriangleLen)); + mRect->bottomRight->setCoords(right_Hight, lY1+(m_fLeftSpace+m_fTriangleLen)+m_fImageWidth+m_fColorWordLen); // //位置与rect不一样,否则图像反转 // mPixmap_Color->topLeft->setCoords(right_Hight, lY1+(lY2-lY1)/4); @@ -347,11 +347,21 @@ void TransparentDraggableSwallCore::setRange(double left_Low, double right_Hight // 设置父锚点,定位点 //mItemTitle->position->setParentAnchor(mRect->bottom); mItemTitle->position->setCoords(mRect->bottomRight->coords().x(), //(mRect->topLeft->coords().x() + mRect->bottomRight->coords().x())/2, - lY1+(lY2-lY1)/4); //(mRect->topLeft->coords().y() + mRect->bottomRight->coords().y())/2); // 设置文本在矩形中心位置 + lY1+(m_fLeftSpace+m_fTriangleLen)+m_fImageWidth+20); //(mRect->topLeft->coords().y() + mRect->bottomRight->coords().y())/2); // 设置文本在矩形中心位置 //mRect->topLeft->setCoords(left, mPlot->yAxis->range().upper); //mRect->bottomRight->setCoords(right, mPlot->yAxis->range().lower); + //三角形2边 + m_qcpItemLine1->start->setCoords((left_Low+right_Hight)/2, lY1+m_fLeftSpace); + m_qcpItemLine1->end->setCoords(left_Low, lY1+(m_fLeftSpace+m_fTriangleLen)); + // + m_qcpItemLine2->start->setCoords((left_Low+right_Hight)/2, lY1+m_fLeftSpace); + m_qcpItemLine2->end->setCoords(right_Hight, lY1+(m_fLeftSpace+m_fTriangleLen)); + // + m_qcpItemLine3->start->setCoords((left_Low+right_Hight)/2, lY1+m_fLeftSpace); + m_qcpItemLine3->end->setCoords((left_Low+right_Hight)/2, lY1+(m_fLeftSpace+m_fTriangleLen)); + updateHandles(); mPlot->replot(); } @@ -389,6 +399,10 @@ void TransparentDraggableSwallCore::deleteRect() mPlot->removeItem(mPixmap_Oil); //mPlot->removeItem(mPixmap_Color); mPlot->removeItem(mItemTitle); + //三角形2边 + mPlot->removeItem(m_qcpItemLine1); + mPlot->removeItem(m_qcpItemLine2); + mPlot->removeItem(m_qcpItemLine3); mPlot->replot(); this->deleteLater(); @@ -411,7 +425,7 @@ void TransparentDraggableSwallCore::initRect() mRect = new QCPItemRect(mPlot); mRect->setLayer("overlay"); // 确保在最上层 mRect->setBrush(QBrush(QColor(255, 255, 255, 50))); // 半透明蓝色100, 100, 255, 50 - mRect->setPen(QPen(QColor(70, 70, 255, 200))); + mRect->setPen(QPen(QColor(0, 0, 0, 200))); // // 创建左右边界控制点 // mLeftHandle = new QCPItemRect(mPlot); @@ -458,6 +472,16 @@ void TransparentDraggableSwallCore::initRect() //mItemTitle->position->setType(QCPItemPosition::ptAxisRectRatio); mItemTitle->position->setCoords(0.5, 0); mItemTitle->setLayer("overlay"); + + //三角形2边 + m_qcpItemLine1 = new QCPItemLine(mPlot); + m_qcpItemLine1->setPen(QPen(QColor(0, 0, 0, 200))); + // + m_qcpItemLine2 = new QCPItemLine(mPlot); + m_qcpItemLine2->setPen(QPen(QColor(0, 0, 0, 200))); + // + m_qcpItemLine3 = new QCPItemLine(mPlot); + m_qcpItemLine3->setPen(QPen(QColor(0, 0, 0, 200))); } void TransparentDraggableSwallCore::updateHandles() diff --git a/logPlus/TransparentDraggableSwallCore.h b/logPlus/TransparentDraggableSwallCore.h index f0e8835..a2faa41 100644 --- a/logPlus/TransparentDraggableSwallCore.h +++ b/logPlus/TransparentDraggableSwallCore.h @@ -76,6 +76,10 @@ private: QCPItemText *mItemTitle; QString mstrTitle=""; QString m_strUuid = ""; + //三角形2边 + QCPItemLine *m_qcpItemLine1; + QCPItemLine *m_qcpItemLine2; + QCPItemLine *m_qcpItemLine3; QString m_Lith; QString m_Oil; @@ -92,6 +96,15 @@ private: // 添加最小宽度成员变量 double mMinWidth; + + // + float m_fLeftSpace=0; //左侧空白长度 + float m_fTriangleLen=40;//三角形长度 + // + float m_fImageWidth=70;//图片长度 + float m_fImageHeight=20;//图片高度 + // + float m_fColorWordLen=40;//颜色文字长度 }; #endif // TRANSPARENTDRAGGABLESWALLCORE_H diff --git a/logPlus/formdraw.cpp b/logPlus/formdraw.cpp index 7ad3dc3..e6bf640 100644 --- a/logPlus/formdraw.cpp +++ b/logPlus/formdraw.cpp @@ -1194,14 +1194,6 @@ void FormDraw::s_addDrawImage(QString strUuid, QString strSlfName, QString strWe //图像 成像 DrawImageNew_NoFilter(curv, strSlfName, ""); - //道-对象 - QString strAliasName = "井斜方位图"; - QString strUnit = "(°)"; - QColor newlineColor=QColor(0,0,0); - double width=2; - QString strScaleType = ""; - //道-对象 - m_formTrack->Add(strSlfName, m_strWellName, m_strTrackName, strLineName, strAliasName, strUnit, newlineColor, width, m_RightVal, m_LeftVal, strScaleType, "DrawImageObject"); // connect(curv, SIGNAL(mouseWheel(QWheelEvent*)), this, SLOT(s_mouseWheel(QWheelEvent*))); @@ -2066,7 +2058,7 @@ void FormDraw::DrawImageNew_NoFilter(QMyCustomPlot *widget, QString strSlfName, // 重新缩放键(x)和值(y)轴,以便可以看到整个颜色图: //widget->rescaleAxes(); - QString strAliasName = ""; + QString strAliasName = "成图"; QString strUnit = ""; QColor newlineColor=QColor(0,0,0); double width=2; @@ -4054,9 +4046,10 @@ void FormDraw::DrawDenv(QMyCustomPlot *widget, QString strSlfName) m_csCurveAZIM=("AZIM"); m_csCurveDEVI=("DEVI"); + m_nCircleLineWidth = 2 ; m_nTailWidth=2; m_TailColor=qRgb(255,0,0); - m_crPointFill=qRgb(0,255,0); + m_crPointFillDenv=qRgb(0,0,0); m_crCirCleColor = qRgb(0,0,255); m_nRadius = 4; m_nTailLen=8; @@ -4099,7 +4092,7 @@ void FormDraw::DrawDenv(QMyCustomPlot *widget, QString strSlfName) // QPen pPen(m_TailColor,m_nTailWidth); QPen pPen2(m_crCirCleColor,m_nCircleLineWidth); - QBrush cBrush(m_crPointFill); + QBrush cBrush(m_crPointFillDenv); float tempf,flVal; int i,j,nPointNum=0,tempi; diff --git a/logPlus/formdraw.h b/logPlus/formdraw.h index 5bdc6ba..f1041be 100644 --- a/logPlus/formdraw.h +++ b/logPlus/formdraw.h @@ -155,6 +155,7 @@ public: //井斜方位图 QString m_csCurveAZIM, m_csCurveDEVI; // 方位/倾角/可信度 曲线名 QColor m_TailColor,m_crCirCleColor;// add m_crCirCleColor圆线颜色 + QColor m_crPointFillDenv; //文字结论 void initWords(QMyCustomPlot *widget, QString strSlfName, QString strLineName);