diff --git a/ApplicationCode/Commands/FractureCommands/CMakeLists_files.cmake b/ApplicationCode/Commands/FractureCommands/CMakeLists_files.cmake index 3b8e3a8e81..63d3566d98 100644 --- a/ApplicationCode/Commands/FractureCommands/CMakeLists_files.cmake +++ b/ApplicationCode/Commands/FractureCommands/CMakeLists_files.cmake @@ -13,6 +13,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RicNewStimPlanFractureTemplateFeature.h ${CMAKE_CURRENT_LIST_DIR}/RicNewWellPathFractureAtPosFeature.h ${CMAKE_CURRENT_LIST_DIR}/RicNewWellPathFractureFeature.h ${CMAKE_CURRENT_LIST_DIR}/RicNewFractureModelFeature.h +${CMAKE_CURRENT_LIST_DIR}/RicNewWellPathFractureModelAtPosFeature.h ${CMAKE_CURRENT_LIST_DIR}/RicCreateMultipleFracturesFeature.h ${CMAKE_CURRENT_LIST_DIR}/RicCreateMultipleFracturesOptionItemUi.h @@ -35,6 +36,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RicNewStimPlanFractureTemplateFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicNewWellPathFractureAtPosFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicNewWellPathFractureFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicNewFractureModelFeature.cpp +${CMAKE_CURRENT_LIST_DIR}/RicNewWellPathFractureModelAtPosFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicCreateMultipleFracturesFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicCreateMultipleFracturesOptionItemUi.cpp diff --git a/ApplicationCode/Commands/FractureCommands/RicNewFractureModelFeature.cpp b/ApplicationCode/Commands/FractureCommands/RicNewFractureModelFeature.cpp index 88d9570fa5..0bc2531018 100644 --- a/ApplicationCode/Commands/FractureCommands/RicNewFractureModelFeature.cpp +++ b/ApplicationCode/Commands/FractureCommands/RicNewFractureModelFeature.cpp @@ -47,7 +47,8 @@ CAF_CMD_SOURCE_INIT( RicNewFractureModelFeature, "RicNewFractureModelFeature" ); /// //-------------------------------------------------------------------------------------------------- RimFractureModel* RicNewFractureModelFeature::addFractureModel( RimWellPath* wellPath, - RimWellPathCollection* wellPathCollection ) + RimWellPathCollection* wellPathCollection, + double measuredDepth ) { CVF_ASSERT( wellPath ); @@ -82,6 +83,11 @@ RimFractureModel* RicNewFractureModelFeature::addFractureModel( RimWellPath* project->updateAllRequiredEditors(); } + if ( measuredDepth > 0.0 ) + { + fractureModel->setMD( measuredDepth ); + } + Riu3DMainWindowTools::selectAsCurrentItem( fractureModel ); return fractureModel; } diff --git a/ApplicationCode/Commands/FractureCommands/RicNewFractureModelFeature.h b/ApplicationCode/Commands/FractureCommands/RicNewFractureModelFeature.h index 0e9510c16e..31fd06c01b 100644 --- a/ApplicationCode/Commands/FractureCommands/RicNewFractureModelFeature.h +++ b/ApplicationCode/Commands/FractureCommands/RicNewFractureModelFeature.h @@ -33,7 +33,8 @@ class RicNewFractureModelFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; public: - static RimFractureModel* addFractureModel( RimWellPath* wellPath, RimWellPathCollection* wellPathCollection ); + static RimFractureModel* + addFractureModel( RimWellPath* wellPath, RimWellPathCollection* wellPathCollection, double measuredDepth = -1.0 ); protected: void onActionTriggered( bool isChecked ) override; diff --git a/ApplicationCode/Commands/FractureCommands/RicNewWellPathFractureModelAtPosFeature.cpp b/ApplicationCode/Commands/FractureCommands/RicNewWellPathFractureModelAtPosFeature.cpp new file mode 100644 index 0000000000..4fb81137cb --- /dev/null +++ b/ApplicationCode/Commands/FractureCommands/RicNewWellPathFractureModelAtPosFeature.cpp @@ -0,0 +1,68 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2020- 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 "RicNewWellPathFractureModelAtPosFeature.h" + +#include "RicNewFractureModelFeature.h" + +#include "RimTools.h" +#include "RimWellPath.h" +#include "RimWellPathCollection.h" + +#include "Riu3dSelectionManager.h" + +#include + +CAF_CMD_SOURCE_INIT( RicNewWellPathFractureModelAtPosFeature, "RicNewWellPathFractureModelAtPosFeature" ); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicNewWellPathFractureModelAtPosFeature::onActionTriggered( bool isChecked ) +{ + Riu3dSelectionManager* riuSelManager = Riu3dSelectionManager::instance(); + RiuSelectionItem* selItem = riuSelManager->selectedItem( Riu3dSelectionManager::RUI_TEMPORARY ); + + RiuWellPathSelectionItem* wellPathItem = dynamic_cast( selItem ); + if ( !wellPathItem ) return; + + RimWellPath* wellPath = wellPathItem->m_wellpath; + if ( !wellPath ) return; + + RimWellPathCollection* wellPathCollection = RimTools::wellPathCollection(); + if ( !wellPathCollection ) return; + + RicNewFractureModelFeature::addFractureModel( wellPath, wellPathCollection, wellPathItem->m_measuredDepth ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicNewWellPathFractureModelAtPosFeature::setupActionLook( QAction* actionToSetup ) +{ + actionToSetup->setIcon( QIcon( ":/FractureSymbol16x16.png" ) ); + actionToSetup->setText( "Create Fracture Model at this Depth" ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RicNewWellPathFractureModelAtPosFeature::isCommandEnabled() +{ + return true; +} diff --git a/ApplicationCode/Commands/FractureCommands/RicNewWellPathFractureModelAtPosFeature.h b/ApplicationCode/Commands/FractureCommands/RicNewWellPathFractureModelAtPosFeature.h new file mode 100644 index 0000000000..d5af026d68 --- /dev/null +++ b/ApplicationCode/Commands/FractureCommands/RicNewWellPathFractureModelAtPosFeature.h @@ -0,0 +1,36 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2020- 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" + +#include + +//================================================================================================== +/// +//================================================================================================== +class RicNewWellPathFractureModelAtPosFeature : public caf::CmdFeature +{ + CAF_CMD_HEADER_INIT; + +protected: + void onActionTriggered( bool isChecked ) override; + void setupActionLook( QAction* actionToSetup ) override; + bool isCommandEnabled() override; +}; diff --git a/ApplicationCode/UserInterface/RiuViewerCommands.cpp b/ApplicationCode/UserInterface/RiuViewerCommands.cpp index 1c19b1cf88..2f2fde21b7 100644 --- a/ApplicationCode/UserInterface/RiuViewerCommands.cpp +++ b/ApplicationCode/UserInterface/RiuViewerCommands.cpp @@ -526,6 +526,7 @@ void RiuViewerCommands::displayContextMenu( QMouseEvent* event ) menuBuilder << "RicNewValveAtMeasuredDepthFeature"; menuBuilder << "RicNewFishbonesSubsAtMeasuredDepthFeature"; menuBuilder << "RicNewWellPathFractureAtPosFeature"; + menuBuilder << "RicNewWellPathFractureModelAtPosFeature"; menuBuilder.addSeparator(); menuBuilder << "RicNewWellPathAttributeFeature"; menuBuilder << "RicWellPathImportCompletionsFileFeature";