Commit fd6d98bb authored by Alexander Wiebel's avatar Alexander Wiebel

[FIX #455] works for one ROI now

parent 285c33d6
......@@ -43,7 +43,7 @@ WFiberSelector::WFiberSelector( boost::shared_ptr< const WDataSetFibers > fibers
for ( size_t i = 0; i < rois.size(); ++i )
{
slotAddRoi( rois[i] );
rois[i].get()->getProperties()->getProperty( "Dirty" )->toPropBool()->set( true );
( rois[i] )->getProperties()->getProperty( "Dirty" )->toPropBool()->set( true );
}
m_assocRoiSignal =
......@@ -68,6 +68,16 @@ WFiberSelector::~WFiberSelector()
WKernel::getRunningKernel()->getRoiManager()->removeAddNotifier( m_assocRoiSignal );
WKernel::getRunningKernel()->getRoiManager()->removeRemoveNotifier( m_removeRoiSignal );
WKernel::getRunningKernel()->getRoiManager()->removeRemoveBranchNotifier( m_removeBranchSignal );
// We need the following because not all ROIs are removed per slot below
for ( std::list< boost::shared_ptr< WSelectorBranch > >::iterator iter = m_branches.begin(); iter != m_branches.end(); ++iter )
{
std::list< boost::shared_ptr< WSelectorRoi > > rois = ( *iter )->getROIs();
for ( std::list< boost::shared_ptr< WSelectorRoi > >::iterator roiIter = rois.begin(); roiIter != rois.end(); ++roiIter )
{
( *roiIter )->getRoi()->removeChangeNotifier( m_changeRoiSignal );
}
}
}
void WFiberSelector::slotAddRoi( osg::ref_ptr< WROI > roi )
......@@ -81,7 +91,7 @@ void WFiberSelector::slotAddRoi( osg::ref_ptr< WROI > roi )
branch = ( *iter );
}
}
if ( !( branch.get() ) )
if ( !branch )
{
branch = boost::shared_ptr<WSelectorBranch>(
new WSelectorBranch( m_fibers, WKernel::getRunningKernel()->getRoiManager()->getBranch( roi ) ) );
......
......@@ -43,6 +43,12 @@ WSelectorBranch::WSelectorBranch( boost::shared_ptr< const WDataSetFibers > fibe
WSelectorBranch::~WSelectorBranch()
{
m_branch->removeChangeNotifier( m_changeSignal );
// We need the following because not all ROIs are removed per slot below
for ( std::list< boost::shared_ptr< WSelectorRoi > >::iterator roiIter = m_rois.begin(); roiIter != m_rois.end(); ++roiIter )
{
( *roiIter )->getRoi()->removeChangeNotifier( m_changeRoiSignal );
}
}
void WSelectorBranch::addRoi( boost::shared_ptr< WSelectorRoi > roi )
......@@ -54,10 +60,14 @@ void WSelectorBranch::addRoi( boost::shared_ptr< WSelectorRoi > roi )
roi->getRoi()->addChangeNotifier( m_changeRoiSignal );
}
std::list< boost::shared_ptr< WSelectorRoi > > WSelectorBranch::getROIs()
{
return m_rois;
}
void WSelectorBranch::setDirty()
{
m_dirty = true;
if ( m_branch->getProperties()->getProperty( "Bundle Color" )->toPropColor()->changed() )
{
colorChanged();
......@@ -66,6 +76,7 @@ void WSelectorBranch::setDirty()
void WSelectorBranch::removeRoi( osg::ref_ptr< WROI > roi )
{
roi->removeChangeNotifier( m_changeRoiSignal );
for( std::list< boost::shared_ptr< WSelectorRoi > >::iterator iter = m_rois.begin(); iter != m_rois.end(); ++iter )
{
if ( ( *iter )->getRoi() == roi )
......@@ -74,7 +85,6 @@ void WSelectorBranch::removeRoi( osg::ref_ptr< WROI > roi )
break;
}
}
roi->removeChangeNotifier( m_changeRoiSignal );
}
void WSelectorBranch::recalculate()
......
......@@ -67,6 +67,12 @@ public:
*/
void addRoi( boost::shared_ptr< WSelectorRoi > roi );
/**
* \return A copy of the list of WSelectorRois
*/
std::list< boost::shared_ptr< WSelectorRoi > > getROIs();
/**
* removes a roi fromt he branch
* \param roi
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment