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 WRMBRANCH_H
00026 #define WRMBRANCH_H
00027
00028 #include <list>
00029 #include <string>
00030 #include <vector>
00031
00032 #include <boost/enable_shared_from_this.hpp>
00033
00034 #include "../common/WProperties.h"
00035
00036 #include "../graphicsEngine/WROI.h"
00037
00038 #include "WExportKernel.h"
00039
00040 class WROIManager;
00041
00042
00043
00044
00045 class OWKERNEL_EXPORT WRMBranch : public boost::enable_shared_from_this< WRMBranch >
00046 {
00047 public:
00048
00049
00050
00051
00052 explicit WRMBranch( boost::shared_ptr< WROIManager > roiManager );
00053
00054
00055
00056
00057 ~WRMBranch();
00058
00059
00060
00061
00062
00063
00064 void addRoi( osg::ref_ptr< WROI > roi );
00065
00066
00067
00068
00069
00070
00071 void removeRoi( osg::ref_ptr< WROI > roi );
00072
00073
00074
00075
00076
00077 void removeAllRois();
00078
00079
00080
00081
00082
00083
00084
00085 bool dirty( bool reset = false );
00086
00087
00088
00089
00090 void setDirty();
00091
00092
00093
00094
00095
00096
00097 bool empty();
00098
00099
00100
00101
00102
00103
00104 bool contains( osg::ref_ptr< WROI > roi );
00105
00106
00107
00108
00109
00110
00111 osg::ref_ptr< WROI > getFirstRoi();
00112
00113
00114
00115
00116
00117
00118 boost::shared_ptr< WROIManager > getRoiManager();
00119
00120
00121
00122
00123
00124
00125 boost::shared_ptr< WProperties > getProperties();
00126
00127
00128
00129
00130
00131 bool isNot();
00132
00133
00134
00135
00136
00137 void getRois( std::vector< osg::ref_ptr< WROI > >& roiVec );
00138
00139
00140
00141
00142
00143
00144 void addChangeNotifier( boost::shared_ptr< boost::function< void() > > notifier );
00145
00146
00147
00148
00149
00150
00151
00152 void removeChangeNotifier( boost::shared_ptr< boost::function< void() > > notifier );
00153
00154
00155 protected:
00156
00157
00158
00159 void properties();
00160
00161
00162
00163
00164
00165 void propertyChanged();
00166 private:
00167 boost::shared_ptr< WROIManager > m_roiManager;
00168
00169 std::list< osg::ref_ptr< WROI > > m_rois;
00170
00171
00172
00173
00174 boost::shared_ptr< WProperties > m_properties;
00175
00176 WPropBool m_dirty;
00177
00178
00179
00180
00181 WPropBool m_isNot;
00182
00183
00184
00185
00186 WPropColor m_bundleColor;
00187
00188
00189
00190
00191 std::list< boost::shared_ptr< boost::function< void() > > > m_changeNotifiers;
00192
00193 boost::shared_ptr< boost::function< void() > > m_changeRoiSignal;
00194
00195
00196
00197
00198 boost::shared_mutex m_associatedNotifiersLock;
00199 };
00200
00201 inline bool WRMBranch::empty()
00202 {
00203 return m_rois.empty();
00204 }
00205
00206 inline bool WRMBranch::dirty( bool reset )
00207 {
00208 bool ret = m_dirty->get();
00209 if( reset )
00210 {
00211 m_dirty->set( false );
00212 }
00213 return ret;
00214 }
00215
00216 inline bool WRMBranch::isNot()
00217 {
00218 return m_isNot->get();
00219 }
00220 #endif // WRMBRANCH_H