复制粘贴多条曲线,多条曲线显示,曲线滚动条联动

This commit is contained in:
zhaolei 2026-04-01 09:23:19 +08:00
parent 3685398d01
commit 24f1ac1be2
10 changed files with 294 additions and 77 deletions

View File

@ -39,7 +39,7 @@ signals:
void sig_CloseProject();//关闭项目 void sig_CloseProject();//关闭项目
void sig_ShowParameterCard(QString strSlfName, QString strName);//参数表查看 void sig_ShowParameterCard(QString strSlfName, QString strName);//参数表查看
void sig_ShowCurve(QString strSlfName, QString strName);//曲线数据查看 void sig_ShowCurve(QMap<QString,QList<QString>> mapShowObject);//曲线数据查看
void sig_DepthShift(QString strSlfName, QString strName, double DepthOffset);//深度移动 void sig_DepthShift(QString strSlfName, QString strName, double DepthOffset);//深度移动
void sig_ShowTable(QString strSlfName, QString strName);//表格数据查看 void sig_ShowTable(QString strSlfName, QString strName);//表格数据查看
void sig_ShowWave(QString strSlfName, QString strName);//波列数据查看 void sig_ShowWave(QString strSlfName, QString strName);//波列数据查看

View File

@ -1930,37 +1930,37 @@ void CDataManagger::CallDisplayWaveOrCurve(int Type, const QString& FileName,
} }
// void CDataManagger::CallDisplayCurveVerChange(int Type, const QString& FileName, void CDataManagger::CallDisplayCurveVerChange(int Type, const QString& FileName,
// const QString& CurveName, QWidget* parent, int value, float tipValue) const QString& CurveName, QWidget* parent, int value, float tipValue)
// { {
// //常规曲线 //常规曲线
// if (Type == 0) if (Type == 0)
// { {
// ShowCurve *pDlg=parent->findChild<ShowCurve*>("curveView"); ShowCurve *pDlg=parent->findChild<ShowCurve*>("curveView");
// if(NULL == pDlg) if(NULL == pDlg)
// { {
// pDlg=new ShowCurve(parent); pDlg=new ShowCurve(parent);
// pDlg->setObjectName("curveView"); pDlg->setObjectName("curveView");
// pDlg->FileName=FileName; pDlg->FileName=FileName;
// pDlg->CurveName=CurveName; pDlg->CurveName=CurveName;
// pDlg->init(); pDlg->init();
// pDlg->show(); pDlg->show();
// } }
// pDlg->linkVerDeptSliderValueChange(value, tipValue); pDlg->linkVerDeptSliderValueChange(value, tipValue);
// } }
// } }
// void CDataManagger::sendTableP2Mgr(QWidget* parent, QScrollBar *p, QTableWidget *t) void CDataManagger::sendTableP2Mgr(QWidget* parent, QScrollBar *p, QTableWidget *t)
// { {
// ShowCurve *pDlg = parent->findChild<ShowCurve*>("curveView"); ShowCurve *pDlg = parent->findChild<ShowCurve*>("curveView");
// if(NULL == pDlg) return; if(NULL == pDlg) return;
// pDlg->setTableBro(p); pDlg->setTableBro(p);
// pDlg->setCurveTable(t); pDlg->setCurveTable(t);
// } }
/* /*
void CDataManagger::ListMessage(const QString& listName,const QStringList& header,const QStringList& listMessage) void CDataManagger::ListMessage(const QString& listName,const QStringList& header,const QStringList& listMessage)

View File

@ -70,6 +70,7 @@ FORMS += \
HEADERS += \ HEADERS += \
../../common/geometryutils.h \ ../../common/geometryutils.h \
../include/DataManagger.h \
AdaptionComboBox.h \ AdaptionComboBox.h \
AngleAdjTool.h \ AngleAdjTool.h \
CheckHeadView.h \ CheckHeadView.h \
@ -92,8 +93,7 @@ HEADERS += \
cdialog.h \ cdialog.h \
dataslothelper.h \ dataslothelper.h \
deptlineedit.h \ deptlineedit.h \
view.h \ view.h
../include/DataManagger.h
SOURCES += \ SOURCES += \
../../common/geometryutils.cpp \ ../../common/geometryutils.cpp \

View File

@ -138,6 +138,7 @@ public:
public: public:
void setName(QString strOldPath, QString strOldName, int nObjectType); void setName(QString strOldPath, QString strOldName, int nObjectType);
void setShowCurveName(QString strPath, QString strName, QMap<QString,QList<QString>> mapShowObject);
}; };
#endif /* PAITABLEWIDGET_H_ */ #endif /* PAITABLEWIDGET_H_ */

View File

@ -191,6 +191,7 @@ void WellLogTableDialogNew::setName(QString strOldPath, QString strOldName, int
pWellLog->m_name = strOldName; pWellLog->m_name = strOldName;
m_pWellLogs.clear(); m_pWellLogs.clear();
m_pWellLogs.append(pWellLog); m_pWellLogs.append(pWellLog);
//初始化 //初始化
InitWell(); InitWell();
@ -205,6 +206,46 @@ void WellLogTableDialogNew::setName(QString strOldPath, QString strOldName, int
//m_pUI->tableWidget->setCurrentCell(300, 0); //m_pUI->tableWidget->setCurrentCell(300, 0);
} }
void WellLogTableDialogNew::setShowCurveName(QString strPath, QString strName, QMap<QString,QList<QString>> mapShowObject)
{
FileName = strPath;
CurveName = strName;
m_ObjectType = CURVE_OBJECT;
if (WAVE_OBJECT != m_ObjectType)
m_pUI->horizontalScrollBar->hide();
m_pWellLogs.clear();
QList<QString> listShowSlfName = mapShowObject.keys();
for(int i= 0; i < listShowSlfName.size(); i++)
{
QString strSlfName = listShowSlfName.at(i);
QList<QString> listObjectName = mapShowObject[listShowSlfName.at(i)];
for(int j= 0; j < listObjectName.size(); j++)
{
QString strCurveName = listObjectName.at(j);
CObjWellLog* pWellLog = new CObjWellLog;
pWellLog->SetSlfFileName(strSlfName);
pWellLog->m_name = strCurveName;
m_pWellLogs.append(pWellLog);
}
}
//初始化
InitWell();
m_gridData->m_middleWidth=0;
m_gridData->m_gridWidth=0;
InitWellLog();
qDebug() << "count=" << QString::number(count);
m_pUI->tableWidget->verticalScrollBar()->setRange(0, count);//count
m_pUI->tableWidget->verticalScrollBar()->setValue(count / 2);
//m_pUI->tableWidget->setCurrentCell(300, 0);
}
//井眼轨迹 //井眼轨迹
void WellLogTableDialogNew::InitWell() void WellLogTableDialogNew::InitWell()
{ {

View File

@ -3448,17 +3448,17 @@ void GridDataAdapter::slotVerScrollValueChange(int nValue)
m_popTip->moveCursorPoint(m_popTipValue); m_popTip->moveCursorPoint(m_popTipValue);
if(m_dtype == D_WellLogData){ if(m_dtype == D_WellLogData){
// //20210111 GZL add 联动 //20210111 GZL add 联动
// QWidget* parent=qobject_cast<QWidget*>(m_table->parent()); QWidget* parent=qobject_cast<QWidget*>(m_table->parent());
// QWidget* pvPage=parent->findChild<QWidget*>("curvePreViewPage"); QWidget* pvPage=parent->findChild<QWidget*>("curvePreViewPage");
// int value = (m_EDep-m_popTipValue)*CurveViewVerRange/(m_EDep-m_SDep)+1; int value = (m_EDep-m_popTipValue)*CurveViewVerRange/(m_EDep-m_SDep)+1;
// if(value >= 0 && value <= CurveViewVerRange){ if(value >= 0 && value <= CurveViewVerRange){
// m_mgr->CallDisplayCurveVerChange(0,fileName,curveName,pvPage,value,m_popTipValue); m_mgr->CallDisplayCurveVerChange(0,fileName,curveName,pvPage,value,m_popTipValue);
// m_mgr->sendTableP2Mgr(pvPage, m_verScrolBar, m_table); m_mgr->sendTableP2Mgr(pvPage, m_verScrolBar, m_table);
// } }
// //updateTableView(); //updateTableView();
} }
} }
else{ else{

View File

@ -89,7 +89,7 @@ MainWindow::MainWindow(QWidget *parent) :
connect(CallManage::getInstance(), SIGNAL(sig_ShowParameterCard(QString, QString)), this, SLOT(s_ShowParameterCard(QString, QString))); connect(CallManage::getInstance(), SIGNAL(sig_ShowParameterCard(QString, QString)), this, SLOT(s_ShowParameterCard(QString, QString)));
//曲线 //曲线
//关联信号槽,数据查看曲线数据 //关联信号槽,数据查看曲线数据
connect(CallManage::getInstance(), SIGNAL(sig_ShowCurve(QString, QString)), this, SLOT(s_ShowCurve(QString, QString))); connect(CallManage::getInstance(), SIGNAL(sig_ShowCurve(QMap<QString,QList<QString>>)), this, SLOT(s_ShowCurve(QMap<QString,QList<QString>>)));
//关联信号槽,数据查看表格数据 //关联信号槽,数据查看表格数据
connect(CallManage::getInstance(), SIGNAL(sig_ShowTable(QString, QString)), this, SLOT(s_ShowTable(QString, QString))); connect(CallManage::getInstance(), SIGNAL(sig_ShowTable(QString, QString)), this, SLOT(s_ShowTable(QString, QString)));
@ -583,12 +583,21 @@ void MainWindow::s_ShowParameterCard(QString strSlfName, QString strName)
} }
//曲线数据查看 //曲线数据查看
void MainWindow::s_ShowCurve(QString strSlfName, QString strName) void MainWindow::s_ShowCurve(QMap<QString,QList<QString>> mapShowObject)
{ {
if(m_centerWidgets) if(m_centerWidgets)
{ {
QString strSlfName;
QString strName;
QList<QString> listShowSlfName = mapShowObject.keys();
if (listShowSlfName.size()>0)
{
strSlfName = listShowSlfName.at(0);
strName = mapShowObject[listShowSlfName.at(0)].at(0);
}
WellLogTableDialogNew* pDialog = new WellLogTableDialogNew(); WellLogTableDialogNew* pDialog = new WellLogTableDialogNew();
pDialog->setName(strSlfName, strName, CURVE_OBJECT); pDialog->setShowCurveName(strSlfName, strName, mapShowObject);
QString wellname; QString wellname;
QString path; QString path;
GetWellNameAndPath(strSlfName, wellname, path); GetWellNameAndPath(strSlfName, wellname, path);

View File

@ -91,7 +91,7 @@ public slots:
//开发工具 //开发工具
void s_development(); void s_development();
void s_ShowParameterCard(QString strSlfName, QString strName);//参数卡数据查看 void s_ShowParameterCard(QString strSlfName, QString strName);//参数卡数据查看
void s_ShowCurve(QString strSlfName, QString strName);//曲线数据查看 void s_ShowCurve(QMap<QString,QList<QString>> mapShowObject);//曲线数据查看
void s_ShowTable(QString strSlfName, QString strName);//表格数据查看 void s_ShowTable(QString strSlfName, QString strName);//表格数据查看
void s_ShowWave(QString strSlfName, QString strName); //波列数据查看 void s_ShowWave(QString strSlfName, QString strName); //波列数据查看
void s_WelllogInformation(QString strSlfName);//编辑测井信息 void s_WelllogInformation(QString strSlfName);//编辑测井信息

View File

@ -63,7 +63,7 @@ QtProjectWidgets::QtProjectWidgets(QWidget *parent)
// 设置选择模式为多选模式 // 设置选择模式为多选模式
ui->treeWidget->setSelectionMode(QAbstractItemView::ExtendedSelection); // 或者使用 QAbstractItemView::MultiSelection ui->treeWidget->setSelectionMode(QAbstractItemView::ExtendedSelection); // 或者使用 QAbstractItemView::MultiSelection
m_ReFlag = 0;
} }
QtProjectWidgets::~QtProjectWidgets() QtProjectWidgets::~QtProjectWidgets()
@ -76,6 +76,19 @@ QString QtProjectWidgets::getLeftTreeString()
return ui->treeWidget->getCurrentItemString(); return ui->treeWidget->getCurrentItemString();
} }
void QtProjectWidgets::slotButtonCancel()
{
m_ReFlag=QDialogButtonBox::StandardButton::Cancel;
}
void QtProjectWidgets::slotButtonOk()
{
m_ReFlag=QDialogButtonBox::StandardButton::Yes;
}
void QtProjectWidgets::slotButtonNo()
{
m_ReFlag=QDialogButtonBox::StandardButton::No;
}
////初始化树图控件 ////初始化树图控件
//void QtProjectWidgets::initTreeWidget(QString fullPath, QString strProjectName) //void QtProjectWidgets::initTreeWidget(QString fullPath, QString strProjectName)
//{ //{
@ -937,7 +950,28 @@ void QtProjectWidgets::onShowParameterCard(bool checked)
//曲线数据查看 //曲线数据查看
void QtProjectWidgets::onShowCurve(bool checked) void QtProjectWidgets::onShowCurve(bool checked)
{ {
emit CallManage::getInstance()->sig_ShowCurve(m_strSlfName, m_strCurveObjectName); m_mapShowObject.clear();
foreach(QTreeWidgetItem *pItem, ui->treeWidget->selectedItems())
{
QTreeWidgetItem *parentItem = pItem->parent()->parent(); // 上两层目录是井次
if (parentItem)
{
QString strSlfName = parentItem->data(0, Qt::UserRole+1).toString();
if (strSlfName.contains(".slf"))
{
QString strObjectName = pItem->text(0);
if(!m_mapShowObject.contains(strSlfName))
{
QList<QString> selList;
selList.clear();
m_mapShowObject.insert(strSlfName,selList);
}
m_mapShowObject[strSlfName].append(strObjectName);
}
}
}
if(m_mapShowObject.size()>0)
emit CallManage::getInstance()->sig_ShowCurve(m_mapShowObject);
} }
//深度移动 //深度移动
@ -1160,41 +1194,169 @@ void QtProjectWidgets::onDeleteObject()
void QtProjectWidgets::onCopySelObject() // 复制 void QtProjectWidgets::onCopySelObject() // 复制
{ {
m_strCopySlfName = m_strSlfName; // 当前复制的对象Slf文件 m_mapCopyObject.clear();
m_strCopyCurveObjectName = m_strCurveObjectName; // 当前复制的对象名 foreach(QTreeWidgetItem *pItem, ui->treeWidget->selectedItems())
{
QTreeWidgetItem *parentItem = pItem->parent()->parent(); // 上两层目录是井次
if (parentItem)
{
QString strSlfName = parentItem->data(0, Qt::UserRole+1).toString();
if (strSlfName.contains(".slf"))
{
QString strObjectName = pItem->text(0);
if(!m_mapCopyObject.contains(strSlfName))
{
QList<QString> selList;
selList.clear();
m_mapCopyObject.insert(strSlfName,selList);
}
m_mapCopyObject[strSlfName].append(strObjectName);
}
}
}
} }
void QtProjectWidgets::onPasteSelObject() // 粘贴 void QtProjectWidgets::onPasteSelObject() // 粘贴
{ {
if (m_strCopySlfName == m_strSlfName) int flag=0;
int check=0;
m_ReFlag=0;
QList<QString> listCopySlfName = m_mapCopyObject.keys();
for(int i= 0; i < listCopySlfName.size(); i++)
{ {
CLogIO *logio=new CLogIO; QString strCopySlfName = listCopySlfName.at(i);
if(!logio->Open(m_strSlfName.toStdString().c_str(),CLogIO::modeReadWrite)) { QList<QString> listObjectName = m_mapCopyObject[listCopySlfName.at(i)];
delete logio; if (strCopySlfName == m_strSlfName)
return;
}
char buf[1000];
int i=1;
while(1) {
sprintf(buf,"%s_%d",m_strCopyCurveObjectName.toLocal8Bit().data(),i++);
if (0>logio->FindObjectName(buf))
break;
}
logio->CopyObject(m_strCopyCurveObjectName.toLocal8Bit().data(), buf);
logio->Close();
delete logio;
foreach(QTreeWidgetItem *pItem, ui->treeWidget->selectedItems())
{ {
QTreeWidgetItem *parentItem = pItem/*->parent()*/; // 上一层目录是井次 CLogIO *logio=new CLogIO;
if (parentItem && m_strSlfName == parentItem->data(0, Qt::UserRole+1).toString()) if(!logio->Open(m_strSlfName.toStdString().c_str(),CLogIO::modeReadWrite)) {
RefreshWellRoundTree(parentItem); delete logio;
parentItem = parentItem = pItem->parent(); return;
if (parentItem && m_strSlfName == parentItem->data(0, Qt::UserRole+1).toString()) }
RefreshWellRoundTree(parentItem); for(int j= 0; j < listObjectName.size(); j++)
break; {
char buf[1000];
int nindex=1;
while(1) {
sprintf(buf,"%s_%d",listObjectName.at(j).toLocal8Bit().data(),nindex++);
if (0>logio->FindObjectName(buf))
break;
}
logio->CopyObject(listObjectName.at(j).toLocal8Bit().data(), buf);
}
logio->Close();
delete logio;
} }
return; else
{
for(int j= 0; j < listObjectName.size(); j++)
{
bool bExistence = false;
CLogIO *logio=new CLogIO;
if(!logio->Open(m_strSlfName.toStdString().c_str(),CLogIO::modeReadWrite)) {
delete logio;
return;
}
if (logio->FindObjectName(listObjectName.at(j).toLocal8Bit().data())>=0)
bExistence = true;
logio->Close();
delete logio;
if((!flag||!check)&&bExistence)
{
QDialog dialog(NULL);
Qt::WindowFlags flags = dialog.windowFlags();
flags |= Qt::WindowStaysOnTopHint;
flags &= ~Qt::WindowContextHelpButtonHint;
dialog.setWindowTitle("提示");
QString mess="已存在!\n 该功能只具覆盖或另创建能力,无法完成拼接操作。\n如需要进行拼接,请在图形区可视化编辑状态完成。\n请选择操作模式:\n";
QFormLayout form(&dialog);
form.addRow(new QLabel(listObjectName.at(j)+mess));
QCheckBox *pCheckBox=new QCheckBox("均按下列操作",&dialog);
form.addRow(pCheckBox);
QDialogButtonBox buttonBox(QDialogButtonBox::Yes |QDialogButtonBox::No | QDialogButtonBox::Cancel,
Qt::Horizontal, &dialog);
form.addRow(&buttonBox);
buttonBox.button(QDialogButtonBox::Yes)->setText(QString("覆盖"));
buttonBox.button(QDialogButtonBox::No)->setText(QString("增加"));
buttonBox.button(QDialogButtonBox::Cancel)->setText(QString("放弃"));
form.addRow(&buttonBox);
QObject::connect(buttonBox.button(QDialogButtonBox::Cancel), SIGNAL(clicked()), this, SLOT(slotButtonCancel()));
QObject::connect(buttonBox.button(QDialogButtonBox::Yes), SIGNAL(clicked()), this, SLOT(slotButtonOk()));
QObject::connect(buttonBox.button(QDialogButtonBox::No), SIGNAL(clicked()), this, SLOT(slotButtonNo()));
QObject::connect(&buttonBox, SIGNAL(accepted()), &dialog, SLOT(accept()));
QObject::connect(&buttonBox, SIGNAL(rejected()), &dialog, SLOT(reject()));
dialog.exec();
flag=m_ReFlag;
check=pCheckBox->checkState();
}
if (flag==QDialogButtonBox::Cancel)
{
QMessageBox::information(NULL,"Cancel","Cancel");
continue;
}
else if (flag==QDialogButtonBox::Yes)
{
CLogIO *logio=new CLogIO;
if(!logio->Open(m_strSlfName.toStdString().c_str(),CLogIO::modeReadWrite)) {
delete logio;
return;
}
logio->DeleteObject(listObjectName.at(j).toLocal8Bit().data());
logio->Close();
delete logio;
CObjWellLog* pcopyingwelllog= new CObjWellLog();
pcopyingwelllog->SetSlfFileName(strCopySlfName);
pcopyingwelllog->SetName(listObjectName.at(j));
pcopyingwelllog->CopyToSLFFile(m_strSlfName);
delete pcopyingwelllog;
}
else if (flag==QDialogButtonBox::No && bExistence)
{
CLogIO *logio=new CLogIO;
if(!logio->Open(m_strSlfName.toStdString().c_str(),CLogIO::modeReadWrite)) {
delete logio;
return;
}
char buf[1000];
int nindex=1;
while(1) {
sprintf(buf,"%s_%d",listObjectName.at(j).toLocal8Bit().data(),nindex++);
if (0>logio->FindObjectName(buf))
break;
}
logio->Close();
delete logio;
CObjWellLog* pcopyingwelllog= new CObjWellLog();
pcopyingwelllog->SetSlfFileName(strCopySlfName);
pcopyingwelllog->SetName(listObjectName.at(j));
pcopyingwelllog->CopyToSLFFile(m_strSlfName,false,buf);
delete pcopyingwelllog;
}
else if (!bExistence)
{
CObjWellLog* pcopyingwelllog= new CObjWellLog();
pcopyingwelllog->SetSlfFileName(strCopySlfName);
pcopyingwelllog->SetName(listObjectName.at(j));
pcopyingwelllog->CopyToSLFFile(m_strSlfName);
delete pcopyingwelllog;
}
}
}
}
foreach(QTreeWidgetItem *pItem, ui->treeWidget->selectedItems())
{
QTreeWidgetItem *parentItem = pItem/*->parent()*/; // 上一层目录是井次
if (parentItem && m_strSlfName == parentItem->data(0, Qt::UserRole+1).toString())
RefreshWellRoundTree(parentItem);
parentItem = parentItem = pItem->parent();
if (parentItem && m_strSlfName == parentItem->data(0, Qt::UserRole+1).toString())
RefreshWellRoundTree(parentItem);
break;
} }
} }
@ -1489,11 +1651,11 @@ void QtProjectWidgets::onItemClicked(QTreeWidgetItem* item, int index)
m_strSlfName = item->parent()->data(0, Qt::UserRole+1).toString();//从父节点井次获取slf m_strSlfName = item->parent()->data(0, Qt::UserRole+1).toString();//从父节点井次获取slf
} }
if (m_strCopySlfName != m_strSlfName) if (m_mapCopyObject.size()==0)
m_action_Paste->setVisible(false); m_action_Paste->setVisible(false);
else else
m_action_Paste->setVisible(true); m_action_Paste->setVisible(true);
//
if (qApp->mouseButtons() == Qt::RightButton) // 只针对鼠标右键,弹出菜单 if (qApp->mouseButtons() == Qt::RightButton) // 只针对鼠标右键,弹出菜单
{ {
if (NULL == popMenu) if (NULL == popMenu)

View File

@ -24,6 +24,9 @@ private:
Ui::QtProjectWidgetsClass *ui; Ui::QtProjectWidgetsClass *ui;
public slots: public slots:
void slotButtonOk();
void slotButtonNo();
void slotButtonCancel();
//void s_initTreeWidget(QString strName);//初始化树图控件 //void s_initTreeWidget(QString strName);//初始化树图控件
void s_loadTreeWidget(QString fileFull);//加载树图 void s_loadTreeWidget(QString fileFull);//加载树图
@ -85,7 +88,7 @@ public:
QMenu *_menuParCardFolder; //参数卡目录 QMenu *_menuParCardFolder; //参数卡目录
QMenu *_menuWaveFolder; //波列目录 QMenu *_menuWaveFolder; //波列目录
QAction* m_action_Paste; // QAction* m_action_Paste; //
//根节点(项目名称)-右键菜单 //根节点(项目名称)-右键菜单
QAction* m_action_New; QAction* m_action_New;
QAction* m_action_Open; QAction* m_action_Open;
@ -99,8 +102,9 @@ public:
QString m_strSlfName; QString m_strSlfName;
QString m_strCurveObjectName; QString m_strCurveObjectName;
QString m_strCopySlfName; // 当前复制的对象Slf文件 QMap<QString,QList<QString>> m_mapShowObject;// 显示Slf文件里对象名
QString m_strCopyCurveObjectName; // 当前复制的对象名 QMap<QString,QList<QString>> m_mapCopyObject;// 复制Slf文件里对象名
int m_ReFlag;
public: public:
void loadIndexSysTree(QTreeWidgetItem *parent, QString fileFull, QString prjname); void loadIndexSysTree(QTreeWidgetItem *parent, QString fileFull, QString prjname);