From 73053b0bb7898ec6a5942b8093be6b4a88f9e77b Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 13 Feb 2017 15:00:49 +0100 Subject: [PATCH] #1174 Create TOF property filter with selected tracer --- .../RicShowContributingWellsFeature.cpp | 25 +++++++++++ .../RimEclipseResultDefinition.cpp | 45 ++++++++++++++++--- .../RimEclipseResultDefinition.h | 3 ++ 3 files changed, 66 insertions(+), 7 deletions(-) diff --git a/ApplicationCode/Commands/FlowCommands/RicShowContributingWellsFeature.cpp b/ApplicationCode/Commands/FlowCommands/RicShowContributingWellsFeature.cpp index 6f6870da78..8175bd945e 100644 --- a/ApplicationCode/Commands/FlowCommands/RicShowContributingWellsFeature.cpp +++ b/ApplicationCode/Commands/FlowCommands/RicShowContributingWellsFeature.cpp @@ -22,11 +22,15 @@ #include "RimDefines.h" #include "RimEclipseCellColors.h" +#include "RimEclipsePropertyFilter.h" +#include "RimEclipsePropertyFilterCollection.h" #include "RimEclipseView.h" #include "RimEclipseWell.h" #include "RimEclipseWellCollection.h" #include "RimWellAllocationPlot.h" +#include "RiuMainWindow.h" + #include CAF_CMD_SOURCE_INIT(RicShowContributingWellsFeature, "RicShowContributingWellsFeature"); @@ -76,6 +80,27 @@ void RicShowContributingWellsFeature::onActionTriggered(bool isChecked) } } + // Disable all existing property filters, and + // create a new property filter based on TOF for current well + + RimEclipsePropertyFilterCollection* propertyFilterCollection = activeView->eclipsePropertyFilterCollection(); + + 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()->updateResultNameHasChanged(); + + propertyFilterCollection->updateConnectedEditors(); + + RiuMainWindow::instance()->setExpanded(propertyFilterCollection, true); + activeView->scheduleCreateDisplayModelAndRedraw(); } } diff --git a/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.cpp b/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.cpp index d7d2de6886..44fb932648 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.cpp @@ -250,6 +250,43 @@ void RimEclipseResultDefinition::updateAnyFieldHasChanged() } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimEclipseResultDefinition::setTofAndSelectTracer(const QString& tracerName) +{ + setResultType(RimDefines::FLOW_DIAGNOSTICS); + setResultVariable("TOF"); + + m_flowTracerSelectionMode = FLOW_TR_BY_SELECTION; + + std::vector tracers; + tracers.push_back(tracerName); + setSelectedTracers(tracers); + + if (m_flowSolution() == nullptr) + { + assignFlowSolutionFromCase(); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimEclipseResultDefinition::assignFlowSolutionFromCase() +{ + RimEclipseResultCase* eclCase = nullptr; + this->firstAncestorOrThisOfType(eclCase); + if (eclCase) + { + std::vector flowSols = eclCase->flowDiagSolutions(); + if (flowSols.size() > 0) + { + this->setFlowSolution(flowSols[0]); + } + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -891,13 +928,7 @@ void RimEclipseResultDefinition::defineUiOrdering(QString uiConfigName, caf::Pdm if ( m_flowSolution() == nullptr ) { - RimEclipseResultCase* eclCase; - this->firstAncestorOrThisOfType(eclCase); - if ( eclCase ) - { - std::vector flowSols = eclCase->flowDiagSolutions(); - if (flowSols.size()){ this->setFlowSolution(flowSols[0]); } - } + assignFlowSolutionFromCase(); } } uiOrdering.add(&m_resultVariableUiField); diff --git a/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.h b/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.h index 7a339a99d0..bd0948770c 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.h +++ b/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.h @@ -87,6 +87,8 @@ public: void updateResultNameHasChanged(); void updateAnyFieldHasChanged(); + void setTofAndSelectTracer(const QString& tracerName); + protected: virtual void updateLegendCategorySettings() {}; @@ -123,6 +125,7 @@ protected: private: void setFlowSolution(RimFlowDiagSolution* flowSol); void setSelectedTracers(const std::vector& selectedTracers); + void assignFlowSolutionFromCase(); bool hasDualPorFractureResult();