diff --git a/DataMgr/src/CreateNewTableDlg.cpp b/DataMgr/src/CreateNewTableDlg.cpp index 46b490e..5f83740 100644 --- a/DataMgr/src/CreateNewTableDlg.cpp +++ b/DataMgr/src/CreateNewTableDlg.cpp @@ -2,6 +2,8 @@ #include "DataHelper.h" #include "LogIO.h" #include "dataslothelper.h" +#include "geometryutils.h" + extern DEFAULTTABLE *DefauleTable;//[DefTabNum]; extern int DefTabNum; /* @@ -140,7 +142,7 @@ void CCreateNewTableDlg::slotSave() { QMessageBox::warning(NULL,"警告!",FileName+"\r\n打开井次文件失败!");return ; } - if(logio.FindObjectIndex(TableName.toStdString().c_str())>=0) + if(logio.FindObjectIndex(UTF8ToGBK(TableName))>=0) { QMessageBox::warning(NULL,"警告!","您要产生的表名称已存在!");return; } @@ -189,7 +191,7 @@ void CCreateNewTableDlg::slotSave() *(DWORD *)&pField[i].Reserved = strDigit.toInt(); } - int table=logio.CreateTable(0,TableName.toLocal8Bit().toStdString().c_str(),TableHzName.toLocal8Bit().toStdString().c_str(),fNum,&pField[0],0); + int table=logio.CreateTable(0,UTF8ToGBK(TableName),TableHzName.toLocal8Bit().toStdString().c_str(),fNum,&pField[0],0); delete []pField; logio.CloseTable(table); logio.Close(); diff --git a/Slfio/src/slf.cpp b/Slfio/src/slf.cpp index 21f6772..ba26468 100644 --- a/Slfio/src/slf.cpp +++ b/Slfio/src/slf.cpp @@ -113,12 +113,19 @@ bool MappingMem(HANDLE *hHandle,LPSTR *hMem,int len,const char* name) 0, // low offset: beginning 0); // default: map entire file #else - HANDLE hMapFile = open(slf1.toStdString().c_str(),O_RDONLY)); - if((hMapFile < 0) +// *hHandle = open(slf1.toStdString().c_str(), O_RDWR|O_CREAT,0644); +// if (*hHandle <0) +// return FALSE; +// void* p = mmap(0, 4096*512,PROT_READ|PROT_WRITE,MAP_SHARED,*hHandle,0); + *hHandle = -1; + void* p = mmap(0, 4096*512,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON,-1,0); + if (p == MAP_FAILED) { - return false; + //qDebug()<

OpenCurve(m_pWellLogs[0]->GetName().toStdString().c_str()); + int index=logio->OpenCurve(UTF8ToGBK(m_pWellLogs[0]->GetName())); if(index>-1) { flag=1; } @@ -511,7 +511,7 @@ void WellLogTableDialogNew::slotSave() int count=rowCount; for(int j=0;jOpenCurve(m_pWellLogs[j]->GetName().toStdString().c_str()); + int index=logio->OpenCurve(UTF8ToGBK(m_pWellLogs[0]->GetName())); if(index>-1) { float *data=new float[rowCount+1]; @@ -552,7 +552,7 @@ void WellLogTableDialogNew::slotSave() delete logio; return; } - int iIndex=logio->OpenTable(m_pWellLogs[0]->GetName().toStdString().c_str()); + int iIndex=logio->OpenTable(UTF8ToGBK(m_pWellLogs[0]->GetName())); if (iIndex >=0) { int fc=logio->GetTableFieldCount(iIndex); diff --git a/WellLogUI/src/griddataadapter.cpp b/WellLogUI/src/griddataadapter.cpp index 78012ec..71f202b 100644 --- a/WellLogUI/src/griddataadapter.cpp +++ b/WellLogUI/src/griddataadapter.cpp @@ -2775,7 +2775,7 @@ void GridDataAdapter::updatetTableWellLogData() QString Qbug = digDec(/*QString::fromLocal8Bit*/(buf)); lstData<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; } diff --git a/logPlus/TransparentDraggableGeoLith.h b/logPlus/TransparentDraggableGeoLith.h index 71a1150..502ce79 100644 --- a/logPlus/TransparentDraggableGeoLith.h +++ b/logPlus/TransparentDraggableGeoLith.h @@ -111,6 +111,7 @@ public: //鼠标形状 bool m_bArrow = false; bool m_bMoveRect = false; + bool m_bNormal = false; int getCursor(); //鼠标是否拖动item bool m_bChange = false; diff --git a/logPlus/TransparentDraggableGujing.cpp b/logPlus/TransparentDraggableGujing.cpp index 0a7a17d..d636c8e 100644 --- a/logPlus/TransparentDraggableGujing.cpp +++ b/logPlus/TransparentDraggableGujing.cpp @@ -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; } diff --git a/logPlus/TransparentDraggableGujing.h b/logPlus/TransparentDraggableGujing.h index 0870a0e..55fdbc4 100644 --- a/logPlus/TransparentDraggableGujing.h +++ b/logPlus/TransparentDraggableGujing.h @@ -90,7 +90,8 @@ public: //鼠标形状 bool m_bArrow = false; - bool m_bMoveRect = false; + bool m_bMoveRect = false; + bool m_bNormal = false; int getCursor(); //鼠标是否拖动item bool m_bChange = false; diff --git a/logPlus/TransparentDraggableLayer.cpp b/logPlus/TransparentDraggableLayer.cpp index 3e43e43..a85252e 100644 --- a/logPlus/TransparentDraggableLayer.cpp +++ b/logPlus/TransparentDraggableLayer.cpp @@ -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; } diff --git a/logPlus/TransparentDraggableLayer.h b/logPlus/TransparentDraggableLayer.h index 28451c7..2f3ed75 100644 --- a/logPlus/TransparentDraggableLayer.h +++ b/logPlus/TransparentDraggableLayer.h @@ -104,6 +104,7 @@ public: //鼠标形状 bool m_bArrow = false; bool m_bMoveRect = false; + bool m_bNormal = false; int getCursor(); //鼠标是否拖动item bool m_bChange = false; diff --git a/logPlus/TransparentDraggableRect.cpp b/logPlus/TransparentDraggableRect.cpp index 9a6a185..e3a4353 100644 --- a/logPlus/TransparentDraggableRect.cpp +++ b/logPlus/TransparentDraggableRect.cpp @@ -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; } diff --git a/logPlus/TransparentDraggableRect.h b/logPlus/TransparentDraggableRect.h index b9f7bdd..e6a5ea3 100644 --- a/logPlus/TransparentDraggableRect.h +++ b/logPlus/TransparentDraggableRect.h @@ -96,6 +96,7 @@ public: //鼠标形状 bool m_bArrow = false; bool m_bMoveRect = false; + bool m_bNormal = false; int getCursor(); //鼠标是否拖动item bool m_bChange = false; diff --git a/logPlus/formdraw.cpp b/logPlus/formdraw.cpp index 86636d6..1308db5 100644 --- a/logPlus/formdraw.cpp +++ b/logPlus/formdraw.cpp @@ -7395,8 +7395,44 @@ void FormDraw::dropEvent(QDropEvent* event) { if(strType=="curveObject") { - //新建曲线 - emit CallManage::getInstance()->sig_AddLine(m_strUuid, strSlfName, strWellName, m_strTrackName, strLineName); + if (list.size() > 5) + { + QString strListPropertyText = list[4]; + QStringList listOtherProperty = strListPropertyText.split(", "); // 以逗号加空格为分隔符分割字符串 + // + QString strListPropertyMain = list[5]; + QStringList listMainProperty = strListPropertyMain.split(", "); // 以逗号加空格为分隔符分割字符串 + + // + if (listMainProperty.size() > 5) + { + double newLeftScale; + double newRightScale; + QString strScaleType; + QColor lineColor; + double width; + Qt::PenStyle lineStyle; + // + newLeftScale = listMainProperty[0].toDouble(); + newRightScale = listMainProperty[1].toDouble(); + strScaleType = listMainProperty[2]; + lineColor.setNamedColor(listMainProperty[3]); + width = listMainProperty[4].toDouble(); + lineStyle = (Qt::PenStyle)listMainProperty[5].toInt(); + + //新建曲线 + emit CallManage::getInstance()->sig_AddLine_Property(m_strUuid, strSlfName, strWellName, m_strTrackName, strLineName, + newLeftScale, newRightScale, strScaleType, lineColor, width, lineStyle, listOtherProperty); + } + else + { + emit CallManage::getInstance()->sig_AddLine(m_strUuid, strSlfName, strWellName, m_strTrackName, strLineName); + } + } + else + { + emit CallManage::getInstance()->sig_AddLine(m_strUuid, strSlfName, strWellName, m_strTrackName, strLineName); + } } else if(strType=="waveObject") { @@ -7456,8 +7492,18 @@ void FormDraw::dropEvent(QDropEvent* event) } else if(strType=="LogfaceObject") { - //沉积相 - emit CallManage::getInstance()->sig_AddLogface(m_strUuid, strSlfName, strWellName, m_strTrackName, strLineName); + if (list.size() > 4) + { + QString strListPropertyText = list[4]; + QStringList listOtherProperty = strListPropertyText.split(", "); // 以逗号加空格为分隔符分割字符串 + //沉积相 + emit CallManage::getInstance()->sig_AddLogface(m_strUuid, strSlfName, strWellName, m_strTrackName, strLineName, 0, listOtherProperty); + } + else + { + //沉积相 + emit CallManage::getInstance()->sig_AddLogface(m_strUuid, strSlfName, strWellName, m_strTrackName, strLineName); + } } else if(strType=="MCalsObject") { diff --git a/logPlus/mainwindow.cpp b/logPlus/mainwindow.cpp index 8fe9fdd..098a6e5 100644 --- a/logPlus/mainwindow.cpp +++ b/logPlus/mainwindow.cpp @@ -179,6 +179,21 @@ void MainWindow::ReadConfig() int iHeight = 10000; //读取,MyCustom界面高度 qtCommon->readHeight(configPath, iHeight); + if(iHeight == 0) + { + } + else if(iHeight == 1) + { + } + else + { + if(iHeight < QApplication::desktop()->height()) + { + //不能低于分辨率 + iHeight = QApplication::desktop()->height(); + } + } + g_iHeight_MyCustom = iHeight; //Debug模式 diff --git a/logPlus/preqtablewidget.cpp b/logPlus/preqtablewidget.cpp index 54e8619..3feb147 100644 --- a/logPlus/preqtablewidget.cpp +++ b/logPlus/preqtablewidget.cpp @@ -113,7 +113,45 @@ void PreQTableWidget::dropEvent(QDropEvent *event) if(strType=="curveObject") { //新建曲线 - emit CallManage::getInstance()->sig_AddLine(m_strUuid, strSlfName, strWellName, m_strTrackName, strLineName); + if (list.size() > 5) + { + QString strListPropertyText = list[4]; + QStringList listOtherProperty = strListPropertyText.split(", "); // 以逗号加空格为分隔符分割字符串 + // + QString strListPropertyMain = list[5]; + QStringList listMainProperty = strListPropertyMain.split(", "); // 以逗号加空格为分隔符分割字符串 + + // + if (listMainProperty.size() > 5) + { + double newLeftScale; + double newRightScale; + QString strScaleType; + QColor lineColor; + double width; + Qt::PenStyle lineStyle; + // + newLeftScale = listMainProperty[0].toDouble(); + newRightScale = listMainProperty[1].toDouble(); + strScaleType = listMainProperty[2]; + lineColor.setNamedColor(listMainProperty[3]); + width = listMainProperty[4].toDouble(); + lineStyle = (Qt::PenStyle)listMainProperty[5].toInt(); + + //新建曲线 + emit CallManage::getInstance()->sig_AddLine_Property(m_strUuid, strSlfName, strWellName, m_strTrackName, strLineName, + newLeftScale, newRightScale, strScaleType, lineColor, width, lineStyle, listOtherProperty); + } + else + { + emit CallManage::getInstance()->sig_AddLine(m_strUuid, strSlfName, strWellName, m_strTrackName, strLineName); + } + } + else + { + emit CallManage::getInstance()->sig_AddLine(m_strUuid, strSlfName, strWellName, m_strTrackName, strLineName); + } + } else if(strType=="waveObject") { @@ -361,10 +399,61 @@ void PreQTableWidget::performDrag() //属性信息 QString strListPropertyText = ""; + QString strListPropertyMain = ""; if(strType=="curveObject") { //曲线 + //此处属性注意顺序,后续使用按照顺序 + QStringList listOtherProperty; + listOtherProperty.append(formInfo->m_strAliasName); + listOtherProperty.append(formInfo->m_strUnit); + listOtherProperty.append(formInfo->m_curveNameFont.toString());//曲线名称字体 + if(formInfo->m_bDrawLine) + { + listOtherProperty.append("DrawLine"); + } + else{ + listOtherProperty.append("0"); + } + // + if(formInfo->m_bDrawGan) + { + listOtherProperty.append("DrawGan"); + } + else{ + listOtherProperty.append("0"); + } + // + if(formInfo->m_bDrawPoint) + { + listOtherProperty.append("DrawPoint"); + } + else{ + listOtherProperty.append("0"); + } + // + if(formInfo->m_bDrawSymmetry) + { + listOtherProperty.append("DrawSymmetry"); + } + else{ + listOtherProperty.append("0"); + } + // + listOtherProperty.append(QString::number(formInfo->m_pointStyle)); + // + strListPropertyText = listOtherProperty.join(", "); // 合并成一个字符串,元素之间用逗号加空格分隔 + // + QStringList listMainProperty; + listMainProperty.append(QString::number(formInfo->m_vmin)); + listMainProperty.append(QString::number(formInfo->m_vmax)); + listMainProperty.append(formInfo->m_strScaleType); + listMainProperty.append(formInfo->m_lineColor.name()); + listMainProperty.append(QString::number(formInfo->m_dWidth)); + listMainProperty.append(QString::number(formInfo->m_lineStyle)); + // + strListPropertyMain = listMainProperty.join(", "); // 合并成一个字符串,元素之间用逗号加空格分隔 } else if(strType=="waveObject") { @@ -473,12 +562,19 @@ void PreQTableWidget::performDrag() // 这里需要根据你的item数据来设置mimeData,例如: if(strListPropertyText == "") { - mimeData->setText(formInfo->m_strSlfName + "#@@#"+ formInfo->m_strWellName + "#@@#" +formInfo->m_strLineName + "#@@#" + strType); } else { - mimeData->setText(formInfo->m_strSlfName + "#@@#"+ formInfo->m_strWellName + "#@@#" +formInfo->m_strLineName + "#@@#" + strType + "#@@#" + strListPropertyText); + if(strListPropertyMain == "") + { + mimeData->setText(formInfo->m_strSlfName + "#@@#"+ formInfo->m_strWellName + "#@@#" +formInfo->m_strLineName + "#@@#" + strType + "#@@#" + strListPropertyText); + } + else + { + //曲线额外补充属性 + mimeData->setText(formInfo->m_strSlfName + "#@@#"+ formInfo->m_strWellName + "#@@#" +formInfo->m_strLineName + "#@@#" + strType + "#@@#" + strListPropertyText+ "#@@#" + strListPropertyMain); + } } // 创建QDrag对象 QDrag *drag = new QDrag(this); diff --git a/logPlus/qmycustomplot.cpp b/logPlus/qmycustomplot.cpp index 1511766..6a214f9 100644 --- a/logPlus/qmycustomplot.cpp +++ b/logPlus/qmycustomplot.cpp @@ -1313,6 +1313,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(); } @@ -1452,7 +1490,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++) @@ -1579,7 +1617,7 @@ void QMyCustomPlot::mouseMoveEvent(QMouseEvent *event) { this->setCursor(Qt::SizeVerCursor); } - else + else if (nmaxCursor == 3) { QCursor currentCursor = this->cursor(); if(currentCursor == Qt::CrossCursor) @@ -1590,6 +1628,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(); @@ -1794,6 +1889,7 @@ void QMyCustomPlot::s_LineClicked(int index) // } } +//右键 void QMyCustomPlot::contextMenuEvent(QContextMenuEvent *event) { m_event = event; @@ -1804,7 +1900,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); - menu.addAction(QIcon(::GetImagePath() + "curve.png"), "开始编辑曲线", this, &QMyCustomPlot::onEditLine); + 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()); } @@ -1824,8 +1926,14 @@ void QMyCustomPlot::contextMenuEvent(QContextMenuEvent *event) { QMenu menu(this); //录井剖面 - menu.addAction(QIcon(::GetImagePath() + "curve.png"), "开始编辑录井剖面", this, &QMyCustomPlot::onEditGeoLith); - menu.addAction(QIcon(::GetImagePath() + "icon/CopyCoreTxt.png"), "从剪切板文本数据粘贴", this, &QMyCustomPlot::addItems_GeoLith); + 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); menu.addAction(QIcon(::GetImagePath() + "icon/CopyCoreTxt.png"), "刷新数据", this, &QMyCustomPlot::RefreshItems_GeoLith); @@ -1835,8 +1943,14 @@ void QMyCustomPlot::contextMenuEvent(QContextMenuEvent *event) { QMenu menu(this); //岩性描述,文字结论 - menu.addAction(QIcon(::GetImagePath() + "curve.png"), "开始编辑文字结论", this, &QMyCustomPlot::onEditText); - menu.addAction(QIcon(::GetImagePath() + "icon/CopyCoreTxt.png"), "从剪切板文本数据粘贴", this, &QMyCustomPlot::addItems_Text); + 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); menu.addAction(QIcon(::GetImagePath() + "icon/CopyCoreTxt.png"), "刷新数据", this, &QMyCustomPlot::RefreshItems_Text); @@ -1846,8 +1960,14 @@ void QMyCustomPlot::contextMenuEvent(QContextMenuEvent *event) { QMenu menu(this); //地质分层 - menu.addAction(QIcon(::GetImagePath() + "curve.png"), "开始编辑地质分层", this, &QMyCustomPlot::onEditLayer); - menu.addAction(QIcon(::GetImagePath() + "icon/CopyCoreTxt.png"), "从剪切板文本数据粘贴", this, &QMyCustomPlot::addItems_Layer); + 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); menu.addAction(QIcon(::GetImagePath() + "icon/CopyCoreTxt.png"), "刷新数据", this, &QMyCustomPlot::RefreshItems_Layer); @@ -1917,13 +2037,16 @@ void QMyCustomPlot::contextMenuEvent(QContextMenuEvent *event) } // - FormInfo* pInfo = m_formTrack->getFormInfoByParameters(m_strUuid, m_strWellName, m_strTrackName, m_strLineName); - if (pInfo == NULL) + if(m_strType == "") { - return; + FormInfo* pInfo = m_formTrack->getFormInfoByParameters(m_strUuid, m_strWellName, m_strTrackName, m_strLineName); + if (pInfo == NULL) + { + return; + } + m_strType = pInfo->m_strType; } - QString strType = pInfo->m_strType; - if (strType == "JiegutextObject") + if (m_strType == "JiegutextObject") { QMenu menu(this); //气测/FMT/射孔/文本 @@ -1933,11 +2056,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); //固井 - menu.addAction(QIcon(::GetImagePath() + "curve.png"), "开始编辑固井结论", this, &QMyCustomPlot::onEditGujing); + 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); @@ -1945,7 +2074,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); //沉积相 @@ -1953,7 +2082,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(","); @@ -1978,7 +2107,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); @@ -2021,6 +2150,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) { @@ -2041,7 +2173,6 @@ void QMyCustomPlot::onEditLine() } // 当选择完成时,获取矩形范围并放大 QRectF rect = this->selectionRect()->rect(); // 获取选择的矩形区域(像素坐标) - m_bEditRect=true;//当前是否正在编辑曲线。 // 转换为坐标轴范围 double top = rect.top(); @@ -2075,7 +2206,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::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) { //信号槽只绑定一次,避免重复绑定 @@ -2126,7 +2281,6 @@ void QMyCustomPlot::onEditText() } // 当选择完成时,获取矩形范围并放大 QRectF rect = this->selectionRect()->rect(); // 获取选择的矩形区域(像素坐标) - m_bEditRect=true;//当前是否正在编辑曲线。 // 转换为坐标轴范围 double top = rect.top(); @@ -2173,20 +2327,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) { //信号槽只绑定一次,避免重复绑定 @@ -2206,7 +2370,6 @@ void QMyCustomPlot::onEditLayer() } // 当选择完成时,获取矩形范围并放大 QRectF rect = this->selectionRect()->rect(); // 获取选择的矩形区域(像素坐标) - m_bEditRect=true;//当前是否正在编辑曲线。 // 转换为坐标轴范围 double top = rect.top(); @@ -2262,11 +2425,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) { @@ -2287,7 +2463,6 @@ void QMyCustomPlot::onEditGujing() } // 当选择完成时,获取矩形范围并放大 QRectF rect = this->selectionRect()->rect(); // 获取选择的矩形区域(像素坐标) - m_bEditRect=true;//当前是否正在编辑曲线。 // 转换为坐标轴范围 double top = rect.top(); @@ -2334,14 +2509,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() { @@ -2831,7 +3016,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) { //信号槽只绑定一次,避免重复绑定 @@ -2851,7 +3038,6 @@ void QMyCustomPlot::onEditGeoLith() } // 当选择完成时,获取矩形范围并放大 QRectF rect = this->selectionRect()->rect(); // 获取选择的矩形区域(像素坐标) - m_bEditRect=true;//当前是否正在编辑曲线。 // 转换为坐标轴范围 double top = rect.top(); @@ -2979,14 +3165,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; diff --git a/logPlus/qmycustomplot.h b/logPlus/qmycustomplot.h index 56e81b1..2899794 100644 --- a/logPlus/qmycustomplot.h +++ b/logPlus/qmycustomplot.h @@ -562,12 +562,14 @@ public slots: //右键--编辑曲线 void onEditLine(); + void onCloseEditLine(); //通用 void ClearSelectItems(); //取消选中 //右键--编辑固井 void onEditGujing(); + void onCloseEditGujing(); void addItems_Gujing(); //从剪切板文本数据粘贴 void DeleteItems_Gujing(); //全部清空 void RefreshItems_Gujing(); //刷新数据 @@ -600,7 +602,8 @@ public slots: void AddItem_SWallCore(QStringList lists); //右键--编辑录井剖面 - void onEditGeoLith(); + void onEditGeoLith(); + void onCloseEditGeoLith(); void addItems_GeoLith(); //从剪切板文本数据粘贴 void DeleteItems_GeoLith(); //全部清空 void RefreshItems_GeoLith(); //刷新数据 @@ -608,6 +611,7 @@ public slots: //右键--编辑文字结论 void onEditText(); + void onCloseEditText(); void addItems_Text(); //从剪切板文本数据粘贴 void DeleteItems_Text(); //全部清空 void RefreshItems_Text(); //刷新数据 @@ -615,6 +619,7 @@ public slots: //右键--编辑地质分层 void onEditLayer(); + void onCloseEditLayer(); void addItems_Layer(); //从剪切板文本数据粘贴 void DeleteItems_Layer(); //全部清空 void RefreshItems_Layer(); //刷新数据 @@ -751,6 +756,7 @@ public: //单点移动功能 void executeSingle(QMouseEvent *event); + //右键 virtual void contextMenuEvent(QContextMenuEvent *event); QList m_FracTabList; diff --git a/logPlus/qtprojectwidgets.cpp b/logPlus/qtprojectwidgets.cpp index c61de4c..8fb6a5c 100644 --- a/logPlus/qtprojectwidgets.cpp +++ b/logPlus/qtprojectwidgets.cpp @@ -266,7 +266,6 @@ void QtProjectWidgets::s_loadTreeWidget(QString fileFull) itemIndex->setExpanded(true); } - void QtProjectWidgets::loadIndexSysTree(QTreeWidgetItem *parent, QString fileFull, QString prjname) { //Logdata @@ -298,10 +297,6 @@ void QtProjectWidgets::loadIndexSysTree(QTreeWidgetItem *parent, QString fileFul } else { - qDebug() << " folderPath " << folderPath; - - - //井目录 //取当前当前目录内容 QDir dir(folderPath); @@ -865,6 +860,11 @@ void QtProjectWidgets::initCurveObjectTreeMenu(QMenu *menu, QTreeWidget *treeWid connect(m_action_DepthShift, SIGNAL(triggered(bool)), this, SLOT(onDepthShift(bool))); menu->addAction(m_action_DepthShift); + m_action_DepthResample = new QAction("深度重采样", treeWidget); + m_action_DepthResample->setIcon(QIcon(GetImagePath() + "icon/AddToTrack.png")); // 设置图标 + connect(m_action_DepthResample, SIGNAL(triggered(bool)), this, SLOT(onDepthResample(bool))); + menu->addAction(m_action_DepthResample); + QAction* action_WaveCompose = new QAction("合成阵列曲线", treeWidget); action_WaveCompose->setIcon(QIcon(GetImagePath() + "icon/RigidDepthShifting.png")); connect(action_WaveCompose, SIGNAL(triggered()), this, SLOT(onWaveCompose())); @@ -1246,6 +1246,201 @@ void QtProjectWidgets::onDepthShift(bool checked) } } +//深度重采样 +void QtProjectWidgets::onDepthResample(bool checked) +{ + double rlev=0.125; + bool ok=0; + QString ss=QInputDialog::getText(NULL,"深度重采样","请输入新的采样间隔",QLineEdit::Normal,QString::number(rlev),&ok); + if(!ok) return; + rlev=ss.toDouble(); + if(rlev==0) return; + int ret=QMessageBox::information(NULL,"提示","不保留原始数据?",QMessageBox::Yes|QMessageBox::No); + QList selectedItemList = ui->treeWidget->selectedItems(); + foreach (QTreeWidgetItem * pItem, selectedItemList) + { + QString strTreeTag = pItem->data(0, Qt::UserRole).toString(); + if (strTreeTag == "wellname") //井名 + { + QList listqWellFiles = m_qmapWellFiles[pItem->text(0)]; + int count = listqWellFiles.count(); + for(int i=0;iSetSlfFileName(listqWellFiles.at(i)); + if(pround){ + QString SlfFileName=pround->GetSlfFileName(); + if(SlfFileName.isEmpty()) continue; + CMemRdWt * logio=new CMemRdWt(); + if(!logio->Open(SlfFileName.toStdString().c_str(),CSlfIO::modeReadWrite)) + { + delete logio; + return ; + }; + char name[64]; + int count1=logio->GetObjectCount(); + QStringList namess; + for(int i=0;iGetObjectStatus(i)!=OBJECT_NORMAL) continue; + logio->GetObjectName(i,name); + if(strstr(name,".OLD")) continue; + short Attribute,SubAttribute; + Attribute=logio->GetObjectType(i); + if(Attribute!=CURVE_OBJECT&&Attribute!=WAVE_OBJECT)continue; + namess.append(name); + int index=logio->OpenChannel(name); + if(index>-1) { + logio->ChannelResamples(index,rlev); + } + /* + CObjWellLog *pLog=dynamic_cast(pround->GetObjectByName(name)); + if(pLog) { + if(pLog->IsLoaded()) + { + pLog->isLoad=false; + pLog->LoadFromSLF(); + } + else pLog->SetRlev(rlev); + } + */ + } + delete logio; + // foreach(QString name1,namess) + // { + // GetObjectEvent().OnDeAttchData(m_SlfFileName,name1); + // GetObjectEvent().OnRefreshData(m_SlfFileName,name1); + // } + if(ret==QMessageBox::Yes) { + CMemRdWt * logio=new CMemRdWt(); + if(!logio->Open(SlfFileName.toStdString().c_str(),CSlfIO::modeReadWrite)) + { + delete logio; + return ; + }; + char name[64]; + int count=logio->GetObjectCount(); + DepthProgress dp; + dp.CreatProgress(0,count,"开始清除对象原始数据..."); + for(int i=0;iGetObjectName(i,name); + if(strstr(name,".OLD")) logio->DiscardObject(name); + dp.SetDepth(i); + } + delete logio; + dp.DelProgress(); + } + CDataImport::ChangetoSlf(SlfFileName); + } + } + } + else if (strTreeTag == "wellItem") //井次 + { + CObjWelllogRound* pround = new CObjWelllogRound; + pround->SetSlfFileName(pItem->data(0, Qt::UserRole+1).toString()); + if(pround){ + QString SlfFileName=pround->GetSlfFileName(); + if(SlfFileName.isEmpty()) continue; + CMemRdWt * logio=new CMemRdWt(); + if(!logio->Open(SlfFileName.toStdString().c_str(),CSlfIO::modeReadWrite)) + { + delete logio; + return ; + }; + char name[64]; + int count=logio->GetObjectCount(); + QStringList namess; + for(int i=0;iGetObjectStatus(i)!=OBJECT_NORMAL) continue; + logio->GetObjectName(i,name); + if(strstr(name,".OLD")) continue; + short Attribute,SubAttribute; + Attribute=logio->GetObjectType(i); + if(Attribute!=CURVE_OBJECT&&Attribute!=WAVE_OBJECT)continue; + int index=logio->OpenChannel(name); + if(index>-1) { + logio->ChannelResamples(index,rlev); + namess.append(name); + } + /* + CObjWellLog *pLog=dynamic_cast(pround->GetObjectByName(name)); + if(pLog) { + if(pLog->IsLoaded()) + { + pLog->isLoad=false; + pLog->LoadFromSLF(); + } + else pLog->SetRlev(rlev); + } + */ + } + delete logio; + // foreach(QString name1,namess) + // { + // GetObjectEvent().OnDeAttchData(m_SlfFileName,name1); + // GetObjectEvent().OnRefreshData(m_SlfFileName,name1); + // } + if(ret==QMessageBox::Yes) { + CMemRdWt * logio=new CMemRdWt(); + if(!logio->Open(SlfFileName.toStdString().c_str(),CSlfIO::modeReadWrite)) + { + delete logio; + return ; + }; + char name[64]; + int count=logio->GetObjectCount(); + DepthProgress dp; + dp.CreatProgress(0,count,"开始清除对象原始数据..."); + for(int i=0;iGetObjectName(i,name); + if(strstr(name,".OLD")) logio->DiscardObject(name); + dp.SetDepth(i); + } + delete logio; + dp.DelProgress(); + } + CDataImport::ChangetoSlf(SlfFileName); + } + } + else { + CObjWellLog* pLog= new CObjWellLog(); + pLog->SetSlfFileName(pItem->data(0, Qt::UserRole+1).toString()); + pLog->SetName(pItem->text(0)); + if(pLog) { + pLog->ReSample(rlev); + // GetObjectEvent().OnDeAttchData(pLog->GetSlfFileName(),pLog->GetName()); + // GetObjectEvent().OnRefreshData(pLog->GetSlfFileName(),pLog->GetName()); + } + if(ret==QMessageBox::Yes) { + CMemRdWt * logio=new CMemRdWt(); + if(!logio->Open(pLog->GetSlfFileName().toStdString().c_str(),CSlfIO::modeReadWrite)) + { + delete logio; + return ; + }; + char name[64]; + int count=logio->GetObjectCount(); + DepthProgress dp; + dp.CreatProgress(0,count,"开始清除对象原始数据..."); + for(int i=0;iGetObjectName(i,name); + if(strstr(name,".OLD")) logio->DiscardObject(name); + dp.SetDepth(i); + } + delete logio; + dp.DelProgress(); + } + } + } + // foreach(QDialog *pDia,m_pDialogs) + // { + // CBaseDialog *pBD=dynamic_cast(pDia); + // if(pBD) + // { + // pBD->ReFreshWindow(0); + // } + // } +} + //合成阵列曲线 void QtProjectWidgets::onWaveCompose(bool checked) { diff --git a/logPlus/qtprojectwidgets.h b/logPlus/qtprojectwidgets.h index 8f454cf..c8ea200 100644 --- a/logPlus/qtprojectwidgets.h +++ b/logPlus/qtprojectwidgets.h @@ -52,6 +52,7 @@ public slots: void onShowCurve(bool checked = false); //数据查看 void ApplyShiftDepth(QString strSlfName, QString strLineName, double DepthOffset); void onDepthShift(bool checked = false); //深度移动 + void onDepthResample(bool checked = false); //深度重采样 void onWaveCompose(bool checked = false); //合成阵列曲线 void onInfoEdit(bool checked = false); //属性 @@ -120,6 +121,7 @@ public: //曲线对象(AC、BS...)-右键菜单 QAction* m_action_ShowCurve; QAction* m_action_DepthShift; + QAction* m_action_DepthResample; QString m_strWellname; QString m_strSlfName;