diff --git a/ApplicationCode/Commands/RicDeleteItemExec.cpp b/ApplicationCode/Commands/RicDeleteItemExec.cpp index 356955e036..b22c3b86a5 100644 --- a/ApplicationCode/Commands/RicDeleteItemExec.cpp +++ b/ApplicationCode/Commands/RicDeleteItemExec.cpp @@ -206,7 +206,7 @@ void RicDeleteItemExec::redo() parentObj->firstAncestorOrThisOfType(wellLogPlotTrack); if (wellLogPlotTrack) { - wellLogPlotTrack->updateXZoom(); + wellLogPlotTrack->calculateXZoomRangeAndUpdateQwt(); } // Update due to delete plots diff --git a/ApplicationCode/Commands/WellLogCommands/RicWellLogPlotTrackFeatureImpl.cpp b/ApplicationCode/Commands/WellLogCommands/RicWellLogPlotTrackFeatureImpl.cpp index 1884f87fea..f6620eef9f 100644 --- a/ApplicationCode/Commands/WellLogCommands/RicWellLogPlotTrackFeatureImpl.cpp +++ b/ApplicationCode/Commands/WellLogCommands/RicWellLogPlotTrackFeatureImpl.cpp @@ -70,11 +70,13 @@ void RicWellLogPlotTrackFeatureImpl::moveCurvesToWellLogPlotTrack(RimWellLogTrac for (std::set::iterator tIt = srcTracks.begin(); tIt != srcTracks.end(); ++tIt) { - (*tIt)->updateXZoomAndParentPlotDepthZoom(); + (*tIt)->updateParentPlotZoom(); + (*tIt)->calculateXZoomRangeAndUpdateQwt(); } destTrack->loadDataAndUpdate(); - destTrack->updateXZoomAndParentPlotDepthZoom(); + destTrack->updateParentPlotZoom(); + destTrack->calculateXZoomRangeAndUpdateQwt(); destTrack->updateConnectedEditors(); } diff --git a/ApplicationCode/ProjectDataModel/Flow/RimWellPltPlot.cpp b/ApplicationCode/ProjectDataModel/Flow/RimWellPltPlot.cpp index 55a1989977..98647760c3 100644 --- a/ApplicationCode/ProjectDataModel/Flow/RimWellPltPlot.cpp +++ b/ApplicationCode/ProjectDataModel/Flow/RimWellPltPlot.cpp @@ -702,8 +702,7 @@ void RimWellPltPlot::syncCurvesFromUiSelection() updateWidgetTitleWindowTitle(); m_wellLogPlot->loadDataAndUpdate(); - m_wellLogPlot->updateDepthZoom(); - plotTrack->updateXZoom(); + plotTrack->calculateXZoomRange(); } //-------------------------------------------------------------------------------------------------- @@ -945,6 +944,10 @@ void RimWellPltPlot::fieldChangedByUi(const caf::PdmFieldHandle* changedField, c updateFormationsOnPlot(); syncSourcesIoFieldFromGuiField(); syncCurvesFromUiSelection(); + m_wellLogPlot->updateDepthZoom(); + + RimWellLogTrack* const plotTrack = m_wellLogPlot->trackByIndex(0); + plotTrack->calculateXZoomRangeAndUpdateQwt(); } if ( changedField == &m_useStandardConditionCurves @@ -952,6 +955,11 @@ void RimWellPltPlot::fieldChangedByUi(const caf::PdmFieldHandle* changedField, c || changedField == &m_phases) { syncCurvesFromUiSelection(); + m_wellLogPlot->updateDepthZoom(); + + RimWellLogTrack* const plotTrack = m_wellLogPlot->trackByIndex(0); + plotTrack->calculateXZoomRangeAndUpdateQwt(); + } } diff --git a/ApplicationCode/ProjectDataModel/RimWellLogCurve.cpp b/ApplicationCode/ProjectDataModel/RimWellLogCurve.cpp index 2edbead991..62a7458dd6 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogCurve.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellLogCurve.cpp @@ -113,7 +113,7 @@ void RimWellLogCurve::updateZoomInParentPlot() firstAncestorOrThisOfType(plotTrack); if (plotTrack) { - plotTrack->updateXZoomAndParentPlotDepthZoom(); + plotTrack->calculateXZoomRangeAndUpdateQwt(); } } diff --git a/ApplicationCode/ProjectDataModel/RimWellLogCurve.h b/ApplicationCode/ProjectDataModel/RimWellLogCurve.h index 68a6f65653..953d5774e3 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogCurve.h +++ b/ApplicationCode/ProjectDataModel/RimWellLogCurve.h @@ -48,7 +48,6 @@ public: virtual QString wellDate() const { return ""; }; protected: - virtual void updateZoomInParentPlot(); - + virtual void updateZoomInParentPlot() override; cvf::ref m_curveData; }; diff --git a/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurve.cpp b/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurve.cpp index d53adb88dc..e4f821a9dc 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurve.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurve.cpp @@ -439,11 +439,17 @@ void RimWellLogExtractionCurve::onLoadDataAndUpdate(bool updateParentPlot) } } - updateZoomInParentPlot(); + if (updateParentPlot) + { + updateZoomInParentPlot(); + } setLogScaleFromSelectedResult(); - if (m_parentQwtPlot) m_parentQwtPlot->replot(); + if (m_parentQwtPlot) + { + m_parentQwtPlot->replot(); + } } } diff --git a/ApplicationCode/ProjectDataModel/RimWellLogFileCurve.cpp b/ApplicationCode/ProjectDataModel/RimWellLogFileCurve.cpp index 1864756ee3..3cc2eef52f 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogFileCurve.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellLogFileCurve.cpp @@ -168,9 +168,15 @@ void RimWellLogFileCurve::onLoadDataAndUpdate(bool updateParentPlot) } m_qwtPlotCurve->setLineSegmentStartStopIndices(m_curveData->polylineStartStopIndices()); - updateZoomInParentPlot(); + if (updateParentPlot) + { + updateZoomInParentPlot(); + } - if (m_parentQwtPlot) m_parentQwtPlot->replot(); + if (m_parentQwtPlot) + { + m_parentQwtPlot->replot(); + } } } diff --git a/ApplicationCode/ProjectDataModel/RimWellLogPlot.cpp b/ApplicationCode/ProjectDataModel/RimWellLogPlot.cpp index d75f5c9b9f..633186a447 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogPlot.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellLogPlot.cpp @@ -127,11 +127,16 @@ void RimWellLogPlot::fieldChangedByUi(const caf::PdmFieldHandle* changedField, c firstAncestorOrThisOfType(wellAllocPlot); if (wellAllocPlot) wellAllocPlot->loadDataAndUpdate(); else if (isRftPlotChild()) rftPlot()->loadDataAndUpdate(); - else updateTracks(); + else + { + updateTracks(); + updateDepthZoom(); + } } if ( changedField == &m_depthUnit) { updateTracks(); + updateDepthZoom(); } if ( changedField == &m_showTrackLegends) @@ -395,6 +400,7 @@ void RimWellLogPlot::zoomAll() { setDepthAutoZoom(true); updateDepthZoom(); + updateTracks(true); } //-------------------------------------------------------------------------------------------------- @@ -616,7 +622,7 @@ void RimWellLogPlot::onLoadDataAndUpdate() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellLogPlot::updateTracks() +void RimWellLogPlot::updateTracks(bool autoScaleXAxis) { if (m_showWindow) { @@ -625,10 +631,15 @@ void RimWellLogPlot::updateTracks() for (size_t tIdx = 0; tIdx < m_tracks.size(); ++tIdx) { m_tracks[tIdx]->loadDataAndUpdate(); + if (autoScaleXAxis) + { + m_tracks[tIdx]->setAutoScaleXEnabled(true); + m_tracks[tIdx]->calculateXZoomRangeAndUpdateQwt(); + } } calculateAvailableDepthRange(); - updateDepthZoom(); + applyDepthZoomFromVisibleDepth(); } } diff --git a/ApplicationCode/ProjectDataModel/RimWellLogPlot.h b/ApplicationCode/ProjectDataModel/RimWellLogPlot.h index da12f14bff..bad3c81bf3 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogPlot.h +++ b/ApplicationCode/ProjectDataModel/RimWellLogPlot.h @@ -84,7 +84,7 @@ public: RimWellLogTrack* trackByIndex(size_t index); - void updateTracks(); + void updateTracks(bool autoScaleXAxis = false); void updateTrackNames(); void updateDepthZoom(); diff --git a/ApplicationCode/ProjectDataModel/RimWellLogRftCurve.cpp b/ApplicationCode/ProjectDataModel/RimWellLogRftCurve.cpp index b583f9e4ab..6c8f71babc 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogRftCurve.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellLogRftCurve.cpp @@ -335,9 +335,13 @@ void RimWellLogRftCurve::onLoadDataAndUpdate(bool updateParentPlot) m_qwtPlotCurve->setLineSegmentStartStopIndices(m_curveData->polylineStartStopIndices()); - if ( updateParentPlot && m_parentQwtPlot) + if (updateParentPlot) { updateZoomInParentPlot(); + } + + if (m_parentQwtPlot) + { m_parentQwtPlot->replot(); } } diff --git a/ApplicationCode/ProjectDataModel/RimWellLogTrack.cpp b/ApplicationCode/ProjectDataModel/RimWellLogTrack.cpp index d3c8bcbde5..6644871d14 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogTrack.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellLogTrack.cpp @@ -239,22 +239,23 @@ void RimWellLogTrack::fieldChangedByUi(const caf::PdmFieldHandle* changedField, m_wellLogTrackPlotWidget->setXRange(m_visibleXRangeMin, m_visibleXRangeMax); m_wellLogTrackPlotWidget->replot(); m_isAutoScaleXEnabled = false; + updateEditors(); } else if (changedField == &m_isAutoScaleXEnabled) { if (m_isAutoScaleXEnabled()) { - this->updateXZoom(); + this->calculateXZoomRangeAndUpdateQwt(); computeAndSetXRangeMinForLogarithmicScale(); if (m_wellLogTrackPlotWidget) m_wellLogTrackPlotWidget->replot(); - } + } } else if (changedField == &m_isLogarithmicScaleEnabled) { updateAxisScaleEngine(); - this->updateXZoom(); + this->calculateXZoomRangeAndUpdateQwt(); computeAndSetXRangeMinForLogarithmicScale(); m_wellLogTrackPlotWidget->setXRange(m_visibleXRangeMin, m_visibleXRangeMax); @@ -557,7 +558,7 @@ void RimWellLogTrack::loadDataAndUpdate() m_wellLogTrackPlotWidget->updateLegend(); this->updateAxisScaleEngine(); this->updateFormationNamesOnPlot(); - this->updateXZoomAndParentPlotDepthZoom(); + this->applyXZoomFromVisibleRange(); } } @@ -609,6 +610,14 @@ void RimWellLogTrack::setAndUpdateSimWellFormationNamesData(RimCase* rimCase, co } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimWellLogTrack::setAutoScaleXEnabled(bool enabled) +{ + m_isAutoScaleXEnabled = enabled; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -698,7 +707,7 @@ void RimWellLogTrack::detachAllCurves() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellLogTrack::updateXZoomAndParentPlotDepthZoom() +void RimWellLogTrack::updateParentPlotZoom() { if (m_wellLogTrackPlotWidget) { @@ -708,17 +717,31 @@ void RimWellLogTrack::updateXZoomAndParentPlotDepthZoom() { wellLogPlot->updateDepthZoom(); } - - updateXZoom(); - - m_wellLogTrackPlotWidget->replot(); } } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellLogTrack::updateXZoom() +void RimWellLogTrack::calculateXZoomRangeAndUpdateQwt() +{ + this->calculateXZoomRange(); + this->applyXZoomFromVisibleRange(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimWellLogTrack::applyXZoomFromVisibleRange() +{ + m_wellLogTrackPlotWidget->setXRange(m_visibleXRangeMin, m_visibleXRangeMax); + m_wellLogTrackPlotWidget->replot(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimWellLogTrack::calculateXZoomRange() { std::map> stackCurveGroups = visibleStackedCurves(); for (const std::pair>& curveGroup : stackCurveGroups) @@ -728,12 +751,6 @@ void RimWellLogTrack::updateXZoom() if (!m_isAutoScaleXEnabled()) { - if (m_wellLogTrackPlotWidget) - { - m_wellLogTrackPlotWidget->setXRange(m_visibleXRangeMin, m_visibleXRangeMax); - m_wellLogTrackPlotWidget->replot(); - } - return; } @@ -769,10 +786,38 @@ void RimWellLogTrack::updateXZoom() m_visibleXRangeMax = maxValue; computeAndSetXRangeMinForLogarithmicScale(); + updateEditors(); +} - if (m_wellLogTrackPlotWidget) m_wellLogTrackPlotWidget->setXRange(m_visibleXRangeMin, m_visibleXRangeMax); +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimWellLogTrack::updateEditors() +{ + this->updateConnectedEditors(); - updateConnectedEditors(); + RimWellLogPlot* plot = nullptr; + firstAncestorOrThisOfTypeAsserted(plot); + plot->updateConnectedEditors(); + + RimWellRftPlot* rftPlot(nullptr); + + firstAncestorOrThisOfType(rftPlot); + + if (rftPlot) + { + rftPlot->updateConnectedEditors(); + } + else + { + RimWellPltPlot* pltPlot(nullptr); + firstAncestorOrThisOfType(pltPlot); + + if (pltPlot) + { + pltPlot->updateConnectedEditors(); + } + } } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimWellLogTrack.h b/ApplicationCode/ProjectDataModel/RimWellLogTrack.h index c6a7b70729..928ed02072 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogTrack.h +++ b/ApplicationCode/ProjectDataModel/RimWellLogTrack.h @@ -99,9 +99,13 @@ public: void setAndUpdateSimWellFormationNamesAndBranchData(RimCase* rimCase, const QString& simWellName, int branchIndex, bool useBranchDetection); void setAndUpdateSimWellFormationNamesData(RimCase* rimCase, const QString& simWellName); + void setAutoScaleXEnabled(bool enabled); void availableDepthRange(double* minimumDepth, double* maximumDepth); - void updateXZoomAndParentPlotDepthZoom(); - void updateXZoom(); + void updateParentPlotZoom(); + void calculateXZoomRangeAndUpdateQwt(); + void applyXZoomFromVisibleRange(); + void calculateXZoomRange(); + void updateEditors(); void setShowFormations(bool on);