1.支持右键添加、清除分段线。2.分段线支持拖拉修改坐标
This commit is contained in:
parent
bd290701ba
commit
427293bc76
|
|
@ -142,6 +142,17 @@ signals:
|
||||||
//改变道宽
|
//改变道宽
|
||||||
void sig_changeWidth(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, int iCurrentCol, int iNewWidth);
|
void sig_changeWidth(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, int iCurrentCol, int iNewWidth);
|
||||||
|
|
||||||
|
|
||||||
|
//右键--添加分段线
|
||||||
|
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_DelAllShiftLine(QString strUuid);
|
||||||
|
//清除全部分段线
|
||||||
|
void sig_DelAllShiftLineFromPlot(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName);
|
||||||
|
|
||||||
//
|
//
|
||||||
//void sig_addImageToPlot(QMyCustomPlot* customPlot, double left_Low, double right_Hight, QString imagePath);
|
//void sig_addImageToPlot(QMyCustomPlot* customPlot, double left_Low, double right_Hight, QString imagePath);
|
||||||
|
|
||||||
|
|
|
||||||
221
logPlus/TransparentDraggableLine.cpp
Normal file
221
logPlus/TransparentDraggableLine.cpp
Normal file
|
|
@ -0,0 +1,221 @@
|
||||||
|
#include "TransparentDraggableLine.h"
|
||||||
|
|
||||||
|
extern double g_dPixelPerCm;//每厘米像素数
|
||||||
|
//static GeoIndicatorGenerator m_drawGeo;
|
||||||
|
|
||||||
|
TransparentDraggableLine::TransparentDraggableLine(QMyCustomPlot *parentPlot, QString strUuid, double minWidth, QString strTitle)
|
||||||
|
: QObject(parentPlot), mPlot(parentPlot), mstrTitle(strTitle), mMinWidth(minWidth)
|
||||||
|
{
|
||||||
|
m_strUuid = strUuid;
|
||||||
|
//
|
||||||
|
initRect();
|
||||||
|
}
|
||||||
|
|
||||||
|
TransparentDraggableLine::~TransparentDraggableLine()
|
||||||
|
{
|
||||||
|
if(mPlot)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//设置最小宽度
|
||||||
|
void TransparentDraggableLine::setMinWidth(double minWidth)
|
||||||
|
{
|
||||||
|
mMinWidth = minWidth;
|
||||||
|
}
|
||||||
|
|
||||||
|
//设置标题
|
||||||
|
void TransparentDraggableLine::setTitle(QString strTitle)
|
||||||
|
{
|
||||||
|
mstrTitle = strTitle;
|
||||||
|
//mPlot->replot();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 设置矩形范围
|
||||||
|
void TransparentDraggableLine::setRange(double left_Low, double right_Hight)
|
||||||
|
{
|
||||||
|
double lY1 = mPlot->yAxis->range().lower;//+10
|
||||||
|
double lY2 = mPlot->yAxis->range().upper;
|
||||||
|
|
||||||
|
for(int i =0; i<mPlot->m_x.size(); i++)
|
||||||
|
{
|
||||||
|
if(abs(mPlot->m_x[i]-left_Low) < 0.1)
|
||||||
|
{
|
||||||
|
lY1 = mPlot->m_y[i];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
m_lY1 = lY1;
|
||||||
|
|
||||||
|
qcpItemLine->start->setCoords(left_Low, lY1);//圆心位置
|
||||||
|
qcpItemLine->end->setCoords(right_Hight, lY2);//圆心位置
|
||||||
|
|
||||||
|
//updateHandles();
|
||||||
|
mPlot->replot();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取当前范围
|
||||||
|
void TransparentDraggableLine::getRange()
|
||||||
|
{
|
||||||
|
m_left_Low = qcpItemLine->start->coords().x();
|
||||||
|
m_right_Hight = qcpItemLine->end->coords().x();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 设置矩形颜色
|
||||||
|
void TransparentDraggableLine::setColor(const QColor &color)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除框图
|
||||||
|
void TransparentDraggableLine::deleteRect()
|
||||||
|
{
|
||||||
|
if(mPlot) {
|
||||||
|
mPlot->m_mapDraggable_Line.remove(m_strUuid);
|
||||||
|
|
||||||
|
mPlot->removeItem(qcpItemLine);
|
||||||
|
|
||||||
|
mPlot->replot();
|
||||||
|
this->deleteLater();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void TransparentDraggableLine::initRect()
|
||||||
|
{
|
||||||
|
// 连接鼠标事件
|
||||||
|
connect(mPlot, &QCustomPlot::mousePress, this, &TransparentDraggableLine::onMousePress);
|
||||||
|
connect(mPlot, &QCustomPlot::mouseMove, this, &TransparentDraggableLine::onMouseMove);
|
||||||
|
connect(mPlot, &QCustomPlot::mouseRelease, this, &TransparentDraggableLine::onMouseRelease);
|
||||||
|
|
||||||
|
qcpItemLine = new QCPItemLine(mPlot);
|
||||||
|
qcpItemLine->setPen(QPen(Qt::blue));
|
||||||
|
qcpItemLine->setLayer("overlay"); // 确保在最上层
|
||||||
|
|
||||||
|
//上下边界
|
||||||
|
updateHandles();
|
||||||
|
}
|
||||||
|
|
||||||
|
void TransparentDraggableLine::updateHandles()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void TransparentDraggableLine::onDelRect()
|
||||||
|
{
|
||||||
|
//mDragMode = DragNone;
|
||||||
|
//删除框图
|
||||||
|
deleteRect();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void TransparentDraggableLine::onMousePress(QMouseEvent *event)
|
||||||
|
{
|
||||||
|
if(event->button() != Qt::LeftButton)//右键
|
||||||
|
{
|
||||||
|
// QMenu menu(nullptr);
|
||||||
|
// QAction *delAction = menu.addAction("删除框图");
|
||||||
|
// connect(delAction, &QAction::triggered, this, &TransparentDraggableLine::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 *tmpLine = (TransparentDraggableLine*)mPlot->m_SelectShiftLine;
|
||||||
|
tmpLine->qcpItemLine->setPen(QPen(Qt::blue));
|
||||||
|
}
|
||||||
|
|
||||||
|
//重新设置选中线段
|
||||||
|
mPlot->m_SelectShiftLine = this;
|
||||||
|
qcpItemLine->setPen(QPen(Qt::red));
|
||||||
|
|
||||||
|
double delta = (m_lY1+lY2)/10.0;
|
||||||
|
if(x < m_lY1+delta)
|
||||||
|
{
|
||||||
|
mDragMode = DragLeft;
|
||||||
|
}
|
||||||
|
else if(x > lY2-delta)
|
||||||
|
{
|
||||||
|
mDragMode = DragRight;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mDragMode = DragRect;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
mDragMode = DragNone;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
getRange();
|
||||||
|
|
||||||
|
mDragStartY = y;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TransparentDraggableLine::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;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case DragRight: {
|
||||||
|
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::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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
70
logPlus/TransparentDraggableLine.h
Normal file
70
logPlus/TransparentDraggableLine.h
Normal file
|
|
@ -0,0 +1,70 @@
|
||||||
|
#ifndef TRANSPARENTDRAGGABLELINE_H
|
||||||
|
#define TRANSPARENTDRAGGABLELINE_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include "qmycustomplot.h"
|
||||||
|
#include <QString>
|
||||||
|
#include <QMenu>
|
||||||
|
|
||||||
|
#pragma execution_character_set("utf-8") // 强制指定执行字符集为 UTF-8
|
||||||
|
|
||||||
|
//曲线校深--线段
|
||||||
|
class TransparentDraggableLine : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit TransparentDraggableLine(QMyCustomPlot *parentPlot, QString strUuid="", double minWidth = 1.0, QString strTitle = "");
|
||||||
|
|
||||||
|
|
||||||
|
~TransparentDraggableLine();
|
||||||
|
|
||||||
|
//设置最小宽度
|
||||||
|
void setMinWidth(double minWidth);
|
||||||
|
//设置标题
|
||||||
|
void setTitle(QString strTitle);
|
||||||
|
|
||||||
|
// 设置矩形范围
|
||||||
|
void setRange(double left_Low, double right_Hight);
|
||||||
|
// 获取当前范围
|
||||||
|
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);
|
||||||
|
|
||||||
|
private:
|
||||||
|
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 mMinWidth;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // TRANSPARENTDRAGGABLELINE_H
|
||||||
|
|
@ -51,6 +51,7 @@ SOURCES += \
|
||||||
TransparentDraggableGeoLith.cpp \
|
TransparentDraggableGeoLith.cpp \
|
||||||
TransparentDraggableGujing.cpp \
|
TransparentDraggableGujing.cpp \
|
||||||
TransparentDraggableJiegutext.cpp \
|
TransparentDraggableJiegutext.cpp \
|
||||||
|
TransparentDraggableLine.cpp \
|
||||||
TransparentDraggableMFac.cpp \
|
TransparentDraggableMFac.cpp \
|
||||||
TransparentDraggablePhase.cpp \
|
TransparentDraggablePhase.cpp \
|
||||||
TransparentDraggableRect.cpp \
|
TransparentDraggableRect.cpp \
|
||||||
|
|
@ -110,6 +111,7 @@ HEADERS += \
|
||||||
TransparentDraggableGeoLith.h \
|
TransparentDraggableGeoLith.h \
|
||||||
TransparentDraggableGujing.h \
|
TransparentDraggableGujing.h \
|
||||||
TransparentDraggableJiegutext.h \
|
TransparentDraggableJiegutext.h \
|
||||||
|
TransparentDraggableLine.h \
|
||||||
TransparentDraggableMFac.h \
|
TransparentDraggableMFac.h \
|
||||||
TransparentDraggablePhase.h \
|
TransparentDraggablePhase.h \
|
||||||
TransparentDraggableRect.h \
|
TransparentDraggableRect.h \
|
||||||
|
|
|
||||||
|
|
@ -116,6 +116,10 @@ MainWindowCurve::MainWindowCurve(QWidget *parent) :
|
||||||
connect(CallManage::getInstance(), SIGNAL(sig_changeWidth(QString, QString, QString, QString, int, int)), this, SLOT(s_changeWidth(QString, QString, QString, QString, int, int)));
|
connect(CallManage::getInstance(), SIGNAL(sig_changeWidth(QString, QString, QString, QString, int, int)), this, SLOT(s_changeWidth(QString, QString, QString, QString, int, int)));
|
||||||
//曲线选中,置顶
|
//曲线选中,置顶
|
||||||
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_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_DelAllShiftLine(QString)), this, SLOT(s_DelAllShiftLine(QString)));
|
||||||
|
|
||||||
//图头
|
//图头
|
||||||
m_dock1=new QDockWidget(tr(""),this);
|
m_dock1=new QDockWidget(tr(""),this);
|
||||||
|
|
@ -417,7 +421,7 @@ void MainWindowCurve::initToolBar()
|
||||||
//初始化工具栏
|
//初始化工具栏
|
||||||
void MainWindowCurve::initToolBar_2()
|
void MainWindowCurve::initToolBar_2()
|
||||||
{
|
{
|
||||||
QSize toolIconSize(18, 18);
|
QSize toolIconSize(26, 26);
|
||||||
ui->toolBar_2->setIconSize(toolIconSize); //设置工具栏图标大小
|
ui->toolBar_2->setIconSize(toolIconSize); //设置工具栏图标大小
|
||||||
|
|
||||||
QIcon ShiftIcon(::GetImagePath()+"icon/Shift.png");
|
QIcon ShiftIcon(::GetImagePath()+"icon/Shift.png");
|
||||||
|
|
@ -1027,6 +1031,70 @@ void qsort(QVector<CurveLine *>&datx,int left,int right,int idx)
|
||||||
if(i<right) qsort(datx,i,right,idx);
|
if(i<right) qsort(datx,i,right,idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//右键--添加分段线
|
||||||
|
void MainWindowCurve::s_AddShiftLine(QString strUuid, double left_Low, double right_Hight)
|
||||||
|
{
|
||||||
|
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(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_DelAllShiftLine(QString strUuid)
|
||||||
|
{
|
||||||
|
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_DelAllShiftLineFromPlot(m_strUuid, m_LeftCurve.m_strSlfName, m_LeftCurve.m_strWellName, m_LeftCurve.m_strTrackName, m_LeftCurve.m_strLineName);
|
||||||
|
}
|
||||||
|
|
||||||
//自动对比
|
//自动对比
|
||||||
void MainWindowCurve::s_autocor()
|
void MainWindowCurve::s_autocor()
|
||||||
{
|
{
|
||||||
|
|
@ -1156,6 +1224,9 @@ void MainWindowCurve::s_autocor()
|
||||||
float edep=m_mergeLineList[i]->GetRightDepth();
|
float edep=m_mergeLineList[i]->GetRightDepth();
|
||||||
szBuffer1.Format("%g %g\r\n",sdep,edep);
|
szBuffer1.Format("%g %g\r\n",sdep,edep);
|
||||||
szBuffer+=szBuffer1;
|
szBuffer+=szBuffer1;
|
||||||
|
|
||||||
|
//通知界面,增加一条校深线段
|
||||||
|
emit CallManage::getInstance()->sig_AddShifLineToPlot(m_strUuid, m_LeftCurve.m_strSlfName, m_LeftCurve.m_strWellName, m_LeftCurve.m_strTrackName, m_LeftCurve.m_strLineName, -edep, -sdep);
|
||||||
}
|
}
|
||||||
CMemRdWt mem;
|
CMemRdWt mem;
|
||||||
if(mem.Open(m_RightCurve.m_strSlfName.toStdString().c_str()))
|
if(mem.Open(m_RightCurve.m_strSlfName.toStdString().c_str()))
|
||||||
|
|
|
||||||
|
|
@ -59,6 +59,11 @@ public slots:
|
||||||
void mousePressEvent(QMouseEvent *event);
|
void mousePressEvent(QMouseEvent *event);
|
||||||
void s_Raise(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, int iTableType, QString strFormInfoType);
|
void s_Raise(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, int iTableType, QString strFormInfoType);
|
||||||
|
|
||||||
|
//右键--添加分段线
|
||||||
|
void s_AddShiftLine(QString strUuid, double left_Low, double right_Hight);
|
||||||
|
//右键--清除全部分段线
|
||||||
|
void s_DelAllShiftLine(QString strUuid);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void dragEnterEvent(QDragEnterEvent* event);
|
void dragEnterEvent(QDragEnterEvent* event);
|
||||||
void dragMoveEvent(QDragMoveEvent* event);
|
void dragMoveEvent(QDragMoveEvent* event);
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@
|
||||||
#include "TransparentDraggablePhase.h"
|
#include "TransparentDraggablePhase.h"
|
||||||
#include "TransparentDraggableFac.h"
|
#include "TransparentDraggableFac.h"
|
||||||
#include "transparentdraggableGuan.h"
|
#include "transparentdraggableGuan.h"
|
||||||
|
#include "TransparentDraggableLine.h"
|
||||||
#include "qtcommonclass.h"
|
#include "qtcommonclass.h"
|
||||||
|
|
||||||
//是否隐藏刻度
|
//是否隐藏刻度
|
||||||
|
|
@ -76,6 +77,10 @@ QMyCustomPlot::QMyCustomPlot(QWidget *parent, QString strSlfName, QString strWel
|
||||||
//岩性填充-填充
|
//岩性填充-填充
|
||||||
connect(CallManage::getInstance(), SIGNAL(sig_ChangeFillMode(QString, QString, QString, QString, QString, QString, QString, QColor, QString, QString, float, float, QString , QColor, QColor, QString, bool)),
|
connect(CallManage::getInstance(), SIGNAL(sig_ChangeFillMode(QString, QString, QString, QString, QString, QString, QString, QColor, QString, QString, float, float, QString , QColor, QColor, QString, bool)),
|
||||||
this, SLOT(s_ChangeFillMode(QString, QString, QString, QString, QString, QString, QString, QColor, QString, QString, float, float, QString, QColor, QColor, QString, bool)));
|
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_DelAllShiftLineFromPlot(QString, QString, QString, QString, QString)), this, SLOT(s_DelAllShiftLineFromPlot(QString, QString, QString, QString, QString)));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -333,11 +338,15 @@ void QMyCustomPlot::s_LineClicked(int index)
|
||||||
|
|
||||||
void QMyCustomPlot::contextMenuEvent(QContextMenuEvent *event)
|
void QMyCustomPlot::contextMenuEvent(QContextMenuEvent *event)
|
||||||
{
|
{
|
||||||
QMenu menu(this);
|
|
||||||
QAction *resetAction = menu.addAction("添加框图");
|
|
||||||
|
|
||||||
m_event = event;
|
m_event = event;
|
||||||
connect(resetAction, &QAction::triggered, this, &QMyCustomPlot::onAddRect);
|
//
|
||||||
|
QMenu menu(this);
|
||||||
|
|
||||||
|
menu.addAction("添加分段线", this, &QMyCustomPlot::onAddShiftLine);
|
||||||
|
menu.addAction("清除全部分段线", this, &QMyCustomPlot::onDelAllShiftLine);
|
||||||
|
|
||||||
|
// QAction *resetAction = menu.addAction("添加框图");
|
||||||
|
// connect(resetAction, &QAction::triggered, this, &QMyCustomPlot::onAddRect);
|
||||||
|
|
||||||
// if (selectedGraphs().size() > 0)//选中曲线
|
// if (selectedGraphs().size() > 0)//选中曲线
|
||||||
// {
|
// {
|
||||||
|
|
@ -347,6 +356,23 @@ void QMyCustomPlot::contextMenuEvent(QContextMenuEvent *event)
|
||||||
menu.exec(event->globalPos());
|
menu.exec(event->globalPos());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//右键--添加分段线
|
||||||
|
void QMyCustomPlot::onAddShiftLine()
|
||||||
|
{
|
||||||
|
double right_Hight = xAxis->pixelToCoord(m_event->pos().y());//x轴展示深度
|
||||||
|
double left_Low = right_Hight;
|
||||||
|
|
||||||
|
//通知界面,增加一条校深线段
|
||||||
|
emit CallManage::getInstance()->sig_AddShiftLine(m_strUuid, left_Low, right_Hight);
|
||||||
|
}
|
||||||
|
|
||||||
|
//右键--清除全部分段线
|
||||||
|
void QMyCustomPlot::onDelAllShiftLine()
|
||||||
|
{
|
||||||
|
//通知界面,清除全部分段线
|
||||||
|
emit CallManage::getInstance()->sig_DelAllShiftLine(m_strUuid);
|
||||||
|
}
|
||||||
|
|
||||||
void QMyCustomPlot::onAddRect()
|
void QMyCustomPlot::onAddRect()
|
||||||
{
|
{
|
||||||
double right_Hight = xAxis->pixelToCoord(m_event->pos().y());//x轴展示深度
|
double right_Hight = xAxis->pixelToCoord(m_event->pos().y());//x轴展示深度
|
||||||
|
|
@ -377,12 +403,75 @@ void QMyCustomPlot::addImageToPlot(double left_Low, double right_Hight, const QS
|
||||||
m_mapDraggable_Image[strUuid] = dragRect;
|
m_mapDraggable_Image[strUuid] = dragRect;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
//校深线段
|
||||||
|
void QMyCustomPlot::s_AddShifLineToPlot(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, double left_Low, double right_Hight)
|
||||||
|
{
|
||||||
|
if(m_strUuid == strUuid &&
|
||||||
|
m_strSlfName == strSlfName &&
|
||||||
|
m_strWellName == strWellName &&
|
||||||
|
m_strTrackName == strTrackName &&
|
||||||
|
m_strLineName == strLineName)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
addLineToPlot(left_Low, right_Hight, "");
|
||||||
|
}
|
||||||
|
|
||||||
|
//校深线段
|
||||||
|
void QMyCustomPlot::s_DelAllShiftLineFromPlot(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 *pDraggableLine =NULL;
|
||||||
|
{
|
||||||
|
QMap<QString,QObject *>::Iterator it = m_mapDraggable_Line.begin();
|
||||||
|
while( it != m_mapDraggable_Line.end() )
|
||||||
|
{
|
||||||
|
pDraggableLine = (TransparentDraggableLine*)it.value();
|
||||||
|
it++;
|
||||||
|
pDraggableLine->deleteRect();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void QMyCustomPlot::addLineToPlot(double left_Low, double right_Hight, const QString strText, QColor crColor)
|
||||||
|
{
|
||||||
|
QtCommonClass *qtCommon = new QtCommonClass(this);
|
||||||
|
QString strUuid = qtCommon->getUUid();
|
||||||
|
|
||||||
|
// 在初始化代码中
|
||||||
|
TransparentDraggableLine *dragRect = new TransparentDraggableLine(this, strUuid);
|
||||||
|
// 设置初始范围
|
||||||
|
dragRect->setRange(left_Low, right_Hight);
|
||||||
|
// 可选:设置颜色
|
||||||
|
dragRect->setColor(crColor); // 半透明白色
|
||||||
|
//最小宽度
|
||||||
|
dragRect->setMinWidth(0.1);
|
||||||
|
dragRect->setTitle(strText);
|
||||||
|
|
||||||
|
m_mapDraggable_Line[strUuid] = dragRect;
|
||||||
|
}
|
||||||
|
|
||||||
void QMyCustomPlot::addTextToPlot(double left_Low, double right_Hight, const QString strText, QColor crColor)
|
void QMyCustomPlot::addTextToPlot(double left_Low, double right_Hight, const QString strText, QColor crColor)
|
||||||
{
|
{
|
||||||
QtCommonClass *qtCommon = new QtCommonClass(this);
|
QtCommonClass *qtCommon = new QtCommonClass(this);
|
||||||
QString strUuid = qtCommon->getUUid();
|
QString strUuid = qtCommon->getUUid();
|
||||||
|
|
||||||
// 在初始化代码中
|
// 在初始化代码中
|
||||||
TransparentDraggableRect *dragRect = new TransparentDraggableRect(this, strUuid);
|
TransparentDraggableRect *dragRect = new TransparentDraggableRect(this, strUuid);
|
||||||
// 设置初始范围
|
// 设置初始范围
|
||||||
|
|
|
||||||
|
|
@ -80,6 +80,9 @@ public:
|
||||||
QMap<QString, QObject*> m_mapDraggable_Fac;
|
QMap<QString, QObject*> m_mapDraggable_Fac;
|
||||||
QMap<QString, QObject*> m_mapDraggable_Guan;
|
QMap<QString, QObject*> m_mapDraggable_Guan;
|
||||||
QMap<QString, QObject*> m_mapDraggable_Jiegutext;
|
QMap<QString, QObject*> m_mapDraggable_Jiegutext;
|
||||||
|
QMap<QString, QObject*> m_mapDraggable_Line;
|
||||||
|
|
||||||
|
QObject* m_SelectShiftLine=nullptr;//当前选中的分段线
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void slot_time();
|
void slot_time();
|
||||||
|
|
@ -108,6 +111,8 @@ public:
|
||||||
|
|
||||||
void addGuanToPlot(double left_Low, double right_Hight, const QString imagePath, float in);
|
void addGuanToPlot(double left_Low, double right_Hight, const QString imagePath, float in);
|
||||||
|
|
||||||
|
void addLineToPlot(double left_Low, double right_Hight, const QString strText, QColor crColor=QColor(255, 255, 255, 80));
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void s_LineClicked(int index);
|
void s_LineClicked(int index);
|
||||||
void onResetZoom();
|
void onResetZoom();
|
||||||
|
|
@ -137,6 +142,17 @@ public slots:
|
||||||
QString newFillType, QString newTargetLine, QColor newColor, QString newLithosImage, QString newHeadFill,
|
QString newFillType, QString newTargetLine, QColor newColor, QString newLithosImage, QString newHeadFill,
|
||||||
float vMin, float vMax, QString strOtherScaleType, QColor frontColor, QColor backColor, QString newFillMode, bool bFillNow);
|
float vMin, float vMax, QString strOtherScaleType, QColor frontColor, QColor backColor, QString newFillMode, bool bFillNow);
|
||||||
|
|
||||||
|
|
||||||
|
//右键--添加分段线
|
||||||
|
void onAddShiftLine();
|
||||||
|
//校深线段
|
||||||
|
void s_AddShifLineToPlot(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, double left_Low, double right_Hight);
|
||||||
|
|
||||||
|
//右键--清除全部分段线
|
||||||
|
void onDelAllShiftLine();
|
||||||
|
//清除全部分段线
|
||||||
|
void s_DelAllShiftLineFromPlot(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName);
|
||||||
|
|
||||||
void onAddRect();
|
void onAddRect();
|
||||||
|
|
||||||
//蝌蚪图重绘网格线
|
//蝌蚪图重绘网格线
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user