From 1ed9787a379e9c42d49773cfeb11f6718b12eca6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rnar=20Grip=20Fj=C3=A6r?= Date: Thu, 27 Jul 2017 09:52:38 +0200 Subject: [PATCH] #1665 Add loadCase command to command file interface --- .../CMakeLists_files.cmake | 2 + .../CommandFileInterface/RicfLoadCase.cpp | 39 +++++++++++++++++++ .../CommandFileInterface/RicfLoadCase.h | 35 +++++++++++++++++ 3 files changed, 76 insertions(+) create mode 100644 ApplicationCode/CommandFileInterface/RicfLoadCase.cpp create mode 100644 ApplicationCode/CommandFileInterface/RicfLoadCase.h diff --git a/ApplicationCode/CommandFileInterface/CMakeLists_files.cmake b/ApplicationCode/CommandFileInterface/CMakeLists_files.cmake index 8e0d22a449..e98837d358 100644 --- a/ApplicationCode/CommandFileInterface/CMakeLists_files.cmake +++ b/ApplicationCode/CommandFileInterface/CMakeLists_files.cmake @@ -2,6 +2,7 @@ set (SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RicfCloseProject.h ${CMAKE_CURRENT_LIST_DIR}/RicfCommandFileExecutor.h +${CMAKE_CURRENT_LIST_DIR}/RicfLoadCase.h ${CMAKE_CURRENT_LIST_DIR}/RicfOpenProject.h ${CMAKE_CURRENT_LIST_DIR}/RicfSetStartDir.h ) @@ -9,6 +10,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RicfSetStartDir.h set (SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RicfCloseProject.cpp ${CMAKE_CURRENT_LIST_DIR}/RicfCommandFileExecutor.cpp +${CMAKE_CURRENT_LIST_DIR}/RicfLoadCase.cpp ${CMAKE_CURRENT_LIST_DIR}/RicfOpenProject.cpp ${CMAKE_CURRENT_LIST_DIR}/RicfSetStartDir.cpp ) diff --git a/ApplicationCode/CommandFileInterface/RicfLoadCase.cpp b/ApplicationCode/CommandFileInterface/RicfLoadCase.cpp new file mode 100644 index 0000000000..c3d77b3a59 --- /dev/null +++ b/ApplicationCode/CommandFileInterface/RicfLoadCase.cpp @@ -0,0 +1,39 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2017 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 "RicfLoadCase.h" + +#include "RiaApplication.h" + +CAF_PDM_SOURCE_INIT(RicfLoadCase, "loadCase"); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RicfLoadCase::RicfLoadCase() +{ + RICF_InitField(&m_path, "path", QString(), "Path to Case File", "", "", ""); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicfLoadCase::execute() +{ + RiaApplication::instance()->openEclipseCaseFromFile(m_path); +} diff --git a/ApplicationCode/CommandFileInterface/RicfLoadCase.h b/ApplicationCode/CommandFileInterface/RicfLoadCase.h new file mode 100644 index 0000000000..7421179513 --- /dev/null +++ b/ApplicationCode/CommandFileInterface/RicfLoadCase.h @@ -0,0 +1,35 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2017 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 "RicfCommandObject.h" + +#include "cafPdmField.h" + +class RicfLoadCase : public RicfCommandObject +{ + CAF_PDM_HEADER_INIT; + +public: + RicfLoadCase(); + + virtual void execute() override; + +private: + caf::PdmField m_path; +};