diff --git a/CallManage/CallManage.h b/CallManage/CallManage.h index f55d08b..d29e994 100644 --- a/CallManage/CallManage.h +++ b/CallManage/CallManage.h @@ -83,7 +83,7 @@ signals: void sig_AddLogface(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, int nW = 0, QStringList listOtherProperty={}); //套管组件 - void sig_AddTubingstring(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, int nW = 0); + void sig_AddTubingstring(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, int nW = 0, QStringList listOtherProperty={}); //TDT void sig_AddTDT(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, int nW = 0); diff --git a/logPlus/ObjTubingstringResult.cpp b/logPlus/ObjTubingstringResult.cpp deleted file mode 100644 index 9d6fe5f..0000000 --- a/logPlus/ObjTubingstringResult.cpp +++ /dev/null @@ -1,178 +0,0 @@ -#include -#include "ObjTubingstringResult.h" -#include "MemRdWt.h" -#include "geometryutils.h" - -CObjTubingstringResult::CObjTubingstringResult() -{ - if(zoneOrder.size()==0) - { - zoneOrder=GetZoneOrder(QString("TubTools.ini")); - } - - cclimgpath=GetSymbolDir()+"\\管柱组件\\"; -} - -CObjTubingstringResult::~CObjTubingstringResult() -{ - m_pResultList.clear(); -} - -bool CObjTubingstringResult::LoadFromSLF(QMyCustomPlot *widget, QString strSlfName, QString csCurve) -{ - m_pResultList.clear(); - -// //隐藏刻度 -// widget->xAxis->setTicks(false); -// widget->yAxis->setTicks(false); -// widget->xAxis2->setTicks(false); -// widget->yAxis2->setTicks(false); - - Slf_JIEGUPOS *m_pResult=NULL; - CMemRdWt *logio=new CMemRdWt(); - if(strSlfName==""||!logio->Open(strSlfName.toStdString().c_str(),CSlfIO::modeRead)) - { - delete logio; -// QMessageBox::information(NULL,"提示","SLF文件打开失败,请检查!!",QMessageBox::Yes); - return false; - } - - - int iIndex=logio->OpenTable(csCurve.toStdString().c_str()); - if(iIndex>-1) { - int count=logio->GetTableRecordCount(iIndex); - //int fieldnum=logio->GetTableFieldCount(iIndex); - int len=logio->GetTableRecordLength(iIndex); - m_pResult=(Slf_JIEGUPOS *)new char[len+1]; - char buf[200]; - logio->IsChange=true; - - bool bDrawGuanzhu = false; - for(int i=0;iReadTable(iIndex,i+1,m_pResult); - - Slf_JIEGUPOS result; - result.Depth=m_pResult->Depth; - result.Order=m_pResult->Order; - result.Number=m_pResult->Number; - m_pResultList.append(result); - - // - double depth=m_pResult->Depth; - int Order=m_pResult->Order; - int Number=m_pResult->Number; - - if(bDrawGuanzhu == false) - { - //还没有画管柱 - if(Number == zoneOrder.value("管底部").toInt()|| - Number == zoneOrder.value("油管深").toInt()|| - Number == zoneOrder.value("喇叭口").toInt()|| - Number == zoneOrder.value("剌叭口").toInt()) - { - bDrawGuanzhu = true;//画管柱 - - QString shotimgfile=GetSymbolDir()+"\\管柱组件\\管柱.png"; - //QImage shotimg(shotimgfile); - //pPainter->drawImage(rect,shotimg); - - double lY1 = widget->yAxis->range().lower;//+10 - double lY2 = widget->yAxis->range().upper; - QCPItemPixmap *mPixmap; - mPixmap = new QCPItemPixmap(widget); - //mPixmap->setPixmap(QPixmap(":/image/file.png")); // 设置图片 - mPixmap->setScaled(true, Qt::IgnoreAspectRatio); // 设置缩放方式 - mPixmap->setLayer("overlay"); // 确保在最上层 - // - float upper = widget->xAxis->range().upper; - mPixmap->topLeft->setCoords(upper, lY1 + (lY2-lY1-m_Oguan)/2.0); - mPixmap->bottomRight->setCoords(-depth, lY2 - (lY2-lY1-m_Oguan)/2.0); - mPixmap->setPixmap(QPixmap(shotimgfile)); // 设置图片 - } - } - } - logio->CloseTable(iIndex); - delete m_pResult; - } - delete logio; - - for(int i=0; ixAxis->coordToPixel(-depth)-h/2.0; - float lower = widget->xAxis->coordToPixel(-depth)+h/2.0; - float newUpper = widget->xAxis->pixelToCoord(upper); - float newLower = widget->xAxis->pixelToCoord(lower); - widget->addGuanToPlot(newLower, newUpper, cclimgfile, in); - -// QString cclimgfile=cclimgpath+name+".png"; -// double lY1 = widget->yAxis->range().lower;//+10 -// double lY2 = widget->yAxis->range().upper; -// QCPItemPixmap *mPixmap; -// mPixmap = new QCPItemPixmap(widget); -// mPixmap->setScaled(true, Qt::IgnoreAspectRatio); // 设置缩放方式 -// mPixmap->setLayer("overlay"); // 确保在最上层 -// // -// float upper = widget->xAxis->coordToPixel(-depth)-h/2.0; -// float lower = widget->xAxis->coordToPixel(-depth)+h/2.0; -// float newUpper = widget->xAxis->pixelToCoord(upper); -// float newLower = widget->xAxis->pixelToCoord(lower); -// mPixmap->topLeft->setCoords(newUpper, lY1 + (lY2-lY1-in)/2.0); -// mPixmap->bottomRight->setCoords(newLower, lY2 - (lY2-lY1-in)/2.0); -// mPixmap->setPixmap(QPixmap(cclimgfile)); // 设置图片 -} diff --git a/logPlus/ObjTubingstringResult.h b/logPlus/ObjTubingstringResult.h deleted file mode 100644 index eef0fce..0000000 --- a/logPlus/ObjTubingstringResult.h +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef OBTubingstringResultITEM_H -#define OBTubingstringResultITEM_H - -#include -#include "qmycustomplot.h" - -//套管 -class CObjTubingstringResult :public QObject -{ - Q_OBJECT -public: - CObjTubingstringResult(); - virtual ~CObjTubingstringResult(); - - -public: - bool LoadFromSLF(QMyCustomPlot *widget, QString strSlfName, QString csCurve); - void drawOne(QMyCustomPlot *widget, Slf_JIEGUPOS result); - -public: - QMap zoneOrder; - float m_Oguan = 63.5; - float m_Oind = 121.36; - bool m_bDrawCCL = false; - QString cclimgpath=""; - - QList m_pResultList; -private: - -}; - -#endif diff --git a/logPlus/PropertyWidget.cpp b/logPlus/PropertyWidget.cpp index 8f983b1..9d4ccc1 100644 --- a/logPlus/PropertyWidget.cpp +++ b/logPlus/PropertyWidget.cpp @@ -662,6 +662,8 @@ void PropertyWidget::SlotPropertyChanged( QtProperty *pProperty, const QVariant return; } + + } } } @@ -1216,6 +1218,11 @@ void PropertyWidget::SlotPropertyChanged( QtProperty *pProperty, const QVariant emit CallManage::getInstance()->sig_changeFacShow(m_formInfo->m_strUuid, m_formInfo->m_strSlfName, m_formInfo->m_strWellName, m_formInfo->m_strTrackName, m_formInfo->m_strLineName, m_propertyData[pProperty], bShow); } } + else if (m_strCurrentProperty == Tubing_Property)//套管组件 + { + //先处理通用属性 + CommonPropertyChanged(pProperty, variant); + } if("深度比例尺" == m_propertyData[pProperty]) { @@ -2419,10 +2426,15 @@ void PropertyWidget::initProperty(FormInfo *formInfo) //沉积相 this->initFacProperty(formInfo); } - else if(formInfo->m_strType=="SantuyibiaoObject") + else if(formInfo->m_strType=="SantuyibiaoObject") { this->initTvdProperty(formInfo); } + else if (formInfo->m_strType == "TubingstringObject") + { + //套管组件 + this->initTubingProperty(formInfo); + } } void PropertyWidget::initRoseProperty(FormInfo *formInfo) @@ -3124,3 +3136,15 @@ void PropertyWidget::initFacProperty(FormInfo *formInfo) m_strCurrentProperty = Fac_Property; } + +//套管组件 +void PropertyWidget::initTubingProperty(FormInfo *formInfo) +{ + _CreateVariantPropertyItem("通常", "选择井曲线", m_strLineName + "@" + m_strSlfName, QVariant::String); + + _CreateVariantPropertyItem("对象", "显示名称", formInfo->m_strAliasName, QVariant::String); + _CreateVariantPropertyItem("对象", "字体", formInfo->m_curveNameFont, QVariant::Font); + _CreateVariantPropertyItem("对象", "颜色", formInfo->m_lineColor, QVariant::Color); + + m_strCurrentProperty = Tubing_Property; +} diff --git a/logPlus/PropertyWidget.h b/logPlus/PropertyWidget.h index 9b99d96..f3b959a 100644 --- a/logPlus/PropertyWidget.h +++ b/logPlus/PropertyWidget.h @@ -63,8 +63,12 @@ #define JiegutextItem_Property "JiegutextItem_Property" //气测/FMT/射孔/文本item #define Fac_Property "Fac_Property" //沉积相 + #define Tvd_Property "Tvd_Property" //斜井三图一表 +#define Tubing_Property "Tubing_Property" //套管组件 +#define TubingItem_Property "TubingItem_Property" //套管组件item + #pragma execution_character_set("utf-8") /** @@ -206,6 +210,10 @@ public: // 斜井三图一表属性 void initTvdProperty(FormInfo *formInfo); void ChangTvdProperty( QtProperty *pProperty, const QVariant &variant ); + + //套管组件 + void initTubingProperty(FormInfo *formInfo); + void ChangFillProperty();//填充属性改变 void ChangHeadItemProperty();//图头项改变 diff --git a/logPlus/TransparentDraggableFac.cpp b/logPlus/TransparentDraggableFac.cpp index d4d4eb4..d960481 100644 --- a/logPlus/TransparentDraggableFac.cpp +++ b/logPlus/TransparentDraggableFac.cpp @@ -83,7 +83,7 @@ void TransparentDraggableFac::deleteRect() //mPlot->removeItem(mPixmap); mPlot->removeItem(mItemTitle); - mPlot->replot(); + //mPlot->replot(); this->deleteLater(); // diff --git a/logPlus/TransparentDraggableGeoLith.cpp b/logPlus/TransparentDraggableGeoLith.cpp index 191ab99..48f5693 100644 --- a/logPlus/TransparentDraggableGeoLith.cpp +++ b/logPlus/TransparentDraggableGeoLith.cpp @@ -501,7 +501,7 @@ void TransparentDraggableGeoLith::deleteRect() mPlot->removeItem(mPixmap_Color); mPlot->removeItem(mItemTitle); - mPlot->replot(); + //mPlot->replot(); this->deleteLater(); // @@ -611,6 +611,7 @@ void TransparentDraggableGeoLith::onDelRect() //mDragMode = DragNone; //删除框图 deleteRect(); + mPlot->replot(); //保存 mPlot->SaveToSLF_GeoLith(); //属性清空 diff --git a/logPlus/TransparentDraggableGujing.cpp b/logPlus/TransparentDraggableGujing.cpp index fac748d..0a7f2eb 100644 --- a/logPlus/TransparentDraggableGujing.cpp +++ b/logPlus/TransparentDraggableGujing.cpp @@ -230,7 +230,7 @@ void TransparentDraggableGujing::deleteRect() mPlot->removeItem(mPixmap); mPlot->removeItem(mItemTitle); - mPlot->replot(); + //mPlot->replot(); this->deleteLater(); // @@ -336,6 +336,7 @@ void TransparentDraggableGujing::onDelRect() //mDragMode = DragNone; //删除框图 deleteRect(); + mPlot->replot(); //保存 mPlot->SaveToSLF_Gujing(); //属性清空 diff --git a/logPlus/TransparentDraggableJiegutext.cpp b/logPlus/TransparentDraggableJiegutext.cpp index 3fbeea6..e7a9698 100644 --- a/logPlus/TransparentDraggableJiegutext.cpp +++ b/logPlus/TransparentDraggableJiegutext.cpp @@ -131,7 +131,7 @@ void TransparentDraggableJiegutext::deleteRect() mPlot->removeItem(pLine[i]); } - mPlot->replot(); + //mPlot->replot(); this->deleteLater(); // @@ -227,6 +227,7 @@ void TransparentDraggableJiegutext::onDelRect() { //删除框图 deleteRect(); + mPlot->replot(); //保存 mPlot->SaveToSLF_Jiegutext(); //属性清空 diff --git a/logPlus/TransparentDraggableLayer.cpp b/logPlus/TransparentDraggableLayer.cpp index 78d4d81..9e40456 100644 --- a/logPlus/TransparentDraggableLayer.cpp +++ b/logPlus/TransparentDraggableLayer.cpp @@ -207,7 +207,7 @@ void TransparentDraggableLayer::deleteRect() mPlot->removeItem(mPixmap); mPlot->removeItem(mItemTitle); - mPlot->replot(); + //mPlot->replot(); this->deleteLater(); } } @@ -279,6 +279,7 @@ void TransparentDraggableLayer::onDelRect() //mDragMode = DragNone; //删除框图 deleteRect(); + mPlot->replot(); //保存 mPlot->SaveToSLF_Layer(); //属性清空 diff --git a/logPlus/TransparentDraggableLine.cpp b/logPlus/TransparentDraggableLine.cpp index 08d7f56..a4ccd77 100644 --- a/logPlus/TransparentDraggableLine.cpp +++ b/logPlus/TransparentDraggableLine.cpp @@ -77,7 +77,7 @@ void TransparentDraggableLine::deleteRect() mPlot->removeItem(qcpItemLine); - mPlot->replot(); + //mPlot->replot(); this->deleteLater(); } } @@ -108,6 +108,7 @@ void TransparentDraggableLine::onDelRect() //mDragMode = DragNone; //删除框图 deleteRect(); + mPlot->replot(); } diff --git a/logPlus/TransparentDraggableMFac.cpp b/logPlus/TransparentDraggableMFac.cpp index 999fae9..0dfd49b 100644 --- a/logPlus/TransparentDraggableMFac.cpp +++ b/logPlus/TransparentDraggableMFac.cpp @@ -136,7 +136,7 @@ void TransparentDraggableMFac::deleteRect() //mPlot->removeItem(mPixmap); mPlot->removeItem(mItemTitle); - mPlot->replot(); + //mPlot->replot(); this->deleteLater(); // @@ -250,6 +250,7 @@ void TransparentDraggableMFac::onDelRect() //mDragMode = DragNone; //删除框图 deleteRect(); + //mPlot->replot(); //保存 mPlot->SaveToSLF_Fac(); //刷新 bAdd不支持true,否则崩溃,因为发消息的item本身会被删除,无法继续后续处理 diff --git a/logPlus/TransparentDraggablePhase.cpp b/logPlus/TransparentDraggablePhase.cpp index 8d1d9a6..4d6c460 100644 --- a/logPlus/TransparentDraggablePhase.cpp +++ b/logPlus/TransparentDraggablePhase.cpp @@ -104,7 +104,7 @@ void TransparentDraggablePhase::deleteRect() //mPlot->removeItem(mPixmap); mPlot->removeItem(mItemTitle); - mPlot->replot(); + //mPlot->replot(); this->deleteLater(); // diff --git a/logPlus/TransparentDraggableRect.cpp b/logPlus/TransparentDraggableRect.cpp index e796b7f..674ee2c 100644 --- a/logPlus/TransparentDraggableRect.cpp +++ b/logPlus/TransparentDraggableRect.cpp @@ -89,7 +89,7 @@ void TransparentDraggableRect::deleteRect() mPlot->removeItem(mPixmap); mPlot->removeItem(mItemTitle); - mPlot->replot(); + //mPlot->replot(); this->deleteLater(); } } @@ -161,6 +161,7 @@ void TransparentDraggableRect::onDelRect() //mDragMode = DragNone; //删除框图 deleteRect(); + mPlot->replot(); //保存 mPlot->SaveToSLF_Text(); //属性清空 diff --git a/logPlus/TransparentDraggableResult.cpp b/logPlus/TransparentDraggableResult.cpp index 1003677..196fb93 100644 --- a/logPlus/TransparentDraggableResult.cpp +++ b/logPlus/TransparentDraggableResult.cpp @@ -413,6 +413,7 @@ void TransparentDraggableResult::onDelRect() //mDragMode = DragNone; //删除框图 deleteRect(); + mPlot->replot(); } void TransparentDraggableResult::onMousePress(QMouseEvent *event) diff --git a/logPlus/TransparentDraggableSwallCore.cpp b/logPlus/TransparentDraggableSwallCore.cpp index 4665c34..23de729 100644 --- a/logPlus/TransparentDraggableSwallCore.cpp +++ b/logPlus/TransparentDraggableSwallCore.cpp @@ -351,7 +351,7 @@ void TransparentDraggableSwallCore::deleteRect() mPlot->removeItem(m_qcpItemLine2); mPlot->removeItem(m_qcpItemLine3); - mPlot->replot(); + //mPlot->replot(); this->deleteLater(); // @@ -452,6 +452,7 @@ void TransparentDraggableSwallCore::onDelRect() //mDragMode = DragNone; //删除框图 deleteRect(); + mPlot->replot(); //保存 mPlot->SaveToSLF_SwallCore(); //属性清空 diff --git a/logPlus/TransparentGroupResult.cpp b/logPlus/TransparentGroupResult.cpp index b286d47..96355ad 100644 --- a/logPlus/TransparentGroupResult.cpp +++ b/logPlus/TransparentGroupResult.cpp @@ -440,7 +440,7 @@ void TransparentGroupResult::deleteRect() mPlot->removeItem(mItemTitle); mPlot->removeItem(mDragLine); - mPlot->replot(); + //mPlot->replot(); this->deleteLater(); } @@ -698,6 +698,7 @@ void TransparentGroupResult::onDelRect() //mDragMode = DragNone; //删除框图 deleteRect(); + mPlot->replot(); } void TransparentGroupResult::onMousePress(QMouseEvent *event) diff --git a/logPlus/formdraw.cpp b/logPlus/formdraw.cpp index 4285e9c..05b4eec 100644 --- a/logPlus/formdraw.cpp +++ b/logPlus/formdraw.cpp @@ -10,7 +10,6 @@ #include #include "Gradient.h" #include "PickFrac.h" -#include "ObjTubingstringResult.h" #include "DrawNrad.h" #include "formline.h" @@ -94,7 +93,7 @@ FormDraw::FormDraw(QWidget *parent, QString strWellName, QString strTrackName) : connect(CallManage::getInstance(), SIGNAL(sig_AddMCals(QString, QString, QString, QString, QString, int)), this, SLOT(s_addMCals(QString, QString, QString, QString, QString,int))); //套管组件 - connect(CallManage::getInstance(), SIGNAL(sig_AddTubingstring(QString, QString, QString, QString, QString, int)), this, SLOT(s_addTubingstring(QString, QString, QString, QString, QString,int))); + connect(CallManage::getInstance(), SIGNAL(sig_AddTubingstring(QString, QString, QString, QString, QString, int, QStringList)), this, SLOT(s_addTubingstring(QString, QString, QString, QString, QString,int, QStringList))); //改变固井曲线名 connect(CallManage::getInstance(), SIGNAL(sig_changeGujingLine(QString, QString, QString, QString, QString, QString)), this, SLOT(s_changeGujingLine(QString, QString, QString, QString, QString, QString))); @@ -318,6 +317,11 @@ void FormDraw::DisplayLines(QJsonArray linesArray) //沉积相 DisplayFac_One(lineObjInfo); } + else if (strType == "TubingstringObject") + { + //套管组件 + DisplayTubing_One(lineObjInfo); + } else { DisplayType_One(lineObjInfo); @@ -762,6 +766,91 @@ void FormDraw::DisplayFac_One(QJsonObject lineObjInfo) } } +//套管組件 +void FormDraw::DisplayTubing_One(QJsonObject lineObjInfo) +{ + QString strSlfName = ""; + QString strWellName = ""; + QString strLineName = ""; + QString strAliasName = "";//显示名称 + QFont curveNameFont("微软雅黑", 10); // 名称字体 + QColor lineColor = QColor(0, 0, 0);//颜色 + + if (lineObjInfo.contains("SlfName")) + { + QJsonValue value = lineObjInfo.value("SlfName"); + if (value.isString()) { + strSlfName = value.toString(); + //qDebug() << "SlfName:" << strSlfName; + + // + QString slffilename = QString(""); + int ind = strSlfName.lastIndexOf('\\'); + int ind2 = strSlfName.lastIndexOf('/'); + if (ind2 > ind) ind = ind2; + if (ind > -1) { + slffilename = strSlfName.mid(ind + 1); + strSlfName = slffilename; + } + } + } + if (lineObjInfo.contains("WellName")) + { + QJsonValue value = lineObjInfo.value("WellName"); + if (value.isString()) { + strWellName = value.toString(); + //qDebug() << "WellName:" << strWellName; + } + } + if (lineObjInfo.contains("LineName")) + { + QJsonValue value = lineObjInfo.value("LineName"); + if (value.isString()) { + strLineName = value.toString(); + //qDebug() << "LineName:" << strLineName; + } + } + if (lineObjInfo.contains("AliasName")) + { + QJsonValue value = lineObjInfo.value("AliasName"); + if (value.isString()) { + strAliasName = value.toString(); + //qDebug() << "strAliasName:" << strAliasName; + } + } + //字体 + if (lineObjInfo.contains("curveNameFont")) + { + QJsonValue value = lineObjInfo.value("curveNameFont"); + if (value.isString()) { + curveNameFont.fromString(value.toString()); + //qDebug() << "strUnit:" << strUnit; + } + } + // + if (lineObjInfo.contains("lineColor")) + { + lineColor.setNamedColor(lineObjInfo.value("lineColor").toString()); + } + + + + QString folderPath = GetLogdataPath(); + folderPath = folderPath + g_prjname; + strSlfName = folderPath + "/" + "#" + strWellName + "/" + strSlfName; + + if (strLineName != "") + { + QStringList listOtherProperty; + listOtherProperty.append(strAliasName);//别名 + listOtherProperty.append(lineColor.name());//名称颜色 + listOtherProperty.append(curveNameFont.toString());//名称字体 + + //套管組件 + this->s_addTubingstring(m_strUuid, strSlfName, strWellName, m_strTrackName, strLineName, 0, listOtherProperty); // + } +} + void FormDraw::DisplayLine_One(QJsonObject lineObjInfo) { QString strSlfName = ""; @@ -2847,7 +2936,7 @@ void FormDraw::s_addMCals(QString strUuid, QString strSlfName, QString strWellNa } //套管组件 -void FormDraw::s_addTubingstring(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, int nW) +void FormDraw::s_addTubingstring(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, int nW, QStringList listOtherProperty) { //井名&道名不一致 if(strUuid == m_strUuid && m_strWellName == strWellName && m_strTrackName == strTrackName) @@ -2922,9 +3011,8 @@ void FormDraw::s_addTubingstring(QString strUuid, QString strSlfName, QString st curv->yAxis2->setTicks(false); //套管组件 - QString strWaveName = "TUBTOOLS"; - CObjTubingstringResult *objTubingstringResult = new CObjTubingstringResult(); - objTubingstringResult->LoadFromSLF(curv, strSlfName, strWaveName); + //QString strWaveName = "TUBTOOLS"; + curv->LoadFromSLF_Tubing(strSlfName, strLineName); // connect(curv, SIGNAL(mouseWheel(QWheelEvent*)), this, SLOT(s_mouseWheel(QWheelEvent*))); @@ -2933,12 +3021,18 @@ void FormDraw::s_addTubingstring(QString strUuid, QString strSlfName, QString st m_listTableName.push_back(strLineName); QString strAliasName = "套管组件"; - QString strUnit = ""; QColor newlineColor=QColor(0,0,0); + if(listOtherProperty.size()>=3) + { + strAliasName = listOtherProperty[0]; + newlineColor.setNamedColor(listOtherProperty[1]); + } + + QString strUnit = ""; double width=2; QString strScaleType = ""; //道-对象 - m_formTrack->Add(strSlfName, m_strWellName, m_strTrackName, strWaveName, strAliasName, strUnit, newlineColor, width, m_RightVal, m_LeftVal, strScaleType, "TubingstringObject"); + m_formTrack->Add(strSlfName, m_strWellName, m_strTrackName, strLineName, strAliasName, strUnit, newlineColor, width, m_RightVal, m_LeftVal, strScaleType, "TubingstringObject", listOtherProperty); } void FormDraw::initForm(QMyCustomPlot *widget, QString strSlfName, QString strLineName, diff --git a/logPlus/formdraw.h b/logPlus/formdraw.h index 69c0a82..dd9d363 100644 --- a/logPlus/formdraw.h +++ b/logPlus/formdraw.h @@ -69,6 +69,9 @@ public: //沉积相 void DisplayFac_One(QJsonObject lineObjInfo); + //套管組件 + void DisplayTubing_One(QJsonObject lineObjInfo); + // 跨道设置 void crossTrackSetting(); @@ -263,7 +266,7 @@ public slots: void s_addMCals(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, int nW); //套管组件 - void s_addTubingstring(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, int nW); + void s_addTubingstring(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, int nW, QStringList listOtherProperty); //TDT // void s_addTDT(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, int nW); diff --git a/logPlus/forminfo.cpp b/logPlus/forminfo.cpp index d47da8e..e12738c 100644 --- a/logPlus/forminfo.cpp +++ b/logPlus/forminfo.cpp @@ -181,6 +181,13 @@ QJsonObject FormInfo::makeJson() //item属性写入slf文件,不需要此次记录 return rootObj; } + else if (m_strType == "TubingstringObject") + { + //套管组件 + + //item属性写入slf文件,不需要此次记录 + return rootObj; + } rootObj["Unit"] = m_strUnit; rootObj["Width"] = m_dWidth; @@ -1089,6 +1096,14 @@ void FormInfo::contextMenuEvent(QContextMenuEvent *event) menu.addAction(QIcon(::GetImagePath() + "icon/Delete.png"), "删除当前对象", this, &FormInfo::onDeleteTable); menu.exec(event->globalPos()); } + else if(m_strType=="TubingstringObject") + { + //套管组件 + QMenu menu(this); + menu.addAction(QIcon(::GetImagePath() + "icon/Sheet.png"), "数据对象查看", this, &FormInfo::onShowTable); + menu.addAction(QIcon(::GetImagePath() + "icon/Delete.png"), "删除当前对象", this, &FormInfo::onDeleteTable); + menu.exec(event->globalPos()); + } } //曲线数据查看 diff --git a/logPlus/formtrack.cpp b/logPlus/formtrack.cpp index 2a678cb..df964fb 100644 --- a/logPlus/formtrack.cpp +++ b/logPlus/formtrack.cpp @@ -107,8 +107,8 @@ FormTrack::FormTrack(QWidget *parent, QString strWellName, QString strTrackName) this, SLOT(s_addMCals(QString, QString, QString, QString, QString, QString, QColor, double, float, float, QString))); //套管组件 - connect(this, SIGNAL(sig_AddTubingstring(QString, QString, QString, QString, QString, QString, QColor, double, float, float, QString)), - this, SLOT(s_addTubingstring(QString, QString, QString, QString, QString, QString, QColor, double, float, float, QString))); + connect(this, SIGNAL(sig_AddTubingstring(QString, QString, QString, QString, QString, QString, QColor, double, float, float, QString, QStringList)), + this, SLOT(s_addTubingstring(QString, QString, QString, QString, QString, QString, QColor, double, float, float, QString, QStringList))); //曲线选中,置顶 connect(CallManage::getInstance(), SIGNAL(sig_Raise(QString, QString, QString, QString, QString, int, QString)), this, SLOT(s_Raise(QString, QString, QString, QString, QString, int, QString))); @@ -267,7 +267,7 @@ void FormTrack::Add(QString strSlfName, QString strWellName, QString strTrackNam } else if(strType=="TubingstringObject") { - emit sig_AddTubingstring(strSlfName, strWellName, m_strTrackName, strLineName, strAliasName, strUnit, lineColor, dWidth, vmax, vmin, strScaleType); + emit sig_AddTubingstring(strSlfName, strWellName, m_strTrackName, strLineName, strAliasName, strUnit, lineColor, dWidth, vmax, vmin, strScaleType, listOtherProperty); } } @@ -1078,7 +1078,7 @@ void FormTrack::s_addMCals(QString strSlfName, QString strWellName, QString strT } //套管 -void FormTrack::s_addTubingstring(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString strAliasName, QString strUnit, QColor lineColor, double dWidth, float vmax, float vmin, QString strScaleType) +void FormTrack::s_addTubingstring(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString strAliasName, QString strUnit, QColor lineColor, double dWidth, float vmax, float vmin, QString strScaleType, QStringList listOtherProperty) { qDebug() << "FormTrack s_addTubingstring"; @@ -1103,6 +1103,13 @@ void FormTrack::s_addTubingstring(QString strSlfName, QString strWellName, QStri formInfo->setVMin(vmin); formInfo->setFrontColor(QColor(0,0,0)); formInfo->setBackColor(QColor(255,255,255)); + // + if(listOtherProperty.size()>=3) + { + QFont curveNameFont("微软雅黑", 10); // 名称字体 + curveNameFont.fromString(listOtherProperty[2]); + formInfo->m_curveNameFont = curveNameFont; + } //设置高度 ui->tableWidget->setRowHeight(row, 100); //单元格委托 diff --git a/logPlus/formtrack.h b/logPlus/formtrack.h index 8093278..3f1c6df 100644 --- a/logPlus/formtrack.h +++ b/logPlus/formtrack.h @@ -94,7 +94,7 @@ signals: void sig_AddJiegutext(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString strAliasName, QString strUnit, QColor lineColor, double dWidth, float vmax, float vmin, QString strScaleType, QStringList listOtherProperty={}); void sig_AddLogface(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString strAliasName, QString strUnit, QColor lineColor, double dWidth, float vmax, float vmin, QString strScaleType, QStringList listOtherProperty={}); void sig_AddMCals(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString strAliasName, QString strUnit, QColor lineColor, double dWidth, float vmax, float vmin, QString strScaleType); - void sig_AddTubingstring(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString strAliasName, QString strUnit, QColor lineColor, double dWidth, float vmax, float vmin, QString strScaleType); + void sig_AddTubingstring(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString strAliasName, QString strUnit, QColor lineColor, double dWidth, float vmax, float vmin, QString strScaleType, QStringList listOtherProperty={}); public slots: void s_addLine(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString strAliasName, QString strUnit, QColor lineColor, double dWidth, float vmax, float vmin, QString strScaleType, QStringList listOtherProperty={}); @@ -116,7 +116,7 @@ public slots: void s_addJiegutext(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString strAliasName, QString strUnit, QColor lineColor, double dWidth, float vmax, float vmin, QString strScaleType, QStringList listOtherProperty={}); void s_addLogface(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString strAliasName, QString strUnit, QColor lineColor, double dWidth, float vmax, float vmin, QString strScaleType, QStringList listOtherProperty={}); void s_addMCals(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString strAliasName, QString strUnit, QColor lineColor, double dWidth, float vmax, float vmin, QString strScaleType); - void s_addTubingstring(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString strAliasName, QString strUnit, QColor lineColor, double dWidth, float vmax, float vmin, QString strScaleType); + void s_addTubingstring(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString strAliasName, QString strUnit, QColor lineColor, double dWidth, float vmax, float vmin, QString strScaleType, QStringList listOtherProperty={}); void s_addTDT(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString strAliasName, QString strUnit, QColor lineColor, double dWidth, float vmax, float vmin, QString strScaleType); void s_Raise(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, int iTableType, QString strFormInfoType); diff --git a/logPlus/logPlus.pro b/logPlus/logPlus.pro index 68a1648..890a682 100644 --- a/logPlus/logPlus.pro +++ b/logPlus/logPlus.pro @@ -39,7 +39,6 @@ SOURCES += \ Gradient.cpp \ InDefTableDlg.cpp \ InterfaceWidget.cpp \ - ObjTubingstringResult.cpp \ PickFrac.cpp \ PropertyWidget.cpp \ QCPSizeHandle.cpp \ @@ -103,7 +102,6 @@ HEADERS += \ Gradient.h \ InDefTableDlg.h \ InterfaceWidget.h \ - ObjTubingstringResult.h \ PickFrac.h \ PropertyWidget.h \ QCPSizeHandle.h \ diff --git a/logPlus/mainwindowcurve.cpp b/logPlus/mainwindowcurve.cpp index e1175a4..087fb7e 100644 --- a/logPlus/mainwindowcurve.cpp +++ b/logPlus/mainwindowcurve.cpp @@ -3273,7 +3273,18 @@ void MainWindowCurve::s_NewMCals() //套管组件 void MainWindowCurve::s_NewTubingstring() { - QStringList sret = this->getSelectWell(); +// QStringList sret = this->getSelectWell(); +// if(sret.length() <= 0) +// return; + + //选中道 + if(m_SelectTableItem.m_iTableType==2) { + //新建表格曲线 + emit CallManage::getInstance()->sig_AddTableLine(m_strUuid, m_SelectTableItem.m_strSlfName, m_SelectTableItem.m_strWellName, m_SelectTableItem.m_strTrackName, "IMAGE_DATA"); + return; + } + + QStringList sret = this->getSelectWell_New(); if(sret.length() <= 0) return; diff --git a/logPlus/qmycustomplot.cpp b/logPlus/qmycustomplot.cpp index 298eb7e..3e2174d 100644 --- a/logPlus/qmycustomplot.cpp +++ b/logPlus/qmycustomplot.cpp @@ -68,6 +68,13 @@ QMyCustomPlot::QMyCustomPlot(QWidget *parent, QString strSlfName, QString strWel xAxis2->setTickLabels(false); yAxis2->setTickLabels(false); + //套管组件 + zoneOrder_Tubing.clear(); + if(zoneOrder_Tubing.size()==0) + { + zoneOrder_Tubing=GetZoneOrder(QString("TubTools.ini")); + } + connect(this->selectionRect(), &QCPSelectionRect::accepted, this, &QMyCustomPlot::slotSelectionRectAccepted); // make bottom and left axes transfer their ranges to top and right axes: connect(xAxis, SIGNAL(rangeChanged(QCPRange)), xAxis2, SLOT(setRange(QCPRange))); @@ -1299,6 +1306,26 @@ void QMyCustomPlot::contextMenuEvent(QContextMenuEvent *event) //menu.addAction(QIcon(::GetImagePath() + "icon/Layer.png"), "沉积相自动描述", this, &QMyCustomPlot::ChangeDep); menu.exec(event->globalPos()); } + else if (strType == "TubingstringObject") + { + QStringList strs=zoneOrder_Tubing.keys(); + QStringList mstrs=QString("油管接箍,套管接箍,偏配,封隔器,筛管,喇叭口,水力猫,短接,管底部,油管深").split(","); + QMenu menu(this); + QMenu *pSubMenu = menu.addMenu("特殊工具"); + //套管组件 + for(int i=0;i-1) { + menu.addAction(QIcon(::GetImagePath() + "icon/OneSideWallCore.png"), str, this, &QMyCustomPlot::addItem_Tubing); + } + else { + pSubMenu->addAction(QIcon(::GetImagePath() + "icon/OneSideWallCore.png"), str, this, &QMyCustomPlot::addItem_Tubing); + } + } + //menu.addAction(QIcon(::GetImagePath() + "icon/OneSideWallCore.png"), "添加偏配", this, &QMyCustomPlot::addItem_Tubing); + menu.exec(event->globalPos()); + } } //右键--添加分段线 @@ -7824,6 +7851,29 @@ bool QMyCustomPlot::LoadFromSLF_Fac(QString strSlfName, QString csCurve, bool bA return true; } +//添加套管组件 +void QMyCustomPlot::addItem_Tubing() +{ + double right_Hight = xAxis->pixelToCoord(m_event->pos().y());//x轴展示深度 + + QAction *pAct=dynamic_cast(sender()); + if(pAct){ + QString str=pAct->text(); + str.remove("添加"); + int i=zoneOrder_Tubing[str].toInt(); + if(i>-1) { + Slf_JIEGUPOS result; + result.Depth=-right_Hight; + result.Order=0; + result.Number=i; + // + drawOne_Tubing(result); + //保存 + SaveToSLF_Tubing(); + } + } +} + //添加沉积相 void QMyCustomPlot::addItem_Fac() { @@ -8042,3 +8092,263 @@ void QMyCustomPlot::RefreshItems_Fac(bool bAdd) //属性清空 //PropertyService()->InitCurrentViewInfo(); } + + +bool QMyCustomPlot::LoadFromSLF_Tubing(QString strSlfName, QString csCurve) +{ + m_pResultList_Tubing.clear(); + + cclimgpath_Tubing=GetSymbolDir()+"\\管柱组件\\"; + + Slf_JIEGUPOS *m_pResult=NULL; + CMemRdWt *logio=new CMemRdWt(); + if(strSlfName==""||!logio->Open(strSlfName.toStdString().c_str(),CSlfIO::modeRead)) + { + delete logio; +// QMessageBox::information(NULL,"提示","SLF文件打开失败,请检查!!",QMessageBox::Yes); + return false; + } + + + int iIndex=logio->OpenTable(csCurve.toStdString().c_str()); + if(iIndex>-1) { + int count=logio->GetTableRecordCount(iIndex); + //int fieldnum=logio->GetTableFieldCount(iIndex); + int len=logio->GetTableRecordLength(iIndex); + m_pResult=(Slf_JIEGUPOS *)new char[len+1]; + char buf[200]; + logio->IsChange=true; + + bool bDrawGuanzhu = false; + for(int i=0;iReadTable(iIndex,i+1,m_pResult); + + Slf_JIEGUPOS result; + result.Depth=m_pResult->Depth; + result.Order=m_pResult->Order; + result.Number=m_pResult->Number; + m_pResultList_Tubing.append(result); + + // + double depth=m_pResult->Depth; + int Order=m_pResult->Order; + int Number=m_pResult->Number; + + if(bDrawGuanzhu == false) + { + //还没有画管柱 + if(Number == zoneOrder_Tubing.value("管底部").toInt()|| + Number == zoneOrder_Tubing.value("油管深").toInt()|| + Number == zoneOrder_Tubing.value("喇叭口").toInt()|| + Number == zoneOrder_Tubing.value("剌叭口").toInt()) + { + bDrawGuanzhu = true;//画管柱 + + QString shotimgfile=GetSymbolDir()+"\\管柱组件\\管柱.png"; + //QImage shotimg(shotimgfile); + //pPainter->drawImage(rect,shotimg); + + double lY1 = this->yAxis->range().lower;//+10 + double lY2 = this->yAxis->range().upper; + QCPItemPixmap *mPixmap; + mPixmap = new QCPItemPixmap(this); + //mPixmap->setPixmap(QPixmap(":/image/file.png")); // 设置图片 + mPixmap->setScaled(true, Qt::IgnoreAspectRatio); // 设置缩放方式 + mPixmap->setLayer("overlay"); // 确保在最上层 + // + float upper = this->xAxis->range().upper; + mPixmap->topLeft->setCoords(upper, lY1 + (lY2-lY1-m_Oguan_Tubing)/2.0); + mPixmap->bottomRight->setCoords(-depth, lY2 - (lY2-lY1-m_Oguan_Tubing)/2.0); + mPixmap->setPixmap(QPixmap(shotimgfile)); // 设置图片 + } + } + } + logio->CloseTable(iIndex); + delete m_pResult; + } + delete logio; + + for(int i=0; ixAxis->coordToPixel(-depth)-h/2.0; + float lower = this->xAxis->coordToPixel(-depth)+h/2.0; + float newUpper = this->xAxis->pixelToCoord(upper); + float newLower = this->xAxis->pixelToCoord(lower); + this->addGuanToPlot(newLower, newUpper, cclimgfile, in); + +// QString cclimgfile=cclimgpath+name+".png"; +// double lY1 = widget->yAxis->range().lower;//+10 +// double lY2 = widget->yAxis->range().upper; +// QCPItemPixmap *mPixmap; +// mPixmap = new QCPItemPixmap(widget); +// mPixmap->setScaled(true, Qt::IgnoreAspectRatio); // 设置缩放方式 +// mPixmap->setLayer("overlay"); // 确保在最上层 +// // +// float upper = widget->xAxis->coordToPixel(-depth)-h/2.0; +// float lower = widget->xAxis->coordToPixel(-depth)+h/2.0; +// float newUpper = widget->xAxis->pixelToCoord(upper); +// float newLower = widget->xAxis->pixelToCoord(lower); +// mPixmap->topLeft->setCoords(newUpper, lY1 + (lY2-lY1-in)/2.0); +// mPixmap->bottomRight->setCoords(newLower, lY2 - (lY2-lY1-in)/2.0); +// mPixmap->setPixmap(QPixmap(cclimgfile)); // 设置图片 +} + +bool QMyCustomPlot::SaveToSLF_Tubing() +{ + static int isrun=false; + if(isrun) return false; + QString ss=m_strSlfName; + if(ss=="") return false; + isrun=true; + + Slf_JIEGUPOS m_Result; + CMemRdWt *logio=new CMemRdWt(); + if(!logio->Open(ss.toStdString().c_str(),CSlfIO::modeReadWrite)) + { + delete logio; + QMessageBox::information(NULL,"提示","SLF文件打开失败,请检查!!",QMessageBox::Yes); + isrun=false; + return false; + } + bool isfirst=false; + int iIndex=logio->OpenTable(m_strLineName.toStdString().c_str()); + if (iIndex < 0) + { + if(!m_mapDraggable_Guan.size()) { + delete logio; + isrun=false; + return false; + } + if(m_strLineName.indexOf("READCCL",0,Qt::CaseInsensitive)>-1) { + iIndex=logio->Open_Set_Table(m_strLineName.toStdString().c_str(),0,3, + "NO,DEPTH,NUMBER", + "4,4,4",//字段长度 + "1,4,4",//字段类型 + "0,0,0");//字段备注,1-枚举 + } + else iIndex=logio->Open_Set_Table(m_strLineName.toStdString().c_str(),0,4, + "NO,DEPTH,NUMBER,DEST", + "4,4,4,64",//字段长度 + "1,4,4,6",//字段类型 + "0,0,8,0");//字段备注,1-枚举 + isfirst=true; + } + logio->IsChange=true; + logio->SetTableRecordCount(iIndex,m_mapDraggable_Guan.size()); + if(!m_mapDraggable_Guan.size()) { + delete logio; + if(isfirst)AddTableToWellRound(); + isrun=false; + return false; + } + int len=logio->GetTableRecordLength(iIndex); + + TransparentDraggableGuan *pDraggableRect =NULL; + //排序 + QList listSDepth; + for (QMap::Iterator iter = m_mapDraggable_Guan.begin(); iter != m_mapDraggable_Guan.end(); iter++) + { + pDraggableRect = (TransparentDraggableGuan*)iter.value(); + // + QCPRange tmpRange = pDraggableRect->getRange(); + // + float fSDepth = -tmpRange.upper; + listSDepth.append(fSDepth); + } + qSort(listSDepth); + + // + for(int i=0; i::Iterator iter = m_mapDraggable_Guan.begin(); iter != m_mapDraggable_Guan.end(); iter++) + { + pDraggableRect = (TransparentDraggableGuan*)iter.value(); + // + QCPRange tmpRange = pDraggableRect->getRange(); + float fSDepth = -tmpRange.upper; + float fEDepth = -tmpRange.lower; + if(fSDepth == listSDepth[i])//按顺序写入 + { + memset(&m_Result,0,len); + m_Result.Order=i+1; + m_Result.Depth=(fSDepth+fEDepth)/2.0; + // + QString name,itemName; + pDraggableRect->m_Result.replace("\\","/"); + int l=pDraggableRect->m_Result.lastIndexOf("/"); + if(l>-1) name=pDraggableRect->m_Result.mid(l+1); + l=name.indexOf("."); + name=name.left(l); + itemName=name; + // + m_Result.Number=zoneOrder_Tubing.value(itemName).toInt(); + if(len==sizeof(Slf_JIEGUPOS)) { + strncpy(m_Result.Dest,"",64); + m_Result.Dest[63]=0; + } + logio->WriteTable(iIndex,i+1,&m_Result); + } + } + } + logio->CloseTable(iIndex); + delete logio; + if(isfirst)AddTableToWellRound(); + isrun=false; + return true; +} diff --git a/logPlus/qmycustomplot.h b/logPlus/qmycustomplot.h index 0d34465..133a083 100644 --- a/logPlus/qmycustomplot.h +++ b/logPlus/qmycustomplot.h @@ -270,6 +270,18 @@ public: //保存 void SaveToSLF_Fac(); + //套管組件 + QMap zoneOrder_Tubing; + float m_Oguan_Tubing = 63.5; + float m_Oind_Tubing = 121.36; + bool m_bDrawCCL_Tubing = false; + QString cclimgpath_Tubing=""; + QList m_pResultList_Tubing; + QString m_strAddTubing=""; + bool LoadFromSLF_Tubing(QString strSlfName, QString csCurve); + void drawOne_Tubing(Slf_JIEGUPOS result); + bool SaveToSLF_Tubing(); + public slots: void slot_time(); @@ -439,6 +451,10 @@ public slots: void addItem_Fac(); //添加沉积相 void RefreshItems_Fac(bool bAdd=true); //刷新数据 + //右键--套管组件 + void addItem_Tubing(); //添加套管组件 + //void RefreshItems_Tubing(); //刷新数据 + //右键--解释结论 void onOpenEditResult(); void onCloseEditResult(); diff --git a/logPlus/transparentdraggableGuan.cpp b/logPlus/transparentdraggableGuan.cpp index 5dacd12..265dce1 100644 --- a/logPlus/transparentdraggableGuan.cpp +++ b/logPlus/transparentdraggableGuan.cpp @@ -1,5 +1,6 @@ #include "transparentdraggableGuan.h" - +#include "PropertyWidget.h" +#include "CallManage.h" extern double g_dPixelPerCm;//每厘米像素数 //static GeoIndicatorGenerator m_drawGeo; @@ -236,20 +237,52 @@ void TransparentDraggableGuan::deleteRect() mPlot->removeItem(mPixmap); // mPlot->removeItem(mItemTitle); - mPlot->replot(); + //mPlot->replot(); this->deleteLater(); - - // - // //避免二次绘制框图 - // mPlot->m_bDrawRect = false; - // mDragMode = DragNone; - // //取消选中框 - // mPlot->selectionRect()->cancel(); - // mPlot->replot(); - // mPlot->selectionRect()->mActive=true; } } +//设置深度移动量 +void TransparentDraggableGuan::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); + + { + //保存 + mPlot->SaveToSLF_Tubing(); + + //属性清空 + PropertyService()->InitCurrentViewInfo(); + + //取消所有选中单元格 + emit CallManage::getInstance()->sig_Raise(mPlot->m_strUuid, "", "", "", "", 0, ""); + } +} void TransparentDraggableGuan::initRect() { @@ -317,6 +350,11 @@ void TransparentDraggableGuan::onDelRect() //mDragMode = DragNone; //删除框图 deleteRect(); + mPlot->replot(); + //保存 + mPlot->SaveToSLF_Tubing(); + //属性清空 + PropertyService()->InitCurrentViewInfo(); } @@ -343,19 +381,13 @@ void TransparentDraggableGuan::onMousePress(QMouseEvent *event) //event->accept(); +// double low = mRect->topLeft->coords().x(); +// double hight = mRect->bottomRight->coords().x(); +// PropertyService()->initTubingItemProperty(this, low, hight, m_Result); + QMenu menu(nullptr); - QAction *delAction = menu.addAction("删除框图"); - //delAction->installEventFilter(this); - connect(delAction, &QAction::triggered, this, &TransparentDraggableGuan::onDelRect); - - // QAction* pItem = menu.exec(event->globalPos()); - // if(pItem == delAction) - // { - // //event->accept(); - - // int ii=0; - // ii++; - // } + menu.addAction(QIcon(::GetImagePath() + "icon/Delete.png"), "删除选中对象", this, &TransparentDraggableGuan::onDelRect); + menu.addAction(QIcon(::GetImagePath() + "icon/Shift.png"), "设置深度移动量", this, &TransparentDraggableGuan::setItemDepthOffset); menu.exec(event->globalPos()); return; @@ -393,8 +425,32 @@ void TransparentDraggableGuan::onMousePress(QMouseEvent *event) } +int TransparentDraggableGuan::getCursor() +{ + if (m_bMoveRect) + { + return 2; + } + if (m_bArrow) + { + return 1; + } + return 0; +} + void TransparentDraggableGuan::onMouseMove(QMouseEvent *event) { + if (mDragMode == DragRect) + { + m_bMoveRect = true; + } + else + { + m_bArrow = false; + m_bMoveRect = false; + } + + //-------------------- if(mDragMode == DragNone) return; event->accept(); @@ -487,6 +543,12 @@ void TransparentDraggableGuan::onMouseMove(QMouseEvent *event) } } + //位置改变,鼠标拖动item + if(newRange.lower!= mDragStartRange.lower || newRange.upper!= mDragStartRange.upper) + { + m_bChange = true; + } + setRange(newRange.lower, newRange.upper); } @@ -495,6 +557,21 @@ void TransparentDraggableGuan::onMouseRelease(QMouseEvent *event) { if(event->button() == Qt::LeftButton && mDragMode != DragNone) { event->accept(); + //属性 + { +// double low = mRect->topLeft->coords().x(); +// double hight = mRect->bottomRight->coords().x(); +// PropertyService()->initGujingItemProperty(this, low, hight, m_Result); + if(m_bChange) + { + //保存 + mPlot->SaveToSLF_Tubing(); + } + + //取消所有选中单元格 + emit CallManage::getInstance()->sig_Raise(mPlot->m_strUuid, "", "", "", "", 0, ""); + } + //避免二次绘制框图 mPlot->m_bDrawRect = false; //emit rangeChanged(getRange()); diff --git a/logPlus/transparentdraggableGuan.h b/logPlus/transparentdraggableGuan.h index fa74325..f0b0d55 100644 --- a/logPlus/transparentdraggableGuan.h +++ b/logPlus/transparentdraggableGuan.h @@ -55,14 +55,15 @@ private: void updateHandles() ; private slots: - void onDelRect(); + void onDelRect(); //删除 + 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; @@ -83,6 +84,13 @@ private: // 添加最小宽度成员变量 double mMinWidth; float mIn=123; + + //鼠标形状 + bool m_bArrow = false; + bool m_bMoveRect = false; + int getCursor(); + //鼠标是否拖动item + bool m_bChange = false; }; #endif // TRANSPARENTDRAGGABLEGUAN_H diff --git a/logPlus/transparentdraggableRightList.cpp b/logPlus/transparentdraggableRightList.cpp index c7757c0..236d453 100644 --- a/logPlus/transparentdraggableRightList.cpp +++ b/logPlus/transparentdraggableRightList.cpp @@ -159,7 +159,7 @@ void TransparentDraggableRightList::deleteRect() } mPlot->m_bPriviewRightList = false;//当前是否正在编辑曲线。 - mPlot->replot(); + //mPlot->replot(); this->deleteLater(); // @@ -244,6 +244,7 @@ void TransparentDraggableRightList::onDelRect() //mDragMode = DragNone; //删除框图 deleteRect(); + mPlot->replot(); } diff --git a/logPlus/transparentdraggableSelectRect.cpp b/logPlus/transparentdraggableSelectRect.cpp index ce79e61..d8a61a3 100644 --- a/logPlus/transparentdraggableSelectRect.cpp +++ b/logPlus/transparentdraggableSelectRect.cpp @@ -171,7 +171,7 @@ void TransparentDraggableSelectRect::deleteRect() } mPlot->m_bEditRect = false;//当前是否正在编辑曲线。 - mPlot->replot(); + //mPlot->replot(); this->deleteLater(); // @@ -276,6 +276,7 @@ void TransparentDraggableSelectRect::onDelRect() //mDragMode = DragNone; //删除框图 deleteRect(); + mPlot->replot(); } diff --git a/logPlus/transparentdraggableimage.cpp b/logPlus/transparentdraggableimage.cpp index 0c82e08..91161b4 100644 --- a/logPlus/transparentdraggableimage.cpp +++ b/logPlus/transparentdraggableimage.cpp @@ -284,7 +284,7 @@ void TransparentDraggableImage::deleteRect() mPlot->removeItem(mPixmap); mPlot->removeItem(mItemTitle); - mPlot->replot(); + //mPlot->replot(); this->deleteLater(); // @@ -365,6 +365,7 @@ void TransparentDraggableImage::onDelRect() //mDragMode = DragNone; //删除框图 deleteRect(); + mPlot->replot(); }