Commit 318244a6 authored by Alexander Wiebel's avatar Alexander Wiebel

[FIX #455] some of the crashes fixed by removing the notifiers that are not

used anymore. Needed to change them to shared_ptr for this
parent 5ecf920e
......@@ -118,17 +118,27 @@ void WROI::unhide()
void WROI::signalRoiChange()
{
for ( std::list< boost::function< void() > >::iterator iter = m_changeNotifiers.begin();
for ( std::list< boost::shared_ptr< boost::function< void() > > >::iterator iter = m_changeNotifiers.begin();
iter != m_changeNotifiers.end(); ++iter )
{
( *iter )();
( **iter )();
}
}
void WROI::addChangeNotifier( boost::function< void() > notifier )
void WROI::addChangeNotifier( boost::shared_ptr< boost::function< void() > > notifier )
{
boost::unique_lock< boost::shared_mutex > lock;
lock = boost::unique_lock< boost::shared_mutex >( m_associatedNotifiersLock );
m_changeNotifiers.push_back( notifier );
lock.unlock();
}
void WROI::removeChangeNotifier( boost::shared_ptr< boost::function< void() > > notifier )
{
boost::unique_lock< boost::shared_mutex > lock;
lock = boost::unique_lock< boost::shared_mutex >( m_associatedNotifiersLock );
std::list< boost::shared_ptr< boost::function< void() > > >::iterator it;
it = std::find( m_changeNotifiers.begin(), m_changeNotifiers.end(), notifier );
m_changeNotifiers.erase( it );
lock.unlock();
}
......@@ -46,20 +46,28 @@ WFiberSelector::WFiberSelector( boost::shared_ptr< const WDataSetFibers > fibers
rois[i].get()->getProperties()->getProperty( "Dirty" )->toPropBool()->set( true );
}
boost::function< void( osg::ref_ptr< WROI > ) > assocRoiSignal =
boost::bind( &WFiberSelector::slotAddRoi, this, _1 );
WKernel::getRunningKernel()->getRoiManager()->addAddNotifier( assocRoiSignal );
boost::function< void( osg::ref_ptr< WROI > ) > removeRoiSignal =
boost::bind( &WFiberSelector::slotRemoveRoi, this, _1 );
WKernel::getRunningKernel()->getRoiManager()->addRemoveNotifier( removeRoiSignal );
boost::function< void( boost::shared_ptr< WRMBranch > ) > removeBranchSignal =
boost::bind( &WFiberSelector::slotRemoveBranch, this, _1 );
WKernel::getRunningKernel()->getRoiManager()->addRemoveBranchNotifier( removeBranchSignal );
m_assocRoiSignal =
boost::shared_ptr< boost::function< void( osg::ref_ptr< WROI > ) > >(
new boost::function< void( osg::ref_ptr< WROI > ) > ( boost::bind( &WFiberSelector::slotAddRoi, this, _1 ) ) );
WKernel::getRunningKernel()->getRoiManager()->addAddNotifier( m_assocRoiSignal );
m_removeRoiSignal =
boost::shared_ptr< boost::function< void( osg::ref_ptr< WROI > ) > >(
new boost::function< void( osg::ref_ptr< WROI > ) > ( boost::bind( &WFiberSelector::slotRemoveRoi, this, _1 ) ) );
WKernel::getRunningKernel()->getRoiManager()->addRemoveNotifier( m_removeRoiSignal );
m_removeBranchSignal =
boost::shared_ptr< boost::function< void( boost::shared_ptr< WRMBranch > ) > >(
new boost::function< void( boost::shared_ptr< WRMBranch > ) > (
boost::bind( &WFiberSelector::slotRemoveBranch, this, _1 ) ) );
WKernel::getRunningKernel()->getRoiManager()->addRemoveBranchNotifier( m_removeBranchSignal );
}
WFiberSelector::~WFiberSelector()
{
WKernel::getRunningKernel()->getRoiManager()->removeAddNotifier( m_assocRoiSignal );
WKernel::getRunningKernel()->getRoiManager()->removeRemoveNotifier( m_removeRoiSignal );
WKernel::getRunningKernel()->getRoiManager()->removeRemoveBranchNotifier( m_removeBranchSignal );
}
void WFiberSelector::slotAddRoi( osg::ref_ptr< WROI > roi )
......@@ -84,14 +92,16 @@ void WFiberSelector::slotAddRoi( osg::ref_ptr< WROI > roi )
branch->addRoi( sroi );
boost::function< void() > changeRoiSignal = boost::bind( &WFiberSelector::setDirty, this );
sroi->getRoi()->addChangeNotifier( changeRoiSignal );
m_changeRoiSignal
= boost::shared_ptr< boost::function< void() > >( new boost::function< void() >( boost::bind( &WFiberSelector::setDirty, this ) ) );
sroi->getRoi()->addChangeNotifier( m_changeRoiSignal );
setDirty();
}
void WFiberSelector::slotRemoveRoi( osg::ref_ptr< WROI > roi )
{
roi->removeChangeNotifier( m_changeRoiSignal );
for ( std::list< boost::shared_ptr< WSelectorBranch > >::iterator iter = m_branches.begin(); iter != m_branches.end(); ++iter )
{
( *iter )->removeRoi( roi );
......
......@@ -127,6 +127,11 @@ private:
boost::shared_ptr< std::vector< bool > >m_workerBitfield; //!< bit field of activated fibers
std::list< boost::shared_ptr<WSelectorBranch> >m_branches; //!< list of branches int he roi structure
boost::shared_ptr< boost::function< void( osg::ref_ptr< WROI > ) > > m_assocRoiSignal; //!< Signal that can be used to update the selector
boost::shared_ptr< boost::function< void( osg::ref_ptr< WROI > ) > > m_removeRoiSignal; //!< Signal that can be used to update the selector
boost::shared_ptr< boost::function< void( boost::shared_ptr< WRMBranch > ) > > m_removeBranchSignal; //!< Signal for updating the selector
boost::shared_ptr< boost::function< void() > > m_changeRoiSignal; //!< Signal that can be used to update the selector
};
inline size_t WFiberSelector::size()
......
......@@ -61,8 +61,8 @@ void WRMBranch::propertyChanged()
void WRMBranch::addRoi( osg::ref_ptr< WROI > roi )
{
m_rois.push_back( roi );
boost::function< void() > changeRoiSignal = boost::bind( &WRMBranch::setDirty, this );
roi->addChangeNotifier( changeRoiSignal );
m_changeRoiSignal = boost::shared_ptr< boost::function< void() > >( new boost::function< void() >( boost::bind( &WRMBranch::setDirty, this ) ) );
roi->addChangeNotifier( m_changeRoiSignal );
setDirty();
}
......@@ -81,6 +81,7 @@ bool WRMBranch::contains( osg::ref_ptr< WROI > roi )
void WRMBranch::removeRoi( osg::ref_ptr< WROI > roi )
{
roi->removeChangeNotifier( m_changeRoiSignal );
for( std::list< osg::ref_ptr< WROI > >::iterator iter = m_rois.begin(); iter != m_rois.end(); ++iter )
{
if ( ( *iter ) == roi )
......@@ -115,10 +116,10 @@ void WRMBranch::setDirty()
m_dirty->set( true );
m_roiManager->setDirty();
for ( std::list< boost::function< void() > >::iterator iter = m_changeNotifiers.begin();
for ( std::list< boost::shared_ptr< boost::function< void() > > >::iterator iter = m_changeNotifiers.begin();
iter != m_changeNotifiers.end(); ++iter )
{
( *iter )();
( **iter )();
}
}
......@@ -137,10 +138,20 @@ boost::shared_ptr< WProperties > WRMBranch::getProperties()
return m_properties;
}
void WRMBranch::addChangeNotifier( boost::function< void() > notifier )
void WRMBranch::addChangeNotifier( boost::shared_ptr< boost::function< void() > > notifier )
{
boost::unique_lock< boost::shared_mutex > lock;
lock = boost::unique_lock< boost::shared_mutex >( m_associatedNotifiersLock );
m_changeNotifiers.push_back( notifier );
lock.unlock();
}
void WRMBranch::removeChangeNotifier( boost::shared_ptr< boost::function< void() > > notifier )
{
boost::unique_lock< boost::shared_mutex > lock;
lock = boost::unique_lock< boost::shared_mutex >( m_associatedNotifiersLock );
std::list< boost::shared_ptr< boost::function< void() > > >::iterator it;
it = std::find( m_changeNotifiers.begin(), m_changeNotifiers.end(), notifier );
m_changeNotifiers.erase( it );
lock.unlock();
}
......@@ -137,7 +137,15 @@ public:
*
* \param notifier the notifier function
*/
void addChangeNotifier( boost::function< void() > notifier );
void addChangeNotifier( boost::shared_ptr< boost::function< void() > > notifier );
/**
* Remove a specified notifier from the list of default notifiers which get connected to each branch
*
* \param notifier the notifier function
*/
void removeChangeNotifier( boost::shared_ptr< boost::function< void() > > notifier );
protected:
......@@ -176,7 +184,9 @@ private:
/**
* The notifiers connected to added rois by default.
*/
std::list< boost::function< void() > > m_changeNotifiers;
std::list< boost::shared_ptr< boost::function< void() > > > m_changeNotifiers;
boost::shared_ptr< boost::function< void() > > m_changeRoiSignal; //!< Signal that can be used to update the ROImanager branch
/**
* Lock for associated notifiers set.
......
......@@ -50,10 +50,10 @@ void WROIManager::addRoi( osg::ref_ptr< WROI > newRoi )
// add roi to branch
newBranch->addRoi( newRoi );
for ( std::list< boost::function< void( osg::ref_ptr< WROI > ) > >::iterator iter = m_addNotifiers.begin();
for ( std::list< boost::shared_ptr< boost::function< void( osg::ref_ptr< WROI > ) > > >::iterator iter = m_addNotifiers.begin();
iter != m_addNotifiers.end(); ++iter )
{
( *iter )( newRoi );
( **iter )( newRoi );
}
}
......@@ -71,10 +71,10 @@ void WROIManager::addRoi( osg::ref_ptr< WROI > newRoi, osg::ref_ptr< WROI > pare
// add roi to branch
branch->addRoi( newRoi );
for ( std::list< boost::function< void( osg::ref_ptr< WROI > ) > >::iterator iter = m_addNotifiers.begin();
for ( std::list< boost::shared_ptr< boost::function< void( osg::ref_ptr< WROI > ) > > >::iterator iter = m_addNotifiers.begin();
iter != m_addNotifiers.end(); ++iter )
{
( *iter )( newRoi );
( **iter )( newRoi );
}
}
......@@ -86,12 +86,14 @@ void WROIManager::removeRoi( osg::ref_ptr< WROI > roi )
{
( *iter )->removeRoi( roi );
if ( (*iter )->empty() )
if ( ( *iter )->empty() )
{
for ( std::list< boost::function< void( boost::shared_ptr< WRMBranch > ) > >::iterator iter2 = m_removeBranchNotifiers.begin();
iter2 != m_removeBranchNotifiers.end(); ++iter2 )
for ( std::list< boost::shared_ptr< boost::function< void( boost::shared_ptr< WRMBranch > ) > > >::iterator iter2
= m_removeBranchNotifiers.begin();
iter2 != m_removeBranchNotifiers.end();
++iter2 )
{
( *iter2 )( *iter );
( **iter2 )( *iter );
}
m_branches.erase( iter );
break;
......@@ -99,10 +101,12 @@ void WROIManager::removeRoi( osg::ref_ptr< WROI > roi )
}
setDirty();
for ( std::list< boost::function< void( osg::ref_ptr< WROI > ) > >::iterator iter = m_removeNotifiers.begin();
iter != m_removeNotifiers.end(); ++iter )
for ( std::list< boost::shared_ptr< boost::function< void( osg::ref_ptr< WROI > ) > > >::iterator iter
= m_removeNotifiers.begin();
iter != m_removeNotifiers.end();
++iter )
{
( *iter )( roi );
( **iter )( roi );
}
}
......@@ -115,12 +119,14 @@ void WROIManager::removeBranch( osg::ref_ptr< WROI > roi )
( *iter )->removeAllRois();
}
if ( (*iter )->empty() )
if ( ( *iter )->empty() )
{
for ( std::list< boost::function< void( boost::shared_ptr< WRMBranch > ) > >::iterator iter2 = m_removeBranchNotifiers.begin();
iter2 != m_removeBranchNotifiers.end(); ++iter2 )
for ( std::list< boost::shared_ptr< boost::function< void( boost::shared_ptr< WRMBranch > ) > > >::iterator iter2
= m_removeBranchNotifiers.begin();
iter2 != m_removeBranchNotifiers.end();
++iter2 )
{
( *iter2 )( *iter );
( **iter2 )( *iter );
}
m_branches.erase( iter );
break;
......@@ -148,7 +154,7 @@ void WROIManager::setDirty()
m_dirty->set( true );
}
void WROIManager::addAddNotifier( boost::function< void( osg::ref_ptr< WROI > ) > notifier )
void WROIManager::addAddNotifier( boost::shared_ptr< boost::function< void( osg::ref_ptr< WROI > ) > > notifier )
{
boost::unique_lock< boost::shared_mutex > lock;
lock = boost::unique_lock< boost::shared_mutex >( m_associatedNotifiersLock );
......@@ -156,7 +162,17 @@ void WROIManager::addAddNotifier( boost::function< void( osg::ref_ptr< WROI > )
lock.unlock();
}
void WROIManager::addRemoveNotifier( boost::function< void( osg::ref_ptr< WROI > ) > notifier )
void WROIManager::removeAddNotifier( boost::shared_ptr< boost::function< void( osg::ref_ptr< WROI > ) > > notifier )
{
boost::unique_lock< boost::shared_mutex > lock;
lock = boost::unique_lock< boost::shared_mutex >( m_associatedNotifiersLock );
std::list< boost::shared_ptr< boost::function< void( osg::ref_ptr< WROI > ) > > >::iterator it;
it = std::find( m_addNotifiers.begin(), m_addNotifiers.end(), notifier );
m_addNotifiers.erase( it );
lock.unlock();
}
void WROIManager::addRemoveNotifier( boost::shared_ptr< boost::function< void( osg::ref_ptr< WROI > ) > > notifier )
{
boost::unique_lock< boost::shared_mutex > lock;
lock = boost::unique_lock< boost::shared_mutex >( m_associatedNotifiersLock );
......@@ -164,7 +180,17 @@ void WROIManager::addRemoveNotifier( boost::function< void( osg::ref_ptr< WROI >
lock.unlock();
}
void WROIManager::addRemoveBranchNotifier( boost::function< void( boost::shared_ptr< WRMBranch > ) > notifier )
void WROIManager::removeRemoveNotifier( boost::shared_ptr< boost::function< void( osg::ref_ptr< WROI > ) > > notifier )
{
boost::unique_lock< boost::shared_mutex > lock;
lock = boost::unique_lock< boost::shared_mutex >( m_associatedNotifiersLock );
std::list< boost::shared_ptr< boost::function< void( osg::ref_ptr< WROI > ) > > >::iterator it;
it = std::find( m_removeNotifiers.begin(), m_removeNotifiers.end(), notifier );
m_removeNotifiers.erase( it );
lock.unlock();
}
void WROIManager::addRemoveBranchNotifier( boost::shared_ptr< boost::function< void( boost::shared_ptr< WRMBranch > ) > > notifier )
{
boost::unique_lock< boost::shared_mutex > lock;
lock = boost::unique_lock< boost::shared_mutex >( m_associatedNotifiersLock );
......@@ -172,6 +198,16 @@ void WROIManager::addRemoveBranchNotifier( boost::function< void( boost::shared_
lock.unlock();
}
void WROIManager::removeRemoveBranchNotifier( boost::shared_ptr< boost::function< void( boost::shared_ptr< WRMBranch > ) > > notifier )
{
boost::unique_lock< boost::shared_mutex > lock;
lock = boost::unique_lock< boost::shared_mutex >( m_associatedNotifiersLock );
std::list< boost::shared_ptr< boost::function< void( boost::shared_ptr< WRMBranch > ) > > >::iterator it;
it = std::find( m_removeBranchNotifiers.begin(), m_removeBranchNotifiers.end(), notifier );
m_removeBranchNotifiers.erase( it );
lock.unlock();
}
void WROIManager::setSelectedRoi( osg::ref_ptr< WROI > roi )
{
m_selectedRoi = roi;
......
......@@ -106,21 +106,43 @@ public:
*
* \param notifier the notifier function
*/
void addAddNotifier( boost::function< void( osg::ref_ptr< WROI > ) > notifier );
void addAddNotifier( boost::shared_ptr< boost::function< void( osg::ref_ptr< WROI > ) > > notifier );
/**
* Remove a specified notifier from the list of default notifiers which get connected to each added roi.
*
* \param notifier the notifier function
*/
void removeAddNotifier( boost::shared_ptr< boost::function< void( osg::ref_ptr< WROI > ) > > notifier );
/**
* Add a specified notifier to the list of default notifiers which get connected to each removed roi.
*
* \param notifier the notifier function
*/
void addRemoveNotifier( boost::function< void( osg::ref_ptr< WROI > ) > notifier );
void addRemoveNotifier( boost::shared_ptr< boost::function< void( osg::ref_ptr< WROI > ) > > notifier );
/**
* Remove a specified notifier from the list of default notifiers which get connected to each removed roi.
*
* \param notifier the notifier function
*/
void removeRemoveNotifier( boost::shared_ptr< boost::function< void( osg::ref_ptr< WROI > ) > > notifier );
/**
* Add a specified notifier to the list of default notifiers which get connected to each removed branch.
*
* \param notifier the notifier function
*/
void addRemoveBranchNotifier( boost::function< void( boost::shared_ptr< WRMBranch > ) > notifier );
void addRemoveBranchNotifier( boost::shared_ptr< boost::function< void( boost::shared_ptr< WRMBranch > ) > > notifier );
/**
* Remove a specified notifier from the list of default notifiers which get connected to each removed branch.
*
* \param notifier the notifier function
*/
void removeRemoveBranchNotifier( boost::shared_ptr< boost::function< void( boost::shared_ptr< WRMBranch > ) > > notifier );
/**
* setter
......@@ -164,17 +186,17 @@ private:
/**
* The notifiers connected to added rois by default.
*/
std::list< boost::function< void( osg::ref_ptr< WROI > ) > > m_addNotifiers;
std::list< boost::shared_ptr< boost::function< void( osg::ref_ptr< WROI > ) > > > m_addNotifiers;
/**
* The notifiers connected to removed rois by default.
*/
std::list< boost::function< void( osg::ref_ptr< WROI > ) > > m_removeNotifiers;
std::list< boost::shared_ptr< boost::function< void( osg::ref_ptr< WROI > ) > > > m_removeNotifiers;
/**
* The notifiers connected to removed rois by default.
*/
std::list< boost::function< void( boost::shared_ptr< WRMBranch > ) > > m_removeBranchNotifiers;
std::list< boost::shared_ptr< boost::function< void( boost::shared_ptr< WRMBranch > ) > > > m_removeBranchNotifiers;
osg::ref_ptr< WROI > m_selectedRoi; //!< stores a pointer to the currently selected roi
......
......@@ -35,20 +35,23 @@ WSelectorBranch::WSelectorBranch( boost::shared_ptr< const WDataSetFibers > fibe
{
m_bitField = boost::shared_ptr< std::vector<bool> >( new std::vector<bool>( m_size, false ) );
boost::function< void() > changeSignal = boost::bind( &WSelectorBranch::setDirty, this );
m_branch->addChangeNotifier( changeSignal );
m_changeSignal =
boost::shared_ptr< boost::function< void() > >( new boost::function< void() >( boost::bind( &WSelectorBranch::setDirty, this ) ) );
m_branch->addChangeNotifier( m_changeSignal );
}
WSelectorBranch::~WSelectorBranch()
{
m_branch->removeChangeNotifier( m_changeSignal );
}
void WSelectorBranch::addRoi( boost::shared_ptr< WSelectorRoi> roi )
void WSelectorBranch::addRoi( boost::shared_ptr< WSelectorRoi > roi )
{
m_rois.push_back( roi );
boost::function< void() > changeRoiSignal = boost::bind( &WSelectorBranch::setDirty, this );
roi->getRoi()->addChangeNotifier( changeRoiSignal );
m_changeRoiSignal =
boost::shared_ptr< boost::function< void() > >( new boost::function< void() >( boost::bind( &WSelectorBranch::setDirty, this ) ) );
roi->getRoi()->addChangeNotifier( m_changeRoiSignal );
}
void WSelectorBranch::setDirty()
......@@ -71,6 +74,7 @@ void WSelectorBranch::removeRoi( osg::ref_ptr< WROI > roi )
break;
}
}
roi->removeChangeNotifier( m_changeRoiSignal );
}
void WSelectorBranch::recalculate()
......
......@@ -133,6 +133,9 @@ private:
* pointer to the branch object in the roi manager
*/
boost::shared_ptr< WRMBranch > m_branch;
boost::shared_ptr< boost::function< void() > > m_changeSignal; //!< Signal that can be used to update the selector branch
boost::shared_ptr< boost::function< void() > > m_changeRoiSignal; //!< Signal that can be used to update the selector branch
};
inline boost::shared_ptr< std::vector<bool> > WSelectorBranch::getBitField()
......
......@@ -43,12 +43,14 @@ WSelectorRoi::WSelectorRoi( osg::ref_ptr< WROI > roi, boost::shared_ptr< const W
m_currentArray = m_fibers->getVertices();
m_currentReverse = m_fibers->getVerticesReverse();
boost::function< void() > changeRoiSignal = boost::bind( &WSelectorRoi::setDirty, this );
m_roi->addChangeNotifier( changeRoiSignal );
m_changeRoiSignal
= boost::shared_ptr< boost::function< void() > >( new boost::function< void() >( boost::bind( &WSelectorRoi::setDirty, this ) ) );
m_roi->addChangeNotifier( m_changeRoiSignal );
}
WSelectorRoi::~WSelectorRoi()
{
m_roi->removeChangeNotifier( m_changeRoiSignal );
}
void WSelectorRoi::setDirty()
......
......@@ -141,6 +141,8 @@ private:
std::vector<float> m_boxMin; //!< lower boundary of the box, used for boxtest
std::vector<float> m_boxMax; //!< upper boundary of the box, used for boxtest
boost::shared_ptr< boost::function< void() > > m_changeRoiSignal; //!< Signal that can be used to update the selector ROI
};
inline boost::shared_ptr< std::vector<bool> > WSelectorRoi::getBitField()
......
......@@ -216,6 +216,10 @@ void WMArbitraryPlane::moduleMain()
WGraphicsEngine::getGraphicsEngine()->getScene()->remove( &( *m_s1 ) );
WGraphicsEngine::getGraphicsEngine()->getScene()->remove( &( *m_s2 ) );
m_s0->removeChangeNotifier( m_changeRoiSignal );
m_s1->removeChangeNotifier( m_changeRoiSignal );
m_s2->removeChangeNotifier( m_changeRoiSignal );
con.disconnect();
WKernel::getRunningKernel()->getGraphicsEngine()->getScene()->remove( m_rootNode );
......@@ -246,10 +250,11 @@ void WMArbitraryPlane::initPlane()
WGraphicsEngine::getGraphicsEngine()->getScene()->addChild( &( *m_s1 ) );
WGraphicsEngine::getGraphicsEngine()->getScene()->addChild( &( *m_s2 ) );
boost::function< void() > changeRoiSignal = boost::bind( &WMArbitraryPlane::setDirty, this );
m_s0->addChangeNotifier( changeRoiSignal );
m_s1->addChangeNotifier( changeRoiSignal );
m_s2->addChangeNotifier( changeRoiSignal );
m_changeRoiSignal
= boost::shared_ptr< boost::function< void() > >( new boost::function< void() >( boost::bind( &WMArbitraryPlane::setDirty, this ) ) );
m_s0->addChangeNotifier( m_changeRoiSignal );
m_s1->addChangeNotifier( m_changeRoiSignal );
m_s2->addChangeNotifier( m_changeRoiSignal );
}
void WMArbitraryPlane::updatePlane()
......
......@@ -252,6 +252,8 @@ private:
std::vector< osg::ref_ptr<osg::Uniform> > m_samplerUniforms;
osg::ref_ptr<osg::Uniform> m_showCompleteUniform; //!< Determines whether the slice should be drawn completely
boost::shared_ptr< boost::function< void() > > m_changeRoiSignal; //!< Signal that can be used to update the plane
};
#endif // WMARBITRARYPLANE_H
......@@ -165,18 +165,21 @@ void WMDatasetManipulator::init()
WGraphicsEngine::getGraphicsEngine()->getScene()->addChild( &( *m_knobRotCenter ) );
WGraphicsEngine::getGraphicsEngine()->getScene()->addChild( &( *m_knobRot ) );
boost::function< void() > changeRoiSignal = boost::bind( &WMDatasetManipulator::manipulatorMoved, this );
m_knobCenter->addChangeNotifier( changeRoiSignal );
m_knobx1->addChangeNotifier( changeRoiSignal );
m_knobx2->addChangeNotifier( changeRoiSignal );
m_knoby1->addChangeNotifier( changeRoiSignal );
m_knoby2->addChangeNotifier( changeRoiSignal );
m_knobz1->addChangeNotifier( changeRoiSignal );
m_knobz2->addChangeNotifier( changeRoiSignal );
boost::function< void() > changeRotRoiSignal = boost::bind( &WMDatasetManipulator::manipulatorRotMoved, this );
m_knobRotCenter->addChangeNotifier( changeRotRoiSignal );
m_knobRot->addChangeNotifier( changeRotRoiSignal );
using boost::function;
m_changeRoiSignal
= boost::shared_ptr< function< void() > >( new function< void() >( boost::bind( &WMDatasetManipulator::manipulatorMoved, this ) ) );
m_knobCenter->addChangeNotifier( m_changeRoiSignal );
m_knobx1->addChangeNotifier( m_changeRoiSignal );
m_knobx2->addChangeNotifier( m_changeRoiSignal );
m_knoby1->addChangeNotifier( m_changeRoiSignal );
m_knoby2->addChangeNotifier( m_changeRoiSignal );
m_knobz1->addChangeNotifier( m_changeRoiSignal );
m_knobz2->addChangeNotifier( m_changeRoiSignal );
m_changeRotRoiSignal
= boost::shared_ptr< function< void() > >( new function< void() >( boost::bind( &WMDatasetManipulator::manipulatorRotMoved, this ) ) );
m_knobRotCenter->addChangeNotifier( m_changeRotRoiSignal );
m_knobRot->addChangeNotifier( m_changeRotRoiSignal );
setManipulatorMode();
}
......@@ -455,5 +458,16 @@ void WMDatasetManipulator::moduleMain()
WDataHandler::getDefaultSubject()->getChangeCondition()->notify();
}
}
m_knobCenter->removeChangeNotifier( m_changeRoiSignal );
m_knobx1->removeChangeNotifier( m_changeRoiSignal );
m_knobx2->removeChangeNotifier( m_changeRoiSignal );
m_knoby1->removeChangeNotifier( m_changeRoiSignal );
m_knoby2->removeChangeNotifier( m_changeRoiSignal );
m_knobz1->removeChangeNotifier( m_changeRoiSignal );
m_knobz2->removeChangeNotifier( m_changeRoiSignal );
m_knobRotCenter->removeChangeNotifier( m_changeRotRoiSignal );
m_knobRot->removeChangeNotifier( m_changeRotRoiSignal );
}
......@@ -35,7 +35,7 @@
#include "../../kernel/WModuleInputData.h"
#include "../../kernel/WModuleOutputData.h"
/**
/**
* Someone should add some documentation here.
* Probably the best person would be the module's
* creator, i.e. "schurade".
......@@ -150,6 +150,8 @@ private:
*/
WPropBool m_rotationMode;
boost::shared_ptr< boost::function< void() > > m_changeRotRoiSignal; //!< Signal that can be used to update the rotation manipulator
boost::shared_ptr< boost::function< void() > > m_changeRoiSignal; //!< Signal that can be used to update the translation manipulator
boost::shared_ptr<WROISphere> m_knobCenter; //!< stores pointer to the center manipulator
boost::shared_ptr<WROISphere> m_knobx1; //!< stores pointer to manipulator 1
......
......@@ -202,6 +202,12 @@ void WMOverlayAtlas::moduleMain()
}
WKernel::getRunningKernel()->getGraphicsEngine()->getScene()->remove( m_rootNode );
m_s0->removeChangeNotifier( m_changeRoiSignal );
m_s1->removeChangeNotifier( m_changeRoiSignal );
m_s2->removeChangeNotifier( m_changeRoiSignal );
m_s3->removeChangeNotifier( m_changeRoiSignal );
m_s4->removeChangeNotifier( m_changeRoiSignal );
}
void WMOverlayAtlas::init()
......@@ -255,12 +261,13 @@ void WMOverlayAtlas::init()
WGraphicsEngine::getGraphicsEngine()->getScene()->addChild( &( *m_s3 ) );
WGraphicsEngine::getGraphicsEngine()->getScene()->addChild( &( *m_s4 ) );
boost::function< void() > changeRoiSignal = boost::bind( &WMOverlayAtlas::manipulatorMoved, this );
m_s0->addChangeNotifier( changeRoiSignal );
m_s1->addChangeNotifier( changeRoiSignal );
m_s2->addChangeNotifier( changeRoiSignal );
m_s3->addChangeNotifier( changeRoiSignal );
m_s4->addChangeNotifier( changeRoiSignal );
m_changeRoiSignal =
boost::shared_ptr< boost::function< void() > >( new boost::function< void() >( boost::bind( &WMOverlayAtlas::manipulatorMoved, this ) ) );
m_s0->addChangeNotifier( m_changeRoiSignal );
m_s1->addChangeNotifier( m_changeRoiSignal );
m_s2->addChangeNotifier( m_changeRoiSignal );
m_s3->addChangeNotifier( m_changeRoiSignal );
m_s4->addChangeNotifier( m_changeRoiSignal );
toggleManipulators();
}
......