Merge pull request #8882 from OPM/append_curves

Summary Multiplot: Source Stepping append curves with performance fixes
This commit is contained in:
jonjenssen authored and GitHub committed 2022-05-04 13:11:04 +02:00
1 parent bb6ca0848d
commit 296ddbde42
20 files changed
+349 -73

No files matched your search

@@ -131,6 +131,16 @@ RimSummaryMultiPlot::RimSummaryMultiPlot()
m_appendPrevPlot.uiCapability()->setUiEditorTypeName( caf::PdmUiPushButtonEditor::uiEditorTypeName() );
m_appendPrevPlot.uiCapability()->setUiIconFromResourceString( ":/AppendPrev.png" );
CAF_PDM_InitField( &m_appendNextCurve, "AppendNextCurve", false, "", "", "Step Next and Add Curve to Plot" );
m_appendNextCurve.xmlCapability()->disableIO();
m_appendNextCurve.uiCapability()->setUiEditorTypeName( caf::PdmUiPushButtonEditor::uiEditorTypeName() );
m_appendNextCurve.uiCapability()->setUiIconFromResourceString( ":/AppendNextCurve.png" );
CAF_PDM_InitField( &m_appendPrevCurve, "AppendPrevCurve", false, "", "", "Step Previous and Add Curve to Plot" );
m_appendPrevCurve.xmlCapability()->disableIO();
m_appendPrevCurve.uiCapability()->setUiEditorTypeName( caf::PdmUiPushButtonEditor::uiEditorTypeName() );
m_appendPrevCurve.uiCapability()->setUiIconFromResourceString( ":/AppendPrevCurve.png" );
CAF_PDM_InitField( &m_linkSubPlotAxes, "LinkSubPlotAxes", true, "Link Sub Plot Axes" );
CAF_PDM_InitField( &m_autoAdjustAppearance, "AutoAdjustAppearance", false, "Auto Adjust Appearance" );
@@ -408,6 +418,18 @@ void RimSummaryMultiPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedFi
int stepDirection = -1;
appendSubPlotByStepping( stepDirection );
}
else if ( changedField == &m_appendNextCurve )
{
m_appendNextCurve = false;
int stepDirection = 1;
appendCurveByStepping( stepDirection );
}
else if ( changedField == &m_appendPrevCurve )
{
m_appendPrevCurve = false;
int stepDirection = -1;
appendCurveByStepping( stepDirection );
}
else if ( changedField == &m_autoAdjustAppearance )
{
checkAndApplyAutoAppearance();
@@ -526,6 +548,9 @@ std::vector<caf::PdmFieldHandle*> RimSummaryMultiPlot::fieldsToShowInToolbar()
toolBarFields.push_back( &m_appendPrevPlot );
toolBarFields.push_back( &m_appendNextPlot );
toolBarFields.push_back( &m_appendPrevCurve );
toolBarFields.push_back( &m_appendNextCurve );
auto multiFields = RimMultiPlot::fieldsToShowInToolbar();
toolBarFields.insert( std::end( toolBarFields ), std::begin( multiFields ), std::end( multiFields ) );
@@ -1069,6 +1094,44 @@ void RimSummaryMultiPlot::appendSubPlotByStepping( int direction )
RiuPlotMainWindowTools::refreshToolbars();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSummaryMultiPlot::appendCurveByStepping( int direction )
{
for ( auto plot : summaryPlots() )
{
std::vector<caf::PdmObjectHandle*> addresses;
for ( auto curve : plot->allCurves( RimSummaryDataSourceStepping::Axis::Y_AXIS ) )
{
auto address = curve->summaryAddressY();
auto sumCase = curve->summaryCaseY();
address = m_sourceStepping->stepAddress( address, direction );
addresses.push_back( RimSummaryAddress::wrapFileReaderAddress( address, sumCase->caseId() ) );
}
for ( auto curveSet : plot->curveSets() )
{
auto address = curveSet->summaryAddress();
auto sumEns = curveSet->summaryCaseCollection();
address = m_sourceStepping->stepAddress( address, direction );
addresses.push_back( RimSummaryAddress::wrapFileReaderAddress( address, -1, sumEns->ensembleId() ) );
}
plot->handleDroppedObjects( addresses );
for ( auto adr : addresses )
{
delete adr;
}
}
m_sourceStepping->updateStepIndex( direction );
RiuPlotMainWindowTools::refreshToolbars();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------