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

This commit is contained in:
Magne Sjaastad 2017-12-08 09:27:37 +01:00
parent f8e7a8aa26
commit 9c4077a040
3 changed files with 40 additions and 11 deletions

View File

@ -22,6 +22,8 @@
#include "RigEclipseCaseData.h"
#include "RimEclipseCase.h"
#include "RimProject.h"
#include "RimWellPlotTools.h"
#include "cafPdmUiOrdering.h"
//--------------------------------------------------------------------------------------------------
///
@ -66,3 +68,27 @@ QList<caf::PdmOptionItemInfo> RiaSimWellBranchTools::valueOptionsForBranchIndexF
return options;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaSimWellBranchTools::appendSimWellBranchFieldsIfRequired(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);
if (RiaSimWellBranchTools::simulationWellBranches(simWellName, branchDetectionField).size() > 1)
{
uiOrdering->add(&branchIndexField);
}
}
}
}

View File

@ -18,6 +18,8 @@
#pragma once
#include "cafPdmField.h"
#include <QList>
#include <QString>
@ -28,7 +30,8 @@ class RigWellPath;
namespace caf
{
class PdmOptionItemInfo;
}
class PdmUiOrdering;
} // namespace caf
//==================================================================================================
//
@ -38,5 +41,10 @@ class RiaSimWellBranchTools
public:
static std::vector<const RigWellPath*> simulationWellBranches(const QString& simWellName, bool useAutoDetectionOfBranches);
static QList<caf::PdmOptionItemInfo> valueOptionsForBranchIndexField(const std::vector<const RigWellPath*>& simulationWellPaths);
static QList<caf::PdmOptionItemInfo>
valueOptionsForBranchIndexField(const std::vector<const RigWellPath*>& simulationWellPaths);
static void appendSimWellBranchFieldsIfRequired(caf::PdmUiOrdering* uiOrdering, const QString& wellPathOrSimWellName,
const caf::PdmField<bool>& branchDetectionField,
const caf::PdmField<int>& branchIndexField);
};

View File

@ -759,15 +759,10 @@ void RimWellRftPlot::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering&
uiOrdering.add(&m_userName);
uiOrdering.add(&m_wellPathNameOrSimWellName);
if (!RimWellPlotTools::hasAssociatedWellPath(m_wellPathNameOrSimWellName))
{
uiOrdering.add(&m_branchDetection);
if (RiaSimWellBranchTools::simulationWellBranches(associatedSimWellName(), m_branchDetection).size() > 1)
{
uiOrdering.add(&m_branchIndex);
}
}
RiaSimWellBranchTools::appendSimWellBranchFieldsIfRequired(&uiOrdering,
m_wellPathNameOrSimWellName,
m_branchDetection,
m_branchIndex);
caf::PdmUiGroup* sourcesGroup = uiOrdering.addNewGroupWithKeyword("Sources", "Sources");
sourcesGroup->add(&m_selectedSources);