Skip to content

Commit

Permalink
Add helper functions for assignment of data source and axis
Browse files Browse the repository at this point in the history
  • Loading branch information
magnesj committed Sep 19, 2023
1 parent a837507 commit 10ea031
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 10 deletions.
23 changes: 23 additions & 0 deletions ApplicationLibCode/Application/Tools/RiaSummaryTools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -354,3 +354,26 @@ QList<caf::PdmOptionItemInfo> RiaSummaryTools::optionsForSummaryCases( const std

return options;
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaSummaryTools::copyCurveDataSources( RimSummaryCurve& curve, const RimSummaryCurve& otherCurve )
{
curve.setSummaryAddressX( otherCurve.summaryAddressX() );
curve.setSummaryCaseX( otherCurve.summaryCaseX() );

curve.setSummaryAddressY( otherCurve.summaryAddressY() );
curve.setSummaryCaseY( otherCurve.summaryCaseY() );
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaSummaryTools::copyCurveAxisData( RimSummaryCurve& curve, const RimSummaryCurve& otherCurve )
{
curve.setAxisTypeX( otherCurve.axisTypeX() );
curve.setTopOrBottomAxisX( otherCurve.axisX() );

curve.setLeftOrRightAxisY( otherCurve.axisY() );
}
4 changes: 4 additions & 0 deletions ApplicationLibCode/Application/Tools/RiaSummaryTools.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class RimSummaryCaseCollection;
class RimSummaryTable;
class RimSummaryTableCollection;
class RimObservedDataCollection;
class RimSummaryCurve;

class RifEclipseSummaryAddress;

Expand Down Expand Up @@ -88,4 +89,7 @@ class RiaSummaryTools

static QList<caf::PdmOptionItemInfo> optionsForAllSummaryCases();
static QList<caf::PdmOptionItemInfo> optionsForSummaryCases( const std::vector<RimSummaryCase*>& cases );

static void copyCurveDataSources( RimSummaryCurve& curve, const RimSummaryCurve& otherCurve );
static void copyCurveAxisData( RimSummaryCurve& curve, const RimSummaryCurve& otherCurve );
};
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,7 @@ RimSummaryDeclineCurve* RicCreateDeclineCurvesFeature::createDeclineCurveAndAddT
RimSummaryDeclineCurve* newCurve = new RimSummaryDeclineCurve();
CVF_ASSERT( newCurve );

newCurve->setSummaryCaseX( sourceCurve->summaryCaseX() );
newCurve->setSummaryAddressX( sourceCurve->summaryAddressX() );

newCurve->setSummaryCaseY( sourceCurve->summaryCaseY() );
newCurve->setSummaryAddressY( sourceCurve->summaryAddressY() );
RiaSummaryTools::copyCurveDataSources( *newCurve, *sourceCurve );

newCurve->setDeclineCurveType( declineCurveType );

Expand All @@ -105,6 +101,8 @@ RimSummaryDeclineCurve* RicCreateDeclineCurvesFeature::createDeclineCurveAndAddT

summaryPlot->addCurveAndUpdate( newCurve );

RiaSummaryTools::copyCurveAxisData( *newCurve, *sourceCurve );

newCurve->updateDefaultValues();
newCurve->loadDataAndUpdate( true );
newCurve->updateConnectedEditors();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,18 +78,16 @@ RimSummaryRegressionAnalysisCurve*
RimSummaryRegressionAnalysisCurve* newCurve = new RimSummaryRegressionAnalysisCurve();
CVF_ASSERT( newCurve );

newCurve->setSummaryCaseX( sourceCurve->summaryCaseX() );
newCurve->setSummaryAddressX( sourceCurve->summaryAddressX() );

newCurve->setSummaryCaseY( sourceCurve->summaryCaseY() );
newCurve->setSummaryAddressY( sourceCurve->summaryAddressY() );
RiaSummaryTools::copyCurveDataSources( *newCurve, *sourceCurve );

newCurve->setColor( sourceCurve->color() );
newCurve->setSymbol( RiuPlotCurveSymbol::PointSymbolEnum::SYMBOL_RECT );
newCurve->setSymbolSkipDistance( 50 );

summaryPlot->addCurveAndUpdate( newCurve );

RiaSummaryTools::copyCurveAxisData( *newCurve, *sourceCurve );

newCurve->updateDefaultValues();
newCurve->loadDataAndUpdate( true );
newCurve->updateConnectedEditors();
Expand Down

0 comments on commit 10ea031

Please sign in to comment.