Added command for "New Grid Case Group"

TODO: Consider renaming and global availability in the treeview
This commit is contained in:
Pål Hagen 2015-08-11 16:18:27 +02:00
parent b18cd87727
commit 89a45c41c0
4 changed files with 129 additions and 0 deletions

View File

@ -9,6 +9,7 @@ ${CEE_CURRENT_LIST_DIR}RicEclipseCaseClose.h
${CEE_CURRENT_LIST_DIR}RicEclipseCaseCopy.h ${CEE_CURRENT_LIST_DIR}RicEclipseCaseCopy.h
${CEE_CURRENT_LIST_DIR}RicEclipseCaseExecuteScript.h ${CEE_CURRENT_LIST_DIR}RicEclipseCaseExecuteScript.h
${CEE_CURRENT_LIST_DIR}RicEclipseCaseNewGroup.h ${CEE_CURRENT_LIST_DIR}RicEclipseCaseNewGroup.h
${CEE_CURRENT_LIST_DIR}RicEclipseCaseNewGroupExec.h
${CEE_CURRENT_LIST_DIR}RicEclipseCaseNewView.h ${CEE_CURRENT_LIST_DIR}RicEclipseCaseNewView.h
${CEE_CURRENT_LIST_DIR}RicEclipseCasePaste.h ${CEE_CURRENT_LIST_DIR}RicEclipseCasePaste.h
${CEE_CURRENT_LIST_DIR}RicGeoMechPropertyFilter.h ${CEE_CURRENT_LIST_DIR}RicGeoMechPropertyFilter.h
@ -48,6 +49,7 @@ ${CEE_CURRENT_LIST_DIR}RicEclipseCaseClose.cpp
${CEE_CURRENT_LIST_DIR}RicEclipseCaseCopy.cpp ${CEE_CURRENT_LIST_DIR}RicEclipseCaseCopy.cpp
${CEE_CURRENT_LIST_DIR}RicEclipseCaseExecuteScript.cpp ${CEE_CURRENT_LIST_DIR}RicEclipseCaseExecuteScript.cpp
${CEE_CURRENT_LIST_DIR}RicEclipseCaseNewGroup.cpp ${CEE_CURRENT_LIST_DIR}RicEclipseCaseNewGroup.cpp
${CEE_CURRENT_LIST_DIR}RicEclipseCaseNewGroupExec.cpp
${CEE_CURRENT_LIST_DIR}RicEclipseCaseNewView.cpp ${CEE_CURRENT_LIST_DIR}RicEclipseCaseNewView.cpp
${CEE_CURRENT_LIST_DIR}RicEclipseCasePaste.cpp ${CEE_CURRENT_LIST_DIR}RicEclipseCasePaste.cpp
${CEE_CURRENT_LIST_DIR}RicGeoMechPropertyFilter.cpp ${CEE_CURRENT_LIST_DIR}RicGeoMechPropertyFilter.cpp

View File

@ -19,9 +19,12 @@
#include "RicEclipseCaseNewGroup.h" #include "RicEclipseCaseNewGroup.h"
#include "RicEclipseCaseNewGroupExec.h"
#include "RimCase.h" #include "RimCase.h"
#include "cafSelectionManager.h" #include "cafSelectionManager.h"
#include "cafCmdExecCommandManager.h"
#include <QAction> #include <QAction>
@ -50,6 +53,8 @@ bool RicEclipseCaseNewGroup::isCommandEnabled()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RicEclipseCaseNewGroup::onActionTriggered(bool isChecked) void RicEclipseCaseNewGroup::onActionTriggered(bool isChecked)
{ {
RicEclipseCaseNewGroupExec* cmdExec = new RicEclipseCaseNewGroupExec();
caf::CmdExecCommandManager::instance()->processExecuteCommand(cmdExec);
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -0,0 +1,85 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2015- Statoil ASA
// Copyright (C) 2015- Ceetron Solutions AS
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicEclipseCaseNewGroupExec.h"
#include "RimProject.h"
#include "RimEclipseCase.h"
#include "RimEclipseCaseCollection.h"
#include "RimEclipseStatisticsCase.h"
#include "RimIdenticalGridCaseGroup.h"
#include "RimOilField.h"
#include "RiaApplication.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicEclipseCaseNewGroupExec::RicEclipseCaseNewGroupExec()
: CmdExecuteCommand(NULL)
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicEclipseCaseNewGroupExec::~RicEclipseCaseNewGroupExec()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RicEclipseCaseNewGroupExec::name()
{
return "New Grid Case Group";
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicEclipseCaseNewGroupExec::redo()
{
RimProject* proj = RiaApplication::instance()->project();
CVF_ASSERT(proj);
RimEclipseCaseCollection* analysisModels = proj->activeOilField() ? proj->activeOilField()->analysisModels() : NULL;
if (analysisModels)
{
RimIdenticalGridCaseGroup* createdObject = new RimIdenticalGridCaseGroup;
proj->assignIdToCaseGroup(createdObject);
RimEclipseCase* createdReservoir = createdObject->createAndAppendStatisticsCase();
proj->assignCaseIdToCase(createdReservoir);
createdObject->name = QString("Grid Case Group %1").arg(analysisModels->caseGroups().size() + 1);
analysisModels->caseGroups().push_back(createdObject);
analysisModels->updateConnectedEditors();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicEclipseCaseNewGroupExec::undo()
{
// TODO
CVF_ASSERT(0);
}

View File

@ -0,0 +1,37 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2015- Statoil ASA
// Copyright (C) 2015- Ceetron Solutions AS
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafCmdExecuteCommand.h"
//==================================================================================================
///
//==================================================================================================
class RicEclipseCaseNewGroupExec : public caf::CmdExecuteCommand
{
public:
RicEclipseCaseNewGroupExec();
virtual ~RicEclipseCaseNewGroupExec();
virtual QString name();
virtual void redo();
virtual void undo();
};