diff --git a/ApplicationCode/Commands/PerforationCommands/CMakeLists_files.cmake b/ApplicationCode/Commands/PerforationCommands/CMakeLists_files.cmake index ee9864e76f..8f272175c2 100644 --- a/ApplicationCode/Commands/PerforationCommands/CMakeLists_files.cmake +++ b/ApplicationCode/Commands/PerforationCommands/CMakeLists_files.cmake @@ -7,11 +7,13 @@ endif() set (SOURCE_GROUP_HEADER_FILES ${CEE_CURRENT_LIST_DIR}RicEditPerforationCollectionFeature.h ${CEE_CURRENT_LIST_DIR}RicNewPerforationIntervalFeature.h +${CEE_CURRENT_LIST_DIR}RicNewPerforationIntervalAtMeasuredDepthFeature.h ) set (SOURCE_GROUP_SOURCE_FILES ${CEE_CURRENT_LIST_DIR}RicEditPerforationCollectionFeature.cpp ${CEE_CURRENT_LIST_DIR}RicNewPerforationIntervalFeature.cpp +${CEE_CURRENT_LIST_DIR}RicNewPerforationIntervalAtMeasuredDepthFeature.cpp ) list(APPEND CODE_HEADER_FILES diff --git a/ApplicationCode/Commands/PerforationCommands/RicNewPerforationIntervalAtMeasuredDepthFeature.cpp b/ApplicationCode/Commands/PerforationCommands/RicNewPerforationIntervalAtMeasuredDepthFeature.cpp new file mode 100644 index 0000000000..53b9440750 --- /dev/null +++ b/ApplicationCode/Commands/PerforationCommands/RicNewPerforationIntervalAtMeasuredDepthFeature.cpp @@ -0,0 +1,97 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// 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 "RicNewPerforationIntervalAtMeasuredDepthFeature.h" + +#include "RimFishbonesMultipleSubs.h" +#include "RimPerforationCollection.h" +#include "RimPerforationInterval.h" +#include "RimProject.h" +#include "RimWellPath.h" +#include "RimWellPathCollection.h" + +#include "RiuMainWindow.h" +#include "RiuSelectionManager.h" + +#include "cafSelectionManager.h" + +#include + + +CAF_CMD_SOURCE_INIT(RicNewPerforationIntervalAtMeasuredDepthFeature, "RicNewPerforationIntervalAtMeasuredDepthFeature"); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicNewPerforationIntervalAtMeasuredDepthFeature::onActionTriggered(bool isChecked) +{ + RiuWellPathSelectionItem* wellPathSelItem = wellPathSelectionItem(); + CVF_ASSERT(wellPathSelItem); + + RimWellPath* wellPath = wellPathSelItem->m_wellpath; + CVF_ASSERT(wellPath); + + RimPerforationInterval* perforationInterval = new RimPerforationInterval; + int measuredDepth = wellPathSelItem->m_measuredDepth; + perforationInterval->setStartAndEndMD(measuredDepth, measuredDepth + 50); + + wellPath->m_perforationCollection()->appendPerforation(perforationInterval); + + RimWellPathCollection* wellPathCollection = nullptr; + wellPath->firstAncestorOrThisOfTypeAsserted(wellPathCollection); + + wellPathCollection->uiCapability()->updateConnectedEditors(); + wellPathCollection->scheduleGeometryRegenAndRedrawViews(); + + RiuMainWindow::instance()->selectAsCurrentItem(perforationInterval); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RiuWellPathSelectionItem* RicNewPerforationIntervalAtMeasuredDepthFeature::wellPathSelectionItem() +{ + RiuSelectionManager* riuSelManager = RiuSelectionManager::instance(); + RiuSelectionItem* selItem = riuSelManager->selectedItem(RiuSelectionManager::RUI_TEMPORARY); + + RiuWellPathSelectionItem* wellPathItem = dynamic_cast(selItem); + + return wellPathItem; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicNewPerforationIntervalAtMeasuredDepthFeature::setupActionLook(QAction* actionToSetup) +{ + //actionToSetup->setIcon(QIcon(":/FractureSymbol16x16.png")); + actionToSetup->setText("New Perforation Interval"); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RicNewPerforationIntervalAtMeasuredDepthFeature::isCommandEnabled() +{ + if (wellPathSelectionItem()) + { + return true; + } + + return false; +} diff --git a/ApplicationCode/Commands/PerforationCommands/RicNewPerforationIntervalAtMeasuredDepthFeature.h b/ApplicationCode/Commands/PerforationCommands/RicNewPerforationIntervalAtMeasuredDepthFeature.h new file mode 100644 index 0000000000..ae77586bf5 --- /dev/null +++ b/ApplicationCode/Commands/PerforationCommands/RicNewPerforationIntervalAtMeasuredDepthFeature.h @@ -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. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "cafCmdFeature.h" + +class RiuWellPathSelectionItem; + +//================================================================================================== +/// +//================================================================================================== +class RicNewPerforationIntervalAtMeasuredDepthFeature : public caf::CmdFeature +{ + CAF_CMD_HEADER_INIT; + +protected: + virtual void onActionTriggered(bool isChecked) override; + virtual void setupActionLook(QAction* actionToSetup) override; + virtual bool isCommandEnabled() override; + +private: + static RiuWellPathSelectionItem* wellPathSelectionItem(); +}; diff --git a/ApplicationCode/ProjectDataModel/RimPerforationInterval.cpp b/ApplicationCode/ProjectDataModel/RimPerforationInterval.cpp index 8aca567485..1e4c9ead04 100644 --- a/ApplicationCode/ProjectDataModel/RimPerforationInterval.cpp +++ b/ApplicationCode/ProjectDataModel/RimPerforationInterval.cpp @@ -48,6 +48,15 @@ RimPerforationInterval::~RimPerforationInterval() { } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimPerforationInterval::setStartAndEndMD(double startMD, double endMD) +{ + m_startMD = startMD; + m_endMD = endMD; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimPerforationInterval.h b/ApplicationCode/ProjectDataModel/RimPerforationInterval.h index 298c4bd9ce..23b07fa08b 100644 --- a/ApplicationCode/ProjectDataModel/RimPerforationInterval.h +++ b/ApplicationCode/ProjectDataModel/RimPerforationInterval.h @@ -36,7 +36,7 @@ public: RimPerforationInterval(); virtual ~RimPerforationInterval(); - + void setStartAndEndMD(double startMD, double endMD); double startMD() { return m_startMD(); } double endMD() { return m_endMD(); } @@ -50,5 +50,4 @@ private: caf::PdmField< double > m_endMD; caf::PdmField< double > m_radius; caf::PdmField< double > m_skinFactor; - }; diff --git a/ApplicationCode/UserInterface/RiuViewerCommands.cpp b/ApplicationCode/UserInterface/RiuViewerCommands.cpp index 97fff149ba..b75b865a2b 100644 --- a/ApplicationCode/UserInterface/RiuViewerCommands.cpp +++ b/ApplicationCode/UserInterface/RiuViewerCommands.cpp @@ -305,6 +305,7 @@ void RiuViewerCommands::displayContextMenu(QMouseEvent* event) commandIds << "Separator"; commandIds << "RicNewWellPathIntersectionFeature"; commandIds << "RicNewFishbonesSubsAtMeasuredDepthFeature"; + commandIds << "RicNewPerforationIntervalAtMeasuredDepthFeature"; } }