mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Use signal to notify listeners when coordinates of a polygon changes
This commit is contained in:
@@ -90,18 +90,10 @@ RimPolygon* RimPolygonInView::polygon() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPolygonInView::setPolygon( RimPolygon* polygon )
|
||||
{
|
||||
if ( m_polygon )
|
||||
{
|
||||
m_polygon->objectChanged.disconnect( this );
|
||||
}
|
||||
|
||||
if ( polygon )
|
||||
{
|
||||
polygon->objectChanged.connect( this, &RimPolygonInView::onObjectChanged );
|
||||
}
|
||||
|
||||
m_polygon = polygon;
|
||||
|
||||
connectSignals();
|
||||
|
||||
updateTargetsFromPolygon();
|
||||
}
|
||||
|
||||
@@ -244,6 +236,18 @@ void RimPolygonInView::updatePolygonFromTargets()
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPolygonInView::connectSignals()
|
||||
{
|
||||
if ( m_polygon )
|
||||
{
|
||||
m_polygon->objectChanged.connect( this, &RimPolygonInView::onObjectChanged );
|
||||
m_polygon->coordinatesChanged.connect( this, &RimPolygonInView::onCoordinatesChanged );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -381,15 +385,23 @@ void RimPolygonInView::onObjectChanged( const caf::SignalEmitter* emitter )
|
||||
updateVisualization();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPolygonInView::onCoordinatesChanged( const caf::SignalEmitter* emitter )
|
||||
{
|
||||
updateTargetsFromPolygon();
|
||||
|
||||
updateConnectedEditors();
|
||||
updateVisualization();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPolygonInView::initAfterRead()
|
||||
{
|
||||
if ( m_polygon )
|
||||
{
|
||||
m_polygon->objectChanged.connect( this, &RimPolygonInView::onObjectChanged );
|
||||
}
|
||||
connectSignals();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user