System : Move ternaryLegendConfig to private field

This commit is contained in:
Magne Sjaastad 2018-09-24 22:26:14 +02:00
parent 10ef3fcd4d
commit 64a2af653c
3 changed files with 20 additions and 10 deletions

View File

@ -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;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -46,8 +46,9 @@ public:
void updateLegendData(size_t timestep,
RimRegularLegendConfig* legendConfig = nullptr,
RimTernaryLegendConfig* ternaryLegendConfig = nullptr);
RimRegularLegendConfig* legendConfig();
caf::PdmChildField<RimTernaryLegendConfig*> ternaryLegendConfig;
RimTernaryLegendConfig* ternaryLegendConfig();
virtual void setResultVariable(const QString& resultName);
@ -69,6 +70,7 @@ private:
caf::PdmChildArrayField<RimRegularLegendConfig*> m_legendConfigData;
caf::PdmPtrField<RimRegularLegendConfig*> m_legendConfigPtrField;
caf::PdmChildField<RimTernaryLegendConfig*> m_ternaryLegendConfig;
caf::PdmPointer<RimEclipseView> m_reservoirView;

View File

@ -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();