mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#2818 Summary. Add new-plot-commands to context menus
This commit is contained in:
@@ -29,11 +29,14 @@
|
||||
#include "RimSummaryCurveFilter.h"
|
||||
#include "RimSummaryPlot.h"
|
||||
#include "RimSummaryPlotCollection.h"
|
||||
#include "RimSummaryCase.h"
|
||||
#include "RimSummaryCaseCollection.h"
|
||||
|
||||
#include "RiuPlotMainWindow.h"
|
||||
|
||||
#include "cvfAssert.h"
|
||||
#include "cafSelectionManager.h"
|
||||
#include "cafSelectionManagerTools.h"
|
||||
//#include "cafPdmUiItem.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
@@ -55,7 +58,15 @@ bool RicNewSummaryPlotFeature::isCommandEnabled()
|
||||
|
||||
if (sumPlotColl) return true;
|
||||
|
||||
return false;
|
||||
// Multiple case selections
|
||||
std::vector<caf::PdmUiItem*> selectedItems = caf::selectedObjectsByTypeStrict<caf::PdmUiItem*>();
|
||||
|
||||
for (auto item : selectedItems)
|
||||
{
|
||||
if (!dynamic_cast<RimSummaryCase*>(item) && !dynamic_cast<RimSummaryCaseCollection*>(item))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -66,6 +77,16 @@ void RicNewSummaryPlotFeature::onActionTriggered(bool isChecked)
|
||||
RimProject* project = RiaApplication::instance()->project();
|
||||
CVF_ASSERT(project);
|
||||
|
||||
std::vector<RimSummaryCase*> selectedCases = caf::selectedObjectsByType<RimSummaryCase*>();
|
||||
std::vector<RimSummaryCaseCollection*> selectedGroups = caf::selectedObjectsByType<RimSummaryCaseCollection*>();
|
||||
|
||||
// Append grouped cases
|
||||
for (auto group : selectedGroups)
|
||||
{
|
||||
auto groupCases = group->allSummaryCases();
|
||||
selectedCases.insert(selectedCases.end(), groupCases.begin(), groupCases.end());
|
||||
}
|
||||
|
||||
auto dialog = RicEditSummaryPlotFeature::curveCreatorDialog();
|
||||
|
||||
if (!dialog->isVisible())
|
||||
@@ -77,7 +98,7 @@ void RicNewSummaryPlotFeature::onActionTriggered(bool isChecked)
|
||||
dialog->raise();
|
||||
}
|
||||
|
||||
dialog->updateFromSummaryPlot(nullptr);
|
||||
dialog->updateFromDefaultCases(selectedCases);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user