mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Improve curve naming for plot and use in RFT segment plots
* Improve plot naming for depth track plots * Move template text replace to string tools * More data available for object template text * Set plot visible and define default object name template text
This commit is contained in:
@@ -112,6 +112,22 @@ QString RiaDefines::namingVariableTimestep()
|
||||
return "$TIME_STEP";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaDefines::namingVariableAirGap()
|
||||
{
|
||||
return "$AIR_GAP";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaDefines::namingVariableWaterDepth()
|
||||
{
|
||||
return "$WATER_DEPTH";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@@ -80,6 +80,8 @@ QString namingVariableResultName();
|
||||
QString namingVariableResultType();
|
||||
QString namingVariableTime();
|
||||
QString namingVariableTimestep();
|
||||
QString namingVariableAirGap();
|
||||
QString namingVariableWaterDepth();
|
||||
|
||||
double minimumDefaultValuePlot();
|
||||
double minimumDefaultLogValuePlot();
|
||||
|
@@ -140,6 +140,30 @@ QStringList RiaTextStringTools::splitSkipEmptyParts( const QString& text, const
|
||||
#endif
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaTextStringTools::replaceTemplateTextWithValues( const QString& templateText,
|
||||
const std::map<QString, QString>& valueMap )
|
||||
{
|
||||
QString resolvedText = templateText;
|
||||
|
||||
// Use a regular expression to find all occurrences of ${key} in the text and replace with the value
|
||||
|
||||
for ( const auto& [key, value] : valueMap )
|
||||
{
|
||||
QString regexString = key;
|
||||
regexString.replace( "$", "\\$" );
|
||||
regexString += "\\b";
|
||||
|
||||
QRegularExpression rx( regexString );
|
||||
|
||||
resolvedText.replace( rx, value );
|
||||
}
|
||||
|
||||
return resolvedText;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@@ -19,6 +19,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <QString>
|
||||
#include <map>
|
||||
|
||||
class QStringList;
|
||||
|
||||
@@ -36,4 +37,6 @@ QString trimNonAlphaNumericCharacters( const QString& s );
|
||||
QStringList splitSkipEmptyParts( const QString& text, const QString& sep = " " );
|
||||
QStringList splitSkipEmptyParts( const QString& text, const QRegExp& regExp );
|
||||
|
||||
QString replaceTemplateTextWithValues( const QString& templateText, const std::map<QString, QString>& valueMap );
|
||||
|
||||
} // namespace RiaTextStringTools
|
||||
|
@@ -42,6 +42,7 @@
|
||||
#include "RimStimPlanModelPlot.h"
|
||||
#include "RimStimPlanModelPlotCollection.h"
|
||||
#include "RimStimPlanModelTemplate.h"
|
||||
#include "RimWellLogPlotNameConfig.h"
|
||||
#include "RimWellLogTrack.h"
|
||||
#include "RimWellPath.h"
|
||||
#include "RimWellPathCollection.h"
|
||||
@@ -166,7 +167,6 @@ RimStimPlanModelPlot* RicNewStimPlanModelPlotFeature::createPlot( RimStimPlanMod
|
||||
{
|
||||
auto task = progInfo.task( "Updating all tracks", 5 );
|
||||
|
||||
plot->nameConfig()->setAutoNameTags( false, false, false, false, false );
|
||||
plot->setPlotTitleVisible( true );
|
||||
plot->setLegendsVisible( true );
|
||||
plot->setLegendsHorizontal( false );
|
||||
@@ -445,6 +445,7 @@ RimStimPlanModelPlot* RicNewStimPlanModelPlotFeature::createStimPlanModelPlot( b
|
||||
|
||||
stimPlanModelPlotColl->addStimPlanModelPlot( plot );
|
||||
|
||||
plot->setNamingMethod( RiaDefines::ObjectNamingMethod::CUSTOM );
|
||||
if ( !plotDescription.isEmpty() )
|
||||
{
|
||||
plot->nameConfig()->setCustomName( plotDescription );
|
||||
|
@@ -63,6 +63,11 @@ void RicNewMultiPhaseRftSegmentPlotFeature::onActionTriggered( bool isChecked )
|
||||
if ( !summaryCase ) return;
|
||||
|
||||
auto plot = RicNewWellLogPlotFeatureImpl::createHorizontalWellLogPlot();
|
||||
plot->setNamingMethod( RiaDefines::ObjectNamingMethod::TEMPLATE );
|
||||
QString templateText = RiaDefines::namingVariableCase() + ", " + RiaDefines::namingVariableWell() + " - Branch " +
|
||||
RiaDefines::namingVariableWellBranch() + ", " + RiaDefines::namingVariableTime();
|
||||
plot->setNameTemplateText( templateText );
|
||||
plot->setPlotTitleVisible( true );
|
||||
|
||||
QString wellName = "Unknown";
|
||||
|
||||
@@ -109,6 +114,11 @@ void RicNewMultiPhaseRftSegmentPlotFeature::appendTrackAndCurveForBranchType( Ri
|
||||
for ( const auto& resultName : resultNames )
|
||||
{
|
||||
auto curve = RicWellLogTools::addSummaryRftSegmentCurve( plotTrack, resultName, wellName, branchType, summaryCase );
|
||||
curve->setNamingMethod( RiaDefines::ObjectNamingMethod::TEMPLATE );
|
||||
|
||||
QString templateText = RiaDefines::namingVariableResultName() + ", " + RiaDefines::namingVariableResultType();
|
||||
curve->setCurveNameTemplateText( templateText );
|
||||
|
||||
curve->setIsStacked( true );
|
||||
curve->loadDataAndUpdate( true );
|
||||
|
||||
|
@@ -32,6 +32,7 @@
|
||||
#include "RimSimWellInView.h"
|
||||
#include "RimWellLogExtractionCurve.h"
|
||||
#include "RimWellLogPlot.h"
|
||||
#include "RimWellLogPlotNameConfig.h"
|
||||
#include "RimWellLogTrack.h"
|
||||
#include "RimWellPath.h"
|
||||
#include "RimWellPltPlot.h"
|
||||
@@ -113,6 +114,7 @@ void RicNewPltPlotFeature::onActionTriggered( bool isChecked )
|
||||
|
||||
pltPlotColl->addPlot( pltPlot );
|
||||
pltPlot->nameConfig()->setCustomName( plotName );
|
||||
pltPlot->setNamingMethod( RiaDefines::ObjectNamingMethod::CUSTOM );
|
||||
|
||||
// pltPlot->applyInitialSelections();
|
||||
pltPlot->loadDataAndUpdate();
|
||||
|
@@ -22,6 +22,7 @@
|
||||
#include "RimRftPlotCollection.h"
|
||||
#include "RimSimWellInView.h"
|
||||
#include "RimWellLogPlot.h"
|
||||
#include "RimWellLogPlotNameConfig.h"
|
||||
#include "RimWellLogTrack.h"
|
||||
#include "RimWellPath.h"
|
||||
#include "RimWellRftPlot.h"
|
||||
@@ -77,6 +78,7 @@ void RicNewRftPlotFeature::onActionTriggered( bool isChecked )
|
||||
QString plotName = QString( RimWellRftPlot::plotNameFormatString() ).arg( wellName );
|
||||
|
||||
rftPlot->nameConfig()->setCustomName( plotName );
|
||||
rftPlot->setNamingMethod( RiaDefines::ObjectNamingMethod::CUSTOM );
|
||||
|
||||
rftPlot->loadDataAndUpdate();
|
||||
rftPlotColl->updateConnectedEditors();
|
||||
|
@@ -62,6 +62,11 @@ void RicNewRftSegmentWellLogPlotFeature::onActionTriggered( bool isChecked )
|
||||
if ( !summaryCase ) return;
|
||||
|
||||
auto plot = RicNewWellLogPlotFeatureImpl::createHorizontalWellLogPlot();
|
||||
plot->setNamingMethod( RiaDefines::ObjectNamingMethod::TEMPLATE );
|
||||
QString templateText = RiaDefines::namingVariableCase() + ", " + RiaDefines::namingVariableWell() + " - Branch " +
|
||||
RiaDefines::namingVariableWellBranch() + ", " + RiaDefines::namingVariableTime();
|
||||
plot->setNameTemplateText( templateText );
|
||||
plot->setPlotTitleVisible( true );
|
||||
|
||||
QString wellName = "Unknown";
|
||||
|
||||
@@ -105,6 +110,11 @@ void RicNewRftSegmentWellLogPlotFeature::appendTrackAndCurveForBranchType( RimWe
|
||||
plot->loadDataAndUpdate();
|
||||
|
||||
auto curve = RicWellLogTools::addSummaryRftSegmentCurve( plotTrack, resultName, wellName, branchType, summaryCase );
|
||||
curve->setNamingMethod( RiaDefines::ObjectNamingMethod::TEMPLATE );
|
||||
|
||||
QString templateText = RiaDefines::namingVariableResultName() + ", " + RiaDefines::namingVariableResultType();
|
||||
curve->setCurveNameTemplateText( templateText );
|
||||
|
||||
curve->loadDataAndUpdate( true );
|
||||
|
||||
curve->updateAllRequiredEditors();
|
||||
|
@@ -110,7 +110,15 @@ RimWellBoreStabilityPlot*
|
||||
{
|
||||
auto task = progInfo.task( "Updating all tracks", 5 );
|
||||
|
||||
plot->nameConfig()->setAutoNameTags( true, true, true, true, true );
|
||||
QString templateText = QString( "%1, %2, %3, %4, %5" )
|
||||
.arg( RiaDefines::namingVariableCase() )
|
||||
.arg( RiaDefines::namingVariableWell() )
|
||||
.arg( RiaDefines::namingVariableTime() )
|
||||
.arg( RiaDefines::namingVariableAirGap() )
|
||||
.arg( RiaDefines::namingVariableWaterDepth() );
|
||||
plot->setNameTemplateText( templateText );
|
||||
plot->setNamingMethod( RiaDefines::ObjectNamingMethod::TEMPLATE );
|
||||
|
||||
plot->setPlotTitleVisible( true );
|
||||
plot->setLegendsVisible( true );
|
||||
plot->setLegendsHorizontal( true );
|
||||
|
@@ -29,6 +29,7 @@
|
||||
#include "RimWellLogCurveCommonDataSource.h"
|
||||
#include "RimWellLogPlot.h"
|
||||
#include "RimWellLogPlotCollection.h"
|
||||
#include "RimWellLogPlotNameConfig.h"
|
||||
#include "RimWellLogTrack.h"
|
||||
#include "RimWellPath.h"
|
||||
|
||||
|
@@ -22,6 +22,7 @@
|
||||
|
||||
#include "RimWellLogPlot.h"
|
||||
#include "RimWellLogPlotCollection.h"
|
||||
#include "RimWellLogPlotNameConfig.h"
|
||||
|
||||
#include "cafPdmObjectGroup.h"
|
||||
#include "cafPdmObjectHandle.h"
|
||||
|
@@ -234,10 +234,9 @@ void RimWellAllocationPlot::updateFromWell()
|
||||
if ( m_flowType() == ACCUMULATED ) description = "Accumulated Flow";
|
||||
if ( m_flowType() == INFLOW ) description = "Inflow Rates";
|
||||
|
||||
RimWellLogPlotNameConfig* nameConfig = accumulatedWellFlowPlot()->nameConfig();
|
||||
nameConfig->setCustomName( description );
|
||||
nameConfig->setAutoNameTags( false, true, false, false, false );
|
||||
nameConfig->setFieldVisibility( true, true, true, false, false );
|
||||
accumulatedWellFlowPlot()->setNameTemplateText( description + " " + RiaDefines::namingVariableWell() );
|
||||
accumulatedWellFlowPlot()->setNamingMethod( RiaDefines::ObjectNamingMethod::TEMPLATE );
|
||||
|
||||
accumulatedWellFlowPlot()->updateAutoName();
|
||||
|
||||
if ( !m_case ) return;
|
||||
|
@@ -52,6 +52,7 @@
|
||||
#include "RimWellLogFileCurve.h"
|
||||
#include "RimWellLogPlot.h"
|
||||
#include "RimWellLogPlotCollection.h"
|
||||
#include "RimWellLogPlotNameConfig.h"
|
||||
#include "RimWellLogRftCurve.h"
|
||||
#include "RimWellLogTrack.h"
|
||||
#include "RimWellPath.h"
|
||||
@@ -130,6 +131,7 @@ RimWellPltPlot::RimWellPltPlot()
|
||||
m_phases.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN );
|
||||
|
||||
m_nameConfig->setCustomName( "PLT Plot" );
|
||||
setNamingMethod( RiaDefines::ObjectNamingMethod::CUSTOM );
|
||||
|
||||
this->setAsPlotMdiWindow();
|
||||
m_doInitAfterLoad = false;
|
||||
|
@@ -47,6 +47,7 @@
|
||||
#include "RimWellLogFileChannel.h"
|
||||
#include "RimWellLogFileCurve.h"
|
||||
#include "RimWellLogPlot.h"
|
||||
#include "RimWellLogPlotNameConfig.h"
|
||||
#include "RimWellLogRftCurve.h"
|
||||
#include "RimWellLogTrack.h"
|
||||
#include "RimWellPath.h"
|
||||
@@ -129,6 +130,8 @@ RimWellRftPlot::RimWellRftPlot()
|
||||
setAvailableDepthTypes( { RiaDefines::DepthTypeEnum::MEASURED_DEPTH, RiaDefines::DepthTypeEnum::TRUE_VERTICAL_DEPTH } );
|
||||
|
||||
m_nameConfig->setCustomName( "RFT Plot" );
|
||||
setNamingMethod( RiaDefines::ObjectNamingMethod::CUSTOM );
|
||||
|
||||
m_plotLegendsHorizontal = false;
|
||||
|
||||
setPlotTitleVisible( true );
|
||||
|
@@ -22,6 +22,8 @@
|
||||
#include "RiaGuiApplication.h"
|
||||
#include "RiaOptionItemFactory.h"
|
||||
#include "RiaPreferences.h"
|
||||
#include "RiaQDateTimeTools.h"
|
||||
#include "RiaTextStringTools.h"
|
||||
|
||||
#include "RiaResultNames.h"
|
||||
#include "RigWellLogCurveData.h"
|
||||
@@ -41,6 +43,7 @@
|
||||
#include "RimWellAllocationPlot.h"
|
||||
#include "RimWellLogCurve.h"
|
||||
#include "RimWellLogCurveCommonDataSource.h"
|
||||
#include "RimWellLogPlotNameConfig.h"
|
||||
#include "RimWellLogTrack.h"
|
||||
#include "RimWellPath.h"
|
||||
|
||||
@@ -108,6 +111,10 @@ RimDepthTrackPlot::RimDepthTrackPlot()
|
||||
CAF_PDM_InitField( &m_plotWindowTitle, "PlotDescription", QString( "" ), "Name" );
|
||||
m_plotWindowTitle.xmlCapability()->setIOWritable( false );
|
||||
|
||||
auto templateText = QString( "%1, %2" ).arg( RiaDefines::namingVariableCase() ).arg( RiaDefines::namingVariableWell() );
|
||||
CAF_PDM_InitField( &m_nameTemplateText, "TemplateText", templateText, "Template Text" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_namingMethod, "PlotNamingMethod", "Plot Name" );
|
||||
|
||||
caf::AppEnum<RimDepthTrackPlot::DepthTypeEnum> depthType = RiaDefines::DepthTypeEnum::MEASURED_DEPTH;
|
||||
CAF_PDM_InitScriptableField( &m_depthType, "DepthType", depthType, "Type" );
|
||||
|
||||
@@ -486,7 +493,102 @@ void RimDepthTrackPlot::uiOrderingForDepthAxis( QString uiConfigName, caf::PdmUi
|
||||
void RimDepthTrackPlot::uiOrderingForAutoName( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
uiOrdering.add( &m_showPlotTitle );
|
||||
uiOrdering.add( &m_namingMethod );
|
||||
uiOrdering.add( &m_nameTemplateText );
|
||||
|
||||
m_nameConfig->uiOrdering( uiConfigName, uiOrdering );
|
||||
|
||||
auto tooltipText = supportedPlotNameVariables().join( ", " );
|
||||
m_nameTemplateText.uiCapability()->setUiToolTip( tooltipText );
|
||||
m_nameTemplateText.uiCapability()->setUiHidden( m_namingMethod() != RiaDefines::ObjectNamingMethod::TEMPLATE );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimDepthTrackPlot::createPlotNameFromTemplate( const QString& templateText ) const
|
||||
{
|
||||
return RiaTextStringTools::replaceTemplateTextWithValues( templateText, createNameKeyValueMap() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QStringList RimDepthTrackPlot::supportedPlotNameVariables() const
|
||||
{
|
||||
return { RiaDefines::namingVariableCase(),
|
||||
RiaDefines::namingVariableWell(),
|
||||
RiaDefines::namingVariableWellBranch(),
|
||||
RiaDefines::namingVariableTime(),
|
||||
RiaDefines::namingVariableAirGap() };
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::map<QString, QString> RimDepthTrackPlot::createNameKeyValueMap() const
|
||||
{
|
||||
std::map<QString, QString> variableValueMap;
|
||||
|
||||
RimCase* commonCase = m_commonDataSource->caseToApply();
|
||||
RimWellPath* commonWellPath = m_commonDataSource->wellPathToApply();
|
||||
|
||||
if ( commonCase )
|
||||
{
|
||||
variableValueMap[RiaDefines::namingVariableCase()] = commonCase->caseUserDescription();
|
||||
|
||||
if ( m_commonDataSource->timeStepToApply() != -1 )
|
||||
{
|
||||
variableValueMap[RiaDefines::namingVariableTime()] =
|
||||
commonCase->timeStepName( m_commonDataSource->timeStepToApply() );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
auto summaryCase = m_commonDataSource->summaryCaseToApply();
|
||||
if ( summaryCase )
|
||||
{
|
||||
variableValueMap[RiaDefines::namingVariableCase()] = summaryCase->displayCaseName();
|
||||
|
||||
auto wellName = m_commonDataSource->rftWellName();
|
||||
if ( !wellName.isEmpty() ) variableValueMap[RiaDefines::namingVariableWell()] = wellName;
|
||||
|
||||
auto dateTime = m_commonDataSource->rftTime();
|
||||
if ( dateTime.isValid() )
|
||||
{
|
||||
variableValueMap[RiaDefines::namingVariableTime()] =
|
||||
dateTime.toString( RiaQDateTimeTools::dateFormatString() );
|
||||
}
|
||||
|
||||
auto branchIndex = m_commonDataSource->rftBranchIndex();
|
||||
if ( branchIndex >= 0 )
|
||||
{
|
||||
variableValueMap[RiaDefines::namingVariableWellBranch()] = QString::number( branchIndex );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( commonWellPath && !commonWellPath->name().isEmpty() )
|
||||
{
|
||||
variableValueMap[RiaDefines::namingVariableWell()] = commonWellPath->name();
|
||||
}
|
||||
else if ( !m_commonDataSource->simWellNameToApply().isEmpty() )
|
||||
{
|
||||
variableValueMap[RiaDefines::namingVariableWell()] = m_commonDataSource->simWellNameToApply();
|
||||
}
|
||||
|
||||
if ( commonWellPath )
|
||||
{
|
||||
RigWellPath* wellPathGeometry = commonWellPath->wellPathGeometry();
|
||||
if ( wellPathGeometry )
|
||||
{
|
||||
double rkb = wellPathGeometry->rkbDiff();
|
||||
|
||||
variableValueMap[RiaDefines::namingVariableAirGap()] = QString( "Air Gap = %1 m" ).arg( rkb );
|
||||
}
|
||||
}
|
||||
|
||||
return variableValueMap;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -494,60 +596,32 @@ void RimDepthTrackPlot::uiOrderingForAutoName( QString uiConfigName, caf::PdmUiO
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimDepthTrackPlot::createAutoName() const
|
||||
{
|
||||
QStringList generatedCurveName;
|
||||
|
||||
if ( !m_nameConfig->customName().isEmpty() )
|
||||
if ( m_namingMethod() == RiaDefines::ObjectNamingMethod::AUTO )
|
||||
{
|
||||
generatedCurveName.push_back( m_nameConfig->customName() );
|
||||
}
|
||||
// Use the ordering of the supported variables to create a name
|
||||
auto candidateNames = supportedPlotNameVariables();
|
||||
|
||||
RimCase* commonCase = m_commonDataSource->caseToApply();
|
||||
RimWellPath* commonWellPath = m_commonDataSource->wellPathToApply();
|
||||
auto variableValues = createNameKeyValueMap();
|
||||
|
||||
QStringList generatedAutoTags;
|
||||
if ( m_nameConfig->addCaseName() && commonCase )
|
||||
{
|
||||
generatedAutoTags.push_back( commonCase->caseUserDescription() );
|
||||
}
|
||||
|
||||
if ( m_nameConfig->addWellName() )
|
||||
{
|
||||
if ( commonWellPath && !commonWellPath->name().isEmpty() )
|
||||
QStringList variablesWithValue;
|
||||
for ( const auto& name : candidateNames )
|
||||
{
|
||||
generatedAutoTags.push_back( commonWellPath->name() );
|
||||
}
|
||||
else if ( !m_commonDataSource->simWellNameToApply().isEmpty() )
|
||||
{
|
||||
generatedAutoTags.push_back( m_commonDataSource->simWellNameToApply() );
|
||||
}
|
||||
}
|
||||
|
||||
if ( m_nameConfig->addTimeStep() )
|
||||
{
|
||||
if ( commonCase && m_commonDataSource->timeStepToApply() != -1 )
|
||||
{
|
||||
generatedAutoTags.push_back( commonCase->timeStepName( m_commonDataSource->timeStepToApply() ) );
|
||||
}
|
||||
}
|
||||
|
||||
if ( m_nameConfig->addAirGap() )
|
||||
{
|
||||
if ( commonWellPath )
|
||||
{
|
||||
RigWellPath* wellPathGeometry = commonWellPath->wellPathGeometry();
|
||||
if ( wellPathGeometry )
|
||||
if ( variableValues.count( name ) )
|
||||
{
|
||||
double rkb = wellPathGeometry->rkbDiff();
|
||||
generatedAutoTags.push_back( QString( "Air Gap = %1 m" ).arg( rkb ) );
|
||||
variablesWithValue.push_back( name );
|
||||
}
|
||||
}
|
||||
|
||||
QString templateText = variablesWithValue.join( ", " );
|
||||
return createPlotNameFromTemplate( templateText );
|
||||
}
|
||||
|
||||
if ( !generatedAutoTags.empty() )
|
||||
if ( m_namingMethod() == RiaDefines::ObjectNamingMethod::TEMPLATE )
|
||||
{
|
||||
generatedCurveName.push_back( generatedAutoTags.join( ", " ) );
|
||||
return createPlotNameFromTemplate( m_nameTemplateText );
|
||||
}
|
||||
return generatedCurveName.join( ": " );
|
||||
|
||||
return m_nameConfig->customName();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -558,6 +632,22 @@ RimWellLogPlotNameConfig* RimDepthTrackPlot::nameConfig() const
|
||||
return m_nameConfig;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimDepthTrackPlot::setNameTemplateText( const QString& templateText )
|
||||
{
|
||||
m_nameTemplateText = templateText;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimDepthTrackPlot::setNamingMethod( RiaDefines::ObjectNamingMethod namingMethod )
|
||||
{
|
||||
m_namingMethod = namingMethod;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -860,13 +950,6 @@ void RimDepthTrackPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedFiel
|
||||
{
|
||||
m_isAutoScaleDepthEnabled = true;
|
||||
|
||||
bool isTVDRKB = m_depthType == RiaDefines::DepthTypeEnum::TRUE_VERTICAL_DEPTH_RKB;
|
||||
m_nameConfig->setAutoNameTags( m_nameConfig->addCaseName(),
|
||||
m_nameConfig->addWellName(),
|
||||
m_nameConfig->addTimeStep(),
|
||||
isTVDRKB,
|
||||
m_nameConfig->addWaterDepth() );
|
||||
|
||||
RimWellAllocationPlot* parentWellAllocation = nullptr;
|
||||
this->firstAncestorOrThisOfType( parentWellAllocation );
|
||||
if ( parentWellAllocation )
|
||||
@@ -892,7 +975,7 @@ void RimDepthTrackPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedFiel
|
||||
{
|
||||
updateFonts();
|
||||
}
|
||||
else if ( changedField == &m_showPlotTitle )
|
||||
else if ( changedField == &m_showPlotTitle || changedField == &m_namingMethod || changedField == &m_nameTemplateText )
|
||||
{
|
||||
performAutoNameUpdate();
|
||||
}
|
||||
@@ -999,6 +1082,23 @@ QList<caf::PdmOptionItemInfo> RimDepthTrackPlot::calculateValueOptions( const ca
|
||||
{
|
||||
RiaOptionItemFactory::appendOptionItemsForEnsembleCurveSets( &options );
|
||||
}
|
||||
else if ( fieldNeedingOptions == &m_namingMethod )
|
||||
{
|
||||
options.push_back( caf::PdmOptionItemInfo( caf::AppEnum<RiaDefines::ObjectNamingMethod>::uiText(
|
||||
RiaDefines::ObjectNamingMethod::AUTO ),
|
||||
RiaDefines::ObjectNamingMethod::AUTO ) );
|
||||
|
||||
options.push_back( caf::PdmOptionItemInfo( caf::AppEnum<RiaDefines::ObjectNamingMethod>::uiText(
|
||||
RiaDefines::ObjectNamingMethod::CUSTOM ),
|
||||
RiaDefines::ObjectNamingMethod::CUSTOM ) );
|
||||
|
||||
if ( !supportedPlotNameVariables().isEmpty() )
|
||||
{
|
||||
options.push_back( caf::PdmOptionItemInfo( caf::AppEnum<RiaDefines::ObjectNamingMethod>::uiText(
|
||||
RiaDefines::ObjectNamingMethod::TEMPLATE ),
|
||||
RiaDefines::ObjectNamingMethod::TEMPLATE ) );
|
||||
}
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
||||
@@ -1019,6 +1119,13 @@ void RimDepthTrackPlot::initAfterRead()
|
||||
{
|
||||
m_nameConfig->setCustomName( m_plotWindowTitle );
|
||||
}
|
||||
|
||||
if ( RimProject::current()->isProjectFileVersionEqualOrOlderThan( "2022.06.2" ) &&
|
||||
!m_nameConfig->customName().isEmpty() )
|
||||
{
|
||||
m_namingMethod = RiaDefines::ObjectNamingMethod::CUSTOM;
|
||||
}
|
||||
|
||||
performAutoNameUpdate();
|
||||
}
|
||||
|
||||
|
@@ -26,7 +26,6 @@
|
||||
#include "RimEnsembleWellLogStatistics.h"
|
||||
#include "RimPlot.h"
|
||||
#include "RimPlotWindow.h"
|
||||
#include "RimWellLogPlotNameConfig.h"
|
||||
|
||||
#include "cafAppEnum.h"
|
||||
#include "cafPdmChildArrayField.h"
|
||||
@@ -46,6 +45,7 @@ class RimPlot;
|
||||
class RimEnsembleCurveSet;
|
||||
class RiuPlotAxis;
|
||||
class RimWellLogTrack;
|
||||
class RimWellLogPlotNameConfig;
|
||||
|
||||
class QKeyEvent;
|
||||
|
||||
@@ -134,6 +134,8 @@ public:
|
||||
|
||||
QString createAutoName() const override;
|
||||
RimWellLogPlotNameConfig* nameConfig() const;
|
||||
void setNameTemplateText( const QString& templateText );
|
||||
void setNamingMethod( RiaDefines::ObjectNamingMethod namingMethod );
|
||||
|
||||
RimWellLogCurveCommonDataSource* commonDataSource() const;
|
||||
void updateCommonDataSource();
|
||||
@@ -165,8 +167,13 @@ protected:
|
||||
|
||||
QWidget* createViewWidget( QWidget* mainWindowParent ) override;
|
||||
void deleteViewWidget() override;
|
||||
void performAutoNameUpdate() override;
|
||||
void recreatePlotWidgets();
|
||||
|
||||
void performAutoNameUpdate() override;
|
||||
QString createPlotNameFromTemplate( const QString& templateText ) const override;
|
||||
QStringList supportedPlotNameVariables() const override;
|
||||
virtual std::map<QString, QString> createNameKeyValueMap() const;
|
||||
|
||||
void recreatePlotWidgets();
|
||||
|
||||
// Overridden PDM methods
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||
@@ -194,6 +201,9 @@ protected:
|
||||
bool m_commonDataSourceEnabled;
|
||||
|
||||
caf::PdmField<QString> m_plotWindowTitle;
|
||||
caf::PdmField<QString> m_nameTemplateText;
|
||||
|
||||
caf::PdmField<caf::AppEnum<RiaDefines::ObjectNamingMethod>> m_namingMethod;
|
||||
|
||||
// Depth axis
|
||||
caf::PdmField<caf::AppEnum<DepthTypeEnum>> m_depthType;
|
||||
|
@@ -34,6 +34,10 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void performAutoNameUpdate() {}
|
||||
|
||||
// Override these two methods to show and use curve name template when assigning a name to the curve
|
||||
virtual QString createPlotNameFromTemplate( const QString& templateText ) const { return templateText; }
|
||||
virtual QStringList supportedPlotNameVariables() const { return {}; }
|
||||
};
|
||||
|
||||
//==================================================================================================
|
||||
|
@@ -388,6 +388,22 @@ void RimPlotCurve::updateCurveNameNoLegendUpdate()
|
||||
updateLegendEntryVisibilityNoPlotUpdate();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotCurve::setCurveNameTemplateText( const QString& templateText )
|
||||
{
|
||||
m_curveNameTemplateText = templateText;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotCurve::setNamingMethod( RiaDefines::ObjectNamingMethod namingMethod )
|
||||
{
|
||||
m_namingMethod = namingMethod;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@@ -84,7 +84,9 @@ public:
|
||||
void updateCurveName();
|
||||
void updateCurveNameAndUpdatePlotLegendAndTitle();
|
||||
void updateCurveNameNoLegendUpdate();
|
||||
void setCurveNameTemplateText( const QString& templateText );
|
||||
|
||||
void setNamingMethod( RiaDefines::ObjectNamingMethod namingMethod );
|
||||
QString curveName() const;
|
||||
virtual QString curveExportDescription( const RifEclipseSummaryAddress& address = RifEclipseSummaryAddress() ) const;
|
||||
|
||||
|
@@ -29,6 +29,7 @@
|
||||
#include "RimWbsParameters.h"
|
||||
#include "RimWellLogCurveCommonDataSource.h"
|
||||
#include "RimWellLogFile.h"
|
||||
#include "RimWellLogPlotNameConfig.h"
|
||||
|
||||
#include "cafPdmBase.h"
|
||||
#include "cafPdmFieldScriptingCapability.h"
|
||||
@@ -173,6 +174,31 @@ void RimWellBoreStabilityPlot::initAfterRead()
|
||||
applyDataSource();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QStringList RimWellBoreStabilityPlot::supportedPlotNameVariables() const
|
||||
{
|
||||
auto variables = RimWellLogPlot::supportedPlotNameVariables();
|
||||
|
||||
variables.append( RiaDefines::namingVariableWaterDepth() );
|
||||
|
||||
return variables;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::map<QString, QString> RimWellBoreStabilityPlot::createNameKeyValueMap() const
|
||||
{
|
||||
auto nameKeyValueMap = RimWellLogPlot::createNameKeyValueMap();
|
||||
|
||||
QString waterDepthString = QString( "Water Depth = %1 m" ).arg( m_waterDepth );
|
||||
nameKeyValueMap[RiaDefines::namingVariableWaterDepth()] = waterDepthString;
|
||||
|
||||
return nameKeyValueMap;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -183,20 +209,3 @@ void RimWellBoreStabilityPlot::applyDataSource()
|
||||
m_wbsParameters->setTimeStep( m_commonDataSource->timeStepToApply() );
|
||||
this->updateConnectedEditors();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimWellBoreStabilityPlot::createAutoName() const
|
||||
{
|
||||
QString name = RimWellLogPlot::createAutoName();
|
||||
|
||||
if ( m_nameConfig->addWaterDepth() && m_waterDepth != std::numeric_limits<double>::infinity() )
|
||||
{
|
||||
double tvdmsl = m_waterDepth;
|
||||
QString waterDepthString = QString( ", Water Depth = %1 m" ).arg( tvdmsl );
|
||||
name += waterDepthString;
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
@@ -41,8 +41,6 @@ public:
|
||||
void copyWbsParameters( const RimWbsParameters* wbsParameters );
|
||||
void setCaseWellPathAndTimeStep( RimGeoMechCase* geoMechCase, RimWellPath* wellPath, int timeStep );
|
||||
|
||||
QString createAutoName() const override;
|
||||
|
||||
protected:
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
|
||||
@@ -50,6 +48,9 @@ protected:
|
||||
void childFieldChangedByUi( const caf::PdmFieldHandle* changedChildField ) override;
|
||||
void initAfterRead() override;
|
||||
|
||||
QStringList supportedPlotNameVariables() const override;
|
||||
std::map<QString, QString> createNameKeyValueMap() const override;
|
||||
|
||||
private:
|
||||
void applyDataSource();
|
||||
|
||||
|
@@ -27,6 +27,7 @@
|
||||
#include "RimStimPlanModelCurve.h"
|
||||
#include "RimStimPlanModelPropertyCurve.h"
|
||||
#include "RimTools.h"
|
||||
#include "RimWellLogPlotNameConfig.h"
|
||||
#include "RimWellLogTrack.h"
|
||||
|
||||
#include "cafPdmBase.h"
|
||||
|
@@ -1194,3 +1194,29 @@ void RimWellLogCurveCommonDataSource::selectWell( QString wellName )
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimWellLogCurveCommonDataSource::rftWellName() const
|
||||
{
|
||||
return m_rftWellName();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QDateTime RimWellLogCurveCommonDataSource::rftTime() const
|
||||
{
|
||||
return m_rftTimeStep();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int RimWellLogCurveCommonDataSource::rftBranchIndex() const
|
||||
{
|
||||
if ( m_uniqueRftBranchIndices.size() == 1 ) return m_rftSegmentBranchIndex();
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
@@ -83,6 +83,10 @@ public:
|
||||
|
||||
void selectWell( QString wellName );
|
||||
|
||||
QString rftWellName() const;
|
||||
QDateTime rftTime() const;
|
||||
int rftBranchIndex() const;
|
||||
|
||||
void resetDefaultOptions();
|
||||
void analyseCurvesAndTracks( const std::vector<RimWellLogCurve*>& curves, const std::vector<RimWellLogTrack*>& tracks );
|
||||
void analyseCurvesAndTracks();
|
||||
|
@@ -32,84 +32,6 @@ RimWellLogPlotNameConfig::RimWellLogPlotNameConfig()
|
||||
: RimNameConfig( "Well Log Plot" )
|
||||
{
|
||||
CAF_PDM_InitObject( "Well Log Plot Name Generator" );
|
||||
|
||||
CAF_PDM_InitField( &m_addCaseName, "AddCaseName", false, "Show Case Name" );
|
||||
CAF_PDM_InitField( &m_addWellName, "AddWellName", false, "Show Well Name" );
|
||||
CAF_PDM_InitField( &m_addTimestep, "AddTimeStep", false, "Show Time Step" );
|
||||
CAF_PDM_InitField( &m_addAirGap, "AddAirGap", false, "Show Air Gap" );
|
||||
CAF_PDM_InitField( &m_addWaterDepth, "AddWaterDepth", false, "Show Water Depth" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimWellLogPlotNameConfig::addCaseName() const
|
||||
{
|
||||
return m_addCaseName();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimWellLogPlotNameConfig::addWellName() const
|
||||
{
|
||||
return m_addWellName();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimWellLogPlotNameConfig::addTimeStep() const
|
||||
{
|
||||
return m_addTimestep();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimWellLogPlotNameConfig::addAirGap() const
|
||||
{
|
||||
return m_addAirGap();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimWellLogPlotNameConfig::addWaterDepth() const
|
||||
{
|
||||
return m_addWaterDepth();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogPlotNameConfig::setAutoNameTags( bool addCaseName,
|
||||
bool addWellName,
|
||||
bool addTimeStep,
|
||||
bool addAirGap,
|
||||
bool addWaterDepth )
|
||||
{
|
||||
m_addCaseName = addCaseName;
|
||||
m_addWellName = addWellName;
|
||||
m_addTimestep = addTimeStep;
|
||||
m_addAirGap = addAirGap;
|
||||
m_addWaterDepth = addWaterDepth;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogPlotNameConfig::setFieldVisibility( bool caseNameVisible,
|
||||
bool wellNameVisible,
|
||||
bool timeStepVisible,
|
||||
bool airGapVisible,
|
||||
bool waterDepthVisible )
|
||||
{
|
||||
m_addCaseName.uiCapability()->setUiHidden( !caseNameVisible );
|
||||
m_addWellName.uiCapability()->setUiHidden( !wellNameVisible );
|
||||
m_addTimestep.uiCapability()->setUiHidden( !timeStepVisible );
|
||||
m_addAirGap.uiCapability()->setUiHidden( !airGapVisible );
|
||||
m_addWaterDepth.uiCapability()->setUiHidden( !waterDepthVisible );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -117,19 +39,6 @@ void RimWellLogPlotNameConfig::setFieldVisibility( bool caseNameVisible,
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogPlotNameConfig::doEnableAllAutoNameTags( bool enable )
|
||||
{
|
||||
setAutoNameTags( enable, enable, enable, enable, enable );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogPlotNameConfig::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
RimNameConfig::defineUiOrdering( uiConfigName, uiOrdering );
|
||||
|
||||
uiOrdering.add( &m_addCaseName );
|
||||
uiOrdering.add( &m_addWellName );
|
||||
uiOrdering.add( &m_addTimestep );
|
||||
uiOrdering.add( &m_addAirGap );
|
||||
uiOrdering.add( &m_addWaterDepth );
|
||||
// TODO: Dummy implementation to implement the pure abstract method
|
||||
// To be removed when the plot naming is transferred to use of plot template text string
|
||||
}
|
||||
|
@@ -31,29 +31,6 @@ class RimWellLogPlotNameConfig : public RimNameConfig
|
||||
public:
|
||||
RimWellLogPlotNameConfig();
|
||||
|
||||
bool addCaseName() const;
|
||||
bool addWellName() const;
|
||||
bool addTimeStep() const;
|
||||
bool addAirGap() const;
|
||||
bool addWaterDepth() const;
|
||||
|
||||
void setAutoNameTags( bool addCaseName, bool addWellName, bool addTimeStep, bool addAirGap, bool addWaterDepth );
|
||||
void setFieldVisibility( bool caseNameVisible,
|
||||
bool wellNameVisible,
|
||||
bool timeStepVisible,
|
||||
bool airGapVisible,
|
||||
bool waterDepthVisible );
|
||||
|
||||
protected:
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
|
||||
private:
|
||||
void doEnableAllAutoNameTags( bool enable ) override;
|
||||
|
||||
private:
|
||||
caf::PdmField<bool> m_addCaseName;
|
||||
caf::PdmField<bool> m_addWellName;
|
||||
caf::PdmField<bool> m_addTimestep;
|
||||
caf::PdmField<bool> m_addAirGap;
|
||||
caf::PdmField<bool> m_addWaterDepth;
|
||||
};
|
||||
|
@@ -27,6 +27,7 @@
|
||||
#include "RiaRftDefines.h"
|
||||
#include "RiaSimWellBranchTools.h"
|
||||
#include "RiaSummaryTools.h"
|
||||
#include "RiaTextStringTools.h"
|
||||
|
||||
#include "RifEclipseRftAddress.h"
|
||||
#include "RifReaderEclipseRft.h"
|
||||
@@ -567,14 +568,7 @@ QString RimWellLogRftCurve::createCurveAutoName()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimWellLogRftCurve::createCurveNameFromTemplate( const QString& templateText )
|
||||
{
|
||||
QString curveName = templateText;
|
||||
|
||||
for ( const auto& [key, value] : createCurveNameKeyValueMap() )
|
||||
{
|
||||
curveName.replace( key, value );
|
||||
}
|
||||
|
||||
return curveName;
|
||||
return RiaTextStringTools::replaceTemplateTextWithValues( templateText, createCurveNameKeyValueMap() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@@ -342,3 +342,29 @@ WELSPECS
|
||||
EXPECT_STREQ( textForCompare.toStdString().data(), tableText.toStdString().data() );
|
||||
}
|
||||
}
|
||||
|
||||
TEST( RifTextDataTableFormatter, ReplaceTokensInString )
|
||||
{
|
||||
{
|
||||
std::map<QString, QString> keyValues = {
|
||||
{ "$KEY1", "VALUE1" },
|
||||
{ "$KEY1_WITH_MORE_TEXT", "VALUE2" },
|
||||
};
|
||||
|
||||
auto templateText = QString( "$KEY1, $KEY1_WITH_MORE_TEXT" );
|
||||
auto resolvedText = RiaTextStringTools::replaceTemplateTextWithValues( templateText, keyValues );
|
||||
|
||||
EXPECT_STREQ( resolvedText.toStdString().data(), "VALUE1, VALUE2" );
|
||||
}
|
||||
|
||||
{
|
||||
std::map<QString, QString> keyValues = {
|
||||
{ "$KEY1", "VALUE1" },
|
||||
};
|
||||
|
||||
auto templateText = QString( "$KEY1, $KEY1_WITH_MORE_2" );
|
||||
auto resolvedText = RiaTextStringTools::replaceTemplateTextWithValues( templateText, keyValues );
|
||||
|
||||
EXPECT_STREQ( resolvedText.toStdString().data(), "VALUE1, $KEY1_WITH_MORE_2" );
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user