From 64a2af653c20172de9a1fd958ef0aae6f6f8bd46 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 24 Sep 2018 22:26:14 +0200 Subject: [PATCH] System : Move ternaryLegendConfig to private field --- .../ProjectDataModel/RimEclipseCellColors.cpp | 18 +++++++++++++----- .../ProjectDataModel/RimEclipseCellColors.h | 4 +++- .../ProjectDataModel/RimEclipseView.cpp | 8 ++++---- 3 files changed, 20 insertions(+), 10 deletions(-) diff --git a/ApplicationCode/ProjectDataModel/RimEclipseCellColors.cpp b/ApplicationCode/ProjectDataModel/RimEclipseCellColors.cpp index fe3d9148dd..96b97a45bd 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseCellColors.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseCellColors.cpp @@ -56,8 +56,8 @@ RimEclipseCellColors::RimEclipseCellColors() CAF_PDM_InitFieldNoDefault(&m_legendConfigData, "ResultVarLegendDefinitionList", "", "", "", ""); - CAF_PDM_InitFieldNoDefault(&ternaryLegendConfig, "TernaryLegendDefinition", "Ternary Legend Definition", "", "", ""); - this->ternaryLegendConfig = new RimTernaryLegendConfig(); + CAF_PDM_InitFieldNoDefault(&m_ternaryLegendConfig, "TernaryLegendDefinition", "Ternary Legend Definition", "", "", ""); + this->m_ternaryLegendConfig = new RimTernaryLegendConfig(); CAF_PDM_InitFieldNoDefault(&m_legendConfigPtrField, "LegendDefinitionPtrField", "Legend Definition PtrField", "", "", ""); @@ -74,7 +74,7 @@ RimEclipseCellColors::~RimEclipseCellColors() m_legendConfigData.deleteAllChildObjects(); - delete ternaryLegendConfig(); + delete m_ternaryLegendConfig(); } //-------------------------------------------------------------------------------------------------- @@ -189,7 +189,7 @@ void RimEclipseCellColors::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOr { if (this->resultVariable() == RiaDefines::ternarySaturationResultName()) { - uiTreeOrdering.add(ternaryLegendConfig()); + uiTreeOrdering.add(m_ternaryLegendConfig()); } else { @@ -278,7 +278,7 @@ void RimEclipseCellColors::updateLegendData(size_t currentTimeStep, RimTernaryLegendConfig* ternaryLegendConfig) { if (!legendConfig) legendConfig = this->legendConfig(); - if (!ternaryLegendConfig) ternaryLegendConfig = this->ternaryLegendConfig(); + if (!ternaryLegendConfig) ternaryLegendConfig = this->m_ternaryLegendConfig(); if ( this->hasResult() ) { @@ -519,6 +519,14 @@ RimRegularLegendConfig* RimEclipseCellColors::legendConfig() return m_legendConfigPtrField; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimTernaryLegendConfig* RimEclipseCellColors::ternaryLegendConfig() +{ + return m_ternaryLegendConfig; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimEclipseCellColors.h b/ApplicationCode/ProjectDataModel/RimEclipseCellColors.h index 3962a7ecaa..a2e356a813 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseCellColors.h +++ b/ApplicationCode/ProjectDataModel/RimEclipseCellColors.h @@ -46,8 +46,9 @@ public: void updateLegendData(size_t timestep, RimRegularLegendConfig* legendConfig = nullptr, RimTernaryLegendConfig* ternaryLegendConfig = nullptr); + RimRegularLegendConfig* legendConfig(); - caf::PdmChildField ternaryLegendConfig; + RimTernaryLegendConfig* ternaryLegendConfig(); virtual void setResultVariable(const QString& resultName); @@ -69,6 +70,7 @@ private: caf::PdmChildArrayField m_legendConfigData; caf::PdmPtrField m_legendConfigPtrField; + caf::PdmChildField m_ternaryLegendConfig; caf::PdmPointer m_reservoirView; diff --git a/ApplicationCode/ProjectDataModel/RimEclipseView.cpp b/ApplicationCode/ProjectDataModel/RimEclipseView.cpp index bc47a6ed5d..bca607529e 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseView.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseView.cpp @@ -1144,10 +1144,10 @@ void RimEclipseView::updateMinMaxValuesAndAddLegendToView(QString legendLabel, size_t maxTimeStepCount = cellResultsData->maxTimeStepCount(); if (resultColors->isTernarySaturationSelected() && maxTimeStepCount > 1) { - if (resultColors->ternaryLegendConfig->showLegend() && resultColors->ternaryLegendConfig->titledOverlayFrame()) + if (resultColors->ternaryLegendConfig()->showLegend() && resultColors->ternaryLegendConfig()->titledOverlayFrame()) { - resultColors->ternaryLegendConfig->setTitle(legendLabel); - m_viewer->addColorLegendToBottomLeftCorner(resultColors->ternaryLegendConfig->titledOverlayFrame()); + resultColors->ternaryLegendConfig()->setTitle(legendLabel); + m_viewer->addColorLegendToBottomLeftCorner(resultColors->ternaryLegendConfig()->titledOverlayFrame()); } } } @@ -1611,7 +1611,7 @@ void RimEclipseView::resetLegendsInViewer() RimRegularLegendConfig* cellResultNormalLegendConfig = this->cellResult()->legendConfig(); if (cellResultNormalLegendConfig) cellResultNormalLegendConfig->recreateLegend(); - this->cellResult()->ternaryLegendConfig->recreateLegend(); + this->cellResult()->ternaryLegendConfig()->recreateLegend(); this->cellEdgeResult()->legendConfig()->recreateLegend(); m_viewer->removeAllColorLegends();