井次备份,井次剪切,井次粘贴功能添加
This commit is contained in:
parent
f3da99fea2
commit
d677e104fa
|
|
@ -17,7 +17,9 @@
|
|||
* @class WellLogDialog
|
||||
* @brief 测井系统默认对话框
|
||||
*/
|
||||
|
||||
// void OSGWELLLOGUI_EXPORT RenameWellName(CObjWell *pDestWell,CObjWell *pSourceWell,bool isMount=true);
|
||||
int OSGWELLLOGUI_EXPORT SetWellRoundWellName(QString filename,QString strNewName);
|
||||
// bool OSGWELLLOGUI_EXPORT RenameWellName(CObjWell *pWell,QString strNewName);
|
||||
class OSGWELLLOGUI_EXPORT WellLogDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
|
|
|||
|
|
@ -170,7 +170,6 @@ void QtProjectWidgets::s_loadTreeWidget(QString fileFull)
|
|||
ui->treeWidget->setHeaderHidden(true); // 隐藏表头
|
||||
ui->treeWidget->clear();//清理数据
|
||||
|
||||
//
|
||||
QFileInfo fileinfo;
|
||||
fileinfo = QFileInfo(fileFull);
|
||||
//
|
||||
|
|
@ -637,6 +636,15 @@ void QtProjectWidgets::loadWellTree(QTreeWidgetItem *parent, QString fileFull, Q
|
|||
}
|
||||
}
|
||||
|
||||
void QtProjectWidgets::expandAll(QTreeWidgetItem* item) {
|
||||
if (item) {
|
||||
item->setExpanded(true); // 展开当前项
|
||||
for (int i = 0; i < item->childCount(); ++i) {
|
||||
expandAll(item->child(i)); // 递归展开所有子项
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//初始化树形控件中的右键菜单
|
||||
void QtProjectWidgets::initMenu()
|
||||
{
|
||||
|
|
@ -644,6 +652,10 @@ void QtProjectWidgets::initMenu()
|
|||
m_action_Paste ->setIcon(QIcon(GetImagePath() + "icon/Copy.png")); // 设置图标":/image/u174.png"
|
||||
connect(m_action_Paste, SIGNAL(triggered()), this, SLOT(onPasteSelObject()));
|
||||
|
||||
m_action_WellPaste = new QAction("粘贴井次", ui->treeWidget);
|
||||
m_action_WellPaste ->setIcon(QIcon(GetImagePath() + "icon/Copy.png")); // 设置图标
|
||||
connect(m_action_WellPaste, SIGNAL(triggered()), this, SLOT(onPasteWell()));
|
||||
|
||||
//根节点(项目名称)-右键菜单
|
||||
_menuRoot = new QMenu(ui->treeWidget);
|
||||
initRootTreeMenu(_menuRoot, ui->treeWidget);
|
||||
|
|
@ -841,6 +853,8 @@ void QtProjectWidgets::initWellNameTreeMenu(QMenu *menu, QTreeWidget *treeWidget
|
|||
action_New->setIcon(QIcon(GetImagePath() + "icon/outcurves.png")); // 设置图标
|
||||
connect(action_New, SIGNAL(triggered(bool)), this, SLOT(onOutWellLogRound()));
|
||||
menu->addAction(action_New);
|
||||
|
||||
menu->addAction(m_action_WellPaste);
|
||||
}
|
||||
|
||||
//初始化根节点(井次名称)-右键菜单
|
||||
|
|
@ -856,10 +870,21 @@ void QtProjectWidgets::initSlfNameTreeMenu(QMenu *menu, QTreeWidget *treeWidget)
|
|||
connect(action_New, SIGNAL(triggered(bool)), this, SLOT(onImportSlfTable()));
|
||||
menu->addAction(action_New);
|
||||
|
||||
action_New = new QAction("备份", treeWidget);
|
||||
action_New->setIcon(QIcon(GetImagePath() + "icon/Copy.png")); // 设置图标
|
||||
connect(action_New, SIGNAL(triggered(bool)), this, SLOT(onSlfbackup()));
|
||||
menu->addAction(action_New);
|
||||
|
||||
QAction* action_Cut = new QAction("剪切井次", treeWidget);
|
||||
action_Cut->setIcon(QIcon(GetImagePath() + "icon/Cut.png")); // 设置图标
|
||||
connect(action_Cut, SIGNAL(triggered()), this, SLOT(onCutSlf()));
|
||||
menu->addAction(action_Cut);
|
||||
|
||||
action_New = new QAction("编辑测井信息", treeWidget);
|
||||
action_New->setIcon(QIcon(GetImagePath() + "icon/Edit.png")); // 设置图标
|
||||
connect(action_New, SIGNAL(triggered(bool)), this, SLOT(onWelllogInformation()));
|
||||
menu->addAction(action_New);
|
||||
|
||||
menu->addAction(m_action_Paste);
|
||||
|
||||
//
|
||||
|
|
@ -1047,6 +1072,77 @@ void QtProjectWidgets::onShowWave(bool checked)
|
|||
emit CallManage::getInstance()->sig_ShowWave(m_strSlfName, m_strCurveObjectName);
|
||||
}
|
||||
|
||||
//备份井次
|
||||
void QtProjectWidgets::onSlfbackup()
|
||||
{
|
||||
if(!m_strSlfName.isEmpty())
|
||||
{
|
||||
QString path,strWellName,Slfname;
|
||||
foreach(QTreeWidgetItem *pItem, ui->treeWidget->selectedItems())
|
||||
{
|
||||
QTreeWidgetItem *parentItem = pItem;
|
||||
if (parentItem && m_strSlfName == parentItem->data(0, Qt::UserRole+1).toString())
|
||||
{
|
||||
strWellName = parentItem->parent()->text(0);
|
||||
}
|
||||
}
|
||||
GetWellNameAndPath(m_strSlfName,Slfname,path);
|
||||
QString newfile=path+"/"+Slfname+"_backup.slf";
|
||||
if(QFile::copy(m_strSlfName,newfile)) {
|
||||
QString strProjectFolder = GetProjectFolder();
|
||||
QString strProjectFile = strProjectFolder + g_prjname;
|
||||
strProjectFile += ".wwl";
|
||||
s_OpenProject(strProjectFile);
|
||||
|
||||
int topCount = ui->treeWidget->topLevelItemCount(); // 获取顶级节点数量
|
||||
if(topCount<1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
QTreeWidgetItem *item = ui->treeWidget->topLevelItem(0);
|
||||
int childCount = item->childCount(); // 获取子节点数量
|
||||
for (int i = 0; i < childCount; ++i)
|
||||
{
|
||||
//井组,数据分析...
|
||||
QTreeWidgetItem *wellGroupItem = item->child(i);
|
||||
QString wellGroupname = wellGroupItem->text(0);
|
||||
if (wellGroupname == "井组")
|
||||
{
|
||||
int wellCount = wellGroupItem->childCount(); // 获取井节点数量
|
||||
for (int j = 0; j < wellCount; ++j)
|
||||
{
|
||||
//井组,数据分析...
|
||||
QTreeWidgetItem *wellItem = wellGroupItem->child(j);
|
||||
QString wellname = wellItem->text(0);
|
||||
if(wellname==strWellName)//井
|
||||
{
|
||||
wellItem->setExpanded(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return ;
|
||||
}
|
||||
else QMessageBox::information(NULL,"提示","备份失败!");
|
||||
}
|
||||
}
|
||||
|
||||
//剪切井次
|
||||
void QtProjectWidgets::onCutSlf()
|
||||
{
|
||||
m_mapCopyObject.clear();
|
||||
m_strCutSlfName = m_strSlfName;
|
||||
foreach(QTreeWidgetItem *pItem, ui->treeWidget->selectedItems())
|
||||
{
|
||||
QTreeWidgetItem *parentItem = pItem;
|
||||
if (parentItem && m_strSlfName == parentItem->data(0, Qt::UserRole+1).toString())
|
||||
{
|
||||
m_strCutWellname = parentItem->parent()->text(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//编辑测井信息
|
||||
void QtProjectWidgets::onWelllogInformation()
|
||||
{
|
||||
|
|
@ -1185,16 +1281,51 @@ void QtProjectWidgets::onDeleteObject()
|
|||
logio->DeleteObject(m_strCurveObjectName.toLocal8Bit().data());
|
||||
logio->Close();
|
||||
|
||||
foreach(QTreeWidgetItem *pItem, ui->treeWidget->selectedItems())
|
||||
QString strProjectFolder = GetProjectFolder();
|
||||
QString strProjectFile = strProjectFolder + g_prjname;
|
||||
strProjectFile += ".wwl";
|
||||
s_OpenProject(strProjectFile);
|
||||
|
||||
int topCount = ui->treeWidget->topLevelItemCount(); // 获取顶级节点数量
|
||||
if(topCount<1)
|
||||
{
|
||||
QTreeWidgetItem *parentItem = pItem->parent()->parent(); // 上两层目录是井次
|
||||
RefreshWellRoundTree(parentItem);
|
||||
break;
|
||||
return;
|
||||
}
|
||||
|
||||
QTreeWidgetItem *item = ui->treeWidget->topLevelItem(0);
|
||||
int childCount = item->childCount(); // 获取子节点数量
|
||||
for (int i = 0; i < childCount; ++i)
|
||||
{
|
||||
//井组,数据分析...
|
||||
QTreeWidgetItem *wellGroupItem = item->child(i);
|
||||
QString wellGroupname = wellGroupItem->text(0);
|
||||
if (wellGroupname == "井组")
|
||||
{
|
||||
int wellCount = wellGroupItem->childCount(); // 获取井节点数量
|
||||
for (int j = 0; j < wellCount; ++j)
|
||||
{
|
||||
//井组,数据分析...
|
||||
QTreeWidgetItem *wellItem = wellGroupItem->child(j);
|
||||
QString wellname = wellItem->text(0);
|
||||
|
||||
int slfCount = wellItem->childCount(); // 获取井节点数量
|
||||
// wellItem->sortChildren(0, Qt::SortOrder::AscendingOrder);
|
||||
for (int k = 0; k < slfCount; ++k)
|
||||
{
|
||||
if (m_strSlfName == wellItem->child(k)->data(0, Qt::UserRole+1).toString())
|
||||
{
|
||||
wellItem->setExpanded(true);
|
||||
expandAll(wellItem->child(k));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void QtProjectWidgets::onCopySelObject() // 复制
|
||||
{
|
||||
m_strCutWellname = "";
|
||||
m_mapCopyObject.clear();
|
||||
foreach(QTreeWidgetItem *pItem, ui->treeWidget->selectedItems())
|
||||
{
|
||||
|
|
@ -1215,7 +1346,6 @@ void QtProjectWidgets::onCopySelObject() // 复制
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void QtProjectWidgets::onPasteSelObject() // 粘贴
|
||||
|
|
@ -1361,6 +1491,81 @@ void QtProjectWidgets::onPasteSelObject() // 粘贴
|
|||
}
|
||||
}
|
||||
|
||||
// 粘贴井次
|
||||
void QtProjectWidgets::onPasteWell()
|
||||
{
|
||||
QString strNewName=m_strWellname;
|
||||
QString name="您确信移动到"+strNewName+"井下吗?\n如果移动,该井数据将被移入(当前井下数据也被备份于Logdata/Temp下)。";
|
||||
int flag = QMessageBox::warning(NULL,"提示",name,QMessageBox::Yes,QMessageBox::No);
|
||||
if(flag==QMessageBox::Yes)
|
||||
{
|
||||
QString wellfile=m_strCutSlfName;
|
||||
QString newfilename;
|
||||
int index=wellfile.lastIndexOf("#");
|
||||
int index1=wellfile.lastIndexOf("\\");
|
||||
int index2=wellfile.lastIndexOf("/");
|
||||
if(index2>index1) index1=index2;
|
||||
QString olddir=wellfile.left(index1);
|
||||
QString newdir=wellfile.mid(index,index1-index);
|
||||
newfilename=wellfile;
|
||||
newfilename.replace(newdir,"#"+strNewName);
|
||||
|
||||
QFileInfo check_file(newfilename);
|
||||
if (check_file.exists() && check_file.isFile()) {
|
||||
QString strMessage="已存在井次文件"+newfilename+"确定要覆盖么?";
|
||||
int flag1 =QMessageBox::warning(NULL,"提示",strMessage,QMessageBox::Yes,QMessageBox::No);
|
||||
if(flag!=QMessageBox::Yes)
|
||||
return;
|
||||
|
||||
QFile::remove(newfilename);
|
||||
}
|
||||
|
||||
QDir ss;
|
||||
if(ss.rename(wellfile,newfilename))
|
||||
{
|
||||
SetWellRoundWellName(newfilename,strNewName);
|
||||
}
|
||||
}
|
||||
|
||||
QString strProjectFolder = GetProjectFolder();
|
||||
QString strProjectFile = strProjectFolder + g_prjname;
|
||||
strProjectFile += ".wwl";
|
||||
s_OpenProject(strProjectFile);
|
||||
|
||||
int topCount = ui->treeWidget->topLevelItemCount(); // 获取顶级节点数量
|
||||
if(topCount<1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
QTreeWidgetItem *item = ui->treeWidget->topLevelItem(0);
|
||||
int childCount = item->childCount(); // 获取子节点数量
|
||||
for (int i = 0; i < childCount; ++i)
|
||||
{
|
||||
//井组,数据分析...
|
||||
QTreeWidgetItem *wellGroupItem = item->child(i);
|
||||
QString wellGroupname = wellGroupItem->text(0);
|
||||
if (wellGroupname == "井组")
|
||||
{
|
||||
int wellCount = wellGroupItem->childCount(); // 获取井节点数量
|
||||
for (int j = 0; j < wellCount; ++j)
|
||||
{
|
||||
//井组,数据分析...
|
||||
QTreeWidgetItem *wellItem = wellGroupItem->child(j);
|
||||
QString wellname = wellItem->text(0);
|
||||
if(wellname==m_strWellname || wellname==m_strCutWellname)//井
|
||||
{
|
||||
wellItem->setExpanded(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_strCutWellname = "";
|
||||
m_strCutSlfName = "";
|
||||
return;
|
||||
}
|
||||
|
||||
//刷新井次树
|
||||
void QtProjectWidgets::RefreshWellRoundTree(QTreeWidgetItem *parentItem)
|
||||
{
|
||||
|
|
@ -1378,13 +1583,17 @@ void QtProjectWidgets::RefreshWellRoundTree(QTreeWidgetItem *parentItem)
|
|||
for (int i = 0; i < WellCount; ++i)
|
||||
{
|
||||
QTreeWidgetItem *childItem = pWellItem->child(i);
|
||||
childItem->setExpanded(true);
|
||||
int childCount = childItem->childCount();
|
||||
for (int j = 0; j < childCount; ++j)
|
||||
if (childItem && m_strSlfName == childItem->data(0, Qt::UserRole+1).toString())
|
||||
{
|
||||
childItem->child(j)->setExpanded(true);
|
||||
childItem->setExpanded(true);
|
||||
int childCount = childItem->childCount();
|
||||
for (int j = 0; j < childCount; ++j)
|
||||
{
|
||||
childItem->child(j)->setExpanded(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
pWellItem->sortChildren(0, Qt::SortOrder::AscendingOrder);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1618,6 +1827,7 @@ void QtProjectWidgets::onItemClicked(QTreeWidgetItem* item, int index)
|
|||
}
|
||||
else if (strTreeTag == "wellname")
|
||||
{
|
||||
m_strWellname = item->text(0);
|
||||
//根节点(项目名称)-右键菜单
|
||||
popMenu = _menuWellName;
|
||||
}
|
||||
|
|
@ -1657,6 +1867,11 @@ void QtProjectWidgets::onItemClicked(QTreeWidgetItem* item, int index)
|
|||
else
|
||||
m_action_Paste->setVisible(true);
|
||||
|
||||
if (m_strWellname==m_strCutWellname || m_strCutWellname.isEmpty())
|
||||
m_action_WellPaste->setVisible(false);
|
||||
else
|
||||
m_action_WellPaste->setVisible(true);
|
||||
|
||||
if (qApp->mouseButtons() == Qt::RightButton) // 只针对鼠标右键,弹出菜单
|
||||
{
|
||||
if (NULL == popMenu)
|
||||
|
|
|
|||
|
|
@ -51,6 +51,8 @@ public slots:
|
|||
//波列
|
||||
void onShowWave(bool checked = false); //波列查看
|
||||
|
||||
void onSlfbackup(); //备份井次
|
||||
void onCutSlf(); //剪切井次
|
||||
void onEditWelllogRound();
|
||||
void onImportSingleWellLogData();
|
||||
void onImportSlfTable();
|
||||
|
|
@ -65,6 +67,7 @@ public slots:
|
|||
void onDeleteObject(); // 删除
|
||||
void onCopySelObject(); // 复制
|
||||
void onPasteSelObject(); // 粘贴
|
||||
void onPasteWell(); // 粘贴井次
|
||||
void RefreshWellRoundTree(QTreeWidgetItem *parentItem); // 刷新井次树
|
||||
//向左侧树图,追加固井结论表格
|
||||
void s_AddGujingToTree(QString strSlfName, QString strWellName, QString strLineName);
|
||||
|
|
@ -89,6 +92,7 @@ public:
|
|||
QMenu *_menuWaveFolder; //波列目录
|
||||
|
||||
QAction* m_action_Paste; //粘贴
|
||||
QAction* m_action_WellPaste; //井次粘贴
|
||||
//根节点(项目名称)-右键菜单
|
||||
QAction* m_action_New;
|
||||
QAction* m_action_Open;
|
||||
|
|
@ -99,9 +103,12 @@ public:
|
|||
QAction* m_action_ShowCurve;
|
||||
QAction* m_action_DepthShift;
|
||||
|
||||
QString m_strWellname;
|
||||
QString m_strSlfName;
|
||||
QString m_strCurveObjectName;
|
||||
|
||||
QString m_strCutWellname;
|
||||
QString m_strCutSlfName;
|
||||
QMap<QString,QList<QString>> m_mapShowObject;// 显示Slf文件里对象名
|
||||
QMap<QString,QList<QString>> m_mapCopyObject;// 复制Slf文件里对象名
|
||||
int m_ReFlag;
|
||||
|
|
@ -110,6 +117,8 @@ public:
|
|||
void loadIndexSysTree(QTreeWidgetItem *parent, QString fileFull, QString prjname);
|
||||
void loadWellTree(QTreeWidgetItem *parent, QString fileFull, QString parentWellname);
|
||||
|
||||
void expandAll(QTreeWidgetItem* item);
|
||||
|
||||
//初始化树形控件中的右键菜单
|
||||
void initMenu();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user