diff --git a/ApplicationCode/CommandFileInterface/CMakeLists_files.cmake b/ApplicationCode/CommandFileInterface/CMakeLists_files.cmake index 43832e2316..85637ddaac 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}/RicfExportMsw.h ${CMAKE_CURRENT_LIST_DIR}/RicfExportProperty.h ${CMAKE_CURRENT_LIST_DIR}/RicfExportSnapshots.h ${CMAKE_CURRENT_LIST_DIR}/RicfExportWellPathCompletions.h @@ -13,6 +14,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}/RicfExportMsw.cpp ${CMAKE_CURRENT_LIST_DIR}/RicfExportProperty.cpp ${CMAKE_CURRENT_LIST_DIR}/RicfExportSnapshots.cpp ${CMAKE_CURRENT_LIST_DIR}/RicfExportWellPathCompletions.cpp diff --git a/ApplicationCode/CommandFileInterface/RicfExportMsw.cpp b/ApplicationCode/CommandFileInterface/RicfExportMsw.cpp new file mode 100644 index 0000000000..d50774f003 --- /dev/null +++ b/ApplicationCode/CommandFileInterface/RicfExportMsw.cpp @@ -0,0 +1,80 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// 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 "RicfExportMsw.h" + +#include "RicfCommandFileExecutor.h" + +#include "RiaApplication.h" + +#include "RimProject.h" +#include "RimOilField.h" +#include "RimWellPathCollection.h" +#include "RimWellPath.h" +#include "RimEclipseCaseCollection.h" +#include "RimEclipseCase.h" +#include "RimFishbonesCollection.h" +#include "RimFishbonesMultipleSubs.h" + +#include "CompletionCommands/RicExportFishbonesWellSegmentsFeature.h" + +CAF_PDM_SOURCE_INIT(RicfExportMsw, "exportMsw"); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RicfExportMsw::RicfExportMsw() +{ + RICF_InitField(&m_caseId, "case", -1, "Case", "", "", ""); + RICF_InitField(&m_wellPathName, "wellPath", QString(), "Case", "", "", ""); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicfExportMsw::execute() +{ + RicCaseAndFileExportSettingsUi exportSettings; + + for (RimEclipseCase* c : RiaApplication::instance()->project()->activeOilField()->analysisModels->cases()) + { + if (c->caseId() == m_caseId()) + { + exportSettings.caseToApply = c; + break; + } + } + + QString exportFolder = RicfCommandFileExecutor::instance()->getExportPath(RicfCommandFileExecutor::COMPLETIONS); + if (exportFolder.isNull()) + { + exportFolder = RiaApplication::instance()->createAbsolutePathFromProjectRelativePath("completions"); + } + exportSettings.folder = exportFolder; + + RimWellPath* wellPath = RiaApplication::instance()->project()->activeOilField()->wellPathCollection->wellPathByName(m_wellPathName); + + std::vector fishbonesSubs; + + for (RimFishbonesMultipleSubs* fishbones : wellPath->fishbonesCollection()->fishbonesSubs()) + { + fishbonesSubs.push_back(fishbones); + } + + RicExportFishbonesWellSegmentsFeature::exportWellSegments(wellPath, fishbonesSubs, exportSettings); +} diff --git a/ApplicationCode/CommandFileInterface/RicfExportMsw.h b/ApplicationCode/CommandFileInterface/RicfExportMsw.h new file mode 100644 index 0000000000..5acf7e1026 --- /dev/null +++ b/ApplicationCode/CommandFileInterface/RicfExportMsw.h @@ -0,0 +1,36 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// 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 RicfExportMsw : public RicfCommandObject +{ + CAF_PDM_HEADER_INIT; + +public: + RicfExportMsw(); + + virtual void execute() override; + +private: + caf::PdmField m_caseId; + caf::PdmField m_wellPathName; +}; \ No newline at end of file diff --git a/ApplicationCode/Commands/CompletionCommands/RicExportFishbonesWellSegmentsFeature.h b/ApplicationCode/Commands/CompletionCommands/RicExportFishbonesWellSegmentsFeature.h index c54fc01eab..338ed30c3e 100644 --- a/ApplicationCode/Commands/CompletionCommands/RicExportFishbonesWellSegmentsFeature.h +++ b/ApplicationCode/Commands/CompletionCommands/RicExportFishbonesWellSegmentsFeature.h @@ -42,11 +42,13 @@ protected: virtual void setupActionLook(QAction* actionToSetup) override; virtual bool isCommandEnabled() override; +public: + static void exportWellSegments(const RimWellPath* wellPath, const std::vector& fishbonesSubs, const RicCaseAndFileExportSettingsUi& settings); + private: static RimFishbonesCollection* selectedFishbonesCollection(); static RimWellPath* selectedWellPath(); - static void exportWellSegments(const RimWellPath* wellPath, const std::vector& fishbonesSubs, const RicCaseAndFileExportSettingsUi& settings); static void generateWelsegsTable(RifEclipseDataTableFormatter& formatter, const RimWellPath* wellPath, const RicCaseAndFileExportSettingsUi& settings, const std::vector& locations); static void generateCompsegsTable(RifEclipseDataTableFormatter& formatter, const RimWellPath* wellPath, const RicCaseAndFileExportSettingsUi& settings, const std::vector& locations); static void generateWsegvalvTable(RifEclipseDataTableFormatter& formatter, const RimWellPath* wellPath, const RicCaseAndFileExportSettingsUi& settings, const std::vector& locations);