diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp index 4c81a581ba..50f7d2f5d8 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp @@ -2155,12 +2155,9 @@ QString RimEnsembleCurveSet::createAutoName() const { auto plot = firstAncestorOrThisOfTypeAsserted(); - QString curveSetName = - m_summaryAddressNameTools->curveNameY( m_yValuesSummaryAddress->address(), plot->plotTitleHelper(), plot->plotTitleHelper() ); - if ( curveSetName.isEmpty() ) - { - curveSetName = m_summaryAddressNameTools->curveNameY( m_yValuesSummaryAddress->address(), nullptr, nullptr ); - } + QString curveSetName = m_summaryAddressNameTools->curveName( RiaSummaryCurveAddress( m_yValuesSummaryAddress->address() ), + plot->plotTitleHelper(), + plot->plotTitleHelper() ); if ( curveSetName.isEmpty() ) { diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimMultipleSummaryPlotNameHelper.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimMultipleSummaryPlotNameHelper.cpp index 7286fb86f6..0196809103 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimMultipleSummaryPlotNameHelper.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimMultipleSummaryPlotNameHelper.cpp @@ -49,12 +49,12 @@ QString RimMultiSummaryPlotNameHelper::plotTitle() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -bool RimMultiSummaryPlotNameHelper::isPlotDisplayingSingleVectorName() const +bool RimMultiSummaryPlotNameHelper::isPlotDisplayingSingleCurveType() const { int plotCountWithSingleQuantity = 0; for ( auto nameHelper : m_nameHelpers ) { - if ( nameHelper->isPlotDisplayingSingleVectorName() ) plotCountWithSingleQuantity++; + if ( nameHelper->isPlotDisplayingSingleCurveType() ) plotCountWithSingleQuantity++; } return plotCountWithSingleQuantity == 1; @@ -160,7 +160,7 @@ std::string RimMultiSummaryPlotNameHelper::titleVectorName() const { for ( auto nameHelper : m_nameHelpers ) { - if ( nameHelper->isPlotDisplayingSingleVectorName() ) return nameHelper->titleVectorName(); + if ( nameHelper->isPlotDisplayingSingleCurveType() ) return nameHelper->titleVectorName(); } return ""; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimMultipleSummaryPlotNameHelper.h b/ApplicationLibCode/ProjectDataModel/Summary/RimMultipleSummaryPlotNameHelper.h index 56d6ed9581..71d5c9cbb2 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimMultipleSummaryPlotNameHelper.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimMultipleSummaryPlotNameHelper.h @@ -30,7 +30,7 @@ class RimMultiSummaryPlotNameHelper : public RimSummaryNameHelper QString plotTitle() const override; - bool isPlotDisplayingSingleVectorName() const override; + bool isPlotDisplayingSingleCurveType() const override; bool isWellNameInTitle() const override; bool isGroupNameInTitle() const override; bool isNetworkInTitle() const override; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp index b8ba4879db..92a104191b 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp @@ -600,25 +600,8 @@ QString RimSummaryCurve::createCurveAutoName() } RimMultiSummaryPlotNameHelper multiNameHelper( plotNameHelpers ); - QString curveName = m_curveNameConfig->curveNameY( m_yValuesSummaryAddress->address(), currentPlotNameHelper, &multiNameHelper ); - if ( curveName.isEmpty() ) - { - curveName = m_curveNameConfig->curveNameY( m_yValuesSummaryAddress->address(), nullptr, nullptr ); - } - - { - QString curveNameX = m_curveNameConfig->curveNameX( m_xValuesSummaryAddress->address(), currentPlotNameHelper, &multiNameHelper ); - if ( curveNameX.isEmpty() ) - { - curveNameX = m_curveNameConfig->curveNameX( m_xValuesSummaryAddress->address(), nullptr, nullptr ); - } - - if ( !curveName.isEmpty() && !curveNameX.isEmpty() ) - { - curveName += " | " + curveNameX; - } - } + QString curveName = m_curveNameConfig->curveName( curveAddress(), currentPlotNameHelper, &multiNameHelper ); if ( curveName.isEmpty() ) { curveName = "Curve Name Placeholder"; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveAutoName.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveAutoName.cpp index efce53cf2d..a11585bddf 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveAutoName.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveAutoName.cpp @@ -65,6 +65,24 @@ RimSummaryCurveAutoName::RimSummaryCurveAutoName() } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RimSummaryCurveAutoName::curveName( const RiaSummaryCurveAddress& summaryCurveAddress, + const RimSummaryNameHelper* currentNameHelper, + const RimSummaryNameHelper* plotNameHelper ) const +{ + QString name; + + name = curveNameY( summaryCurveAddress.summaryAddressY(), currentNameHelper, plotNameHelper ); + if ( name.isEmpty() ) + { + name = curveNameY( summaryCurveAddress.summaryAddressY(), nullptr, nullptr ); + } + + return name; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -193,7 +211,7 @@ QString RimSummaryCurveAutoName::buildCurveName( const RifEclipseSummaryAddress& if ( m_vectorName || m_longVectorName ) { - bool skipSubString = currentNameHelper && currentNameHelper->vectorNames().size() == 1; + bool skipSubString = currentNameHelper && currentNameHelper->isPlotDisplayingSingleCurveType(); if ( !skipSubString ) { if ( m_longVectorName() ) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveAutoName.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveAutoName.h index baaacc7c31..ca86409300 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveAutoName.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveAutoName.h @@ -31,6 +31,15 @@ class RimSummaryCurveAutoName : public caf::PdmObject public: RimSummaryCurveAutoName(); + QString curveName( const RiaSummaryCurveAddress& summaryCurveAddress, + const RimSummaryNameHelper* currentNameHelper, + const RimSummaryNameHelper* plotNameHelper ) const; + + void applySettings( const RimSummaryCurveAutoName& other ); + +private: + // friend class RimSummaryCurve; + QString curveNameY( const RifEclipseSummaryAddress& summaryAddress, const RimSummaryNameHelper* currentNameHelper, const RimSummaryNameHelper* plotNameHelper ) const; @@ -38,11 +47,6 @@ class RimSummaryCurveAutoName : public caf::PdmObject const RimSummaryNameHelper* currentNameHelper, const RimSummaryNameHelper* plotNameHelper ) const; - void applySettings( const RimSummaryCurveAutoName& other ); - -private: - friend class RimSummaryCurve; - void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryNameHelper.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryNameHelper.h index b21d58416f..c6549fc3be 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryNameHelper.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryNameHelper.h @@ -38,7 +38,7 @@ class RimSummaryNameHelper QString aggregatedPlotTitle( const RimSummaryNameHelper& summaryMultiPlotNameHelper ) const; - virtual bool isPlotDisplayingSingleVectorName() const = 0; + virtual bool isPlotDisplayingSingleCurveType() const = 0; virtual bool isWellNameInTitle() const = 0; virtual bool isGroupNameInTitle() const = 0; virtual bool isNetworkInTitle() const = 0; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotNameHelper.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotNameHelper.cpp index aaaab75891..25a8076924 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotNameHelper.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotNameHelper.cpp @@ -102,8 +102,14 @@ QString RimSummaryPlotNameHelper::plotTitle() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -bool RimSummaryPlotNameHelper::isPlotDisplayingSingleVectorName() const +bool RimSummaryPlotNameHelper::isPlotDisplayingSingleCurveType() const { + if ( m_analyzer->quantities().size() == 2 && m_analyzer->onlyCrossPlotCurves() ) + { + // We have cross plot curves, and two quantities. This means that we have one curve. + return true; + } + if ( m_analyzer->quantities().size() == 2 ) { std::vector strings; @@ -113,6 +119,7 @@ bool RimSummaryPlotNameHelper::isPlotDisplayingSingleVectorName() const auto first = RimObjectiveFunctionTools::nativeQuantityName( strings[0] ); auto second = RimObjectiveFunctionTools::nativeQuantityName( strings[1] ); + // We have two quantities, one history and one not. if ( first == second ) return true; } diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotNameHelper.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotNameHelper.h index 6f64f810c9..65de09e958 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotNameHelper.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotNameHelper.h @@ -50,7 +50,7 @@ class RimSummaryPlotNameHelper : public RimSummaryNameHelper QString plotTitle() const override; - bool isPlotDisplayingSingleVectorName() const override; + bool isPlotDisplayingSingleCurveType() const override; bool isWellNameInTitle() const override; bool isGroupNameInTitle() const override; bool isNetworkInTitle() const override;