#8522 Summary Plot: handle plot axis deletion.

This commit is contained in:
Kristian Bendiksen
2022-02-18 18:22:40 +01:00
parent bd22336ba8
commit 1a1acfa006
5 changed files with 51 additions and 4 deletions

View File

@@ -95,6 +95,8 @@ RimPlotAxisProperties::RimPlotAxisProperties()
m_annotations.uiCapability()->setUiTreeHidden( true );
updateOptionSensitivity();
setDeletable( true );
}
//--------------------------------------------------------------------------------------------------

View File

@@ -2091,6 +2091,16 @@ RiuPlotAxis RimEnsembleCurveSet::axisY() const
return RiuPlotAxis::defaultLeft();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEnsembleCurveSet::setAxisY( RiuPlotAxis plotAxis )
{
RimSummaryPlot* plot = nullptr;
firstAncestorOrThisOfTypeAsserted( plot );
m_plotAxisProperties = plot->axisPropertiesForPlotAxis( plotAxis );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -167,6 +167,9 @@ public:
std::vector<cvf::Color3f> generateColorsForCases( const std::vector<RimSummaryCase*>& summaryCases ) const;
RiuPlotAxis axisY() const;
void setAxisY( RiuPlotAxis plotAxis );
protected:
void initAfterRead() override;
@@ -192,8 +195,7 @@ private:
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
void updatePlotAxis();
RiuPlotAxis axisY() const;
void updatePlotAxis();
QString createAutoName() const;

View File

@@ -2457,3 +2457,33 @@ void RimSummaryPlot::assignPlotAxis( RimSummaryCurve* curve )
curve->setLeftOrRightAxisY( newPlotAxis );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSummaryPlot::onChildDeleted( caf::PdmChildArrayFieldHandle* childArray,
std::vector<caf::PdmObjectHandle*>& referringObjects )
{
if ( childArray == &m_axisProperties )
{
for ( caf::PdmObjectHandle* reffingObj : referringObjects )
{
RimSummaryCurve* curve = dynamic_cast<RimSummaryCurve*>( reffingObj );
RimEnsembleCurveSet* curveSet = dynamic_cast<RimEnsembleCurveSet*>( reffingObj );
if ( curve )
{
curve->setLeftOrRightAxisY( RiuPlotAxis::defaultLeft() );
}
else if ( curveSet )
{
curveSet->setAxisY( RiuPlotAxis::defaultLeft() );
}
}
if ( plotWidget() )
{
updateAxes();
plotWidget()->scheduleReplot();
}
}
}

View File

@@ -220,8 +220,11 @@ protected:
caf::PdmFieldHandle* userDescriptionField() override;
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
void childFieldChangedByUi( const caf::PdmFieldHandle* changedChildField ) override;
void updateStackedCurveData();
void updateStackedCurveDataForAxis( RiuPlotAxis plotAxis );
void onChildDeleted( caf::PdmChildArrayFieldHandle* childArray,
std::vector<caf::PdmObjectHandle*>& referringObjects ) override;
void updateStackedCurveData();
void updateStackedCurveDataForAxis( RiuPlotAxis plotAxis );
void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "" ) override;
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;