From 81b973a74c43ce12cffb23e491d24230d8db3f26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A5l=20Hagen?= Date: Tue, 22 Sep 2015 15:12:33 +0200 Subject: [PATCH] (#507) Picking unit name from LAS file in curve's update method --- .../RicAddWellLogToPlotFeature.cpp | 1 - .../ProjectDataModel/RimWellLogFileCurve.cpp | 22 +++++++++---------- .../ProjectDataModel/RimWellLogFileCurve.h | 1 - 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/ApplicationCode/Commands/WellLogCommands/RicAddWellLogToPlotFeature.cpp b/ApplicationCode/Commands/WellLogCommands/RicAddWellLogToPlotFeature.cpp index db40f29af0..9f5fdcb2a9 100644 --- a/ApplicationCode/Commands/WellLogCommands/RicAddWellLogToPlotFeature.cpp +++ b/ApplicationCode/Commands/WellLogCommands/RicAddWellLogToPlotFeature.cpp @@ -99,7 +99,6 @@ void RicAddWellLogToPlotFeature::onActionTriggered(bool isChecked) curve->setColor(curveColor); curve->setWellPath(wellPath); curve->setWellLogChannelName(wellLog->name()); - curve->setWellLogChannelUnit(wellLogDataFile->wellLogChannelUnit(wellLog->name())); curve->updatePlotData(); diff --git a/ApplicationCode/ProjectDataModel/RimWellLogFileCurve.cpp b/ApplicationCode/ProjectDataModel/RimWellLogFileCurve.cpp index c6058afd9f..8ea1b8781e 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogFileCurve.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellLogFileCurve.cpp @@ -87,6 +87,8 @@ void RimWellLogFileCurve::updatePlotData() { m_plotCurve->setSamples(NULL, NULL, 0); } + + m_plotCurve->setTitle(createCurveName()); } } else @@ -116,14 +118,6 @@ void RimWellLogFileCurve::setWellLogChannelName(const QString& name) m_wellLogChannnelName = name; } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimWellLogFileCurve::setWellLogChannelUnit(const QString& name) -{ - m_wellLogChannnelUnit = name; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -219,7 +213,7 @@ QList RimWellLogFileCurve::calculateValueOptions(const c //-------------------------------------------------------------------------------------------------- QString RimWellLogFileCurve::createCurveName() { - if (m_wellPath()) + if (m_wellPath) { QString txt; @@ -227,9 +221,15 @@ QString RimWellLogFileCurve::createCurveName() txt += " : "; txt += m_wellLogChannnelName; - if (!m_wellLogChannnelUnit().isEmpty()) + RimWellLogFile* logFileInfo = m_wellPath->m_wellLogFile; + RigWellLogFile* wellLogFile = logFileInfo ? logFileInfo->wellLogFile() : NULL; + if (wellLogFile) { - txt += QString(" [%1]").arg(m_wellLogChannnelUnit); + QString unitName = wellLogFile->wellLogChannelUnit(m_wellLogChannnelName); + if (!unitName.isEmpty()) + { + txt += QString(" [%1]").arg(wellLogFile->wellLogChannelUnit(m_wellLogChannnelName)); + } } return txt; diff --git a/ApplicationCode/ProjectDataModel/RimWellLogFileCurve.h b/ApplicationCode/ProjectDataModel/RimWellLogFileCurve.h index 16751b6f03..bf053e932d 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogFileCurve.h +++ b/ApplicationCode/ProjectDataModel/RimWellLogFileCurve.h @@ -43,7 +43,6 @@ class RimWellLogFileCurve : public RimWellLogPlotCurve void setWellPath(RimWellPath* wellPath); void setWellLogChannelName(const QString& name); - void setWellLogChannelUnit(const QString& name); // Overrides from RimWellLogPlotCurve virtual void updatePlotData();