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
|
||||
|
||||
Reference in New Issue
Block a user