固井结论右键菜单,追加:分割、删除当前对象、设置深度移动量功能,并支持实时更新到slf文件。

This commit is contained in:
jiayulong 2026-02-27 16:35:03 +08:00
parent 2e478d3acb
commit 2ecd79660f
11 changed files with 292 additions and 20 deletions

View File

@ -191,6 +191,9 @@ signals:
//编辑曲线,框选拉伸/压缩
void sig_EShiftDepth(QString strSlfName, QString strLineName, int count, QList<double> left_Low_List, QList<double> right_Hight_List);
//向左侧树图,追加固井结论表格
void sig_AddGujingToTree(QString strSlfName, QString strWellName, QString strLineName);
//
//void sig_addImageToPlot(QMyCustomPlot* customPlot, double left_Low, double right_Hight, QString imagePath);

View File

@ -233,6 +233,8 @@ void PropertyWidget::SlotPropertyChanged( QtProperty *pProperty, const QVariant
{
double upper = variant.value<double>();
m_tdGujing->setUpper(-upper);
//保存
m_tdGujing->mPlot->SaveToSLF_Gujing();
}
}
else if("底深(m)" == m_propertyData[pProperty])
@ -242,6 +244,8 @@ void PropertyWidget::SlotPropertyChanged( QtProperty *pProperty, const QVariant
{
double lower = variant.value<double>();
m_tdGujing->setLower(-lower);
//保存
m_tdGujing->mPlot->SaveToSLF_Gujing();
}
}
else if("固井结论" == m_propertyData[pProperty])
@ -254,6 +258,8 @@ void PropertyWidget::SlotPropertyChanged( QtProperty *pProperty, const QVariant
//
QCPRange currentRange = m_tdGujing->getRange();
m_tdGujing->setRange(currentRange.lower, currentRange.upper);
//保存
m_tdGujing->mPlot->SaveToSLF_Gujing();
}
}
}

View File

@ -306,11 +306,84 @@ void TransparentDraggableGujing::updateHandles()
}
//分割
void TransparentDraggableGujing::onSplitRect()
{
QCPRange currentRange = getRange();
//分割后显示上半部分
setRange((currentRange.lower+currentRange.upper)/2.0, currentRange.upper);
//添加下半部分
mPlot->addGujingToPlot(currentRange.lower, (currentRange.lower+currentRange.upper)/2.0, m_Result);
double low = mRect->topLeft->coords().x();
double hight = mRect->bottomRight->coords().x();
PropertyService()->initGujingItemProperty(this, low, hight, m_Result);
//保存
mPlot->SaveToSLF_Gujing();
//取消所有选中单元格
emit CallManage::getInstance()->sig_Raise(mPlot->m_strUuid, "", "", "", "", 1, "");
}
//删除
void TransparentDraggableGujing::onDelRect()
{
//mDragMode = DragNone;
//删除框图
deleteRect();
//保存
mPlot->SaveToSLF_Gujing();
}
//全部清空
void TransparentDraggableGujing::onDelAll()
{
if(QMessageBox::information(NULL,QObject::tr("提示"),QObject::tr("该功能将清除当前组件展示的全部信息,清除后无法恢复,但会备份到对应的\"_BAK\"中,确定清除吗?"),QMessageBox::Yes|QMessageBox::No)!=QMessageBox::Yes) return;
QString obj=mPlot->m_strLineName + "BAK";
}
//设置深度移动量
void TransparentDraggableGujing::setItemDepthOffset()
{
bool ok=0;
double depthshift=QInputDialog::getDouble(NULL,"深度移动","请输入移动的深度量(上移-,下移+)",0.0,-2147483647, 2147483647,4,&ok);
if(!ok) return;
QCPRange currentRange = getRange();
QCPRange newRange = currentRange;
newRange.lower = currentRange.lower-depthshift;
newRange.upper = currentRange.upper-depthshift;
//
double width = currentRange.size();
// //double center = mDragStartRange.center() + dx;
// double center = currentRange.center() - depthshift;
// newRange.lower = center - width/2;
// newRange.upper = center + width/2;
// 检查是否超出轴范围
if(newRange.lower < getMyLower()) {
return;
}
else if(newRange.upper > getMyUpper()) {
return;
}
//
setRange(newRange.lower, newRange.upper);
{
double low = mRect->topLeft->coords().x();
double hight = mRect->bottomRight->coords().x();
PropertyService()->initGujingItemProperty(this, low, hight, m_Result);
//保存
mPlot->SaveToSLF_Gujing();
//取消所有选中单元格
emit CallManage::getInstance()->sig_Raise(mPlot->m_strUuid, "", "", "", "", 1, "");
}
}
//设置顶深
@ -379,8 +452,15 @@ void TransparentDraggableGujing::onMousePress(QMouseEvent *event)
//event->accept();
double low = mRect->topLeft->coords().x();
double hight = mRect->bottomRight->coords().x();
PropertyService()->initGujingItemProperty(this, low, hight, m_Result);
QMenu menu(nullptr);
menu.addAction(QIcon(::GetImagePath() + "icon/Split.png"), "分割", this, &TransparentDraggableGujing::onSplitRect);
menu.addAction(QIcon(::GetImagePath() + "icon/Delete.png"), "删除选中对象", this, &TransparentDraggableGujing::onDelRect);
menu.addAction(QIcon(::GetImagePath() + "icon/Shift.png"), "设置深度移动量", this, &TransparentDraggableGujing::setItemDepthOffset);
menu.addAction(QIcon(::GetImagePath() + "icon/Delete.png"), "全部清空", this, &TransparentDraggableGujing::onDelAll);
menu.exec(event->globalPos());
return;
@ -525,6 +605,9 @@ void TransparentDraggableGujing::onMouseRelease(QMouseEvent *event)
double low = mRect->topLeft->coords().x();
double hight = mRect->bottomRight->coords().x();
PropertyService()->initGujingItemProperty(this, low, hight, m_Result);
//保存
mPlot->SaveToSLF_Gujing();
//取消所有选中单元格
emit CallManage::getInstance()->sig_Raise(mPlot->m_strUuid, "", "", "", "", 1, "");
}

View File

@ -58,14 +58,17 @@ private:
void updateHandles() ;
private slots:
void onDelRect();
void onSplitRect(); //分割
void onDelRect(); //删除
void onDelAll(); //全部清空
void setItemDepthOffset(); //设置深度移动量
void onMousePress(QMouseEvent *event);
void onMouseMove(QMouseEvent *event);
void onMouseRelease(QMouseEvent *event);
double getMyLower();
double getMyUpper();
private:
public:
QMyCustomPlot *mPlot;
QCPItemRect *mRect;
QCPItemRect *mLeftHandle;

View File

@ -4059,9 +4059,9 @@ bool FormDraw::LoadFromSLF_Gujing(QMyCustomPlot *widget, QString strSlfName, QSt
file.close();
}
QMap<QString,QString> zoneOrder;
//QMap<QString,QString> zoneOrder;
for(int i=0;i<lines.size();i++){
zoneOrder.insert(lines[i],QString::number(i));
widget->zoneOrder_Gujing.insert(lines[i],QString::number(i));
}
int iIndex=logio->OpenTable(strLineName.toStdString().c_str());
@ -4083,7 +4083,7 @@ bool FormDraw::LoadFromSLF_Gujing(QMyCustomPlot *widget, QString strSlfName, QSt
QString result = "";
//
QString iconshotname=zoneOrder.key(QString::number(m_Result->RESULT));
QString iconshotname=widget->zoneOrder_Gujing.key(QString::number(m_Result->RESULT));
if(iconshotname!="")
result=::GetGujingSymbolDir()+iconshotname+".svg";
int len=2;

View File

@ -336,21 +336,21 @@ void MainWindow::s_Open()
void MainWindow::s_SaveProject()
{
//加载插件显示
QWidget * pMyWidget = CallPlugin::getInstance()->getPluginWidget(PLUGINUNIT, (QWidget *)this);
if (pMyWidget != nullptr)
{
//
m_centerWidgets->addTab(pMyWidget, "插件视图");
}
// //加载插件显示
// QWidget * pMyWidget = CallPlugin::getInstance()->getPluginWidget(PLUGINUNIT, (QWidget *)this);
// if (pMyWidget != nullptr)
// {
// //
// m_centerWidgets->addTab(pMyWidget, "插件视图");
// }
//设置参数
QString strParams = "hello";
CallPlugin::getInstance()->setPluginParams(PLUGINUNIT, strParams);
// //设置参数
// QString strParams = "hello";
// CallPlugin::getInstance()->setPluginParams(PLUGINUNIT, strParams);
//获取参数
QString strParams2 = CallPlugin::getInstance()->getPluginParams(PLUGINUNIT);
qDebug() << "getPluginParams: " << strParams2;
// //获取参数
// QString strParams2 = CallPlugin::getInstance()->getPluginParams(PLUGINUNIT);
// qDebug() << "getPluginParams: " << strParams2;
// //加载插件显示
// QWidget * pMyWidget = CallPlugin::getInstance()->getPluginWidget(MYUNITPLUGIN, NULL);

View File

@ -18,6 +18,7 @@
#include "transparentdraggableRightList.h"
#include "qtcommonclass.h"
#include "slf.h"
#include "MemRdWt.h"
//是否隐藏刻度
extern int g_iShow;
@ -881,7 +882,7 @@ void QMyCustomPlot::contextMenuEvent(QContextMenuEvent *event)
{
QMenu menu(this);
//固井
menu.addAction(QIcon(::GetImagePath() + "curve.png"), "添加固井结论", this, &QMyCustomPlot::onEditGujing);
menu.addAction(QIcon(::GetImagePath() + "curve.png"), "开始编辑固井结论", this, &QMyCustomPlot::onEditGujing);
menu.exec(event->globalPos());
}
@ -1043,10 +1044,41 @@ void QMyCustomPlot::onEditGujing()
double right_Hight = this->xAxis->pixelToCoord(top);
double left_Low = this->xAxis->pixelToCoord(bottom);
//追加判断,避免框选重叠
TransparentDraggableGujing *pDraggableRect =NULL;
{
QMap<QString,QObject *>::Iterator it = m_mapDraggable_Gujing.begin();
while( it != m_mapDraggable_Gujing.end() )
{
pDraggableRect = (TransparentDraggableGujing*)it.value();
//
QCPRange tmpRange = pDraggableRect->getRange();
if(tmpRange.lower >= left_Low && tmpRange.upper <= right_Hight)
{
return;
}
if(tmpRange.upper >= left_Low && tmpRange.upper <= right_Hight)
{
return;
}
if(tmpRange.lower >= left_Low && tmpRange.lower <= right_Hight)
{
return;
}
it++;
}
}
{
//添加固井结论
this->addGujingToPlot(left_Low, right_Hight, ::GetGujingSymbolDir());//left_Low, right_Hight
//保存
this->SaveToSLF_Gujing();
//取消框选
this->setInteractions(QCP::iSelectLegend | QCP::iSelectPlottables);
this->setSelectionRectMode(QCP::srmNone);
@ -1056,6 +1088,90 @@ void QMyCustomPlot::onEditGujing()
}
}
bool QMyCustomPlot::SaveToSLF_Gujing()
{
static int isrun=false;
if(isrun) return false;
QString ss=m_strSlfName;
if(ss=="") return false;
isrun=true;
GUJING_DATA m_Result;
CMemRdWt *logio=new CMemRdWt();
if(ss==""||!logio->Open(ss.toStdString().c_str(),CSlfIO::modeReadWrite))
{
delete logio;
QMessageBox::information(NULL,"提示","SLF文件打开失败请检查",QMessageBox::Yes);
isrun=false;
return false;
}
int iIndex=logio->OpenTable(m_strLineName.toStdString().c_str());
bool isfirst=false;
if (iIndex < 0)
{
if(!m_mapDraggable_Gujing.size()) {
delete logio;
isrun=false;
return false;
}
iIndex=logio->Open_Set_Table(m_strLineName.toStdString().c_str(),GUJING_OBJECT,4,
"NO,SDEP,EDEP,RESULT",
"4,4,4,4",//字段长度
"1,4,4,1",//字段类型
"0,0,0,2");//字段备注
isfirst=true;
}
logio->SetTableRecordCount(iIndex,m_mapDraggable_Gujing.size());
int j=0;
if(!m_mapDraggable_Gujing.size()) {
delete logio;
if(isfirst)AddTableToWellRound();
isrun=false;
return false;
}
TransparentDraggableGujing *pDraggableRect =NULL;
for (QMap<QString,QObject *>::Iterator iter = m_mapDraggable_Gujing.begin(); iter != m_mapDraggable_Gujing.end(); iter++,j++)
{
pDraggableRect = (TransparentDraggableGujing*)iter.value();
//
QCPRange tmpRange = pDraggableRect->getRange();
memset(&m_Result,0,sizeof(GUJING_DATA));
m_Result.SDEP = -tmpRange.upper;
m_Result.EDEP = -tmpRange.lower;
m_Result.NO=j+1;
m_Result.RESULT=0;
QString innerresult=GetIntResult_Gujing(pDraggableRect->m_Result);
if(innerresult!="")
m_Result.RESULT=innerresult.toInt();
if(m_Result.RESULT<0) m_Result.RESULT=0;
logio->WriteTable(iIndex,j+1,&m_Result);
}
logio->CloseTable(iIndex);
delete logio;
if(isfirst)AddTableToWellRound();
isrun=false;
return true;
}
QString QMyCustomPlot::GetIntResult_Gujing(QString result)
{
if(result=="") return "";
QFileInfo afile(result);
QString strBaseName = afile.completeBaseName();
return zoneOrder_Gujing.value(strBaseName);
}
//向左侧树图,追加固井结论表格
void QMyCustomPlot::AddTableToWellRound()
{
emit CallManage::getInstance()->sig_AddGujingToTree(m_strSlfName, m_strWellName, m_strLineName);
}
void QMyCustomPlot::onAddRect()
{
double right_Hight = xAxis->pixelToCoord(m_event->pos().y());//x轴展示深度
@ -1675,6 +1791,7 @@ void QMyCustomPlot::addGujingToPlot(double left_Low, double right_Hight, const Q
//dragRect->setTitle(strText);
m_mapDraggable_Gujing[strUuid] = dragRect;
}
//气测/FMT/射孔/文本

View File

@ -137,6 +137,12 @@ public:
QObject* m_SelectShiftLine=nullptr;//当前选中的分段线
QObject* m_SelectRect=nullptr;//当前选中的曲线编辑框
//固井
QMap<QString,QString> zoneOrder_Gujing;
bool SaveToSLF_Gujing();
QString GetIntResult_Gujing(QString result);
void AddTableToWellRound();//将固井结论表,添加到左侧树图
public slots:
void slot_time();

View File

@ -51,6 +51,8 @@ QtProjectWidgets::QtProjectWidgets(QWidget *parent)
connect(CallManage::getInstance(), SIGNAL(sig_NewProject()), this, SLOT(s_NewProject()));
//关联信号槽,打开评估工程
connect(CallManage::getInstance(), SIGNAL(sig_OpenProject(QString)), this, SLOT(s_OpenProject(QString)));
//向左侧树图,追加固井结论表格
connect(CallManage::getInstance(), SIGNAL(sig_AddGujingToTree(QString,QString,QString)), this, SLOT(s_AddGujingToTree(QString,QString,QString)));
//初始化树形控件中的右键菜单
initMenu();
@ -1272,3 +1274,45 @@ void QtProjectWidgets::onItemChanged(QTreeWidgetItem* item, int index)
// emit CallManage::getInstance()->sig_testPlugin(m_strCurveObjectName);
// }
}
//向左侧树图,追加固井结论表格
void QtProjectWidgets::s_AddGujingToTree(QString strSlfName, QString strWellName, QString strLineName)
{
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)//井
{
// 获取井次节点数量
int wellLogCount = wellItem->childCount();
for (int k = 0; k < wellLogCount; ++k)
{
QTreeWidgetItem *wellLogItem = wellItem->child(k);
wellItem->removeChild(wellLogItem);
}
//井重新加载井次信息
loadWellTree(wellItem, strSlfName, strWellName);
wellItem->setExpanded(true);
}
}
}
}
}

View File

@ -56,7 +56,11 @@ public slots:
void onWelllogInformation(); //编辑测井信息
void onDepthShift_Well(bool checked = false); //深度移动
//表格数据 根节点
void onCreateNewTable(); //创建新表
void onCreateNewTable(); //创建新表
//向左侧树图,追加固井结论表格
void s_AddGujingToTree(QString strSlfName, QString strWellName, QString strLineName);
public:
//初始化树图控件
//void initTreeWidget(QString fullPath, QString strProjectName);
@ -111,6 +115,7 @@ public:
void initSlfNameTreeMenu(QMenu *menu, QTreeWidget *treeWidget);
//初始化根节点(表目录)-右键菜单
void initTableFolderTreeMenu(QMenu *menu, QTreeWidget *treeWidget);
private:
};

View File

@ -23,4 +23,9 @@ https://www.cnblogs.com/ys0103/p/4562493.html
20.logPlus
powershell统计代码行数
Get-ChildItem -Recurse -Include *.h | Get-Content | Measure-Object -Line
Get-ChildItem -Recurse -Include *.cpp | Get-Content | Measure-Object -Line
Get-ChildItem -Recurse -Include *.ui | Get-Content | Measure-Object -Line