From 2ed5ff7fb7fdf261f0cbdc94da8086e9d7015d0c Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 9 Mar 2017 23:01:45 +0100 Subject: [PATCH] #1288 Added RicSelectViewUI and harmonized features --- .../FlowCommands/CMakeLists_files.cmake | 3 + .../Commands/FlowCommands/RicSelectViewUI.cpp | 132 +++++++++++++++++ .../Commands/FlowCommands/RicSelectViewUI.h | 58 ++++++++ .../RicShowContributingWellsFeature.cpp | 9 +- .../RicShowContributingWellsFeature.h | 1 - .../RicShowContributingWellsFeatureImpl.cpp | 76 +++------- .../RicShowContributingWellsFeatureImpl.h | 3 +- ...icShowContributingWellsFromPlotFeature.cpp | 134 ++++++++---------- 8 files changed, 285 insertions(+), 131 deletions(-) create mode 100644 ApplicationCode/Commands/FlowCommands/RicSelectViewUI.cpp create mode 100644 ApplicationCode/Commands/FlowCommands/RicSelectViewUI.h diff --git a/ApplicationCode/Commands/FlowCommands/CMakeLists_files.cmake b/ApplicationCode/Commands/FlowCommands/CMakeLists_files.cmake index f851cddf8f..eb1c91da91 100644 --- a/ApplicationCode/Commands/FlowCommands/CMakeLists_files.cmake +++ b/ApplicationCode/Commands/FlowCommands/CMakeLists_files.cmake @@ -11,6 +11,7 @@ ${CEE_CURRENT_LIST_DIR}RicShowContributingWellsFromPlotFeature.h ${CEE_CURRENT_LIST_DIR}RicShowContributingWellsFeature.h ${CEE_CURRENT_LIST_DIR}RicShowContributingWellsFeatureImpl.h ${CEE_CURRENT_LIST_DIR}RicPlotProductionRateFeature.h +${CEE_CURRENT_LIST_DIR}RicSelectViewUI.h ) set (SOURCE_GROUP_SOURCE_FILES @@ -20,8 +21,10 @@ ${CEE_CURRENT_LIST_DIR}RicShowContributingWellsFromPlotFeature.cpp ${CEE_CURRENT_LIST_DIR}RicShowContributingWellsFeature.cpp ${CEE_CURRENT_LIST_DIR}RicShowContributingWellsFeatureImpl.cpp ${CEE_CURRENT_LIST_DIR}RicPlotProductionRateFeature.cpp +${CEE_CURRENT_LIST_DIR}RicSelectViewUI.cpp ) + list(APPEND CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES} ) diff --git a/ApplicationCode/Commands/FlowCommands/RicSelectViewUI.cpp b/ApplicationCode/Commands/FlowCommands/RicSelectViewUI.cpp new file mode 100644 index 0000000000..9598a195e9 --- /dev/null +++ b/ApplicationCode/Commands/FlowCommands/RicSelectViewUI.cpp @@ -0,0 +1,132 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// 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 "RicSelectViewUI.h" + +#include "RimEclipseResultCase.h" +#include "RimEclipseView.h" + + +CAF_PDM_SOURCE_INIT(RicSelectViewUI, "RicSelectViewUI"); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RicSelectViewUI::RicSelectViewUI() +{ + CAF_PDM_InitObject("RicSelectViewUI", "", "", ""); + + CAF_PDM_InitFieldNoDefault(&m_selectedView, "MasterView", "Select view", "", "", ""); + CAF_PDM_InitField(&m_createNewView, "CreateNewView", false, "Create New View", "", "", ""); + CAF_PDM_InitField(&m_newViewName, "NewViewName", QString("ShowContributingWells"), "New View Name", "", "", ""); + + m_currentView = nullptr; + m_currentCase = nullptr; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicSelectViewUI::setView(RimEclipseView* currentView) +{ + m_currentView = currentView; + + m_currentView->firstAncestorOrThisOfTypeAsserted(m_currentCase); + + m_selectedView = m_currentView; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicSelectViewUI::setCase(RimEclipseResultCase* currentCase) +{ + m_currentCase = currentCase; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimEclipseView* RicSelectViewUI::selectedView() const +{ + return m_selectedView(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RicSelectViewUI::createNewView() const +{ + return m_createNewView; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RicSelectViewUI::newViewName() const +{ + return m_newViewName; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QList RicSelectViewUI::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly) +{ + QList options; + + if (fieldNeedingOptions == &m_selectedView) + { + QIcon icon; + if (m_currentCase) + { + icon = m_currentCase->uiCapability()->uiIcon(); + for (RimView* v : m_currentCase->views()) + { + QString displayName = m_currentCase->caseUserDescription() + ": " + v->name; + + options.push_back(caf::PdmOptionItemInfo(displayName, v, false, icon)); + } + } + } + + return options; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicSelectViewUI::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) +{ + if (m_currentCase && m_currentCase->views().size() == 0) + { + m_createNewView = true; + } + + if (m_createNewView) + { + m_newViewName.uiCapability()->setUiReadOnly(false); + m_selectedView.uiCapability()->setUiReadOnly(true); + } + else + { + m_newViewName.uiCapability()->setUiReadOnly(true); + m_selectedView.uiCapability()->setUiReadOnly(false); + } +} + diff --git a/ApplicationCode/Commands/FlowCommands/RicSelectViewUI.h b/ApplicationCode/Commands/FlowCommands/RicSelectViewUI.h new file mode 100644 index 0000000000..f3ecfa2355 --- /dev/null +++ b/ApplicationCode/Commands/FlowCommands/RicSelectViewUI.h @@ -0,0 +1,58 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// 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 "cafPdmField.h" +#include "cafPdmObject.h" +#include "cafPdmPtrField.h" + +class RimEclipseView; +class RimEclipseResultCase; + +//================================================================================================== +/// +//================================================================================================== +class RicSelectViewUI : public caf::PdmObject +{ + CAF_PDM_HEADER_INIT; + +public: + RicSelectViewUI(); + + void setView(RimEclipseView* currentView); + void setCase(RimEclipseResultCase* currentCase); + + RimEclipseView* selectedView() const; + bool createNewView() const; + QString newViewName() const; + + virtual QList calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly) override; + +protected: + virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override; + +private: + caf::PdmPtrField m_selectedView; + caf::PdmField m_createNewView; + caf::PdmField m_newViewName; + + RimEclipseView* m_currentView; + RimEclipseResultCase* m_currentCase; +}; + diff --git a/ApplicationCode/Commands/FlowCommands/RicShowContributingWellsFeature.cpp b/ApplicationCode/Commands/FlowCommands/RicShowContributingWellsFeature.cpp index 21a479dd9b..38b69304ad 100644 --- a/ApplicationCode/Commands/FlowCommands/RicShowContributingWellsFeature.cpp +++ b/ApplicationCode/Commands/FlowCommands/RicShowContributingWellsFeature.cpp @@ -20,9 +20,13 @@ #include "RicShowContributingWellsFeatureImpl.h" +#include "RimEclipseView.h" #include "RimEclipseWell.h" +#include "RiuMainWindow.h" + #include "cafSelectionManager.h" +#include "cafCmdFeatureManager.h" #include @@ -55,7 +59,10 @@ void RicShowContributingWellsFeature::onActionTriggered(bool isChecked) RimEclipseView* eclipseView = nullptr; well->firstAncestorOrThisOfTypeAsserted(eclipseView); - RicShowContributingWellsFeatureImpl::modifyViewToShowContributingWells(eclipseView, well->name()); + RicShowContributingWellsFeatureImpl::modifyViewToShowContributingWells(eclipseView, well->name(), eclipseView->currentTimeStep()); + + RiuMainWindow::instance()->setExpanded(eclipseView, true); + RiuMainWindow::instance()->selectAsCurrentItem(eclipseView); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/Commands/FlowCommands/RicShowContributingWellsFeature.h b/ApplicationCode/Commands/FlowCommands/RicShowContributingWellsFeature.h index a32a043124..ab99fa476e 100644 --- a/ApplicationCode/Commands/FlowCommands/RicShowContributingWellsFeature.h +++ b/ApplicationCode/Commands/FlowCommands/RicShowContributingWellsFeature.h @@ -20,7 +20,6 @@ #include "cafCmdFeature.h" - //================================================================================================== /// //================================================================================================== diff --git a/ApplicationCode/Commands/FlowCommands/RicShowContributingWellsFeatureImpl.cpp b/ApplicationCode/Commands/FlowCommands/RicShowContributingWellsFeatureImpl.cpp index eaecf8fdab..c7e7ee36f5 100644 --- a/ApplicationCode/Commands/FlowCommands/RicShowContributingWellsFeatureImpl.cpp +++ b/ApplicationCode/Commands/FlowCommands/RicShowContributingWellsFeatureImpl.cpp @@ -40,15 +40,13 @@ //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RicShowContributingWellsFeatureImpl::modifyViewToShowContributingWells(RimEclipseView* viewToModify, const QString& wellName) +void RicShowContributingWellsFeatureImpl::modifyViewToShowContributingWells(RimEclipseView* viewToModify, const QString& wellName, int timeStep) { - CAF_ASSERT(selectedWell); - - RimEclipseView* eclipseView = viewToModify; + CAF_ASSERT(viewToModify); RimEclipseWell* selectedWell = nullptr; - for (RimEclipseWell* w : eclipseView->wellCollection()->wells()) + for (RimEclipseWell* w : viewToModify->wellCollection()->wells()) { if (w->name() == wellName) { @@ -62,34 +60,32 @@ void RicShowContributingWellsFeatureImpl::modifyViewToShowContributingWells(RimE selectedWell->firstAncestorOrThisOfTypeAsserted(eclipseResultCase); // Use the active flow diag solutions, or the first one as default - RimFlowDiagSolution* flowDiagSolution = eclipseView->cellResult()->flowDiagSolution(); + RimFlowDiagSolution* flowDiagSolution = viewToModify->cellResult()->flowDiagSolution(); if (!flowDiagSolution) { - std::vector flowSolutions = eclipseResultCase->flowDiagSolutions(); - if (flowSolutions.size()) flowDiagSolution = flowSolutions.front(); + flowDiagSolution = eclipseResultCase->defaultFlowDiagSolution(); } CAF_ASSERT(flowDiagSolution); - int timeStep = eclipseView->currentTimeStep(); - RimFlowDiagSolution::TracerStatusType tracerStatus = flowDiagSolution->tracerStatusInTimeStep(selectedWell->name(), timeStep); - if (!(tracerStatus == RimFlowDiagSolution::INJECTOR || tracerStatus == RimFlowDiagSolution::PRODUCER)) { return; } - - eclipseView->cellResult()->setResultType(RimDefines::FLOW_DIAGNOSTICS); - eclipseView->cellResult()->setResultVariable("MaxFractionTracer"); + + viewToModify->setCurrentTimeStep(timeStep); + viewToModify->cellResult()->setResultType(RimDefines::FLOW_DIAGNOSTICS); + viewToModify->cellResult()->setResultVariable("MaxFractionTracer"); + viewToModify->cellResult()->setFlowSolution(flowDiagSolution); switch (tracerStatus) { case RimFlowDiagSolution::PRODUCER: - eclipseView->cellResult()->setFlowDiagTracerSelectionType(RimEclipseResultDefinition::FLOW_TR_INJECTORS); + viewToModify->cellResult()->setFlowDiagTracerSelectionType(RimEclipseResultDefinition::FLOW_TR_INJECTORS); break; case RimFlowDiagSolution::INJECTOR: - eclipseView->cellResult()->setFlowDiagTracerSelectionType(RimEclipseResultDefinition::FLOW_TR_PRODUCERS); + viewToModify->cellResult()->setFlowDiagTracerSelectionType(RimEclipseResultDefinition::FLOW_TR_PRODUCERS); break; default: @@ -97,12 +93,12 @@ void RicShowContributingWellsFeatureImpl::modifyViewToShowContributingWells(RimE break; } - eclipseView->cellResult()->loadDataAndUpdate(); - eclipseView->cellResult()->updateConnectedEditors(); + viewToModify->cellResult()->loadDataAndUpdate(); + viewToModify->cellResult()->updateConnectedEditors(); std::vector tracerNames = findContributingTracerNames(flowDiagSolution, selectedWell->wellResults(), timeStep); - for (RimEclipseWell* w : eclipseView->wellCollection()->wells()) + for (RimEclipseWell* w : viewToModify->wellCollection()->wells()) { if (std::find(tracerNames.begin(), tracerNames.end(), w->name()) != tracerNames.end() || selectedWell->name() == w->name()) @@ -118,7 +114,7 @@ void RicShowContributingWellsFeatureImpl::modifyViewToShowContributingWells(RimE // Disable all existing property filters, and // create a new property filter based on TOF for current well - RimEclipsePropertyFilterCollection* propertyFilterCollection = eclipseView->eclipsePropertyFilterCollection(); + RimEclipsePropertyFilterCollection* propertyFilterCollection = viewToModify->eclipsePropertyFilterCollection(); for (RimEclipsePropertyFilter* f : propertyFilterCollection->propertyFilters()) { @@ -128,7 +124,7 @@ void RicShowContributingWellsFeatureImpl::modifyViewToShowContributingWells(RimE RimEclipsePropertyFilter* propertyFilter = new RimEclipsePropertyFilter(); propertyFilterCollection->propertyFilters().push_back(propertyFilter); - propertyFilter->resultDefinition()->setEclipseCase(eclipseView->eclipseCase()); + propertyFilter->resultDefinition()->setEclipseCase(viewToModify->eclipseCase()); propertyFilter->resultDefinition()->setTofAndSelectTracer(selectedWell->name()); propertyFilter->resultDefinition()->loadDataAndUpdate(); @@ -136,41 +132,11 @@ void RicShowContributingWellsFeatureImpl::modifyViewToShowContributingWells(RimE RiuMainWindow::instance()->setExpanded(propertyFilterCollection, true); - eclipseView->faultCollection()->showFaultCollection = false; - eclipseView->faultCollection()->updateConnectedEditors(); + viewToModify->faultCollection()->showFaultCollection = false; + viewToModify->faultCollection()->updateConnectedEditors(); - eclipseView->scheduleCreateDisplayModelAndRedraw(); - - auto* feature = caf::CmdFeatureManager::instance()->getCommandFeature("RicShowMainWindowFeature"); - feature->actionTriggered(false); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -std::vector RicShowContributingWellsFeatureImpl::contributingTracers(RimEclipseWell* well) -{ - CAF_ASSERT(well); - - RimEclipseView* eclipseView = nullptr; - well->firstAncestorOrThisOfTypeAsserted(eclipseView); - - RimEclipseResultCase* eclipseResultCase = nullptr; - well->firstAncestorOrThisOfTypeAsserted(eclipseResultCase); - - // Use the active flow diag solutions, or the first one as default - RimFlowDiagSolution* flowDiagSolution = eclipseView->cellResult()->flowDiagSolution(); - if (!flowDiagSolution) - { - std::vector flowSolutions = eclipseResultCase->flowDiagSolutions(); - if (flowSolutions.size()) flowDiagSolution = flowSolutions.front(); - } - - CAF_ASSERT(flowDiagSolution); - - int timeStep = eclipseView->currentTimeStep(); - - return findContributingTracerNames(flowDiagSolution, well->wellResults(), timeStep); + viewToModify->updateCurrentTimeStepAndRedraw(); + viewToModify->scheduleCreateDisplayModelAndRedraw(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/Commands/FlowCommands/RicShowContributingWellsFeatureImpl.h b/ApplicationCode/Commands/FlowCommands/RicShowContributingWellsFeatureImpl.h index eeb90e24d4..09f3f12c1d 100644 --- a/ApplicationCode/Commands/FlowCommands/RicShowContributingWellsFeatureImpl.h +++ b/ApplicationCode/Commands/FlowCommands/RicShowContributingWellsFeatureImpl.h @@ -33,10 +33,9 @@ class RigSingleWellResultsData; class RicShowContributingWellsFeatureImpl { public: - static void modifyViewToShowContributingWells(RimEclipseView* viewToModify, const QString& wellName); + static void modifyViewToShowContributingWells(RimEclipseView* viewToModify, const QString& wellName, int timeStep); private: - static std::vector contributingTracers(RimEclipseWell* well); static std::vector findContributingTracerNames( const RimFlowDiagSolution* flowDiagSolution, const RigSingleWellResultsData* wellResults, diff --git a/ApplicationCode/Commands/FlowCommands/RicShowContributingWellsFromPlotFeature.cpp b/ApplicationCode/Commands/FlowCommands/RicShowContributingWellsFromPlotFeature.cpp index 919ce04448..c4771ac4a2 100644 --- a/ApplicationCode/Commands/FlowCommands/RicShowContributingWellsFromPlotFeature.cpp +++ b/ApplicationCode/Commands/FlowCommands/RicShowContributingWellsFromPlotFeature.cpp @@ -20,20 +20,20 @@ #include "RiaApplication.h" -#include "RimDefines.h" -#include "RimEclipseCellColors.h" -#include "RimEclipsePropertyFilter.h" -#include "RimEclipsePropertyFilterCollection.h" +#include "RicSelectViewUI.h" +#include "RicShowContributingWellsFeatureImpl.h" + +#include "RimEclipseResultCase.h" #include "RimEclipseView.h" -#include "RimEclipseWell.h" -#include "RimEclipseWellCollection.h" +#include "RimFlowDiagSolution.h" #include "RimWellAllocationPlot.h" #include "RiuMainWindow.h" -#include #include "cafCmdFeatureManager.h" -#include "RimFlowDiagSolution.h" +#include "cafPdmUiPropertyViewDialog.h" + +#include CAF_CMD_SOURCE_INIT(RicShowContributingWellsFromPlotFeature, "RicShowContributingWellsFromPlotFeature"); @@ -42,12 +42,6 @@ CAF_CMD_SOURCE_INIT(RicShowContributingWellsFromPlotFeature, "RicShowContributin //-------------------------------------------------------------------------------------------------- bool RicShowContributingWellsFromPlotFeature::isCommandEnabled() { - RimWellAllocationPlot* wellAllocationPlot = RiaApplication::instance()->activeWellAllocationPlot(); - if (!wellAllocationPlot) return false; - - RimEclipseView* activeView = dynamic_cast(RiaApplication::instance()->activeReservoirView()); - if (!activeView) return false; - return true; } @@ -59,81 +53,77 @@ void RicShowContributingWellsFromPlotFeature::onActionTriggered(bool isChecked) RimWellAllocationPlot* wellAllocationPlot = RiaApplication::instance()->activeWellAllocationPlot(); if (!wellAllocationPlot) return; - RimEclipseView* activeView = dynamic_cast(RiaApplication::instance()->activeReservoirView()); - if (!activeView) return; + RimEclipseResultCase* parentEclipseCase = nullptr; + wellAllocationPlot->flowDiagSolution()->firstAncestorOrThisOfTypeAsserted(parentEclipseCase); - int timeStep = wellAllocationPlot->timeStep(); - QString wellName = wellAllocationPlot->wellName(); - const std::vector contributingTracers = wellAllocationPlot->contributingTracerNames(); - RimFlowDiagSolution* flowSolution = wellAllocationPlot->flowDiagSolution(); + RimEclipseView* viewToManipulate = nullptr; - if ( !flowSolution ) return; - - RimFlowDiagSolution::TracerStatusType tracerStatus = flowSolution->tracerStatusInTimeStep(wellName, timeStep); - - if (!(tracerStatus == RimFlowDiagSolution::INJECTOR || tracerStatus == RimFlowDiagSolution::PRODUCER) ) return; - - activeView->cellResult()->setResultType(RimDefines::FLOW_DIAGNOSTICS); - activeView->cellResult()->setResultVariable("MaxFractionTracer"); - - switch (tracerStatus) { - case RimFlowDiagSolution::PRODUCER: - activeView->cellResult()->setFlowDiagTracerSelectionType(RimEclipseResultDefinition::FLOW_TR_INJECTORS); - break; - case RimFlowDiagSolution::INJECTOR: - activeView->cellResult()->setFlowDiagTracerSelectionType(RimEclipseResultDefinition::FLOW_TR_PRODUCERS); - break; + RimEclipseView* viewForSameResultCase = nullptr; - default: - CVF_ASSERT(false); - break; - } - activeView->setCurrentTimeStep(timeStep); - activeView->cellResult()->loadDataAndUpdate(); - - activeView->cellResult()->updateConnectedEditors(); - - - for ( RimEclipseWell* well : activeView->wellCollection()->wells() ) - { - if ( std::find(contributingTracers.begin(), contributingTracers.end(), well->name()) != contributingTracers.end() - || wellAllocationPlot->wellName() == well->name() ) + RimEclipseView* activeView = dynamic_cast(RiaApplication::instance()->activeReservoirView()); + if (activeView) { - well->showWell = true; + RimEclipseResultCase* activeViewParent = nullptr; + activeView->firstAncestorOrThisOfTypeAsserted(activeViewParent); + + if (activeViewParent == parentEclipseCase) + { + viewForSameResultCase = activeView; + } + else + { + if (parentEclipseCase->views().size() > 0) + { + viewForSameResultCase = dynamic_cast(parentEclipseCase->views()[0]); + } + } + } + + RicSelectViewUI featureUi; + if (viewForSameResultCase) + { + featureUi.setView(viewForSameResultCase); } else { - well->showWell = false; + featureUi.setCase(parentEclipseCase); + } + + caf::PdmUiPropertyViewDialog propertyDialog(NULL, &featureUi, "Show Contributing Wells in View", ""); + propertyDialog.resize(QSize(400, 200)); + + if (propertyDialog.exec() != QDialog::Accepted) return; + + if (featureUi.createNewView()) + { + RimEclipseView* createdView = parentEclipseCase->createAndAddReservoirView(); + createdView->name = featureUi.newViewName(); + + // Must be run before buildViewItems, as wells are created in this function + createdView->loadDataAndUpdate(); + parentEclipseCase->updateConnectedEditors(); + + viewToManipulate = createdView; + } + else + { + viewToManipulate = featureUi.selectedView(); } } - // Disable all existing property filters, and - // create a new property filter based on TOF for current well + CAF_ASSERT(viewToManipulate); - RimEclipsePropertyFilterCollection* propertyFilterCollection = activeView->eclipsePropertyFilterCollection(); + int timeStep = wellAllocationPlot->timeStep(); + QString wellName = wellAllocationPlot->wellName(); - for ( RimEclipsePropertyFilter* f : propertyFilterCollection->propertyFilters() ) - { - f->isActive = false; - } - - RimEclipsePropertyFilter* propertyFilter = new RimEclipsePropertyFilter(); - propertyFilterCollection->propertyFilters().push_back(propertyFilter); - - propertyFilter->resultDefinition()->setEclipseCase(activeView->eclipseCase()); - propertyFilter->resultDefinition()->setTofAndSelectTracer(wellAllocationPlot->wellName()); - propertyFilter->resultDefinition()->loadDataAndUpdate(); - - propertyFilterCollection->updateConnectedEditors(); - - RiuMainWindow::instance()->setExpanded(propertyFilterCollection, true); - - activeView->scheduleCreateDisplayModelAndRedraw(); + RicShowContributingWellsFeatureImpl::modifyViewToShowContributingWells(viewToManipulate, wellName, timeStep); auto* feature = caf::CmdFeatureManager::instance()->getCommandFeature("RicShowMainWindowFeature"); feature->actionTriggered(false); + RiuMainWindow::instance()->setExpanded(viewToManipulate, true); + RiuMainWindow::instance()->selectAsCurrentItem(viewToManipulate); } //--------------------------------------------------------------------------------------------------