支持双击编辑固井、地质层位道、曲线、录井剖面、岩性描述文字结论

This commit is contained in:
jiayulong 2026-05-18 18:20:31 +08:00
parent bb3b9a971b
commit d9054d26e6
10 changed files with 298 additions and 36 deletions

View File

@ -830,6 +830,10 @@ int TransparentDraggableGeoLith::getCursor()
{
return 1;
}
if(m_bNormal)
{
return 3;
}
return 0;
}
@ -847,6 +851,16 @@ void TransparentDraggableGeoLith::onMouseMove(QMouseEvent *event)
}
else
{
double y = mPlot->xAxis->pixelToCoord(event->pos().y());//x轴展示深度
QCPRange currentRange = getRange();
if(y >= currentRange.lower && y <= currentRange.upper) {
m_bNormal = true;
}
else
{
m_bNormal = false;
}
//
m_bArrow = false;
m_bMoveRect = false;
}

View File

@ -111,6 +111,7 @@ public:
//鼠标形状
bool m_bArrow = false;
bool m_bMoveRect = false;
bool m_bNormal = false;
int getCursor();
//鼠标是否拖动item
bool m_bChange = false;

View File

@ -513,6 +513,10 @@ int TransparentDraggableGujing::getCursor()
{
return 1;
}
if(m_bNormal)
{
return 3;
}
return 0;
}
@ -530,6 +534,16 @@ void TransparentDraggableGujing::onMouseMove(QMouseEvent *event)
}
else
{
double y = mPlot->xAxis->pixelToCoord(event->pos().y());//x轴展示深度
QCPRange currentRange = getRange();
if(y >= currentRange.lower && y <= currentRange.upper) {
m_bNormal = true;
}
else
{
m_bNormal = false;
}
//
m_bArrow = false;
m_bMoveRect = false;
}

View File

@ -91,6 +91,7 @@ public:
//鼠标形状
bool m_bArrow = false;
bool m_bMoveRect = false;
bool m_bNormal = false;
int getCursor();
//鼠标是否拖动item
bool m_bChange = false;

View File

@ -445,6 +445,10 @@ int TransparentDraggableLayer::getCursor()
{
return 1;
}
if(m_bNormal)
{
return 3;
}
return 0;
}
@ -462,6 +466,16 @@ void TransparentDraggableLayer::onMouseMove(QMouseEvent *event)
}
else
{
double y = mPlot->xAxis->pixelToCoord(event->pos().y());//x轴展示深度
QCPRange currentRange = getRange();
if(y >= currentRange.lower && y <= currentRange.upper) {
m_bNormal = true;
}
else
{
m_bNormal = false;
}
//
m_bArrow = false;
m_bMoveRect = false;
}

View File

@ -104,6 +104,7 @@ public:
//鼠标形状
bool m_bArrow = false;
bool m_bMoveRect = false;
bool m_bNormal = false;
int getCursor();
//鼠标是否拖动item
bool m_bChange = false;

View File

@ -333,6 +333,10 @@ int TransparentDraggableRect::getCursor()
{
return 1;
}
if(m_bNormal)
{
return 3;
}
return 0;
}
@ -350,6 +354,16 @@ void TransparentDraggableRect::onMouseMove(QMouseEvent *event)
}
else
{
double y = mPlot->xAxis->pixelToCoord(event->pos().y());//x轴展示深度
QCPRange currentRange = getRange();
if(y >= currentRange.lower && y <= currentRange.upper) {
m_bNormal = true;
}
else
{
m_bNormal = false;
}
//
m_bArrow = false;
m_bMoveRect = false;
}

View File

@ -96,6 +96,7 @@ public:
//鼠标形状
bool m_bArrow = false;
bool m_bMoveRect = false;
bool m_bNormal = false;
int getCursor();
//鼠标是否拖动item
bool m_bChange = false;

View File

@ -1311,6 +1311,44 @@ void QMyCustomPlot::mouseDoubleClickEvent(QMouseEvent *event)
// 在这里添加你的双击处理逻辑
m_bEditor = true;
//曲线
if(m_addRandomGraph && m_strLineName != "CORE_PHYSICS")
{
//双击编辑曲线
onEditLine();
}
else if (m_strLineName == "GEO_LITH")
{
//录井剖面
onEditGeoLith();
}
else if (m_strLineName == "WORDS_RELUST")
{
//岩性描述,文字结论
onEditText();
}
else if (m_strLineName == "LAYER_DATA")
{
//地质分层
onEditLayer();
}
//------------
if(m_strType == "")
{
FormInfo* pInfo = m_formTrack->getFormInfoByParameters(m_strUuid, m_strWellName, m_strTrackName, m_strLineName);
if (pInfo == NULL)
{
return;
}
m_strType = pInfo->m_strType;
}
if (m_strType == "gujingObject")
{
//双击编辑固井
onEditGujing();
}
// 接受事件
event->accept();
}
@ -1450,7 +1488,7 @@ void QMyCustomPlot::mouseMoveEvent(QMouseEvent *event)
QCustomPlot::mouseMoveEvent(event);
int nmaxCursor = 0;
int nmaxCursor = -1;
//解释结论
QObjectList objList = m_mapDragGroup.values();
for( int i = 0; i< objList.size(); i++)
@ -1577,7 +1615,7 @@ void QMyCustomPlot::mouseMoveEvent(QMouseEvent *event)
{
this->setCursor(Qt::SizeVerCursor);
}
else
else if (nmaxCursor == 3)
{
QCursor currentCursor = this->cursor();
if(currentCursor == Qt::CrossCursor)
@ -1588,6 +1626,63 @@ void QMyCustomPlot::mouseMoveEvent(QMouseEvent *event)
this->setCursor(Qt::ArrowCursor);
}
}
else
{
bool bCheck = false;
//曲线
/*if(m_addRandomGraph && m_strLineName != "CORE_PHYSICS")
{
bCheck = true;
}
else */if (m_strLineName == "GEO_LITH")
{
//录井剖面
bCheck = true;
}
else if (m_strLineName == "WORDS_RELUST")
{
//岩性描述,文字结论
bCheck = true;
}
else if (m_strLineName == "LAYER_DATA")
{
//地质分层
bCheck = true;
}
//
if(m_strType == "")
{
FormInfo* pInfo = m_formTrack->getFormInfoByParameters(m_strUuid, m_strWellName, m_strTrackName, m_strLineName);
if (pInfo == NULL)
{
return;
}
m_strType = pInfo->m_strType;
}
//
if (m_strType == "gujingObject")
{
bCheck = true;
}
if(bCheck)
{
//十字标,编辑
if(m_bEditRect)
{
this->setCursor(Qt::CrossCursor);
}
else
{
this->setCursor(Qt::ArrowCursor);
}
}
else
{
this->setCursor(Qt::ArrowCursor);
}
}
// if (mMousePress) {
// auto items = selectedItems();
@ -1792,6 +1887,7 @@ void QMyCustomPlot::s_LineClicked(int index)
// }
}
//右键
void QMyCustomPlot::contextMenuEvent(QContextMenuEvent *event)
{
m_event = event;
@ -1802,7 +1898,13 @@ void QMyCustomPlot::contextMenuEvent(QContextMenuEvent *event)
menu.addAction(QIcon(::GetImagePath() + "icon/ZonePoint.png"), "添加分段线", this, &QMyCustomPlot::onAddShiftLine);
menu.addAction(QIcon(::GetImagePath() + "icon/ClearZonePoint.png"), "清除当前分段线", this, &QMyCustomPlot::onDelSelectShiftLine);
menu.addAction(QIcon(::GetImagePath() + "icon/ClearZone.png"), "清除全部分段线", this, &QMyCustomPlot::onDelAllShiftLine);
if(m_bEditRect)
{
menu.addAction(QIcon(::GetImagePath() + "curve.png"), "关闭编辑曲线", this, &QMyCustomPlot::onCloseEditLine);
}
else{
menu.addAction(QIcon(::GetImagePath() + "curve.png"), "开始编辑曲线", this, &QMyCustomPlot::onEditLine);
}
menu.exec(event->globalPos());
}
@ -1822,7 +1924,13 @@ void QMyCustomPlot::contextMenuEvent(QContextMenuEvent *event)
{
QMenu menu(this);
//录井剖面
if(m_bEditRect)
{
menu.addAction(QIcon(::GetImagePath() + "curve.png"), "关闭编辑录井剖面", this, &QMyCustomPlot::onCloseEditGeoLith);
}
else{
menu.addAction(QIcon(::GetImagePath() + "curve.png"), "开始编辑录井剖面", this, &QMyCustomPlot::onEditGeoLith);
}
menu.addAction(QIcon(::GetImagePath() + "icon/CopyCoreTxt.png"), "从剪切板文本数据粘贴", this, &QMyCustomPlot::addItems_GeoLith);
menu.addAction(QIcon(::GetImagePath() + "icon/ClearSelectCore.png"), "取消选中", this, &QMyCustomPlot::ClearSelectItems);
menu.addAction(QIcon(::GetImagePath() + "icon/Delete.png"), "全部清空", this, &QMyCustomPlot::DeleteItems_GeoLith);
@ -1833,7 +1941,13 @@ void QMyCustomPlot::contextMenuEvent(QContextMenuEvent *event)
{
QMenu menu(this);
//岩性描述,文字结论
if(m_bEditRect)
{
menu.addAction(QIcon(::GetImagePath() + "curve.png"), "关闭编辑文字结论", this, &QMyCustomPlot::onCloseEditText);
}
else{
menu.addAction(QIcon(::GetImagePath() + "curve.png"), "开始编辑文字结论", this, &QMyCustomPlot::onEditText);
}
menu.addAction(QIcon(::GetImagePath() + "icon/CopyCoreTxt.png"), "从剪切板文本数据粘贴", this, &QMyCustomPlot::addItems_Text);
menu.addAction(QIcon(::GetImagePath() + "icon/ClearSelectCore.png"), "取消选中", this, &QMyCustomPlot::ClearSelectItems);
menu.addAction(QIcon(::GetImagePath() + "icon/Delete.png"), "全部清空", this, &QMyCustomPlot::DeleteItems_Text);
@ -1844,7 +1958,13 @@ void QMyCustomPlot::contextMenuEvent(QContextMenuEvent *event)
{
QMenu menu(this);
//地质分层
if(m_bEditRect)
{
menu.addAction(QIcon(::GetImagePath() + "curve.png"), "关闭编辑地质分层", this, &QMyCustomPlot::onCloseEditLayer);
}
else{
menu.addAction(QIcon(::GetImagePath() + "curve.png"), "开始编辑地质分层", this, &QMyCustomPlot::onEditLayer);
}
menu.addAction(QIcon(::GetImagePath() + "icon/CopyCoreTxt.png"), "从剪切板文本数据粘贴", this, &QMyCustomPlot::addItems_Layer);
menu.addAction(QIcon(::GetImagePath() + "icon/ClearSelectCore.png"), "取消选中", this, &QMyCustomPlot::ClearSelectItems);
menu.addAction(QIcon(::GetImagePath() + "icon/Delete.png"), "全部清空", this, &QMyCustomPlot::DeleteItems_Layer);
@ -1915,13 +2035,16 @@ void QMyCustomPlot::contextMenuEvent(QContextMenuEvent *event)
}
//
if(m_strType == "")
{
FormInfo* pInfo = m_formTrack->getFormInfoByParameters(m_strUuid, m_strWellName, m_strTrackName, m_strLineName);
if (pInfo == NULL)
{
return;
}
QString strType = pInfo->m_strType;
if (strType == "JiegutextObject")
m_strType = pInfo->m_strType;
}
if (m_strType == "JiegutextObject")
{
QMenu menu(this);
//气测/FMT/射孔/文本
@ -1931,11 +2054,17 @@ void QMyCustomPlot::contextMenuEvent(QContextMenuEvent *event)
menu.addAction(QIcon(::GetImagePath() + "icon/CopyCoreTxt.png"), "刷新数据", this, &QMyCustomPlot::RefreshItems_Jiegutext);
menu.exec(event->globalPos());
}
else if (strType == "gujingObject")
else if (m_strType == "gujingObject")
{
QMenu menu(this);
//固井
if(m_bEditRect)
{
menu.addAction(QIcon(::GetImagePath() + "curve.png"), "关闭编辑固井结论", this, &QMyCustomPlot::onCloseEditGujing);
}
else{
menu.addAction(QIcon(::GetImagePath() + "curve.png"), "开始编辑固井结论", this, &QMyCustomPlot::onEditGujing);
}
menu.addAction(QIcon(::GetImagePath() + "icon/CopyCoreTxt.png"), "从剪切板文本数据粘贴", this, &QMyCustomPlot::addItems_Gujing);
menu.addAction(QIcon(::GetImagePath() + "icon/ClearSelectCore.png"), "取消选中", this, &QMyCustomPlot::ClearSelectItems);
menu.addAction(QIcon(::GetImagePath() + "icon/Delete.png"), "全部清空", this, &QMyCustomPlot::DeleteItems_Gujing);
@ -1943,7 +2072,7 @@ void QMyCustomPlot::contextMenuEvent(QContextMenuEvent *event)
menu.addAction(QIcon(::GetImagePath() + "development.png"), "合并结论", this, &QMyCustomPlot::MegResult_Gujing);
menu.exec(event->globalPos());
}
else if (strType == "LogfaceObject")
else if (m_strType == "LogfaceObject")
{
QMenu menu(this);
//沉积相
@ -1951,7 +2080,7 @@ void QMyCustomPlot::contextMenuEvent(QContextMenuEvent *event)
//menu.addAction(QIcon(::GetImagePath() + "icon/Layer.png"), "沉积相自动描述", this, &QMyCustomPlot::ChangeDep);
menu.exec(event->globalPos());
}
else if (strType == "TubingstringObject")
else if (m_strType == "TubingstringObject")
{
QStringList strs=zoneOrder_Tubing.keys();
QStringList mstrs=QString("油管接箍,套管接箍,偏配,封隔器,筛管,喇叭口,水力猫,短接,管底部,油管深").split(",");
@ -1976,7 +2105,7 @@ void QMyCustomPlot::contextMenuEvent(QContextMenuEvent *event)
menu.exec(event->globalPos());
}
else if (strType == "CrackObject") // 裂缝
else if (m_strType == "CrackObject") // 裂缝
{
QMenu menu(this);
menu.addAction(QIcon(::GetImagePath() + "curve.png"), "添加裂缝", this, &QMyCustomPlot::addCrackObject);
@ -2019,6 +2148,9 @@ void QMyCustomPlot::onEditLine()
}
this->setInteractions(QCP::iSelectAxes | QCP::iSelectLegend | QCP::iSelectPlottables | QCP::iMultiSelect); // 轴、图例、图表可以被选择,并且是多选的方式
this->setSelectionRectMode(QCP::srmCustom); // 鼠标框选
//this->setCursor(Qt::CrossCursor);
m_bEditRect=true;//当前是否正在编辑曲线。
if(m_bFirstTimeConnect)
{
@ -2039,7 +2171,6 @@ void QMyCustomPlot::onEditLine()
}
// 当选择完成时,获取矩形范围并放大
QRectF rect = this->selectionRect()->rect(); // 获取选择的矩形区域(像素坐标)
m_bEditRect=true;//当前是否正在编辑曲线。
// 转换为坐标轴范围
double top = rect.top();
@ -2073,7 +2204,7 @@ void QMyCustomPlot::onEditLine()
}
}
if(abs(right_Hight-left_Low) >= (3*rlev) )//至少选中5个点
if(abs(right_Hight-left_Low) >= (3*rlev) && abs(right_Hight_Number-left_Low_Number)>0)//至少选中5个点
{
// for (int j=right_Hight_Number; j<left_Low_Number-1; j++)
// {
@ -2099,12 +2230,36 @@ void QMyCustomPlot::onEditLine()
}
}
//右键--关闭编辑曲线
void QMyCustomPlot::onCloseEditLine()
{
//删除
TransparentDraggableSelectRect *pDraggableRect =NULL;
{
QMap<QString,QObject *>::Iterator it = this->m_mapDraggable_SelectRect.begin();
if( it != this->m_mapDraggable_SelectRect.end() )
{
pDraggableRect = (TransparentDraggableSelectRect*)it.value();
pDraggableRect->deleteRect();
}
}
replot();
m_bEditRect = false;
//取消框选
this->setInteractions(QCP::iSelectLegend | QCP::iSelectPlottables);
this->setSelectionRectMode(QCP::srmNone);
}
//右键--添加文字结论
void QMyCustomPlot::onEditText()
{
this->setInteractions(QCP::iSelectAxes | QCP::iSelectLegend | QCP::iSelectPlottables | QCP::iMultiSelect); // 轴、图例、图表可以被选择,并且是多选的方式
this->setSelectionRectMode(QCP::srmCustom); // 鼠标框选
this->setCursor(Qt::CrossCursor);
m_bEditRect=true;//当前是否正在编辑曲线。
if(m_bFirstTimeConnect)
{
//信号槽只绑定一次,避免重复绑定
@ -2124,7 +2279,6 @@ void QMyCustomPlot::onEditText()
}
// 当选择完成时,获取矩形范围并放大
QRectF rect = this->selectionRect()->rect(); // 获取选择的矩形区域(像素坐标)
m_bEditRect=true;//当前是否正在编辑曲线。
// 转换为坐标轴范围
double top = rect.top();
@ -2171,20 +2325,30 @@ void QMyCustomPlot::onEditText()
//属性清空
PropertyService()->InitCurrentViewInfo();
//取消框选
this->setInteractions(QCP::iSelectLegend | QCP::iSelectPlottables);
this->setSelectionRectMode(QCP::srmNone);
// //取消框选
// this->setInteractions(QCP::iSelectLegend | QCP::iSelectPlottables);
// this->setSelectionRectMode(QCP::srmNone);
}
});
}
}
//右键--关闭编辑文字结论
void QMyCustomPlot::onCloseEditText()
{
m_bEditRect = false;
//取消框选
this->setInteractions(QCP::iSelectLegend | QCP::iSelectPlottables);
this->setSelectionRectMode(QCP::srmNone);
}
//右键--添加地质分层
void QMyCustomPlot::onEditLayer()
{
this->setInteractions(QCP::iSelectAxes | QCP::iSelectLegend | QCP::iSelectPlottables | QCP::iMultiSelect); // 轴、图例、图表可以被选择,并且是多选的方式
this->setSelectionRectMode(QCP::srmCustom); // 鼠标框选
this->setCursor(Qt::CrossCursor);
m_bEditRect=true;//当前是否正在编辑曲线。
if(m_bFirstTimeConnect)
{
//信号槽只绑定一次,避免重复绑定
@ -2204,7 +2368,6 @@ void QMyCustomPlot::onEditLayer()
}
// 当选择完成时,获取矩形范围并放大
QRectF rect = this->selectionRect()->rect(); // 获取选择的矩形区域(像素坐标)
m_bEditRect=true;//当前是否正在编辑曲线。
// 转换为坐标轴范围
double top = rect.top();
@ -2260,11 +2423,24 @@ void QMyCustomPlot::onEditLayer()
}
}
//右键--关闭编辑地质分层
void QMyCustomPlot::onCloseEditLayer()
{
m_bEditRect=false;
//取消框选
this->setInteractions(QCP::iSelectLegend | QCP::iSelectPlottables);
this->setSelectionRectMode(QCP::srmNone);
}
//右键--添加固井
void QMyCustomPlot::onEditGujing()
{
this->setInteractions(QCP::iSelectAxes | QCP::iSelectLegend | QCP::iSelectPlottables | QCP::iMultiSelect); // 轴、图例、图表可以被选择,并且是多选的方式
this->setSelectionRectMode(QCP::srmCustom); // 鼠标框选
this->setCursor(Qt::CrossCursor);
m_bEditRect=true;//当前是否正在编辑曲线。
if(m_bFirstTimeConnect)
{
@ -2285,7 +2461,6 @@ void QMyCustomPlot::onEditGujing()
}
// 当选择完成时,获取矩形范围并放大
QRectF rect = this->selectionRect()->rect(); // 获取选择的矩形区域(像素坐标)
m_bEditRect=true;//当前是否正在编辑曲线。
// 转换为坐标轴范围
double top = rect.top();
@ -2332,14 +2507,24 @@ void QMyCustomPlot::onEditGujing()
//属性清空
PropertyService()->InitCurrentViewInfo();
//取消框选
this->setInteractions(QCP::iSelectLegend | QCP::iSelectPlottables);
this->setSelectionRectMode(QCP::srmNone);
// //取消框选
// this->setInteractions(QCP::iSelectLegend | QCP::iSelectPlottables);
// this->setSelectionRectMode(QCP::srmNone);
}
});
}
}
//右键--关闭编辑固井
void QMyCustomPlot::onCloseEditGujing()
{
m_bEditRect = false;
//取消框选
this->setInteractions(QCP::iSelectLegend | QCP::iSelectPlottables);
this->setSelectionRectMode(QCP::srmNone);
}
// 岩心图片
void QMyCustomPlot::onEditImage()
{
@ -2829,7 +3014,9 @@ void QMyCustomPlot::onEditGeoLith()
{
this->setInteractions(QCP::iSelectAxes | QCP::iSelectLegend | QCP::iSelectPlottables | QCP::iMultiSelect); // 轴、图例、图表可以被选择,并且是多选的方式
this->setSelectionRectMode(QCP::srmCustom); // 鼠标框选
this->setCursor(Qt::CrossCursor);
m_bEditRect=true;//当前是否正在编辑曲线。
if(m_bFirstTimeConnect)
{
//信号槽只绑定一次,避免重复绑定
@ -2849,7 +3036,6 @@ void QMyCustomPlot::onEditGeoLith()
}
// 当选择完成时,获取矩形范围并放大
QRectF rect = this->selectionRect()->rect(); // 获取选择的矩形区域(像素坐标)
m_bEditRect=true;//当前是否正在编辑曲线。
// 转换为坐标轴范围
double top = rect.top();
@ -2977,14 +3163,24 @@ void QMyCustomPlot::onEditGeoLith()
//属性清空
PropertyService()->InitCurrentViewInfo();
//取消框选
this->setInteractions(QCP::iSelectLegend | QCP::iSelectPlottables);
this->setSelectionRectMode(QCP::srmNone);
// //取消框选
// this->setInteractions(QCP::iSelectLegend | QCP::iSelectPlottables);
// this->setSelectionRectMode(QCP::srmNone);
}
});
}
}
//右键--关闭编辑录井剖面
void QMyCustomPlot::onCloseEditGeoLith()
{
m_bEditRect=false;
//取消框选
this->setInteractions(QCP::iSelectLegend | QCP::iSelectPlottables);
this->setSelectionRectMode(QCP::srmNone);
}
bool QMyCustomPlot::SaveToSLF_SwallCore()
{
static int isrun=false;

View File

@ -559,12 +559,14 @@ public slots:
//右键--编辑曲线
void onEditLine();
void onCloseEditLine();
//通用
void ClearSelectItems(); //取消选中
//右键--编辑固井
void onEditGujing();
void onCloseEditGujing();
void addItems_Gujing(); //从剪切板文本数据粘贴
void DeleteItems_Gujing(); //全部清空
void RefreshItems_Gujing(); //刷新数据
@ -598,6 +600,7 @@ public slots:
//右键--编辑录井剖面
void onEditGeoLith();
void onCloseEditGeoLith();
void addItems_GeoLith(); //从剪切板文本数据粘贴
void DeleteItems_GeoLith(); //全部清空
void RefreshItems_GeoLith(); //刷新数据
@ -605,6 +608,7 @@ public slots:
//右键--编辑文字结论
void onEditText();
void onCloseEditText();
void addItems_Text(); //从剪切板文本数据粘贴
void DeleteItems_Text(); //全部清空
void RefreshItems_Text(); //刷新数据
@ -612,6 +616,7 @@ public slots:
//右键--编辑地质分层
void onEditLayer();
void onCloseEditLayer();
void addItems_Layer(); //从剪切板文本数据粘贴
void DeleteItems_Layer(); //全部清空
void RefreshItems_Layer(); //刷新数据
@ -748,6 +753,7 @@ public:
//单点移动功能
void executeSingle(QMouseEvent *event);
//右键
virtual void contextMenuEvent(QContextMenuEvent *event);
QList<FRAC_TABLE> m_FracTabList;