From 7584e038832afdd2e46240cdfe2b9ba9019d1f6f Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 1 Jul 2016 09:20:20 +0200 Subject: [PATCH] Added context menu NewSummaryPlot for summary cases --- .../Application/RiaApplication.cpp | 2 ++ .../RicNewSummaryPlotFeature.cpp | 23 ++++++++++++++++--- .../RimContextCommandBuilder.cpp | 9 ++++++-- 3 files changed, 29 insertions(+), 5 deletions(-) diff --git a/ApplicationCode/Application/RiaApplication.cpp b/ApplicationCode/Application/RiaApplication.cpp index c182a3123b..6af30494ef 100644 --- a/ApplicationCode/Application/RiaApplication.cpp +++ b/ApplicationCode/Application/RiaApplication.cpp @@ -820,6 +820,8 @@ bool RiaApplication::openEclipseCase(const QString& caseName, const QString& cas RimSummaryPlotCollection* summaryPlotColl = mainPlotColl->summaryPlotCollection(); RicNewSummaryPlotFeature::createNewSummaryPlot(summaryPlotColl, newSumCase); + + sumCaseColl->updateConnectedEditors(); } } } diff --git a/ApplicationCode/Commands/SummaryPlotCommands/RicNewSummaryPlotFeature.cpp b/ApplicationCode/Commands/SummaryPlotCommands/RicNewSummaryPlotFeature.cpp index 5b22e562d0..60ec8f1b8b 100644 --- a/ApplicationCode/Commands/SummaryPlotCommands/RicNewSummaryPlotFeature.cpp +++ b/ApplicationCode/Commands/SummaryPlotCommands/RicNewSummaryPlotFeature.cpp @@ -22,12 +22,15 @@ #include "RimMainPlotCollection.h" #include "RimProject.h" +#include "RimSummaryCase.h" #include "RimSummaryCurveFilter.h" #include "RimSummaryPlot.h" #include "RimSummaryPlotCollection.h" #include "RiuMainPlotWindow.h" +#include "cafSelectionManager.h" + #include #include "cvfAssert.h" @@ -57,10 +60,24 @@ void RicNewSummaryPlotFeature::onActionTriggered(bool isChecked) RimSummaryPlotCollection* summaryPlotColl = mainPlotColl->summaryPlotCollection(); CVF_ASSERT(summaryPlotColl); - std::vector cases; - project->allSummaryCases(cases); + RimSummaryCase* summaryCase = nullptr; + std::vector selection; + caf::SelectionManager::instance()->objectsByType(&selection); + if (selection.size() == 1) + { + summaryCase = selection[0]; + } + else + { + std::vector cases; + project->allSummaryCases(cases); + if (cases.size() > 0) + { + summaryCase = cases[0]; + } + } - createNewSummaryPlot(summaryPlotColl, cases.size() > 0 ? cases[0] : NULL); + createNewSummaryPlot(summaryPlotColl, summaryCase); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimContextCommandBuilder.cpp b/ApplicationCode/ProjectDataModel/RimContextCommandBuilder.cpp index 35e7935548..f62c7d18b2 100644 --- a/ApplicationCode/ProjectDataModel/RimContextCommandBuilder.cpp +++ b/ApplicationCode/ProjectDataModel/RimContextCommandBuilder.cpp @@ -41,9 +41,10 @@ #include "RimGeoMechView.h" #include "RimIdenticalGridCaseGroup.h" #include "RimScriptCollection.h" -#include "RimSummaryPlotCollection.h" -#include "RimSummaryPlot.h" +#include "RimSummaryCase.h" #include "RimSummaryCurve.h" +#include "RimSummaryPlot.h" +#include "RimSummaryPlotCollection.h" #include "RimViewController.h" #include "RimViewLinker.h" #include "RimWellLogCurve.h" @@ -278,6 +279,10 @@ QStringList RimContextCommandBuilder::commandsFromSelection() { commandIds << "RicDeleteItemFeature"; } + else if (dynamic_cast(uiItem)) + { + commandIds << "RicNewSummaryPlotFeature"; + } else if (dynamic_cast(uiItem)) { commandIds << "RicAddWellLogToPlotFeature";