#2127 Sim Well Branches : Move logic related to uiOrdering to RiaSimWellBranchTools

This commit is contained in:
Magne Sjaastad
2017-12-08 09:44:33 +01:00
parent 9c4077a040
commit 0e5e88008a
5 changed files with 43 additions and 31 deletions

View File

@@ -72,23 +72,37 @@ QList<caf::PdmOptionItemInfo> RiaSimWellBranchTools::valueOptionsForBranchIndexF
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaSimWellBranchTools::appendSimWellBranchFieldsIfRequired(caf::PdmUiOrdering* uiOrdering,
const QString& wellPathOrSimWellName,
const caf::PdmField<bool>& branchDetectionField,
const caf::PdmField<int>& branchIndexField)
void RiaSimWellBranchTools::appendSimWellBranchFieldsIfRequiredFromWellName(caf::PdmUiOrdering* uiOrdering,
const QString& wellPathOrSimWellName,
const caf::PdmField<bool>& branchDetectionField,
const caf::PdmField<int>& branchIndexField)
{
if (!RimWellPlotTools::hasAssociatedWellPath(wellPathOrSimWellName))
{
const QString simWellName = RimWellPlotTools::simWellName(wellPathOrSimWellName);
if (RiaSimWellBranchTools::simulationWellBranches(simWellName, true).size() > 1)
{
uiOrdering->add(&branchDetectionField);
RiaSimWellBranchTools::appendSimWellBranchFieldsIfRequiredFromSimWellName(uiOrdering,
simWellName,
branchDetectionField,
branchIndexField);
}
}
if (RiaSimWellBranchTools::simulationWellBranches(simWellName, branchDetectionField).size() > 1)
{
uiOrdering->add(&branchIndexField);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaSimWellBranchTools::appendSimWellBranchFieldsIfRequiredFromSimWellName(caf::PdmUiOrdering* uiOrdering,
const QString& simWellName,
const caf::PdmField<bool>& branchDetectionField,
const caf::PdmField<int>& branchIndexField)
{
if (RiaSimWellBranchTools::simulationWellBranches(simWellName, true).size() > 1)
{
uiOrdering->add(&branchDetectionField);
if (RiaSimWellBranchTools::simulationWellBranches(simWellName, branchDetectionField).size() > 1)
{
uiOrdering->add(&branchIndexField);
}
}
}

View File

@@ -44,7 +44,11 @@ public:
static QList<caf::PdmOptionItemInfo>
valueOptionsForBranchIndexField(const std::vector<const RigWellPath*>& simulationWellPaths);
static void appendSimWellBranchFieldsIfRequired(caf::PdmUiOrdering* uiOrdering, const QString& wellPathOrSimWellName,
static void appendSimWellBranchFieldsIfRequiredFromWellName(caf::PdmUiOrdering* uiOrdering, const QString& wellPathOrSimWellName,
const caf::PdmField<bool>& branchDetectionField,
const caf::PdmField<int>& branchIndexField);
static void appendSimWellBranchFieldsIfRequiredFromSimWellName(caf::PdmUiOrdering* uiOrdering, const QString& simWellName,
const caf::PdmField<bool>& branchDetectionField,
const caf::PdmField<int>& branchIndexField);
};