diff --git a/ApplicationCode/Commands/WellPathCommands/CMakeLists_files.cmake b/ApplicationCode/Commands/WellPathCommands/CMakeLists_files.cmake index 67a87c1d8c..ea6635f73c 100644 --- a/ApplicationCode/Commands/WellPathCommands/CMakeLists_files.cmake +++ b/ApplicationCode/Commands/WellPathCommands/CMakeLists_files.cmake @@ -3,6 +3,9 @@ set (SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RicWellPathDeleteFeature.h ${CMAKE_CURRENT_LIST_DIR}/RicWellPathsImportFileFeature.h ${CMAKE_CURRENT_LIST_DIR}/RicWellPathsImportSsihubFeature.h +${CMAKE_CURRENT_LIST_DIR}/RicNewEditableWellPathFeature.h +${CMAKE_CURRENT_LIST_DIR}/RicNewWellPathListTargetFeature.h +${CMAKE_CURRENT_LIST_DIR}/RicDeleteWellPathTargetFeature.h ${CMAKE_CURRENT_LIST_DIR}/RicWellPathsUnitSystemSettingsImpl.h ${CMAKE_CURRENT_LIST_DIR}/RicWellPathsUnitSystemSettingsUi.h ${CMAKE_CURRENT_LIST_DIR}/RicWellPathViewerEventHandler.h @@ -14,6 +17,9 @@ set (SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RicWellPathDeleteFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicWellPathsImportFileFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicWellPathsImportSsihubFeature.cpp +${CMAKE_CURRENT_LIST_DIR}/RicNewEditableWellPathFeature.cpp +${CMAKE_CURRENT_LIST_DIR}/RicNewWellPathListTargetFeature.cpp +${CMAKE_CURRENT_LIST_DIR}/RicDeleteWellPathTargetFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicWellPathsUnitSystemSettingsImpl.cpp ${CMAKE_CURRENT_LIST_DIR}/RicWellPathsUnitSystemSettingsUi.cpp ${CMAKE_CURRENT_LIST_DIR}/RicWellPathViewerEventHandler.cpp diff --git a/ApplicationCode/Commands/WellPathCommands/RicDeleteWellPathTargetFeature.cpp b/ApplicationCode/Commands/WellPathCommands/RicDeleteWellPathTargetFeature.cpp new file mode 100644 index 0000000000..d2bda85b36 --- /dev/null +++ b/ApplicationCode/Commands/WellPathCommands/RicDeleteWellPathTargetFeature.cpp @@ -0,0 +1,75 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2018- equinor 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 "RicDeleteWellPathTargetFeature.h" + +CAF_CMD_SOURCE_INIT(RicDeleteWellPathTargetFeature, "RicDeleteWellPathTargetFeature"); + +#include "cafSelectionManager.h" +#include "RimWellPathTarget.h" +#include "RimModeledWellpath.h" +#include + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RicDeleteWellPathTargetFeature::isCommandEnabled() +{ + std::vector objects; + caf::SelectionManager::instance()->objectsByType(&objects, caf::SelectionManager::CURRENT); + + if ( objects.size() > 0 ) + { + return true; + } + + return false; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicDeleteWellPathTargetFeature::onActionTriggered(bool isChecked) +{ + std::vector targets; + caf::SelectionManager::instance()->objectsByType(&targets, caf::SelectionManager::CURRENT); + + if (targets.size() > 0) + { + + RimWellPathGeometryDef* wellGeomDef = nullptr; + targets[0]->firstAncestorOrThisOfTypeAsserted(wellGeomDef); + + for ( auto target: targets ) + { + wellGeomDef->deleteTarget(target); + } + + wellGeomDef->updateConnectedEditors(); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicDeleteWellPathTargetFeature::setupActionLook(QAction* actionToSetup) +{ + actionToSetup->setText("Delete Target"); + actionToSetup->setIcon(QIcon(":/Erase.png")); +} + + diff --git a/ApplicationCode/Commands/WellPathCommands/RicDeleteWellPathTargetFeature.h b/ApplicationCode/Commands/WellPathCommands/RicDeleteWellPathTargetFeature.h new file mode 100644 index 0000000000..7c4d3d4aac --- /dev/null +++ b/ApplicationCode/Commands/WellPathCommands/RicDeleteWellPathTargetFeature.h @@ -0,0 +1,35 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2018- equinor 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" + +//================================================================================================== +/// +//================================================================================================== +class RicDeleteWellPathTargetFeature : public caf::CmdFeature +{ + CAF_CMD_HEADER_INIT; +protected: + + // Overrides + virtual bool isCommandEnabled() override; + virtual void onActionTriggered( bool isChecked ) override; + virtual void setupActionLook( QAction* actionToSetup ) override; +}; diff --git a/ApplicationCode/Commands/WellPathCommands/RicNewEditableWellPathFeature.cpp b/ApplicationCode/Commands/WellPathCommands/RicNewEditableWellPathFeature.cpp new file mode 100644 index 0000000000..a5966ad56c --- /dev/null +++ b/ApplicationCode/Commands/WellPathCommands/RicNewEditableWellPathFeature.cpp @@ -0,0 +1,87 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2018- equinor 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 "RicNewEditableWellPathFeature.h" + +CAF_CMD_SOURCE_INIT(RicNewEditableWellPathFeature, "RicNewEditableWellPathFeature"); + +#include "cafSelectionManager.h" +#include "RimWellPath.h" +#include "RimWellPathCollection.h" +#include "RiaApplication.h" +#include "RimProject.h" +#include "RimModeledWellPath.h" +#include +#include "RimOilField.h" + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RicNewEditableWellPathFeature::isCommandEnabled() +{ + { + std::vector objects; + caf::SelectionManager::instance()->objectsByType(&objects); + + if ( objects.size() > 0 ) + { + return true; + } + } + { + std::vector objects; + caf::SelectionManager::instance()->objectsByType(&objects); + + if ( objects.size() > 0 ) + { + return true; + } + } + + return false; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicNewEditableWellPathFeature::onActionTriggered(bool isChecked) +{ + if ( RiaApplication::instance()->project() && RiaApplication::instance()->project()->activeOilField() ) + { + RimWellPathCollection* wellPathCollection = RiaApplication::instance()->project()->activeOilField()->wellPathCollection(); + + if ( wellPathCollection ) + { + std::vector newWellPaths; + newWellPaths.push_back(new RimModeledWellpath()); + wellPathCollection->addWellPaths(newWellPaths); + wellPathCollection->uiCapability()->updateConnectedEditors(); + wellPathCollection->scheduleRedrawAffectedViews(); + } + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicNewEditableWellPathFeature::setupActionLook(QAction* actionToSetup) +{ + actionToSetup->setText("Create Editable Well Path"); + actionToSetup->setIcon(QIcon(":/Well.png")); +} + + diff --git a/ApplicationCode/Commands/WellPathCommands/RicNewEditableWellPathFeature.h b/ApplicationCode/Commands/WellPathCommands/RicNewEditableWellPathFeature.h new file mode 100644 index 0000000000..9ee94e37c1 --- /dev/null +++ b/ApplicationCode/Commands/WellPathCommands/RicNewEditableWellPathFeature.h @@ -0,0 +1,35 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2018- equinor 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" + +//================================================================================================== +/// +//================================================================================================== +class RicNewEditableWellPathFeature : public caf::CmdFeature +{ + CAF_CMD_HEADER_INIT; +protected: + + // Overrides + virtual bool isCommandEnabled() override; + virtual void onActionTriggered( bool isChecked ) override; + virtual void setupActionLook( QAction* actionToSetup ) override; +}; diff --git a/ApplicationCode/Commands/WellPathCommands/RicNewWellPathListTargetFeature.cpp b/ApplicationCode/Commands/WellPathCommands/RicNewWellPathListTargetFeature.cpp new file mode 100644 index 0000000000..202c3afc7a --- /dev/null +++ b/ApplicationCode/Commands/WellPathCommands/RicNewWellPathListTargetFeature.cpp @@ -0,0 +1,91 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2018- equinor 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 "RicNewWellPathListTargetFeature.h" + +CAF_CMD_SOURCE_INIT(RicNewWellPathListTargetFeature, "RicNewWellPathListTargetFeature"); + +#include "cafSelectionManager.h" +#include "RimWellPathTarget.h" +#include "RimModeledWellpath.h" +#include + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RicNewWellPathListTargetFeature::isCommandEnabled() +{ + { + std::vector objects; + caf::SelectionManager::instance()->objectsByType(&objects); + + if ( objects.size() > 0 ) + { + return true; + } + } + { + std::vector objects; + caf::SelectionManager::instance()->objectsByType(&objects, caf::SelectionManager::CURRENT); + + if ( objects.size() > 0 ) + { + return true; + } + } + + return false; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicNewWellPathListTargetFeature::onActionTriggered(bool isChecked) +{ + std::vector targets; + caf::SelectionManager::instance()->objectsByType(&targets, caf::SelectionManager::CURRENT); + if (targets.size() > 0) + { + RimWellPathGeometryDef* wellGeomDef = nullptr; + targets[0]->firstAncestorOrThisOfTypeAsserted(wellGeomDef); + + wellGeomDef->insertTarget(targets[0], new RimWellPathTarget); + wellGeomDef->updateConnectedEditors(); + return; + } + + std::vector geomDefs; + caf::SelectionManager::instance()->objectsByType(&geomDefs); + if (geomDefs.size() > 0) + { + RimWellPathGeometryDef* wellGeomDef = geomDefs[0]; + + wellGeomDef->insertTarget(nullptr, new RimWellPathTarget); + wellGeomDef->updateConnectedEditors(); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicNewWellPathListTargetFeature::setupActionLook(QAction* actionToSetup) +{ + actionToSetup->setText("New Target"); + actionToSetup->setIcon(QIcon(":/Well.png")); +} + + diff --git a/ApplicationCode/Commands/WellPathCommands/RicNewWellPathListTargetFeature.h b/ApplicationCode/Commands/WellPathCommands/RicNewWellPathListTargetFeature.h new file mode 100644 index 0000000000..b11eb364b2 --- /dev/null +++ b/ApplicationCode/Commands/WellPathCommands/RicNewWellPathListTargetFeature.h @@ -0,0 +1,35 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2018- equinor 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" + +//================================================================================================== +/// +//================================================================================================== +class RicNewWellPathListTargetFeature : public caf::CmdFeature +{ + CAF_CMD_HEADER_INIT; +protected: + + // Overrides + virtual bool isCommandEnabled() override; + virtual void onActionTriggered( bool isChecked ) override; + virtual void setupActionLook( QAction* actionToSetup ) override; +}; diff --git a/ApplicationCode/ProjectDataModel/CMakeLists_files.cmake b/ApplicationCode/ProjectDataModel/CMakeLists_files.cmake index 4910fe5d98..247ae502ef 100644 --- a/ApplicationCode/ProjectDataModel/CMakeLists_files.cmake +++ b/ApplicationCode/ProjectDataModel/CMakeLists_files.cmake @@ -25,6 +25,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RimSimWellInView.h ${CMAKE_CURRENT_LIST_DIR}/RimSimWellInViewCollection.h ${CMAKE_CURRENT_LIST_DIR}/RimWellPath.h ${CMAKE_CURRENT_LIST_DIR}/RimFileWellPath.h +${CMAKE_CURRENT_LIST_DIR}/RimModeledWellpath.h ${CMAKE_CURRENT_LIST_DIR}/RimWellPathCollection.h ${CMAKE_CURRENT_LIST_DIR}/RimWellPathTarget.h ${CMAKE_CURRENT_LIST_DIR}/RimScriptCollection.h @@ -136,6 +137,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RimSimWellInView.cpp ${CMAKE_CURRENT_LIST_DIR}/RimSimWellInViewCollection.cpp ${CMAKE_CURRENT_LIST_DIR}/RimWellPath.cpp ${CMAKE_CURRENT_LIST_DIR}/RimFileWellPath.cpp +${CMAKE_CURRENT_LIST_DIR}/RimModeledWellpath.cpp ${CMAKE_CURRENT_LIST_DIR}/RimWellPathCollection.cpp ${CMAKE_CURRENT_LIST_DIR}/RimWellPathTarget.cpp ${CMAKE_CURRENT_LIST_DIR}/RimScriptCollection.cpp diff --git a/ApplicationCode/ProjectDataModel/RimContextCommandBuilder.cpp b/ApplicationCode/ProjectDataModel/RimContextCommandBuilder.cpp index 00b4feca36..6993bea578 100644 --- a/ApplicationCode/ProjectDataModel/RimContextCommandBuilder.cpp +++ b/ApplicationCode/ProjectDataModel/RimContextCommandBuilder.cpp @@ -243,6 +243,7 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection() } else if (dynamic_cast(uiItem)) { + menuBuilder << "RicNewEditableWellPathFeature"; menuBuilder.subMenuStart("Import"); menuBuilder << "RicWellPathsImportFileFeature"; menuBuilder << "RicWellPathsImportSsihubFeature"; diff --git a/ApplicationCode/ProjectDataModel/RimModeledWellPath.cpp b/ApplicationCode/ProjectDataModel/RimModeledWellPath.cpp new file mode 100644 index 0000000000..ff181b09d1 --- /dev/null +++ b/ApplicationCode/ProjectDataModel/RimModeledWellPath.cpp @@ -0,0 +1,163 @@ +#include "RimModeledWellPath.h" +#include "cafPdmUiTableViewEditor.h" +#include "RimWellPathTarget.h" +#include "cafPdmUiTreeOrdering.h" +#include "cafCmdFeatureMenuBuilder.h" + +CAF_PDM_SOURCE_INIT(RimModeledWellpath, "ModeledWellpath"); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimModeledWellpath::RimModeledWellpath() +{ + CAF_PDM_InitObject("Modeled WellPath", ":/Well.png", "", ""); + + CAF_PDM_InitFieldNoDefault(&m_geometryDefinition, "WellPathGeometryDef", "Trajectory", "", "", ""); + //m_geometryDefinition.uiCapability()->setUiHidden(true); + m_geometryDefinition = new RimWellPathGeometryDef; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimModeledWellpath::~RimModeledWellpath() +{ + +} + + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimModeledWellpath::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName) +{ + uiTreeOrdering.add(m_geometryDefinition()); + RimWellPath::defineUiTreeOrdering(uiTreeOrdering, uiConfigName); +} + +namespace caf +{ +template<> +void caf::AppEnum< RimWellPathGeometryDef::WellStartType >::setUp() +{ + addItem(RimWellPathGeometryDef::START_AT_FIRST_TARGET, "START_AT_FIRST_TARGET", "Start at First Target"); + addItem(RimWellPathGeometryDef::START_AT_SURFACE, "START_AT_SURFACE", "Start at Surface"); + addItem(RimWellPathGeometryDef::START_FROM_OTHER_WELL, "START_FROM_OTHER_WELL", "Branch"); + addItem(RimWellPathGeometryDef::START_AT_AUTO_SURFACE, "START_AT_AUTO_SURFACE", "Auto Surface"); + + setDefault(RimWellPathGeometryDef::START_AT_FIRST_TARGET); +} +} + +CAF_PDM_SOURCE_INIT(RimWellPathGeometryDef, "WellPathGeometryDef"); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimWellPathGeometryDef::RimWellPathGeometryDef() +{ + CAF_PDM_InitObject("Trajectory", ":/Well.png", "", ""); + + CAF_PDM_InitFieldNoDefault(&m_wellStartType, "WellStartType", "Start Type", "", "", ""); + CAF_PDM_InitField(&m_startPos, "StartPos", cvf::Vec3d(0,0,0), "UTM Start Pos", "", "", ""); + + CAF_PDM_InitFieldNoDefault(&m_parentWell, "ParentWell", "Parent Well", "", "", ""); + CAF_PDM_InitField(&m_kickoffDepthOrMD, "KickoffDepthOrMD", 100.0, "Kickoff Depth", "", "", ""); + + CAF_PDM_InitFieldNoDefault(&m_wellTargets, "WellPathTargets", "Well Targets", "", "", ""); + m_wellTargets.uiCapability()->setUiEditorTypeName(caf::PdmUiTableViewEditor::uiEditorTypeName()); + //m_wellTargets.uiCapability()->setUiTreeHidden(true); + m_wellTargets.uiCapability()->setUiTreeChildrenHidden(true); + m_wellTargets.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::TOP); + m_wellTargets.uiCapability()->setCustomContextMenuEnabled(true); + + + m_wellTargets.push_back(new RimWellPathTarget()); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimWellPathGeometryDef::~RimWellPathGeometryDef() +{ + +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimWellPathGeometryDef::insertTarget(RimWellPathTarget* targetToInsertBefore, RimWellPathTarget* targetToInsert) +{ + size_t index = m_wellTargets.index(targetToInsertBefore); + if (index < m_wellTargets.size()) m_wellTargets.insert(index, targetToInsert); + else m_wellTargets.push_back(targetToInsert); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimWellPathGeometryDef::deleteTarget(RimWellPathTarget* targetTodelete) +{ + m_wellTargets.removeChildObject(targetTodelete); + delete targetTodelete; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimWellPathGeometryDef::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) +{ + if (&m_startPos == changedField) + { + std::cout << "fieldChanged" << std::endl; + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimWellPathGeometryDef::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) +{ + uiOrdering.add(&m_wellStartType); + if (m_wellStartType == START_FROM_OTHER_WELL) + { + uiOrdering.add(&m_parentWell); + m_kickoffDepthOrMD.uiCapability()->setUiName("Measured Depth"); + uiOrdering.add(&m_kickoffDepthOrMD); + } + + if (m_wellStartType == START_AT_SURFACE) + { + uiOrdering.add(&m_startPos); + m_kickoffDepthOrMD.uiCapability()->setUiName("Kick Off Depth"); + uiOrdering.add(&m_kickoffDepthOrMD); + } + + uiOrdering.add(&m_wellTargets); + uiOrdering.skipRemainingFields(true); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimWellPathGeometryDef::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName) +{ + uiTreeOrdering.skipRemainingChildren(true); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimWellPathGeometryDef::defineCustomContextMenu(const caf::PdmFieldHandle* fieldNeedingMenu, + QMenu* menu, + QWidget* fieldEditorWidget) +{ + caf::CmdFeatureMenuBuilder menuBuilder; + + menuBuilder << "RicNewWellPathListTargetFeature"; + menuBuilder << "Separator"; + menuBuilder << "RicDeleteWellPathTargetFeature"; + + menuBuilder.appendToMenu(menu); +} diff --git a/ApplicationCode/ProjectDataModel/RimModeledWellPath.h b/ApplicationCode/ProjectDataModel/RimModeledWellPath.h new file mode 100644 index 0000000000..ba8dea2af7 --- /dev/null +++ b/ApplicationCode/ProjectDataModel/RimModeledWellPath.h @@ -0,0 +1,82 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2018 - equinor 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 "RimWellPath.h" + +#include "cafPdmFieldCvfVec3d.h" +#include "cafPdmObject.h" +#include "cafPdmField.h" +#include "cafAppEnum.h" +#include "cafPdmPtrField.h" + +class RimWellPathTarget; +class RimWellPath; +class RimWellPathGeometryDef; + +class RimModeledWellpath: public RimWellPath +{ + CAF_PDM_HEADER_INIT; +public: + + RimModeledWellpath(); + ~RimModeledWellpath(); + +private: + + + caf::PdmChildField m_geometryDefinition; + + virtual void defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName) override; + +}; + + +class RimWellPathGeometryDef : public caf::PdmObject +{ + CAF_PDM_HEADER_INIT; +public: + + RimWellPathGeometryDef(); + ~RimWellPathGeometryDef(); + + enum WellStartType { START_AT_FIRST_TARGET, START_AT_SURFACE, START_FROM_OTHER_WELL, START_AT_AUTO_SURFACE }; + + void insertTarget(RimWellPathTarget* targetToInsertBefore, RimWellPathTarget* targetToInsert); + void deleteTarget(RimWellPathTarget* targetTodelete); + virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override; + +private: + virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override; + virtual void defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName) override; + + + caf::PdmField > m_wellStartType; + caf::PdmField m_startPos; + + caf::PdmField m_kickoffDepthOrMD; + caf::PdmPtrField m_parentWell; + + caf::PdmChildArrayField m_wellTargets; + +protected: + virtual void defineCustomContextMenu(const caf::PdmFieldHandle* fieldNeedingMenu, + QMenu* menu, + QWidget* fieldEditorWidget) override; + +}; diff --git a/ApplicationCode/ProjectDataModel/RimWellPath.h b/ApplicationCode/ProjectDataModel/RimWellPath.h index a6e90142b9..88d6d64ec5 100644 --- a/ApplicationCode/ProjectDataModel/RimWellPath.h +++ b/ApplicationCode/ProjectDataModel/RimWellPath.h @@ -128,6 +128,7 @@ protected: virtual QList calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly) override; virtual void initAfterRead() override; virtual void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; + virtual void defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName) override; void setWellPathGeometry(RigWellPath* wellPathModel); @@ -158,7 +159,6 @@ private: private: - virtual void defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName) override; static size_t simulationWellBranchCount(const QString& simWellName); private: diff --git a/ApplicationCode/ProjectDataModel/RimWellPathTarget.cpp b/ApplicationCode/ProjectDataModel/RimWellPathTarget.cpp index 6a85c7830d..a47d847409 100644 --- a/ApplicationCode/ProjectDataModel/RimWellPathTarget.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellPathTarget.cpp @@ -22,10 +22,12 @@ RimWellPathTarget::RimWellPathTarget() , m_inclination(0.0) { + CAF_PDM_InitField(&m_isEnabled, "IsEnabled", true, "", "", "", ""); CAF_PDM_InitFieldNoDefault(&m_targetType, "TargetType", "Type", "", "", ""); + m_targetType.uiCapability()->setUiHidden(true); CAF_PDM_InitFieldNoDefault(&m_targetPoint, "TargetPoint", "Point", "", "", ""); - CAF_PDM_InitField(&m_azimuth, "Azimuth", 0.0, "Azimuth", "", "", ""); - CAF_PDM_InitField(&m_inclination, "Inclination", 0.0, "Inclination", "", "", ""); + CAF_PDM_InitField(&m_azimuth, "Azimuth", 0.0, "Azi", "", "", ""); + CAF_PDM_InitField(&m_inclination, "Inclination", 0.0, "Inc", "", "", ""); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimWellPathTarget.h b/ApplicationCode/ProjectDataModel/RimWellPathTarget.h index 51e2f5bcfd..49157374a2 100644 --- a/ApplicationCode/ProjectDataModel/RimWellPathTarget.h +++ b/ApplicationCode/ProjectDataModel/RimWellPathTarget.h @@ -1,6 +1,6 @@ ///////////////////////////////////////////////////////////////////////////////// // -// Copyright (C) 2018 - equinor +// Copyright (C) 2018 - equinor // // ResInsight is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -42,9 +42,10 @@ public: double inclination(); private: + caf::PdmField m_isEnabled; caf::PdmField > m_targetType; - caf::PdmField m_targetPoint; - caf::PdmField m_azimuth; - caf::PdmField m_inclination; + caf::PdmField m_targetPoint; + caf::PdmField m_azimuth; + caf::PdmField m_inclination; };