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:
@@ -44,8 +44,74 @@ void caf::AppEnum<RiaDefines::MultiPlotAxisVisibility>::setUp()
|
|||||||
|
|
||||||
setDefault( RiaDefines::MultiPlotAxisVisibility::ONE_VISIBLE );
|
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
|
}; // 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
|
#pragma once
|
||||||
|
|
||||||
class QPaintDevice;
|
class QPaintDevice;
|
||||||
|
class QString;
|
||||||
|
|
||||||
// Defines relate to plotting
|
// Defines relate to plotting
|
||||||
namespace RiaDefines
|
namespace RiaDefines
|
||||||
@@ -65,6 +66,21 @@ enum class MultiPlotAxisVisibility
|
|||||||
ALL_VISIBLE
|
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 minimumDefaultValuePlot();
|
||||||
double minimumDefaultLogValuePlot();
|
double minimumDefaultLogValuePlot();
|
||||||
double maximumDefaultValuePlot();
|
double maximumDefaultValuePlot();
|
||||||
|
|||||||
@@ -134,7 +134,7 @@ void RimGridCrossPlotCurve::updateZoomInParentPlot()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
QString RimGridCrossPlotCurve::createCurveAutoName()
|
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 )
|
void RimGridTimeHistoryCurve::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||||
{
|
{
|
||||||
RimPlotCurve::updateOptionSensitivity();
|
RimPlotCurve::updateFieldUiState();
|
||||||
|
|
||||||
uiOrdering.add( &m_geometrySelectionText );
|
uiOrdering.add( &m_geometrySelectionText );
|
||||||
|
|
||||||
|
|||||||
@@ -59,14 +59,20 @@ RimPlotCurve::RimPlotCurve()
|
|||||||
CAF_PDM_InitField( &m_showCurve, "Show", true, "Show curve" );
|
CAF_PDM_InitField( &m_showCurve, "Show", true, "Show curve" );
|
||||||
m_showCurve.uiCapability()->setUiHidden( true );
|
m_showCurve.uiCapability()->setUiHidden( true );
|
||||||
|
|
||||||
CAF_PDM_InitFieldNoDefault( &m_curveName, "CurveName", "Curve Name" );
|
CAF_PDM_InitFieldNoDefault( &m_curveName, "CurveName", "" );
|
||||||
CAF_PDM_InitFieldNoDefault( &m_customCurveName, "CurveDescription", "Custom Name" );
|
|
||||||
m_customCurveName.uiCapability()->setUiHidden( true );
|
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" );
|
CAF_PDM_InitFieldNoDefault( &m_legendEntryText, "LegendDescription", "Legend Name" );
|
||||||
m_legendEntryText.uiCapability()->setUiHidden( true );
|
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_showLegend, "ShowLegend", true, "Contribute To Legend" );
|
||||||
CAF_PDM_InitField( &m_showErrorBars, "ShowErrorBars", true, "Show Error Bars" );
|
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 )
|
else if ( changedField == &m_curveName )
|
||||||
{
|
{
|
||||||
m_customCurveName = m_curveName;
|
|
||||||
updateCurveNameAndUpdatePlotLegendAndTitle();
|
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();
|
updateCurveNameAndUpdatePlotLegendAndTitle();
|
||||||
nameChanged.send( curveName() );
|
nameChanged.send( curveName() );
|
||||||
}
|
}
|
||||||
@@ -189,20 +193,8 @@ caf::PdmFieldHandle* RimPlotCurve::objectToggleField()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimPlotCurve::setCustomName( const QString& customName )
|
void RimPlotCurve::setCustomName( const QString& customName )
|
||||||
{
|
{
|
||||||
m_isUsingAutoName = false;
|
m_namingMethod = RiaDefines::ObjectNamingMethod::CUSTOM;
|
||||||
m_customCurveName = customName;
|
m_curveName = customName;
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
QString RimPlotCurve::legendEntryText() const
|
|
||||||
{
|
|
||||||
if ( !m_legendEntryText().isEmpty() )
|
|
||||||
{
|
|
||||||
return m_legendEntryText;
|
|
||||||
}
|
|
||||||
return m_customCurveName;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -222,6 +214,30 @@ void RimPlotCurve::setErrorBarsVisible( bool isVisible )
|
|||||||
updateCurveAppearance();
|
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();
|
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;
|
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()
|
void RimPlotCurve::updateCurveName()
|
||||||
{
|
{
|
||||||
if ( m_isUsingAutoName )
|
if ( m_namingMethod == RiaDefines::ObjectNamingMethod::AUTO )
|
||||||
{
|
{
|
||||||
m_curveName = this->createCurveAutoName();
|
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() )
|
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 )
|
void RimPlotCurve::curveNameUiOrdering( caf::PdmUiOrdering& uiOrdering )
|
||||||
{
|
{
|
||||||
uiOrdering.add( &m_isUsingAutoName );
|
updateFieldUiState();
|
||||||
|
|
||||||
|
uiOrdering.add( &m_namingMethod );
|
||||||
|
uiOrdering.add( &m_curveNameTemplateText );
|
||||||
uiOrdering.add( &m_curveName );
|
uiOrdering.add( &m_curveName );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -88,9 +88,8 @@ public:
|
|||||||
QString curveName() const;
|
QString curveName() const;
|
||||||
virtual QString curveExportDescription( const RifEclipseSummaryAddress& address = RifEclipseSummaryAddress() ) const;
|
virtual QString curveExportDescription( const RifEclipseSummaryAddress& address = RifEclipseSummaryAddress() ) const;
|
||||||
|
|
||||||
void setCustomName( const QString& customName );
|
void setCustomName( const QString& customName );
|
||||||
QString legendEntryText() const;
|
void setLegendEntryText( const QString& legendEntryText );
|
||||||
void setLegendEntryText( const QString& legendEntryText );
|
|
||||||
|
|
||||||
virtual void updateCurveVisibility();
|
virtual void updateCurveVisibility();
|
||||||
void updateLegendEntryVisibilityAndPlotLegend();
|
void updateLegendEntryVisibilityAndPlotLegend();
|
||||||
@@ -129,13 +128,18 @@ public:
|
|||||||
void deletePlotCurve();
|
void deletePlotCurve();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual QString createCurveAutoName() = 0;
|
virtual QString createCurveAutoName() = 0;
|
||||||
virtual void updateZoomInParentPlot() = 0;
|
|
||||||
virtual void onLoadDataAndUpdate( bool updateParentPlot ) = 0;
|
|
||||||
void initAfterRead() override;
|
|
||||||
void updateCurvePresentation( bool updatePlotLegendAndTitle );
|
|
||||||
|
|
||||||
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();
|
void updatePlotTitle();
|
||||||
virtual void updateLegendsInPlot();
|
virtual void updateLegendsInPlot();
|
||||||
|
|
||||||
@@ -159,13 +163,13 @@ protected:
|
|||||||
|
|
||||||
virtual double computeCurveZValue();
|
virtual double computeCurveZValue();
|
||||||
|
|
||||||
protected:
|
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||||
// Overridden PDM methods
|
caf::PdmFieldHandle* objectToggleField() override;
|
||||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
caf::PdmFieldHandle* userDescriptionField() override;
|
||||||
caf::PdmFieldHandle* objectToggleField() override;
|
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override;
|
||||||
caf::PdmFieldHandle* userDescriptionField() override;
|
|
||||||
void appearanceUiOrdering( caf::PdmUiOrdering& uiOrdering );
|
void appearanceUiOrdering( caf::PdmUiOrdering& uiOrdering );
|
||||||
void curveNameUiOrdering( caf::PdmUiOrdering& uiOrdering );
|
void curveNameUiOrdering( caf::PdmUiOrdering& uiOrdering );
|
||||||
|
|
||||||
void onCurveAppearanceChanged( const caf::SignalEmitter* emitter );
|
void onCurveAppearanceChanged( const caf::SignalEmitter* emitter );
|
||||||
virtual void onFillColorChanged( const caf::SignalEmitter* emitter );
|
virtual void onFillColorChanged( const caf::SignalEmitter* emitter );
|
||||||
@@ -176,20 +180,28 @@ protected:
|
|||||||
|
|
||||||
virtual void updateAxisInPlot( RiuPlotAxis plotAxis );
|
virtual void updateAxisInPlot( RiuPlotAxis plotAxis );
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool isCurveNameTemplateSupported() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
caf::PdmField<bool> m_showCurve;
|
caf::PdmField<bool> m_showCurve;
|
||||||
|
|
||||||
caf::PdmField<QString> m_curveName;
|
caf::PdmField<QString> m_curveName;
|
||||||
caf::PdmField<QString> m_customCurveName;
|
caf::PdmField<QString> m_curveNameTemplateText;
|
||||||
caf::PdmField<bool> m_showLegend;
|
|
||||||
|
caf::PdmField<caf::AppEnum<RiaDefines::ObjectNamingMethod>> m_namingMethod;
|
||||||
|
|
||||||
caf::PdmField<QString> m_legendEntryText;
|
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;
|
caf::PdmChildField<RimPlotCurveAppearance*> m_curveAppearance;
|
||||||
|
|
||||||
QPointer<RiuPlotWidget> m_parentPlot;
|
QPointer<RiuPlotWidget> m_parentPlot;
|
||||||
RiuPlotCurve* m_plotCurve;
|
RiuPlotCurve* m_plotCurve;
|
||||||
|
|
||||||
|
caf::PdmField<bool> m_isUsingAutoName_OBSOLETE;
|
||||||
caf::PdmField<QString> m_symbolLabel_OBSOLETE;
|
caf::PdmField<QString> m_symbolLabel_OBSOLETE;
|
||||||
caf::PdmField<int> m_symbolSize_OBSOLETE;
|
caf::PdmField<int> m_symbolSize_OBSOLETE;
|
||||||
caf::PdmField<cvf::Color3f> m_curveColor_OBSOLETE;
|
caf::PdmField<cvf::Color3f> m_curveColor_OBSOLETE;
|
||||||
|
|||||||
@@ -104,7 +104,6 @@ protected:
|
|||||||
protected:
|
protected:
|
||||||
caf::PdmField<QString> m_symbolLabel;
|
caf::PdmField<QString> m_symbolLabel;
|
||||||
caf::PdmField<int> m_symbolSize;
|
caf::PdmField<int> m_symbolSize;
|
||||||
caf::PdmField<QString> m_legendEntryText;
|
|
||||||
|
|
||||||
caf::PdmField<cvf::Color3f> m_curveColor;
|
caf::PdmField<cvf::Color3f> m_curveColor;
|
||||||
caf::PdmField<int> m_curveThickness;
|
caf::PdmField<int> m_curveThickness;
|
||||||
|
|||||||
@@ -177,7 +177,7 @@ void RimAsciiDataCurve::onLoadDataAndUpdate( bool updateParentPlot )
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimAsciiDataCurve::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
void RimAsciiDataCurve::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||||
{
|
{
|
||||||
RimPlotCurve::updateOptionSensitivity();
|
RimPlotCurve::updateFieldUiState();
|
||||||
|
|
||||||
uiOrdering.add( &m_plotAxis );
|
uiOrdering.add( &m_plotAxis );
|
||||||
|
|
||||||
|
|||||||
@@ -846,7 +846,7 @@ void RimSummaryCurve::defineEditorAttribute( const caf::PdmFieldHandle* field,
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimSummaryCurve::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
void RimSummaryCurve::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||||
{
|
{
|
||||||
RimPlotCurve::updateOptionSensitivity();
|
RimPlotCurve::updateFieldUiState();
|
||||||
|
|
||||||
{
|
{
|
||||||
QString curveDataGroupName = "Summary Vector";
|
QString curveDataGroupName = "Summary Vector";
|
||||||
@@ -883,7 +883,7 @@ void RimSummaryCurve::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering
|
|||||||
nameGroup->add( &m_showLegend );
|
nameGroup->add( &m_showLegend );
|
||||||
RimPlotCurve::curveNameUiOrdering( *nameGroup );
|
RimPlotCurve::curveNameUiOrdering( *nameGroup );
|
||||||
|
|
||||||
if ( m_isUsingAutoName )
|
if ( m_namingMethod == RiaDefines::ObjectNamingMethod::AUTO )
|
||||||
{
|
{
|
||||||
m_curveNameConfig->uiOrdering( uiConfigName, *nameGroup );
|
m_curveNameConfig->uiOrdering( uiConfigName, *nameGroup );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -125,7 +125,7 @@ QString RimRftTopologyCurve::createCurveAutoName()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimRftTopologyCurve::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
void RimRftTopologyCurve::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||||
{
|
{
|
||||||
RimPlotCurve::updateOptionSensitivity();
|
RimPlotCurve::updateFieldUiState();
|
||||||
|
|
||||||
caf::PdmUiGroup* curveDataGroup = uiOrdering.addNewGroup( "Data Source" );
|
caf::PdmUiGroup* curveDataGroup = uiOrdering.addNewGroup( "Data Source" );
|
||||||
curveDataGroup->add( &m_summaryCase );
|
curveDataGroup->add( &m_summaryCase );
|
||||||
|
|||||||
@@ -749,7 +749,7 @@ QList<caf::PdmOptionItemInfo>
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimWellLogExtractionCurve::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
void RimWellLogExtractionCurve::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||||
{
|
{
|
||||||
RimPlotCurve::updateOptionSensitivity();
|
RimPlotCurve::updateFieldUiState();
|
||||||
|
|
||||||
caf::PdmUiGroup* curveDataGroup = uiOrdering.addNewGroupWithKeyword( "Data Source", dataSourceGroupKeyword() );
|
caf::PdmUiGroup* curveDataGroup = uiOrdering.addNewGroupWithKeyword( "Data Source", dataSourceGroupKeyword() );
|
||||||
|
|
||||||
@@ -798,7 +798,7 @@ void RimWellLogExtractionCurve::defineUiOrdering( QString uiConfigName, caf::Pdm
|
|||||||
nameGroup->add( &m_showLegend );
|
nameGroup->add( &m_showLegend );
|
||||||
RimPlotCurve::curveNameUiOrdering( *nameGroup );
|
RimPlotCurve::curveNameUiOrdering( *nameGroup );
|
||||||
|
|
||||||
if ( m_isUsingAutoName )
|
if ( m_namingMethod == RiaDefines::ObjectNamingMethod::AUTO )
|
||||||
{
|
{
|
||||||
nameGroup->add( &m_addWellNameToCurveName );
|
nameGroup->add( &m_addWellNameToCurveName );
|
||||||
nameGroup->add( &m_addCaseNameToCurveName );
|
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() );
|
m_plotCurve->setTitle( createCurveAutoName() );
|
||||||
}
|
}
|
||||||
@@ -330,7 +330,7 @@ void RimWellLogFileCurve::fieldChangedByUi( const caf::PdmFieldHandle* changedFi
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimWellLogFileCurve::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
void RimWellLogFileCurve::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||||
{
|
{
|
||||||
RimPlotCurve::updateOptionSensitivity();
|
RimPlotCurve::updateFieldUiState();
|
||||||
|
|
||||||
caf::PdmUiGroup* curveDataGroup = uiOrdering.addNewGroup( "Curve Data" );
|
caf::PdmUiGroup* curveDataGroup = uiOrdering.addNewGroup( "Curve Data" );
|
||||||
curveDataGroup->add( &m_wellPath );
|
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() )
|
if ( !wellName().isEmpty() )
|
||||||
{
|
{
|
||||||
name.push_back( wellName() );
|
variableValueMap[RiaDefines::namingVariableWell()] = wellName();
|
||||||
}
|
}
|
||||||
|
|
||||||
name.push_back( "RFT" );
|
variableValueMap[RiaDefines::namingVariableResultType()] = "RFT";
|
||||||
|
|
||||||
|
QString caseText;
|
||||||
if ( m_eclipseResultCase )
|
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.
|
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 )
|
else if ( m_summaryCase )
|
||||||
{
|
{
|
||||||
name.push_back( m_summaryCase->displayCaseName() );
|
caseText = m_summaryCase->displayCaseName();
|
||||||
}
|
}
|
||||||
else if ( m_observedFmuRftData )
|
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 )
|
if ( m_rftDataType() == RftDataType::RFT_DATA )
|
||||||
@@ -518,25 +524,70 @@ QString RimWellLogRftCurve::createCurveAutoName()
|
|||||||
RifEclipseRftAddress::RftWellLogChannelType channelNameEnum =
|
RifEclipseRftAddress::RftWellLogChannelType channelNameEnum =
|
||||||
caf::AppEnum<RifEclipseRftAddress::RftWellLogChannelType>::fromText( wellLogChannelUiName() );
|
caf::AppEnum<RifEclipseRftAddress::RftWellLogChannelType>::fromText( wellLogChannelUiName() );
|
||||||
QString channelName = caf::AppEnum<RifEclipseRftAddress::RftWellLogChannelType>::uiText( channelNameEnum );
|
QString channelName = caf::AppEnum<RifEclipseRftAddress::RftWellLogChannelType>::uiText( channelNameEnum );
|
||||||
name.push_back( channelName );
|
|
||||||
|
variableValueMap[RiaDefines::namingVariableResultName()] = channelName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( m_rftDataType() == RftDataType::RFT_SEGMENT_DATA )
|
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() );
|
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() )
|
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 )
|
void RimWellLogRftCurve::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||||
{
|
{
|
||||||
RimPlotCurve::updateOptionSensitivity();
|
RimPlotCurve::updateFieldUiState();
|
||||||
|
|
||||||
caf::PdmUiGroup* curveDataGroup = uiOrdering.addNewGroup( "Curve Data" );
|
caf::PdmUiGroup* curveDataGroup = uiOrdering.addNewGroup( "Curve Data" );
|
||||||
curveDataGroup->add( &m_eclipseResultCase );
|
curveDataGroup->add( &m_eclipseResultCase );
|
||||||
|
|||||||
@@ -102,8 +102,10 @@ public:
|
|||||||
void assignColorFromResultName( const QString& resultName );
|
void assignColorFromResultName( const QString& resultName );
|
||||||
|
|
||||||
protected:
|
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;
|
void onLoadDataAndUpdate( bool updateParentPlot ) override;
|
||||||
RiaDefines::PhaseType phaseType() const override;
|
RiaDefines::PhaseType phaseType() const override;
|
||||||
|
|
||||||
@@ -124,6 +126,8 @@ private:
|
|||||||
std::vector<size_t> sortedIndicesInRftFile();
|
std::vector<size_t> sortedIndicesInRftFile();
|
||||||
void updateWellChannelNameAndTimeStep();
|
void updateWellChannelNameAndTimeStep();
|
||||||
|
|
||||||
|
std::map<QString, QString> createCurveNameKeyValueMap() const;
|
||||||
|
|
||||||
std::vector<double> xValues();
|
std::vector<double> xValues();
|
||||||
std::vector<double> errorValues();
|
std::vector<double> errorValues();
|
||||||
std::vector<double> tvDepthValues();
|
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() );
|
m_plotCurve->setTitle( createCurveAutoName() );
|
||||||
}
|
}
|
||||||
@@ -221,7 +221,7 @@ void RimWellMeasurementCurve::fieldChangedByUi( const caf::PdmFieldHandle* chang
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimWellMeasurementCurve::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
void RimWellMeasurementCurve::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||||
{
|
{
|
||||||
RimPlotCurve::updateOptionSensitivity();
|
RimPlotCurve::updateFieldUiState();
|
||||||
|
|
||||||
caf::PdmUiGroup* curveDataGroup = uiOrdering.addNewGroup( "Curve Data" );
|
caf::PdmUiGroup* curveDataGroup = uiOrdering.addNewGroup( "Curve Data" );
|
||||||
curveDataGroup->add( &m_wellPath );
|
curveDataGroup->add( &m_wellPath );
|
||||||
|
|||||||
Reference in New Issue
Block a user