From 94095a16f0a373d5dfcc10ac3f11434c02092274 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A5l=20Hagen?= Date: Fri, 4 Sep 2015 12:21:41 +0200 Subject: [PATCH] (#396) Set visible depth range from all available data when there's only 1 trace with 1 curve --- .../ProjectDataModel/RimWellLogExtractionCurve.cpp | 11 +++++++++++ ApplicationCode/ProjectDataModel/RimWellLogPlot.cpp | 9 +++++++++ ApplicationCode/ProjectDataModel/RimWellLogPlot.h | 2 ++ 3 files changed, 22 insertions(+) diff --git a/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurve.cpp b/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurve.cpp index 380b9c8a88..f4190f5185 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurve.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurve.cpp @@ -34,6 +34,7 @@ #include "RimWellLogPlotCurve.h" #include "RimWellLogPlot.h" +#include "RimWellLogPlotTrace.h" #include "RiuWellLogTracePlot.h" #include "qwt_plot_curve.h" #include "RimWellLogPlotCollection.h" @@ -184,6 +185,16 @@ void RimWellLogExtractionCurve::updatePlotData() if (wellLogPlot) { wellLogPlot->updateAvailableDepthRange(); + + if (wellLogPlot->traceCount() == 1) + { + RimWellLogPlotTrace* plotTrace; + firstAnchestorOrThisOfType(plotTrace); + if (plotTrace && plotTrace->curveCount() == 1) + { + wellLogPlot->setVisibleDepthRangeFromContents(); + } + } } } diff --git a/ApplicationCode/ProjectDataModel/RimWellLogPlot.cpp b/ApplicationCode/ProjectDataModel/RimWellLogPlot.cpp index 1ed451ed74..877e43fd2e 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogPlot.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellLogPlot.cpp @@ -277,6 +277,15 @@ void RimWellLogPlot::updateAxisRanges() if (m_viewer) m_viewer->setDepthRange(m_minimumVisibleDepth, m_maximumVisibleDepth); } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimWellLogPlot::setVisibleDepthRangeFromContents() +{ + setDepthRange(m_depthRangeMinimum, m_depthRangeMaximum); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimWellLogPlot.h b/ApplicationCode/ProjectDataModel/RimWellLogPlot.h index 278e0d3994..2dfa64f813 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogPlot.h +++ b/ApplicationCode/ProjectDataModel/RimWellLogPlot.h @@ -56,6 +56,8 @@ public: void visibleDepthRange(double* minimumDepth, double* maximumDepth) const; void updateAxisRanges(); + void setVisibleDepthRangeFromContents(); + protected: // Overridden PDM methods