From bf00807aee39b85aa89ba88676940c443bd70bfa Mon Sep 17 00:00:00 2001 From: Rebecca Cox Date: Sun, 5 Nov 2017 12:26:27 +0100 Subject: [PATCH] #2077 Well Allocation Plot: Set default formation name values --- .../Flow/RimWellAllocationPlot.cpp | 1 + .../ProjectDataModel/RimWellLogTrack.cpp | 58 +++++++++++++++---- .../ProjectDataModel/RimWellLogTrack.h | 3 + 3 files changed, 50 insertions(+), 12 deletions(-) diff --git a/ApplicationCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp b/ApplicationCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp index ddc92270c6..9fa0ea9179 100644 --- a/ApplicationCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp +++ b/ApplicationCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp @@ -248,6 +248,7 @@ void RimWellAllocationPlot::updateFromWell() RimWellLogTrack* plotTrack = new RimWellLogTrack(); plotTrack->setDescription(QString("Branch %1").arg(brIdx + 1)); + plotTrack->setBranchIndex((int)brIdx); accumulatedWellFlowPlot()->addTrack(plotTrack); diff --git a/ApplicationCode/ProjectDataModel/RimWellLogTrack.cpp b/ApplicationCode/ProjectDataModel/RimWellLogTrack.cpp index 8d6869c44f..e009dc493c 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogTrack.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellLogTrack.cpp @@ -44,6 +44,7 @@ #include "RimProject.h" #include "RimTools.h" #include "RimWellFlowRateCurve.h" +#include "RimWellAllocationPlot.h" #include "RimWellLogCurve.h" #include "RimWellLogPlot.h" #include "RimWellLogPlotCollection.h" @@ -259,6 +260,16 @@ void RimWellLogTrack::fieldChangedByUi(const caf::PdmFieldHandle* changedField, m_formationCase = cases[0]; } } + + RimWellAllocationPlot* wellAllocationPlot; + firstAncestorOrThisOfType(wellAllocationPlot); + + if (wellAllocationPlot) + { + m_trajectoryType = RimWellLogTrack::SIMULATION_WELL; + m_simulationWellChosen = true; + m_simWellName = wellAllocationPlot->wellName(); + } } loadDataAndUpdate(); @@ -508,29 +519,32 @@ void RimWellLogTrack::loadDataAndUpdate() } else { - m_trajectoryType == RimWellLogTrack::SIMULATION_WELL; + m_trajectoryType = RimWellLogTrack::SIMULATION_WELL; m_simulationWellChosen = true; m_simWellName = wellName; m_branchIndex = rftPlot->branchIndex(); } } - if (m_showFormations) + RimWellAllocationPlot* wellAllocationPlot; + (rftPlot || pltPlot) ? wellAllocationPlot = nullptr : firstAncestorOrThisOfType(wellAllocationPlot); + + if (wellAllocationPlot) { - m_trajectoryType.uiCapability()->setUiReadOnly(false); - m_simWellName.uiCapability()->setUiReadOnly(false); - m_formationCase.uiCapability()->setUiReadOnly(false); - m_wellPath.uiCapability()->setUiReadOnly(false); - m_branchIndex.uiCapability()->setUiReadOnly(false); + setFormationFieldsUiReadOnly(true); } else { - m_trajectoryType.uiCapability()->setUiReadOnly(true); - m_simWellName.uiCapability()->setUiReadOnly(true); - m_formationCase.uiCapability()->setUiReadOnly(true); - m_wellPath.uiCapability()->setUiReadOnly(true); - m_branchIndex.uiCapability()->setUiReadOnly(true); + if (m_showFormations) + { + setFormationFieldsUiReadOnly(false); + } + else + { + setFormationFieldsUiReadOnly(true); + } } + updateFormationNamesOnPlot(); } @@ -543,6 +557,14 @@ void RimWellLogTrack::setXAxisTitle(const QString& text) m_xAxisTitle = text; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimWellLogTrack::setBranchIndex(int branchIndex) +{ + m_branchIndex = branchIndex; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -1054,6 +1076,18 @@ std::vector RimWellLogTrack::formationNamesVector(RimCase* rimCase) return std::vector(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimWellLogTrack::setFormationFieldsUiReadOnly(bool readOnly /*= true*/) +{ + m_trajectoryType.uiCapability()->setUiReadOnly(readOnly); + m_simWellName.uiCapability()->setUiReadOnly(readOnly); + m_formationCase.uiCapability()->setUiReadOnly(readOnly); + m_wellPath.uiCapability()->setUiReadOnly(readOnly); + m_branchIndex.uiCapability()->setUiReadOnly(readOnly); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimWellLogTrack.h b/ApplicationCode/ProjectDataModel/RimWellLogTrack.h index 786ac40ab3..a9684c694a 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogTrack.h +++ b/ApplicationCode/ProjectDataModel/RimWellLogTrack.h @@ -77,6 +77,7 @@ public: size_t curveIndex(RimWellLogCurve* curve); size_t curveCount() { return curves.size(); } void setXAxisTitle(const QString& text); + void setBranchIndex(int branchIndex); void recreateViewer(); void detachAllCurves(); @@ -132,6 +133,8 @@ private: static std::vector formationNamesVector(RimCase* rimCase); + void setFormationFieldsUiReadOnly(bool readOnly = true); + void updateFormationNamesOnPlot(); void removeFormationNames(); void updateAxisScaleEngine();