mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
(#339) Added RicCreateGridCaseGroupFeature
This commit is contained in:
parent
6e48e036c1
commit
fb6baee197
@ -43,6 +43,7 @@ ${CEE_CURRENT_LIST_DIR}RicSaveEclipseResultAsInputPropertyFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicSaveEclipseResultAsInputPropertyExec.h
|
||||
${CEE_CURRENT_LIST_DIR}RicImportEclipseCaseFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicImportInputEclipseCaseFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicCreateGridCaseGroupFeature.h
|
||||
|
||||
${CEE_CURRENT_LIST_DIR}RicWellPathsImportSsihubFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicWellPathsImportFileFeature.h
|
||||
@ -92,6 +93,7 @@ ${CEE_CURRENT_LIST_DIR}RicSaveEclipseResultAsInputPropertyFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicSaveEclipseResultAsInputPropertyExec.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicImportEclipseCaseFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicImportInputEclipseCaseFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicCreateGridCaseGroupFeature.cpp
|
||||
|
||||
${CEE_CURRENT_LIST_DIR}RicWellPathsImportSsihubFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicWellPathsImportFileFeature.cpp
|
||||
|
65
ApplicationCode/Commands/RicCreateGridCaseGroupFeature.cpp
Normal file
65
ApplicationCode/Commands/RicCreateGridCaseGroupFeature.cpp
Normal file
@ -0,0 +1,65 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RicCreateGridCaseGroupFeature.h"
|
||||
|
||||
#include "RimEclipseCaseCollection.h"
|
||||
#include "RiaApplication.h"
|
||||
#include "RiuMultiCaseImportDialog.h"
|
||||
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicCreateGridCaseGroupFeature, "RicCreateGridCaseGroupFeature");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicCreateGridCaseGroupFeature::isCommandEnabled()
|
||||
{
|
||||
std::vector<RimEclipseCaseCollection*> selection;
|
||||
caf::SelectionManager::instance()->objectsByType(&selection);
|
||||
|
||||
return selection.size() > 0;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicCreateGridCaseGroupFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
RiuMultiCaseImportDialog dialog;
|
||||
int action = dialog.exec();
|
||||
if (action == QDialog::Accepted)
|
||||
{
|
||||
QStringList gridFileNames = dialog.eclipseCaseFileNames();
|
||||
app->addEclipseCases(gridFileNames);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicCreateGridCaseGroupFeature::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
actionToSetup->setIcon(QIcon(":/CreateGridCaseGroup16x16.png"));
|
||||
actionToSetup->setText("Import Eclipse Case");
|
||||
}
|
40
ApplicationCode/Commands/RicCreateGridCaseGroupFeature.h
Normal file
40
ApplicationCode/Commands/RicCreateGridCaseGroupFeature.h
Normal file
@ -0,0 +1,40 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "cafCmdFeature.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicCreateGridCaseGroupFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
protected:
|
||||
// Overrides
|
||||
virtual bool isCommandEnabled();
|
||||
virtual void onActionTriggered( bool isChecked );
|
||||
virtual void setupActionLook( QAction* actionToSetup );
|
||||
};
|
||||
|
||||
|
@ -562,6 +562,7 @@ void RimProject::actionsBasedOnSelection(QMenu& contextMenu)
|
||||
{
|
||||
commandIds << "RicImportEclipseCaseFeature";
|
||||
commandIds << "RicImportInputEclipseCaseFeature";
|
||||
commandIds << "RicCreateGridCaseGroupFeature";
|
||||
}
|
||||
else if (dynamic_cast<RimGeoMechView*>(uiItem))
|
||||
{
|
||||
|
@ -1756,14 +1756,10 @@ void RiuMainWindow::hideAllDockWindows()
|
||||
void RiuMainWindow::slotOpenMultipleCases()
|
||||
{
|
||||
#if 1
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
RiuMultiCaseImportDialog dialog;
|
||||
int action = dialog.exec();
|
||||
if (action == QDialog::Accepted)
|
||||
{
|
||||
QStringList gridFileNames = dialog.eclipseCaseFileNames();
|
||||
app->addEclipseCases(gridFileNames);
|
||||
}
|
||||
QAction* action = caf::CmdFeatureManager::instance()->action("RicCreateGridCaseGroupFeature");
|
||||
CVF_ASSERT(action);
|
||||
|
||||
action->trigger();
|
||||
|
||||
#else // Code to fast generate a test project
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
|
Loading…
Reference in New Issue
Block a user