From 254d944b84fab0b49a888459171b3f85c890034b Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 3 Apr 2017 20:48:45 +0200 Subject: [PATCH] #1371 opm-parser : Removed command features --- .../EclipseCommands/CMakeLists_files.cmake | 4 - .../RicAddEclipseInputPropertyFeature.cpp | 13 -- .../RicAddOpmInputPropertyFeature.cpp | 115 ------------------ .../RicAddOpmInputPropertyFeature.h | 45 ------- .../RicImportInputEclipseCaseOpmFeature.cpp | 100 --------------- .../RicImportInputEclipseCaseOpmFeature.h | 39 ------ 6 files changed, 316 deletions(-) delete mode 100644 ApplicationCode/Commands/EclipseCommands/RicAddOpmInputPropertyFeature.cpp delete mode 100644 ApplicationCode/Commands/EclipseCommands/RicAddOpmInputPropertyFeature.h delete mode 100644 ApplicationCode/Commands/EclipseCommands/RicImportInputEclipseCaseOpmFeature.cpp delete mode 100644 ApplicationCode/Commands/EclipseCommands/RicImportInputEclipseCaseOpmFeature.h diff --git a/ApplicationCode/Commands/EclipseCommands/CMakeLists_files.cmake b/ApplicationCode/Commands/EclipseCommands/CMakeLists_files.cmake index fabf93ac48..920f7417c1 100644 --- a/ApplicationCode/Commands/EclipseCommands/CMakeLists_files.cmake +++ b/ApplicationCode/Commands/EclipseCommands/CMakeLists_files.cmake @@ -6,7 +6,6 @@ endif() set (SOURCE_GROUP_HEADER_FILES ${CEE_CURRENT_LIST_DIR}RicAddEclipseInputPropertyFeature.h -${CEE_CURRENT_LIST_DIR}RicAddOpmInputPropertyFeature.h ${CEE_CURRENT_LIST_DIR}RicComputeStatisticsFeature.h ${CEE_CURRENT_LIST_DIR}RicCreateGridCaseGroupFeature.h ${CEE_CURRENT_LIST_DIR}RicEclipseCaseNewGroupExec.h @@ -18,7 +17,6 @@ ${CEE_CURRENT_LIST_DIR}RicEclipsePropertyFilterNewExec.h ${CEE_CURRENT_LIST_DIR}RicEclipsePropertyFilterNewFeature.h ${CEE_CURRENT_LIST_DIR}RicImportEclipseCaseFeature.h ${CEE_CURRENT_LIST_DIR}RicImportInputEclipseCaseFeature.h -${CEE_CURRENT_LIST_DIR}RicImportInputEclipseCaseOpmFeature.h ${CEE_CURRENT_LIST_DIR}RicNewStatisticsCaseFeature.h ${CEE_CURRENT_LIST_DIR}RicSaveEclipseInputPropertyFeature.h ${CEE_CURRENT_LIST_DIR}RicSaveEclipseResultAsInputPropertyExec.h @@ -28,7 +26,6 @@ ${CEE_CURRENT_LIST_DIR}RicApplyPropertyFilterAsCellResultFeature.h set (SOURCE_GROUP_SOURCE_FILES ${CEE_CURRENT_LIST_DIR}RicAddEclipseInputPropertyFeature.cpp -${CEE_CURRENT_LIST_DIR}RicAddOpmInputPropertyFeature.cpp ${CEE_CURRENT_LIST_DIR}RicComputeStatisticsFeature.cpp ${CEE_CURRENT_LIST_DIR}RicCreateGridCaseGroupFeature.cpp ${CEE_CURRENT_LIST_DIR}RicEclipseCaseNewGroupExec.cpp @@ -40,7 +37,6 @@ ${CEE_CURRENT_LIST_DIR}RicEclipsePropertyFilterNewExec.cpp ${CEE_CURRENT_LIST_DIR}RicEclipsePropertyFilterNewFeature.cpp ${CEE_CURRENT_LIST_DIR}RicImportEclipseCaseFeature.cpp ${CEE_CURRENT_LIST_DIR}RicImportInputEclipseCaseFeature.cpp -${CEE_CURRENT_LIST_DIR}RicImportInputEclipseCaseOpmFeature.cpp ${CEE_CURRENT_LIST_DIR}RicNewStatisticsCaseFeature.cpp ${CEE_CURRENT_LIST_DIR}RicSaveEclipseInputPropertyFeature.cpp ${CEE_CURRENT_LIST_DIR}RicSaveEclipseResultAsInputPropertyExec.cpp diff --git a/ApplicationCode/Commands/EclipseCommands/RicAddEclipseInputPropertyFeature.cpp b/ApplicationCode/Commands/EclipseCommands/RicAddEclipseInputPropertyFeature.cpp index dd87823d9f..de61fc1a35 100644 --- a/ApplicationCode/Commands/EclipseCommands/RicAddEclipseInputPropertyFeature.cpp +++ b/ApplicationCode/Commands/EclipseCommands/RicAddEclipseInputPropertyFeature.cpp @@ -21,7 +21,6 @@ #include "RimEclipseInputPropertyCollection.h" #include "RimEclipseInputCase.h" -#include "RimEclipseInputCaseOpm.h" #include "RiaApplication.h" #include "RiuMainWindow.h" @@ -40,18 +39,6 @@ CAF_CMD_SOURCE_INIT(RicAddEclipseInputPropertyFeature, "RicAddEclipseInputProper //-------------------------------------------------------------------------------------------------- bool RicAddEclipseInputPropertyFeature::isCommandEnabled() { - RimEclipseInputPropertyCollection* inputProp = selectedInputPropertyCollection(); - if (inputProp) - { - RimEclipseInputCaseOpm* inputCaseOpm = NULL; - - inputProp->firstAncestorOrThisOfType(inputCaseOpm); - if (inputCaseOpm) - { - return false; - } - } - return selectedInputPropertyCollection() != NULL; } diff --git a/ApplicationCode/Commands/EclipseCommands/RicAddOpmInputPropertyFeature.cpp b/ApplicationCode/Commands/EclipseCommands/RicAddOpmInputPropertyFeature.cpp deleted file mode 100644 index 2d2cd2a4da..0000000000 --- a/ApplicationCode/Commands/EclipseCommands/RicAddOpmInputPropertyFeature.cpp +++ /dev/null @@ -1,115 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////// -// -// Copyright (C) 2016- Statoil ASA -// -// 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 -// for more details. -// -///////////////////////////////////////////////////////////////////////////////// - -#include "RicAddOpmInputPropertyFeature.h" - -#include "RiaApplication.h" -#include "RimEclipseInputCaseOpm.h" -#include "RimEclipseInputPropertyCollection.h" -#include "RiuMainWindow.h" - -#include "cafSelectionManager.h" - -#include -#include -#include -#include - -CAF_CMD_SOURCE_INIT(RicAddOpmInputPropertyFeature, "RicAddOpmInputPropertyFeature"); - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -bool RicAddOpmInputPropertyFeature::isCommandEnabled() -{ - RimEclipseInputPropertyCollection* inputProp = selectedInputPropertyCollection(); - if (inputProp) - { - RimEclipseInputCaseOpm* inputCaseOpm = NULL; - - inputProp->firstAncestorOrThisOfType(inputCaseOpm); - if (inputCaseOpm) - { - return true; - } - } - - return false; -} - - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RicAddOpmInputPropertyFeature::onActionTriggered(bool isChecked) -{ - RiaApplication* app = RiaApplication::instance(); - QString defaultDir = app->lastUsedDialogDirectory("INPUT_FILES"); - QStringList fileNames = QFileDialog::getOpenFileNames(NULL, "Select Eclipse Input Property Files", defaultDir, "All Files (*.* *)"); - - if (fileNames.isEmpty()) return; - - // Remember the directory to next time - defaultDir = QFileInfo(fileNames.last()).absolutePath(); - app->setLastUsedDialogDirectory("INPUT_FILES", defaultDir); - - RimEclipseInputPropertyCollection* inputPropertyCollection = selectedInputPropertyCollection(); - if (inputPropertyCollection) - { - addEclipseInputProperty(fileNames, inputPropertyCollection); - } -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RicAddOpmInputPropertyFeature::setupActionLook(QAction* actionToSetup) -{ - actionToSetup->setText("Add Input Property"); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -RimEclipseInputPropertyCollection* RicAddOpmInputPropertyFeature::selectedInputPropertyCollection() const -{ - std::vector selection; - caf::SelectionManager::instance()->objectsByType(&selection); - - return selection.size() > 0 ? selection[0] : NULL; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RicAddOpmInputPropertyFeature::addEclipseInputProperty(const QStringList& fileNames, RimEclipseInputPropertyCollection* inputPropertyCollection) -{ - CVF_ASSERT(inputPropertyCollection); - - RimEclipseInputCaseOpm* inputCaseOpm = NULL; - - inputPropertyCollection->firstAncestorOrThisOfType(inputCaseOpm); - if (inputCaseOpm) - { - inputCaseOpm->appendPropertiesFromStandaloneFiles(fileNames); - } - - inputPropertyCollection->updateConnectedEditors(); -} - - diff --git a/ApplicationCode/Commands/EclipseCommands/RicAddOpmInputPropertyFeature.h b/ApplicationCode/Commands/EclipseCommands/RicAddOpmInputPropertyFeature.h deleted file mode 100644 index e5ca7facf8..0000000000 --- a/ApplicationCode/Commands/EclipseCommands/RicAddOpmInputPropertyFeature.h +++ /dev/null @@ -1,45 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////// -// -// 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 -// for more details. -// -///////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "cafCmdFeature.h" - -class RimEclipseInputPropertyCollection; -class QStringList; - -//================================================================================================== -/// -//================================================================================================== -class RicAddOpmInputPropertyFeature : public caf::CmdFeature -{ - CAF_CMD_HEADER_INIT; - -protected: - // Overrides - virtual bool isCommandEnabled(); - virtual void onActionTriggered( bool isChecked ); - virtual void setupActionLook( QAction* actionToSetup ); - -private: - RimEclipseInputPropertyCollection* selectedInputPropertyCollection() const; - static void addEclipseInputProperty(const QStringList& fileNames, RimEclipseInputPropertyCollection* inputPropertyCollection); -}; - - diff --git a/ApplicationCode/Commands/EclipseCommands/RicImportInputEclipseCaseOpmFeature.cpp b/ApplicationCode/Commands/EclipseCommands/RicImportInputEclipseCaseOpmFeature.cpp deleted file mode 100644 index 22406bab93..0000000000 --- a/ApplicationCode/Commands/EclipseCommands/RicImportInputEclipseCaseOpmFeature.cpp +++ /dev/null @@ -1,100 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////// -// -// Copyright (C) 2016 Statoil ASA -// -// 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 -// for more details. -// -///////////////////////////////////////////////////////////////////////////////// - -#include "RicImportInputEclipseCaseOpmFeature.h" - -#include "RiaApplication.h" - -#include "RimDefines.h" -#include "RimEclipseCaseCollection.h" -#include "RimEclipseCellColors.h" -#include "RimEclipseInputCaseOpm.h" -#include "RimEclipseView.h" -#include "RimOilField.h" -#include "RimProject.h" - -#include "RiuMainWindow.h" - -#include "cafSelectionManager.h" - -#include -#include - -CAF_CMD_SOURCE_INIT(RicImportInputEclipseCaseOpmFeature, "RicImportInputEclipseCaseOpmFeature"); - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -bool RicImportInputEclipseCaseOpmFeature::isCommandEnabled() -{ - return true; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RicImportInputEclipseCaseOpmFeature::onActionTriggered(bool isChecked) -{ - RiaApplication* app = RiaApplication::instance(); - QString defaultDir = app->lastUsedDialogDirectory("INPUT_FILES"); - QString fileName = QFileDialog::getOpenFileName(RiuMainWindow::instance(), "Import Eclipse Input file", defaultDir, "Eclipse Input Files (*.GRDECL);;All Files (*.*)"); - - if (fileName.isEmpty()) return; - - // Remember the path to next time - app->setLastUsedDialogDirectory("INPUT_FILES", QFileInfo(fileName).absolutePath()); - - RimProject* proj = app->project(); - RimEclipseCaseCollection* analysisModels = proj->activeOilField() ? proj->activeOilField()->analysisModels() : NULL; - if (analysisModels) - { - // This code originates from RiaApplication::openInputEclipseCaseFromFileNames - - RimEclipseInputCaseOpm* rimInputReservoir = new RimEclipseInputCaseOpm(); - proj->assignCaseIdToCase(rimInputReservoir); - - rimInputReservoir->importNewEclipseGridAndProperties(fileName); - - analysisModels->cases.push_back(rimInputReservoir); - - RimEclipseView* riv = rimInputReservoir->createAndAddReservoirView(); - - riv->cellResult()->setResultType(RimDefines::INPUT_PROPERTY); - riv->hasUserRequestedAnimation = true; - - riv->loadDataAndUpdate(); - - if (!riv->cellResult()->hasResult()) - { - riv->cellResult()->setResultVariable(RimDefines::undefinedResultName()); - } - - analysisModels->updateConnectedEditors(); - - RiuMainWindow::instance()->selectAsCurrentItem(riv->cellResult()); - } -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RicImportInputEclipseCaseOpmFeature::setupActionLook(QAction* actionToSetup) -{ - actionToSetup->setIcon(QIcon(":/EclipseInput48x48.png")); - actionToSetup->setText("Import Input Eclipse Case (opm-parser) - BETA"); -} diff --git a/ApplicationCode/Commands/EclipseCommands/RicImportInputEclipseCaseOpmFeature.h b/ApplicationCode/Commands/EclipseCommands/RicImportInputEclipseCaseOpmFeature.h deleted file mode 100644 index 6df4d3fd15..0000000000 --- a/ApplicationCode/Commands/EclipseCommands/RicImportInputEclipseCaseOpmFeature.h +++ /dev/null @@ -1,39 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////// -// -// Copyright (C) 2016 Statoil ASA -// -// 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 -// for more details. -// -///////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "cafCmdFeature.h" - -#include - -//================================================================================================== -/// -//================================================================================================== -class RicImportInputEclipseCaseOpmFeature : public caf::CmdFeature -{ - CAF_CMD_HEADER_INIT; - -protected: - // Overrides - virtual bool isCommandEnabled(); - virtual void onActionTriggered( bool isChecked ); - virtual void setupActionLook( QAction* actionToSetup ); -}; - -