Simplify access to RimMainPlotCollection

* Add current() to RimMainPlotCollection to avoid include of RimProject
* Remove "segment" prefix
* Reload data when RftCase changes
This commit is contained in:
Magne Sjaastad
2022-08-19 05:30:25 -07:00
committed by GitHub
parent 506bfbd638
commit 4cd38d7daf
51 changed files with 240 additions and 418 deletions

View File

@@ -25,7 +25,6 @@
#include "RimGridCrossPlotDataSet.h"
#include "RimGridView.h"
#include "RimMainPlotCollection.h"
#include "RimProject.h"
#include "RiuPlotMainWindowTools.h"
#include "RiuViewer.h"
@@ -50,12 +49,11 @@ bool RicCreateGridCrossPlotFeature::isCommandEnabled()
//--------------------------------------------------------------------------------------------------
void RicCreateGridCrossPlotFeature::onActionTriggered( bool isChecked )
{
RimProject* project = RimProject::current();
RimGridCrossPlotCollection* collection =
caf::SelectionManager::instance()->selectedItemAncestorOfType<RimGridCrossPlotCollection>();
if ( !collection )
{
collection = project->mainPlotCollection()->gridCrossPlotCollection();
collection = RimMainPlotCollection::current()->gridCrossPlotCollection();
}
RimGridCrossPlot* plot = collection->createGridCrossPlot();
RimGridCrossPlotDataSet* dataSet = plot->createDataSet();

View File

@@ -58,9 +58,7 @@ std::vector<RimSaturationPressurePlot*>
return plots;
}
RimProject* project = RimProject::current();
RimSaturationPressurePlotCollection* collection = project->mainPlotCollection()->saturationPressurePlotCollection();
RimSaturationPressurePlotCollection* collection = RimMainPlotCollection::current()->saturationPressurePlotCollection();
if ( eclipseResultCase && eclipseResultCase->ensureReservoirCaseIsOpen() )
{
@@ -123,9 +121,7 @@ bool RicCreateSaturationPressurePlotsFeature::isCommandEnabled()
//--------------------------------------------------------------------------------------------------
void RicCreateSaturationPressurePlotsFeature::onActionTriggered( bool isChecked )
{
RimProject* project = RimProject::current();
RimSaturationPressurePlotCollection* collection = project->mainPlotCollection()->saturationPressurePlotCollection();
RimSaturationPressurePlotCollection* collection = RimMainPlotCollection::current()->saturationPressurePlotCollection();
std::vector<RimEclipseResultCase*> eclipseCases;
{