#4828 Summary Plot Templates : Support ensembles as plot data sources

This commit is contained in:
Magne Sjaastad
2019-10-04 18:46:30 +02:00
parent 3d3ad421dd
commit 2c73b2ed02
9 changed files with 152 additions and 78 deletions

View File

@@ -40,7 +40,10 @@ CAF_CMD_SOURCE_INIT( RicCreatePlotFromSelectionFeature, "RicCreatePlotFromSelect
//--------------------------------------------------------------------------------------------------
bool RicCreatePlotFromSelectionFeature::isCommandEnabled()
{
return !selectedSummaryCases().empty();
bool anySummaryCases = !RicSummaryPlotTemplateTools::selectedSummaryCases().empty();
bool anySummaryCaseCollections = !RicSummaryPlotTemplateTools::selectedSummaryCaseCollections().empty();
return ( anySummaryCases || anySummaryCaseCollections );
}
//--------------------------------------------------------------------------------------------------
@@ -48,11 +51,12 @@ bool RicCreatePlotFromSelectionFeature::isCommandEnabled()
//--------------------------------------------------------------------------------------------------
void RicCreatePlotFromSelectionFeature::onActionTriggered( bool isChecked )
{
QString fileName = RicSummaryPlotTemplateTools::selectPlotTemplatePath();
std::vector<RimSummaryCase*> sumCases = selectedSummaryCases();
QString fileName = RicSummaryPlotTemplateTools::selectPlotTemplatePath();
auto sumCases = RicSummaryPlotTemplateTools::selectedSummaryCases();
auto sumCaseCollections = RicSummaryPlotTemplateTools::selectedSummaryCaseCollections();
RimSummaryPlot* newSummaryPlot = RicSummaryPlotTemplateTools::createPlotFromTemplateFile( fileName );
RicSummaryPlotTemplateTools::appendSummaryPlotToPlotCollection( newSummaryPlot, sumCases );
RicSummaryPlotTemplateTools::appendSummaryPlotToPlotCollection( newSummaryPlot, sumCases, sumCaseCollections );
}
//--------------------------------------------------------------------------------------------------
@@ -63,14 +67,3 @@ void RicCreatePlotFromSelectionFeature::setupActionLook( QAction* actionToSetup
actionToSetup->setText( "Create Plot from Template" );
actionToSetup->setIcon( QIcon( ":/SummaryTemplate16x16.png" ) );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimSummaryCase*> RicCreatePlotFromSelectionFeature::selectedSummaryCases() const
{
std::vector<RimSummaryCase*> objects;
caf::SelectionManager::instance()->objectsByType( &objects );
return objects;
}