mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Improve curve naming
* Add curve name template and handling of string variables * Mark autoName as obsolete field * Use key-value map to populate variable values * Add curve naming methods Auto, Custom and Template
This commit is contained in:
parent
05d7eac52c
commit
5e184df670
@ -44,8 +44,74 @@ void caf::AppEnum<RiaDefines::MultiPlotAxisVisibility>::setUp()
|
||||
|
||||
setDefault( RiaDefines::MultiPlotAxisVisibility::ONE_VISIBLE );
|
||||
}
|
||||
|
||||
template <>
|
||||
void caf::AppEnum<RiaDefines::ObjectNamingMethod>::setUp()
|
||||
{
|
||||
addItem( RiaDefines::ObjectNamingMethod::CUSTOM, "CUSTOM", "Custom" );
|
||||
addItem( RiaDefines::ObjectNamingMethod::AUTO, "AUTO", "Auto" );
|
||||
addItem( RiaDefines::ObjectNamingMethod::TEMPLATE, "TEMPLATE", "Template" );
|
||||
|
||||
setDefault( RiaDefines::ObjectNamingMethod::AUTO );
|
||||
}
|
||||
}; // namespace caf
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaDefines::namingVariableCase()
|
||||
{
|
||||
return "$CASE";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaDefines::namingVariableWell()
|
||||
{
|
||||
return "$WELL";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaDefines::namingVariableWellBranch()
|
||||
{
|
||||
return "$WELL_BRANCH";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaDefines::namingVariableResultName()
|
||||
{
|
||||
return "$RESULT_NAME";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaDefines::namingVariableResultType()
|
||||
{
|
||||
return "$RESULT_TYPE";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaDefines::namingVariableTime()
|
||||
{
|
||||
return "$TIME";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaDefines::namingVariableTimestep()
|
||||
{
|
||||
return "$TIME_STEP";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -19,6 +19,7 @@
|
||||
#pragma once
|
||||
|
||||
class QPaintDevice;
|
||||
class QString;
|
||||
|
||||
// Defines relate to plotting
|
||||
namespace RiaDefines
|
||||
@ -65,6 +66,21 @@ enum class MultiPlotAxisVisibility
|
||||
ALL_VISIBLE
|
||||
};
|
||||
|
||||
enum class ObjectNamingMethod
|
||||
{
|
||||
CUSTOM,
|
||||
AUTO,
|
||||
TEMPLATE
|
||||
};
|
||||
|
||||
QString namingVariableCase();
|
||||
QString namingVariableWell();
|
||||
QString namingVariableWellBranch();
|
||||
QString namingVariableResultName();
|
||||
QString namingVariableResultType();
|
||||
QString namingVariableTime();
|
||||
QString namingVariableTimestep();
|
||||
|
||||
double minimumDefaultValuePlot();
|
||||
double minimumDefaultLogValuePlot();
|
||||
double maximumDefaultValuePlot();
|
||||
|
@ -134,7 +134,7 @@ void RimGridCrossPlotCurve::updateZoomInParentPlot()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimGridCrossPlotCurve::createCurveAutoName()
|
||||
{
|
||||
return m_customCurveName;
|
||||
return m_curveName;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -565,7 +565,7 @@ std::vector<double> RimGridTimeHistoryCurve::daysSinceSimulationStart() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridTimeHistoryCurve::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
RimPlotCurve::updateOptionSensitivity();
|
||||
RimPlotCurve::updateFieldUiState();
|
||||
|
||||
uiOrdering.add( &m_geometrySelectionText );
|
||||
|
||||
|
@ -59,14 +59,20 @@ RimPlotCurve::RimPlotCurve()
|
||||
CAF_PDM_InitField( &m_showCurve, "Show", true, "Show curve" );
|
||||
m_showCurve.uiCapability()->setUiHidden( true );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_curveName, "CurveName", "Curve Name" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_customCurveName, "CurveDescription", "Custom Name" );
|
||||
m_customCurveName.uiCapability()->setUiHidden( true );
|
||||
CAF_PDM_InitFieldNoDefault( &m_curveName, "CurveName", "" );
|
||||
|
||||
auto templateText =
|
||||
QString( "%1, %2" ).arg( RiaDefines::namingVariableCase() ).arg( RiaDefines::namingVariableResultName() );
|
||||
CAF_PDM_InitField( &m_curveNameTemplateText, "TemplateText", templateText, "Template Text" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_namingMethod, "CurveNamingMethod", "Curve Name" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_legendEntryText, "LegendDescription", "Legend Name" );
|
||||
m_legendEntryText.uiCapability()->setUiHidden( true );
|
||||
|
||||
CAF_PDM_InitField( &m_isUsingAutoName, "AutoName", true, "Auto Name" );
|
||||
CAF_PDM_InitField( &m_isUsingAutoName_OBSOLETE, "AutoName", true, "Auto Name" );
|
||||
m_isUsingAutoName_OBSOLETE.xmlCapability()->setIOWritable( false );
|
||||
m_isUsingAutoName_OBSOLETE.uiCapability()->setUiHidden( true );
|
||||
|
||||
CAF_PDM_InitField( &m_showLegend, "ShowLegend", true, "Contribute To Legend" );
|
||||
CAF_PDM_InitField( &m_showErrorBars, "ShowErrorBars", true, "Show Error Bars" );
|
||||
|
||||
@ -150,16 +156,14 @@ void RimPlotCurve::fieldChangedByUi( const caf::PdmFieldHandle* changedField, co
|
||||
}
|
||||
else if ( changedField == &m_curveName )
|
||||
{
|
||||
m_customCurveName = m_curveName;
|
||||
updateCurveNameAndUpdatePlotLegendAndTitle();
|
||||
}
|
||||
else if ( changedField == &m_isUsingAutoName )
|
||||
else if ( changedField == &m_namingMethod )
|
||||
{
|
||||
updateCurveNameAndUpdatePlotLegendAndTitle();
|
||||
}
|
||||
else if ( changedField == &m_namingMethod || changedField == &m_curveNameTemplateText )
|
||||
{
|
||||
if ( !m_isUsingAutoName )
|
||||
{
|
||||
m_customCurveName = createCurveAutoName();
|
||||
}
|
||||
|
||||
updateCurveNameAndUpdatePlotLegendAndTitle();
|
||||
nameChanged.send( curveName() );
|
||||
}
|
||||
@ -189,20 +193,8 @@ caf::PdmFieldHandle* RimPlotCurve::objectToggleField()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotCurve::setCustomName( const QString& customName )
|
||||
{
|
||||
m_isUsingAutoName = false;
|
||||
m_customCurveName = customName;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimPlotCurve::legendEntryText() const
|
||||
{
|
||||
if ( !m_legendEntryText().isEmpty() )
|
||||
{
|
||||
return m_legendEntryText;
|
||||
}
|
||||
return m_customCurveName;
|
||||
m_namingMethod = RiaDefines::ObjectNamingMethod::CUSTOM;
|
||||
m_curveName = customName;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -222,6 +214,30 @@ void RimPlotCurve::setErrorBarsVisible( bool isVisible )
|
||||
updateCurveAppearance();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimPlotCurve::createCurveNameFromTemplate( const QString& templateText )
|
||||
{
|
||||
return templateText;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimPlotCurve::isCurveNameTemplateSupported() const
|
||||
{
|
||||
return !supportedCurveNameVariables().isEmpty();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QStringList RimPlotCurve::supportedCurveNameVariables() const
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -231,6 +247,15 @@ void RimPlotCurve::initAfterRead()
|
||||
{
|
||||
updateCurveAppearanceForFilesOlderThan_2021_06();
|
||||
}
|
||||
|
||||
if ( m_isUsingAutoName_OBSOLETE() )
|
||||
{
|
||||
m_namingMethod = RiaDefines::ObjectNamingMethod::AUTO;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_namingMethod = RiaDefines::ObjectNamingMethod::CUSTOM;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -261,6 +286,33 @@ caf::PdmFieldHandle* RimPlotCurve::userDescriptionField()
|
||||
return &m_curveName;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QList<caf::PdmOptionItemInfo> RimPlotCurve::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions )
|
||||
{
|
||||
QList<caf::PdmOptionItemInfo> options;
|
||||
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 ( isCurveNameTemplateSupported() )
|
||||
{
|
||||
options.push_back( caf::PdmOptionItemInfo( caf::AppEnum<RiaDefines::ObjectNamingMethod>::uiText(
|
||||
RiaDefines::ObjectNamingMethod::TEMPLATE ),
|
||||
RiaDefines::ObjectNamingMethod::TEMPLATE ) );
|
||||
}
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -299,13 +351,13 @@ void RimPlotCurve::setCurveVisibility( bool visible )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotCurve::updateCurveName()
|
||||
{
|
||||
if ( m_isUsingAutoName )
|
||||
if ( m_namingMethod == RiaDefines::ObjectNamingMethod::AUTO )
|
||||
{
|
||||
m_curveName = this->createCurveAutoName();
|
||||
}
|
||||
else
|
||||
else if ( m_namingMethod == RiaDefines::ObjectNamingMethod::TEMPLATE )
|
||||
{
|
||||
m_curveName = m_customCurveName;
|
||||
m_curveName = this->createCurveNameFromTemplate( m_curveNameTemplateText );
|
||||
}
|
||||
|
||||
if ( !m_legendEntryText().isEmpty() )
|
||||
@ -339,9 +391,18 @@ void RimPlotCurve::updateCurveNameNoLegendUpdate()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotCurve::updateOptionSensitivity()
|
||||
void RimPlotCurve::updateFieldUiState()
|
||||
{
|
||||
m_curveName.uiCapability()->setUiReadOnly( m_isUsingAutoName );
|
||||
m_curveName.uiCapability()->setUiReadOnly( m_namingMethod != RiaDefines::ObjectNamingMethod::CUSTOM );
|
||||
|
||||
m_curveNameTemplateText.uiCapability()->setUiHidden( m_namingMethod != RiaDefines::ObjectNamingMethod::TEMPLATE );
|
||||
|
||||
auto templateVariables = supportedCurveNameVariables();
|
||||
if ( !templateVariables.isEmpty() )
|
||||
{
|
||||
auto toolTipText = templateVariables.join( "," );
|
||||
m_curveNameTemplateText.uiCapability()->setUiToolTip( toolTipText );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -371,7 +432,10 @@ void RimPlotCurve::appearanceUiOrdering( caf::PdmUiOrdering& uiOrdering )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotCurve::curveNameUiOrdering( caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
uiOrdering.add( &m_isUsingAutoName );
|
||||
updateFieldUiState();
|
||||
|
||||
uiOrdering.add( &m_namingMethod );
|
||||
uiOrdering.add( &m_curveNameTemplateText );
|
||||
uiOrdering.add( &m_curveName );
|
||||
}
|
||||
|
||||
|
@ -88,9 +88,8 @@ public:
|
||||
QString curveName() const;
|
||||
virtual QString curveExportDescription( const RifEclipseSummaryAddress& address = RifEclipseSummaryAddress() ) const;
|
||||
|
||||
void setCustomName( const QString& customName );
|
||||
QString legendEntryText() const;
|
||||
void setLegendEntryText( const QString& legendEntryText );
|
||||
void setCustomName( const QString& customName );
|
||||
void setLegendEntryText( const QString& legendEntryText );
|
||||
|
||||
virtual void updateCurveVisibility();
|
||||
void updateLegendEntryVisibilityAndPlotLegend();
|
||||
@ -129,13 +128,18 @@ public:
|
||||
void deletePlotCurve();
|
||||
|
||||
protected:
|
||||
virtual QString createCurveAutoName() = 0;
|
||||
virtual void updateZoomInParentPlot() = 0;
|
||||
virtual void onLoadDataAndUpdate( bool updateParentPlot ) = 0;
|
||||
void initAfterRead() override;
|
||||
void updateCurvePresentation( bool updatePlotLegendAndTitle );
|
||||
virtual QString createCurveAutoName() = 0;
|
||||
|
||||
void updateOptionSensitivity();
|
||||
// Override these two methods to show and use curve name template when assigning a name to the curve
|
||||
virtual QString createCurveNameFromTemplate( const QString& templateText );
|
||||
virtual QStringList supportedCurveNameVariables() const;
|
||||
|
||||
virtual void updateZoomInParentPlot() = 0;
|
||||
virtual void onLoadDataAndUpdate( bool updateParentPlot ) = 0;
|
||||
void initAfterRead() override;
|
||||
void updateCurvePresentation( bool updatePlotLegendAndTitle );
|
||||
|
||||
void updateFieldUiState();
|
||||
void updatePlotTitle();
|
||||
virtual void updateLegendsInPlot();
|
||||
|
||||
@ -159,13 +163,13 @@ protected:
|
||||
|
||||
virtual double computeCurveZValue();
|
||||
|
||||
protected:
|
||||
// Overridden PDM methods
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||
caf::PdmFieldHandle* objectToggleField() override;
|
||||
caf::PdmFieldHandle* userDescriptionField() override;
|
||||
void appearanceUiOrdering( caf::PdmUiOrdering& uiOrdering );
|
||||
void curveNameUiOrdering( caf::PdmUiOrdering& uiOrdering );
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||
caf::PdmFieldHandle* objectToggleField() override;
|
||||
caf::PdmFieldHandle* userDescriptionField() override;
|
||||
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override;
|
||||
|
||||
void appearanceUiOrdering( caf::PdmUiOrdering& uiOrdering );
|
||||
void curveNameUiOrdering( caf::PdmUiOrdering& uiOrdering );
|
||||
|
||||
void onCurveAppearanceChanged( const caf::SignalEmitter* emitter );
|
||||
virtual void onFillColorChanged( const caf::SignalEmitter* emitter );
|
||||
@ -176,20 +180,28 @@ protected:
|
||||
|
||||
virtual void updateAxisInPlot( RiuPlotAxis plotAxis );
|
||||
|
||||
private:
|
||||
bool isCurveNameTemplateSupported() const;
|
||||
|
||||
protected:
|
||||
caf::PdmField<bool> m_showCurve;
|
||||
caf::PdmField<bool> m_showCurve;
|
||||
|
||||
caf::PdmField<QString> m_curveName;
|
||||
caf::PdmField<QString> m_customCurveName;
|
||||
caf::PdmField<bool> m_showLegend;
|
||||
caf::PdmField<QString> m_curveNameTemplateText;
|
||||
|
||||
caf::PdmField<caf::AppEnum<RiaDefines::ObjectNamingMethod>> m_namingMethod;
|
||||
|
||||
caf::PdmField<QString> m_legendEntryText;
|
||||
caf::PdmField<bool> m_showErrorBars;
|
||||
caf::PdmField<bool> m_isUsingAutoName;
|
||||
|
||||
caf::PdmField<bool> m_showLegend;
|
||||
caf::PdmField<bool> m_showErrorBars;
|
||||
|
||||
caf::PdmChildField<RimPlotCurveAppearance*> m_curveAppearance;
|
||||
|
||||
QPointer<RiuPlotWidget> m_parentPlot;
|
||||
RiuPlotCurve* m_plotCurve;
|
||||
|
||||
caf::PdmField<bool> m_isUsingAutoName_OBSOLETE;
|
||||
caf::PdmField<QString> m_symbolLabel_OBSOLETE;
|
||||
caf::PdmField<int> m_symbolSize_OBSOLETE;
|
||||
caf::PdmField<cvf::Color3f> m_curveColor_OBSOLETE;
|
||||
|
@ -104,7 +104,6 @@ protected:
|
||||
protected:
|
||||
caf::PdmField<QString> m_symbolLabel;
|
||||
caf::PdmField<int> m_symbolSize;
|
||||
caf::PdmField<QString> m_legendEntryText;
|
||||
|
||||
caf::PdmField<cvf::Color3f> m_curveColor;
|
||||
caf::PdmField<int> m_curveThickness;
|
||||
|
@ -177,7 +177,7 @@ void RimAsciiDataCurve::onLoadDataAndUpdate( bool updateParentPlot )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAsciiDataCurve::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
RimPlotCurve::updateOptionSensitivity();
|
||||
RimPlotCurve::updateFieldUiState();
|
||||
|
||||
uiOrdering.add( &m_plotAxis );
|
||||
|
||||
|
@ -846,7 +846,7 @@ void RimSummaryCurve::defineEditorAttribute( const caf::PdmFieldHandle* field,
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryCurve::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
RimPlotCurve::updateOptionSensitivity();
|
||||
RimPlotCurve::updateFieldUiState();
|
||||
|
||||
{
|
||||
QString curveDataGroupName = "Summary Vector";
|
||||
@ -883,7 +883,7 @@ void RimSummaryCurve::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering
|
||||
nameGroup->add( &m_showLegend );
|
||||
RimPlotCurve::curveNameUiOrdering( *nameGroup );
|
||||
|
||||
if ( m_isUsingAutoName )
|
||||
if ( m_namingMethod == RiaDefines::ObjectNamingMethod::AUTO )
|
||||
{
|
||||
m_curveNameConfig->uiOrdering( uiConfigName, *nameGroup );
|
||||
}
|
||||
|
@ -125,7 +125,7 @@ QString RimRftTopologyCurve::createCurveAutoName()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimRftTopologyCurve::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
RimPlotCurve::updateOptionSensitivity();
|
||||
RimPlotCurve::updateFieldUiState();
|
||||
|
||||
caf::PdmUiGroup* curveDataGroup = uiOrdering.addNewGroup( "Data Source" );
|
||||
curveDataGroup->add( &m_summaryCase );
|
||||
|
@ -749,7 +749,7 @@ QList<caf::PdmOptionItemInfo>
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogExtractionCurve::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
RimPlotCurve::updateOptionSensitivity();
|
||||
RimPlotCurve::updateFieldUiState();
|
||||
|
||||
caf::PdmUiGroup* curveDataGroup = uiOrdering.addNewGroupWithKeyword( "Data Source", dataSourceGroupKeyword() );
|
||||
|
||||
@ -798,7 +798,7 @@ void RimWellLogExtractionCurve::defineUiOrdering( QString uiConfigName, caf::Pdm
|
||||
nameGroup->add( &m_showLegend );
|
||||
RimPlotCurve::curveNameUiOrdering( *nameGroup );
|
||||
|
||||
if ( m_isUsingAutoName )
|
||||
if ( m_namingMethod == RiaDefines::ObjectNamingMethod::AUTO )
|
||||
{
|
||||
nameGroup->add( &m_addWellNameToCurveName );
|
||||
nameGroup->add( &m_addCaseNameToCurveName );
|
||||
|
@ -178,7 +178,7 @@ void RimWellLogFileCurve::onLoadDataAndUpdate( bool updateParentPlot )
|
||||
}
|
||||
}
|
||||
|
||||
if ( m_isUsingAutoName )
|
||||
if ( m_namingMethod == RiaDefines::ObjectNamingMethod::AUTO )
|
||||
{
|
||||
m_plotCurve->setTitle( createCurveAutoName() );
|
||||
}
|
||||
@ -330,7 +330,7 @@ void RimWellLogFileCurve::fieldChangedByUi( const caf::PdmFieldHandle* changedFi
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogFileCurve::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
RimPlotCurve::updateOptionSensitivity();
|
||||
RimPlotCurve::updateFieldUiState();
|
||||
|
||||
caf::PdmUiGroup* curveDataGroup = uiOrdering.addNewGroup( "Curve Data" );
|
||||
curveDataGroup->add( &m_wellPath );
|
||||
|
@ -482,32 +482,38 @@ void RimWellLogRftCurve::assignColorFromResultName( const QString& resultName )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimWellLogRftCurve::createCurveAutoName()
|
||||
std::map<QString, QString> RimWellLogRftCurve::createCurveNameKeyValueMap() const
|
||||
{
|
||||
QStringList name;
|
||||
std::map<QString, QString> variableValueMap;
|
||||
|
||||
if ( !wellName().isEmpty() )
|
||||
{
|
||||
name.push_back( wellName() );
|
||||
variableValueMap[RiaDefines::namingVariableWell()] = wellName();
|
||||
}
|
||||
|
||||
name.push_back( "RFT" );
|
||||
variableValueMap[RiaDefines::namingVariableResultType()] = "RFT";
|
||||
|
||||
QString caseText;
|
||||
if ( m_eclipseResultCase )
|
||||
{
|
||||
name.push_back( m_eclipseResultCase->caseUserDescription() );
|
||||
caseText = m_eclipseResultCase->caseUserDescription();
|
||||
}
|
||||
else if ( m_ensemble ) // Summary RFT curves have both ensemble and summary set. Prioritize ensemble for name.
|
||||
{
|
||||
name.push_back( m_ensemble->name() );
|
||||
caseText = m_ensemble->name();
|
||||
}
|
||||
else if ( m_summaryCase )
|
||||
{
|
||||
name.push_back( m_summaryCase->displayCaseName() );
|
||||
caseText = m_summaryCase->displayCaseName();
|
||||
}
|
||||
else if ( m_observedFmuRftData )
|
||||
{
|
||||
name.push_back( m_observedFmuRftData->name() );
|
||||
caseText = m_observedFmuRftData->name();
|
||||
}
|
||||
|
||||
if ( !caseText.isEmpty() )
|
||||
{
|
||||
variableValueMap[RiaDefines::namingVariableCase()] = caseText;
|
||||
}
|
||||
|
||||
if ( m_rftDataType() == RftDataType::RFT_DATA )
|
||||
@ -518,25 +524,70 @@ QString RimWellLogRftCurve::createCurveAutoName()
|
||||
RifEclipseRftAddress::RftWellLogChannelType channelNameEnum =
|
||||
caf::AppEnum<RifEclipseRftAddress::RftWellLogChannelType>::fromText( wellLogChannelUiName() );
|
||||
QString channelName = caf::AppEnum<RifEclipseRftAddress::RftWellLogChannelType>::uiText( channelNameEnum );
|
||||
name.push_back( channelName );
|
||||
|
||||
variableValueMap[RiaDefines::namingVariableResultName()] = channelName;
|
||||
}
|
||||
}
|
||||
else if ( m_rftDataType() == RftDataType::RFT_SEGMENT_DATA )
|
||||
{
|
||||
name.push_back( m_segmentResultName );
|
||||
variableValueMap[RiaDefines::namingVariableResultName()] = m_segmentResultName;
|
||||
|
||||
QString branchText = QString( "Branch %1" ).arg( m_segmentBranchIndex() );
|
||||
name.push_back( branchText );
|
||||
|
||||
name.push_back( m_segmentBranchType().uiText() );
|
||||
variableValueMap[RiaDefines::namingVariableWellBranch()] = branchText;
|
||||
|
||||
variableValueMap[RiaDefines::namingVariableResultType()] = m_segmentBranchType().uiText();
|
||||
}
|
||||
|
||||
if ( !m_timeStep().isNull() )
|
||||
{
|
||||
name.push_back( m_timeStep().toString( RiaQDateTimeTools::dateFormatString() ) );
|
||||
variableValueMap[RiaDefines::namingVariableTime()] = m_timeStep().toString( RiaQDateTimeTools::dateFormatString() );
|
||||
}
|
||||
|
||||
return name.join( ", " );
|
||||
return variableValueMap;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimWellLogRftCurve::createCurveAutoName()
|
||||
{
|
||||
QStringList curveNameSubStrings;
|
||||
|
||||
for ( const auto& [key, value] : createCurveNameKeyValueMap() )
|
||||
{
|
||||
curveNameSubStrings.push_back( value );
|
||||
}
|
||||
|
||||
return curveNameSubStrings.join( ", " );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimWellLogRftCurve::createCurveNameFromTemplate( const QString& templateText )
|
||||
{
|
||||
QString curveName = templateText;
|
||||
|
||||
for ( const auto& [key, value] : createCurveNameKeyValueMap() )
|
||||
{
|
||||
curveName.replace( key, value );
|
||||
}
|
||||
|
||||
return curveName;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QStringList RimWellLogRftCurve::supportedCurveNameVariables() const
|
||||
{
|
||||
return { RiaDefines::namingVariableWell(),
|
||||
RiaDefines::namingVariableResultName(),
|
||||
RiaDefines::namingVariableResultType(),
|
||||
RiaDefines::namingVariableCase(),
|
||||
RiaDefines::namingVariableWellBranch(),
|
||||
RiaDefines::namingVariableTime() };
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -735,7 +786,7 @@ void RimWellLogRftCurve::onLoadDataAndUpdate( bool updateParentPlot )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogRftCurve::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
RimPlotCurve::updateOptionSensitivity();
|
||||
RimPlotCurve::updateFieldUiState();
|
||||
|
||||
caf::PdmUiGroup* curveDataGroup = uiOrdering.addNewGroup( "Curve Data" );
|
||||
curveDataGroup->add( &m_eclipseResultCase );
|
||||
|
@ -102,8 +102,10 @@ public:
|
||||
void assignColorFromResultName( const QString& resultName );
|
||||
|
||||
protected:
|
||||
// Overrides from RimWellLogPlotCurve
|
||||
QString createCurveAutoName() override;
|
||||
QString createCurveAutoName() override;
|
||||
QString createCurveNameFromTemplate( const QString& templateText ) override;
|
||||
QStringList supportedCurveNameVariables() const override;
|
||||
|
||||
void onLoadDataAndUpdate( bool updateParentPlot ) override;
|
||||
RiaDefines::PhaseType phaseType() const override;
|
||||
|
||||
@ -124,6 +126,8 @@ private:
|
||||
std::vector<size_t> sortedIndicesInRftFile();
|
||||
void updateWellChannelNameAndTimeStep();
|
||||
|
||||
std::map<QString, QString> createCurveNameKeyValueMap() const;
|
||||
|
||||
std::vector<double> xValues();
|
||||
std::vector<double> errorValues();
|
||||
std::vector<double> tvDepthValues();
|
||||
|
@ -138,7 +138,7 @@ void RimWellMeasurementCurve::onLoadDataAndUpdate( bool updateParentPlot )
|
||||
}
|
||||
}
|
||||
|
||||
if ( m_isUsingAutoName && m_plotCurve )
|
||||
if ( m_namingMethod == RiaDefines::ObjectNamingMethod::AUTO && m_plotCurve )
|
||||
{
|
||||
m_plotCurve->setTitle( createCurveAutoName() );
|
||||
}
|
||||
@ -221,7 +221,7 @@ void RimWellMeasurementCurve::fieldChangedByUi( const caf::PdmFieldHandle* chang
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellMeasurementCurve::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
RimPlotCurve::updateOptionSensitivity();
|
||||
RimPlotCurve::updateFieldUiState();
|
||||
|
||||
caf::PdmUiGroup* curveDataGroup = uiOrdering.addNewGroup( "Curve Data" );
|
||||
curveDataGroup->add( &m_wellPath );
|
||||
|
Loading…
Reference in New Issue
Block a user