Skip to content

Commit

Permalink
Improvements for cross plot curves from multiple realizations
Browse files Browse the repository at this point in the history
WIP: Must fix single cross plot curve
  • Loading branch information
magnesj committed Sep 18, 2023
1 parent f0063b7 commit 7d57061
Show file tree
Hide file tree
Showing 9 changed files with 46 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2155,12 +2155,9 @@ QString RimEnsembleCurveSet::createAutoName() const
{
auto plot = firstAncestorOrThisOfTypeAsserted<RimSummaryPlot>();

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() )
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 "";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
19 changes: 1 addition & 18 deletions ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -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() )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,22 @@ 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;
QString curveNameX( const RifEclipseSummaryAddress& summaryAddress,
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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::string> strings;
Expand All @@ -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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 7d57061

Please sign in to comment.