#7107 Ensemble curves : Remove obsolete update signals

This commit is contained in:
Magne Sjaastad 2020-12-11 19:21:40 +01:00
parent b5729d538f
commit 3b231a0bb6
4 changed files with 17 additions and 32 deletions

View File

@ -28,10 +28,7 @@ CAF_PDM_SOURCE_INIT( RimCustomObjectiveFunctionCollection, "RimCustomObjectiveFu
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RimCustomObjectiveFunctionCollection::RimCustomObjectiveFunctionCollection() RimCustomObjectiveFunctionCollection::RimCustomObjectiveFunctionCollection()
: objectiveFunctionAdded( this ) : objectiveFunctionChanged( this )
, objectiveFunctionChanged( this )
, objectiveFunctionAboutToBeDeleted( this )
, objectiveFunctionDeleted( this )
{ {
CAF_PDM_InitObject( "Custom Objective Functions", ":/ObjectiveFunctionCollection.svg", "", "" ); CAF_PDM_InitObject( "Custom Objective Functions", ":/ObjectiveFunctionCollection.svg", "", "" );
@ -45,7 +42,6 @@ RimCustomObjectiveFunction* RimCustomObjectiveFunctionCollection::addObjectiveFu
{ {
auto newFunction = new RimCustomObjectiveFunction(); auto newFunction = new RimCustomObjectiveFunction();
m_objectiveFunctions.push_back( newFunction ); m_objectiveFunctions.push_back( newFunction );
objectiveFunctionAdded.send( newFunction );
return newFunction; return newFunction;
} }
@ -54,7 +50,7 @@ RimCustomObjectiveFunction* RimCustomObjectiveFunctionCollection::addObjectiveFu
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimCustomObjectiveFunctionCollection::onObjectiveFunctionChanged( RimCustomObjectiveFunction* objectiveFunction ) void RimCustomObjectiveFunctionCollection::onObjectiveFunctionChanged( RimCustomObjectiveFunction* objectiveFunction )
{ {
objectiveFunctionChanged.send( objectiveFunction ); objectiveFunctionChanged.send();
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -77,3 +73,12 @@ void RimCustomObjectiveFunctionCollection::defineUiTreeOrdering( caf::PdmUiTreeO
} }
uiTreeOrdering.skipRemainingChildren( true ); uiTreeOrdering.skipRemainingChildren( true );
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimCustomObjectiveFunctionCollection::onChildDeleted( caf::PdmChildArrayFieldHandle* childArray,
std::vector<caf::PdmObjectHandle*>& referringObjects )
{
objectiveFunctionChanged.send();
}

View File

@ -35,10 +35,7 @@ class RimCustomObjectiveFunctionCollection : public caf::PdmObject
CAF_PDM_HEADER_INIT; CAF_PDM_HEADER_INIT;
public: public:
caf::Signal<RimCustomObjectiveFunction*> objectiveFunctionAdded; caf::Signal<> objectiveFunctionChanged;
caf::Signal<RimCustomObjectiveFunction*> objectiveFunctionChanged;
caf::Signal<RimCustomObjectiveFunction*> objectiveFunctionAboutToBeDeleted;
caf::Signal<> objectiveFunctionDeleted;
public: public:
RimCustomObjectiveFunctionCollection(); RimCustomObjectiveFunctionCollection();
@ -48,7 +45,9 @@ public:
std::vector<RimCustomObjectiveFunction*> objectiveFunctions() const; std::vector<RimCustomObjectiveFunction*> objectiveFunctions() const;
private: private:
void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName /* = "" */ ) override; void onChildDeleted( caf::PdmChildArrayFieldHandle* childArray,
std::vector<caf::PdmObjectHandle*>& referringObjects ) override;
void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName ) override;
private: private:
caf::PdmChildArrayField<RimCustomObjectiveFunction*> m_objectiveFunctions; caf::PdmChildArrayField<RimCustomObjectiveFunction*> m_objectiveFunctions;

View File

@ -198,8 +198,6 @@ RimEnsembleCurveSet::RimEnsembleCurveSet()
"" ); "" );
m_customObjectiveFunctions = new RimCustomObjectiveFunctionCollection(); m_customObjectiveFunctions = new RimCustomObjectiveFunctionCollection();
m_customObjectiveFunctions->objectiveFunctionChanged.connect( this, &RimEnsembleCurveSet::onObjectiveFunctionChanged ); m_customObjectiveFunctions->objectiveFunctionChanged.connect( this, &RimEnsembleCurveSet::onObjectiveFunctionChanged );
m_customObjectiveFunctions->objectiveFunctionAboutToBeDeleted
.connect( this, &RimEnsembleCurveSet::onObjectiveFunctionAboutToBeDeleted );
CAF_PDM_InitFieldNoDefault( &m_statistics, "Statistics", "Statistics", "", "", "" ); CAF_PDM_InitFieldNoDefault( &m_statistics, "Statistics", "Statistics", "", "", "" );
m_statistics = new RimEnsembleStatistics(); m_statistics = new RimEnsembleStatistics();
@ -914,27 +912,12 @@ void RimEnsembleCurveSet::updateMaxMinAndDefaultValues()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimEnsembleCurveSet::onObjectiveFunctionChanged( const caf::SignalEmitter* emitter, void RimEnsembleCurveSet::onObjectiveFunctionChanged( const caf::SignalEmitter* emitter )
RimCustomObjectiveFunction* objectiveFunction )
{ {
updateCurveColors(); updateCurveColors();
updateFilterLegend(); updateFilterLegend();
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEnsembleCurveSet::onObjectiveFunctionAboutToBeDeleted( const caf::SignalEmitter* emitter,
RimCustomObjectiveFunction* objectiveFunction )
{
if ( objectiveFunction == m_customObjectiveFunction )
{
m_customObjectiveFunction = nullptr;
}
updateCurveColors();
updateFilterLegend();
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -183,9 +183,7 @@ private:
void updateTimeAnnotations(); void updateTimeAnnotations();
void updateAddressesUiField(); void updateAddressesUiField();
void onObjectiveFunctionChanged( const caf::SignalEmitter* emitter, RimCustomObjectiveFunction* objectiveFunction ); void onObjectiveFunctionChanged( const caf::SignalEmitter* emitter );
void onObjectiveFunctionAboutToBeDeleted( const caf::SignalEmitter* emitter,
RimCustomObjectiveFunction* objectiveFunction );
private: private:
caf::PdmField<bool> m_showCurves; caf::PdmField<bool> m_showCurves;