mirror of
https://github.com/OPM/ResInsight.git
synced 2026-09-03 20:53:13 -05:00
#1059 System : Use PdmOptionItemInfo constructor for PdmObjects
This commit is contained in:
@@ -38,6 +38,7 @@
|
||||
#include "RimGeoMechView.h"
|
||||
#include "RimOilField.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimTools.h"
|
||||
#include "RimWellLogCurve.h"
|
||||
#include "RimWellLogPlot.h"
|
||||
#include "RimWellLogPlotCollection.h"
|
||||
@@ -49,9 +50,9 @@
|
||||
#include "RiuWellLogTrack.h"
|
||||
|
||||
#include "cafPdmUiTreeOrdering.h"
|
||||
#include "cafUtils.h"
|
||||
|
||||
#include <cmath>
|
||||
#include "cafUtils.h"
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
@@ -323,44 +324,27 @@ void RimWellLogExtractionCurve::onLoadDataAndUpdate()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QList<caf::PdmOptionItemInfo> RimWellLogExtractionCurve::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly)
|
||||
{
|
||||
QList<caf::PdmOptionItemInfo> optionList;
|
||||
QList<caf::PdmOptionItemInfo> options;
|
||||
|
||||
optionList = RimWellLogCurve::calculateValueOptions(fieldNeedingOptions, useOptionsOnly);
|
||||
if (optionList.size() > 0) return optionList;
|
||||
options = RimWellLogCurve::calculateValueOptions(fieldNeedingOptions, useOptionsOnly);
|
||||
if (options.size() > 0) return options;
|
||||
|
||||
if (fieldNeedingOptions == &m_wellPath)
|
||||
{
|
||||
RimProject* proj = RiaApplication::instance()->project();
|
||||
if (proj->activeOilField()->wellPathCollection())
|
||||
RimTools::wellPathOptionItems(&options);
|
||||
|
||||
if (options.size() > 0)
|
||||
{
|
||||
caf::PdmChildArrayField<RimWellPath*>& wellPaths = proj->activeOilField()->wellPathCollection()->wellPaths;
|
||||
|
||||
for (size_t i = 0; i< wellPaths.size(); i++)
|
||||
{
|
||||
optionList.push_back(caf::PdmOptionItemInfo(wellPaths[i]->name(), QVariant::fromValue(caf::PdmPointer<caf::PdmObjectHandle>(wellPaths[i]))));
|
||||
}
|
||||
|
||||
if (optionList.size() > 0)
|
||||
{
|
||||
optionList.push_front(caf::PdmOptionItemInfo("None", QVariant::fromValue(caf::PdmPointer<caf::PdmObjectHandle>(NULL))));
|
||||
}
|
||||
options.push_front(caf::PdmOptionItemInfo("None", nullptr));
|
||||
}
|
||||
}
|
||||
else if (fieldNeedingOptions == &m_case)
|
||||
{
|
||||
RimProject* proj = RiaApplication::instance()->project();
|
||||
std::vector<RimCase*> cases;
|
||||
RimTools::caseOptionItems(&options);
|
||||
|
||||
proj->allCases(cases);
|
||||
|
||||
for (size_t i = 0; i< cases.size(); i++)
|
||||
if (options.size() > 0)
|
||||
{
|
||||
optionList.push_back(caf::PdmOptionItemInfo(cases[i]->caseUserDescription(), QVariant::fromValue(caf::PdmPointer<caf::PdmObjectHandle>(cases[i]))));
|
||||
}
|
||||
|
||||
if (optionList.size() > 0)
|
||||
{
|
||||
optionList.push_front(caf::PdmOptionItemInfo("None", QVariant::fromValue(caf::PdmPointer<caf::PdmObjectHandle>(NULL))));
|
||||
options.push_front(caf::PdmOptionItemInfo("None", nullptr));
|
||||
}
|
||||
}
|
||||
else if (fieldNeedingOptions == &m_timeStep)
|
||||
@@ -374,11 +358,11 @@ QList<caf::PdmOptionItemInfo> RimWellLogExtractionCurve::calculateValueOptions(c
|
||||
|
||||
for (int i = 0; i < timeStepNames.size(); i++)
|
||||
{
|
||||
optionList.push_back(caf::PdmOptionItemInfo(timeStepNames[i], i));
|
||||
options.push_back(caf::PdmOptionItemInfo(timeStepNames[i], i));
|
||||
}
|
||||
}
|
||||
|
||||
return optionList;
|
||||
return options;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user