mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Fixed crash due to missing LegendConfig
This commit is contained in:
@@ -58,7 +58,10 @@ RimEclipseCellColors::RimEclipseCellColors()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimEclipseCellColors::~RimEclipseCellColors()
|
||||
{
|
||||
delete obsoleteField_legendConfig();
|
||||
CVF_ASSERT(obsoleteField_legendConfig() == NULL);
|
||||
|
||||
m_legendConfigData.deleteAllChildObjects();
|
||||
|
||||
delete ternaryLegendConfig();
|
||||
}
|
||||
|
||||
@@ -113,11 +116,6 @@ void RimEclipseCellColors::changeLegendConfig(QString resultVarNameOfNewLegend)
|
||||
{
|
||||
legendResultVariable = this->m_legendConfigPtrField()->resultVariableName();
|
||||
}
|
||||
else if (obsoleteField_legendConfig)
|
||||
{
|
||||
// Use resultVariableName from obsolete legend config if present
|
||||
legendResultVariable = obsoleteField_legendConfig->resultVariableName();
|
||||
}
|
||||
|
||||
if (!this->m_legendConfigPtrField() || legendResultVariable != resultVarNameOfNewLegend)
|
||||
{
|
||||
@@ -164,6 +162,8 @@ void RimEclipseCellColors::initAfterRead()
|
||||
{
|
||||
// The current legend config is NOT stored in <ResultVarLegendDefinitionList> in ResInsight up to v 1.3.7-dev
|
||||
m_legendConfigData.push_back(obsoleteField_legendConfig);
|
||||
m_legendConfigPtrField = obsoleteField_legendConfig;
|
||||
obsoleteField_legendConfig = NULL;
|
||||
}
|
||||
|
||||
changeLegendConfig(this->resultVariable());
|
||||
|
||||
@@ -953,17 +953,15 @@ void RimEclipseView::updateMinMaxValuesAndAddLegendToView(QString legendLabel, R
|
||||
localNegClosestToZero = globalNegClosestToZero;
|
||||
}
|
||||
|
||||
CVF_ASSERT(resultColors->legendConfig());
|
||||
|
||||
resultColors->legendConfig()->setClosestToZeroValues(globalPosClosestToZero, globalNegClosestToZero, localPosClosestToZero, localNegClosestToZero);
|
||||
resultColors->legendConfig()->setAutomaticRanges(globalMin, globalMax, localMin, localMax);
|
||||
|
||||
m_viewer->addColorLegendToBottomLeftCorner(resultColors->legendConfig()->legend());
|
||||
resultColors->legendConfig()->legend()->setTitle(cvfqt::Utils::toString(legendLabel + resultColors->resultVariable()));
|
||||
}
|
||||
else
|
||||
{
|
||||
resultColors->legendConfig()->setClosestToZeroValues(0, 0, 0, 0);
|
||||
resultColors->legendConfig()->setAutomaticRanges(cvf::UNDEFINED_DOUBLE, cvf::UNDEFINED_DOUBLE, cvf::UNDEFINED_DOUBLE, cvf::UNDEFINED_DOUBLE);
|
||||
}
|
||||
|
||||
|
||||
size_t maxTimeStepCount = cellResultsData->maxTimeStepCount();
|
||||
if (resultColors->isTernarySaturationSelected() && maxTimeStepCount > 1)
|
||||
@@ -1427,12 +1425,16 @@ RimEclipseCellColors* RimEclipseView::currentFaultResultColors()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipseView::resetLegendsInViewer()
|
||||
{
|
||||
this->cellResult()->legendConfig()->recreateLegend();
|
||||
RimLegendConfig* cellResultNormalLegendConfig = this->cellResult()->legendConfig();
|
||||
if (cellResultNormalLegendConfig) cellResultNormalLegendConfig->recreateLegend();
|
||||
|
||||
this->cellResult()->ternaryLegendConfig->recreateLegend();
|
||||
this->cellEdgeResult()->legendConfig->recreateLegend();
|
||||
|
||||
m_viewer->removeAllColorLegends();
|
||||
m_viewer->addColorLegendToBottomLeftCorner(this->cellResult()->legendConfig()->legend());
|
||||
|
||||
if (cellResultNormalLegendConfig) m_viewer->addColorLegendToBottomLeftCorner(cellResultNormalLegendConfig->legend());
|
||||
|
||||
m_viewer->addColorLegendToBottomLeftCorner(this->cellEdgeResult()->legendConfig->legend());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user