00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef WROIMANAGER_H
00026 #define WROIMANAGER_H
00027
00028 #include <list>
00029 #include <vector>
00030
00031 #include <boost/enable_shared_from_this.hpp>
00032
00033 #include "WRMBranch.h"
00034
00035 #include "WExportKernel.h"
00036
00037
00038
00039
00040 class OWKERNEL_EXPORT WROIManager: public boost::enable_shared_from_this< WROIManager >
00041 {
00042 public:
00043
00044
00045
00046 WROIManager();
00047
00048
00049
00050
00051 ~WROIManager();
00052
00053
00054
00055
00056
00057
00058
00059 void addRoi( osg::ref_ptr< WROI > newRoi );
00060
00061
00062
00063
00064
00065
00066
00067
00068 void addRoi( osg::ref_ptr< WROI > newRoi, osg::ref_ptr< WROI > parentRoi );
00069
00070
00071
00072
00073
00074
00075 void removeRoi( osg::ref_ptr< WROI > roi );
00076
00077
00078
00079
00080
00081
00082 void removeBranch( osg::ref_ptr< WROI > roi );
00083
00084
00085
00086
00087
00088
00089
00090 boost::shared_ptr< WRMBranch> getBranch( osg::ref_ptr< WROI > roi );
00091
00092
00093
00094
00095 void setDirty();
00096
00097
00098
00099
00100
00101
00102 bool dirty( bool reset = false );
00103
00104
00105
00106
00107
00108
00109 void addAddNotifier( boost::shared_ptr< boost::function< void( osg::ref_ptr< WROI > ) > > notifier );
00110
00111
00112
00113
00114
00115
00116 void removeAddNotifier( boost::shared_ptr< boost::function< void( osg::ref_ptr< WROI > ) > > notifier );
00117
00118
00119
00120
00121
00122
00123
00124 void addRemoveNotifier( boost::shared_ptr< boost::function< void( osg::ref_ptr< WROI > ) > > notifier );
00125
00126
00127
00128
00129
00130
00131 void removeRemoveNotifier( boost::shared_ptr< boost::function< void( osg::ref_ptr< WROI > ) > > notifier );
00132
00133
00134
00135
00136
00137
00138 void addRemoveBranchNotifier( boost::shared_ptr< boost::function< void( boost::shared_ptr< WRMBranch > ) > > notifier );
00139
00140
00141
00142
00143
00144
00145 void removeRemoveBranchNotifier( boost::shared_ptr< boost::function< void( boost::shared_ptr< WRMBranch > ) > > notifier );
00146
00147
00148
00149
00150
00151 void setSelectedRoi( osg::ref_ptr< WROI > roi );
00152
00153
00154
00155
00156
00157
00158 osg::ref_ptr< WROI > getSelectedRoi();
00159
00160
00161
00162
00163
00164 boost::shared_ptr< WProperties > getProperties();
00165
00166
00167
00168
00169
00170 std::vector< osg::ref_ptr< WROI > > getRois();
00171
00172 protected:
00173 private:
00174 size_t m_size;
00175
00176 std::list< boost::shared_ptr< WRMBranch > > m_branches;
00177
00178
00179
00180
00181 boost::shared_mutex m_associatedNotifiersLock;
00182
00183
00184
00185
00186 std::list< boost::shared_ptr< boost::function< void( osg::ref_ptr< WROI > ) > > > m_addNotifiers;
00187
00188
00189
00190
00191 std::list< boost::shared_ptr< boost::function< void( osg::ref_ptr< WROI > ) > > > m_removeNotifiers;
00192
00193
00194
00195
00196 std::list< boost::shared_ptr< boost::function< void( boost::shared_ptr< WRMBranch > ) > > > m_removeBranchNotifiers;
00197
00198
00199 osg::ref_ptr< WROI > m_selectedRoi;
00200
00201
00202
00203
00204 boost::shared_ptr< WProperties > m_properties;
00205
00206
00207
00208
00209 WPropBool m_dirty;
00210 };
00211
00212 inline bool WROIManager::dirty( bool reset )
00213 {
00214 bool ret = m_dirty->get();
00215 if( reset )
00216 {
00217 m_dirty->set( false );
00218 }
00219 return ret;
00220 }
00221
00222 inline boost::shared_ptr< WProperties > WROIManager::getProperties()
00223 {
00224 return m_properties;
00225 }
00226
00227 #endif // WROIMANAGER_H