diff --git a/CallManage/CallManage.h b/CallManage/CallManage.h index e86eb55..9304065 100644 --- a/CallManage/CallManage.h +++ b/CallManage/CallManage.h @@ -218,16 +218,39 @@ signals: void sig_AddShiftLine(QString strUuid, double left_Low, double right_Hight); //校深线段 void sig_AddShifLineToPlot(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, double left_Low, double right_Hight); + //校深(主校补充线段) + void sig_AddShiftLine_Master(QString strUuid, double left_Low, double right_Hight, QString strUuid_biaozhun); + //校深线段(主校补充线段) + void sig_AddShifLineToPlot_Master(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, double left_Low, double right_Hight, QString strUuid_biaozhun); + //校准线段移动 + void sig_MoveLine_Jiaozhun(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, double left_Low, double right_Hight, QString strUuid_biaozhun); + //校准线段颜色(重新选中) + void sig_ChangeLineColor_Jiaozhun(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString strUuid_biaozhun); + //补充线段颜色(重新选中) + void sig_ChangeLineColor_Master(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString strUuid_biaozhun); //右键--清除当前分段线 void sig_DelSelectShiftLine(QString strUuid); //清除当前分段线 - void sig_DelSelectShiftLineFromPlot(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName); + void sig_DelSelectShiftLineFromPlot(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString strTrackName_Right, QString strLineName_Right); + //清除当前分段线 + void sig_DelSelectShiftLineFromPlot_Master(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString strUuid_biaozhun); //右键--清除全部分段线 void sig_DelAllShiftLine(QString strUuid); //清除全部分段线 void sig_DelAllShiftLineFromPlot(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName); + //清除全部分段线 + void sig_DelAllShiftLineFromPlot_Master(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName); + + //校准曲线拖动后,通知补充线段移动 + void sig_ChangeRange_Master(QString strUuid, double left_Low, double right_Hight, QString strUuid_biaozhun); + //补充曲线拖动后,通知校准线段移动 + void sig_ChangeRange_Jiaozhun(QString strUuid, double left_Low, double right_Hight, QString strUuid_biaozhun); + //补充曲线选中后,改变校准线段颜色(重新选中) + void sig_ChangeSelectShiftLineColor_Jiaozhun(QString strUuid, QString strUuid_biaozhun); + //校准曲线选中后,改变补充线段颜色(重新选中) + void sig_ChangeSelectShiftLineColor_Master(QString strUuid, QString strUuid_biaozhun); //执行校正 void sig_RuncorFromPlot(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName); diff --git a/logPlus/TransparentDraggableLine.cpp b/logPlus/TransparentDraggableLine.cpp index 4e118c1..ed375bf 100644 --- a/logPlus/TransparentDraggableLine.cpp +++ b/logPlus/TransparentDraggableLine.cpp @@ -1,4 +1,5 @@ -#include "TransparentDraggableLine.h" +#include "TransparentDraggableLine.h" +#include "CallManage.h" extern double g_dPixelPerCm;//每厘米像素数 //static GeoIndicatorGenerator m_drawGeo; @@ -53,6 +54,8 @@ void TransparentDraggableLine::setRange(double left_Low, double right_Hight, boo qcpItemLine->start->setCoords(left_Low, lY1);//圆心位置 qcpItemLine->end->setCoords(right_Hight, lY2);//圆心位置 + emit CallManage::getInstance()->sig_ChangeRange_Master(mPlot->m_strUuid, right_Hight, right_Hight, m_strUuid); + //updateHandles(); //刷新,针对批量修改不在此处刷新,后面统一刷新 if(bReplot) @@ -95,7 +98,7 @@ void TransparentDraggableLine::initRect() connect(mPlot, &QCustomPlot::mouseRelease, this, &TransparentDraggableLine::onMouseRelease); qcpItemLine = new QCPItemLine(mPlot); - qcpItemLine->setPen(QPen(Qt::black, 1)); + qcpItemLine->setPen(QPen(Qt::blue, 2)); qcpItemLine->setLayer("overlay"); // 确保在最上层 //上下边界 @@ -142,12 +145,12 @@ void TransparentDraggableLine::onMousePress(QMouseEvent *event) { //之前的选中线段,恢复黑色 TransparentDraggableLine *tmpLine = (TransparentDraggableLine*)mPlot->m_SelectShiftLine; - tmpLine->qcpItemLine->setPen(QPen(Qt::blue)); + tmpLine->qcpItemLine->setPen(QPen(Qt::blue, 2)); } //重新设置选中线段 mPlot->m_SelectShiftLine = this; - qcpItemLine->setPen(QPen(Qt::red)); + qcpItemLine->setPen(QPen(Qt::red, 2)); double delta = (lY2-m_lY1)/10.0; if(x < m_lY1+delta) @@ -162,6 +165,9 @@ void TransparentDraggableLine::onMousePress(QMouseEvent *event) { mDragMode = DragRect; } + + //改变补充线段颜色(重新选中) + emit CallManage::getInstance()->sig_ChangeSelectShiftLineColor_Master(mPlot->m_strUuid, m_strUuid); } else { mDragMode = DragNone; diff --git a/logPlus/TransparentDraggableLine_Master.cpp b/logPlus/TransparentDraggableLine_Master.cpp new file mode 100644 index 0000000..dcdce51 --- /dev/null +++ b/logPlus/TransparentDraggableLine_Master.cpp @@ -0,0 +1,238 @@ +#include "TransparentDraggableLine_Master.h" +#include "CallManage.h" + +extern double g_dPixelPerCm;//每厘米像素数 +//static GeoIndicatorGenerator m_drawGeo; + +TransparentDraggableLine_Master::TransparentDraggableLine_Master(QMyCustomPlot *parentPlot, QString strUuid, double minWidth, QString strTitle) + : QObject(parentPlot), mPlot(parentPlot), mstrTitle(strTitle), mMinWidth(minWidth) +{ + m_strUuid = strUuid; + // + initRect(); +} + +TransparentDraggableLine_Master::~TransparentDraggableLine_Master() +{ + if(mPlot) + { + } +} + +//设置最小宽度 +void TransparentDraggableLine_Master::setMinWidth(double minWidth) +{ + mMinWidth = minWidth; +} + +//设置标题 +void TransparentDraggableLine_Master::setTitle(QString strTitle) +{ + mstrTitle = strTitle; + //mPlot->replot(); +} + +// 设置矩形范围 +void TransparentDraggableLine_Master::setRange(double left_Low, double right_Hight, bool bReplot) +{ + m_left_Low = left_Low; + m_right_Hight = right_Hight; + + double lY1 = mPlot->yAxis->range().lower;//+10 + double lY2 = mPlot->yAxis->range().upper; + + for(int i =0; im_x.size(); i++) + { + if(abs(mPlot->m_x[i]-right_Hight) < 0.1) + { + lY2 = mPlot->m_y[i]; + break; + } + } + m_lY1 = lY1; + m_lY2 = lY2; + + qcpItemLine->start->setCoords(left_Low, lY1);//圆心位置 + qcpItemLine->end->setCoords(right_Hight, lY2);//圆心位置 + + emit CallManage::getInstance()->sig_ChangeRange_Jiaozhun(mPlot->m_strUuid, right_Hight, right_Hight, m_strUuid); + + //updateHandles(); + //刷新,针对批量修改不在此处刷新,后面统一刷新 + if(bReplot) + { + mPlot->replot(); + } +} + +// 获取当前范围 +void TransparentDraggableLine_Master::getRange() +{ + m_left_Low = qcpItemLine->start->coords().x(); + m_right_Hight = qcpItemLine->end->coords().x(); +} + +// 设置矩形颜色 +void TransparentDraggableLine_Master::setColor(const QColor &color) +{ +} + +// 删除框图 +void TransparentDraggableLine_Master::deleteRect() +{ + if(mPlot) { + mPlot->m_mapDraggable_Line_Master.remove(m_strUuid); + + mPlot->removeItem(qcpItemLine); + + //mPlot->replot(); + this->deleteLater(); + } +} + + +void TransparentDraggableLine_Master::initRect() +{ + // 连接鼠标事件 + connect(mPlot, &QCustomPlot::mousePress, this, &TransparentDraggableLine_Master::onMousePress); + connect(mPlot, &QCustomPlot::mouseMove, this, &TransparentDraggableLine_Master::onMouseMove); + connect(mPlot, &QCustomPlot::mouseRelease, this, &TransparentDraggableLine_Master::onMouseRelease); + + qcpItemLine = new QCPItemLine(mPlot); + qcpItemLine->setPen(QPen(Qt::blue, 2)); + qcpItemLine->setLayer("overlay"); // 确保在最上层 + + //上下边界 + updateHandles(); +} + +void TransparentDraggableLine_Master::updateHandles() +{ + +} + +void TransparentDraggableLine_Master::onDelRect() +{ + //mDragMode = DragNone; + //删除框图 + deleteRect(); + mPlot->replot(); +} + + +void TransparentDraggableLine_Master::onMousePress(QMouseEvent *event) +{ + if(event->button() != Qt::LeftButton)//右键 + { +// QMenu menu(nullptr); +// QAction *delAction = menu.addAction("删除框图"); +// connect(delAction, &QAction::triggered, this, &TransparentDraggableLine_Master::onDelRect); + +// menu.exec(event->globalPos()); +// return; + } + + event->accept(); + + // 检查点击了哪个部分 + double y = mPlot->xAxis->pixelToCoord(event->pos().y());//x轴展示深度 + double x = mPlot->yAxis->pixelToCoord(event->pos().x()); + //double lY1 = mPlot->yAxis->range().lower;//+10 + //double lY2 = mPlot->yAxis->range().upper; + + if(qcpItemLine->selectTest(event->pos(), false) < 5) + { + if(mPlot->m_SelectShiftLine) + { + //之前的选中线段,恢复黑色 + TransparentDraggableLine_Master *tmpLine = (TransparentDraggableLine_Master*)mPlot->m_SelectShiftLine; + tmpLine->qcpItemLine->setPen(QPen(Qt::blue, 2)); + } + + //重新设置选中线段 + mPlot->m_SelectShiftLine = this; + qcpItemLine->setPen(QPen(Qt::red, 2)); + // + double delta = (m_lY2-m_lY1)/10.0; + if(x < m_lY1+delta) + { + mDragMode = DragLeft; + } + else if(x > m_lY2-delta) + { + mDragMode = DragRight; + } + else + { + mDragMode = DragRect; + } + + //改变校准线段颜色(重新选中) + emit CallManage::getInstance()->sig_ChangeSelectShiftLineColor_Jiaozhun(mPlot->m_strUuid, m_strUuid); + } + else { + mDragMode = DragNone; + return; + } + + getRange(); + + mDragStartY = y; +} + +void TransparentDraggableLine_Master::onMouseMove(QMouseEvent *event) +{ + if(mDragMode == DragNone) return; + + event->accept(); + + //double x = mPlot->xAxis->pixelToCoord(event->pos().x()); + //double dx = x - mDragStartX; + + double y = mPlot->xAxis->pixelToCoord(event->pos().y()); + double dy = y - mDragStartY; + mDragStartY = y; + + switch(mDragMode) { + case DragLeft: { + m_left_Low = m_left_Low + dy; + m_right_Hight = m_right_Hight + dy;//追加的 + break; + } + case DragRight: { + m_left_Low = m_left_Low + dy;//追加的 + m_right_Hight = m_right_Hight + dy; + break; + } + case DragRect: { + m_left_Low = m_left_Low + dy; + m_right_Hight = m_right_Hight + dy; + break; + } + default: + break; + } + + setRange(m_left_Low, m_right_Hight); +} + +void TransparentDraggableLine_Master::onMouseRelease(QMouseEvent *event) +{ + if(event->button() == Qt::LeftButton && mDragMode != DragNone) { + event->accept(); + //避免二次绘制框图 + mPlot->m_bDrawRect = false; + //emit rangeChanged(getRange()); + mDragMode = DragNone; + //取消选中状态 +// QCPDataSelection emptySelection; +// mPlot->graph(0)->setSelection(emptySelection); +// mPlot->replot(); + + //取消选中框 + mPlot->selectionRect()->cancel(); + mPlot->replot(); + mPlot->selectionRect()->mActive=true; + } +} + diff --git a/logPlus/TransparentDraggableLine_Master.h b/logPlus/TransparentDraggableLine_Master.h new file mode 100644 index 0000000..15c741d --- /dev/null +++ b/logPlus/TransparentDraggableLine_Master.h @@ -0,0 +1,71 @@ +#ifndef TransparentDraggableLine_Master_MAATSR_H +#define TransparentDraggableLine_Master_MAATSR_H + +#include +#include "qmycustomplot.h" +#include +#include + +#pragma execution_character_set("utf-8") // 强制指定执行字符集为 UTF-8 + +//曲线校深--线段 +class TransparentDraggableLine_Master : public QObject +{ + Q_OBJECT +public: + explicit TransparentDraggableLine_Master(QMyCustomPlot *parentPlot, QString strUuid="", double minWidth = 1.0, QString strTitle = ""); + + + ~TransparentDraggableLine_Master(); + + //设置最小宽度 + void setMinWidth(double minWidth); + //设置标题 + void setTitle(QString strTitle); + + // 设置矩形范围 + void setRange(double left_Low, double right_Hight, bool bReplot=true); + // 获取当前范围 + void getRange(); + + // 设置矩形颜色 + void setColor(const QColor &color); + + // 删除框图 + void deleteRect(); + +signals: + void rangeChanged(QCPRange newRange); + +private: + void initRect(); + void updateHandles() ; + +private slots: + void onDelRect(); + void onMousePress(QMouseEvent *event); + void onMouseMove(QMouseEvent *event); + void onMouseRelease(QMouseEvent *event); + +public: + QMyCustomPlot *mPlot; + + QCPItemLine *qcpItemLine; + QString mstrTitle=""; + QString m_strUuid = ""; + + enum DragMode { DragNone, DragLeft, DragRight, DragRect }; + DragMode mDragMode = DragNone; + //double mDragStartX = 0; + double mDragStartY = 0; + + double m_left_Low = 0; + double m_right_Hight = 0; + double m_lY1 = 0; + double m_lY2 = 0; + + // 添加最小宽度成员变量 + double mMinWidth; +}; + +#endif // TransparentDraggableLine_Master_MAATSR_H diff --git a/logPlus/logPlus.pro b/logPlus/logPlus.pro index 59b637d..7b306da 100644 --- a/logPlus/logPlus.pro +++ b/logPlus/logPlus.pro @@ -51,6 +51,7 @@ SOURCES += \ TransparentDraggableJiegutext.cpp \ TransparentDraggableLayer.cpp \ TransparentDraggableLine.cpp \ + TransparentDraggableLine_Master.cpp \ TransparentDraggableMFac.cpp \ TransparentDraggablePhase.cpp \ TransparentDraggableRect.cpp \ @@ -119,6 +120,7 @@ HEADERS += \ TransparentDraggableJiegutext.h \ TransparentDraggableLayer.h \ TransparentDraggableLine.h \ + TransparentDraggableLine_Master.h \ TransparentDraggableMFac.h \ TransparentDraggablePhase.h \ TransparentDraggableRect.h \ diff --git a/logPlus/mainwindowcurve.cpp b/logPlus/mainwindowcurve.cpp index d56ef41..e9421e5 100644 --- a/logPlus/mainwindowcurve.cpp +++ b/logPlus/mainwindowcurve.cpp @@ -135,11 +135,22 @@ MainWindowCurve::MainWindowCurve(QWidget *parent) : connect(CallManage::getInstance(), SIGNAL(sig_Raise(QString, QString, QString, QString, QString, int, QString)), this, SLOT(s_Raise(QString, QString, QString, QString, QString, int, QString))); //右键--添加分段线 connect(CallManage::getInstance(), SIGNAL(sig_AddShiftLine(QString, double, double)), this, SLOT(s_AddShiftLine(QString, double, double))); + //右键--添加分段线 + connect(CallManage::getInstance(), SIGNAL(sig_AddShiftLine_Master(QString, double, double, QString)), this, SLOT(s_AddShiftLine_Master(QString, double, double, QString))); //右键--清除当前分段线 connect(CallManage::getInstance(), SIGNAL(sig_DelSelectShiftLine(QString)), this, SLOT(s_DelSelectShiftLine(QString))); //右键--清除全部分段线 connect(CallManage::getInstance(), SIGNAL(sig_DelAllShiftLine(QString)), this, SLOT(s_DelAllShiftLine(QString))); + //校准曲线拖动后,通知补充线段移动 + connect(CallManage::getInstance(), SIGNAL(sig_ChangeRange_Master(QString, double, double, QString)), this, SLOT(s_ChangeRange_Master(QString, double, double, QString))); + //补充曲线拖动后,通知校准线段移动 + connect(CallManage::getInstance(), SIGNAL(sig_ChangeRange_Jiaozhun(QString, double, double, QString)), this, SLOT(s_ChangeRange_Jiaozhun(QString, double, double, QString))); + //补充曲线选中后,改变校准线段颜色(重新选中) + connect(CallManage::getInstance(), SIGNAL(sig_ChangeSelectShiftLineColor_Jiaozhun(QString, QString)), this, SLOT(s_ChangeSelectShiftLineColor_Jiaozhun(QString, QString))); + //校准曲线选中后,改变补充线段颜色(重新选中) + connect(CallManage::getInstance(), SIGNAL(sig_ChangeSelectShiftLineColor_Master(QString, QString)), this, SLOT(s_ChangeSelectShiftLineColor_Master(QString, QString))); + //执行校正 connect(CallManage::getInstance(), SIGNAL(sig_Runcor_List(QString, QList, QList)), this, SLOT(s_Runcor_List(QString, QList, QList))); @@ -332,8 +343,8 @@ void MainWindowCurve::initMainToolBar() ui->mainToolBar->addAction(m_fixwellsectionHeaderAc); //ui->mainToolBar->addAction(m_currtempliteAc); ui->mainToolBar->addAction(m_saveastemplateAc); - //ui->mainToolBar->addAction(m_executeDepthShiftAc); - //ui->mainToolBar->addAction(m_joindepthAc); + ui->mainToolBar->addAction(m_executeDepthShiftAc); + ui->mainToolBar->addAction(m_joindepthAc); ui->mainToolBar->addAction(m_ModuleOpenAc); ui->mainToolBar->addAction(m_SaveAsPictureAc);//导出长图 ui->mainToolBar->addAction(m_SaveAsPdfAc);//导出PDF @@ -1006,12 +1017,17 @@ void MainWindowCurve::s_Standard() return; } + //主校(源拼接)曲线中,去掉本条曲线 if(m_RightCurve.m_strSlfName == m_SelectTableItem.m_strSlfName && m_RightCurve.m_strWellName == m_SelectTableItem.m_strWellName && m_RightCurve.m_strTrackName == m_SelectTableItem.m_strTrackName && m_RightCurve.m_strLineName == m_SelectTableItem.m_strLineName) { + //------------------------------------- + //通知界面,清除全部分段线 + emit CallManage::getInstance()->sig_DelAllShiftLine(m_strUuid); + //主校曲线中,切换为不选择 m_RightCurve.m_iTableType=0; m_RightCurve.m_strUuid = ""; @@ -1042,6 +1058,10 @@ void MainWindowCurve::s_Standard() //当前有标准(目标拼接)曲线 if(m_LeftCurve.m_iTableType==3 && m_LeftCurve.m_strFormInfoType=="curveObject") { + //------------------------------------- + //通知界面,清除全部分段线 + emit CallManage::getInstance()->sig_DelAllShiftLine(m_strUuid); + //当前已经选中为标准曲线 if(m_LeftCurve.m_strSlfName == m_SelectTableItem.m_strSlfName && m_LeftCurve.m_strWellName == m_SelectTableItem.m_strWellName && @@ -1110,6 +1130,10 @@ void MainWindowCurve::s_Correction() //当前有标准曲线 if(m_LeftCurve.m_iTableType==3 && m_LeftCurve.m_strFormInfoType=="curveObject") { + //------------------------------------- + //通知界面,清除全部分段线 + emit CallManage::getInstance()->sig_DelAllShiftLine(m_strUuid); + //当前已经选中为标准曲线 if(m_LeftCurve.m_strSlfName == m_SelectTableItem.m_strSlfName && m_LeftCurve.m_strWellName == m_SelectTableItem.m_strWellName && @@ -1156,6 +1180,11 @@ void MainWindowCurve::s_Correction() m_RightCurve.m_strTrackName == m_SelectTableItem.m_strTrackName && m_RightCurve.m_strLineName == m_SelectTableItem.m_strLineName) { + + //------------------------------------- + //通知界面,清除全部分段线 + emit CallManage::getInstance()->sig_DelAllShiftLine(m_strUuid); + //修改当前曲线选择状态 iSelect=0未知 emit CallManage::getInstance()->sig_ChangeLineStatus(m_strUuid, m_SelectTableItem.m_strSlfName, m_SelectTableItem.m_strWellName, m_SelectTableItem.m_strTrackName, m_SelectTableItem.m_strLineName, 0, m_bMerge); @@ -1256,6 +1285,144 @@ void MainWindowCurve::s_AddShiftLine(QString strUuid, double left_Low, double ri emit CallManage::getInstance()->sig_AddShifLineToPlot(m_strUuid, m_LeftCurve.m_strSlfName, m_LeftCurve.m_strWellName, m_LeftCurve.m_strTrackName, m_LeftCurve.m_strLineName, left_Low, right_Hight); } +//校深(主校补充线段) +void MainWindowCurve::s_AddShiftLine_Master(QString strUuid, double left_Low, double right_Hight, QString strUuid_biaozhun) +{ + if(strUuid != m_strUuid) + { + return; + } + + //当前有标准曲线 + if(m_LeftCurve.m_iTableType==3 && m_LeftCurve.m_strFormInfoType=="curveObject") + { + } + else + { + QMessageBox::warning(this, "提示", "请先选择标准曲线!"); + return; + } + + //当前有主校曲线 + if(m_RightCurve.m_iTableType==3 && m_RightCurve.m_strFormInfoType=="curveObject") + { + } + else + { + QMessageBox::warning(this, "提示", "请先选择校正曲线!"); + return; + } + + //通知界面,增加一条(主校补充线段) + emit CallManage::getInstance()->sig_AddShifLineToPlot_Master(m_strUuid, m_RightCurve.m_strSlfName, m_RightCurve.m_strWellName, m_RightCurve.m_strTrackName, m_RightCurve.m_strLineName, left_Low, right_Hight, strUuid_biaozhun); +} + +//校准曲线拖动后,通知补充线段移动 +void MainWindowCurve::s_ChangeRange_Master(QString strUuid, double left_Low, double right_Hight, QString strUuid_biaozhun) +{ + if(strUuid != m_strUuid) + { + return; + } + + //当前有标准曲线 + if(m_LeftCurve.m_iTableType==3 && m_LeftCurve.m_strFormInfoType=="curveObject") + { + } + else + { + QMessageBox::warning(this, "提示", "请先选择标准曲线!"); + return; + } + + //当前有主校曲线 + if(m_RightCurve.m_iTableType==3 && m_RightCurve.m_strFormInfoType=="curveObject") + { + } + else + { + QMessageBox::warning(this, "提示", "请先选择校正曲线!"); + return; + } + + //通知界面,增加一条(主校补充线段) + emit CallManage::getInstance()->sig_AddShifLineToPlot_Master(m_strUuid, m_RightCurve.m_strSlfName, m_RightCurve.m_strWellName, m_RightCurve.m_strTrackName, m_RightCurve.m_strLineName, left_Low, right_Hight, strUuid_biaozhun); +} + +//补充曲线拖动后,通知校准线段移动 +void MainWindowCurve::s_ChangeRange_Jiaozhun(QString strUuid, double left_Low, double right_Hight, QString strUuid_biaozhun) +{ + if(strUuid != m_strUuid) + { + return; + } + + //当前有标准曲线 + if(m_LeftCurve.m_iTableType==3 && m_LeftCurve.m_strFormInfoType=="curveObject") + { + } + else + { + QMessageBox::warning(this, "提示", "请先选择标准曲线!"); + return; + } + + //通知界面,校准线段移动 + emit CallManage::getInstance()->sig_MoveLine_Jiaozhun(m_strUuid, m_LeftCurve.m_strSlfName, m_LeftCurve.m_strWellName, m_LeftCurve.m_strTrackName, m_LeftCurve.m_strLineName, left_Low, right_Hight, strUuid_biaozhun); +} + +//补充曲线选中后,改变校准线段颜色(重新选中) +void MainWindowCurve::s_ChangeSelectShiftLineColor_Jiaozhun(QString strUuid, QString strUuid_biaozhun) +{ + if(strUuid != m_strUuid) + { + return; + } + + //当前有标准曲线 + if(m_LeftCurve.m_iTableType==3 && m_LeftCurve.m_strFormInfoType=="curveObject") + { + } + else + { + QMessageBox::warning(this, "提示", "请先选择标准曲线!"); + return; + } + + //通知界面,改变校准线段颜色(重新选中) + emit CallManage::getInstance()->sig_ChangeLineColor_Jiaozhun(m_strUuid, m_LeftCurve.m_strSlfName, m_LeftCurve.m_strWellName, m_LeftCurve.m_strTrackName, m_LeftCurve.m_strLineName, strUuid_biaozhun); +} + +//校准曲线选中后,改变补充线段颜色(重新选中) +void MainWindowCurve::s_ChangeSelectShiftLineColor_Master(QString strUuid, QString strUuid_biaozhun) +{ + if(strUuid != m_strUuid) + { + return; + } + + //当前有标准曲线 + if(m_LeftCurve.m_iTableType==3 && m_LeftCurve.m_strFormInfoType=="curveObject") + { + } + else + { + QMessageBox::warning(this, "提示", "请先选择标准曲线!"); + return; + } + //当前有主校曲线 + if(m_RightCurve.m_iTableType==3 && m_RightCurve.m_strFormInfoType=="curveObject") + { + } + else + { + QMessageBox::warning(this, "提示", "请先选择校正曲线!"); + return; + } + //通知界面,改变补充线段颜色(重新选中) + emit CallManage::getInstance()->sig_ChangeLineColor_Master(m_strUuid, m_RightCurve.m_strSlfName, m_RightCurve.m_strWellName, m_RightCurve.m_strTrackName, m_RightCurve.m_strLineName, strUuid_biaozhun); +} + //右键--清除当前分段线 void MainWindowCurve::s_DelSelectShiftLine(QString strUuid) { @@ -1274,18 +1441,25 @@ void MainWindowCurve::s_DelSelectShiftLine(QString strUuid) return; } -// //当前有主校曲线 -// if(m_RightCurve.m_iTableType==3 && m_RightCurve.m_strFormInfoType=="curveObject") -// { -// } -// else -// { + //当前有主校曲线 + if(m_RightCurve.m_iTableType==3 && m_RightCurve.m_strFormInfoType=="curveObject") + { + //不在此处删除,在删除标准曲线的内部处理 + //通知界面,清除当前分段线 + emit CallManage::getInstance()->sig_DelSelectShiftLineFromPlot(m_strUuid, + m_LeftCurve.m_strSlfName, m_LeftCurve.m_strWellName, m_LeftCurve.m_strTrackName, m_LeftCurve.m_strLineName, + m_RightCurve.m_strTrackName, m_RightCurve.m_strLineName); + } + else + { + //通知界面,清除当前分段线 + emit CallManage::getInstance()->sig_DelSelectShiftLineFromPlot(m_strUuid, + m_LeftCurve.m_strSlfName, m_LeftCurve.m_strWellName, m_LeftCurve.m_strTrackName, m_LeftCurve.m_strLineName, + "", ""); + // QMessageBox::warning(this, "提示", "请先选择校正曲线!"); // return; -// } - - //通知界面,清除当前分段线 - emit CallManage::getInstance()->sig_DelSelectShiftLineFromPlot(m_strUuid, m_LeftCurve.m_strSlfName, m_LeftCurve.m_strWellName, m_LeftCurve.m_strTrackName, m_LeftCurve.m_strLineName); + } } //右键--清除全部分段线 @@ -1306,18 +1480,20 @@ void MainWindowCurve::s_DelAllShiftLine(QString strUuid) return; } -// //当前有主校曲线 -// if(m_RightCurve.m_iTableType==3 && m_RightCurve.m_strFormInfoType=="curveObject") -// { -// } -// else -// { -// QMessageBox::warning(this, "提示", "请先选择校正曲线!"); -// return; -// } - //通知界面,清除全部分段线 emit CallManage::getInstance()->sig_DelAllShiftLineFromPlot(m_strUuid, m_LeftCurve.m_strSlfName, m_LeftCurve.m_strWellName, m_LeftCurve.m_strTrackName, m_LeftCurve.m_strLineName); + + //当前有主校曲线 + if(m_RightCurve.m_iTableType==3 && m_RightCurve.m_strFormInfoType=="curveObject") + { + //通知界面,清除全部分段线 + emit CallManage::getInstance()->sig_DelAllShiftLineFromPlot_Master(m_strUuid, m_RightCurve.m_strSlfName, m_RightCurve.m_strWellName, m_RightCurve.m_strTrackName, m_RightCurve.m_strLineName); + } + else + { +// QMessageBox::warning(this, "提示", "请先选择校正曲线!"); +// return; + } } //自动对比 @@ -2111,6 +2287,11 @@ void MainWindowCurve::s_ClearAllSetCurve() //当前有主校曲线 if(m_RightCurve.m_iTableType==3 && m_RightCurve.m_strFormInfoType=="curveObject") { + //----------------------- + //通知界面,清除全部分段线 + emit CallManage::getInstance()->sig_DelAllShiftLineFromPlot_Master(m_strUuid, m_RightCurve.m_strSlfName, m_RightCurve.m_strWellName, m_RightCurve.m_strTrackName, m_RightCurve.m_strLineName); + //----------------------- + //修改当前曲线选择状态 iSelect=0未知 emit CallManage::getInstance()->sig_ChangeLineStatus(m_strUuid, m_RightCurve.m_strSlfName, m_RightCurve.m_strWellName, m_RightCurve.m_strTrackName, m_RightCurve.m_strLineName, 0, m_bMerge); diff --git a/logPlus/mainwindowcurve.h b/logPlus/mainwindowcurve.h index ffda537..38796ac 100644 --- a/logPlus/mainwindowcurve.h +++ b/logPlus/mainwindowcurve.h @@ -162,11 +162,22 @@ public slots: //右键--添加分段线 void s_AddShiftLine(QString strUuid, double left_Low, double right_Hight); + //校深(主校补充线段) + void s_AddShiftLine_Master(QString strUuid, double left_Low, double right_Hight, QString strUuid_biaozhun); //右键--清除当前分段线 void s_DelSelectShiftLine(QString strUuid); //右键--清除全部分段线 void s_DelAllShiftLine(QString strUuid); + //校准曲线拖动后,通知补充线段移动 + void s_ChangeRange_Master(QString strUuid, double left_Low, double right_Hight, QString strUuid_biaozhun); + //补充曲线拖动后,通知校准线段移动 + void s_ChangeRange_Jiaozhun(QString strUuid, double left_Low, double right_Hight, QString strUuid_biaozhun); + //补充曲线选中后,改变校准线段颜色(重新选中) + void s_ChangeSelectShiftLineColor_Jiaozhun(QString strUuid, QString strUuid_biaozhun); + //校准曲线选中后,改变补充线段颜色(重新选中) + void s_ChangeSelectShiftLineColor_Master(QString strUuid, QString strUuid_biaozhun); + //右键菜单响应函数 void slotContextMenu(QPoint pos); void slotDeleteSelectWell(); diff --git a/logPlus/qmycustomplot.cpp b/logPlus/qmycustomplot.cpp index 10d2ae4..f7a31d6 100644 --- a/logPlus/qmycustomplot.cpp +++ b/logPlus/qmycustomplot.cpp @@ -14,6 +14,7 @@ #include "TransparentDraggableFac.h" #include "transparentdraggableGuan.h" #include "TransparentDraggableLine.h" +#include "TransparentDraggableLine_Master.h" #include "transparentdraggableSelectRect.h" #include "transparentdraggableLayer.h" #include "transparentdraggableRightList.h" @@ -162,10 +163,23 @@ QMyCustomPlot::QMyCustomPlot(QWidget *parent, QString strSlfName, QString strWel this, SLOT(s_ChangeFillMode(QString, QString, QString, QString, QString, QString, QString, QColor, QString, QString, float, float, QString, QColor, QColor, QString, bool))); //添加校深线段 connect(CallManage::getInstance(), SIGNAL(sig_AddShifLineToPlot(QString, QString, QString, QString, QString, double, double)), this, SLOT(s_AddShifLineToPlot(QString, QString, QString, QString, QString, double, double))); + //添加校深线段(主校补充线段) + connect(CallManage::getInstance(), SIGNAL(sig_AddShifLineToPlot_Master(QString, QString, QString, QString, QString, double, double, QString)), this, SLOT(s_AddShifLineToPlot_Master(QString, QString, QString, QString, QString, double, double, QString))); + //校准线段移动 + connect(CallManage::getInstance(), SIGNAL(sig_MoveLine_Jiaozhun(QString, QString, QString, QString, QString, double, double, QString)), this, SLOT(s_MoveLine_Jiaozhun(QString, QString, QString, QString, QString, double, double, QString))); + //校准线段颜色(重新选中) + connect(CallManage::getInstance(), SIGNAL(sig_ChangeLineColor_Jiaozhun(QString, QString, QString, QString, QString, QString)), this, SLOT(s_ChangeLineColor_Jiaozhun(QString, QString, QString, QString, QString, QString))); + //补充线段颜色(重新选中) + connect(CallManage::getInstance(), SIGNAL(sig_ChangeLineColor_Master(QString, QString, QString, QString, QString, QString)), this, SLOT(s_ChangeLineColor_Master(QString, QString, QString, QString, QString, QString))); + //清除当前分段线 - connect(CallManage::getInstance(), SIGNAL(sig_DelSelectShiftLineFromPlot(QString, QString, QString, QString, QString)), this, SLOT(s_DelSelectShiftLineFromPlot(QString, QString, QString, QString, QString))); + connect(CallManage::getInstance(), SIGNAL(sig_DelSelectShiftLineFromPlot(QString, QString, QString, QString, QString, QString, QString)), this, SLOT(s_DelSelectShiftLineFromPlot(QString, QString, QString, QString, QString, QString, QString))); + //清除当前分段线 + connect(CallManage::getInstance(), SIGNAL(sig_DelSelectShiftLineFromPlot_Master(QString, QString, QString, QString, QString, QString)), this, SLOT(s_DelSelectShiftLineFromPlot_Master(QString, QString, QString, QString, QString, QString))); //清除全部分段线 connect(CallManage::getInstance(), SIGNAL(sig_DelAllShiftLineFromPlot(QString, QString, QString, QString, QString)), this, SLOT(s_DelAllShiftLineFromPlot(QString, QString, QString, QString, QString))); + //清除全部分段线 + connect(CallManage::getInstance(), SIGNAL(sig_DelAllShiftLineFromPlot_Master(QString, QString, QString, QString, QString)), this, SLOT(s_DelAllShiftLineFromPlot_Master(QString, QString, QString, QString, QString))); //执行校正 connect(CallManage::getInstance(), SIGNAL(sig_RuncorFromPlot(QString, QString, QString, QString, QString)), this, SLOT(s_RuncorFromPlot(QString, QString, QString, QString, QString))); @@ -4868,8 +4882,154 @@ void QMyCustomPlot::s_AddShifLineToPlot(QString strUuid, QString strSlfName, QSt addLineToPlot(left_Low, right_Hight, ""); } +//校深线段(主校补充线段) +void QMyCustomPlot::s_AddShifLineToPlot_Master(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, double left_Low, double right_Hight, QString strUuid_biaozhun) +{ + if(m_strUuid == strUuid && + m_strSlfName == strSlfName && + m_strWellName == strWellName && + m_strTrackName == strTrackName && + m_strLineName == strLineName) + { + + } + else + { + return; + } + + addLineToPlot_Master(left_Low, right_Hight, "", strUuid_biaozhun); +} + +//校准线段移动 +void QMyCustomPlot::s_MoveLine_Jiaozhun(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, double left_Low, double right_Hight, QString strUuid_biaozhun) +{ + if(m_strUuid == strUuid && + m_strSlfName == strSlfName && + m_strWellName == strWellName && + m_strTrackName == strTrackName && + m_strLineName == strLineName) + { + + } + else + { + return; + } + + // + TransparentDraggableLine *pDraggableLine =NULL; + QMap::Iterator it = m_mapDraggable_Line.begin(); + while( it != m_mapDraggable_Line.end() ) + { + pDraggableLine = (TransparentDraggableLine*)it.value(); + if(pDraggableLine->m_strUuid == strUuid_biaozhun) + { + //存在老的同id线段,进行移动 + double lY2 = this->yAxis->range().upper; + pDraggableLine->qcpItemLine->end->setCoords(left_Low, lY2);//圆心位置 + replot(); + return; + } + it++; + } +} + +//校准线段颜色(重新选中) +void QMyCustomPlot::s_ChangeLineColor_Jiaozhun(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString strUuid_biaozhun) +{ + if(m_strUuid == strUuid && + m_strSlfName == strSlfName && + m_strWellName == strWellName && + m_strTrackName == strTrackName && + m_strLineName == strLineName) + { + + } + else + { + return; + } + + // + TransparentDraggableLine *pDraggableLine =NULL; + QMap::Iterator it = m_mapDraggable_Line.begin(); + while( it != m_mapDraggable_Line.end() ) + { + pDraggableLine = (TransparentDraggableLine*)it.value(); + if(pDraggableLine->m_strUuid == strUuid_biaozhun) + { + //存在老的同id线段 + if(this->m_SelectShiftLine) + { + //之前的选中线段,恢复黑色 + TransparentDraggableLine *tmpLine = (TransparentDraggableLine*)this->m_SelectShiftLine; + if(tmpLine) + { + tmpLine->qcpItemLine->setPen(QPen(Qt::blue, 2)); + } + } + + //重新设置选中线段 + m_SelectShiftLine = pDraggableLine; + pDraggableLine->qcpItemLine->setPen(QPen(Qt::red, 2)); + + replot(); + return; + } + it++; + } +} + +//补充线段颜色(重新选中) +void QMyCustomPlot::s_ChangeLineColor_Master(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString strUuid_biaozhun) +{ + if(m_strUuid == strUuid && + m_strSlfName == strSlfName && + m_strWellName == strWellName && + m_strTrackName == strTrackName && + m_strLineName == strLineName) + { + + } + else + { + return; + } + + // + TransparentDraggableLine_Master *pDraggableLine =NULL; + QMap::Iterator it = m_mapDraggable_Line_Master.begin(); + while( it != m_mapDraggable_Line_Master.end() ) + { + pDraggableLine = (TransparentDraggableLine_Master*)it.value(); + if(pDraggableLine->m_strUuid == strUuid_biaozhun) + { + //存在老的同id线段 + if(this->m_SelectShiftLine) + { + //之前的选中线段,恢复黑色 + TransparentDraggableLine_Master *tmpLine = (TransparentDraggableLine_Master*)this->m_SelectShiftLine; + if(tmpLine) + { + tmpLine->qcpItemLine->setPen(QPen(Qt::blue, 2)); + } + } + + //重新设置选中线段 + m_SelectShiftLine = pDraggableLine; + pDraggableLine->qcpItemLine->setPen(QPen(Qt::red, 2)); + + replot(); + return; + } + it++; + } +} + //清除当前分段线 -void QMyCustomPlot::s_DelSelectShiftLineFromPlot(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName) +void QMyCustomPlot::s_DelSelectShiftLineFromPlot(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, + QString strTrackName_Right, QString strLineName_Right) { if(m_strUuid == strUuid && m_strSlfName == strSlfName && @@ -4885,14 +5045,58 @@ void QMyCustomPlot::s_DelSelectShiftLineFromPlot(QString strUuid, QString strSlf } if(m_SelectShiftLine) - { + { TransparentDraggableLine *pDraggableLine = (TransparentDraggableLine *)m_SelectShiftLine; + + //先清除补充线段 + emit CallManage::getInstance()->sig_DelSelectShiftLineFromPlot_Master(m_strUuid, + m_strSlfName, m_strWellName, strTrackName_Right, strLineName_Right, pDraggableLine->m_strUuid); + + //再清除当前选中线段 pDraggableLine->deleteRect(); m_SelectShiftLine = nullptr; } replot(); } +//清除当前分段线 +void QMyCustomPlot::s_DelSelectShiftLineFromPlot_Master(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString strUuid_biaozhun) +{ + if(m_strUuid == strUuid && + m_strSlfName == strSlfName && + m_strWellName == strWellName && + m_strTrackName == strTrackName && + m_strLineName == strLineName) + { + + } + else + { + return; + } + +// if(m_SelectShiftLine) +// { +// TransparentDraggableLine *pDraggableLine = (TransparentDraggableLine *)m_SelectShiftLine; +// pDraggableLine->deleteRect(); +// m_SelectShiftLine = nullptr; +// } + TransparentDraggableLine_Master *pDraggableLine =NULL; + QMap::Iterator it = m_mapDraggable_Line_Master.begin(); + while( it != m_mapDraggable_Line_Master.end() ) + { + pDraggableLine = (TransparentDraggableLine_Master*)it.value(); + if(pDraggableLine->m_strUuid == strUuid_biaozhun) + { + pDraggableLine->deleteRect(); + m_SelectShiftLine = nullptr; + break; + } + it++; + } + replot(); +} + //清除全部分段线 void QMyCustomPlot::s_DelAllShiftLineFromPlot(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName) { @@ -4916,8 +5120,36 @@ void QMyCustomPlot::s_DelAllShiftLineFromPlot(QString strUuid, QString strSlfNam pDraggableLine = (TransparentDraggableLine*)it.value(); it++; pDraggableLine->deleteRect(); - m_SelectShiftLine = nullptr; } + m_SelectShiftLine = nullptr; + this->replot(); +} + +//清除全部分段线 +void QMyCustomPlot::s_DelAllShiftLineFromPlot_Master(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName) +{ + if(m_strUuid == strUuid && + m_strSlfName == strSlfName && + m_strWellName == strWellName && + m_strTrackName == strTrackName && + m_strLineName == strLineName) + { + + } + else + { + return; + } + + TransparentDraggableLine_Master *pDraggableLine =NULL; + QMap::Iterator it = m_mapDraggable_Line_Master.begin(); + while( it != m_mapDraggable_Line_Master.end() ) + { + pDraggableLine = (TransparentDraggableLine_Master*)it.value(); + it++; + pDraggableLine->deleteRect(); + } + m_SelectShiftLine = nullptr; this->replot(); } @@ -5715,6 +5947,39 @@ void QMyCustomPlot::addLineToPlot(double left_Low, double right_Hight, const QSt dragRect->setTitle(strText); m_mapDraggable_Line[strUuid] = dragRect; + //通知界面,增加一条主校补充线段 + emit CallManage::getInstance()->sig_AddShiftLine_Master(m_strUuid, left_Low, right_Hight, strUuid); +} + +//校深线段(主校补充线段) +void QMyCustomPlot::addLineToPlot_Master(double left_Low, double right_Hight, const QString strText, QString strUuid_biaozhun, QColor crColor) +{ + QString strUuid = strUuid_biaozhun; + + TransparentDraggableLine_Master *pDraggableLine =NULL; + QMap::Iterator it = m_mapDraggable_Line_Master.begin(); + while( it != m_mapDraggable_Line_Master.end() ) + { + pDraggableLine = (TransparentDraggableLine_Master*)it.value(); + if(pDraggableLine->m_strUuid == strUuid_biaozhun) + { + //存在老的同id线段,进行移动 + pDraggableLine->setRange(left_Low, right_Hight); + return; + } + it++; + } + + // 在初始化代码中 + TransparentDraggableLine_Master *dragRect = new TransparentDraggableLine_Master(this, strUuid); + // 设置初始范围 + dragRect->setRange(left_Low, right_Hight); + // 可选:设置颜色 + dragRect->setColor(crColor); // 半透明白色 + //最小宽度 + dragRect->setMinWidth(0.1); + dragRect->setTitle(strText); + m_mapDraggable_Line_Master[strUuid] = dragRect; } void QMyCustomPlot::addTextToPlot(double left_Low, double right_Hight, const QString strText, bool bRefresh, QColor crColor) diff --git a/logPlus/qmycustomplot.h b/logPlus/qmycustomplot.h index f4dacde..64f5fb4 100644 --- a/logPlus/qmycustomplot.h +++ b/logPlus/qmycustomplot.h @@ -282,6 +282,7 @@ public: QMap m_mapDraggable_Guan; QMap m_mapDraggable_Jiegutext; QMap m_mapDraggable_Line; + QMap m_mapDraggable_Line_Master; QMap m_mapDraggable_SelectRect; QMap m_mapDraggable_RightList; QMap m_mapDraggable_CorePhysics; // 岩心分析 @@ -457,6 +458,9 @@ public: //校深线段 void addLineToPlot(double left_Low, double right_Hight, const QString strText, QColor crColor=QColor(255, 255, 255, 80)); + //校深线段(主校补充线段) + void addLineToPlot_Master(double left_Low, double right_Hight, const QString strText, QString strUuid_biaozhun, QColor crColor=QColor(255, 255, 255, 80)); + //框选并编辑曲线 void addSelectRectToPlot(double left_Low, double right_Hight, int left_Low_Number, int right_Hight_Number); @@ -516,16 +520,28 @@ public slots: void onAddShiftLine(); //校深线段 void s_AddShifLineToPlot(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, double left_Low, double right_Hight); + //校深线段(主校补充线段) + void s_AddShifLineToPlot_Master(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, double left_Low, double right_Hight, QString strUuid_biaozhun); + //校准线段移动 + void s_MoveLine_Jiaozhun(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, double left_Low, double right_Hight, QString strUuid_biaozhun); + //校准线段颜色(重新选中) + void s_ChangeLineColor_Jiaozhun(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString strUuid_biaozhun); + //补充线段颜色(重新选中) + void s_ChangeLineColor_Master(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString strUuid_biaozhun); //右键--清除当前分段线 void onDelSelectShiftLine(); //清除当前分段线 - void s_DelSelectShiftLineFromPlot(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName); + void s_DelSelectShiftLineFromPlot(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString strTrackName_Right, QString strLineName_Right); + //清除当前分段线 + void s_DelSelectShiftLineFromPlot_Master(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString strUuid_biaozhun); //右键--清除全部分段线 void onDelAllShiftLine(); //清除全部分段线 void s_DelAllShiftLineFromPlot(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName); + //清除全部分段线 + void s_DelAllShiftLineFromPlot_Master(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName); //右键--编辑曲线 void onEditLine();