拼接曲线,支持预览
This commit is contained in:
parent
e71f17bd3e
commit
93f74bdd04
|
|
@ -173,6 +173,13 @@ signals:
|
|||
void sig_MergeFromPlot(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName);
|
||||
void sig_Merge_List(QString strUuid, QList<double> left_Low_List, QList<double> right_Hight_List);
|
||||
|
||||
//执行预览
|
||||
void sig_PreMergeFromPlot(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName);
|
||||
void sig_PreMerge_List(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QList<double> left_Low_List, QList<double> right_Hight_List);
|
||||
void sig_PreMerge_FromRightList(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QList<double> new_DepthList, QList<double> new_ValueList);
|
||||
//关闭预览框
|
||||
void sig_PreMerge_Close(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName);
|
||||
|
||||
//Plot重新加载数据
|
||||
void sig_ReloadPlot(QString strUuid, QString strSlfName, QString strLineName);
|
||||
|
||||
|
|
|
|||
|
|
@ -827,6 +827,30 @@ int GetCurvInfo(QString strSlfName, QString strLineName, double &sdep, double &e
|
|||
return 1;
|
||||
}
|
||||
|
||||
int GetCurvValue(QString strSlfName, QString strLineName, QList<double> new_DepthList, QList<double> &new_ValueList)
|
||||
{
|
||||
CLogIO *logio=new CLogIO();
|
||||
logio->Open(strSlfName.toStdString().c_str(),CSlfIO::modeRead);
|
||||
//
|
||||
int index=logio->OpenCurve(strLineName.toStdString().c_str());
|
||||
if(index<0) {
|
||||
delete logio;
|
||||
return -1;
|
||||
}
|
||||
|
||||
float fValue=-9999;
|
||||
for(int i=0; i<new_DepthList.size(); i++)
|
||||
{
|
||||
logio->ReadCurve(index, 0-new_DepthList[i], 1, &fValue);
|
||||
new_ValueList.append(fValue);
|
||||
}
|
||||
//
|
||||
logio->CloseCurve(index);
|
||||
delete logio;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
bool getAliasNameFromIni(QString CurveName, QString &strAliasName, QString &strUnit)
|
||||
{
|
||||
QString curveFamilyFilePath = ::GetConfPath() + "CurveFamily_New.ini";
|
||||
|
|
|
|||
|
|
@ -202,6 +202,7 @@ void SetSystemExisting(bool exiting);
|
|||
bool SystemExiting();
|
||||
bool getAllSlf(QString prjname, QVector<QString> &vecSlfList, QVector<QString> &vecWellList);//直方图,获取当前工程下的slf
|
||||
int GetCurvInfo(QString strSlfName, QString strLineName, double &sdep, double &edep, double &rlev);//获取曲线顶深、底深、间隔
|
||||
int GetCurvValue(QString strSlfName, QString strLineName, QList<double> new_DepthList, QList<double> &new_ValueList);//获取指定刻度的曲线值
|
||||
bool getAliasNameFromIni(QString CurveName, QString &strAliasName, QString &strUnit);//曲线别名,单位
|
||||
/**
|
||||
* @brief 获取系统缺省的系统颜色
|
||||
|
|
|
|||
|
|
@ -1015,7 +1015,7 @@ int DepPairs::joincurve(float sdeps,float edeps,float *datx1,float *daty1,float
|
|||
fp_temp=fopen(dir.toStdString().c_str(),"w+");
|
||||
if(fp_temp==NULL)
|
||||
{
|
||||
QMessageBox::warning(nullptr, "提示", "Not create file :admtemp !\n");
|
||||
QMessageBox::warning(nullptr, "提示", "Not create file :admtemp !");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
@ -1164,7 +1164,7 @@ int DepPairs::adm(float stem,float etem ,float cmins,
|
|||
fp_temp=fopen(dir.toStdString().c_str(),"rt");
|
||||
if(fp_temp==NULL)
|
||||
{
|
||||
QMessageBox::warning(nullptr, "提示", "Not create file :admtemp !\n");
|
||||
QMessageBox::warning(nullptr, "提示", "Not create file :admtemp !");
|
||||
delete [] datx;
|
||||
delete [] daty;
|
||||
delete [] datc;
|
||||
|
|
|
|||
|
|
@ -82,6 +82,7 @@ SOURCES += \
|
|||
qtprojectwidgets.cpp \
|
||||
totalTitleBar.cpp \
|
||||
transparentdraggableGuan.cpp \
|
||||
transparentdraggableRightList.cpp \
|
||||
transparentdraggableSelectRect.cpp \
|
||||
transparentdraggableimage.cpp \
|
||||
variantfactory.cpp \
|
||||
|
|
@ -143,6 +144,7 @@ HEADERS += \
|
|||
qtprojectwidgets.h \
|
||||
totalTitleBar.h \
|
||||
transparentdraggableGuan.h \
|
||||
transparentdraggableRightList.h \
|
||||
transparentdraggableSelectRect.h \
|
||||
transparentdraggableimage.h \
|
||||
variantfactory.h \
|
||||
|
|
|
|||
|
|
@ -135,6 +135,9 @@ MainWindowCurve::MainWindowCurve(QWidget *parent) :
|
|||
//执行拼接
|
||||
connect(CallManage::getInstance(), SIGNAL(sig_Merge_List(QString, QList<double>, QList<double>)), this, SLOT(s_Merge_List(QString, QList<double>, QList<double>)));
|
||||
|
||||
//执行预览
|
||||
connect(CallManage::getInstance(), SIGNAL(sig_PreMerge_List(QString, QString, QString, QString, QString, QList<double>, QList<double>)), this, SLOT(s_PreMerge_List(QString, QString, QString, QString, QString, QList<double>, QList<double>)));
|
||||
|
||||
//执行压缩/拉伸
|
||||
connect(CallManage::getInstance(), SIGNAL(sig_EShiftDepth(QString, QString, int, QList<double>, QList<double>)), this, SLOT(s_EShiftDepth(QString, QString, int, QList<double>, QList<double>)));
|
||||
|
||||
|
|
@ -568,7 +571,7 @@ void MainWindowCurve::initToolBar_3()
|
|||
ui->toolBar_3->addAction(m_CorrectionAc);
|
||||
//ui->toolBar_3->addAction(m_ShiftotherAc);
|
||||
ui->toolBar_3->addSeparator();
|
||||
//ui->toolBar_3->addAction(m_PreMegAc);
|
||||
ui->toolBar_3->addAction(m_PreMegAc);
|
||||
ui->toolBar_3->addAction(m_mergeAc);
|
||||
ui->toolBar_3->addSeparator();
|
||||
ui->toolBar_3->addAction(m_ClearAllSetCurveAc);
|
||||
|
|
@ -577,7 +580,7 @@ void MainWindowCurve::initToolBar_3()
|
|||
connect(m_StandardAc, &QAction::triggered, this, &MainWindowCurve::s_Standard);
|
||||
connect(m_CorrectionAc, &QAction::triggered, this, &MainWindowCurve::s_Correction);
|
||||
//// connect(m_ShiftotherAc, &QAction::triggered, this, &MainWindowCurve::s_Shiftother);
|
||||
// connect(m_autocorAc, &QAction::triggered, this, &MainWindowCurve::s_autocor);
|
||||
connect(m_PreMegAc, &QAction::triggered, this, &MainWindowCurve::s_PreMegAc);
|
||||
connect(m_mergeAc, &QAction::triggered, this, &MainWindowCurve::s_merge);
|
||||
connect(m_ClearAllSetCurveAc, &QAction::triggered, this, &MainWindowCurve::s_ClearAllSetCurve);
|
||||
connect(m_ClearSetCurveAc, &QAction::triggered, this, &MainWindowCurve::s_ClearSetCurve);
|
||||
|
|
@ -1579,6 +1582,153 @@ void MainWindowCurve::s_Runcor_List(QString strUuid, QList<double> left_Low_List
|
|||
}
|
||||
}
|
||||
|
||||
//拼接预览
|
||||
void MainWindowCurve::s_PreMegAc()
|
||||
{
|
||||
//当前有标准(目标)曲线
|
||||
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_PreMergeFromPlot(m_strUuid, m_LeftCurve.m_strSlfName, m_LeftCurve.m_strWellName, m_LeftCurve.m_strTrackName, m_LeftCurve.m_strLineName);
|
||||
}
|
||||
|
||||
void MainWindowCurve::s_PreMerge_List(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QList<double> left_Low_List, QList<double> right_Hight_List)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
m_mergeLineList.clear();
|
||||
//
|
||||
int pointnum =left_Low_List.size();
|
||||
|
||||
//
|
||||
for(int i=0;i<pointnum;i++)
|
||||
{
|
||||
CurveLine * pLine = new CurveLine();
|
||||
pLine->SetLeftDepth(left_Low_List[i]);
|
||||
pLine->SetRightDepth(right_Hight_List[i]);
|
||||
m_mergeLineList.append(pLine);
|
||||
}
|
||||
qsort(m_mergeLineList,0,m_mergeLineList.size()-1,0);
|
||||
|
||||
if(pointnum<1) {
|
||||
QMessageBox::warning(this, "提示", "曲线拼接深度点不存在,无法拼接!请先设置拼接深度点。");
|
||||
return;
|
||||
}
|
||||
if(pointnum>2) {
|
||||
QMessageBox::warning(this, "提示", "曲线拼接深度点太多,最多可设置2点!请重新设置拼接深度点。");
|
||||
return;
|
||||
}
|
||||
|
||||
float SourSdep=0;
|
||||
float SourEdep=0;
|
||||
float DectSdep=0;
|
||||
if(pointnum==1) {
|
||||
QMessageBox box(QMessageBox::Warning,"提示","拼接深度点仅有1个,请您选择拼接部位");
|
||||
box.setStandardButtons (QMessageBox::Yes|QMessageBox::No|QMessageBox::Cancel);
|
||||
box.setButtonText(QMessageBox::Yes,QString("拼接上段"));
|
||||
box.setButtonText(QMessageBox::No,QString("拼接下段"));
|
||||
box.setButtonText(QMessageBox::Cancel,QString("放弃"));
|
||||
int flag=box.exec();//QMessageBox::information(NULL,"敬告",pwelllog->GetName()+mess,QMessageBox::Yes,QMessageBox::No,QMessageBox::Cancel);
|
||||
|
||||
double sdep_right = 0;
|
||||
double edep_right = 0;
|
||||
double rlev_right = 0;
|
||||
//获取曲线顶深、底深、间隔
|
||||
int iRet = GetCurvInfo(m_RightCurve.m_strSlfName, m_RightCurve.m_strLineName, sdep_right, edep_right, rlev_right);
|
||||
if(iRet!=1)
|
||||
{
|
||||
QMessageBox::warning(this, "提示", "曲线深度读取失败,无法拼接!");
|
||||
return;
|
||||
}
|
||||
if(flag==QMessageBox::Yes) {
|
||||
SourSdep=sdep_right;
|
||||
SourEdep=m_mergeLineList[0]->GetLeftDepth();
|
||||
DectSdep=SourSdep;
|
||||
}
|
||||
else if(flag==QMessageBox::No) {
|
||||
DectSdep=m_mergeLineList[0]->GetLeftDepth();
|
||||
SourEdep=edep_right;
|
||||
SourSdep=m_mergeLineList[0]->GetRightDepth();
|
||||
}
|
||||
else return;
|
||||
}
|
||||
else if(pointnum==2) {
|
||||
SourSdep=m_mergeLineList[0]->GetLeftDepth();//+m_RightCurve->GetShiftOffset();
|
||||
SourEdep=m_mergeLineList[1]->GetLeftDepth();//+m_RightCurve->GetShiftOffset();
|
||||
DectSdep=m_mergeLineList[0]->GetLeftDepth();
|
||||
}
|
||||
|
||||
//---------------
|
||||
double sdep_left = 0;
|
||||
double edep_left = 0;
|
||||
double rlev_left = 0;
|
||||
//获取曲线顶深、底深、间隔
|
||||
int iRet = GetCurvInfo(m_LeftCurve.m_strSlfName, m_LeftCurve.m_strLineName, sdep_left, edep_left, rlev_left);
|
||||
if(iRet!=1)
|
||||
{
|
||||
QMessageBox::warning(this, "提示", "曲线深度读取失败,无法拼接!");
|
||||
return;
|
||||
}
|
||||
//
|
||||
QList<double> new_DepthList;
|
||||
QList<double> new_ValueList;
|
||||
int size1=(SourEdep-SourSdep)/rlev_left+1.5;
|
||||
if(size1>0) {
|
||||
float dep=0;
|
||||
for(int i=0;i<size1;i++) {
|
||||
dep=SourSdep+i*rlev_left;
|
||||
new_DepthList.append(0-dep);
|
||||
}
|
||||
}
|
||||
iRet = GetCurvValue(m_RightCurve.m_strSlfName, m_RightCurve.m_strLineName, new_DepthList, new_ValueList);
|
||||
if(iRet!=1)
|
||||
{
|
||||
QMessageBox::warning(this, "提示", "曲线数据读取失败,无法拼接!");
|
||||
return;
|
||||
}
|
||||
//采用右侧数据,执行预览
|
||||
emit CallManage::getInstance()->sig_PreMerge_FromRightList(m_strUuid, strSlfName, strWellName, strTrackName, strLineName, new_DepthList, new_ValueList);
|
||||
}
|
||||
|
||||
//执行拼接
|
||||
void MainWindowCurve::s_merge()
|
||||
{
|
||||
|
|
@ -1602,7 +1752,7 @@ void MainWindowCurve::s_merge()
|
|||
return;
|
||||
}
|
||||
|
||||
//通知界面,执行校正
|
||||
//通知界面,执行拼接
|
||||
emit CallManage::getInstance()->sig_MergeFromPlot(m_strUuid, m_LeftCurve.m_strSlfName, m_LeftCurve.m_strWellName, m_LeftCurve.m_strTrackName, m_LeftCurve.m_strLineName);
|
||||
}
|
||||
|
||||
|
|
@ -1648,11 +1798,11 @@ void MainWindowCurve::s_Merge_List(QString strUuid, QList<double> left_Low_List,
|
|||
qsort(m_mergeLineList,0,m_mergeLineList.size()-1,0);
|
||||
|
||||
if(pointnum<1) {
|
||||
QMessageBox::warning(this, "提示", "曲线拼接深度点不存在,无法拼接!\n请先设置拼接深度点。");
|
||||
QMessageBox::warning(this, "提示", "曲线拼接深度点不存在,无法拼接!请先设置拼接深度点。");
|
||||
return;
|
||||
}
|
||||
if(pointnum>2) {
|
||||
QMessageBox::warning(this, "提示", "曲线拼接深度点太多,最多可设置2点!\n请重新设置拼接深度点。");
|
||||
QMessageBox::warning(this, "提示", "曲线拼接深度点太多,最多可设置2点!请重新设置拼接深度点。");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -1812,6 +1962,8 @@ void MainWindowCurve::s_Merge_List(QString strUuid, QList<double> left_Low_List,
|
|||
|
||||
//Plot重新加载数据
|
||||
emit CallManage::getInstance()->sig_ReloadPlot(m_strUuid, filename1, name1);
|
||||
//关闭预览框
|
||||
emit CallManage::getInstance()->sig_PreMerge_Close(m_strUuid, m_LeftCurve.m_strSlfName, m_LeftCurve.m_strWellName, m_LeftCurve.m_strTrackName, m_LeftCurve.m_strLineName);
|
||||
|
||||
if(ERRORS.size())QMessageBox::warning(this, "提示", "目标曲线不存在:"+ERRORS.join(" "));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -219,6 +219,10 @@ public slots:
|
|||
void s_merge();
|
||||
void s_Merge_List(QString strUuid, QList<double> left_Low_List, QList<double> right_Hight_List);
|
||||
|
||||
//拼接预览
|
||||
void s_PreMegAc();
|
||||
void s_PreMerge_List(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QList<double> left_Low_List, QList<double> right_Hight_List);
|
||||
|
||||
//编辑曲线,框选拉伸/压缩
|
||||
void s_EShiftDepth(QString strSlfName, QString strLineName, int count, QList<double> left_Low_List, QList<double> right_Hight_List);
|
||||
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@
|
|||
#include "transparentdraggableGuan.h"
|
||||
#include "TransparentDraggableLine.h"
|
||||
#include "transparentdraggableSelectRect.h"
|
||||
#include "transparentdraggableRightList.h"
|
||||
#include "qtcommonclass.h"
|
||||
|
||||
//是否隐藏刻度
|
||||
|
|
@ -89,6 +90,12 @@ QMyCustomPlot::QMyCustomPlot(QWidget *parent, QString strSlfName, QString strWel
|
|||
connect(CallManage::getInstance(), SIGNAL(sig_RuncorFromPlot(QString, QString, QString, QString, QString)), this, SLOT(s_RuncorFromPlot(QString, QString, QString, QString, QString)));
|
||||
//执行拼接
|
||||
connect(CallManage::getInstance(), SIGNAL(sig_MergeFromPlot(QString, QString, QString, QString, QString)), this, SLOT(s_MergeFromPlot(QString, QString, QString, QString, QString)));
|
||||
//执行预览
|
||||
connect(CallManage::getInstance(), SIGNAL(sig_PreMergeFromPlot(QString, QString, QString, QString, QString)), this, SLOT(s_PreMergeFromPlot(QString, QString, QString, QString, QString)));
|
||||
//采用右侧数据,执行预览
|
||||
connect(CallManage::getInstance(), SIGNAL(sig_PreMerge_FromRightList(QString, QString, QString, QString, QString, QList<double>, QList<double>)), this, SLOT(s_PreMerge_FromRightList(QString, QString, QString, QString, QString, QList<double>, QList<double>)));
|
||||
//关闭预览框
|
||||
connect(CallManage::getInstance(), SIGNAL(sig_PreMerge_Close(QString, QString, QString, QString, QString)), this, SLOT(s_PreMerge_Close(QString, QString, QString, QString, QString)));
|
||||
|
||||
//Plot重新加载数据
|
||||
connect(CallManage::getInstance(), SIGNAL(sig_ReloadPlot(QString, QString, QString)), this, SLOT(s_ReloadPlot(QString, QString, QString)));
|
||||
|
|
@ -604,6 +611,29 @@ void QMyCustomPlot::addSelectRectToPlot(double left_Low, double right_Hight, int
|
|||
m_mapDraggable_SelectRect[strUuid] = dragRect;
|
||||
}
|
||||
|
||||
//预览
|
||||
void QMyCustomPlot::addRightListToPlot( QList<double> new_DepthList, QList<double> new_ValueListt)
|
||||
{
|
||||
//qDebug() << "QMyCustomPlot addSelectRectToPlot";
|
||||
|
||||
QtCommonClass *qtCommon = new QtCommonClass(this);
|
||||
QString strUuid = qtCommon->getUUid();
|
||||
|
||||
// 在初始化代码中
|
||||
TransparentDraggableRightList *dragRect = new TransparentDraggableRightList(this, strUuid);
|
||||
//图片,提前设值,后面setRange改变
|
||||
dragRect->setRightList(new_DepthList, new_ValueListt);
|
||||
// 设置初始范围
|
||||
dragRect->setRange(new_DepthList[new_DepthList.size()-1], new_DepthList[0]);
|
||||
// 可选:设置颜色
|
||||
dragRect->setColor(QColor(255, 255, 255, 80)); // 半透明红色
|
||||
//最小宽度
|
||||
dragRect->setMinWidth(0.1);
|
||||
//dragRect->setTitle(strText);
|
||||
|
||||
m_mapDraggable_RightList[strUuid] = dragRect;
|
||||
}
|
||||
|
||||
//校深线段
|
||||
void QMyCustomPlot::s_AddShifLineToPlot(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, double left_Low, double right_Hight)
|
||||
{
|
||||
|
|
@ -705,7 +735,7 @@ void QMyCustomPlot::s_RuncorFromPlot(QString strUuid, QString strSlfName, QStrin
|
|||
|
||||
if(left_Low_List.size()<=0)
|
||||
{
|
||||
QMessageBox::warning(this, "提示", "无校正深度线或深度移动量!");
|
||||
QMessageBox::warning(nullptr, "提示", "无校正深度线或深度移动量!");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -746,7 +776,7 @@ void QMyCustomPlot::s_MergeFromPlot(QString strUuid, QString strSlfName, QString
|
|||
|
||||
if(left_Low_List.size()<=0)
|
||||
{
|
||||
QMessageBox::warning(this, "提示", "曲线拼接深度点不存在,无法拼接!\n请先设置拼接深度点。");
|
||||
QMessageBox::warning(nullptr, "提示", "曲线拼接深度点不存在,无法拼接!请先设置拼接深度点。");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -754,6 +784,93 @@ void QMyCustomPlot::s_MergeFromPlot(QString strUuid, QString strSlfName, QString
|
|||
emit CallManage::getInstance()->sig_Merge_List(m_strUuid, left_Low_List, right_Hight_List);
|
||||
}
|
||||
|
||||
//关闭预览框
|
||||
void QMyCustomPlot::s_PreMerge_Close(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;
|
||||
}
|
||||
|
||||
TransparentDraggableRightList *pDraggableRect =NULL;
|
||||
{
|
||||
QMap<QString,QObject *>::Iterator it = this->m_mapDraggable_RightList.begin();
|
||||
if( it != this->m_mapDraggable_RightList.end() )
|
||||
{
|
||||
pDraggableRect = (TransparentDraggableRightList*)it.value();
|
||||
pDraggableRect->deleteRect();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void QMyCustomPlot::s_PreMerge_FromRightList(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QList<double> new_DepthList, QList<double> new_ValueList)
|
||||
{
|
||||
if(m_strUuid == strUuid &&
|
||||
m_strSlfName == strSlfName &&
|
||||
m_strWellName == strWellName &&
|
||||
m_strTrackName == strTrackName &&
|
||||
m_strLineName == strLineName)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//预览
|
||||
addRightListToPlot(new_DepthList, new_ValueList);
|
||||
}
|
||||
|
||||
//执行预览
|
||||
void QMyCustomPlot::s_PreMergeFromPlot(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;
|
||||
}
|
||||
|
||||
QList<double> left_Low_List;
|
||||
QList<double> right_Hight_List;
|
||||
|
||||
TransparentDraggableLine *pDraggableLine =NULL;
|
||||
QMap<QString,QObject *>::Iterator it = m_mapDraggable_Line.begin();
|
||||
while( it != m_mapDraggable_Line.end() )
|
||||
{
|
||||
pDraggableLine = (TransparentDraggableLine*)it.value();
|
||||
left_Low_List.append(0-pDraggableLine->m_left_Low);
|
||||
right_Hight_List.append(0-pDraggableLine->m_right_Hight);
|
||||
|
||||
//
|
||||
it++;
|
||||
}
|
||||
|
||||
if(left_Low_List.size()<=0)
|
||||
{
|
||||
QMessageBox::warning(nullptr, "提示", "曲线拼接深度点不存在,无法拼接!请先设置拼接深度点。");
|
||||
return;
|
||||
}
|
||||
|
||||
//执行预览
|
||||
emit CallManage::getInstance()->sig_PreMerge_List(m_strUuid, m_strSlfName, m_strWellName, m_strTrackName, m_strLineName, left_Low_List, right_Hight_List);
|
||||
}
|
||||
|
||||
//Plot重新加载数据
|
||||
void QMyCustomPlot::s_ReloadPlot(QString strUuid, QString strSlfName, QString strLineName)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -81,6 +81,7 @@ public:
|
|||
bool m_addRandomGraph=false;//当前是否绘制曲线 true:是。
|
||||
bool m_bEditRect=false; //当前是否正在编辑曲线。
|
||||
bool m_bFirstTimeConnect=true; //初次绑定编辑曲线信号槽。
|
||||
bool m_bPriviewRightList=false; //当前是否正在预览曲线。
|
||||
|
||||
QMap<QString, QObject*> m_mapDraggable_Rect;
|
||||
QMap<QString, QObject*> m_mapDraggable_Result;
|
||||
|
|
@ -95,6 +96,7 @@ public:
|
|||
QMap<QString, QObject*> m_mapDraggable_Jiegutext;
|
||||
QMap<QString, QObject*> m_mapDraggable_Line;
|
||||
QMap<QString, QObject*> m_mapDraggable_SelectRect;
|
||||
QMap<QString, QObject*> m_mapDraggable_RightList;
|
||||
|
||||
QObject* m_SelectShiftLine=nullptr;//当前选中的分段线
|
||||
QObject* m_SelectRect=nullptr;//当前选中的曲线编辑框
|
||||
|
|
@ -131,6 +133,9 @@ public:
|
|||
//框选并编辑曲线
|
||||
void addSelectRectToPlot(double left_Low, double right_Hight, int left_Low_Number, int right_Hight_Number);
|
||||
|
||||
//预览
|
||||
void addRightListToPlot( QList<double> new_DepthList, QList<double> new_ValueList);
|
||||
|
||||
public slots:
|
||||
void s_LineClicked(int index);
|
||||
void onResetZoom();
|
||||
|
|
@ -185,6 +190,12 @@ public slots:
|
|||
//执行拼接
|
||||
void s_MergeFromPlot(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName);
|
||||
|
||||
//执行预览
|
||||
void s_PreMergeFromPlot(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName);
|
||||
void s_PreMerge_FromRightList(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QList<double> new_DepthList, QList<double> new_ValueList);
|
||||
//关闭预览框
|
||||
void s_PreMerge_Close(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName);
|
||||
|
||||
//Plot重新加载数据
|
||||
void s_ReloadPlot(QString strUuid, QString strSlfName, QString strLineName);
|
||||
|
||||
|
|
|
|||
491
logPlus/transparentdraggableRightList.cpp
Normal file
491
logPlus/transparentdraggableRightList.cpp
Normal file
|
|
@ -0,0 +1,491 @@
|
|||
#include "transparentdraggableRightList.h"
|
||||
#include "CallManage.h"
|
||||
|
||||
|
||||
extern double g_dPixelPerCm;//每厘米像素数
|
||||
//static GeoIndicatorGenerator m_drawGeo;
|
||||
|
||||
TransparentDraggableRightList::TransparentDraggableRightList(QMyCustomPlot *parentPlot, QString strUuid, double minWidth, QString strTitle)
|
||||
: QObject(parentPlot), mPlot(parentPlot), mstrTitle(strTitle), mMinWidth(minWidth)
|
||||
{
|
||||
m_strUuid = strUuid;
|
||||
//
|
||||
initRect();
|
||||
}
|
||||
|
||||
TransparentDraggableRightList::~TransparentDraggableRightList()
|
||||
{
|
||||
if(mPlot) {
|
||||
// mPlot->removeItem(mRect);
|
||||
// mPlot->removeItem(mLeftHandle);
|
||||
// mPlot->removeItem(mRightHandle);
|
||||
mPlot->m_bPriviewRightList = false;//当前是否正在编辑曲线。
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void TransparentDraggableRightList::DrawSVGNormal(QPainter* painter,QString svgFileName,QRectF borderRect,bool IsWellSectonHorizonLayout)
|
||||
{
|
||||
QString svg=svgFileName;
|
||||
QRectF boundingRect = painter->transform().mapRect(borderRect);
|
||||
painter->save();
|
||||
QTransform transform;
|
||||
transform.reset();
|
||||
if (!IsWellSectonHorizonLayout)
|
||||
{
|
||||
painter->setWorldTransform(transform);
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
QPixmap tiledmap(svg);
|
||||
QRect border(boundingRect.left(),boundingRect.top(),boundingRect.width(),boundingRect.height());
|
||||
painter->drawPixmap(border,tiledmap);
|
||||
painter->restore();
|
||||
}
|
||||
//拉伸
|
||||
void TransparentDraggableRightList::DrawSVGSteched(QPainter* painter,QString svgFileName,QRectF borderRect,bool IsWellSectonHorizonLayout)
|
||||
{
|
||||
QString svg=svgFileName;
|
||||
QSvgRenderer m_SvgRenderer;
|
||||
m_SvgRenderer.load(svg);
|
||||
m_SvgRenderer.render(painter,borderRect);
|
||||
}
|
||||
//平铺
|
||||
void TransparentDraggableRightList::DrawSVGTiled(QPainter* painter,QString svgFileName,QRectF borderRect,bool IsWellSectonHorizonLayout)
|
||||
{
|
||||
QString svg=svgFileName;
|
||||
QRectF boundingRect = painter->transform().mapRect(borderRect);
|
||||
painter->save();
|
||||
QTransform transform;
|
||||
transform.reset();
|
||||
if (!IsWellSectonHorizonLayout)
|
||||
{
|
||||
painter->setWorldTransform(transform);
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
QPixmap tiledmap(svg);
|
||||
painter->drawTiledPixmap(boundingRect,tiledmap);
|
||||
painter->restore();
|
||||
}
|
||||
|
||||
|
||||
|
||||
//设置最小宽度
|
||||
void TransparentDraggableRightList::setMinWidth(double minWidth)
|
||||
{
|
||||
mMinWidth = minWidth;
|
||||
}
|
||||
|
||||
//设置标题
|
||||
void TransparentDraggableRightList::setTitle(QString strTitle)
|
||||
{
|
||||
mstrTitle = strTitle;
|
||||
mItemTitle->setText(mstrTitle);
|
||||
//mPlot->replot();
|
||||
}
|
||||
|
||||
void TransparentDraggableRightList::setRightList(QList<double> new_DepthList, QList<double> new_ValueList)
|
||||
{
|
||||
for (int j=0; j<new_DepthList.size()-1; j++)
|
||||
{
|
||||
QCPItemLine *qcpItemLine = new QCPItemLine(mPlot);
|
||||
qcpItemLine->setPen(QPen(Qt::blue));
|
||||
qcpItemLine->setLayer("overlay"); // 确保在最上层
|
||||
qcpItemLine->start->setCoords(new_DepthList[j], new_ValueList[j]);
|
||||
qcpItemLine->end->setCoords(new_DepthList[j+1], new_ValueList[j+1]);
|
||||
|
||||
//
|
||||
m_qcpItemLine_List.append(qcpItemLine);
|
||||
}
|
||||
}
|
||||
|
||||
// 设置矩形范围
|
||||
void TransparentDraggableRightList::setRange(double left_Low, double right_Hight)
|
||||
{
|
||||
if(left_Low >= right_Hight) return;
|
||||
|
||||
m_left_Low_Current = left_Low;
|
||||
m_right_Hight_Current = 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, lY2);
|
||||
|
||||
double delta = (right_Hight - left_Low) / (double)(m_left_Low_Number-m_right_Hight_Number-1);
|
||||
|
||||
updateHandles();
|
||||
mPlot->replot();
|
||||
}
|
||||
|
||||
// 获取当前范围
|
||||
QCPRange TransparentDraggableRightList::getRange()
|
||||
{
|
||||
return QCPRange(mRect->topLeft->coords().x(), mRect->bottomRight->coords().x());
|
||||
}
|
||||
|
||||
// 设置矩形颜色
|
||||
void TransparentDraggableRightList::setColor(const QColor &color)
|
||||
{
|
||||
mRect->setBrush(QBrush(color));
|
||||
mRect->setPen(QPen(color.darker()));
|
||||
//mPlot->replot();
|
||||
}
|
||||
|
||||
// 删除框图
|
||||
void TransparentDraggableRightList::deleteRect()
|
||||
{
|
||||
if(mPlot) {
|
||||
|
||||
// mRect->deleteLater();
|
||||
// mLeftHandle->deleteLater();
|
||||
// mRightHandle->deleteLater();
|
||||
// mPixmap->deleteLater();
|
||||
|
||||
mPlot->m_mapDraggable_RightList.remove(m_strUuid);
|
||||
|
||||
mPlot->removeItem(mRect);
|
||||
mPlot->removeItem(mLeftHandle);
|
||||
mPlot->removeItem(mRightHandle);
|
||||
mPlot->removeItem(mPixmap);
|
||||
mPlot->removeItem(mItemTitle);
|
||||
|
||||
for(int i=m_qcpItemLine_List.size()-1; i>-1; i--)
|
||||
{
|
||||
mPlot->removeItem(m_qcpItemLine_List[i]);
|
||||
}
|
||||
mPlot->m_bPriviewRightList = false;//当前是否正在编辑曲线。
|
||||
|
||||
mPlot->replot();
|
||||
this->deleteLater();
|
||||
|
||||
//
|
||||
// //避免二次绘制框图
|
||||
// mPlot->m_bDrawRect = false;
|
||||
// mDragMode = DragNone;
|
||||
// //取消选中框
|
||||
// mPlot->selectionRect()->cancel();
|
||||
// mPlot->replot();
|
||||
// mPlot->selectionRect()->mActive=true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void TransparentDraggableRightList::initRect()
|
||||
{
|
||||
// 创建透明矩形
|
||||
mRect = new QCPItemRect(mPlot);
|
||||
mRect->setLayer("overlay"); // 确保在最上层
|
||||
mRect->setBrush(QBrush(QColor(255, 255, 255, 50))); // 半透明蓝色
|
||||
mRect->setPen(QPen(QColor(70, 70, 255, 200)));
|
||||
|
||||
// 创建左右边界控制点
|
||||
mLeftHandle = new QCPItemRect(mPlot);
|
||||
mLeftHandle->setLayer("overlay");
|
||||
mLeftHandle->setBrush(QBrush(Qt::red));
|
||||
mLeftHandle->setPen(QPen(Qt::darkRed));
|
||||
|
||||
mRightHandle = new QCPItemRect(mPlot);
|
||||
mRightHandle->setLayer("overlay");
|
||||
mRightHandle->setBrush(QBrush(Qt::red));
|
||||
mRightHandle->setPen(QPen(Qt::darkRed));
|
||||
|
||||
// 设置初始位置
|
||||
//double center = mPlot->xAxis->range().center();
|
||||
// setRange(center - 10, center + 10);
|
||||
|
||||
// 连接鼠标事件
|
||||
connect(mPlot, &QCustomPlot::mousePress, this, &TransparentDraggableRightList::onMousePress);
|
||||
//connect(mPlot, &QCustomPlot::mouseMove, this, &TransparentDraggableRightList::onMouseMove);
|
||||
connect(mPlot, &QCustomPlot::mouseRelease, this, &TransparentDraggableRightList::onMouseRelease);
|
||||
|
||||
mPixmap = new QCPItemPixmap(mPlot);
|
||||
//mPixmap->setPixmap(QPixmap(":/image/file.png")); // 设置图片
|
||||
mPixmap->setScaled(true, Qt::IgnoreAspectRatio); // 设置缩放方式
|
||||
mPixmap->setLayer("overlay"); // 确保在最上层
|
||||
|
||||
mItemTitle = new QCPItemText(mPlot);
|
||||
mItemTitle->setText(mstrTitle);
|
||||
//mItemTitle->setBrush(QBrush(Qt::red));
|
||||
mItemTitle->setFont(QFont("Arial", 12, QFont::Bold));
|
||||
mItemTitle->setColor(Qt::black);
|
||||
mItemTitle->setPositionAlignment(Qt::AlignTop | Qt::AlignHCenter);
|
||||
mItemTitle->position->setType(QCPItemPosition::ptPlotCoords);
|
||||
//mItemTitle->position->setType(QCPItemPosition::ptAxisRectRatio);
|
||||
mItemTitle->position->setCoords(0.5, 0);
|
||||
mItemTitle->setLayer("overlay");
|
||||
}
|
||||
|
||||
void TransparentDraggableRightList::updateHandles()
|
||||
{
|
||||
// 左边界矩形控制点
|
||||
mLeftHandle->topLeft->setParentAnchor(mRect->topLeft);
|
||||
mLeftHandle->bottomRight->setParentAnchor(mRect->topRight);//(mRect->bottomLeft);
|
||||
mLeftHandle->topLeft->setCoords(-0.5, 0.5); // 矩形大小
|
||||
mLeftHandle->bottomRight->setCoords(0.5, -0.5); // 矩形大小
|
||||
|
||||
// 右边界矩形控制点
|
||||
mRightHandle->topLeft->setParentAnchor(mRect->bottomLeft);
|
||||
mRightHandle->bottomRight->setParentAnchor(mRect->bottomRight);
|
||||
mRightHandle->topLeft->setCoords(-0.5, 0.5); // 矩形大小
|
||||
mRightHandle->bottomRight->setCoords(0.5, -0.5); // 矩形大小
|
||||
|
||||
}
|
||||
|
||||
void TransparentDraggableRightList::slotSaveChange()
|
||||
{
|
||||
}
|
||||
|
||||
void TransparentDraggableRightList::onDelRect()
|
||||
{
|
||||
//mDragMode = DragNone;
|
||||
//删除框图
|
||||
deleteRect();
|
||||
}
|
||||
|
||||
|
||||
void TransparentDraggableRightList::onMousePress(QMouseEvent *event)
|
||||
{
|
||||
if(event->button() != Qt::LeftButton)//右键
|
||||
{
|
||||
double y = mPlot->xAxis->pixelToCoord(event->pos().y());//x轴展示深度
|
||||
QCPRange currentRange = getRange();
|
||||
if(mLeftHandle->selectTest(event->pos(), false) < 5) {
|
||||
mDragMode = DragNone;
|
||||
}
|
||||
else if(mRightHandle->selectTest(event->pos(), false) < 5) {
|
||||
mDragMode = DragNone;
|
||||
}
|
||||
//else if(x >= currentRange.lower && x <= currentRange.upper) {
|
||||
else if(y >= currentRange.lower && y <= currentRange.upper) {
|
||||
mDragMode = DragNone;
|
||||
|
||||
QMenu menu(mPlot);
|
||||
//menu.addAction(QIcon(::GetImagePath() + "icon/savecurve.png"), "保存当前数据修改", this, &TransparentDraggableRightList::slotSaveChange);
|
||||
menu.addAction(QIcon(::GetImagePath() + "icon/ClearSel.png"), "放弃当前数据修改", this, &TransparentDraggableRightList::onDelRect);
|
||||
menu.exec(event->globalPos());
|
||||
}
|
||||
else {
|
||||
mDragMode = DragNone;
|
||||
return;
|
||||
}
|
||||
|
||||
//event->accept();
|
||||
return;
|
||||
}
|
||||
|
||||
//不处理事件-----------------------
|
||||
return;
|
||||
|
||||
event->accept();
|
||||
|
||||
// 检查点击了哪个部分
|
||||
//double x = mPlot->xAxis->pixelToCoord(event->pos().x());
|
||||
//double y = mPlot->yAxis->pixelToCoord(event->pos().y());
|
||||
|
||||
double y = mPlot->xAxis->pixelToCoord(event->pos().y());//x轴展示深度
|
||||
|
||||
QCPRange currentRange = getRange();
|
||||
|
||||
if(mLeftHandle->selectTest(event->pos(), false) < 5) {
|
||||
mDragMode = DragLeft;
|
||||
}
|
||||
else if(mRightHandle->selectTest(event->pos(), false) < 5) {
|
||||
mDragMode = DragRight;
|
||||
}
|
||||
//else if(x >= currentRange.lower && x <= currentRange.upper) {
|
||||
else if(y >= currentRange.lower && y <= currentRange.upper) {
|
||||
mDragMode = DragRect;
|
||||
}
|
||||
else {
|
||||
mDragMode = DragNone;
|
||||
return;
|
||||
}
|
||||
|
||||
//mDragStartX = x;
|
||||
mDragStartY = y;
|
||||
mDragStartRange = currentRange;
|
||||
|
||||
}
|
||||
|
||||
void TransparentDraggableRightList::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;
|
||||
|
||||
QCPRange newRange = mDragStartRange;
|
||||
|
||||
switch(mDragMode) {
|
||||
case DragLeft: {
|
||||
//double proposedLeft = mDragStartRange.lower + dx;
|
||||
double proposedLeft = mDragStartRange.lower + dy;
|
||||
// 确保不超出轴范围且不使宽度小于最小值
|
||||
newRange.lower = qBound(
|
||||
//mPlot->xAxis->range().lower,
|
||||
getMyLower(),
|
||||
proposedLeft,
|
||||
mDragStartRange.upper - mMinWidth);
|
||||
break;
|
||||
}
|
||||
case DragRight: {
|
||||
//double proposedRight = mDragStartRange.upper + dx;
|
||||
double proposedRight = mDragStartRange.upper + dy;
|
||||
// 确保不超出轴范围且不使宽度小于最小值
|
||||
newRange.upper = qBound(
|
||||
mDragStartRange.lower + mMinWidth,
|
||||
proposedRight,
|
||||
getMyUpper());
|
||||
//mPlot->xAxis->range().upper);
|
||||
break;
|
||||
}
|
||||
case DragRect: {
|
||||
double width = mDragStartRange.size();
|
||||
//double center = mDragStartRange.center() + dx;
|
||||
double center = mDragStartRange.center() + dy;
|
||||
newRange.lower = center - width/2;
|
||||
newRange.upper = center + width/2;
|
||||
|
||||
// 检查是否超出轴范围
|
||||
if(newRange.lower < getMyLower()) {
|
||||
newRange.lower = getMyLower();
|
||||
newRange.upper = newRange.lower + width;
|
||||
}
|
||||
else if(newRange.upper > getMyUpper()) {
|
||||
newRange.upper = getMyUpper();
|
||||
newRange.lower = newRange.upper - width;
|
||||
}
|
||||
|
||||
// QCPRange axisRange = mPlot->xAxis->range();
|
||||
// if(newRange.lower < axisRange.lower) {
|
||||
// newRange.lower = axisRange.lower;
|
||||
// newRange.upper = newRange.lower + width;
|
||||
// }
|
||||
// else if(newRange.upper > axisRange.upper) {
|
||||
// newRange.upper = axisRange.upper;
|
||||
// newRange.lower = newRange.upper - width;
|
||||
// }
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
// //取整数(方便显示统计,左右边界整数显示。)
|
||||
// newRange.lower = (int)newRange.lower;
|
||||
// QCPRange rangeByFile = mPlot->xAxis->range();
|
||||
// if (std::fabs(rangeByFile.upper - (int)newRange.upper) >= 1.0)
|
||||
// {
|
||||
// newRange.upper = (int)newRange.upper;
|
||||
// }
|
||||
|
||||
// 最终确保宽度不小于最小值(针对整体拖动的情况)
|
||||
if(newRange.size() < mMinWidth) {
|
||||
if(mDragMode == DragRect) {
|
||||
// 如果是整体拖动,保持中心点不变
|
||||
double center = newRange.center();
|
||||
newRange.lower = center - mMinWidth/2;
|
||||
newRange.upper = center + mMinWidth/2;
|
||||
} else {
|
||||
// 如果是边界拖动,强制设置最小宽度
|
||||
if(mDragMode == DragLeft) {
|
||||
newRange.lower = newRange.upper - mMinWidth;
|
||||
} else if(mDragMode == DragRight) {
|
||||
newRange.upper = newRange.lower + mMinWidth;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
setRange(newRange.lower, newRange.upper);
|
||||
|
||||
}
|
||||
|
||||
void TransparentDraggableRightList::onMouseRelease(QMouseEvent *event)
|
||||
{
|
||||
//不处理事件-----------------------
|
||||
return;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
double TransparentDraggableRightList::getMyLower()
|
||||
{
|
||||
double dLower = mPlot->xAxis->range().lower;
|
||||
double proposedLeft = mDragStartRange.lower;
|
||||
|
||||
TransparentDraggableRightList *pDraggableRect =NULL;
|
||||
{
|
||||
QMap<QString,QObject *>::Iterator it = mPlot->m_mapDraggable_RightList.begin();
|
||||
while( it != mPlot->m_mapDraggable_RightList.end() )
|
||||
{
|
||||
if(it.key() == m_strUuid)
|
||||
{
|
||||
it++;
|
||||
continue;
|
||||
}
|
||||
pDraggableRect = (TransparentDraggableRightList*)it.value();
|
||||
//
|
||||
QCPRange tmpRange = pDraggableRect->getRange();
|
||||
if(tmpRange.upper >= dLower && tmpRange.upper <= proposedLeft)
|
||||
{
|
||||
dLower = tmpRange.upper;
|
||||
}
|
||||
it++;
|
||||
}
|
||||
}
|
||||
|
||||
return dLower;
|
||||
}
|
||||
|
||||
double TransparentDraggableRightList::getMyUpper()
|
||||
{
|
||||
double dUpper = mPlot->xAxis->range().upper;
|
||||
double proposedRight = mDragStartRange.upper;
|
||||
|
||||
TransparentDraggableRightList *pDraggableRect =NULL;
|
||||
{
|
||||
QMap<QString,QObject *>::Iterator it = mPlot->m_mapDraggable_RightList.begin();
|
||||
while( it != mPlot->m_mapDraggable_RightList.end() )
|
||||
{
|
||||
if(it.key() == m_strUuid)
|
||||
{
|
||||
it++;
|
||||
continue;
|
||||
}
|
||||
pDraggableRect = (TransparentDraggableRightList*)it.value();
|
||||
//
|
||||
QCPRange tmpRange = pDraggableRect->getRange();
|
||||
if(tmpRange.lower <= dUpper && tmpRange.lower >= proposedRight)
|
||||
{
|
||||
dUpper = tmpRange.lower;
|
||||
}
|
||||
it++;
|
||||
}
|
||||
}
|
||||
|
||||
return dUpper;
|
||||
}
|
||||
91
logPlus/transparentdraggableRightList.h
Normal file
91
logPlus/transparentdraggableRightList.h
Normal file
|
|
@ -0,0 +1,91 @@
|
|||
#ifndef TRANSPARENTDRAGGABLERIGHTLIST_H
|
||||
#define TRANSPARENTDRAGGABLERIGHTLIST_H
|
||||
|
||||
#include <QObject>
|
||||
#include "qmycustomplot.h"
|
||||
#include <QString>
|
||||
#include <QMenu>
|
||||
#include "geometryutils.h"
|
||||
#include <QSvgRenderer>
|
||||
|
||||
#pragma execution_character_set("utf-8") // 强制指定执行字符集为 UTF-8
|
||||
|
||||
class TransparentDraggableRightList : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit TransparentDraggableRightList(QMyCustomPlot *parentPlot, QString strUuid="", double minWidth = 1.0, QString strTitle = "");
|
||||
|
||||
|
||||
~TransparentDraggableRightList();
|
||||
|
||||
|
||||
void DrawSVGNormal(QPainter* painter,QString svgFileName,QRectF borderRect,bool IsWellSectonHorizonLayout);
|
||||
//拉伸
|
||||
void DrawSVGSteched(QPainter* painter,QString svgFileName,QRectF borderRect,bool IsWellSectonHorizonLayout);
|
||||
//平铺
|
||||
void DrawSVGTiled(QPainter* painter,QString svgFileName,QRectF borderRect,bool IsWellSectonHorizonLayout);
|
||||
//设置最小宽度
|
||||
void setMinWidth(double minWidth);
|
||||
//设置标题
|
||||
void setTitle(QString strTitle);
|
||||
|
||||
void setRightList(QList<double> new_DepthList, QList<double> new_ValueList);
|
||||
|
||||
// 设置矩形范围
|
||||
void setRange(double left_Low, double right_Hight);
|
||||
// 获取当前范围
|
||||
QCPRange getRange();
|
||||
|
||||
// 设置矩形颜色
|
||||
void setColor(const QColor &color);
|
||||
|
||||
// 删除框图
|
||||
void deleteRect();
|
||||
|
||||
signals:
|
||||
void rangeChanged(QCPRange newRange);
|
||||
void sig_DelRect();
|
||||
|
||||
private:
|
||||
void initRect();
|
||||
void updateHandles() ;
|
||||
|
||||
private slots:
|
||||
void slotSaveChange();
|
||||
void onDelRect();
|
||||
void onMousePress(QMouseEvent *event);
|
||||
void onMouseMove(QMouseEvent *event);
|
||||
void onMouseRelease(QMouseEvent *event);
|
||||
double getMyLower();
|
||||
double getMyUpper();
|
||||
|
||||
private:
|
||||
QMyCustomPlot *mPlot;
|
||||
QCPItemRect *mRect;
|
||||
QCPItemRect *mLeftHandle;
|
||||
QCPItemRect *mRightHandle;
|
||||
|
||||
QCPItemPixmap *mPixmap;
|
||||
QCPItemText *mItemTitle;
|
||||
QString mstrTitle="";
|
||||
QString m_strUuid = "";
|
||||
QString m_Result;
|
||||
//
|
||||
QList<QCPItemLine*> m_qcpItemLine_List;
|
||||
int m_left_Low_Number;
|
||||
int m_right_Hight_Number;
|
||||
double m_left_Low_Current;
|
||||
double m_right_Hight_Current;
|
||||
|
||||
enum DragMode { DragNone, DragLeft, DragRight, DragRect };
|
||||
DragMode mDragMode = DragNone;
|
||||
//double mDragStartX = 0;
|
||||
double mDragStartY = 0;
|
||||
QCPRange mDragStartRange;
|
||||
|
||||
// 添加最小宽度成员变量
|
||||
double mMinWidth;
|
||||
};
|
||||
|
||||
#endif // TRANSPARENTDRAGGABLERIGHTLIST_H
|
||||
|
|
@ -105,90 +105,6 @@ void TransparentDraggableSelectRect::setNumber(int left_Low_Number, int right_Hi
|
|||
}
|
||||
}
|
||||
|
||||
//设置解释结论
|
||||
void TransparentDraggableSelectRect::setResult(QString filePath)
|
||||
{
|
||||
m_Result = filePath;
|
||||
}
|
||||
|
||||
void TransparentDraggableSelectRect::drawResult(double left_Low, double right_Hight, double lY1, double lY2)
|
||||
{
|
||||
if(m_Result=="")
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
double x1 = mPlot->xAxis->coordToPixel(left_Low);
|
||||
double x2 = mPlot->xAxis->coordToPixel(right_Hight);
|
||||
double y1 = mPlot->yAxis->coordToPixel(lY1);
|
||||
double y2 = mPlot->yAxis->coordToPixel(lY2);
|
||||
|
||||
//
|
||||
QString filePath = m_Result;
|
||||
//
|
||||
QString strLast = filePath.right(4);
|
||||
if(strLast.toLower()==".svg")
|
||||
{
|
||||
QString path,filename;
|
||||
GetWellNameAndPath(filePath, filename, path);
|
||||
QString basename = filename;
|
||||
|
||||
QString val=filePath;
|
||||
QImage image(y2-y1, x1-x2,QImage::Format_RGB32);
|
||||
QPainter painter(&image);
|
||||
QRectF fillRect(0,0, y2-y1, x1-x2);
|
||||
painter.fillRect(fillRect,Qt::white);
|
||||
//拉伸
|
||||
DrawSVGSteched(&painter,filePath,fillRect,0);
|
||||
//平铺
|
||||
//DrawSVGTiled(&painter,filePath,fillRect,0);
|
||||
//正常
|
||||
//DrawSVGNormal(&painter,filePath,fillRect,0);
|
||||
|
||||
val=GetImagePath()+"TempNew";
|
||||
QDir ss;
|
||||
if(!ss.exists(val)) {
|
||||
ss.mkdir(val);
|
||||
}
|
||||
val+=QDir::separator();
|
||||
val+=basename+".png";
|
||||
image.save(val);
|
||||
|
||||
//
|
||||
mPixmap->setPixmap(QPixmap(val)); // 设置图片
|
||||
}
|
||||
else
|
||||
{
|
||||
mPixmap->setPixmap(QPixmap(filePath)); // 设置图片
|
||||
|
||||
// QString path,filename;
|
||||
// GetWellNameAndPath(filePath, filename, path);
|
||||
// QString basename = filename;
|
||||
|
||||
// QString val=filePath;
|
||||
// QImage image(y2-y1, x1-x2,QImage::Format_RGB32);
|
||||
// QPainter painter(&image);
|
||||
// QRectF fillRect(0,0, y2-y1, x1-x2);
|
||||
// painter.fillRect(fillRect,Qt::white);
|
||||
// //平铺
|
||||
// DrawSVGNormal(&painter,filePath,fillRect,0);
|
||||
|
||||
// val=GetImagePath()+"TempNew";
|
||||
// QDir ss;
|
||||
// if(!ss.exists(val)) {
|
||||
// ss.mkdir(val);
|
||||
// }
|
||||
// val+=QDir::separator();
|
||||
// val+=basename+".png";
|
||||
// image.save(val);
|
||||
|
||||
// //
|
||||
// mPixmap->setPixmap(QPixmap(val)); // 设置图片
|
||||
}
|
||||
|
||||
//mPlot->replot();
|
||||
}
|
||||
|
||||
// 设置矩形范围
|
||||
void TransparentDraggableSelectRect::setRange(double left_Low, double right_Hight)
|
||||
{
|
||||
|
|
@ -213,20 +129,6 @@ void TransparentDraggableSelectRect::setRange(double left_Low, double right_High
|
|||
iLoop++;
|
||||
}
|
||||
|
||||
//位置与rect不一样,否则图像反转
|
||||
// mPixmap->topLeft->setCoords(right_Hight, lY1);
|
||||
// mPixmap->bottomRight->setCoords(left_Low, lY2);
|
||||
//drawResult(left_Low, right_Hight, lY1, lY2);
|
||||
|
||||
//mItemTitle->position->setCoords(0.5, 0.5);
|
||||
// 设置父锚点,定位点
|
||||
//mItemTitle->position->setParentAnchor(mRect->bottom);
|
||||
// mItemTitle->position->setCoords((mRect->topLeft->coords().x() + mRect->bottomRight->coords().x())/2,
|
||||
// (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);
|
||||
|
||||
updateHandles();
|
||||
mPlot->replot();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,10 +32,6 @@ public:
|
|||
|
||||
void setNumber(int left_Low_Number, int right_Hight_Number);
|
||||
|
||||
//设置解释结论
|
||||
void setResult(QString filePath);
|
||||
void drawResult(double left_Low, double right_Hight, double lY1, double lY2);
|
||||
|
||||
// 设置矩形范围
|
||||
void setRange(double left_Low, double right_Hight);
|
||||
// 获取当前范围
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user