diff --git a/ApplicationCode/Commands/RicDeleteItemExec.cpp b/ApplicationCode/Commands/RicDeleteItemExec.cpp index 060e5b35e7..bcad860806 100644 --- a/ApplicationCode/Commands/RicDeleteItemExec.cpp +++ b/ApplicationCode/Commands/RicDeleteItemExec.cpp @@ -34,6 +34,7 @@ #include "RimWellPathCollection.h" #include "RimView.h" #include "RimWellLogPlot.h" +#include "RimWellLogPlotTrace.h" #include "RimWellLogPlotCollection.h" #include "RimProject.h" @@ -115,6 +116,13 @@ void RicDeleteItemExec::redo() wellLogPlot->updateAvailableDepthRange(); } + RimWellLogPlotTrace* wellLogPlotTrace; + parentObj->firstAnchestorOrThisOfType(wellLogPlotTrace); + if (wellLogPlotTrace) + { + wellLogPlotTrace->updateAxisRanges(); + } + RimWellLogPlotCollection* wellLogPlotCollection = NULL; parentObj->firstAnchestorOrThisOfType(wellLogPlotCollection); if (wellLogPlotCollection) diff --git a/ApplicationCode/ProjectDataModel/RimWellLogPlotTrace.cpp b/ApplicationCode/ProjectDataModel/RimWellLogPlotTrace.cpp index 4e399523fd..1bf34c9189 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogPlotTrace.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellLogPlotTrace.cpp @@ -31,6 +31,10 @@ #include +#define RI_LOGPLOTTRACE_MINX_DEFAULT -10.0 +#define RI_LOGPLOTTRACE_MAXX_DEFAULT 100.0 + + CAF_PDM_SOURCE_INIT(RimWellLogPlotTrace, "WellLogPlotTrace"); //-------------------------------------------------------------------------------------------------- @@ -46,9 +50,8 @@ RimWellLogPlotTrace::RimWellLogPlotTrace() CAF_PDM_InitFieldNoDefault(&curves, "Curves", "", "", "", ""); curves.uiCapability()->setUiHidden(true); - CAF_PDM_InitField(&m_minimumValue, "MinimumValue", -10.0, "Minimum value", "", "", ""); - CAF_PDM_InitField(&m_maximumValue, "MaximumValue", 100.0, "Maximum value", "", "", ""); - + CAF_PDM_InitField(&m_minimumValue, "MinimumValue", RI_LOGPLOTTRACE_MINX_DEFAULT, "Minimum value", "", "", ""); + CAF_PDM_InitField(&m_maximumValue, "MaximumValue", RI_LOGPLOTTRACE_MAXX_DEFAULT, "Maximum value", "", "", ""); } //-------------------------------------------------------------------------------------------------- @@ -188,3 +191,37 @@ void RimWellLogPlotTrace::detachAllCurves() curves[cIdx]->detachCurve(); } } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimWellLogPlotTrace::updateAxisRanges() +{ + bool rangesChanged = false; + + if (m_viewer) + { + RimWellLogPlot* wellLogPlot; + firstAnchestorOrThisOfType(wellLogPlot); + if (wellLogPlot) + { + double minimumDepth, maximumDepth; + wellLogPlot->visibleDepthRange(&minimumDepth, &maximumDepth); + + m_viewer->setAxisScale(QwtPlot::yLeft, minimumDepth, maximumDepth); + rangesChanged = true; + } + + // Assume auto-scaling on X-axis as long as curves exist, reset to default if not + if (curves.size() < 1) + { + m_viewer->setAxisScale(QwtPlot::xTop, RI_LOGPLOTTRACE_MINX_DEFAULT, RI_LOGPLOTTRACE_MAXX_DEFAULT); + rangesChanged = true; + } + + if (rangesChanged) + { + m_viewer->replot(); + } + } +} diff --git a/ApplicationCode/ProjectDataModel/RimWellLogPlotTrace.h b/ApplicationCode/ProjectDataModel/RimWellLogPlotTrace.h index ac9beedfc1..de102e31ac 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogPlotTrace.h +++ b/ApplicationCode/ProjectDataModel/RimWellLogPlotTrace.h @@ -50,6 +50,7 @@ public: void loadDataAndUpdate(); bool availableDepthRange(double* minimumDepth, double* maximumDepth); + void updateAxisRanges(); RiuWellLogTracePlot* viewer();