From bac2d2b4b2704c85c1df760d61ecffd3c0903089 Mon Sep 17 00:00:00 2001 From: Rebecca Cox Date: Mon, 6 Nov 2017 13:39:14 +0100 Subject: [PATCH] #2037 RFT Plot: Set formation case from plot --- .../ProjectDataModel/Flow/RimWellRftPlot.cpp | 12 +++++- .../ProjectDataModel/RimWellLogTrack.cpp | 42 ++++++------------- .../ProjectDataModel/RimWellLogTrack.h | 5 ++- 3 files changed, 26 insertions(+), 33 deletions(-) diff --git a/ApplicationCode/ProjectDataModel/Flow/RimWellRftPlot.cpp b/ApplicationCode/ProjectDataModel/Flow/RimWellRftPlot.cpp index 92fb808379..ad2add6425 100644 --- a/ApplicationCode/ProjectDataModel/Flow/RimWellRftPlot.cpp +++ b/ApplicationCode/ProjectDataModel/Flow/RimWellRftPlot.cpp @@ -260,7 +260,7 @@ void RimWellRftPlot::updateFormationNamesData() const { for (size_t i = 0; i < m_wellLogPlot->trackCount(); i++) { - m_wellLogPlot->trackByIndex(i)->updateFormationNamesData(RimWellLogTrack::WELL_PATH, nullptr, QString(), 0); + m_wellLogPlot->trackByIndex(i)->updateFormationNamesData(nullptr, RimWellLogTrack::WELL_PATH, nullptr, QString(), 0); } return; } @@ -282,9 +282,17 @@ void RimWellRftPlot::updateFormationNamesData() const trajectoryType = RimWellLogTrack::SIMULATION_WELL; } + RimCase* rimCase = nullptr; + std::vector cases; + proj->allCases(cases); + if (!cases.empty()) + { + rimCase = cases[0]; + } + if (m_wellLogPlot->trackCount() > 0) { - m_wellLogPlot->trackByIndex(0)->updateFormationNamesData(trajectoryType, wellPath, m_wellName, m_branchIndex); + m_wellLogPlot->trackByIndex(0)->updateFormationNamesData(rimCase, trajectoryType, wellPath, m_wellName, m_branchIndex); } } diff --git a/ApplicationCode/ProjectDataModel/RimWellLogTrack.cpp b/ApplicationCode/ProjectDataModel/RimWellLogTrack.cpp index 1560a84516..2a372130f1 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogTrack.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellLogTrack.cpp @@ -44,9 +44,7 @@ #include "RimProject.h" #include "RimTools.h" #include "RimWellFlowRateCurve.h" -#include "RimWellAllocationPlot.h" #include "RimWellLogCurve.h" -#include "RimWellLogPlot.h" #include "RimWellLogPlotCollection.h" #include "RimWellPath.h" #include "RimWellPathCollection.h" @@ -248,30 +246,6 @@ void RimWellLogTrack::fieldChangedByUi(const caf::PdmFieldHandle* changedField, } else if (changedField == &m_showFormations) { - if (!m_formationCase && m_showFormations) - { - RimProject* proj = RiaApplication::instance()->project(); - if (proj) - { - std::vector cases; - proj->allCases(cases); - if (!cases.empty()) - { - m_formationCase = cases[0]; - } - } - - RimWellAllocationPlot* wellAllocationPlot; - firstAncestorOrThisOfType(wellAllocationPlot); - - if (wellAllocationPlot) - { - m_formationTrajectoryType = RimWellLogTrack::SIMULATION_WELL; - m_simulationWellChosen = true; - m_formationSimWellName = wellAllocationPlot->wellName(); - } - } - loadDataAndUpdate(); } else if (changedField == &m_formationCase) @@ -497,13 +471,15 @@ void RimWellLogTrack::loadDataAndUpdate() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellLogTrack::updateFormationNamesData(TrajectoryType trajectoryType, RimWellPath* wellPath, QString simWellName, int branchIndex) +void RimWellLogTrack::updateFormationNamesData(RimCase* rimCase, TrajectoryType trajectoryType, RimWellPath* wellPath, QString simWellName, int branchIndex) { + m_formationCase = rimCase; m_formationTrajectoryType = trajectoryType; m_formationWellPath = wellPath; m_formationSimWellName = simWellName; m_formationBranchIndex = branchIndex; - + + updateConnectedEditors(); updateFormationNamesOnPlot(); } @@ -518,11 +494,19 @@ void RimWellLogTrack::setXAxisTitle(const QString& text) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellLogTrack::setBranchIndex(int branchIndex) +void RimWellLogTrack::setFormationBranchIndex(int branchIndex) { m_formationBranchIndex = branchIndex; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +int RimWellLogTrack::formationBranchIndex() const +{ + return m_formationBranchIndex; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimWellLogTrack.h b/ApplicationCode/ProjectDataModel/RimWellLogTrack.h index bf1f17c932..8c09d25fbb 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogTrack.h +++ b/ApplicationCode/ProjectDataModel/RimWellLogTrack.h @@ -77,13 +77,14 @@ public: size_t curveIndex(RimWellLogCurve* curve); size_t curveCount() { return curves.size(); } void setXAxisTitle(const QString& text); - void setBranchIndex(int branchIndex); + void setFormationBranchIndex(int branchIndex); + int formationBranchIndex() const; void recreateViewer(); void detachAllCurves(); void loadDataAndUpdate(); - void updateFormationNamesData(TrajectoryType trajectoryType, RimWellPath* wellPath, QString simWellName, int branchIndex); + void updateFormationNamesData(RimCase* rimCase, TrajectoryType trajectoryType, RimWellPath* wellPath, QString simWellName, int branchIndex); void availableDepthRange(double* minimumDepth, double* maximumDepth); void updateXZoomAndParentPlotDepthZoom();