From 7c86482af33ff98b3bac63b5757ab218e32ff6f4 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 2 Feb 2017 11:11:03 +0100 Subject: [PATCH] #1107 Added calculateValueOptions for case and flow diag solution --- .../Flow/RimWellAllocationPlot.cpp | 28 +++++++++++++++++++ .../Flow/RimWellAllocationPlot.h | 2 +- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/ApplicationCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp b/ApplicationCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp index 137066547f..13b1fc891b 100644 --- a/ApplicationCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp +++ b/ApplicationCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp @@ -40,6 +40,7 @@ #include "RiuMainPlotWindow.h" #include "RiuWellAllocationPlot.h" #include "RigAccWellFlowCalculator.h" +#include "RimProject.h" CAF_PDM_SOURCE_INIT(RimWellAllocationPlot, "WellAllocationPlot"); @@ -347,6 +348,33 @@ QList RimWellAllocationPlot::calculateValueOptions(const options.push_back(caf::PdmOptionItemInfo(timeStepNames[i], i)); } } + else if (fieldNeedingOptions == &m_case) + { + RimProject* proj = nullptr; + this->firstAncestorOrThisOfType(proj); + if (proj) + { + std::vector cases; + proj->descendantsIncludingThisOfType(cases); + + for (RimEclipseResultCase* c : cases) + { + options.push_back(caf::PdmOptionItemInfo(c->caseUserDescription(), c, false, c->uiIcon())); + } + } + } + else if (fieldNeedingOptions == &m_flowDiagSolution) + { + if (m_case) + { + std::vector flowSols = m_case->flowDiagSolutions(); + + for (RimFlowDiagSolution* flowSol : flowSols) + { + options.push_back(caf::PdmOptionItemInfo(flowSol->userDescription(), flowSol, false, flowSol->uiIcon())); + } + } + } return options; } diff --git a/ApplicationCode/ProjectDataModel/Flow/RimWellAllocationPlot.h b/ApplicationCode/ProjectDataModel/Flow/RimWellAllocationPlot.h index 91752e9d7b..c361a00eb4 100644 --- a/ApplicationCode/ProjectDataModel/Flow/RimWellAllocationPlot.h +++ b/ApplicationCode/ProjectDataModel/Flow/RimWellAllocationPlot.h @@ -64,7 +64,6 @@ public: RimWellLogPlot* accumulatedWellFlowPlot(); RimTotalWellAllocationPlot* totalWellFlowPlot(); - virtual QList calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly) override; QString wellName() const; @@ -74,6 +73,7 @@ protected: // Overridden PDM methods virtual caf::PdmFieldHandle* userDescriptionField() { return &m_userName; } virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override; + virtual QList calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly) override; virtual QImage snapshotWindowContent() override;