#1390 Ensure computed statistics view is added to statistics case

This commit is contained in:
Bjørnar Grip Fjær
2017-04-03 12:35:19 +02:00
parent e4354a0891
commit 3cefc2f7a8
3 changed files with 19 additions and 17 deletions

View File

@@ -26,6 +26,7 @@
#include "RimView.h"
#include "RiuMainWindow.h"
#include "RiaLogging.h"
#include "cafSelectionManager.h"
@@ -36,9 +37,9 @@ CAF_CMD_SOURCE_INIT(RicNewViewFeature, "RicNewViewFeature");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewViewFeature::addReservoirView()
void RicNewViewFeature::addReservoirView(RimEclipseCase* eclipseCase, RimGeoMechCase* geomCase)
{
RimView* newView = createReservoirView();
RimView* newView = createReservoirView(eclipseCase, geomCase);
if (newView)
{
@@ -62,7 +63,18 @@ bool RicNewViewFeature::isCommandEnabled()
//--------------------------------------------------------------------------------------------------
void RicNewViewFeature::onActionTriggered(bool isChecked)
{
addReservoirView();
// Establish type of selected object
RimEclipseCase* eclipseCase = selectedEclipseCase();
RimGeoMechCase* geomCase = selectedGeoMechCase();
RimGeoMechView* geoMechView = selectedGeoMechView();
RimEclipseView* reservoirView = selectedEclipseView();
// Find case to insert into
if (geoMechView) geomCase = geoMechView->geoMechCase();
if (reservoirView) eclipseCase = reservoirView->eclipseCase();
addReservoirView(eclipseCase, geomCase);
}
//--------------------------------------------------------------------------------------------------
@@ -77,18 +89,8 @@ void RicNewViewFeature::setupActionLook(QAction* actionToSetup)
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimView* RicNewViewFeature::createReservoirView()
RimView* RicNewViewFeature::createReservoirView(RimEclipseCase* eclipseCase, RimGeoMechCase* geomCase)
{
// Establish type of selected object
RimEclipseCase* eclipseCase = selectedEclipseCase();
RimGeoMechCase* geomCase = selectedGeoMechCase();
RimGeoMechView* geoMechView = selectedGeoMechView();
RimEclipseView* reservoirView = selectedEclipseView();
// Find case to insert into
if (geoMechView) geomCase = geoMechView->geoMechCase();
if (reservoirView) eclipseCase = reservoirView->eclipseCase();
RimView* insertedView = NULL;
if (eclipseCase)

View File

@@ -35,7 +35,7 @@ class RicNewViewFeature : public caf::CmdFeature
CAF_CMD_HEADER_INIT;
public:
static void addReservoirView();
static void addReservoirView(RimEclipseCase* eclipseCase, RimGeoMechCase* geomCase);
protected:
// Overrides
@@ -44,7 +44,7 @@ protected:
virtual void setupActionLook( QAction* actionToSetup );
private:
static RimView* createReservoirView();
static RimView* createReservoirView(RimEclipseCase* eclipseCase, RimGeoMechCase* geomCase);
static RimEclipseCase* selectedEclipseCase();
static RimGeoMechCase* selectedGeoMechCase();