#6652 Fix missing legend entries in summary editor

This commit is contained in:
Gaute Lindkvist 2020-10-01 08:28:08 +02:00 committed by Magne Sjaastad
parent fde2c5e4af
commit 2de49891fb
5 changed files with 45 additions and 9 deletions

View File

@ -455,16 +455,24 @@ void RicSummaryPlotEditorUi::updatePreviewCurvesFromCurveDefinitions(
size_t ensembleCurveCnt = ensembleCurveCount( allCurveDefsToDisplay );
bool speedCheatsRequired = ensembleCurveCnt > ENSEMBLE_CURVE_COUNT_THRESHOLD;
bool legendsVisible = m_previewPlot->legendsVisible();
// Disable legends when adding curves
m_previewPlot->setLegendsVisible( false );
if ( speedCheatsRequired ) m_previewPlot->setLegendsVisible( false );
// Add new curves
std::map<RimSummaryCurve*, std::pair<bool, bool>> stashedErrorBarsAndLegendVisibility;
for ( const auto& curveDef : curveDefsToAdd )
{
RimSummaryCase* currentCase = curveDef.summaryCase();
RimSummaryCurve* curve = new RimSummaryCurve();
curve->setErrorBarsVisible( false );
curve->showLegend( false );
if ( speedCheatsRequired )
{
stashedErrorBarsAndLegendVisibility[curve] = std::make_pair( curve->errorBarsVisible(), curve->showInLegend() );
curve->setErrorBarsVisible( false );
curve->setShowInLegend( false );
}
curve->setSummaryCaseY( currentCase );
curve->setSummaryAddressYAndApplyInterpolation( curveDef.summaryAddress() );
curve->applyCurveAutoNameSettings( *m_curveNameConfig() );
@ -528,7 +536,18 @@ void RicSummaryPlotEditorUi::updatePreviewCurvesFromCurveDefinitions(
}
// Enable legends if there is not too many curves
m_previewPlot->setLegendsVisible( !warningDisplayed );
if ( speedCheatsRequired && !warningDisplayed )
{
m_previewPlot->setLegendsVisible( legendsVisible );
for ( const auto& curveAndVisibilityPair : stashedErrorBarsAndLegendVisibility )
{
auto curve = curveAndVisibilityPair.first;
auto errorBarsAndLegendVisibility = curveAndVisibilityPair.second;
curve->setErrorBarsVisible( errorBarsAndLegendVisibility.first );
curve->setShowInLegend( errorBarsAndLegendVisibility.second );
}
}
m_previewPlot->loadDataAndUpdate();
m_previewPlot->zoomAll();
m_previewPlot->updateConnectedEditors();

View File

@ -542,7 +542,7 @@ void RimWellRftPlot::updateCurvesInPlot( const std::set<RiaRftPltCurveDefinition
bool isFirstSummaryCurveInEnsemble =
ensemblesWithSummaryCurves.count( curveDefToAdd.address().ensemble() ) == 0u;
curve->showLegend( isFirstSummaryCurveInEnsemble );
curve->setShowInLegend( isFirstSummaryCurveInEnsemble );
ensemblesWithSummaryCurves.insert( curveDefToAdd.address().ensemble() );
}
else if ( m_showStatisticsCurves && curveDefToAdd.address().sourceType() == RifDataSourceForRftPlt::ENSEMBLE_RFT )

View File

@ -618,7 +618,7 @@ void RimGridCrossPlotDataSet::createCurves( const RigEclipseCrossPlotResult& res
}
curve->setSymbolEdgeColor( curve->color() );
curve->setSamples( it->second.xValues, it->second.yValues );
curve->showLegend( m_crossPlotCurves.empty() );
curve->setShowInLegend( m_crossPlotCurves.empty() );
curve->setLegendEntryText( createAutoName() );
curve->setCurveAutoAppearance();
curve->updateUiIconFromPlotSymbol();

View File

@ -1034,7 +1034,23 @@ void RimPlotCurve::setFillColor( const cvf::Color3f& fillColor )
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPlotCurve::showLegend( bool show )
bool RimPlotCurve::showInLegend() const
{
return m_showLegend;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimPlotCurve::errorBarsVisible() const
{
return m_showErrorBars;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPlotCurve::setShowInLegend( bool show )
{
m_showLegend = show;
updateLegendEntryVisibilityNoPlotUpdate();

View File

@ -111,10 +111,11 @@ public:
void updateLegendEntryVisibilityAndPlotLegend();
void updateLegendEntryVisibilityNoPlotUpdate();
void showLegend( bool show );
bool showInLegend() const;
bool errorBarsVisible() const;
void setShowInLegend( bool show );
void setZOrder( double z );
void setErrorBarsVisible( bool isVisible );
virtual void updateCurveAppearance();