mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-10 07:26:03 -06:00
(#339) Added RicImportEclipseCaseFeature
This commit is contained in:
parent
cd1e04d6e8
commit
6e48e036c1
@ -42,6 +42,7 @@ ${CEE_CURRENT_LIST_DIR}RicRangeFilterNewSliceKFeature.h
|
||||
${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}RicWellPathsImportSsihubFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicWellPathsImportFileFeature.h
|
||||
@ -90,6 +91,7 @@ ${CEE_CURRENT_LIST_DIR}RicRangeFilterNewSliceKFeature.cpp
|
||||
${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}RicWellPathsImportSsihubFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicWellPathsImportFileFeature.cpp
|
||||
|
@ -0,0 +1,69 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RicImportInputEclipseCaseFeature.h"
|
||||
|
||||
#include "RimEclipseCaseCollection.h"
|
||||
#include "RiaApplication.h"
|
||||
#include "RiuMainWindow.h"
|
||||
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <QFileDialog>
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicImportInputEclipseCaseFeature, "RicImportInputEclipseCaseFeature");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicImportInputEclipseCaseFeature::isCommandEnabled()
|
||||
{
|
||||
std::vector<RimEclipseCaseCollection*> selection;
|
||||
caf::SelectionManager::instance()->objectsByType(&selection);
|
||||
|
||||
return selection.size() > 0;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicImportInputEclipseCaseFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
QString defaultDir = app->defaultFileDialogDirectory("INPUT_FILES");
|
||||
QStringList fileNames = QFileDialog::getOpenFileNames(RiuMainWindow::instance(), "Import Eclipse Input Files", defaultDir, "Eclipse Input Files and Input Properties (*.GRDECL *)");
|
||||
|
||||
if (fileNames.isEmpty()) return;
|
||||
|
||||
// Remember the path to next time
|
||||
app->setDefaultFileDialogDirectory("INPUT_FILES", QFileInfo(fileNames.last()).absolutePath());
|
||||
|
||||
app->openInputEclipseCaseFromFileNames(fileNames);
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicImportInputEclipseCaseFeature::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
actionToSetup->setIcon(QIcon(":/EclipseInput48x48.png"));
|
||||
actionToSetup->setText("Import Input Eclipse Case");
|
||||
}
|
40
ApplicationCode/Commands/RicImportInputEclipseCaseFeature.h
Normal file
40
ApplicationCode/Commands/RicImportInputEclipseCaseFeature.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 RicImportInputEclipseCaseFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
protected:
|
||||
// Overrides
|
||||
virtual bool isCommandEnabled();
|
||||
virtual void onActionTriggered( bool isChecked );
|
||||
virtual void setupActionLook( QAction* actionToSetup );
|
||||
};
|
||||
|
||||
|
@ -561,6 +561,7 @@ void RimProject::actionsBasedOnSelection(QMenu& contextMenu)
|
||||
if (dynamic_cast<RimEclipseCaseCollection*>(uiItem))
|
||||
{
|
||||
commandIds << "RicImportEclipseCaseFeature";
|
||||
commandIds << "RicImportInputEclipseCaseFeature";
|
||||
}
|
||||
else if (dynamic_cast<RimGeoMechView*>(uiItem))
|
||||
{
|
||||
|
@ -914,16 +914,10 @@ void RiuMainWindow::slotImportInputEclipseFiles()
|
||||
{
|
||||
if (checkForDocumentModifications())
|
||||
{
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
QString defaultDir = app->defaultFileDialogDirectory("INPUT_FILES");
|
||||
QStringList fileNames = QFileDialog::getOpenFileNames(this, "Import Eclipse Input Files", defaultDir, "Eclipse Input Files and Input Properties (*.GRDECL *)");
|
||||
QAction* action = caf::CmdFeatureManager::instance()->action("RicImportInputEclipseCaseFeature");
|
||||
CVF_ASSERT(action);
|
||||
|
||||
if (fileNames.isEmpty()) return;
|
||||
|
||||
// Remember the path to next time
|
||||
app->setDefaultFileDialogDirectory("INPUT_FILES", QFileInfo(fileNames.last()).absolutePath());
|
||||
|
||||
app->openInputEclipseCaseFromFileNames(fileNames);
|
||||
action->trigger();
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user