mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#8522 Summary Plot: Prune unused axes after move or delete
This commit is contained in:
@@ -95,8 +95,15 @@ RimPlotAxisProperties::RimPlotAxisProperties()
|
||||
m_annotations.uiCapability()->setUiTreeHidden( true );
|
||||
|
||||
updateOptionSensitivity();
|
||||
}
|
||||
|
||||
setDeletable( true );
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimPlotAxisProperties::isDeletable() const
|
||||
{
|
||||
// The default axes (which have index 0) are not deletable
|
||||
return m_plotAxisIndex != 0;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -77,6 +77,9 @@ public:
|
||||
bool isAxisInverted() const override;
|
||||
void setAxisInverted( bool inverted );
|
||||
|
||||
bool isDeletable() const override;
|
||||
|
||||
|
||||
std::vector<RimPlotAxisAnnotation*> annotations() const override;
|
||||
void appendAnnotation( RimPlotAxisAnnotation* annotation ) override;
|
||||
void removeAllAnnotations() override;
|
||||
|
||||
@@ -753,6 +753,7 @@ void RimEnsembleCurveSet::fieldChangedByUi( const caf::PdmFieldHandle* changedFi
|
||||
|
||||
updatePlotAxis();
|
||||
plot->updateAxes();
|
||||
plot->updateAll();
|
||||
|
||||
updateTextInPlot = true;
|
||||
}
|
||||
@@ -2099,6 +2100,11 @@ void RimEnsembleCurveSet::setAxisY( RiuPlotAxis plotAxis )
|
||||
RimSummaryPlot* plot = nullptr;
|
||||
firstAncestorOrThisOfTypeAsserted( plot );
|
||||
m_plotAxisProperties = plot->axisPropertiesForPlotAxis( plotAxis );
|
||||
|
||||
for ( RimSummaryCurve* curve : curves() )
|
||||
{
|
||||
curve->setLeftOrRightAxisY( axisY() );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -845,7 +845,7 @@ void RimSummaryPlot::updateZoomForAxis( RiuPlotAxis plotAxis )
|
||||
}
|
||||
|
||||
double min, max;
|
||||
RimPlotAxisLogRangeCalculator calc( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, plotCurves );
|
||||
RimPlotAxisLogRangeCalculator calc( plotAxis.axis(), plotCurves );
|
||||
calc.computeAxisRange( &min, &max );
|
||||
|
||||
if ( yAxisProps->isAxisInverted() )
|
||||
@@ -2008,7 +2008,7 @@ RiuPlotWidget* RimSummaryPlot::doCreatePlotViewWidget( QWidget* mainWindowParent
|
||||
|
||||
for ( auto axisProperties : m_axisProperties )
|
||||
{
|
||||
plotWidget()->ensureAxis( axisProperties->plotAxisType() );
|
||||
plotWidget()->ensureAxisIsCreated( axisProperties->plotAxisType() );
|
||||
}
|
||||
|
||||
for ( RimGridTimeHistoryCurve* curve : m_gridTimeHistoryCurves )
|
||||
@@ -2482,6 +2482,13 @@ void RimSummaryPlot::onChildDeleted( caf::PdmChildArrayFieldHandle* childAr
|
||||
|
||||
if ( plotWidget() )
|
||||
{
|
||||
std::set<RiuPlotAxis> usedPlotAxis;
|
||||
for ( auto axisProperties : m_axisProperties )
|
||||
{
|
||||
usedPlotAxis.insert( axisProperties->plotAxisType() );
|
||||
}
|
||||
|
||||
plotWidget()->pruneAxes( usedPlotAxis );
|
||||
updateAxes();
|
||||
plotWidget()->scheduleReplot();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user