From b028c3611652c749b1fa846c25966eb5110dc284 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Jensen?= Date: Fri, 21 Sep 2018 13:44:27 +0200 Subject: [PATCH] #3260 Well Path Export. Export dev file, new commands --- ...ortCompletionsForVisibleWellPathsFeature.h | 4 +- .../ExportCommands/CMakeLists_files.cmake | 7 +- .../RicExportSelectedWellPathsFeature.cpp | 179 ++++++++++++++++++ .../RicExportSelectedWellPathsFeature.h | 52 +++++ .../RicExportVisibleWellPathsFeature.cpp | 122 ++++++++++++ .../RicExportVisibleWellPathsFeature.h | 47 +++++ .../ExportCommands/RicExportWellPathsUi.cpp | 107 +++++++++++ .../ExportCommands/RicExportWellPathsUi.h | 52 +++++ .../RimContextCommandBuilder.cpp | 33 +++- .../ProjectDataModel/RimDialogData.cpp | 12 ++ .../ProjectDataModel/RimDialogData.h | 3 + 11 files changed, 614 insertions(+), 4 deletions(-) create mode 100644 ApplicationCode/Commands/ExportCommands/RicExportSelectedWellPathsFeature.cpp create mode 100644 ApplicationCode/Commands/ExportCommands/RicExportSelectedWellPathsFeature.h create mode 100644 ApplicationCode/Commands/ExportCommands/RicExportVisibleWellPathsFeature.cpp create mode 100644 ApplicationCode/Commands/ExportCommands/RicExportVisibleWellPathsFeature.h create mode 100644 ApplicationCode/Commands/ExportCommands/RicExportWellPathsUi.cpp create mode 100644 ApplicationCode/Commands/ExportCommands/RicExportWellPathsUi.h diff --git a/ApplicationCode/Commands/CompletionExportCommands/RicExportCompletionsForVisibleWellPathsFeature.h b/ApplicationCode/Commands/CompletionExportCommands/RicExportCompletionsForVisibleWellPathsFeature.h index c80ba540ca..00a7954cb6 100644 --- a/ApplicationCode/Commands/CompletionExportCommands/RicExportCompletionsForVisibleWellPathsFeature.h +++ b/ApplicationCode/Commands/CompletionExportCommands/RicExportCompletionsForVisibleWellPathsFeature.h @@ -35,6 +35,6 @@ protected: virtual void onActionTriggered(bool isChecked) override; virtual void setupActionLook(QAction* actionToSetup) override; -private: - std::vector visibleWellPaths(); +public: + static std::vector visibleWellPaths(); }; diff --git a/ApplicationCode/Commands/ExportCommands/CMakeLists_files.cmake b/ApplicationCode/Commands/ExportCommands/CMakeLists_files.cmake index 5fdd3d1c04..b6b2959113 100644 --- a/ApplicationCode/Commands/ExportCommands/CMakeLists_files.cmake +++ b/ApplicationCode/Commands/ExportCommands/CMakeLists_files.cmake @@ -1,4 +1,3 @@ - set (SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RicCellRangeUi.h ${CMAKE_CURRENT_LIST_DIR}/RicExportCarfin.h @@ -17,6 +16,9 @@ ${CMAKE_CURRENT_LIST_DIR}/RicSnapshotAllViewsToFileFeature.h ${CMAKE_CURRENT_LIST_DIR}/RicSnapshotFilenameGenerator.h ${CMAKE_CURRENT_LIST_DIR}/RicSnapshotViewToClipboardFeature.h ${CMAKE_CURRENT_LIST_DIR}/RicSnapshotViewToFileFeature.h +${CMAKE_CURRENT_LIST_DIR}/RicExportSelectedWellPathsFeature.h +${CMAKE_CURRENT_LIST_DIR}/RicExportVisibleWellPathsFeature.h +${CMAKE_CURRENT_LIST_DIR}/RicExportWellPathsUi.h ) set (SOURCE_GROUP_SOURCE_FILES @@ -37,6 +39,9 @@ ${CMAKE_CURRENT_LIST_DIR}/RicSnapshotAllViewsToFileFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicSnapshotFilenameGenerator.cpp ${CMAKE_CURRENT_LIST_DIR}/RicSnapshotViewToClipboardFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicSnapshotViewToFileFeature.cpp +${CMAKE_CURRENT_LIST_DIR}/RicExportSelectedWellPathsFeature.cpp +${CMAKE_CURRENT_LIST_DIR}/RicExportVisibleWellPathsFeature.cpp +${CMAKE_CURRENT_LIST_DIR}/RicExportWellPathsUi.cpp ) list(APPEND CODE_HEADER_FILES diff --git a/ApplicationCode/Commands/ExportCommands/RicExportSelectedWellPathsFeature.cpp b/ApplicationCode/Commands/ExportCommands/RicExportSelectedWellPathsFeature.cpp new file mode 100644 index 0000000000..f25aa9e99c --- /dev/null +++ b/ApplicationCode/Commands/ExportCommands/RicExportSelectedWellPathsFeature.cpp @@ -0,0 +1,179 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// 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 "RicExportSelectedWellPathsFeature.h" + +#include "RiaApplication.h" +#include "RiaLogging.h" + +#include "RicExportWellPathsUi.h" + +#include "RigWellPath.h" + +#include "RimWellPath.h" +#include "RimProject.h" +#include "RimSummaryCaseMainCollection.h" +#include "RimDialogData.h" + +#include "RiuPlotMainWindowTools.h" + +#include "cafSelectionManagerTools.h" +#include "cafPdmUiPropertyViewDialog.h" + +#include +#include +#include +#include + +#include + + +CAF_CMD_SOURCE_INIT(RicExportSelectedWellPathsFeature, "RicExportSelectedWellPathsFeature"); + + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicExportSelectedWellPathsFeature::exportWellPath(const RimWellPath* wellPath, double mdStepSize, const QString& folder) +{ + auto geom = wellPath->wellPathGeometry(); + double currMd = geom->measureDepths().front() - mdStepSize; + double endMd = geom->measureDepths().back(); + + auto fileName = wellPath->name() + ".dev"; + auto filePtr = openFileForExport(folder, fileName); + QTextStream stream(filePtr.get()); + stream.setRealNumberNotation(QTextStream::FixedNotation); + + stream << "WELLNAME: '" << wellPath->name() << "'" << endl; + + while (currMd < endMd) + { + currMd += mdStepSize; + if (currMd > endMd) currMd = endMd; + + auto pt = geom->interpolatedPointAlongWellPath(currMd); + double tvd = -pt.z(); + + // Write to file + stream << pt.x() << " " << pt.y() << " " << tvd << " " << currMd << endl; + } + + filePtr->close(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QFilePtr RicExportSelectedWellPathsFeature::openFileForExport(const QString& folderName, const QString& fileName) +{ + QDir exportFolder = QDir(folderName); + QString filePath = exportFolder.filePath(fileName); + QFilePtr exportFile(new QFile(filePath)); + if (!exportFile->open(QIODevice::WriteOnly)) + { + auto errorMessage = QString("Export Well Path: Could not open the file: %1").arg(filePath); + RiaLogging::error(errorMessage); + } + return exportFile; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicExportSelectedWellPathsFeature::handleAction(const std::vector& wellPaths) +{ + if (!wellPaths.empty()) + { + auto dialogData = openDialog(); + if (dialogData) + { + auto folder = dialogData->exportFolder(); + auto mdStepSize = dialogData->mdStepSize(); + if (folder.isEmpty()) + { + return; + } + + for (auto wellPath : wellPaths) + { + exportWellPath(wellPath, mdStepSize, folder); + } + + } + + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RicExportSelectedWellPathsFeature::isCommandEnabled() +{ + std::vector wellPaths = caf::selectedObjectsByTypeStrict(); + + return !wellPaths.empty(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicExportSelectedWellPathsFeature::onActionTriggered(bool isChecked) +{ + std::vector wellPaths = caf::selectedObjectsByTypeStrict(); + + handleAction(wellPaths); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicExportSelectedWellPathsFeature::setupActionLook(QAction* actionToSetup) +{ + actionToSetup->setText("Export Selected Well Paths"); + actionToSetup->setIcon(QIcon(":/WellLogCurve16x16.png")); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RicExportWellPathsUi* RicExportSelectedWellPathsFeature::openDialog() +{ + RiaApplication* app = RiaApplication::instance(); + RimProject* proj = app->project(); + + QString startPath = app->lastUsedDialogDirectory("WELL_LOGS_DIR"); + if (startPath.isEmpty()) + { + QFileInfo fi(proj->fileName()); + startPath = fi.absolutePath(); + } + + RicExportWellPathsUi* featureUi = app->project()->dialogData()->wellPathsExportData(); + + caf::PdmUiPropertyViewDialog propertyDialog(nullptr, featureUi, "Export Well Paths", "", QDialogButtonBox::Ok | QDialogButtonBox::Cancel); + propertyDialog.resize(QSize(600, 60)); + + if (propertyDialog.exec() == QDialog::Accepted && !featureUi->exportFolder().isEmpty()) + { + auto dialogData = app->project()->dialogData()->wellPathsExportData(); + app->setLastUsedDialogDirectory("WELL_LOGS_DIR", dialogData->exportFolder()); + return dialogData; + } + return nullptr; +} diff --git a/ApplicationCode/Commands/ExportCommands/RicExportSelectedWellPathsFeature.h b/ApplicationCode/Commands/ExportCommands/RicExportSelectedWellPathsFeature.h new file mode 100644 index 0000000000..c56a75562d --- /dev/null +++ b/ApplicationCode/Commands/ExportCommands/RicExportSelectedWellPathsFeature.h @@ -0,0 +1,52 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// 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 + +#include "cafCmdFeature.h" + +class RimWellPath; +class RicExportWellPathsUi; + +//================================================================================================== +/// +//================================================================================================== +typedef std::shared_ptr QFilePtr; + +//================================================================================================== +/// +//================================================================================================== +class RicExportSelectedWellPathsFeature : public caf::CmdFeature +{ + CAF_CMD_HEADER_INIT; + + static void exportWellPath(const RimWellPath* wellPath, double mdStepSize, const QString& folder); + static QFilePtr openFileForExport(const QString& folderName, const QString& fileName); + static void handleAction(const std::vector& wellPaths); + +protected: + // Overrides + virtual bool isCommandEnabled(); + virtual void onActionTriggered( bool isChecked ); + virtual void setupActionLook(QAction* actionToSetup); + +private: + static RicExportWellPathsUi* openDialog(); +}; diff --git a/ApplicationCode/Commands/ExportCommands/RicExportVisibleWellPathsFeature.cpp b/ApplicationCode/Commands/ExportCommands/RicExportVisibleWellPathsFeature.cpp new file mode 100644 index 0000000000..7d26aaef6b --- /dev/null +++ b/ApplicationCode/Commands/ExportCommands/RicExportVisibleWellPathsFeature.cpp @@ -0,0 +1,122 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// 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 "RicExportVisibleWellPathsFeature.h" + +#include "RiaApplication.h" +#include "RiaLogging.h" + +#include "RicExportSelectedWellPathsFeature.h" +#include "CompletionExportCommands/RicExportCompletionsForVisibleWellPathsFeature.h" + +#include "RigWellPath.h" + +#include "RimWellPath.h" +#include "RimProject.h" +#include "RimSummaryCaseMainCollection.h" + +#include "RiuPlotMainWindowTools.h" + +#include "cafSelectionManagerTools.h" + +#include +#include +#include +#include + +#include + + +CAF_CMD_SOURCE_INIT(RicExportVisibleWellPathsFeature, "RicExportVisibleWellPathsFeature"); + + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicExportVisibleWellPathsFeature::exportWellPath(const RimWellPath* wellPath, double mdStepSize, const QString& folder) +{ + auto geom = wellPath->wellPathGeometry(); + double currMd = geom->measureDepths().front() - mdStepSize; + double endMd = geom->measureDepths().back(); + + auto fileName = wellPath->name() + ".dev"; + auto filePtr = openFileForExport(folder, fileName); + QTextStream stream(filePtr.get()); + stream.setRealNumberNotation(QTextStream::FixedNotation); + + stream << "WELLNAME: " << wellPath->name() << endl; + + while (currMd < endMd) + { + currMd += mdStepSize; + if (currMd > endMd) currMd = endMd; + + auto pt = geom->interpolatedPointAlongWellPath(currMd); + double tvd = -pt.z(); + + // Write to file + stream << pt.x() << " " << pt.y() << " " << tvd << " " << currMd << endl; + } + + filePtr->close(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QFilePtr RicExportVisibleWellPathsFeature::openFileForExport(const QString& folderName, const QString& fileName) +{ + QDir exportFolder = QDir(folderName); + QString filePath = exportFolder.filePath(fileName); + QFilePtr exportFile(new QFile(filePath)); + if (!exportFile->open(QIODevice::WriteOnly)) + { + auto errorMessage = QString("Export Well Path: Could not open the file: %1").arg(filePath); + RiaLogging::error(errorMessage); + } + return exportFile; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RicExportVisibleWellPathsFeature::isCommandEnabled() +{ + std::vector wellPaths = RicExportCompletionsForVisibleWellPathsFeature::visibleWellPaths(); + + return !wellPaths.empty(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicExportVisibleWellPathsFeature::onActionTriggered(bool isChecked) +{ + std::vector wellPaths = RicExportCompletionsForVisibleWellPathsFeature::visibleWellPaths(); + + RicExportSelectedWellPathsFeature::handleAction(wellPaths); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicExportVisibleWellPathsFeature::setupActionLook(QAction* actionToSetup) +{ + actionToSetup->setText("Export Visible Well Paths"); + actionToSetup->setIcon(QIcon(":/WellLogCurve16x16.png")); +} diff --git a/ApplicationCode/Commands/ExportCommands/RicExportVisibleWellPathsFeature.h b/ApplicationCode/Commands/ExportCommands/RicExportVisibleWellPathsFeature.h new file mode 100644 index 0000000000..9c7e58e41b --- /dev/null +++ b/ApplicationCode/Commands/ExportCommands/RicExportVisibleWellPathsFeature.h @@ -0,0 +1,47 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// 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 + +#include "cafCmdFeature.h" + +class RimWellPath; + +//================================================================================================== +/// +//================================================================================================== +typedef std::shared_ptr QFilePtr; + +//================================================================================================== +/// +//================================================================================================== +class RicExportVisibleWellPathsFeature : public caf::CmdFeature +{ + CAF_CMD_HEADER_INIT; + + void exportWellPath(const RimWellPath* wellPath, double mdStepSize, const QString& folder); + QFilePtr openFileForExport(const QString& folderName, const QString& fileName); + +protected: + // Overrides + virtual bool isCommandEnabled(); + virtual void onActionTriggered( bool isChecked ); + virtual void setupActionLook(QAction* actionToSetup); +}; diff --git a/ApplicationCode/Commands/ExportCommands/RicExportWellPathsUi.cpp b/ApplicationCode/Commands/ExportCommands/RicExportWellPathsUi.cpp new file mode 100644 index 0000000000..e6ea1c69aa --- /dev/null +++ b/ApplicationCode/Commands/ExportCommands/RicExportWellPathsUi.cpp @@ -0,0 +1,107 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2018 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 "RicExportWellPathsUi.h" + +#include "RiaApplication.h" +#include "RiaOptionItemFactory.h" + +#include "RimCase.h" +#include "RimGridView.h" +#include "RimProject.h" + +#include "cafPdmUiFilePathEditor.h" +#include "cafPdmUiOrdering.h" + +CAF_PDM_SOURCE_INIT(RicExportWellPathsUi, "RicExportWellPathsUi"); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RicExportWellPathsUi::RicExportWellPathsUi() +{ + CAF_PDM_InitObject("Resample LAS curves for export", "", "", ""); + + CAF_PDM_InitField(&m_exportFolder, "ExportFolder", QString(), "Export Folder", "", "", ""); + m_exportFolder.uiCapability()->setUiEditorTypeName(caf::PdmUiFilePathEditor::uiEditorTypeName()); + + CAF_PDM_InitField(&m_mdStepSize, "MdStepSize", 5.0, "MD Step Size", "", "", ""); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicExportWellPathsUi::setMdStepSize(double mdStepSize) +{ + m_mdStepSize = mdStepSize; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RicExportWellPathsUi::exportFolder() const +{ + return m_exportFolder; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +double RicExportWellPathsUi::mdStepSize() const +{ + return m_mdStepSize; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +//QList RicExportWellPathsUi::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, +// bool* useOptionsOnly) +//{ +// QList options; +// +// if (fieldNeedingOptions == &m_mdStepSize) +// { +// std::vector visibleViews; +// RiaApplication::instance()->project()->allVisibleGridViews(visibleViews); +// +// for (RimGridView* v : visibleViews) +// { +// RiaOptionItemFactory::appendOptionItemFromViewNameAndCaseName(v, &options); +// } +// } +// +// return options; +//} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicExportWellPathsUi::defineEditorAttribute(const caf::PdmFieldHandle* field, + QString uiConfigName, + caf::PdmUiEditorAttribute* attribute) +{ + if (field == &m_exportFolder) + { + caf::PdmUiFilePathEditorAttribute* myAttr = dynamic_cast(attribute); + if (myAttr) + { + myAttr->m_selectDirectory = true; + } + } +} diff --git a/ApplicationCode/Commands/ExportCommands/RicExportWellPathsUi.h b/ApplicationCode/Commands/ExportCommands/RicExportWellPathsUi.h new file mode 100644 index 0000000000..c1a9f0999d --- /dev/null +++ b/ApplicationCode/Commands/ExportCommands/RicExportWellPathsUi.h @@ -0,0 +1,52 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2018 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 "cafPdmField.h" +#include "cafPdmObject.h" +#include "cafPdmPtrField.h" + +class RimGridView; + +//================================================================================================== +/// +//================================================================================================== +class RicExportWellPathsUi : public caf::PdmObject +{ + CAF_PDM_HEADER_INIT; + +public: + RicExportWellPathsUi(); + + void setMdStepSize(double mdStepSize); + + QString exportFolder() const; + double mdStepSize() const; + +private: + //QList calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, + // bool* useOptionsOnly) override; + void defineEditorAttribute(const caf::PdmFieldHandle* field, + QString uiConfigName, + caf::PdmUiEditorAttribute* attribute) override; + +private: + caf::PdmField m_exportFolder; + caf::PdmField m_mdStepSize; +}; diff --git a/ApplicationCode/ProjectDataModel/RimContextCommandBuilder.cpp b/ApplicationCode/ProjectDataModel/RimContextCommandBuilder.cpp index 9699f64226..dd8a85db49 100644 --- a/ApplicationCode/ProjectDataModel/RimContextCommandBuilder.cpp +++ b/ApplicationCode/ProjectDataModel/RimContextCommandBuilder.cpp @@ -302,6 +302,11 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection() menuBuilder << "RicWellPathExportCompletionDataFeature"; menuBuilder.subMenuEnd(); + menuBuilder.subMenuStart("Export Well Paths"); + menuBuilder << "RicExportSelectedWellPathsFeature"; + menuBuilder << "RicExportVisibleWellPathsFeature"; + menuBuilder.subMenuEnd(); + menuBuilder << "RicCreateMultipleFracturesFeature"; menuBuilder << "Separator"; @@ -728,7 +733,33 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection() { menuBuilder << text; } - + + menuBuilder.subMenuEnd(); + } + } + + { + QStringList candidates; + + if (!menuBuilder.isCmdFeatureAdded("RicExportSelectedWellPathsFeature")) + { + candidates << "RicExportSelectedWellPathsFeature"; + + } + if (!menuBuilder.isCmdFeatureAdded("RicExportVisibleWellPathsFeature")) + { + candidates << "RicExportVisibleWellPathsFeature"; + } + + if (!candidates.isEmpty()) + { + menuBuilder.subMenuStart("Export Well Paths", QIcon(":/WellLogCurve16x16.png")); + + for (const auto& text : candidates) + { + menuBuilder << text; + } + menuBuilder.subMenuEnd(); } } diff --git a/ApplicationCode/ProjectDataModel/RimDialogData.cpp b/ApplicationCode/ProjectDataModel/RimDialogData.cpp index 77e46c4043..c8bb34c94d 100644 --- a/ApplicationCode/ProjectDataModel/RimDialogData.cpp +++ b/ApplicationCode/ProjectDataModel/RimDialogData.cpp @@ -22,6 +22,7 @@ #include "CompletionExportCommands/RicExportCompletionDataSettingsUi.h" #include "FractureCommands/RicCreateMultipleFracturesUi.h" #include "HoloLensCommands/RicHoloLensExportToFolderUi.h" +#include "ExportCommands/RicExportWellPathsUi.h" CAF_PDM_SOURCE_INIT(RimDialogData, "RimDialogData"); @@ -43,6 +44,9 @@ RimDialogData::RimDialogData() CAF_PDM_InitFieldNoDefault(&m_holoLenseExportToFolderData, "HoloLenseExportToFolderData", "Holo Lens Export To Folder Data", "", "", ""); m_holoLenseExportToFolderData = new RicHoloLensExportToFolderUi(); + + CAF_PDM_InitFieldNoDefault(&m_exportWellPathsData, "ExportwellPathsData", "Export Well Paths Data", "", "", ""); + m_exportWellPathsData = new RicExportWellPathsUi(); } //-------------------------------------------------------------------------------------------------- @@ -102,3 +106,11 @@ RicHoloLensExportToFolderUi* RimDialogData::holoLensExportToFolderData() const return m_holoLenseExportToFolderData; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RicExportWellPathsUi* RimDialogData::wellPathsExportData() const +{ + return m_exportWellPathsData; +} + diff --git a/ApplicationCode/ProjectDataModel/RimDialogData.h b/ApplicationCode/ProjectDataModel/RimDialogData.h index b86bcfde4c..55b8679824 100644 --- a/ApplicationCode/ProjectDataModel/RimDialogData.h +++ b/ApplicationCode/ProjectDataModel/RimDialogData.h @@ -25,6 +25,7 @@ class RicExportCarfinUi; class RicExportCompletionDataSettingsUi; class RiuCreateMultipleFractionsUi; class RicHoloLensExportToFolderUi; +class RicExportWellPathsUi; //================================================================================================== /// @@ -53,10 +54,12 @@ public: RiuCreateMultipleFractionsUi* multipleFractionsData() const; RicHoloLensExportToFolderUi* holoLensExportToFolderData() const; + RicExportWellPathsUi* wellPathsExportData() const; private: caf::PdmChildField m_exportCarfin; caf::PdmChildField m_exportCompletionData; caf::PdmChildField m_multipleFractionsData; caf::PdmChildField m_holoLenseExportToFolderData; + caf::PdmChildField m_exportWellPathsData; };