diff --git a/logPlus/PropertyWidget.cpp b/logPlus/PropertyWidget.cpp index 197509e..ae16c1e 100644 --- a/logPlus/PropertyWidget.cpp +++ b/logPlus/PropertyWidget.cpp @@ -956,11 +956,15 @@ void PropertyWidget::SlotPropertyChanged( QtProperty *pProperty, const QVariant { double upper = variant.value(); m_tdJieshi->setDragRect(2, -upper); + //保存更新 + m_tdJieshi->mPlot->SaveToSLF_Result(); } else if ("底深(m)" == m_propertyData[pProperty]) { double lower = variant.value(); m_tdJieshi->setDragRect(1, -lower); + //保存更新 + m_tdJieshi->mPlot->SaveToSLF_Result(); } else { diff --git a/logPlus/TransparentGroupResult.cpp b/logPlus/TransparentGroupResult.cpp index ff98423..b49f2ef 100644 --- a/logPlus/TransparentGroupResult.cpp +++ b/logPlus/TransparentGroupResult.cpp @@ -422,6 +422,8 @@ void TransparentGroupResult::setDragResult(int nidx, QString strResult) return; pDrag->setResult(strResult); pDrag->setShowProperty(m_nConclusionProportion, m_nShowPos, true); + // + mPlot->SaveToSLF_Result(); } void TransparentGroupResult::setDragDepth(int nidx, double dDepth) diff --git a/logPlus/TransparentGroupResult.h b/logPlus/TransparentGroupResult.h index f36795a..338b3ee 100644 --- a/logPlus/TransparentGroupResult.h +++ b/logPlus/TransparentGroupResult.h @@ -115,7 +115,7 @@ private slots: double getMyLower(); double getMyUpper(); -private: +public: QMyCustomPlot *mPlot; QCPItemRect *mRect; QCPItemRect *mLeftHandle; diff --git a/logPlus/formdraw.cpp b/logPlus/formdraw.cpp index 36f5a43..030e0ef 100644 --- a/logPlus/formdraw.cpp +++ b/logPlus/formdraw.cpp @@ -5892,7 +5892,7 @@ void FormDraw::initResult(QMyCustomPlot *widget, QString strSlfName, QString str widget->yAxis->setVisible(false); widget->yAxis2->setVisible(false); // - LoadFromSLF_Result(widget, strSlfName, strLineName); + widget->LoadFromSLF_Result(strSlfName, strLineName); QString strAliasName = ""; QString strUnit = ""; @@ -5904,59 +5904,6 @@ void FormDraw::initResult(QMyCustomPlot *widget, QString strSlfName, QString str } -bool FormDraw::LoadFromSLF_Result(QMyCustomPlot *widget, QString strSlfName, QString strLineName) -{ - static bool isrun=false; - CMemRdWt *logio=new CMemRdWt(); - if(!logio->Open(strSlfName.toStdString().c_str(), CSlfIO::modeRead)) - { - delete logio; - isrun=false; - return false; - } - - int iIndex=logio->OpenTable(strLineName.toStdString().c_str()); - if(iIndex>-1) { - int len = logio->GetTableRecordLength(iIndex); - int sl = sizeof(LAYER_DATA); - if(sl>len) len=sl; - LAYER_DATA *m_Result,*m_Result1; - int count=logio->GetTableRecordCount(iIndex); - char *pstr=new char[len*count+1]; - memset(pstr,0,len*count); - int zone=1; - for(int i=0;iReadTable(iIndex,i+1,m_Result); - if(!i) zone=atoi(m_Result->Zone); - } - - QString strGroupUuid = ""; - for(int i=0;iStartDepth==m_Result->EndDepth) continue; - - QString strZone = QString::number(atoi(m_Result->Zone)); - // 设置解释结论终止深度 - TransparentGroupResult* pGroup = widget->addResultGroup(-m_Result->EndDepth, -m_Result->StartDepth, strGroupUuid, strZone); - pGroup->addAllResultToPlot(m_Result); - } - - //最后统一刷新 - widget->replot(); - - logio->CloseTable(iIndex); - delete pstr; - } - delete logio; - - - isrun=false; - return true; -} - //录井剖面 void FormDraw::initGeoLith(QMyCustomPlot *widget, QString strSlfName, QString strLineName, QString strAliasName, QColor newlineColor, QStringList listOtherProperty) { diff --git a/logPlus/formdraw.h b/logPlus/formdraw.h index 8df7368..b8a240e 100644 --- a/logPlus/formdraw.h +++ b/logPlus/formdraw.h @@ -230,7 +230,6 @@ public: //解释结论 void initResult(QMyCustomPlot *widget, QString strSlfName, QString strLineName); - bool LoadFromSLF_Result(QMyCustomPlot *widget, QString strSlfName, QString strLineName); //录井剖面 void initGeoLith(QMyCustomPlot *widget, QString strSlfName, QString strLineName, QString strAliasName = "录井剖面", QColor newlineColor=QColor(0,0,0), QStringList listOtherProperty={}); diff --git a/logPlus/qmycustomplot.cpp b/logPlus/qmycustomplot.cpp index d3593eb..a1271a9 100644 --- a/logPlus/qmycustomplot.cpp +++ b/logPlus/qmycustomplot.cpp @@ -1146,11 +1146,11 @@ void QMyCustomPlot::contextMenuEvent(QContextMenuEvent *event) mLastPos = event->pos(); qDebug() << "mLastPos:" << mLastPos; menu.addAction(QIcon(::GetImagePath() + "curve.png"), "关闭编辑解释结论", this, &QMyCustomPlot::onCloseEditResult); - menu.addAction(QIcon(::GetImagePath() + "icon/CopyCoreTxt.png"), "从剪切板文本数据粘贴", this, &QMyCustomPlot::addItems_Layer); +// 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::DeleteItemGroup); - menu.addAction(QIcon(::GetImagePath() + "icon/Delete.png"), "全部清空", this, &QMyCustomPlot::DeleteItems_Layer); - menu.addAction(QIcon(::GetImagePath() + "icon/load.png"), "刷新数据", this, &QMyCustomPlot::RefreshItems_Layer); +// menu.addAction(QIcon(::GetImagePath() + "icon/Delete.png"), "全部清空", this, &QMyCustomPlot::DeleteItems_Layer); + menu.addAction(QIcon(::GetImagePath() + "icon/load.png"), "刷新数据", this, &QMyCustomPlot::RefreshResult); menu.addAction(QIcon(::GetImagePath() + "icon/SetZone.png"), "更新层号", this, &QMyCustomPlot::updateGroupZone); menu.addAction(QIcon(::GetImagePath() + "icon/Split.png"), "分割为层内层", this, &QMyCustomPlot::segmentationInnerLayer); @@ -4451,6 +4451,60 @@ void QMyCustomPlot::onCloseEditImage() this->setCursor(Qt::ArrowCursor); } +//加载解释结论slf数据 +bool QMyCustomPlot::LoadFromSLF_Result(QString strSlfName, QString strLineName) +{ + static bool isrun=false; + CMemRdWt *logio=new CMemRdWt(); + if(!logio->Open(strSlfName.toStdString().c_str(), CSlfIO::modeRead)) + { + delete logio; + isrun=false; + return false; + } + + int iIndex=logio->OpenTable(strLineName.toStdString().c_str()); + if(iIndex>-1) { + int len = logio->GetTableRecordLength(iIndex); + int sl = sizeof(LAYER_DATA); + if(sl>len) len=sl; + LAYER_DATA *m_Result,*m_Result1; + int count=logio->GetTableRecordCount(iIndex); + char *pstr=new char[len*count+1]; + memset(pstr,0,len*count); + int zone=1; + for(int i=0;iReadTable(iIndex,i+1,m_Result); + if(!i) zone=atoi(m_Result->Zone); + } + + QString strGroupUuid = ""; + for(int i=0;iStartDepth==m_Result->EndDepth) continue; + + QString strZone = QString::number(atoi(m_Result->Zone)); + // 设置解释结论终止深度 + TransparentGroupResult* pGroup = addResultGroup(-m_Result->EndDepth, -m_Result->StartDepth, strGroupUuid, strZone); + pGroup->addAllResultToPlot(m_Result); + } + + //最后统一刷新 + replot(); + + logio->CloseTable(iIndex); + delete pstr; + } + delete logio; + + + isrun=false; + return true; +} + //加载固井slf数据 bool QMyCustomPlot::LoadFromSLF_Gujing(QString strSlfName, QString strLineName) { @@ -5350,7 +5404,7 @@ void QMyCustomPlot::s_Refresh_All(QString strUuid, QString strSlfName, QString s else if (m_strLineName == "RESULT") { // 解释结论 - //RefreshItems_Layer(); + RefreshResult(); } else if (m_strLineName == "IMAGE_DATA") { @@ -9014,10 +9068,43 @@ void QMyCustomPlot::DeleteItemGroup() continue; pGroup->removeAllResult(); } + this->replot(); SaveToSLF_Result(); } } +//刷新 +void QMyCustomPlot::RefreshResult() +{ + if (m_strLineName == "RESULT") + { + QStringList listRemove; + //删除对象 + TransparentGroupResult *pDraggableRect =NULL; + QMap::Iterator it = m_mapDragGroup.begin(); + while( it != m_mapDragGroup.end() ) + { + pDraggableRect = (TransparentGroupResult*)it.value(); + listRemove << it.key(); + // + it++; + } + + for (int i = 0; i < listRemove.size(); i++) + { + TransparentGroupResult *pGroup = qobject_cast(m_mapDragGroup.value(listRemove.at(i))); + if (pGroup == nullptr) + continue; + pGroup->removeAllResult(); + } + + //加载 + this->LoadFromSLF_Result(m_strSlfName, m_strLineName); + //属性清空 + PropertyService()->InitCurrentViewInfo(); + } +} + void QMyCustomPlot::updateGroupZone() { QMap mapSort; diff --git a/logPlus/qmycustomplot.h b/logPlus/qmycustomplot.h index 54a8d18..1231bdc 100644 --- a/logPlus/qmycustomplot.h +++ b/logPlus/qmycustomplot.h @@ -275,6 +275,9 @@ public: QObject* m_SelectRect=nullptr;//当前选中的曲线编辑框 QObject* m_selectItem = nullptr; + //解释结论 + bool LoadFromSLF_Result(QString strSlfName, QString strLineName); + //固井 QMap zoneOrder_Gujing; bool SaveToSLF_Gujing(); @@ -619,6 +622,7 @@ public slots: void onCloseEditResult(); void DeleteItemGroup(); void updateGroupZone(); //更新层号 + void RefreshResult();//刷新 bool SaveToSLF_Result();