mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Added command for "New Grid Case Group"
TODO: Consider renaming and global availability in the treeview
This commit is contained in:
parent
b18cd87727
commit
89a45c41c0
@ -9,6 +9,7 @@ ${CEE_CURRENT_LIST_DIR}RicEclipseCaseClose.h
|
||||
${CEE_CURRENT_LIST_DIR}RicEclipseCaseCopy.h
|
||||
${CEE_CURRENT_LIST_DIR}RicEclipseCaseExecuteScript.h
|
||||
${CEE_CURRENT_LIST_DIR}RicEclipseCaseNewGroup.h
|
||||
${CEE_CURRENT_LIST_DIR}RicEclipseCaseNewGroupExec.h
|
||||
${CEE_CURRENT_LIST_DIR}RicEclipseCaseNewView.h
|
||||
${CEE_CURRENT_LIST_DIR}RicEclipseCasePaste.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}RicEclipseCaseExecuteScript.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicEclipseCaseNewGroup.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicEclipseCaseNewGroupExec.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicEclipseCaseNewView.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicEclipseCasePaste.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicGeoMechPropertyFilter.cpp
|
||||
|
@ -19,9 +19,12 @@
|
||||
|
||||
#include "RicEclipseCaseNewGroup.h"
|
||||
|
||||
#include "RicEclipseCaseNewGroupExec.h"
|
||||
|
||||
#include "RimCase.h"
|
||||
|
||||
#include "cafSelectionManager.h"
|
||||
#include "cafCmdExecCommandManager.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
@ -50,6 +53,8 @@ bool RicEclipseCaseNewGroup::isCommandEnabled()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicEclipseCaseNewGroup::onActionTriggered(bool isChecked)
|
||||
{
|
||||
RicEclipseCaseNewGroupExec* cmdExec = new RicEclipseCaseNewGroupExec();
|
||||
caf::CmdExecCommandManager::instance()->processExecuteCommand(cmdExec);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
85
ApplicationCode/Commands/RicEclipseCaseNewGroupExec.cpp
Normal file
85
ApplicationCode/Commands/RicEclipseCaseNewGroupExec.cpp
Normal 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);
|
||||
}
|
37
ApplicationCode/Commands/RicEclipseCaseNewGroupExec.h
Normal file
37
ApplicationCode/Commands/RicEclipseCaseNewGroupExec.h
Normal 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();
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user