(#538) Display correct unit in curve name

This commit is contained in:
Magne Sjaastad 2015-12-02 14:21:22 +01:00
parent de14b93f6b
commit a215e080cc
3 changed files with 18 additions and 5 deletions

View File

@ -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);

View File

@ -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;

View File

@ -51,7 +51,7 @@ public:
std::vector<double> depthValues() const;
std::vector<double> 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);