From 324d6d72e3e176eb541e874db58ce380e73ceaeb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20St=C3=B8ren?= Date: Sat, 11 Nov 2017 23:15:13 +0100 Subject: [PATCH] #2112 Avoid updating legend for each curve. Generalize and roll out the solution found for summary curves --- .../ProjectDataModel/Flow/RimWellFlowRateCurve.cpp | 2 +- .../ProjectDataModel/RimGridTimeHistoryCurve.cpp | 2 +- ApplicationCode/ProjectDataModel/RimPlotCurve.cpp | 13 ++++++++++--- ApplicationCode/ProjectDataModel/RimPlotCurve.h | 2 +- .../ProjectDataModel/RimWellLogExtractionCurve.cpp | 2 +- .../ProjectDataModel/RimWellLogFileCurve.cpp | 2 +- .../ProjectDataModel/RimWellLogRftCurve.cpp | 9 ++++++--- .../ProjectDataModel/RimWellLogTrack.cpp | 14 +++++++++++--- .../ProjectDataModel/Summary/RimAsciiDataCurve.cpp | 2 +- .../ProjectDataModel/Summary/RimSummaryCurve.cpp | 12 +----------- 10 files changed, 34 insertions(+), 26 deletions(-) diff --git a/ApplicationCode/ProjectDataModel/Flow/RimWellFlowRateCurve.cpp b/ApplicationCode/ProjectDataModel/Flow/RimWellFlowRateCurve.cpp index fe89b56ebb..95cea77cdc 100644 --- a/ApplicationCode/ProjectDataModel/Flow/RimWellFlowRateCurve.cpp +++ b/ApplicationCode/ProjectDataModel/Flow/RimWellFlowRateCurve.cpp @@ -134,7 +134,7 @@ QString RimWellFlowRateCurve::createCurveAutoName() //-------------------------------------------------------------------------------------------------- void RimWellFlowRateCurve::onLoadDataAndUpdate(bool updateParentPlot) { - RimWellLogCurve::updateCurvePresentation(); + this->RimPlotCurve::updateCurvePresentation(updateParentPlot); if (isCurveVisible()) { diff --git a/ApplicationCode/ProjectDataModel/RimGridTimeHistoryCurve.cpp b/ApplicationCode/ProjectDataModel/RimGridTimeHistoryCurve.cpp index 0cf0f02765..629e6ce985 100644 --- a/ApplicationCode/ProjectDataModel/RimGridTimeHistoryCurve.cpp +++ b/ApplicationCode/ProjectDataModel/RimGridTimeHistoryCurve.cpp @@ -293,7 +293,7 @@ void RimGridTimeHistoryCurve::updateZoomInParentPlot() //-------------------------------------------------------------------------------------------------- void RimGridTimeHistoryCurve::onLoadDataAndUpdate(bool updateParentPlot) { - this->RimPlotCurve::updateCurvePresentation(); + this->RimPlotCurve::updateCurvePresentation(updateParentPlot); if (isCurveVisible()) { diff --git a/ApplicationCode/ProjectDataModel/RimPlotCurve.cpp b/ApplicationCode/ProjectDataModel/RimPlotCurve.cpp index fe4c894124..30c05f0997 100644 --- a/ApplicationCode/ProjectDataModel/RimPlotCurve.cpp +++ b/ApplicationCode/ProjectDataModel/RimPlotCurve.cpp @@ -210,13 +210,20 @@ void RimPlotCurve::updateCurveVisibility() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimPlotCurve::updateCurvePresentation() +void RimPlotCurve::updateCurvePresentation(bool updatePlotLegend) { this->updateCurveVisibility(); - this->updateCurveNameAndUpdatePlotLegend(); + + if (updatePlotLegend) + { + this->updateCurveNameAndUpdatePlotLegend(); + } + else + { + this->updateCurveNameNoLegendUpdate(); + } updateCurveAppearance(); - // Todo: Rest of the curve setup controlled from this class } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimPlotCurve.h b/ApplicationCode/ProjectDataModel/RimPlotCurve.h index b5cc9d2d37..ee58669c7e 100644 --- a/ApplicationCode/ProjectDataModel/RimPlotCurve.h +++ b/ApplicationCode/ProjectDataModel/RimPlotCurve.h @@ -106,7 +106,7 @@ protected: virtual void updateZoomInParentPlot() = 0; virtual void onLoadDataAndUpdate(bool updateParentPlot) = 0; - void updateCurvePresentation(); + void updateCurvePresentation(bool updatePlotLegend); virtual void updateCurveAppearance(); void updateOptionSensitivity(); diff --git a/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurve.cpp b/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurve.cpp index 8f436c8224..3b287e11ae 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurve.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurve.cpp @@ -291,7 +291,7 @@ void RimWellLogExtractionCurve::fieldChangedByUi(const caf::PdmFieldHandle* chan //-------------------------------------------------------------------------------------------------- void RimWellLogExtractionCurve::onLoadDataAndUpdate(bool updateParentPlot) { - RimWellLogCurve::updateCurvePresentation(); + this->RimPlotCurve::updateCurvePresentation(updateParentPlot); if (isCurveVisible()) { diff --git a/ApplicationCode/ProjectDataModel/RimWellLogFileCurve.cpp b/ApplicationCode/ProjectDataModel/RimWellLogFileCurve.cpp index cd4ddfa4f4..7312608a4b 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogFileCurve.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellLogFileCurve.cpp @@ -76,7 +76,7 @@ RimWellLogFileCurve::~RimWellLogFileCurve() //-------------------------------------------------------------------------------------------------- void RimWellLogFileCurve::onLoadDataAndUpdate(bool updateParentPlot) { - RimWellLogCurve::updateCurvePresentation(); + this->RimPlotCurve::updateCurvePresentation(updateParentPlot); if (isCurveVisible()) { diff --git a/ApplicationCode/ProjectDataModel/RimWellLogRftCurve.cpp b/ApplicationCode/ProjectDataModel/RimWellLogRftCurve.cpp index 6bc352924f..6b8535da1f 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogRftCurve.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellLogRftCurve.cpp @@ -265,7 +265,7 @@ QString RimWellLogRftCurve::createCurveAutoName() //-------------------------------------------------------------------------------------------------- void RimWellLogRftCurve::onLoadDataAndUpdate(bool updateParentPlot) { - RimWellLogCurve::updateCurvePresentation(); + this->RimPlotCurve::updateCurvePresentation(updateParentPlot); m_isUsingPseudoLength = false; @@ -322,8 +322,11 @@ void RimWellLogRftCurve::onLoadDataAndUpdate(bool updateParentPlot) m_qwtPlotCurve->setLineSegmentStartStopIndices(m_curveData->polylineStartStopIndices()); - updateZoomInParentPlot(); - if (m_parentQwtPlot) m_parentQwtPlot->replot(); + if ( updateParentPlot && m_parentQwtPlot) + { + updateZoomInParentPlot(); + m_parentQwtPlot->replot(); + } } } diff --git a/ApplicationCode/ProjectDataModel/RimWellLogTrack.cpp b/ApplicationCode/ProjectDataModel/RimWellLogTrack.cpp index 5e361522f3..0df21cff2b 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogTrack.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellLogTrack.cpp @@ -449,14 +449,16 @@ void RimWellLogTrack::loadDataAndUpdate() { RimWellLogPlot* wellLogPlot; firstAncestorOrThisOfType(wellLogPlot); + if (wellLogPlot && m_wellLogTrackPlotWidget) { m_wellLogTrackPlotWidget->setDepthTitle(wellLogPlot->depthPlotTitle()); m_wellLogTrackPlotWidget->setXTitle(m_xAxisTitle); } + for (size_t cIdx = 0; cIdx < curves.size(); ++cIdx) { - curves[cIdx]->loadDataAndUpdate(true); + curves[cIdx]->loadDataAndUpdate(false); } if (m_showFormations) @@ -467,8 +469,14 @@ void RimWellLogTrack::loadDataAndUpdate() { setFormationFieldsUiReadOnly(true); } - - updateFormationNamesOnPlot(); + + if ( m_wellLogTrackPlotWidget ) + { + m_wellLogTrackPlotWidget->updateLegend(); + this->updateAxisScaleEngine(); + this->updateFormationNamesOnPlot(); + this->updateXZoomAndParentPlotDepthZoom(); + } } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/Summary/RimAsciiDataCurve.cpp b/ApplicationCode/ProjectDataModel/Summary/RimAsciiDataCurve.cpp index 0135181670..57e4568586 100644 --- a/ApplicationCode/ProjectDataModel/Summary/RimAsciiDataCurve.cpp +++ b/ApplicationCode/ProjectDataModel/Summary/RimAsciiDataCurve.cpp @@ -130,7 +130,7 @@ void RimAsciiDataCurve::updateZoomInParentPlot() //-------------------------------------------------------------------------------------------------- void RimAsciiDataCurve::onLoadDataAndUpdate(bool updateParentPlot) { - this->RimPlotCurve::updateCurvePresentation(); + this->RimPlotCurve::updateCurvePresentation(updateParentPlot); if (isCurveVisible()) { diff --git a/ApplicationCode/ProjectDataModel/Summary/RimSummaryCurve.cpp b/ApplicationCode/ProjectDataModel/Summary/RimSummaryCurve.cpp index acca9bfcd4..0399bb6794 100644 --- a/ApplicationCode/ProjectDataModel/Summary/RimSummaryCurve.cpp +++ b/ApplicationCode/ProjectDataModel/Summary/RimSummaryCurve.cpp @@ -377,17 +377,7 @@ void RimSummaryCurve::updateZoomInParentPlot() //-------------------------------------------------------------------------------------------------- void RimSummaryCurve::onLoadDataAndUpdate(bool updateParentPlot) { - this->updateCurveVisibility(); - if (updateParentPlot) - { - this->updateCurveNameAndUpdatePlotLegend(); - } - else - { - this->updateCurveNameNoLegendUpdate(); - } - - updateCurveAppearance(); + this->RimPlotCurve::updateCurvePresentation(updateParentPlot); m_selectedVariableDisplayField = QString::fromStdString(m_curveVariable->address().uiText());