#5131 : Calculated curves : Show native address in title

This commit is contained in:
Magne Sjaastad 2019-12-10 13:18:14 +01:00 committed by Kristian Bendiksen
parent 03581804e2
commit 532d5899de
3 changed files with 50 additions and 7 deletions

View File

@ -119,6 +119,22 @@ std::vector<RimSummaryCalculation*> RimSummaryCalculationCollection::calculation
return m_calcuations.childObjects();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimSummaryCalculation* RimSummaryCalculationCollection::findCalculationById( int id ) const
{
for ( RimSummaryCalculation* calc : m_calcuations )
{
if ( calc->id() == id )
{
return calc;
}
}
return nullptr;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -41,6 +41,7 @@ public:
RimSummaryCalculation* addCalculationCopy( const RimSummaryCalculation* sourceCalculation );
void deleteCalculation( RimSummaryCalculation* calculation );
std::vector<RimSummaryCalculation*> calculations() const;
RimSummaryCalculation* findCalculationById( int id ) const;
RimSummaryCase* calculationSummaryCase();

View File

@ -36,6 +36,10 @@
#include "RimMultiPlotWindow.h"
#include "RimPlotAxisProperties.h"
#include "RimProject.h"
#include "RimSummaryAddress.h"
#include "RimSummaryCalculation.h"
#include "RimSummaryCalculationCollection.h"
#include "RimSummaryCalculationVariable.h"
#include "RimSummaryCase.h"
#include "RimSummaryCurve.h"
#include "RimSummaryCurveCollection.h"
@ -1779,16 +1783,38 @@ void RimSummaryPlot::updateNameHelperWithCurveData( RimSummaryPlotNameHelper* na
{
for ( RimSummaryCurve* curve : m_summaryCurveCollection->curves() )
{
addresses.push_back( curve->summaryAddressY() );
sumCases.push_back( curve->summaryCaseY() );
if ( curve->summaryCaseX() )
if ( curve->summaryAddressY().category() == RifEclipseSummaryAddress::SUMMARY_CALCULATED )
{
sumCases.push_back( curve->summaryCaseX() );
RimProject* proj = RiaApplication::instance()->project();
RimSummaryCalculationCollection* calculationColl = proj->calculationCollection();
if ( curve->summaryAddressX().category() != RifEclipseSummaryAddress::SUMMARY_INVALID )
if ( calculationColl )
{
addresses.push_back( curve->summaryAddressX() );
RimSummaryCalculation* calculation = calculationColl->findCalculationById(
curve->summaryAddressY().id() );
if ( calculation )
{
for ( RimSummaryCalculationVariable* v : calculation->allVariables() )
{
sumCases.push_back( v->summaryCase() );
addresses.push_back( v->summaryAddress()->address() );
}
}
}
}
else
{
addresses.push_back( curve->summaryAddressY() );
sumCases.push_back( curve->summaryCaseY() );
if ( curve->summaryCaseX() )
{
sumCases.push_back( curve->summaryCaseX() );
if ( curve->summaryAddressX().category() != RifEclipseSummaryAddress::SUMMARY_INVALID )
{
addresses.push_back( curve->summaryAddressX() );
}
}
}
}