mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-09 23:16:00 -06:00
#723 Make sure a view is created if no view is present for a statistics case
This commit is contained in:
parent
74cc58e5f2
commit
0b8285d333
@ -64,17 +64,7 @@ void RicComputeStatisticsFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
RimEclipseStatisticsCase* statisticsCase = selection[0];
|
||||
|
||||
statisticsCase->computeStatistics();
|
||||
statisticsCase->scheduleACTIVEGeometryRegenOnReservoirViews();
|
||||
statisticsCase->updateConnectedEditorsAndReservoirViews();
|
||||
|
||||
if (statisticsCase->reservoirViews.size() == 0)
|
||||
{
|
||||
QAction* action = caf::CmdFeatureManager::instance()->action("RicNewViewFeature");
|
||||
CVF_ASSERT(action);
|
||||
|
||||
action->trigger();
|
||||
}
|
||||
statisticsCase->computeStatisticsAndUpdateViews();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -19,21 +19,34 @@
|
||||
|
||||
#include "RicNewViewFeature.h"
|
||||
|
||||
#include "RimView.h"
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimGeoMechView.h"
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimGeoMechCase.h"
|
||||
#include "RimGeoMechView.h"
|
||||
#include "RimView.h"
|
||||
|
||||
#include "RiuMainWindow.h"
|
||||
|
||||
#include "cafSelectionManager.h"
|
||||
#include "cafPdmUiTreeView.h"
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicNewViewFeature, "RicNewViewFeature");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewViewFeature::addReservoirView()
|
||||
{
|
||||
RimView* newView = createReservoirView();
|
||||
|
||||
if (newView)
|
||||
{
|
||||
RiuMainWindow::instance()->projectTreeView()->setExpanded(newView, true);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -50,9 +63,7 @@ bool RicNewViewFeature::isCommandEnabled()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewViewFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
RimView* newView = addReservoirView();
|
||||
|
||||
RiuMainWindow::instance()->projectTreeView()->setExpanded(newView, true);
|
||||
addReservoirView();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -66,7 +77,7 @@ void RicNewViewFeature::setupActionLook(QAction* actionToSetup)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimView* RicNewViewFeature::addReservoirView()
|
||||
RimView* RicNewViewFeature::createReservoirView()
|
||||
{
|
||||
// Establish type of selected object
|
||||
RimEclipseCase* eclipseCase = selectedEclipseCase();
|
||||
@ -108,7 +119,7 @@ RimView* RicNewViewFeature::addReservoirView()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimEclipseCase* RicNewViewFeature::selectedEclipseCase() const
|
||||
RimEclipseCase* RicNewViewFeature::selectedEclipseCase()
|
||||
{
|
||||
std::vector<RimEclipseCase*> selection;
|
||||
caf::SelectionManager::instance()->objectsByType(&selection);
|
||||
@ -124,7 +135,7 @@ RimEclipseCase* RicNewViewFeature::selectedEclipseCase() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimGeoMechCase* RicNewViewFeature::selectedGeoMechCase() const
|
||||
RimGeoMechCase* RicNewViewFeature::selectedGeoMechCase()
|
||||
{
|
||||
std::vector<RimGeoMechCase*> selection;
|
||||
caf::SelectionManager::instance()->objectsByType(&selection);
|
||||
@ -140,7 +151,7 @@ RimGeoMechCase* RicNewViewFeature::selectedGeoMechCase() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimEclipseView* RicNewViewFeature::selectedEclipseView() const
|
||||
RimEclipseView* RicNewViewFeature::selectedEclipseView()
|
||||
{
|
||||
std::vector<RimEclipseView*> selection;
|
||||
caf::SelectionManager::instance()->objectsByType(&selection);
|
||||
@ -156,7 +167,7 @@ RimEclipseView* RicNewViewFeature::selectedEclipseView() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimGeoMechView* RicNewViewFeature::selectedGeoMechView() const
|
||||
RimGeoMechView* RicNewViewFeature::selectedGeoMechView()
|
||||
{
|
||||
std::vector<RimGeoMechView*> selection;
|
||||
caf::SelectionManager::instance()->objectsByType(&selection);
|
||||
|
@ -21,11 +21,11 @@
|
||||
|
||||
#include "cafCmdFeature.h"
|
||||
|
||||
class RimView;
|
||||
class RimEclipseCase;
|
||||
class RimEclipseView;
|
||||
class RimGeoMechCase;
|
||||
class RimGeoMechView;
|
||||
class RimView;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
@ -34,6 +34,9 @@ class RicNewViewFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
public:
|
||||
static void addReservoirView();
|
||||
|
||||
protected:
|
||||
// Overrides
|
||||
virtual bool isCommandEnabled();
|
||||
@ -41,10 +44,10 @@ protected:
|
||||
virtual void setupActionLook( QAction* actionToSetup );
|
||||
|
||||
private:
|
||||
RimView* addReservoirView();
|
||||
static RimView* createReservoirView();
|
||||
|
||||
RimEclipseCase* selectedEclipseCase() const;
|
||||
RimGeoMechCase* selectedGeoMechCase() const;
|
||||
RimEclipseView* selectedEclipseView() const;
|
||||
RimGeoMechView* selectedGeoMechView() const;
|
||||
static RimEclipseCase* selectedEclipseCase();
|
||||
static RimGeoMechCase* selectedGeoMechCase();
|
||||
static RimEclipseView* selectedEclipseView();
|
||||
static RimGeoMechView* selectedGeoMechView();
|
||||
};
|
||||
|
@ -20,15 +20,19 @@
|
||||
|
||||
#include "RimEclipseStatisticsCase.h"
|
||||
|
||||
#include "RicNewViewFeature.h"
|
||||
|
||||
#include "RigCaseCellResultsData.h"
|
||||
#include "RigCaseData.h"
|
||||
|
||||
#include "RimCaseCollection.h"
|
||||
#include "RimIdenticalGridCaseGroup.h"
|
||||
#include "RimReservoirCellResultsStorage.h"
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimEclipseCellColors.h"
|
||||
#include "RimEclipseStatisticsCaseEvaluator.h"
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimEclipseWellCollection.h"
|
||||
#include "RimIdenticalGridCaseGroup.h"
|
||||
#include "RimReservoirCellResultsStorage.h"
|
||||
|
||||
#include "RiuMainWindow.h"
|
||||
|
||||
#include "cafPdmUiPushButtonEditor.h"
|
||||
@ -441,9 +445,7 @@ void RimEclipseStatisticsCase::fieldChangedByUi(const caf::PdmFieldHandle* chang
|
||||
}
|
||||
else
|
||||
{
|
||||
computeStatistics();
|
||||
scheduleACTIVEGeometryRegenOnReservoirViews();
|
||||
updateConnectedEditorsAndReservoirViews();
|
||||
computeStatisticsAndUpdateViews();
|
||||
}
|
||||
m_calculateEditCommand = false;
|
||||
}
|
||||
@ -653,6 +655,21 @@ void RimEclipseStatisticsCase::clearComputedStatistics()
|
||||
updateConnectedEditorsAndReservoirViews();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipseStatisticsCase::computeStatisticsAndUpdateViews()
|
||||
{
|
||||
computeStatistics();
|
||||
scheduleACTIVEGeometryRegenOnReservoirViews();
|
||||
updateConnectedEditorsAndReservoirViews();
|
||||
|
||||
if (reservoirViews.size() == 0)
|
||||
{
|
||||
RicNewViewFeature::addReservoirView();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -54,8 +54,8 @@ public:
|
||||
void computeStatistics();
|
||||
bool hasComputedStatistics() const;
|
||||
void clearComputedStatistics();
|
||||
void computeStatisticsAndUpdateViews();
|
||||
|
||||
void scheduleACTIVEGeometryRegenOnReservoirViews();
|
||||
void updateConnectedEditorsAndReservoirViews();
|
||||
|
||||
virtual bool openEclipseGridFile();
|
||||
@ -73,6 +73,8 @@ public:
|
||||
virtual void updateFilePathsFromProjectPath(const QString& projectPath, const QString& oldProjectPath){}
|
||||
|
||||
private:
|
||||
void scheduleACTIVEGeometryRegenOnReservoirViews();
|
||||
|
||||
RimIdenticalGridCaseGroup* caseGroup();
|
||||
|
||||
void getSourceCases(std::vector<RimEclipseCase*>& sourceCases);
|
||||
|
Loading…
Reference in New Issue
Block a user