#1107 Added calculateValueOptions for case and flow diag solution

This commit is contained in:
Magne Sjaastad 2017-02-02 11:11:03 +01:00
parent d24bf527bf
commit 7c86482af3
2 changed files with 29 additions and 1 deletions

View File

@ -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<caf::PdmOptionItemInfo> 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<RimEclipseResultCase*> 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<RimFlowDiagSolution*> flowSols = m_case->flowDiagSolutions();
for (RimFlowDiagSolution* flowSol : flowSols)
{
options.push_back(caf::PdmOptionItemInfo(flowSol->userDescription(), flowSol, false, flowSol->uiIcon()));
}
}
}
return options;
}

View File

@ -64,7 +64,6 @@ public:
RimWellLogPlot* accumulatedWellFlowPlot();
RimTotalWellAllocationPlot* totalWellFlowPlot();
virtual QList<caf::PdmOptionItemInfo> 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<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly) override;
virtual QImage snapshotWindowContent() override;