From b2ec4e055fa14865dc10dfb1ce39a7e2b9cc5b6c Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Tue, 21 Feb 2017 09:49:27 +0100 Subject: [PATCH] #1174 Added Show contributing wells from 3D view --- .../FlowCommands/CMakeLists_files.cmake | 2 + ...pp => RicShowContributingWellsFeature.cpp} | 50 +++++++------------ ...py.h => RicShowContributingWellsFeature.h} | 4 +- .../UserInterface/RiuViewerCommands.cpp | 1 + 4 files changed, 21 insertions(+), 36 deletions(-) rename ApplicationCode/Commands/FlowCommands/{RicShowWellAllocationPlotFeature - Copy.cpp => RicShowContributingWellsFeature.cpp} (50%) rename ApplicationCode/Commands/FlowCommands/{RicShowWellAllocationPlotFeature - Copy.h => RicShowContributingWellsFeature.h} (93%) diff --git a/ApplicationCode/Commands/FlowCommands/CMakeLists_files.cmake b/ApplicationCode/Commands/FlowCommands/CMakeLists_files.cmake index 230a719f8d..ad729ca6b4 100644 --- a/ApplicationCode/Commands/FlowCommands/CMakeLists_files.cmake +++ b/ApplicationCode/Commands/FlowCommands/CMakeLists_files.cmake @@ -8,12 +8,14 @@ set (SOURCE_GROUP_HEADER_FILES ${CEE_CURRENT_LIST_DIR}RicShowWellAllocationPlotFeature.h ${CEE_CURRENT_LIST_DIR}RicAddStoredWellAllocationPlotFeature.h ${CEE_CURRENT_LIST_DIR}RicShowContributingWellsFromPlotFeature.h +${CEE_CURRENT_LIST_DIR}RicShowContributingWellsFeature.h ) set (SOURCE_GROUP_SOURCE_FILES ${CEE_CURRENT_LIST_DIR}RicShowWellAllocationPlotFeature.cpp ${CEE_CURRENT_LIST_DIR}RicAddStoredWellAllocationPlotFeature.cpp ${CEE_CURRENT_LIST_DIR}RicShowContributingWellsFromPlotFeature.cpp +${CEE_CURRENT_LIST_DIR}RicShowContributingWellsFeature.cpp ) list(APPEND CODE_HEADER_FILES diff --git a/ApplicationCode/Commands/FlowCommands/RicShowWellAllocationPlotFeature - Copy.cpp b/ApplicationCode/Commands/FlowCommands/RicShowContributingWellsFeature.cpp similarity index 50% rename from ApplicationCode/Commands/FlowCommands/RicShowWellAllocationPlotFeature - Copy.cpp rename to ApplicationCode/Commands/FlowCommands/RicShowContributingWellsFeature.cpp index 804f6df145..56e023a898 100644 --- a/ApplicationCode/Commands/FlowCommands/RicShowWellAllocationPlotFeature - Copy.cpp +++ b/ApplicationCode/Commands/FlowCommands/RicShowContributingWellsFeature.cpp @@ -16,28 +16,18 @@ // ///////////////////////////////////////////////////////////////////////////////// -#include "RicShowWellAllocationPlotFeature.h" +#include "RicShowContributingWellsFeature.h" -#include "RiaApplication.h" - -#include "RimEclipseWell.h" -#include "RimFlowPlotCollection.h" -#include "RimMainPlotCollection.h" -#include "RimProject.h" -#include "RimWellAllocationPlot.h" - -#include "RiuMainPlotWindow.h" - -#include "cafSelectionManager.h" +#include "cafCmdFeatureManager.h" #include -CAF_CMD_SOURCE_INIT(RicShowWellAllocationPlotFeature, "RicShowWellAllocationPlotFeature"); +CAF_CMD_SOURCE_INIT(RicShowContributingWellsFeature, "RicShowContributingWellsFeature"); //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -bool RicShowWellAllocationPlotFeature::isCommandEnabled() +bool RicShowContributingWellsFeature::isCommandEnabled() { return true; } @@ -45,27 +35,21 @@ bool RicShowWellAllocationPlotFeature::isCommandEnabled() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RicShowWellAllocationPlotFeature::onActionTriggered(bool isChecked) +void RicShowContributingWellsFeature::onActionTriggered(bool isChecked) { - std::vector collection; - caf::SelectionManager::instance()->objectsByType(&collection); + // First, shot the well allocation plot + // Then, use the feature to show contributing wells as this is based on the previous feature - if (collection.size() > 0) + std::vector commandIds; + commandIds.push_back("RicShowWellAllocationPlotFeature"); + commandIds.push_back("RicShowContributingWellsFromPlotFeature"); + + for (auto commandId : commandIds) { - RimEclipseWell* eclWell = collection[0]; - - if (RiaApplication::instance()->project()) + auto* feature = caf::CmdFeatureManager::instance()->getCommandFeature(commandId); + if (feature) { - RimFlowPlotCollection* flowPlotColl = RiaApplication::instance()->project()->mainPlotCollection->flowPlotCollection(); - if (flowPlotColl) - { - flowPlotColl->defaultPlot()->setFromSimulationWell(eclWell); - flowPlotColl->defaultPlot()->updateConnectedEditors(); - - // Make sure the summary plot window is created and visible - RiuMainPlotWindow* plotwindow = RiaApplication::instance()->getOrCreateAndShowMainPlotWindow(); - plotwindow->selectAsCurrentItem(flowPlotColl->defaultPlot()); - } + feature->actionTriggered(false); } } } @@ -73,8 +57,8 @@ void RicShowWellAllocationPlotFeature::onActionTriggered(bool isChecked) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RicShowWellAllocationPlotFeature::setupActionLook(QAction* actionToSetup) +void RicShowContributingWellsFeature::setupActionLook(QAction* actionToSetup) { actionToSetup->setIcon(QIcon(":/new_icon16x16.png")); - actionToSetup->setText("Show Well Allocation Plot"); + actionToSetup->setText("Show Contributing Wells"); } diff --git a/ApplicationCode/Commands/FlowCommands/RicShowWellAllocationPlotFeature - Copy.h b/ApplicationCode/Commands/FlowCommands/RicShowContributingWellsFeature.h similarity index 93% rename from ApplicationCode/Commands/FlowCommands/RicShowWellAllocationPlotFeature - Copy.h rename to ApplicationCode/Commands/FlowCommands/RicShowContributingWellsFeature.h index 7d804b8640..a32a043124 100644 --- a/ApplicationCode/Commands/FlowCommands/RicShowWellAllocationPlotFeature - Copy.h +++ b/ApplicationCode/Commands/FlowCommands/RicShowContributingWellsFeature.h @@ -20,13 +20,11 @@ #include "cafCmdFeature.h" -class RimEclipseWell; - //================================================================================================== /// //================================================================================================== -class RicShowWellAllocationPlotFeature : public caf::CmdFeature +class RicShowContributingWellsFeature : public caf::CmdFeature { CAF_CMD_HEADER_INIT; diff --git a/ApplicationCode/UserInterface/RiuViewerCommands.cpp b/ApplicationCode/UserInterface/RiuViewerCommands.cpp index 002b757baf..3bc0f7f301 100644 --- a/ApplicationCode/UserInterface/RiuViewerCommands.cpp +++ b/ApplicationCode/UserInterface/RiuViewerCommands.cpp @@ -309,6 +309,7 @@ void RiuViewerCommands::displayContextMenu(QMouseEvent* event) commandIds << "RicNewSimWellIntersectionFeature"; commandIds << "RicShowWellAllocationPlotFeature"; + commandIds << "RicShowContributingWellsFeature"; } }