From cbc97c6c6bf2b16ace7e762f3a12a1800fc35ed8 Mon Sep 17 00:00:00 2001 From: jiayulong Date: Fri, 27 Mar 2026 17:22:51 +0800 Subject: [PATCH] =?UTF-8?q?1.=E4=BA=95=E5=A3=81=E5=8F=96=E5=BF=83=EF=BC=8C?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=9B=BE=E5=BD=A2=E5=A4=96=E8=A7=82=EF=BC=8C?= =?UTF-8?q?=E4=B8=8E=E8=80=81=E7=89=88=E6=9C=AC=E4=B8=80=E8=87=B4=EF=BC=8C?= =?UTF-8?q?=E9=81=93=E5=AE=BD=E6=94=B9=E5=8F=98=E6=95=B4=E4=BD=93=E4=B8=8D?= =?UTF-8?q?=E5=8F=98=E5=BD=A2=E3=80=82=202.=E5=9B=BA=E4=BA=95=E7=BB=93?= =?UTF-8?q?=E8=AE=BA=E7=9A=84=E9=BB=91=E8=BE=B9=EF=BC=8C=E8=A7=A3=E5=86=B3?= =?UTF-8?q?=E4=B8=8D=E6=98=BE=E7=A4=BA=E9=97=AE=E9=A2=98=EF=BC=8C=E4=B8=8E?= =?UTF-8?q?=E8=80=81=E7=89=88=E6=9C=AC=E4=B8=80=E8=87=B4=EF=BC=8C=E9=81=93?= =?UTF-8?q?=E5=AE=BD=E6=94=B9=E5=8F=98=E5=B2=A9=E6=80=A7=E4=B8=8D=E5=8F=98?= =?UTF-8?q?=E5=BD=A2=E3=80=82=203.=E5=BD=95=E4=BA=95=E5=89=96=E9=9D=A2?= =?UTF-8?q?=EF=BC=8C=E5=90=84=E4=B8=AA=E7=BB=84=E4=BB=B6=E4=B8=AD=E9=97=B4?= =?UTF-8?q?=E7=94=A8=E9=BB=91=E7=BA=BF=E5=88=86=E5=89=B2=EF=BC=8C=E4=B8=8E?= =?UTF-8?q?=E8=80=81=E7=89=88=E6=9C=AC=E4=B8=80=E8=87=B4=EF=BC=8C=E9=81=93?= =?UTF-8?q?=E5=AE=BD=E6=94=B9=E5=8F=98=E5=B2=A9=E6=80=A7=E4=B8=8D=E5=8F=98?= =?UTF-8?q?=E5=BD=A2=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- logPlus/TransparentDraggableGeoLith.cpp | 69 +++++++++-- logPlus/TransparentDraggableGeoLith.h | 4 + logPlus/TransparentDraggableGujing.cpp | 11 +- logPlus/TransparentDraggableSwallCore.cpp | 141 ++++++++++++++-------- logPlus/TransparentDraggableSwallCore.h | 12 +- logPlus/formdraw.cpp | 3 + logPlus/qmycustomplot.cpp | 78 +++++++++++- logPlus/qmycustomplot.h | 12 ++ 8 files changed, 260 insertions(+), 70 deletions(-) diff --git a/logPlus/TransparentDraggableGeoLith.cpp b/logPlus/TransparentDraggableGeoLith.cpp index 4c605b8..62a965a 100644 --- a/logPlus/TransparentDraggableGeoLith.cpp +++ b/logPlus/TransparentDraggableGeoLith.cpp @@ -109,8 +109,8 @@ void TransparentDraggableGeoLith::drawLith(double left_Low, double right_Hight, return; } - double x1 = mPlot->xAxis->coordToPixel(left_Low); - double x2 = mPlot->xAxis->coordToPixel(right_Hight); + double x1 = mPlot->xAxis->coordToPixel(left_Low)-1; //下边上移1像素-1 + double x2 = mPlot->xAxis->coordToPixel(right_Hight)+1;//上边下移1像素+1 double y1 = 0; if(mPlot->m_bShowOil) { @@ -257,8 +257,8 @@ void TransparentDraggableGeoLith::drawColorLeft(double left_Low, double right_Hi GetWellNameAndPath(m_Color, filename, path); QString basename = filename; - double x1 = mPlot->xAxis->coordToPixel(left_Low); - double x2 = mPlot->xAxis->coordToPixel(right_Hight); + double x1 = mPlot->xAxis->coordToPixel(left_Low)-1; //下边上移1像素-1 + double x2 = mPlot->xAxis->coordToPixel(right_Hight)+1;//上边下移1像素+1 double y1 = mPlot->yAxis->coordToPixel(lY1); double y2 = mPlot->yAxis->coordToPixel(lY1+(lY2-lY1)/mPlot->m_dOilZhan); double newWidth = y2-y1; @@ -293,8 +293,8 @@ void TransparentDraggableGeoLith::drawColorLeft(double left_Low, double right_Hi // mPixmap_Color->setPixmap(QPixmap(val)); // 设置图片 - mPixmap_Color->topLeft->setCoords(right_Hight, lY1);//right_Hight - mPixmap_Color->bottomRight->setCoords(left_Low, lY1+(lY2-lY1)/mPlot->m_dOilZhan);//left_Low + mPixmap_Color->topLeft->setCoords(right_Hight, mPlot->yAxis->pixelToCoord(y1+1));//right_Hight + mPixmap_Color->bottomRight->setCoords(left_Low, mPlot->yAxis->pixelToCoord(y2-1));//left_Low } //设置m_Oil @@ -309,6 +309,13 @@ void TransparentDraggableGeoLith::drawOil(double left_Low, double right_Hight, d { mPixmap_Oil->topLeft->setCoords(0, 0); //right_Hight, lY1 mPixmap_Oil->bottomRight->setCoords(0, 0); //left_Low + + //含油2条线 + m_qcpItemLine1->start->setCoords(0, 0); + m_qcpItemLine1->end->setCoords(0, 0); + // + m_qcpItemLine2->start->setCoords(0, 0); + m_qcpItemLine2->end->setCoords(0, 0); return; } @@ -384,13 +391,34 @@ void TransparentDraggableGeoLith::drawOil(double left_Low, double right_Hight, d if(mPlot->m_bCenterOil)//含油性居中 { - mPixmap_Oil->topLeft->setCoords(xNewRight, lY1+ (lY2-lY1 -(lY2-lY1)/mPlot->m_dOilZhan) / 2.0); //right_Hight, lY1 - mPixmap_Oil->bottomRight->setCoords(xNewLeft, lY2- (lY2-lY1 -(lY2-lY1)/mPlot->m_dOilZhan) / 2.0); //left_Low + double yTmp1 = mPlot->yAxis->coordToPixel(lY1+ (lY2-lY1 -(lY2-lY1)/mPlot->m_dOilZhan) / 2.0); + double yTmp2 = mPlot->yAxis->coordToPixel(lY2- (lY2-lY1 -(lY2-lY1)/mPlot->m_dOilZhan) / 2.0); + + mPixmap_Oil->topLeft->setCoords(xNewRight, mPlot->yAxis->pixelToCoord(yTmp1+1)); //right_Hight, lY1 + mPixmap_Oil->bottomRight->setCoords(xNewLeft, mPlot->yAxis->pixelToCoord(yTmp2-2)); //left_Low + + if(mPlot->m_bShowColor || mPlot->m_bShowColorNum) // 绘制颜色号/显示颜色 + { + //颜色1条线 + m_qcpItemLine1->start->setCoords(right_Hight, mPlot->yAxis->pixelToCoord(y1)); + m_qcpItemLine1->end->setCoords(left_Low, mPlot->yAxis->pixelToCoord(y1)); + //第2条隐藏 + m_qcpItemLine2->start->setCoords(0, 0); + m_qcpItemLine2->end->setCoords(0, 0); + } } else { mPixmap_Oil->topLeft->setCoords(xNewRight, mPlot->yAxis->pixelToCoord(y1+1)); //right_Hight, lY1 - mPixmap_Oil->bottomRight->setCoords(xNewLeft, mPlot->yAxis->pixelToCoord(y2-1)); //left_Low + mPixmap_Oil->bottomRight->setCoords(xNewLeft, mPlot->yAxis->pixelToCoord(y2-2)); //left_Low + + //含油2条线 + m_qcpItemLine1->start->setCoords(right_Hight, mPlot->yAxis->pixelToCoord(y1)); + m_qcpItemLine1->end->setCoords(left_Low, mPlot->yAxis->pixelToCoord(y1)); + // + m_qcpItemLine2->start->setCoords(right_Hight, mPlot->yAxis->pixelToCoord(y2)); + m_qcpItemLine2->end->setCoords(left_Low, mPlot->yAxis->pixelToCoord(y2)); + } //mPlot->replot(); @@ -404,6 +432,12 @@ void TransparentDraggableGeoLith::setRange(double left_Low, double right_Hight, double lY1 = mPlot->yAxis->range().lower;//+10 double lY2 = mPlot->yAxis->range().upper; + //坐标转像素 + double x1 = mPlot->xAxis->coordToPixel(left_Low); + double x2 = mPlot->xAxis->coordToPixel(right_Hight); + double left_Low2 = mPlot->xAxis->pixelToCoord(x1-2); + double right_Hight2 = mPlot->xAxis->pixelToCoord(x2+1); + mRect->topLeft->setCoords(left_Low, lY1); mRect->bottomRight->setCoords(right_Hight, lY2); @@ -451,13 +485,13 @@ void TransparentDraggableGeoLith::setRange(double left_Low, double right_Hight, } } // - drawLith(left_Low, right_Hight, lY1, lY2); + drawLith(left_Low2, right_Hight2, lY1, lY2); //位置与rect不一样,否则图像反转 - drawOil(left_Low, right_Hight, lY1, lY2); + drawOil(left_Low2, right_Hight2, lY1, lY2); //左侧颜色 - drawColorLeft(left_Low, right_Hight, lY1, lY2); + drawColorLeft(left_Low2, right_Hight2, lY1, lY2); updateHandles(); @@ -501,6 +535,9 @@ void TransparentDraggableGeoLith::deleteRect() mPlot->removeItem(mPixmap_Oil); mPlot->removeItem(mPixmap_Color); mPlot->removeItem(mItemTitle); + //含油2边 + mPlot->removeItem(m_qcpItemLine1); + mPlot->removeItem(m_qcpItemLine2); //mPlot->replot(); this->deleteLater(); @@ -570,6 +607,14 @@ void TransparentDraggableGeoLith::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))); + } void TransparentDraggableGeoLith::updateHandles() diff --git a/logPlus/TransparentDraggableGeoLith.h b/logPlus/TransparentDraggableGeoLith.h index b9545c8..71a1150 100644 --- a/logPlus/TransparentDraggableGeoLith.h +++ b/logPlus/TransparentDraggableGeoLith.h @@ -87,6 +87,10 @@ public: QString mstrTitle=""; QString m_strUuid = ""; + //含油 2边 + QCPItemLine *m_qcpItemLine1; + QCPItemLine *m_qcpItemLine2; + QString m_Lith; QString m_Oil; QString m_Color; diff --git a/logPlus/TransparentDraggableGujing.cpp b/logPlus/TransparentDraggableGujing.cpp index 279d6db..0130135 100644 --- a/logPlus/TransparentDraggableGujing.cpp +++ b/logPlus/TransparentDraggableGujing.cpp @@ -181,9 +181,14 @@ void TransparentDraggableGujing::setRange(double left_Low, double right_Hight, b mRect->bottomRight->setCoords(right_Hight, lY2); //位置与rect不一样,否则图像反转 - mPixmap->topLeft->setCoords(right_Hight, lY1); - mPixmap->bottomRight->setCoords(left_Low, lY2); - drawResult(left_Low, right_Hight, lY1, lY2); + double x1 = mPlot->xAxis->coordToPixel(left_Low); + double x2 = mPlot->xAxis->coordToPixel(right_Hight); + double left_Low2 = mPlot->xAxis->pixelToCoord(x1-2); + double right_Hight2 = mPlot->xAxis->pixelToCoord(x2+1); + // + mPixmap->topLeft->setCoords(right_Hight2, lY1); + mPixmap->bottomRight->setCoords(left_Low2, lY2); + drawResult(left_Low2, right_Hight2, lY1, lY2); // 设置父锚点,定位点 mItemTitle->position->setCoords((mRect->topLeft->coords().x() + mRect->bottomRight->coords().x())/2, diff --git a/logPlus/TransparentDraggableSwallCore.cpp b/logPlus/TransparentDraggableSwallCore.cpp index a782e25..410a5f4 100644 --- a/logPlus/TransparentDraggableSwallCore.cpp +++ b/logPlus/TransparentDraggableSwallCore.cpp @@ -11,8 +11,8 @@ TransparentDraggableSwallCore::TransparentDraggableSwallCore(QMyCustomPlot *pare m_strUuid = strUuid; //图片高度(需要根据高度宏定义,重新计算) - double h = SideWallCoreHeight * g_dPixelPerCm; //0.4cm //40; - m_fImageHeight = h/2.0; +// double h = SideWallCoreHeight * g_dPixelPerCm; //0.4cm //40; +// m_fImageHeight = h/2.0; // initRect(); @@ -101,10 +101,10 @@ void TransparentDraggableSwallCore::drawLith(double left_Low, double right_Hight return; } - double x1 = mPlot->xAxis->coordToPixel((left_Low+right_Hight)/2)+m_fImageHeight; - double x2 = mPlot->xAxis->coordToPixel((left_Low+right_Hight)/2); + double x1 = mPlot->xAxis->coordToPixel((left_Low+right_Hight)/2)+m_fImageHeight-1; //下边上移1像素-1 + double x2 = mPlot->xAxis->coordToPixel((left_Low+right_Hight)/2)+1;//上边下移1像素+1 double y1 = mPlot->yAxis->coordToPixel(lY1)+(m_fLeftSpace+m_fTriangleLen); - double y2 = mPlot->yAxis->coordToPixel(lY1)+m_fImageWidth+(m_fLeftSpace+m_fTriangleLen); + double y2 = mPlot->yAxis->coordToPixel(lY1)+(m_fLeftSpace+m_fTriangleLen)+m_fImageWidth-1; bool bWidthBig = false; double newWidth = y2-y1; @@ -152,35 +152,36 @@ void TransparentDraggableSwallCore::drawLith(double left_Low, double right_Hight } else { - QString path,filename; - GetWellNameAndPath(filePath, filename, path); - QString basename = filename; +// QString path,filename; +// GetWellNameAndPath(filePath, filename, path); +// QString basename = filename; +// QString val=filePath; +// QImage image(newWidth, newHeight, QImage::Format_RGB32); +// QPainter painter(&image); +// QRectF fillRect(0,0,newWidth, newHeight); +// painter.fillRect(fillRect,Qt::white); +// // +// bool isOne=true; +// bool isStech=true; +// bool isHorizon=false; +// float cm = g_dPixelPerCm;//一厘米对应的像素个数 +// QColor bkColor = QColor(255,255,255,0); - QString val=filePath; - QImage image(newWidth, newHeight, QImage::Format_RGB32); - QPainter painter(&image); - QRectF fillRect(0,0,newWidth, newHeight); - painter.fillRect(fillRect,Qt::white); - // - bool isOne=true; - bool isStech=true; - bool isHorizon=false; - float cm = g_dPixelPerCm;//一厘米对应的像素个数 - QColor bkColor = QColor(255,255,255,0); - - float GeoResult = m_drawGeo.seleGeo("岩性符号库", basename, &painter, fillRect, isOne, isStech, isHorizon, cm, bkColor); - - val=GetImagePath()+"TempNew"; - QDir ss; - if(!ss.exists(val)) { - ss.mkdir(val); - } - val+=QDir::separator(); - val+=basename+".png"; - image.save(val); +// float GeoResult = m_drawGeo.seleGeo("岩性符号库", basename, &painter, fillRect, isOne, isStech, isHorizon, cm, bkColor); +// val=GetImagePath()+"TempNew"; +// QDir ss; +// if(!ss.exists(val)) { +// ss.mkdir(val); +// } +// val+=QDir::separator(); +// val+=basename+".png"; +// image.save(val); // - mPixmap_Lith->setPixmap(QPixmap(val)); // 设置图片 +// mPixmap_Lith->setPixmap(QPixmap(val)); // 设置图片 + + // + mPixmap_Lith->setPixmap(QPixmap(m_Lith)); // 设置图片 } mPixmap_Lith->topLeft->setCoords(mPlot->xAxis->pixelToCoord(x2), mPlot->yAxis->pixelToCoord(y1));//right_Hight+1 mPixmap_Lith->bottomRight->setCoords(mPlot->xAxis->pixelToCoord(x1), mPlot->yAxis->pixelToCoord(y2));//left_Low-1 @@ -199,9 +200,9 @@ void TransparentDraggableSwallCore::drawOil(double left_Low, double right_Hight, return; } - double x1 = mPlot->xAxis->coordToPixel((left_Low+right_Hight)/2); - double x2 = mPlot->xAxis->coordToPixel((left_Low+right_Hight)/2)-m_fImageHeight; - double y1 = mPlot->yAxis->coordToPixel(lY1)+(m_fLeftSpace+m_fTriangleLen); + double x1 = mPlot->xAxis->coordToPixel((left_Low+right_Hight)/2); + double x2 = mPlot->xAxis->coordToPixel((left_Low+right_Hight)/2)-m_fImageHeight;// + double y1 = mPlot->yAxis->coordToPixel(lY1)+(m_fLeftSpace+m_fTriangleLen)+0.333*m_fImageWidth; double y2 = mPlot->yAxis->coordToPixel(lY1)+m_fImageWidth+(m_fLeftSpace+m_fTriangleLen); bool bWidthBig = false; @@ -274,27 +275,51 @@ 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+(m_fLeftSpace+m_fTriangleLen)); - mRect->bottomRight->setCoords(right_Hight, lY1+(m_fLeftSpace+m_fTriangleLen)+m_fImageWidth+m_fColorWordLen); + //坐标转像素 + double x1 = mPlot->xAxis->coordToPixel(left_Low); + double x2 = mPlot->xAxis->coordToPixel(right_Hight); + double left_Low2 = mPlot->xAxis->pixelToCoord(x1-2); + double right_Hight2 = mPlot->xAxis->pixelToCoord(x2+1); + double y1 = mPlot->yAxis->coordToPixel(lY1); + double y2 = mPlot->yAxis->coordToPixel(lY2); - drawLith(left_Low, right_Hight, lY1, lY2); + mRect->topLeft->setCoords(left_Low, mPlot->yAxis->pixelToCoord(y1+(m_fLeftSpace+m_fTriangleLen)+m_fImageWidth)); + mRect->bottomRight->setCoords(right_Hight, mPlot->yAxis->pixelToCoord(y1+(m_fLeftSpace+m_fTriangleLen)+m_fImageWidth+m_fColorWordLen)); + + + + drawLith(left_Low2, right_Hight2, lY1, lY2); + + drawOil(left_Low2, right_Hight2, lY1, lY2); + + mItemTitle->position->setCoords(mPlot->xAxis->pixelToCoord(x2+8), + mPlot->yAxis->pixelToCoord(y1+(m_fLeftSpace+m_fTriangleLen)+m_fImageWidth+12)); - drawOil(left_Low, right_Hight, lY1, lY2); - mItemTitle->position->setCoords(mRect->bottomRight->coords().x(), - lY1+(m_fLeftSpace+m_fTriangleLen)+m_fImageWidth+20); //三角形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_qcpItemLine1->start->setCoords((left_Low+right_Hight)/2, mPlot->yAxis->pixelToCoord(y1+m_fLeftSpace)); + m_qcpItemLine1->end->setCoords(left_Low, mPlot->yAxis->pixelToCoord(y1+(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_qcpItemLine2->start->setCoords((left_Low+right_Hight)/2, mPlot->yAxis->pixelToCoord(y1+m_fLeftSpace)); + m_qcpItemLine2->end->setCoords(right_Hight, mPlot->yAxis->pixelToCoord(y1+(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)); + m_qcpItemLine3->start->setCoords((left_Low+right_Hight)/2, mPlot->yAxis->pixelToCoord(y1+m_fLeftSpace)); + m_qcpItemLine3->end->setCoords((left_Low+right_Hight)/2, mPlot->yAxis->pixelToCoord(y1+(m_fLeftSpace+m_fTriangleLen)+m_fImageWidth)); + // + m_qcpItemLine4->start->setCoords(right_Hight, mPlot->yAxis->pixelToCoord(y1+(m_fLeftSpace+m_fTriangleLen))); + m_qcpItemLine4->end->setCoords(right_Hight, mPlot->yAxis->pixelToCoord(y1+(m_fLeftSpace+m_fTriangleLen)+m_fImageWidth+m_fColorWordLen)); + // + m_qcpItemLine5->start->setCoords(left_Low, mPlot->yAxis->pixelToCoord(y1+(m_fLeftSpace+m_fTriangleLen))); + m_qcpItemLine5->end->setCoords(left_Low, mPlot->yAxis->pixelToCoord(y1+(m_fLeftSpace+m_fTriangleLen)+m_fImageWidth+m_fColorWordLen)); + // + m_qcpItemLine6->start->setCoords(right_Hight, mPlot->yAxis->pixelToCoord(y1+(m_fLeftSpace+m_fTriangleLen)+m_fImageWidth)); + m_qcpItemLine6->end->setCoords(left_Low, mPlot->yAxis->pixelToCoord(y1+(m_fLeftSpace+m_fTriangleLen)+m_fImageWidth)); + // + m_qcpItemLine7->start->setCoords(right_Hight, mPlot->yAxis->pixelToCoord(y1+(m_fLeftSpace+m_fTriangleLen)+m_fImageWidth+m_fColorWordLen)); + m_qcpItemLine7->end->setCoords(left_Low, mPlot->yAxis->pixelToCoord(y1+(m_fLeftSpace+m_fTriangleLen)+m_fImageWidth+m_fColorWordLen)); - updateHandles(); + //updateHandles(); //刷新,针对批量修改不在此处刷新,后面统一刷新 if(bReplot) { @@ -339,6 +364,10 @@ void TransparentDraggableSwallCore::deleteRect() mPlot->removeItem(m_qcpItemLine1); mPlot->removeItem(m_qcpItemLine2); mPlot->removeItem(m_qcpItemLine3); + mPlot->removeItem(m_qcpItemLine4); + mPlot->removeItem(m_qcpItemLine5); + mPlot->removeItem(m_qcpItemLine6); + mPlot->removeItem(m_qcpItemLine7); //mPlot->replot(); this->deleteLater(); @@ -360,8 +389,8 @@ 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(0, 0, 0, 200))); + mRect->setBrush(QBrush(QColor(255, 255, 255, 50))); // 半透明蓝色100, 100, 255, 50 + mRect->setPen(QPen(QColor(0, 0, 0, 255))); // // 创建左右边界控制点 // mLeftHandle = new QCPItemRect(mPlot); @@ -401,7 +430,7 @@ void TransparentDraggableSwallCore::initRect() mItemTitle = new QCPItemText(mPlot); mItemTitle->setText(mstrTitle); //mItemTitle->setBrush(QBrush(Qt::red)); - mItemTitle->setFont(QFont("Arial", 12, QFont::Bold)); + mItemTitle->setFont(QFont("Arial", 6, QFont::Light)); mItemTitle->setColor(Qt::black); mItemTitle->setPositionAlignment(Qt::AlignTop | Qt::AlignHCenter); mItemTitle->position->setType(QCPItemPosition::ptPlotCoords); @@ -418,6 +447,18 @@ void TransparentDraggableSwallCore::initRect() // m_qcpItemLine3 = new QCPItemLine(mPlot); m_qcpItemLine3->setPen(QPen(QColor(0, 0, 0, 200))); + // + m_qcpItemLine4 = new QCPItemLine(mPlot); + m_qcpItemLine4->setPen(QPen(QColor(0, 0, 0, 200))); + // + m_qcpItemLine5 = new QCPItemLine(mPlot); + m_qcpItemLine5->setPen(QPen(QColor(0, 0, 0, 200))); + // + m_qcpItemLine6 = new QCPItemLine(mPlot); + m_qcpItemLine6->setPen(QPen(QColor(0, 0, 0, 200))); + // + m_qcpItemLine7 = new QCPItemLine(mPlot); + m_qcpItemLine7->setPen(QPen(QColor(0, 0, 0, 200))); } void TransparentDraggableSwallCore::updateHandles() diff --git a/logPlus/TransparentDraggableSwallCore.h b/logPlus/TransparentDraggableSwallCore.h index d328837..b4172fd 100644 --- a/logPlus/TransparentDraggableSwallCore.h +++ b/logPlus/TransparentDraggableSwallCore.h @@ -81,6 +81,10 @@ public: QCPItemLine *m_qcpItemLine1; QCPItemLine *m_qcpItemLine2; QCPItemLine *m_qcpItemLine3; + QCPItemLine *m_qcpItemLine4; + QCPItemLine *m_qcpItemLine5; + QCPItemLine *m_qcpItemLine6; + QCPItemLine *m_qcpItemLine7; QString m_Lith; QString m_Oil; @@ -99,12 +103,12 @@ public: // float m_fLeftSpace=0; //左侧空白长度 - float m_fTriangleLen=40;//三角形长度 + float m_fTriangleLen=16;//三角形长度 // - float m_fImageWidth=70;//图片长度 - float m_fImageHeight=20;//图片高度(需要根据高度宏定义,重新计算) + float m_fImageWidth=45;//图片长度 + float m_fImageHeight=16;//图片高度(需要根据高度宏定义,重新计算) // - float m_fColorWordLen=40;//颜色文字长度 + float m_fColorWordLen=30;//颜色文字长度 //鼠标形状 bool m_bArrow = false; diff --git a/logPlus/formdraw.cpp b/logPlus/formdraw.cpp index 594b7d5..313c919 100644 --- a/logPlus/formdraw.cpp +++ b/logPlus/formdraw.cpp @@ -2707,6 +2707,9 @@ void FormDraw::setColWidth(int iNewWidth) { form->setConclusionProportion(0); } + //道宽改变后,避免井壁取心等组件变形,需要重新刷新 + form->resetPosition(); + form->replot();//屏蔽,缩减时间 } } diff --git a/logPlus/qmycustomplot.cpp b/logPlus/qmycustomplot.cpp index a1d7cf8..677010f 100644 --- a/logPlus/qmycustomplot.cpp +++ b/logPlus/qmycustomplot.cpp @@ -4958,7 +4958,7 @@ void QMyCustomPlot::addSwallCoreToPlot(double Depth, QString LithologyImage, QSt //左侧空白 dragRect->m_fLeftSpace = Sideleft*g_dPixelPerCm; // 设置初始范围 - double h = SideWallCoreHeight * g_dPixelPerCm; //0.4cm //40; + double h = 32;//SideWallCoreHeight * g_dPixelPerCm; //0.4cm //40; double x1 = this->xAxis->coordToPixel(Depth); // double Depth2 = this->xAxis->pixelToCoord(x1-h); @@ -9508,3 +9508,79 @@ void QMyCustomPlot::s_changeLineName(QString strUuid, QString strSlfName, QStrin s_ReloadPlot(strUuid, strSlfName, strNewLineName); //RefreshItems_Jiegutext(); } + +//固井结论 +void QMyCustomPlot::resetPosition_Gujing() +{ + TransparentDraggableGujing *pDraggableRect =NULL; + QMap::Iterator it = m_mapDraggable_Gujing.begin(); + while( it != m_mapDraggable_Gujing.end() ) + { + pDraggableRect = (TransparentDraggableGujing*)it.value(); + it++; + // + QCPRange tmpRange = pDraggableRect->getRange(); + pDraggableRect->setRange(tmpRange.lower, tmpRange.upper, false); + } +} + +//井壁取心 +void QMyCustomPlot::resetPosition_SwallCore() +{ + TransparentDraggableSwallCore *pDraggableRect =NULL; + QMap::Iterator it = m_mapDraggable_SwallCore.begin(); + while( it != m_mapDraggable_SwallCore.end() ) + { + pDraggableRect = (TransparentDraggableSwallCore*)it.value(); + it++; + // + QCPRange tmpRange = pDraggableRect->getRange(); + pDraggableRect->setRange(tmpRange.lower, tmpRange.upper, false); + } +} + +//录井剖面 +void QMyCustomPlot::resetPosition_GeoLith() +{ + TransparentDraggableGeoLith *pDraggableRect =NULL; + QMap::Iterator it = m_mapDraggable_GeoLith.begin(); + while( it != m_mapDraggable_GeoLith.end() ) + { + pDraggableRect = (TransparentDraggableGeoLith*)it.value(); + it++; + // + QCPRange tmpRange = pDraggableRect->getRange(); + pDraggableRect->setRange(tmpRange.lower, tmpRange.upper, false); + } +} + +//地质层位 +void QMyCustomPlot::resetPosition_Layer() +{ + TransparentDraggableLayer *pDraggableRect =NULL; + QMap::Iterator it = m_mapDraggable_Layer.begin(); + while( it != m_mapDraggable_Layer.end() ) + { + pDraggableRect = (TransparentDraggableLayer*)it.value(); + it++; + // + QCPRange tmpRange = pDraggableRect->getRange(); + pDraggableRect->setRange(tmpRange.lower, tmpRange.upper, false); + } +} + +//道宽改变后,避免井壁取心等组件变形,需要重新刷新 +void QMyCustomPlot::resetPosition() +{ + //固井结论 + resetPosition_Gujing(); + //井壁取心 + resetPosition_SwallCore(); + //录井剖面 + resetPosition_GeoLith(); + //地质层位 + resetPosition_Layer(); + + //刷新 + replot(); +} diff --git a/logPlus/qmycustomplot.h b/logPlus/qmycustomplot.h index 7e8613b..7126f6f 100644 --- a/logPlus/qmycustomplot.h +++ b/logPlus/qmycustomplot.h @@ -80,6 +80,18 @@ public: void setShowProperty(QVariant val, int ntag); void setConclusionProportion(int nCopro); void setShowPos(int nSPos); + + //道宽改变后,避免井壁取心等组件变形,需要重新刷新 + void resetPosition(); + //固井结论 + void resetPosition_Gujing(); + //井壁取心 + void resetPosition_SwallCore(); + //录井剖面 + void resetPosition_GeoLith(); + //地质层位 + void resetPosition_Layer(); + protected: //virtual void mouseMoveEvent(QMouseEvent *event);