mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Realization in Ensemble RFT-plot hover info + refactoring of point tracker functionality
* Add realization number to mouse over text for Ensemble RFT * Refactor Curve Info Text Provider functionality - Refactor provider implementation, to separate RiuWellLogTrack from the point tracker and text provider. - Move creating of point tracker outside of RiuWellLogTrack. - Makes it possible to override/write new CurveInfoTextProvider implementation when needed. * Add guards for nullptr
This commit is contained in:
@@ -25,6 +25,7 @@ set(SOURCE_GROUP_HEADER_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimWellLogWbsCurve.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimRftTools.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimRftTopologyCurve.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimWellLogCurveInfoTextProvider.h
|
||||
)
|
||||
|
||||
set(SOURCE_GROUP_SOURCE_FILES
|
||||
@@ -54,6 +55,7 @@ set(SOURCE_GROUP_SOURCE_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimEnsembleWellLogStatisticsCurve.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimRftTools.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimRftTopologyCurve.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimWellLogCurveInfoTextProvider.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES})
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2023- Equinor ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RimWellLogCurveInfoTextProvider.h"
|
||||
|
||||
#include "RimDepthTrackPlot.h"
|
||||
#include "RimWellLogCurve.h"
|
||||
|
||||
#include "RiuPlotCurve.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimWellLogCurveInfoTextProvider::curveInfoText( RiuPlotCurve* riuCurve ) const
|
||||
{
|
||||
if ( riuCurve )
|
||||
{
|
||||
RimWellLogCurve* wlCurve = dynamic_cast<RimWellLogCurve*>( riuCurve->ownerRimCurve() );
|
||||
if ( wlCurve )
|
||||
{
|
||||
return QString( "%1" ).arg( wlCurve->curveName() );
|
||||
}
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimWellLogCurveInfoTextProvider::additionalText( RiuPlotCurve* curve, int sampleIndex ) const
|
||||
{
|
||||
if ( !curve ) return {};
|
||||
|
||||
std::vector<std::pair<QString, double>> propertyNameValues;
|
||||
|
||||
auto* sourceCurve = curve->ownerRimCurve();
|
||||
if ( !sourceCurve ) return {};
|
||||
|
||||
auto annotationCurves = sourceCurve->additionalDataSources();
|
||||
for ( auto annotationCurve : annotationCurves )
|
||||
{
|
||||
RimDepthTrackPlot* depthTrackPlot = nullptr;
|
||||
annotationCurve->firstAncestorOfType( depthTrackPlot );
|
||||
if ( depthTrackPlot )
|
||||
{
|
||||
auto [xValue, yValue] = curve->sample( sampleIndex );
|
||||
|
||||
auto depth = depthTrackPlot->depthOrientation() == RiaDefines::Orientation::VERTICAL ? yValue : xValue;
|
||||
|
||||
auto propertyValue = annotationCurve->closestYValueForX( depth );
|
||||
|
||||
// Use template to get as short label as possible. The default curve name will often
|
||||
// contain too much and redundant information.
|
||||
QString templateText = RiaDefines::namingVariableResultName() + ", " + RiaDefines::namingVariableResultType();
|
||||
auto resultName = annotationCurve->createCurveNameFromTemplate( templateText );
|
||||
|
||||
propertyNameValues.push_back( std::make_pair( resultName, propertyValue ) );
|
||||
}
|
||||
}
|
||||
|
||||
QString txt;
|
||||
for ( const auto& [name, value] : propertyNameValues )
|
||||
{
|
||||
txt += QString( "%1 : %2\n" ).arg( name ).arg( value );
|
||||
}
|
||||
|
||||
return txt;
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2023- Equinor ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RiuPlotCurveInfoTextProvider.h"
|
||||
|
||||
class RiuPlotCurve;
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==================================================================================================
|
||||
class RimWellLogCurveInfoTextProvider : public RiuPlotCurveInfoTextProvider
|
||||
{
|
||||
public:
|
||||
QString curveInfoText( RiuPlotCurve* riuCurve ) const override;
|
||||
QString additionalText( RiuPlotCurve* curve, int sampleIndex ) const override;
|
||||
};
|
||||
@@ -528,7 +528,11 @@ std::map<QString, QString> RimWellLogRftCurve::createCurveNameKeyValueMap() cons
|
||||
{
|
||||
caseText = m_eclipseResultCase->caseUserDescription();
|
||||
}
|
||||
else if ( m_ensemble ) // Summary RFT curves have both ensemble and summary set. Prioritize ensemble for name.
|
||||
else if ( m_summaryCase && m_ensemble ) // Summary RFT curves have both ensemble and summary set
|
||||
{
|
||||
caseText = QString( "%1, %2" ).arg( m_ensemble->name() ).arg( m_summaryCase->displayCaseName() );
|
||||
}
|
||||
else if ( m_ensemble )
|
||||
{
|
||||
caseText = m_ensemble->name();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user