#1976 RFT/PLT Plot. Associate sim well and well path. RFT branch index impl

This commit is contained in:
Bjørn Erik Jensen
2017-10-11 13:52:29 +02:00
parent 00985b00c3
commit dcb1c40414
8 changed files with 321 additions and 39 deletions

View File

@@ -47,9 +47,15 @@
#include <QDir>
#include <QFileInfo>
#include <QMessageBox>
#include "RiaApplication.h"
CAF_PDM_SOURCE_INIT(RimWellPath, "WellPath");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const char RimWellPath::SIM_WELL_NONE_NAME[] = "None";
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -100,6 +106,9 @@ RimWellPath::RimWellPath()
CAF_PDM_InitField(&wellPathIndexInFile, "WellPathNumberInFile", -1, "Well Number in file", "", "", "");
wellPathIndexInFile.uiCapability()->setUiReadOnly(true);
CAF_PDM_InitField(&m_simWellName, "SimWellName", QString(""), "Well", "", "", "");
CAF_PDM_InitField(&m_branchIndex, "SimBranchIndex", 0, "Branch", "", "", "");
CAF_PDM_InitField(&showWellPathLabel, "ShowWellPathLabel", true, "Show well path label", "", "", "");
CAF_PDM_InitField(&showWellPath, "ShowWellPath", true, "Show well path", "", "", "");
@@ -285,6 +294,42 @@ void RimWellPath::fieldChangedByUi(const caf::PdmFieldHandle* changedField, cons
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QList<caf::PdmOptionItemInfo> RimWellPath::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly)
{
QList<caf::PdmOptionItemInfo> options;
if (fieldNeedingOptions == &m_simWellName)
{
RimProject* proj = RiaApplication::instance()->project();
options.push_back(caf::PdmOptionItemInfo(SIM_WELL_NONE_NAME, SIM_WELL_NONE_NAME));
for (const auto& wellName : proj->simulationWellNames())
{
options.push_back(caf::PdmOptionItemInfo(wellName, wellName));
}
}
else if (fieldNeedingOptions == &m_branchIndex)
{
RimProject* proj = RiaApplication::instance()->project();
size_t branchCount = proj->simulationWellBranches(m_simWellName).size();
if (branchCount == 0)
branchCount = 1;
int index = 0;
while(index < branchCount)
{
QString uiText = QString("Branch %1").arg(QString::number(index + 1));
options.push_back(caf::PdmOptionItemInfo(uiText, QVariant::fromValue(index)));
index++;
}
}
return options;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -360,6 +405,16 @@ void RimWellPath::setWellPathGeometry(RigWellPath* wellPathModel)
//--------------------------------------------------------------------------------------------------
void RimWellPath::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
{
if (m_simWellName().isEmpty())
{
// Try to set default simulation well name
auto simWellName = tryFindSimulationWellFromWellPathName(m_name);
if (!simWellName.isEmpty())
{
m_simWellName = simWellName;
}
}
caf::PdmUiGroup* appGroup = uiOrdering.addNewGroup("Appearance");
appGroup->add(&showWellPathLabel);
appGroup->add(&wellPathColor);
@@ -369,6 +424,13 @@ void RimWellPath::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiO
fileInfoGroup->add(&filepath);
fileInfoGroup->add(&wellPathIndexInFile);
caf::PdmUiGroup* simWellGroup = uiOrdering.addNewGroup("Simulation Well");
simWellGroup->add(&m_simWellName);
RimProject* proj = RiaApplication::instance()->project();
if(proj->simulationWellBranches(m_simWellName).size() > 1)
simWellGroup->add(&m_branchIndex);
caf::PdmUiGroup* ssihubGroup = uiOrdering.addNewGroup("Well Info");
ssihubGroup->add(&id);
ssihubGroup->add(&sourceSystem);
@@ -388,6 +450,8 @@ void RimWellPath::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiO
{
m_datumElevation.uiCapability()->setUiHidden(true);
}
uiOrdering.skipRemainingFields(true);
}
//--------------------------------------------------------------------------------------------------
@@ -556,4 +620,36 @@ RimWellPath* RimWellPath::fromFilePath(QString filePath)
return wellPath;
}
return nullptr;
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const QString RimWellPath::relatedSimulationWell() const
{
return m_simWellName;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RimWellPath::relatedSimulationWellBranch() const
{
return m_branchIndex;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const QString RimWellPath::tryFindSimulationWellFromWellPathName(const QString& wellPathName)
{
RimProject* proj = RiaApplication::instance()->project();
for (const auto& simWellName : proj->simulationWellNames())
{
if (QString::compare(simWellName, wellPathName) == 0)
{
return simWellName;
}
}
return "";
}