From a215e080ccb7f2c8b5af2021aa252af3b37d29bd Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Wed, 2 Dec 2015 14:21:22 +0100 Subject: [PATCH] (#538) Display correct unit in curve name --- .../ProjectDataModel/RimWellLogFileCurve.cpp | 6 +++++- .../ReservoirDataModel/RigWellLogFile.cpp | 15 ++++++++++++--- .../ReservoirDataModel/RigWellLogFile.h | 2 +- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/ApplicationCode/ProjectDataModel/RimWellLogFileCurve.cpp b/ApplicationCode/ProjectDataModel/RimWellLogFileCurve.cpp index d91c6bdbe2..70a600074d 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogFileCurve.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellLogFileCurve.cpp @@ -263,7 +263,11 @@ QString RimWellLogFileCurve::createCurveName() RigWellLogFile* wellLogFile = logFileInfo ? logFileInfo->wellLogFile() : NULL; if (wellLogFile) { - QString unitName = wellLogFile->wellLogChannelUnitString(m_wellLogChannnelName); + RimWellLogPlot* wellLogPlot; + firstAnchestorOrThisOfType(wellLogPlot); + CVF_ASSERT(wellLogPlot); + + QString unitName = wellLogFile->wellLogChannelUnitString(m_wellLogChannnelName, wellLogPlot->depthUnit()); if (!unitName.isEmpty()) { txt += QString(" [%1]").arg(unitName); diff --git a/ApplicationCode/ReservoirDataModel/RigWellLogFile.cpp b/ApplicationCode/ReservoirDataModel/RigWellLogFile.cpp index 8c3dc5d36a..a0f787efd9 100644 --- a/ApplicationCode/ReservoirDataModel/RigWellLogFile.cpp +++ b/ApplicationCode/ReservoirDataModel/RigWellLogFile.cpp @@ -206,7 +206,7 @@ QString RigWellLogFile::depthUnitString() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QString RigWellLogFile::wellLogChannelUnitString(const QString& wellLogChannelName) const +QString RigWellLogFile::wellLogChannelUnitString(const QString& wellLogChannelName, RimDefines::DepthUnitType displayDepthUnit) const { QString unit; @@ -216,10 +216,19 @@ QString RigWellLogFile::wellLogChannelUnitString(const QString& wellLogChannelNa unit = QString::fromStdString(lasWell->unitName(wellLogChannelName.toStdString())); } - // Special handling of depth unit - we convert depth to meter if (unit == depthUnitString()) { - return "m"; + if (displayDepthUnit != depthUnit()) + { + if (displayDepthUnit == RimDefines::UNIT_METER) + { + return "M"; + } + else if (displayDepthUnit == RimDefines::UNIT_FEET) + { + return "FT"; + } + } } return unit; diff --git a/ApplicationCode/ReservoirDataModel/RigWellLogFile.h b/ApplicationCode/ReservoirDataModel/RigWellLogFile.h index d269eba7d1..403ae766e9 100644 --- a/ApplicationCode/ReservoirDataModel/RigWellLogFile.h +++ b/ApplicationCode/ReservoirDataModel/RigWellLogFile.h @@ -51,7 +51,7 @@ public: std::vector depthValues() const; std::vector values(const QString& name) const; - QString wellLogChannelUnitString(const QString& wellLogChannelName) const; + QString wellLogChannelUnitString(const QString& wellLogChannelName, RimDefines::DepthUnitType displayDepthUnit) const; RimDefines::DepthUnitType depthUnit() const; static bool exportToLasFile(const RimWellLogCurve* curve, const QString& fileName);