From dce036166038c95caebb93ec61a202534cf003b2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C3=A5l=20Hagen?= <pal@applicano.com>
Date: Fri, 11 Sep 2015 13:22:33 +0200
Subject: [PATCH] (#438) Added unit to depth axis title. Did some refactoring.

---
 .../ProjectDataModel/RimWellLogPlot.cpp       | 22 +++++++++++++++++++
 .../ProjectDataModel/RimWellLogPlot.h         |  1 +
 .../ProjectDataModel/RimWellLogPlotTrace.cpp  |  3 +--
 3 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/ApplicationCode/ProjectDataModel/RimWellLogPlot.cpp b/ApplicationCode/ProjectDataModel/RimWellLogPlot.cpp
index 9ef0c049a0..40a4c7deb0 100644
--- a/ApplicationCode/ProjectDataModel/RimWellLogPlot.cpp
+++ b/ApplicationCode/ProjectDataModel/RimWellLogPlot.cpp
@@ -418,3 +418,25 @@ RimWellLogPlot::DepthTypeEnum RimWellLogPlot::depthType() const
 {
     return m_depthType.value();
 }
+
+//--------------------------------------------------------------------------------------------------
+/// 
+//--------------------------------------------------------------------------------------------------
+QString RimWellLogPlot::depthPlotTitle() const
+{
+    QString depthTitle = "Depth";
+    
+    switch (m_depthType.value())
+    {
+        case MEASURED_DEPTH:
+            depthTitle = "MD";
+            break;
+
+        case TRUE_VERTICAL_DEPTH:
+            depthTitle = "TVD";
+            break;
+    }
+
+    depthTitle += " [m]";
+    return depthTitle;
+}
diff --git a/ApplicationCode/ProjectDataModel/RimWellLogPlot.h b/ApplicationCode/ProjectDataModel/RimWellLogPlot.h
index d19b9739c0..0a1e0e0bfb 100644
--- a/ApplicationCode/ProjectDataModel/RimWellLogPlot.h
+++ b/ApplicationCode/ProjectDataModel/RimWellLogPlot.h
@@ -73,6 +73,7 @@ public:
     void setVisibleDepthRangeFromContents();
 
     DepthTypeEnum depthType() const;
+    QString depthPlotTitle() const;
 
     virtual caf::PdmFieldHandle* userDescriptionField()  { return &m_userName; }
 
diff --git a/ApplicationCode/ProjectDataModel/RimWellLogPlotTrace.cpp b/ApplicationCode/ProjectDataModel/RimWellLogPlotTrace.cpp
index cfcb2bd375..67d092c42d 100644
--- a/ApplicationCode/ProjectDataModel/RimWellLogPlotTrace.cpp
+++ b/ApplicationCode/ProjectDataModel/RimWellLogPlotTrace.cpp
@@ -165,8 +165,7 @@ void RimWellLogPlotTrace::loadDataAndUpdate()
     firstAnchestorOrThisOfType(wellLogPlot);
     if (wellLogPlot)
     {
-        QString depthTitle = wellLogPlot->depthType() == RimWellLogPlot::MEASURED_DEPTH ? "MD" : "TVD";
-        m_viewer->setDepthTitle(depthTitle);
+        m_viewer->setDepthTitle(wellLogPlot->depthPlotTitle());
     }
 
     for (size_t cIdx = 0; cIdx < curves.size(); ++cIdx)