29 #include "../common/WAssert.h"
30 #include "../graphicsEngine/WGraphicsEngine.h"
31 #include "WROIManager.h"
46 toBranch->addRoi( newRoi );
48 for( std::list< std::shared_ptr< boost::function<
void( osg::ref_ptr< WROI > ) > > >::iterator iter =
m_addNotifiers.begin();
63 std::shared_ptr< WRMBranch > newBranch(
new WRMBranch( shared_from_this() ) );
74 std::shared_ptr< WRMBranch > branch;
75 for( std::list< std::shared_ptr< WRMBranch > >::iterator iter =
m_branches.begin(); iter !=
m_branches.end(); ++iter )
77 if( ( *iter ).get()->contains( parentRoi ) )
83 branch->addRoi( newRoi );
85 for( std::list< std::shared_ptr< boost::function<
void( osg::ref_ptr< WROI > ) > > >::iterator iter =
m_addNotifiers.begin();
96 for( std::list< std::shared_ptr< WRMBranch > >::iterator iter =
m_branches.begin(); iter !=
m_branches.end(); ++iter )
98 ( *iter )->removeRoi( roi );
100 if( ( *iter )->empty() )
102 for( std::list< std::shared_ptr< boost::function<
void( std::shared_ptr< WRMBranch > ) > > >::iterator iter2
107 ( **iter2 )( *iter );
115 for( std::list< std::shared_ptr< boost::function<
void( osg::ref_ptr< WROI > ) > > >::iterator iter
126 for( std::list< std::shared_ptr< WRMBranch > >::iterator iter =
m_branches.begin(); iter !=
m_branches.end(); ++iter )
128 if( roi == ( *iter )->getFirstRoi() )
130 ( *iter )->removeAllRois();
133 if( ( *iter )->empty() )
135 for( std::list< std::shared_ptr< boost::function<
void( std::shared_ptr< WRMBranch > ) > > >::iterator iter2
140 ( **iter2 )( *iter );
151 std::shared_ptr< WRMBranch> branch;
153 for( std::list< std::shared_ptr< WRMBranch > >::iterator iter =
m_branches.begin(); iter !=
m_branches.end(); ++iter )
155 if( ( *iter )->contains( roi ) )
169 void WROIManager::addAddNotifier( std::shared_ptr< boost::function<
void( osg::ref_ptr< WROI > ) > > notifier )
171 std::unique_lock< std::shared_mutex > lock;
177 void WROIManager::removeAddNotifier( std::shared_ptr< boost::function<
void( osg::ref_ptr< WROI > ) > > notifier )
179 std::unique_lock< std::shared_mutex > lock;
181 std::list< std::shared_ptr< boost::function< void( osg::ref_ptr< WROI > ) > > >::iterator it;
190 void WROIManager::addRemoveNotifier( std::shared_ptr< boost::function<
void( osg::ref_ptr< WROI > ) > > notifier )
192 std::unique_lock< std::shared_mutex > lock;
198 void WROIManager::removeRemoveNotifier( std::shared_ptr< boost::function<
void( osg::ref_ptr< WROI > ) > > notifier )
200 std::unique_lock< std::shared_mutex > lock;
202 std::list< std::shared_ptr< boost::function< void( osg::ref_ptr< WROI > ) > > >::iterator it;
211 void WROIManager::addRemoveBranchNotifier( std::shared_ptr< boost::function<
void( std::shared_ptr< WRMBranch > ) > > notifier )
213 std::unique_lock< std::shared_mutex > lock;
219 void WROIManager::removeRemoveBranchNotifier( std::shared_ptr< boost::function<
void( std::shared_ptr< WRMBranch > ) > > notifier )
221 std::unique_lock< std::shared_mutex > lock;
223 std::list< std::shared_ptr< boost::function< void( std::shared_ptr< WRMBranch > ) > > >::iterator it;
247 for( std::list< std::shared_ptr< WRMBranch > >::const_iterator iter =
m_branches.begin(); iter !=
m_branches.end(); ++iter )
249 ( *iter )->getRois( returnVec );
260 for( std::list< std::shared_ptr< WRMBranch > >::const_iterator iter =
m_branches.begin(); iter !=
m_branches.end(); ++iter )
262 returnVec.push_back( *iter );
static std::shared_ptr< WGraphicsEngine > getGraphicsEngine()
Returns instance of the graphics engine.
Class to manage properties of an object and to provide convenience methods for easy access and manipu...
implements a branch in the tree like structure for rois
std::list< std::shared_ptr< WRMBranch > > m_branches
list of branches in the logical tree structure
std::shared_ptr< WProperties > m_properties
The property object for the module.
std::list< std::shared_ptr< boost::function< void(osg::ref_ptr< WROI >) > > > m_removeNotifiers
The notifiers connected to removed rois by default.
void setSelectedRoi(osg::ref_ptr< WROI > roi)
setter
std::shared_ptr< WRMBranch > getBranch(osg::ref_ptr< WROI > roi)
getter returns the branch item the roi is in
std::list< std::shared_ptr< boost::function< void(std::shared_ptr< WRMBranch >) > > > m_removeBranchNotifiers
The notifiers connected to removed rois by default.
std::vector< std::shared_ptr< WRMBranch > > Branches
Branches list.
void setDirty()
sets the dirty flag which will cause recalculation of the bit field
WPropBool m_dirty
dirty flag
std::vector< osg::ref_ptr< WROI > > ROIs
ROI list.
WROIManager()
standard constructor
std::shared_ptr< WRMBranch > addBranch()
Add a new branch.
void removeBranch(osg::ref_ptr< WROI > roi)
removes a branch
ROIs getRois() const
getter
Branches getBranches() const
Get a copy of the current branch list.
void removeRoi(osg::ref_ptr< WROI > roi)
removes a roi
osg::ref_ptr< WROI > getSelectedRoi()
getter
osg::ref_ptr< WROI > m_selectedRoi
stores a pointer to the currently selected roi
std::list< std::shared_ptr< boost::function< void(osg::ref_ptr< WROI >) > > > m_addNotifiers
The notifiers connected to added rois by default.
void addRoi(osg::ref_ptr< WROI > newRoi)
Adds a new main ROI.
std::shared_mutex m_associatedNotifiersLock
Lock for associated notifiers set.