#10387 Grid Cross Plot: update plot on color changes

Fixes #10387.
This commit is contained in:
Kristian Bendiksen 2023-06-28 09:51:20 +02:00
parent fdf4309d82
commit b5d6421f22
5 changed files with 44 additions and 1 deletions

View File

@ -128,7 +128,6 @@ RimGridCrossPlotDataSet::RimGridCrossPlotDataSet()
m_crossPlotCurves.uiCapability()->setUiTreeHidden( true );
CAF_PDM_InitFieldNoDefault( &m_crossPlotRegressionCurves, "CrossPlotRegressionCurves", "Regression Curves" );
// m_crossPlotRegressionCurves.uiCapability()->setUiTreeHidden( true );
CAF_PDM_InitField( &m_useCustomColor, "UseCustomColor", false, "Use Custom Color" );
CAF_PDM_InitField( &m_customColor, "CustomColor", cvf::Color3f( cvf::Color3f::BLACK ), "Custom Color" );
@ -469,6 +468,16 @@ void RimGridCrossPlotDataSet::initAfterRead()
m_groupingProperty->setEclipseCase( eclipseCase );
m_plotCellFilterCollection->setCase( eclipseCase );
}
for ( auto curve : m_crossPlotCurves )
{
curve->appearanceChanged.connect( this, &RimGridCrossPlotDataSet::curveAppearanceChanged );
}
for ( auto curve : m_crossPlotRegressionCurves )
{
curve->appearanceChanged.connect( this, &RimGridCrossPlotDataSet::curveAppearanceChanged );
}
}
//--------------------------------------------------------------------------------------------------
@ -673,6 +682,7 @@ void RimGridCrossPlotDataSet::createCurves( const RigEclipseCrossPlotResult& res
curve->setSamples( result.xValues, result.yValues );
curve->setCurveAutoAppearance();
curve->updateUiIconFromPlotSymbol();
curve->appearanceChanged.connect( this, &RimGridCrossPlotDataSet::curveAppearanceChanged );
m_crossPlotCurves.push_back( curve );
}
else
@ -697,6 +707,7 @@ void RimGridCrossPlotDataSet::createCurves( const RigEclipseCrossPlotResult& res
curve->setLegendEntryText( createAutoName() );
curve->setCurveAutoAppearance();
curve->updateUiIconFromPlotSymbol();
curve->appearanceChanged.connect( this, &RimGridCrossPlotDataSet::curveAppearanceChanged );
m_crossPlotCurves.push_back( curve );
}
}
@ -752,6 +763,7 @@ void RimGridCrossPlotDataSet::createRegressionCurves( const RigEclipseCrossPlotR
curve->setSamples( result.xValues, result.yValues );
curve->setCurveAutoAppearance();
curve->updateUiIconFromPlotSymbol();
curve->appearanceChanged.connect( this, &RimGridCrossPlotDataSet::curveAppearanceChanged );
}
else
{
@ -780,6 +792,7 @@ void RimGridCrossPlotDataSet::createRegressionCurves( const RigEclipseCrossPlotR
curve->setLegendEntryText( createAutoName() );
curve->setCurveAutoAppearance();
curve->updateUiIconFromPlotSymbol();
curve->appearanceChanged.connect( this, &RimGridCrossPlotDataSet::curveAppearanceChanged );
}
}
}
@ -822,6 +835,10 @@ void RimGridCrossPlotDataSet::fillCurveDataInExistingRegressionCurves( const Rig
void RimGridCrossPlotDataSet::destroyCurves()
{
detachAllCurves();
for ( auto curve : m_crossPlotCurves )
curve->appearanceChanged.disconnect( this );
m_crossPlotCurves.deleteChildren();
}
@ -831,6 +848,10 @@ void RimGridCrossPlotDataSet::destroyCurves()
void RimGridCrossPlotDataSet::destroyRegressionCurves()
{
detachAllRegressionCurves();
for ( auto curve : m_crossPlotRegressionCurves )
curve->appearanceChanged.disconnect( this );
m_crossPlotRegressionCurves.deleteChildren();
}
@ -1586,6 +1607,14 @@ void RimGridCrossPlotDataSet::filterInvalidCurveValues( RigEclipseCrossPlotResul
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridCrossPlotDataSet::curveAppearanceChanged( const caf::SignalEmitter* emitter )
{
triggerPlotNameUpdateAndReplot();
}
CAF_PDM_SOURCE_INIT( RimGridCrossPlotDataSetNameConfig, "RimGridCrossPlotCurveSetNameConfig" );
//--------------------------------------------------------------------------------------------------

View File

@ -177,6 +177,8 @@ protected:
cvf::Color3f createCurveColor( bool useCustomColor, int colorIndex ) const;
cvf::Color3f createCurveColor( const std::vector<double>& tickValues, int groupIndex ) const;
void curveAppearanceChanged( const caf::SignalEmitter* emitter );
private:
caf::PdmPtrField<RimCase*> m_case;
caf::PdmField<int> m_timeStep;

View File

@ -231,6 +231,15 @@ void RimGridCrossPlotRegressionCurve::setCurveAutoAppearance()
updateCurveAppearance();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridCrossPlotRegressionCurve::updateCurveAppearance()
{
RimPlotCurve::updateCurveAppearance();
updateRectAnnotation();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -44,6 +44,8 @@ public:
void setSamples( const std::vector<double>& xValues, const std::vector<double>& yValues );
void setRangeDefaults( const std::vector<double>& xValues, const std::vector<double>& yValues );
void updateCurveAppearance() override;
void setCurveAutoAppearance();
int groupIndex() const;
size_t sampleCount() const;

View File

@ -325,6 +325,7 @@ void RimRegularLegendConfig::fieldChangedByUi( const caf::PdmFieldHandle* change
if ( changedField != &m_showLegend )
{
crossPlotCurveSet->destroyCurves();
crossPlotCurveSet->destroyRegressionCurves();
}
crossPlotCurveSet->loadDataAndUpdate( true );