Skip to content

Commit

Permalink
guard crash
Browse files Browse the repository at this point in the history
  • Loading branch information
magnesj committed Sep 12, 2023
1 parent 6a28cfc commit ead2507
Showing 1 changed file with 33 additions and 34 deletions.
67 changes: 33 additions & 34 deletions ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -916,50 +916,49 @@ void RimSummaryPlot::updateNumericalAxis( RiaDefines::PlotAxis plotAxis )
if ( riuPlotAxis.axis() == plotAxis )
{
auto* axisProps = dynamic_cast<RimPlotAxisProperties*>( axisProperties );
if ( axisProps )
if ( !axisProps ) continue;

if ( axisProperties->isActive() && hasVisibleCurvesForAxis( riuPlotAxis ) )
{
if ( axisProperties->isActive() && hasVisibleCurvesForAxis( riuPlotAxis ) )
{
plotWidget()->enableAxis( riuPlotAxis, true );
}
else
{
plotWidget()->enableAxis( riuPlotAxis, false );
}
plotWidget()->enableAxis( riuPlotAxis, true );
}
else
{
plotWidget()->enableAxis( riuPlotAxis, false );
}

if ( !hasVisibleCurvesForAxis( riuPlotAxis ) )
{
axisProps->setNameForUnusedAxis();
}
else
{
std::set<QString> timeHistoryQuantities;

if ( !hasVisibleCurvesForAxis( riuPlotAxis ) )
for ( auto c : visibleTimeHistoryCurvesForAxis( riuPlotAxis ) )
{
axisProps->setNameForUnusedAxis();
timeHistoryQuantities.insert( c->quantityName() );
}
else
{
std::set<QString> timeHistoryQuantities;

for ( auto c : visibleTimeHistoryCurvesForAxis( riuPlotAxis ) )
{
timeHistoryQuantities.insert( c->quantityName() );
}

std::vector<RiaSummaryCurveDefinition> curveDefs;
for ( auto summaryCurve : summaryCurves() )
{
if ( summaryCurve->axisY() != riuPlotAxis ) continue;
std::vector<RiaSummaryCurveDefinition> curveDefs;
for ( auto summaryCurve : summaryCurves() )
{
if ( summaryCurve->axisY() != riuPlotAxis ) continue;

curveDefs.push_back( summaryCurve->curveDefinitionY() );
}
curveDefs.push_back( summaryCurve->curveDefinitionY() );
}

for ( auto curveSet : ensembleCurveSetCollection()->curveSets() )
{
if ( curveSet->axisY() != riuPlotAxis ) continue;
for ( auto curveSet : ensembleCurveSetCollection()->curveSets() )
{
if ( curveSet->axisY() != riuPlotAxis ) continue;

RiaSummaryCurveDefinition def( curveSet->summaryCaseCollection(), curveSet->summaryAddress() );
curveDefs.push_back( def );
}
RiaSummaryCurveDefinition def( curveSet->summaryCaseCollection(), curveSet->summaryAddress() );
curveDefs.push_back( def );
}

RimSummaryPlotAxisFormatter calc( axisProps, {}, curveDefs, visibleAsciiDataCurvesForAxis( riuPlotAxis ), timeHistoryQuantities );
RimSummaryPlotAxisFormatter calc( axisProps, {}, curveDefs, visibleAsciiDataCurvesForAxis( riuPlotAxis ), timeHistoryQuantities );

calc.applyAxisPropertiesToPlot( plotWidget() );
}
calc.applyAxisPropertiesToPlot( plotWidget() );
}

plotWidget()->enableAxisNumberLabels( riuPlotAxis, axisProps->showNumbers() );
Expand Down

0 comments on commit ead2507

Please sign in to comment.