diff --git a/logPlus/PickFrac.cpp b/logPlus/PickFrac.cpp index 370dd80..75d3d01 100644 --- a/logPlus/PickFrac.cpp +++ b/logPlus/PickFrac.cpp @@ -23,7 +23,7 @@ CPickFrac::CPickFrac(QMyCustomPlot *myCustomPlot, QString strSlfName, QString cs } //支持框选------------------ - //myCustomPlot->m_bDrawCore_PHYSICS = true; + myCustomPlot->m_bDrawCore_PHYSICS = true; ReadData(strSlfName, csCurve); diff --git a/logPlus/PropertyWidget.cpp b/logPlus/PropertyWidget.cpp index 1fc7f68..4260564 100644 --- a/logPlus/PropertyWidget.cpp +++ b/logPlus/PropertyWidget.cpp @@ -432,8 +432,6 @@ void PropertyWidget::changedCorePhysicsProperty(QtProperty *qtProperty, const QV { double temp = variant.toDouble(); this->m_formInfo->m_cp_corrDepth = temp; - // this->m_tdCorePhysics->m_left_Low = (temp); - // this->m_tdCorePhysics->m_right_Hight = (temp); this->m_tdCorePhysics->setRange(temp,temp,this->m_tdCorePhysics->getCpCoreValue()); this->m_tdCorePhysics->mPlot->saveToSLFCorePhysics(); } @@ -448,13 +446,26 @@ void PropertyWidget::changedCorePhysicsProperty(QtProperty *qtProperty, const QV { double temp = variant.toDouble(); this->m_formInfo->m_cp_leftScale = temp; - this->m_tdCorePhysics->setCpLeftScale(temp); +// this->m_tdCorePhysics->setCpLeftScale(temp); + // 这个操作需要修改所有对象 + QMap m_mapDraggable_CorePhysics = this->m_tdCorePhysics->mPlot->m_mapDraggable_CorePhysics; + for (QMap::Iterator iter = m_mapDraggable_CorePhysics.begin(); iter != m_mapDraggable_CorePhysics.end(); iter++) + { + TransparentDraggableCorePhysics* pDraggableRect = (TransparentDraggableCorePhysics*)iter.value(); + pDraggableRect->setCpLeftScale(temp); + } } else if("右刻度" == m_propertyData[qtProperty]) { double temp = variant.toDouble(); this->m_formInfo->m_cp_rightScale = temp; - this->m_tdCorePhysics->setCpRightScale(temp); +// this->m_tdCorePhysics->setCpRightScale(temp); + QMap m_mapDraggable_CorePhysics = this->m_tdCorePhysics->mPlot->m_mapDraggable_CorePhysics; + for (QMap::Iterator iter = m_mapDraggable_CorePhysics.begin(); iter != m_mapDraggable_CorePhysics.end(); iter++) + { + TransparentDraggableCorePhysics* pDraggableRect = (TransparentDraggableCorePhysics*)iter.value(); + pDraggableRect->setCpRightScale(temp); + } } else if("等分刻度数或自定义序列" == m_propertyData[qtProperty]) { @@ -505,6 +516,8 @@ void PropertyWidget::changedCorePhysicsProperty(QtProperty *qtProperty, const QV this->m_formInfo->m_cp_curveScale = temp; this->m_tdCorePhysics->setCpCurveScale(temp); } + + this->m_tdCorePhysics->update(); } diff --git a/logPlus/TransparentDraggableCorePhysics.cpp b/logPlus/TransparentDraggableCorePhysics.cpp index 4143eb9..ab570b2 100644 --- a/logPlus/TransparentDraggableCorePhysics.cpp +++ b/logPlus/TransparentDraggableCorePhysics.cpp @@ -239,17 +239,18 @@ void TransparentDraggableCorePhysics::onMouseRelease(QMouseEvent *event) //emit rangeChanged(getRange()); mDragMode = DragNone; //取消选中状态 -// QCPDataSelection emptySelection; -// mPlot->graph(0)->setSelection(emptySelection); -// mPlot->replot(); + // QCPDataSelection emptySelection; + // mPlot->graph(0)->setSelection(emptySelection); + // mPlot->replot(); //取消选中框 mPlot->selectionRect()->cancel(); mPlot->replot(); mPlot->selectionRect()->mActive=true; -// // 设置回选中之前的颜色 -// this->setCpLineColor(this->getCpLineColor()); + // // 设置回选中之前的颜色 + // this->setCpLineColor(this->getCpLineColor()); + PropertyService()->initCorePhysicsItemProperty(this); // 保存slf文件 this->mPlot->saveToSLFCorePhysics(); } @@ -379,6 +380,15 @@ void TransparentDraggableCorePhysics::setCpLeftScale(double value) this->m_cp_leftScale = value; this->mPlot->yAxis2->setRange(value, this->mPlot->yAxis2->range().upper); + + + + QList tracers = this->mPlot->findChildren(); + foreach (QCPItemLine *tracer, tracers) { + +// tracer->setVisible(value); + } + // 重新绘制图形 this->setRange(this->m_left_Low, this->m_left_Low, this->getCpCoreValue(), false); } diff --git a/logPlus/formdraw.cpp b/logPlus/formdraw.cpp index 7f4adb3..594b7d5 100644 --- a/logPlus/formdraw.cpp +++ b/logPlus/formdraw.cpp @@ -6731,8 +6731,9 @@ void FormDraw::initCorePhysics(QMyCustomPlot *widget, QString strSlfName, QStrin QString strAliasName = "岩心实验数据"; QString strUnit = ""; - // widget->m_bDrawCore_PHYSICS = true; + widget->m_bDrawCore_PHYSICS = true; addRandomGraph(widget, x, y, strSlfName, strLineName, strAliasName, strUnit); + // m_formTrack->Add(strSlfName, m_strWellName, m_strTrackName, strLineName, strAliasName, strUnit, newlineColor, width, m_vmax, m_vmin, strScaleType, "tableObject"); //支持框选------------------ // widget->setSelectionRectMode(QCP::SelectionRectMode::srmSelect); diff --git a/logPlus/forminfo.cpp b/logPlus/forminfo.cpp index 7415fa5..b7562a3 100644 --- a/logPlus/forminfo.cpp +++ b/logPlus/forminfo.cpp @@ -306,7 +306,6 @@ QJsonObject FormInfo::makeJson() { makeTvdJson(rootObj); } - else if (m_strType == "depthObject") { rootObj["bVerticaDrawing"] = m_bVerticaDrawing; // 垂向绘制 @@ -332,6 +331,7 @@ QJsonObject FormInfo::makeJson() rootObj["sdMinorTickLineLength"] = m_sdMinorTickLineLength; // 次刻度线长度 rootObj["sdMinorTickLineWidth"] = m_sdMinorTickLineWidth; // 次刻度线宽度 } + return rootObj; } @@ -757,10 +757,25 @@ void FormInfo::paintEvent(QPaintEvent* event) if(m_strLineName == "深度") { - // 2. 给painter设置字体(关键步骤) || m_strLineName == "CORE_PHYSICS" painter.setFont(m_strUnitFont); painter.drawText(rect.left(), rect.top() + rect.height() * 2 / 3, rect.width(), rect.height() / 3, Qt::AlignCenter, this->m_strUnit); } + if(m_strType == "tableObject" && m_strLineName == "CORE_PHYSICS") + { + QFont oldFont = painter.font(); + painter.setFont(m_strUnitFont); + painter.drawText(rect.left()+10, rect.top() + rect.height() * 2 / 3, rect.width(), rect.height() / 3, Qt::AlignCenter, m_strUnit); + painter.setFont(oldFont); + // 显示刻度 + if (m_bShowScale) + { + painter.setFont(m_curveScaleFont); + QFontMetrics fm1(m_curveScaleFont); + QRect textRect = fm1.boundingRect(QString::number(m_vmax, 'f', 0)); + painter.drawText(rect.left() + 10, rect.top() + rect.height() * 2 / 3, rect.width(), rect.height() / 3, Qt::AlignLeft | Qt::AlignVCenter, QString::number(m_vmin));// +" ~ " + QString::number(m_vmax)); + painter.drawText(rect.left() + 10, rect.top() + rect.height() * 2 / 3, rect.width() - textRect.width(), rect.height() / 3, Qt::AlignRight | Qt::AlignVCenter, QString::number(m_vmax)); + } + } QWidget::paintEvent(event); } diff --git a/logPlus/qmycustomplot.cpp b/logPlus/qmycustomplot.cpp index 063d719..a1d7cf8 100644 --- a/logPlus/qmycustomplot.cpp +++ b/logPlus/qmycustomplot.cpp @@ -799,51 +799,52 @@ void QMyCustomPlot::mousePressEvent(QMouseEvent *event) } } - if(m_bDrawCore_PHYSICS)//岩心分析 - { - //获取鼠标点位置 - double x_pos = event->pos().x(); - double y_pos = event->pos().y(); +// if(m_bDrawCore_PHYSICS)//岩心分析 +// { +// //获取鼠标点位置 +// double x_pos = event->pos().x(); +// double y_pos = event->pos().y(); - double x_val; - double y_val; - //转为图像位置 - x_val = xAxis->pixelToCoord(y_pos); - //曲线关联在左右轴判断 - y_val = yAxis->pixelToCoord(x_pos); +// double x_val; +// double y_val; +// //转为图像位置 +// x_val = xAxis->pixelToCoord(y_pos); +// //曲线关联在左右轴判断 +// y_val = yAxis->pixelToCoord(x_pos); - //从选择中获取数据区间 - QCPDataRange range; - if(graph(0)->selected()){ - range = graph(0)->selection().dataRange(); - } - // 检查选定的区间是否是单个数据点 - if (range.size() == 1) { - // 获取选定的数据点的下标范围 - dataIndex = range.begin(); - // 执行特定操作,例如输出下标: - }else{ - dataIndex = -1; - return; - } +// //从选择中获取数据区间 +// QCPDataRange range; +// qDebug() << graph(0)->selected() << "------===---------"; +// if(graph(0)->selected()){ +// range = graph(0)->selection().dataRange(); +// } +// // 检查选定的区间是否是单个数据点 +// if (range.size() == 1) { +// // 获取选定的数据点的下标范围 +// dataIndex = range.begin(); +// // 执行特定操作,例如输出下标: +// }else{ +// dataIndex = -1; +// return; +// } - double xx = graph(0)->data()->at(dataIndex)->key; -// double yy = graph(0)->data()->at(dataIndex)->value; +// double xx = graph(0)->data()->at(dataIndex)->key; +//// double yy = graph(0)->data()->at(dataIndex)->value; -//// double newYPoint = y_val / yy; //曲线Y轴数据 m_y.at(dataIndex) -//// double xDistand = abs(x_val - xx); //曲线X轴数据 m_x.at(dataIndex) +////// double newYPoint = y_val / yy; //曲线Y轴数据 m_y.at(dataIndex) +////// double xDistand = abs(x_val - xx); //曲线X轴数据 m_x.at(dataIndex) -//// //鼠标位距离数据点位置判断 -//// if (newYPoint > 0.2 && newYPoint < 3 && xDistand < 5) { -//// //在此范围(自由设计)则表示选中数据点 -//// dataIndex = dataIndex; -//// }else{ -//// dataIndex = -1; -//// } +////// //鼠标位距离数据点位置判断 +////// if (newYPoint > 0.2 && newYPoint < 3 && xDistand < 5) { +////// //在此范围(自由设计)则表示选中数据点 +////// dataIndex = dataIndex; +////// }else{ +////// dataIndex = -1; +////// } - singleOldPosition = xx; //记录了该点在曲线中Y轴的值 m_y.at(dataIndex) - singleDragMove = true; - } +// singleOldPosition = xx; //记录了该点在曲线中Y轴的值 m_y.at(dataIndex) +// singleDragMove = true; +// } QCustomPlot::mousePressEvent(event); } @@ -1027,9 +1028,9 @@ void QMyCustomPlot::mouseMoveEvent(QMouseEvent *event) if(m_bDrawCore_PHYSICS)//岩心分析 { - if(singleDragMove){ - executeSingle(event); - } +// if(singleDragMove){ +// executeSingle(event); +// } } else { @@ -1066,13 +1067,13 @@ void QMyCustomPlot::mouseReleaseEvent(QMouseEvent *event) } } - if(m_bDrawCore_PHYSICS)//岩心分析 - { - dataIndex = -1; - singleDragMove = false; - //setCursor(Qt::ArrowCursor); - replot(QCustomPlot::rpQueuedReplot); - } +// if(m_bDrawCore_PHYSICS)//岩心分析 +// { +// dataIndex = -1; +// singleDragMove = false; +// //setCursor(Qt::ArrowCursor); +// replot(QCustomPlot::rpQueuedReplot); +// } QCustomPlot::mouseReleaseEvent(event); } @@ -2913,9 +2914,6 @@ bool QMyCustomPlot::saveToSLFCorePhysics() for (QMap::Iterator iter = m_mapDraggable_CorePhysics.begin(); iter != m_mapDraggable_CorePhysics.end(); iter++) { pDraggableRect = (TransparentDraggableCorePhysics*)iter.value(); - // -// QCPRange tmpRange = pDraggableRect->m_right_Hight; - // float fSDepth = -pDraggableRect->m_right_Hight; listSDepth.append(fSDepth); }