diff --git a/CallManage/CallManage.h b/CallManage/CallManage.h index 7c47da5..e475200 100644 --- a/CallManage/CallManage.h +++ b/CallManage/CallManage.h @@ -171,6 +171,8 @@ signals: //改变深度 void sig_changeDepth(QString strUuid, QString strSlfName, QString strWellName, int iY1, int iY2); + void sig_changeWellProperty(QString strSlfName, QString strWellName, QVariantList listVal); + //改变道宽 void sig_changeWidth(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, int iCurrentCol, int iNewWidth); //改变道属性 diff --git a/logPlus/PropertyWidget.cpp b/logPlus/PropertyWidget.cpp index 918172a..cfb118f 100644 --- a/logPlus/PropertyWidget.cpp +++ b/logPlus/PropertyWidget.cpp @@ -1906,7 +1906,14 @@ void PropertyWidget::SlotPropertyChanged( QtProperty *pProperty, const QVariant } else if(m_strCurrentProperty == Well_Property) { - if("开始深度(m)" == m_propertyData[pProperty]) + QString strGroup = ""; + if (1 == pProperty->getParentItem().count()) + { + QtProperty * pParentProperty = *(pProperty->getParentItem().begin()); + strGroup = pParentProperty->propertyName(); + } + QString strPro = m_propertyData[pProperty]; + if("开始深度(m)" == strPro) { //qDebug() << "开始深度(m)->改变"; double newStartDepth = variant.value(); @@ -1918,7 +1925,7 @@ void PropertyWidget::SlotPropertyChanged( QtProperty *pProperty, const QVariant //通知界面 emit CallManage::getInstance()->sig_changeDepth(m_strUuid, m_strSlfName, m_strWellName, m_iY1, m_iY2); } - else if("终止深度(m)" == m_propertyData[pProperty]) + else if("终止深度(m)" == strPro) { //qDebug() << "终止深度(m)->改变"; double newEndDepth = variant.value(); @@ -1930,6 +1937,11 @@ void PropertyWidget::SlotPropertyChanged( QtProperty *pProperty, const QVariant //通知界面 emit CallManage::getInstance()->sig_changeDepth(m_strUuid, m_strSlfName, m_strWellName, m_iY1, m_iY2); } + else + { + QVariantList vlist = { strGroup, strPro, variant }; + emit CallManage::getInstance()->sig_changeWellProperty(m_strSlfName, m_strWellName, vlist); + } } else if(m_strCurrentProperty == Curve_Property) { @@ -2680,7 +2692,7 @@ void PropertyWidget::initWidgetProperty(QString strUuid, int iScale) _CreateVariantPropertyItem("水平格线", "中格线间隔(m)", 2.0, QVariant::Double); } -void PropertyWidget::initWellProperty(QString strUuid, QString strSlfName, QString strWellName, double iY1, double iY2) +void PropertyWidget::initWellProperty(QString strUuid, QString strSlfName, QString strWellName, double iY1, double iY2, FormWell* fWell) { //初始化,清空 InitCurrentViewInfo(); @@ -2698,6 +2710,31 @@ void PropertyWidget::initWellProperty(QString strUuid, QString strSlfName, QStri // _CreateVariantPropertyItem("通常", "开始深度(m)", 0-m_iY2, QVariant::Double); _CreateVariantPropertyItem("通常", "终止深度(m)", 0-m_iY1, QVariant::Double); + + if (fWell) + { + this->initGridProperty("粗网格", QStringList({ "间隔(m)","线宽","颜色","线型" }), fWell->getCuGridProperty()); + this->initGridProperty("中网格", QStringList({ "间隔(m)","线宽","颜色","线型" }), fWell->getZhongGridProperty()); + this->initGridProperty("细网格", QStringList({ "间隔(m)","线宽","颜色","线型" }), fWell->getXiGridProperty()); + this->initGridProperty("边框", QStringList({ "线宽","颜色","线型" }), fWell->getBorderGridProperty()); + } +} + +void PropertyWidget::initGridProperty(QString strGroup, QStringList slist, GridProperty& gridp) +{ + if (strGroup != "边框") + _CreateVariantPropertyItem(strGroup, "间隔(m)", gridp.m_nInv, QVariant::Int); + _CreateVariantPropertyItem(strGroup, "线宽", gridp.m_nWidth, QVariant::Int); + _CreateVariantPropertyItem(strGroup, "颜色", gridp.m_clor, QVariant::Color); + + QStringList listStyle; + listStyle.append("无"); + listStyle.append("实线"); + listStyle.append("虚线"); + listStyle.append("点线"); + listStyle.append("虚点线"); + listStyle.append("虚点点线"); + _CreateEnumPropertyItem(strGroup, "线型", gridp.m_nType, listStyle); } void PropertyWidget::initTrackProperty(FormTrackTop *fromTop, int iWidth, QMyTableWidget *myTableWidget, int iCurrentCol) diff --git a/logPlus/PropertyWidget.h b/logPlus/PropertyWidget.h index 17e3439..3e9539a 100644 --- a/logPlus/PropertyWidget.h +++ b/logPlus/PropertyWidget.h @@ -18,6 +18,7 @@ // #include "forminfo.h" #include "formhead.h" +#include "formwell.h" #include "qmytablewidget.h" #include "formtracktop.h" #include "TransparentDraggableGujing.h" @@ -165,7 +166,8 @@ public: void InitCurrentViewInfo(bool bAll = true); //初始化属性,清空 void initWidgetProperty(QString strUuid, int iScale); //可视解释整体属性 //井 - void initWellProperty(QString strUuid, QString strSlfName, QString strWellName, double iY1, double iY2); + void initWellProperty(QString strUuid, QString strSlfName, QString strWellName, double iY1, double iY2, FormWell* fWell); + void initGridProperty(QString strGroup, QStringList slist, GridProperty& gridp); //道 void initTrackProperty(FormTrackTop *fromTop, int iWidth, QMyTableWidget *myTableWidget, int iCurrentCol); //曲线 diff --git a/logPlus/customtabwidget.cpp b/logPlus/customtabwidget.cpp index 1f7bd6c..c19a358 100644 --- a/logPlus/customtabwidget.cpp +++ b/logPlus/customtabwidget.cpp @@ -190,6 +190,8 @@ void CustomTabWidget::dropEvent(QDropEvent *event) void CustomTabWidget::slot_tabClose(int index) { QWidget *selectWidget = tabWidget(index); + if (selectWidget == NULL) + return; QString objectName = selectWidget->objectName(); if(objectName == "MainWindowSplitter") diff --git a/logPlus/formdraw.cpp b/logPlus/formdraw.cpp index 533f5e9..0d3263d 100644 --- a/logPlus/formdraw.cpp +++ b/logPlus/formdraw.cpp @@ -146,15 +146,17 @@ void FormDraw::setDrawData(QStringList listdt, QJsonObject objInfo) QMyCustomPlot *curv = new QMyCustomPlot(this, strSlfName, strWellName, m_strTrackName, strLineName); //绑定m_formTrack,方便关联formInfo curv->m_formTrack = m_formTrack; - curv->m_iY1 = m_iY1; - curv->m_iY2 = m_iY2; + if ("depthObject" == strType) + { + curv->m_bRowGridVisible = false; + curv->m_bColGridVisible = false; + } + curv->setDepthY(m_iY1, m_iY2); curv->initGeometry(m_strUuid, m_iScale, nW); curv->show(); if ("waveObject" == strType) { - curv->m_iY1 = m_iY1; - curv->m_iY2 = m_iY2; curv->m_nMode = pInfo->getFillTypeIndex(); //curv->m_fmin = pInfo->getVMin(); //curv->m_fmax = pInfo->getVMax(); @@ -2721,6 +2723,66 @@ void FormDraw::setBorderFlags(BorderFlags flags) m_BorderFlags = flags; } +void FormDraw::addCusPlot(QMyCustomPlot* plot) +{ + m_vecCurv.push_back(plot); +} + +bool FormDraw::isHvRowGridLine() +{ + bool bret = false; + for (int i = 0; i < m_vecCurv.size(); i++) + { + QMyCustomPlot* plot = m_vecCurv.at(i); + bret = plot->m_bRowGridVisible; + if (bret) + { + break; + } + } + return bret; +} + +void FormDraw::setGridProperty(int ncuGrid, /* 粗网格间隔 */ QPen cuPen, int nzhongGrid, /* 中网格间隔 */ QPen zhongPen, int nxiGrid, /* 细网格间隔 */ QPen xiPen) +{ + m_ncuGrid = ncuGrid; + m_cuPen = cuPen; + m_nzhongGrid = nzhongGrid; + m_zhongPen = zhongPen; + m_nxiGrid = nxiGrid; + m_xiPen = xiPen; +} + +void FormDraw::changeGridProperty(QString strGroup, int nInv, int nWidth, QColor clor, int nType) +{ + for (int i = 0; i < m_vecCurv.size(); i++) + { + QMyCustomPlot* plot = m_vecCurv.at(i); + if (plot->m_bRowGridVisible) + { + QPen p = QPen(clor, nWidth, (Qt::PenStyle)nType); + if (strGroup == "粗网格") + { + plot->m_ncuGrid = nInv; + plot->m_cuPen = p; + } + else if (strGroup == "中网格") + { + plot->m_nzhongGrid = nInv; + plot->m_zhongPen = p; + } + else if (strGroup == "细网格") + { + plot->m_nxiGrid = nInv; + plot->m_xiPen = p; + } + plot->updateDepthY(plot->m_iY1, plot->m_iY2); + plot->replot(); + break; + } + } +} + void FormDraw::paintEvent(QPaintEvent*) { QPainter painter(this); @@ -2785,8 +2847,7 @@ QMyCustomPlot* FormDraw::addTableLine(QString strUuid, QString strSlfName, QStri QMyCustomPlot *curv = new QMyCustomPlot(this, strSlfName, strWellName, strTrackName, strLineName); //绑定m_formTrack,方便关联formInfo curv->m_formTrack = m_formTrack; - curv->m_iY1 = m_iY1; - curv->m_iY2 = m_iY2; + curv->setDepthY(m_iY1, m_iY2); curv->initGeometry(m_strUuid, m_iScale, m_nTrackW); curv->show(); @@ -2932,25 +2993,6 @@ void FormDraw::s_addLine(QString strUuid, QString strSlfName, QString strWellNam //绑定m_formTrack,方便关联formInfo curv->m_formTrack = m_formTrack; m_curv = curv; - curv->m_strUuid = m_strUuid; - //背景设置成透明色 - curv->setBackground(Qt::transparent); - curv->setStyleSheet("background: transparent;"); - - double dHight = 0; - dHight = (m_iY2-m_iY1)*100.0/(double)m_iScale * g_dPixelPerCm; - if(g_iShow==1) - { - //显示刻度 - dHight = dHight+30; - } - qDebug() << "FormDraw dHight=" << QString::number((int)dHight); - if(dHight>32767) - { - dHight = 32767; - } - - curv->setGeometry(0, 0, g_iOneWidth, (int)dHight);//7500-3184 curv->show(); initForm(curv, strSlfName, strLineName); @@ -2989,36 +3031,6 @@ void FormDraw::s_AddLine_Property(QString strUuid, QString strSlfName, QString s QMyCustomPlot *curv = new QMyCustomPlot(this, strSlfName, strWellName, strTrackName, strLineName); //绑定m_formTrack,方便关联formInfo curv->m_formTrack = m_formTrack; - curv->m_strUuid = m_strUuid; - //背景设置成透明色 - curv->setBackground(Qt::transparent); - curv->setStyleSheet("background: transparent;"); - // - //QRect rect = this->rect(); - //curv->setGeometry(rect.left(),rect.top(), rect.width(), rect.height()); - - double dHight = 0; - dHight = (m_iY2-m_iY1)*100.0/(double)m_iScale * g_dPixelPerCm; - if(g_iShow==1) - { - //显示刻度 - dHight = dHight+30; - } - - qDebug() << "FormDraw dHight=" << QString::number((int)dHight); - if(dHight>32767) - { - dHight = 32767; - } - - //curv->setMaximumHeight((int)dHight); - //curv->setViewport(QRect(0, 0, g_iOneWidth, (int)dHight));//7500-3184 - curv->setGeometry(0, 0, g_iOneWidth, (int)dHight);//7500-3184 - - - //curv->resize(INT_MAX, INT_MAX); // 使用 INT_MAX 来避免16位整数的限制 - // QSizePolicy policy(QSizePolicy::Expanding, QSizePolicy::Expanding); - // curv->setSizePolicy(policy); curv->show(); initForm(curv, strSlfName, strLineName, @@ -3217,21 +3229,9 @@ void FormDraw::setRowHeight(double dHight, QProgressBar *progressBar, int iSplit QMyCustomPlot *form = (QMyCustomPlot*)childWidget; if(form) { - form->m_iY1 = m_iY1; - form->m_iY2 = m_iY2; int nw = form->geometry().width(); form->setGeometry(0, 0, nw, (int)dHight);//7500-3184 - //深度改变 - if(form->m_bX2Y == true) - { - //默认调换 - form->xAxis->setRange(m_iY1, m_iY2); - } - else - { - //针对裂缝的横向波形图,X,Y轴不调换 - form->yAxis->setRange(m_iY1, m_iY2); - } + form->updateDepthY(m_iY1, m_iY2); //emit CallManage::getInstance()->sig_ChangeLeftScale(m_strUuid, form->m_strSlfName, m_strWellName, m_strTrackName, form->m_strLineName, form->m_iX1); @@ -3635,35 +3635,8 @@ void FormDraw::s_addGanZuangTu(QString strUuid, QString strSlfName, QString strW //绑定m_formTrack,方便关联formInfo curv->m_formTrack = m_formTrack; curv->m_strUuid = m_strUuid; - //背景设置成透明色 - curv->setBackground(Qt::transparent); - curv->setStyleSheet("background: transparent;"); - // - //QRect rect = this->rect(); - //curv->setGeometry(rect.left(),rect.top(), rect.width(), rect.height()); - - double dHight = 0; - dHight = (m_iY2-m_iY1)*100.0/(double)m_iScale * g_dPixelPerCm; - if(g_iShow==1) - { - //显示刻度 - dHight = dHight+30; - } - - qDebug() << "FormDraw dHight=" << QString::number((int)dHight); - if(dHight>32767) - { - dHight = 32767; - } - - //curv->setMaximumHeight((int)dHight); - //curv->setViewport(QRect(0, 0, g_iOneWidth, (int)dHight));//7500-3184 - curv->setGeometry(0, 0, g_iOneWidth, (int)dHight);//7500-3184 - - - //curv->resize(INT_MAX, INT_MAX); // 使用 INT_MAX 来避免16位整数的限制 - // QSizePolicy policy(QSizePolicy::Expanding, QSizePolicy::Expanding); - // curv->setSizePolicy(policy); + curv->setDepthY(m_iY1, m_iY2); + curv->initGeometry(m_strUuid, m_iScale, g_iOneWidth); curv->show(); @@ -3710,22 +3683,13 @@ void FormDraw::s_addGanZuangTu(QString strUuid, QString strSlfName, QString strW curv->yAxis->setTickLabelSide(QCPAxis::lsInside); QFont font1("微软雅黑", 16); //fontSize 10 curv->yAxis->setTickLabelFont(font1); - - curv->yAxis->setRange(m_iY1, m_iY2); - curv->axisRect()->setupFullAxesBox(); // // curv->xAxis->ticker()->setTickCount(10);//x个主刻度 // curv->yAxis->ticker()->setTickCount(60);//y个主刻度 int iMyWidth = curv->axisRect(0)->width(); float vmax = iMyWidth; float vmin = 0; - curv->m_iX1 = vmin; - curv->m_iX2 = iMyWidth; - curv->m_iY1 = m_iY1; - curv->m_iY2 = m_iY2; - // - curv->xAxis->setRange(vmin, vmax); - curv->yAxis->setRange(m_iY1, m_iY2); + curv->setScaleX(vmin, vmax); curv->axisRect()->setupFullAxesBox(); // curv->xAxis->ticker()->setTickCount(10);//x个主刻度 @@ -3791,31 +3755,8 @@ void FormDraw::s_addJykt(QString strUuid, QString strSlfName, QString strWellNam QMyCustomPlot *curv = new QMyCustomPlot(this, strSlfName, strWellName, strTrackName, strLineName); //绑定m_formTrack,方便关联formInfo curv->m_formTrack = m_formTrack; - curv->m_strUuid = m_strUuid; - //背景设置成透明色 - curv->setBackground(Qt::transparent); - curv->setStyleSheet("background: transparent;"); - // - //QRect rect = this->rect(); - //curv->setGeometry(rect.left(),rect.top(), rect.width(), rect.height()); - - double dHight = 0; - dHight = (m_iY2-m_iY1)*100.0/(double)m_iScale * g_dPixelPerCm; - if(g_iShow==1) - { - //显示刻度 - dHight = dHight+30; - } - qDebug() << "FormDraw dHight=" << QString::number((int)dHight); - if(dHight>32767) - { - dHight = 32767; - } - - //curv->setMaximumHeight((int)dHight); - //curv->setViewport(QRect(0, 0, g_iOneWidth, (int)dHight));//7500-3184 - curv->setGeometry(0, 0, g_iOneWidth, (int)dHight);//7500-3184 - + curv->setDepthY(m_iY1, m_iY2); + curv->initGeometry(m_strUuid, m_iScale, g_iOneWidth); //curv->resize(INT_MAX, INT_MAX); // 使用 INT_MAX 来避免16位整数的限制 // QSizePolicy policy(QSizePolicy::Expanding, QSizePolicy::Expanding); @@ -3862,35 +3803,8 @@ void FormDraw::s_addDenv(QString strUuid, QString strSlfName, QString strWellNam QMyCustomPlot *curv = new QMyCustomPlot(this, strSlfName, strWellName, strTrackName, strLineName); //绑定m_formTrack,方便关联formInfo curv->m_formTrack = m_formTrack; - curv->m_strUuid = m_strUuid; - //背景设置成透明色 - curv->setBackground(Qt::transparent); - curv->setStyleSheet("background: transparent;"); - // - //QRect rect = this->rect(); - //curv->setGeometry(rect.left(),rect.top(), rect.width(), rect.height()); - - double dHight = 0; - dHight = (m_iY2-m_iY1)*100.0/(double)m_iScale * g_dPixelPerCm; - if(g_iShow==1) - { - //显示刻度 - dHight = dHight+30; - } - qDebug() << "FormDraw dHight=" << QString::number((int)dHight); - if(dHight>32767) - { - dHight = 32767; - } - - //curv->setMaximumHeight((int)dHight); - //curv->setViewport(QRect(0, 0, g_iOneWidth, (int)dHight));//7500-3184 - curv->setGeometry(0, 0, g_iOneWidth, (int)dHight);//7500-3184 - - - //curv->resize(INT_MAX, INT_MAX); // 使用 INT_MAX 来避免16位整数的限制 - // QSizePolicy policy(QSizePolicy::Expanding, QSizePolicy::Expanding); - // curv->setSizePolicy(policy); + curv->setDepthY(m_iY1, m_iY2); + curv->initGeometry(m_strUuid, m_iScale, g_iOneWidth); curv->show(); @@ -3933,36 +3847,6 @@ void FormDraw::s_addDrawImage(QString strUuid, QString strSlfName, QString strWe QMyCustomPlot *curv = new QMyCustomPlot(this, strSlfName, strWellName, strTrackName, strLineName); //绑定m_formTrack,方便关联formInfo curv->m_formTrack = m_formTrack; - curv->m_strUuid = m_strUuid; - //背景设置成透明色 - curv->setBackground(Qt::transparent); - curv->setStyleSheet("background: transparent;"); - // - //QRect rect = this->rect(); - //curv->setGeometry(rect.left(),rect.top(), rect.width(), rect.height()); - - double dHight = 0; - dHight = (m_iY2-m_iY1)*100.0/(double)m_iScale * g_dPixelPerCm; - if(g_iShow==1) - { - //显示刻度 - dHight = dHight+30; - } - qDebug() << "FormDraw dHight=" << QString::number((int)dHight); - if(dHight>32767) - { - dHight = 32767; - } - - //curv->setMaximumHeight((int)dHight); - //curv->setViewport(QRect(0, 0, g_iOneWidth, (int)dHight));//7500-3184 - curv->setGeometry(0, 0, g_iOneWidth, (int)dHight);//7500-3184 - - - //curv->resize(INT_MAX, INT_MAX); // 使用 INT_MAX 来避免16位整数的限制 - // QSizePolicy policy(QSizePolicy::Expanding, QSizePolicy::Expanding); - // curv->setSizePolicy(policy); - curv->show(); //图像 成像 @@ -4070,25 +3954,6 @@ void FormDraw::s_addCrack(QString strUuid, QString strSlfName, QString strWellNa QMyCustomPlot *curv = new QMyCustomPlot(this, strSlfName, strWellName, strTrackName, strLineName); //绑定m_formTrack,方便关联formInfo curv->m_formTrack = m_formTrack; - curv->m_strUuid = m_strUuid; - //背景设置成透明色 - curv->setBackground(Qt::transparent); - curv->setStyleSheet("background: transparent;"); - // - double dHight = 0; - dHight = (m_iY2-m_iY1)*100.0/(double)m_iScale * g_dPixelPerCm; - if(g_iShow==1) - { - //显示刻度 - dHight = dHight+30; - } - qDebug() << "FormDraw dHight=" << QString::number((int)dHight); - if(dHight>32767) - { - dHight = 32767; - } - - curv->setGeometry(0, 0, g_iOneWidth, (int)dHight);//7500-3184 curv->show(); //------------------- @@ -4098,14 +3963,11 @@ void FormDraw::s_addCrack(QString strUuid, QString strSlfName, QString strWellNa int iMyWidth = curv->axisRect(0)->width(); float vmax = iMyWidth; float vmin = 0; - curv->m_iX1 = vmin; - curv->m_iX2 = vmax; - curv->m_iY1 = m_iY1; - curv->m_iY2 = m_iY2; - // - curv->xAxis->setRange(vmin, vmax); - curv->yAxis->setRange(m_iY1, m_iY2); - curv->axisRect()->setupFullAxesBox(); + + curv->setScaleX(vmin, vmax); + curv->setDepthY(m_iY1, m_iY2); + curv->initGeometry(m_strUuid, m_iScale, g_iOneWidth); + curv->axisRect()->setupFullAxesBox(); // curv->xAxis->ticker()->setTickCount(10);//x个主刻度 curv->yAxis->ticker()->setTickCount(60);//y个主刻度 @@ -4160,25 +4022,6 @@ void FormDraw::s_addJiegutext(QString strUuid, QString strSlfName, QString strWe QMyCustomPlot *curv = new QMyCustomPlot(this, strSlfName, strWellName, strTrackName, strLineName); //绑定m_formTrack,方便关联formInfo curv->m_formTrack = m_formTrack; - curv->m_strUuid = m_strUuid; - //背景设置成透明色 - curv->setBackground(Qt::transparent); - curv->setStyleSheet("background: transparent;"); - // - double dHight = 0; - dHight = (m_iY2-m_iY1)*100.0/(double)m_iScale * g_dPixelPerCm; - if(g_iShow==1) - { - //显示刻度 - dHight = dHight+30; - } - qDebug() << "FormDraw dHight=" << QString::number((int)dHight); - if(dHight>32767) - { - dHight = 32767; - } - - curv->setGeometry(0, 0, g_iOneWidth, (int)dHight);//7500-3184 curv->show(); //------------------- @@ -4189,13 +4032,10 @@ void FormDraw::s_addJiegutext(QString strUuid, QString strSlfName, QString strWe float vmax = iMyWidth; float vmin = 0; - curv->m_iX1 = vmin; - curv->m_iX2 = vmax; - curv->m_iY1 = m_iY1; - curv->m_iY2 = m_iY2; // - curv->xAxis->setRange(vmin, vmax); - curv->yAxis->setRange(m_iY1, m_iY2); + curv->setScaleX(vmin, vmax); + curv->setDepthY(m_iY1, m_iY2); + curv->initGeometry(m_strUuid, m_iScale, g_iOneWidth); curv->axisRect()->setupFullAxesBox(); // curv->xAxis->ticker()->setTickCount(10);//x个主刻度 @@ -4287,25 +4127,6 @@ void FormDraw::s_addLogface(QString strUuid, QString strSlfName, QString strWell QMyCustomPlot *curv = new QMyCustomPlot(this, strSlfName, strWellName, strTrackName, strLineName); //绑定m_formTrack,方便关联formInfo curv->m_formTrack = m_formTrack; - curv->m_strUuid = m_strUuid; - //背景设置成透明色 - curv->setBackground(Qt::transparent); - curv->setStyleSheet("background: transparent;"); - // - double dHight = 0; - dHight = (m_iY2-m_iY1)*100.0/(double)m_iScale * g_dPixelPerCm; - if(g_iShow==1) - { - //显示刻度 - dHight = dHight+30; - } - qDebug() << "FormDraw dHight=" << QString::number((int)dHight); - if(dHight>32767) - { - dHight = 32767; - } - - curv->setGeometry(0, 0, g_iOneWidth, (int)dHight);//7500-3184 curv->show(); //------------------- @@ -4316,13 +4137,9 @@ void FormDraw::s_addLogface(QString strUuid, QString strSlfName, QString strWell float vmax = iMyWidth; float vmin = 0; - curv->m_iX1 = vmin; - curv->m_iX2 = vmax; - curv->m_iY1 = m_iY1; - curv->m_iY2 = m_iY2; - // - curv->xAxis->setRange(vmin, vmax); - curv->yAxis->setRange(m_iY1, m_iY2); + curv->setScaleX(vmin, vmax); + curv->setDepthY(m_iY1, m_iY2); + curv->initGeometry(m_strUuid, m_iScale, g_iOneWidth); curv->axisRect()->setupFullAxesBox(); // curv->xAxis->ticker()->setTickCount(10);//x个主刻度 @@ -4412,25 +4229,6 @@ void FormDraw::s_addMCals(QString strUuid, QString strSlfName, QString strWellNa QMyCustomPlot *curv = new QMyCustomPlot(this, strSlfName, strWellName, strTrackName, strLineName); //绑定m_formTrack,方便关联formInfo curv->m_formTrack = m_formTrack; - curv->m_strUuid = m_strUuid; - //背景设置成透明色 - curv->setBackground(Qt::transparent); - curv->setStyleSheet("background: transparent;"); - // - double dHight = 0; - dHight = (m_iY2-m_iY1)*100.0/(double)m_iScale * g_dPixelPerCm; - if(g_iShow==1) - { - //显示刻度 - dHight = dHight+30; - } - qDebug() << "FormDraw dHight=" << QString::number((int)dHight); - if(dHight>32767) - { - dHight = 32767; - } - - curv->setGeometry(0, 0, g_iOneWidth, (int)dHight);//7500-3184 curv->show(); //------------------- @@ -4441,13 +4239,9 @@ void FormDraw::s_addMCals(QString strUuid, QString strSlfName, QString strWellNa float vmax = iMyWidth; float vmin = 0; - curv->m_iX1 = vmin; - curv->m_iX2 = vmax; - curv->m_iY1 = m_iY1; - curv->m_iY2 = m_iY2; - // - curv->xAxis->setRange(vmin, vmax); - curv->yAxis->setRange(m_iY1, m_iY2); + curv->setScaleX(vmin, vmax); + curv->setDepthY(m_iY1, m_iY2); + curv->initGeometry(m_strUuid, m_iScale, g_iOneWidth); curv->axisRect()->setupFullAxesBox(); // curv->xAxis->ticker()->setTickCount(10);//x个主刻度 @@ -4500,25 +4294,6 @@ void FormDraw::s_addTubingstring(QString strUuid, QString strSlfName, QString st QMyCustomPlot *curv = new QMyCustomPlot(this, strSlfName, strWellName, strTrackName, strLineName); //绑定m_formTrack,方便关联formInfo curv->m_formTrack = m_formTrack; - curv->m_strUuid = m_strUuid; - //背景设置成透明色 - curv->setBackground(Qt::transparent); - curv->setStyleSheet("background: transparent;"); - // - double dHight = 0; - dHight = (m_iY2-m_iY1)*100.0/(double)m_iScale * g_dPixelPerCm; - if(g_iShow==1) - { - //显示刻度 - dHight = dHight+30; - } - qDebug() << "FormDraw dHight=" << QString::number((int)dHight); - if(dHight>32767) - { - dHight = 32767; - } - - curv->setGeometry(0, 0, g_iOneWidth, (int)dHight);//7500-3184 curv->show(); //------------------- @@ -4591,13 +4366,9 @@ void FormDraw::s_addTubingstring(QString strUuid, QString strSlfName, QString st m_LeftVal = 0; m_RightVal = iMyWidth; // - curv->m_iX1 = vmin; - curv->m_iX2 = vmax; - curv->m_iY1 = m_iY1; - curv->m_iY2 = m_iY2; - // - curv->xAxis->setRange(vmin, vmax); - curv->yAxis->setRange(m_iY1, m_iY2); + curv->setScaleX(vmin, vmax); + curv->setDepthY(m_iY1, m_iY2); + curv->initGeometry(m_strUuid, m_iScale, g_iOneWidth); curv->axisRect()->setupFullAxesBox(); // curv->xAxis->ticker()->setTickCount(10);//x个主刻度 @@ -4809,13 +4580,10 @@ void FormDraw::initForm(QMyCustomPlot *widget, QString strSlfName, QString strLi // double y2 = widget->yAxis->pixelToCoord(rect.bottom()); // }); - widget->m_iX1 = vmin; - widget->m_iX2 = vmax; - widget->m_iY1 = m_iY1; - widget->m_iY2 = m_iY2; - // - widget->xAxis->setRange(vmin, vmax); - widget->yAxis->setRange(m_iY1, m_iY2); + widget->setScaleX(vmin, vmax); + widget->setDepthY(m_iY1, m_iY2); + widget->initGeometry(m_strUuid, m_iScale, g_iOneWidth); + widget->axisRect()->setupFullAxesBox(); // widget->xAxis->ticker()->setTickCount(10);//x个主刻度 @@ -5267,16 +5035,9 @@ void FormDraw::DrawImageNew_NoFilter(QMyCustomPlot *widget, QString strSlfName, } delete[] value; - // m_iY1 = 0.0 -_EDep; - // m_iY2 = 0.0 -_SDep; - //------------------------ - widget->m_iX1 = vmin; - widget->m_iX2 = vmax; - widget->m_iY1 = m_iY1; - widget->m_iY2 = m_iY2; - // - widget->xAxis->setRange(vmin, vmax); - widget->yAxis->setRange(m_iY1, m_iY2); + widget->setScaleX(vmin, vmax); + widget->setDepthY(m_iY1, m_iY2); + widget->initGeometry(m_strUuid, m_iScale, g_iOneWidth); widget->axisRect()->setupFullAxesBox(); // widget->xAxis->ticker()->setTickCount(10);//x个主刻度 @@ -5468,13 +5229,8 @@ void FormDraw::initTableLine(QMyCustomPlot *widget, QString strSlfName, QString int iMyWidth = widget->axisRect(0)->width(); float vmax = iMyWidth; float vmin = 0; - widget->m_iX1 = vmin; - widget->m_iX2 = iMyWidth; - widget->m_iY1 = m_iY1; - widget->m_iY2 = m_iY2; - // - widget->xAxis->setRange(vmin, vmax); - widget->yAxis->setRange(m_iY1, m_iY2); + + widget->setScaleX(vmin, iMyWidth); widget->axisRect()->setupFullAxesBox(); // widget->xAxis->ticker()->setTickCount(10);//x个主刻度 @@ -5523,13 +5279,7 @@ void FormDraw::initWords(QMyCustomPlot *widget, QString strSlfName, QString strL int iMyWidth = widget->axisRect(0)->width(); float vmax = iMyWidth; float vmin = 0; - widget->m_iX1 = vmin; - widget->m_iX2 = iMyWidth; - widget->m_iY1 = m_iY1; - widget->m_iY2 = m_iY2; - // - widget->xAxis->setRange(vmin, vmax); - widget->yAxis->setRange(m_iY1, m_iY2); + widget->setScaleX(vmin, iMyWidth); widget->axisRect()->setupFullAxesBox(); // widget->xAxis->ticker()->setTickCount(10);//x个主刻度 @@ -5573,13 +5323,7 @@ void FormDraw::initLayer(QMyCustomPlot *widget, QString strSlfName, QString strL int iMyWidth = widget->axisRect(0)->width(); float vmax = iMyWidth; float vmin = 0; - widget->m_iX1 = vmin; - widget->m_iX2 = iMyWidth; - widget->m_iY1 = m_iY1; - widget->m_iY2 = m_iY2; - // - widget->xAxis->setRange(vmin, vmax); - widget->yAxis->setRange(m_iY1, m_iY2); + widget->setScaleX(vmin, iMyWidth); widget->axisRect()->setupFullAxesBox(); // widget->xAxis->ticker()->setTickCount(10);//x个主刻度 @@ -5626,13 +5370,7 @@ void FormDraw::initIMAGE_DATA(QMyCustomPlot *widget, QString strSlfName, QString int iMyWidth = widget->axisRect(0)->width(); float vmax = iMyWidth; float vmin = 0; - widget->m_iX1 = vmin; - widget->m_iX2 = iMyWidth; - widget->m_iY1 = m_iY1; - widget->m_iY2 = m_iY2; - // - widget->xAxis->setRange(vmin, vmax); - widget->yAxis->setRange(m_iY1, m_iY2); + widget->setScaleX(vmin, vmax); widget->axisRect()->setupFullAxesBox(); // widget->xAxis->ticker()->setTickCount(10);//x个主刻度 @@ -5737,13 +5475,7 @@ void FormDraw::initResult(QMyCustomPlot *widget, QString strSlfName, QString str int iMyWidth = widget->axisRect(0)->width(); float vmax = iMyWidth; float vmin = 0; - widget->m_iX1 = vmin; - widget->m_iX2 = iMyWidth; - widget->m_iY1 = m_iY1; - widget->m_iY2 = m_iY2; - // - widget->xAxis->setRange(vmin, vmax); - widget->yAxis->setRange(m_iY1, m_iY2); + widget->setScaleX(vmin, iMyWidth); widget->axisRect()->setupFullAxesBox(); // widget->xAxis->ticker()->setTickCount(10);//x个主刻度 @@ -5839,13 +5571,7 @@ void FormDraw::initGeoLith(QMyCustomPlot *widget, QString strSlfName, QString st int iMyWidth = widget->axisRect(0)->width(); float vmax = iMyWidth; float vmin = 0; - widget->m_iX1 = vmin; - widget->m_iX2 = iMyWidth; - widget->m_iY1 = m_iY1; - widget->m_iY2 = m_iY2; - // - widget->xAxis->setRange(vmin, vmax); - widget->yAxis->setRange(m_iY1, m_iY2); + widget->setScaleX(vmin, iMyWidth); widget->axisRect()->setupFullAxesBox(); // widget->xAxis->ticker()->setTickCount(10);//x个主刻度 @@ -5953,13 +5679,7 @@ void FormDraw::initSwallCore(QMyCustomPlot *widget, QString strSlfName, QString int iMyWidth = widget->axisRect(0)->width(); float vmax = iMyWidth; float vmin = 0; - widget->m_iX1 = vmin; - widget->m_iX2 = iMyWidth; - widget->m_iY1 = m_iY1; - widget->m_iY2 = m_iY2; - // - widget->xAxis->setRange(vmin, vmax); - widget->yAxis->setRange(m_iY1, m_iY2); + widget->setScaleX(vmin, iMyWidth); widget->axisRect()->setupFullAxesBox(); // widget->xAxis->ticker()->setTickCount(10);//x个主刻度 @@ -6005,13 +5725,7 @@ void FormDraw::initGujing(QMyCustomPlot *widget, QString strSlfName, QString str int iMyWidth = widget->axisRect(0)->width(); float vmax = iMyWidth; float vmin = 0; - widget->m_iX1 = vmin; - widget->m_iX2 = iMyWidth; - widget->m_iY1 = m_iY1; - widget->m_iY2 = m_iY2; - // - widget->xAxis->setRange(vmin, vmax); - widget->yAxis->setRange(m_iY1, m_iY2); + widget->setScaleX(vmin, iMyWidth); widget->axisRect()->setupFullAxesBox(); // widget->xAxis->ticker()->setTickCount(10);//x个主刻度 @@ -6052,6 +5766,7 @@ void FormDraw::initGujing(QMyCustomPlot *widget, QString strSlfName, QString str void FormDraw::initDepth(QMyCustomPlot *curv) { // x轴隐藏 + curv->setScaleX(0, 1024); curv->yAxis->setTicks(true); curv->yAxis->setVisible(true); curv->yAxis->setBasePen(Qt::NoPen); @@ -6060,7 +5775,6 @@ void FormDraw::initDepth(QMyCustomPlot *curv) curv->yAxis->setTickLabelSide(QCPAxis::lsInside); QFont font1("微软雅黑", 8); curv->yAxis->setTickLabelFont(font1); - curv->yAxis->setRange(m_iY1, m_iY2); //curv->yAxis->setRangeReversed(true); //curv->axisRect()->setupFullAxesBox(); @@ -6075,13 +5789,8 @@ void FormDraw::initFgrq(QMyCustomPlot *widget) widget->xAxis->setSubTicks(false); widget->xAxis->setTickLabels(false); - widget->m_iX1 = 0; - widget->m_iX2 = 1024; - widget->m_iY1 = m_iY1; - widget->m_iY2 = m_iY2; - // - widget->xAxis->setRange(widget->m_iX1, widget->m_iX2); - widget->yAxis->setRange(m_iY1, m_iY2); + widget->setScaleX(0, 1024); + widget->setDepthY(m_iY1, m_iY2); //对调XY轴,在最前面设置 QCPAxis *yAxis = widget->yAxis; @@ -6093,13 +5802,8 @@ void FormDraw::initFgrq(QMyCustomPlot *widget) void FormDraw::initRose(QMyCustomPlot *widget) { - widget->m_iX1 = 0; - widget->m_iX2 = 1024; - widget->m_iY1 = m_iY1; - widget->m_iY2 = m_iY2; - // - widget->xAxis->setRange(widget->m_iX1, widget->m_iX2); - widget->yAxis->setRange(m_iY1, m_iY2); + widget->setScaleX(0, 1024); + widget->setDepthY(m_iY1, m_iY2); //对调XY轴,在最前面设置 QCPAxis *yAxis = widget->yAxis; @@ -6461,13 +6165,8 @@ void FormDraw::addQCPItemLine(QMyCustomPlot *widget, float cx, float cy, const Q void FormDraw::initDCA(QMyCustomPlot *widget) { - widget->m_iX1 = 0; - widget->m_iX2 = 360; - widget->m_iY1 = m_iY1; - widget->m_iY2 = m_iY2; - // - widget->xAxis->setRange(widget->m_iX1, widget->m_iX2); - widget->yAxis->setRange(m_iY1, m_iY2); + widget->setScaleX(0, 360); + widget->setDepthY(m_iY1, m_iY2); //对调XY轴,在最前面设置 QCPAxis *yAxis = widget->yAxis; @@ -6740,13 +6439,8 @@ void FormDraw::initTDT(QMyCustomPlot *curv) // curv->yAxis->setTickLabelFont(font1); curv->yAxis->setTicks(false); - curv->m_iX1 = 0; - curv->m_iX2 = 400; - curv->m_iY1 = m_iY1; - curv->m_iY2 = m_iY2; - // - curv->xAxis->setRange(curv->m_iX1, curv->m_iX2); - curv->yAxis->setRange(m_iY1, m_iY2); + curv->setScaleX(0, 400); + curv->setDepthY(m_iY1, m_iY2); // // curv->xAxis->ticker()->setTickCount(10);//x个主刻度 // curv->yAxis->ticker()->setTickCount(60);//y个主刻度 @@ -6882,14 +6576,7 @@ void FormDraw::initCorePhysics(QMyCustomPlot *widget, QString strSlfName, QStrin m_vmax = vmax; m_vmin = vmin; - //---------------------------------- - widget->m_iX1 = vmin; - widget->m_iX2 = vmax; - widget->m_iY1 = m_iY1; - widget->m_iY2 = m_iY2; - // - widget->xAxis->setRange(vmin, vmax); - widget->yAxis->setRange(m_iY1, m_iY2); + widget->setScaleX(vmin, vmax); widget->axisRect()->setupFullAxesBox(); // widget->xAxis->ticker()->setTickCount(10);//x个主刻度 @@ -7138,13 +6825,7 @@ void FormDraw::DrawJykt(QMyCustomPlot *widget, QString strSlfName) float vmax = m_RightVal; float vmin = m_LeftVal; - widget->m_iX1 = vmin; - widget->m_iX2 = vmax; - widget->m_iY1 = m_iY1; - widget->m_iY2 = m_iY2; - // - widget->xAxis->setRange(vmin, vmax); - widget->yAxis->setRange(m_iY1, m_iY2); + widget->setScaleX(vmin, vmax); widget->axisRect()->setupFullAxesBox(); // widget->xAxis->ticker()->setTickCount(10);//x个主刻度 @@ -7268,13 +6949,7 @@ void FormDraw::DrawDenv(QMyCustomPlot *widget, QString strSlfName) float vmax = m_RightVal; float vmin = m_LeftVal; - widget->m_iX1 = vmin; - widget->m_iX2 = vmax; - widget->m_iY1 = m_iY1; - widget->m_iY2 = m_iY2; - // - widget->xAxis->setRange(vmin, vmax); - widget->yAxis->setRange(m_iY1, m_iY2); + widget->setScaleX(vmin, vmax); widget->axisRect()->setupFullAxesBox(); // widget->xAxis->ticker()->setTickCount(10);//x个主刻度 diff --git a/logPlus/formdraw.h b/logPlus/formdraw.h index 7267b74..e8691e6 100644 --- a/logPlus/formdraw.h +++ b/logPlus/formdraw.h @@ -88,6 +88,20 @@ public: void crossTrackSetting(); void setBorderFlags(BorderFlags flags); + // 添加绘图 + void addCusPlot(QMyCustomPlot* plot); + // 绘图是否有显示横线格子; + bool isHvRowGridLine(); + + void setGridProperty(int ncuGrid, // 粗网格间隔 + QPen cuPen, + int nzhongGrid, // 中网格间隔 + QPen zhongPen, + int nxiGrid, // 细网格间隔 + QPen xiPen); + // 更新绘图区域网格线 + void changeGridProperty(QString strGroup, int nInv, + int nWidth, QColor clor, int nType); private: Ui::FormDraw *ui; @@ -118,6 +132,12 @@ public: int m_iScale=200; double m_iY1=0; double m_iY2=0; + int m_nxiGrid = 1; // 细网格间隔 + QPen m_xiPen; + int m_nzhongGrid = 2; // 中网格间隔 + QPen m_zhongPen; + int m_ncuGrid = 10; // 粗网格间隔 + QPen m_cuPen; QMyCustomPlot *m_curv = NULL; // 曲线列表 diff --git a/logPlus/formwell.cpp b/logPlus/formwell.cpp index ea9f29c..e6be30b 100644 --- a/logPlus/formwell.cpp +++ b/logPlus/formwell.cpp @@ -21,7 +21,14 @@ FormWell::FormWell(QWidget *parent, QString strWellName) : m_parent = parent; m_strWellName = strWellName; - // + m_cuProperty.m_nInv = 10; + m_cuProperty.m_nWidth = 2; + + m_zhongProperty.m_nInv = 2; + m_zhongProperty.m_clor = QColor(103,103,103); + + m_xiProperty.m_clor = QColor(208,208,208); + ui->tableWidget->verticalHeader()->hide(); //行 ui->tableWidget->horizontalHeader()->hide();//列 int rowcount = 3; //总行数 @@ -232,6 +239,9 @@ QVector FormWell::new_track(QStringList listdt, QString strTrackName) vec << formDraw; formDraw->m_iY1 = m_iY1; formDraw->m_iY2 = m_iY2; + formDraw->setGridProperty(m_cuProperty.m_nInv, QPen(m_cuProperty.m_clor, m_cuProperty.m_nWidth, Qt::PenStyle(m_cuProperty.m_nType)), + m_zhongProperty.m_nInv, QPen(m_zhongProperty.m_clor, m_zhongProperty.m_nWidth, Qt::PenStyle(m_zhongProperty.m_nType)), + m_xiProperty.m_nInv, QPen(m_xiProperty.m_clor, m_xiProperty.m_nWidth, Qt::PenStyle(m_xiProperty.m_nType))); formDraw->m_strUuid = m_strUuid; formDraw->m_strSlfName = strSlfName; formDraw->m_formTrack = formTrack; @@ -266,6 +276,26 @@ int FormWell::getTableWidgetColumn(QString strTrackUuid) return nret; } +GridProperty& FormWell::getCuGridProperty() +{ + return m_cuProperty; +} + +GridProperty& FormWell::getZhongGridProperty() +{ + return m_zhongProperty; +} + +GridProperty& FormWell::getXiGridProperty() +{ + return m_xiProperty; +} + +GridProperty& FormWell::getBorderGridProperty() +{ + return m_borderProperty; +} + void FormWell::paintEvent(QPaintEvent *event) { QPainter painter(this); @@ -552,6 +582,66 @@ int FormWell::setColWidth(int iCurrentCol, int iWidth) return iWellWidth; } +void FormWell::setWellProperty(QVariantList listVal) +{ + QString strGroup = listVal.at(0).toString(); + QString strPro = listVal.at(1).toString(); + + GridProperty* gridpt = NULL;// &pWell->getCuGridProperty(); + if (strGroup == "粗网格") + { + gridpt = &m_cuProperty; + } + else if (strGroup == "中网格") + { + gridpt = &m_zhongProperty; + } + else if (strGroup == "细网格") + { + gridpt = &m_xiProperty; + } + else if (strGroup == "边框") + { + gridpt = &m_borderProperty; + } + if (gridpt == NULL) + return; + + if ("间隔(m)" == strPro) + { + gridpt->m_nInv = listVal.at(2).toInt(); + } + else if ("线宽" == strPro) + { + gridpt->m_nWidth = listVal.at(2).toInt(); + } + else if ("颜色" == strPro) + { + QColor newColor = listVal.at(2).value(); + gridpt->m_clor = newColor; + } + else if ("线型" == strPro) + { + gridpt->m_nType = listVal.at(2).toInt(); + } + + int columnCount = ui->tableWidget->columnCount();//总列数 + for (int i = 0; i < columnCount; i++) + { + if (ui->tableWidget->cellWidget(1, i) == nullptr) + continue; + auto myWidget = ui->tableWidget->cellWidget(2, i); + if (myWidget == nullptr) + continue; + + FormDraw *formDraw = qobject_cast(myWidget); + if (formDraw) + { + formDraw->changeGridProperty(strGroup, gridpt->m_nInv, gridpt->m_nWidth, gridpt->m_clor, gridpt->m_nType); + } + } +} + void FormWell::setRowHeight(double dHight, QProgressBar *progressBar, int iSplit) { //设置高度 diff --git a/logPlus/formwell.h b/logPlus/formwell.h index 4068140..13bc4e0 100644 --- a/logPlus/formwell.h +++ b/logPlus/formwell.h @@ -9,6 +9,15 @@ #pragma execution_character_set("utf-8") +struct GridProperty +{ + GridProperty() :m_nInv(1), m_nWidth(1), m_clor(0, 0, 0), m_nType(1) {} + int m_nInv; + int m_nWidth; + QColor m_clor; + int m_nType; +}; + namespace Ui { class FormWell; } @@ -30,11 +39,23 @@ public: // 根据道ID,获取列索引 int getTableWidgetColumn(QString strTrackUuid); + + // 粗网格 + GridProperty& getCuGridProperty(); + GridProperty& getZhongGridProperty(); + GridProperty& getXiGridProperty(); + GridProperty& getBorderGridProperty(); + protected: void paintEvent(QPaintEvent *event); private: Ui::FormWell *ui; + GridProperty m_cuProperty; // 粗网格 + GridProperty m_zhongProperty; // 中网格 + GridProperty m_xiProperty; // 细网格 + GridProperty m_borderProperty; // 边框 + public: QString m_strUuid; QString m_strWellName; @@ -57,6 +78,8 @@ public: //设置道宽 int setColWidth(int iCurrentCol, int iNewWidth); + void setWellProperty(QVariantList listVal); + //获取当前井的所有道名称 QStringList getTrackNameList(); diff --git a/logPlus/mainwindowcurve.cpp b/logPlus/mainwindowcurve.cpp index 006ad03..fa3dc0c 100644 --- a/logPlus/mainwindowcurve.cpp +++ b/logPlus/mainwindowcurve.cpp @@ -104,6 +104,8 @@ MainWindowCurve::MainWindowCurve(QWidget *parent) : connect(CallManage::getInstance(), SIGNAL(sig_mouseWheel(QWheelEvent*)), this, SLOT(s_mouseWheel(QWheelEvent*))); connect(CallManage::getInstance(), SIGNAL(sig_changeScale(QString, int)), this, SLOT(s_changeScale(QString, int))); connect(CallManage::getInstance(), SIGNAL(sig_changeDepth(QString, QString, QString, int, int)), this, SLOT(s_changeDepth(QString, QString, QString, int, int))); + connect(CallManage::getInstance(), SIGNAL(sig_changeWellProperty(QString, QString, QVariantList)), this, SLOT(s_changeWellProperty(QString, QString, QVariantList))); + connect(CallManage::getInstance(), SIGNAL(sig_changeWidth(QString, QString, QString, QString, int, int)), this, SLOT(s_changeWidth(QString, QString, QString, QString, int, int))); connect(CallManage::getInstance(), SIGNAL(sig_changeTrackProperty(QVariantList)), this, SLOT(s_changeTrackProperty(QVariantList))); @@ -2938,7 +2940,7 @@ void MainWindowCurve::s_NewWell(QString strWellName, QString strSlfName) widgetWell->m_strSlfName = strSlfName; widgetWell->m_iScale = m_iScale; ui->tableWidget_2->setCellWidget(i, columnCount, widgetWell); - + m_mapFWell.insert(strWellName, widgetWell); // m_listWell.push_back(strWellName); } @@ -3007,8 +3009,8 @@ void MainWindowCurve::onItemClicked(QTableWidgetItem* item) //曲线 QString strWellName = item->text(); QString strSlfName = item->data(Qt::UserRole+1).toString(); - - PropertyService()->initWellProperty(m_strUuid, strSlfName, strWellName, m_iY1, m_iY2); + FormWell* fWell = m_mapFWell.value(strWellName); + PropertyService()->initWellProperty(m_strUuid, strSlfName, strWellName, m_iY1, m_iY2, fWell); //取消所有选中单元格 emit CallManage::getInstance()->sig_Raise(m_strUuid, strSlfName, strWellName, "", "", 1, ""); @@ -4291,6 +4293,15 @@ void MainWindowCurve::s_changeDepth(QString strUuid, QString strSlfName, QString //update(); } +void MainWindowCurve::s_changeWellProperty(QString strSlfName, QString strWellName, QVariantList listVal) +{ + FormWell* pWell = m_mapFWell.value(strWellName); + if (!pWell) + return; + + pWell->setWellProperty(listVal); +} + void MainWindowCurve::DisplayWells(QJsonArray wellsArray) { QMap mapWells; diff --git a/logPlus/mainwindowcurve.h b/logPlus/mainwindowcurve.h index abdd06d..dd9f81d 100644 --- a/logPlus/mainwindowcurve.h +++ b/logPlus/mainwindowcurve.h @@ -58,6 +58,8 @@ public: QString m_strUuid; QStringList m_listWell; + QMap m_mapFWell; + //当前选中数据表格 SelectTableItem m_SelectTableItem; @@ -145,6 +147,7 @@ public slots: void s_changeScale(QString strUuid, int iNewScale); //改变深度 void s_changeDepth(QString strUuid, QString strSlfName, QString strWellName, int iY1, int iY2); + void s_changeWellProperty(QString strSlfName, QString strWellName, QVariantList listVal); //改变道宽 void s_changeWidth(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, int iCurrentCol, int iNewWidth); diff --git a/logPlus/qmycustomplot.cpp b/logPlus/qmycustomplot.cpp index b7aa944..f9408ae 100644 --- a/logPlus/qmycustomplot.cpp +++ b/logPlus/qmycustomplot.cpp @@ -25,6 +25,7 @@ #include "PropertyWidget.h" #include "YxzpDialog.h" #include "fracsel.h" +#include "formdraw.h" //是否隐藏刻度 extern int g_iShow; @@ -42,6 +43,19 @@ QMyCustomPlot::QMyCustomPlot(QWidget *parent, QString strSlfName, QString strWel m_strTrackName = strTrackName; m_strLineName = strLineName; + FormDraw* pFormDw = qobject_cast(parent); + if (pFormDw) + { + if (pFormDw->isHvRowGridLine()) + { + m_bRowGridVisible = false; + } + m_cuPen = pFormDw->m_cuPen; + m_zhongPen = pFormDw->m_zhongPen; + m_xiPen = pFormDw->m_xiPen; + pFormDw->addCusPlot(this); + } + mSizeHandleManager = new QCPSizeHandleManager(this); setObjectName("QMyCustomPlot"); @@ -201,9 +215,9 @@ void QMyCustomPlot::initGeometry(QString strUuid, int nscale, int nW) dHight = 32767; } - //curv->setMaximumHeight((int)dHight); - //curv->setViewport(QRect(0, 0, g_iOneWidth, (int)dHight));//7500-3184 - this->setGeometry(0, 0, nW, (int)dHight);//7500-3184 + //curv->setMaximumHeight((int)dHight); + //curv->setViewport(QRect(0, 0, g_iOneWidth, (int)dHight));//7500-3184 + this->setGeometry(0, 0, nW-2, (int)dHight);//7500-3184 } void QMyCustomPlot::changePropertyWaveUpdate() @@ -10071,6 +10085,103 @@ void QMyCustomPlot::resetPosition_Layer() } } +void QMyCustomPlot::setScaleX(float fx1, float fx2) +{ + this->m_iX1 = fx1; + this->m_iX2 = fx2; + this->xAxis->setRange(fx1, fx2); + + if (!m_bColGridVisible) + return; + + for (int i = 0; i < m_vecColGrid.size(); i++) + { + this->removeItem(m_vecColGrid.at(i)); + } + m_vecColGrid.clear(); + + float fabs1 = (fx2 - fx1)/10.0f; + int nabs2 = fx2; + for (; fx1 < fx2; fx1 += fabs1) + { + QCPItemStraightLine* pGline = new QCPItemStraightLine(this); + pGline->setPen(QPen(QColor(208, 208, 208), 1, Qt::SolidLine)); + pGline->point1->setCoords(fx1, -1);//位置 + pGline->point2->setCoords(fx1, -2);//位置 + m_vecColGrid << pGline; + } +} + +void QMyCustomPlot::setDepthY(float fy1, float fy2) +{ + this->m_iY1 = fy1; + this->m_iY2 = fy2; + this->yAxis->setRange(m_iY1, m_iY2); + + if (m_bRowGridVisible) + drawGrid(); +} + +void QMyCustomPlot::updateDepthY(float fy1, float fy2) +{ + this->m_iY1 = fy1; + this->m_iY2 = fy2; + //深度改变 + if (this->m_bX2Y == true) + { + //默认调换 + this->xAxis->setRange(m_iY1, m_iY2); + } + else + { + //针对裂缝的横向波形图,X,Y轴不调换 + this->yAxis->setRange(m_iY1, m_iY2); + } + + if (m_bRowGridVisible) + drawGrid(true); +} + +void QMyCustomPlot::drawGrid(bool b) +{ + for (int i = 0; i < m_vecRowGrid.size(); i++) + { + this->removeItem(m_vecRowGrid.at(i)); + } + m_vecRowGrid.clear(); + + int nabs1 = abs(m_iY2); + int nabs2 = abs(m_iY1); + for (; nabs1 < nabs2; nabs1 += 1) + { + QCPItemStraightLine* pGline = new QCPItemStraightLine(this); + if (nabs1 % m_ncuGrid == 0) // 粗网格 + { + pGline->setPen(m_cuPen); + } + else if (nabs1 % m_nzhongGrid == 0) // 中网格 + { + pGline->setPen(m_zhongPen); + } + else if (nabs1 % m_nxiGrid == 0) // 细网格 + { + pGline->setPen(m_xiPen); + } + + if (this->m_bX2Y == true && b) + { + pGline->point1->setCoords(-nabs1, 1);//位置 + pGline->point2->setCoords(-nabs1, 2);//位置 + } + else + { + pGline->point1->setCoords(1, -nabs1);//位置 + pGline->point2->setCoords(2, -nabs1);//位置 + } + m_vecRowGrid << pGline; + } +} + //道宽改变后,避免井壁取心等组件变形,需要重新刷新 void QMyCustomPlot::resetPosition() { diff --git a/logPlus/qmycustomplot.h b/logPlus/qmycustomplot.h index 8117ae6..84a1247 100644 --- a/logPlus/qmycustomplot.h +++ b/logPlus/qmycustomplot.h @@ -90,9 +90,18 @@ public: void resetPosition_GeoLith(); //地质层位 void resetPosition_Layer(); + + //设置刻度, 绘制网格线 + void setScaleX(float fx1, float fx2); + //设置深度, 绘制网格线 + void setDepthY(float fy1, float fy2); + //改变深度更新绘图 + void updateDepthY(float fy1, float fy2); + //绘制网格 + void drawGrid(bool b = false); protected: - //virtual void mouseMoveEvent(QMouseEvent *event); + public: // 井UUID @@ -191,6 +200,18 @@ public: bool m_bFirstTimeConnect=true; //初次绑定编辑曲线信号槽。 bool m_bPriviewRightList=false; //当前是否正在预览曲线。 + bool m_bRowGridVisible = true; // 网格横轴是否显示 + bool m_bColGridVisible = true; // 网格纵轴是否显示 + int m_nxiGrid = 1; // 细网格间隔 + QPen m_xiPen; + int m_nzhongGrid = 2; // 中网格间隔 + QPen m_zhongPen; + int m_ncuGrid = 10; // 粗网格间隔 + QPen m_cuPen; + + QVector m_vecRowGrid; // 细网格 + QVector m_vecColGrid; + // 组 QMap m_mapDragGroup;