OpenWalnut
1.4.0
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
src
core
graphicsEngine
WROI.h
1
//---------------------------------------------------------------------------
2
//
3
// Project: OpenWalnut ( http://www.openwalnut.org )
4
//
5
// Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
6
// For more information see http://www.openwalnut.org/copying
7
//
8
// This file is part of OpenWalnut.
9
//
10
// OpenWalnut is free software: you can redistribute it and/or modify
11
// it under the terms of the GNU Lesser General Public License as published by
12
// the Free Software Foundation, either version 3 of the License, or
13
// (at your option) any later version.
14
//
15
// OpenWalnut is distributed in the hope that it will be useful,
16
// but WITHOUT ANY WARRANTY; without even the implied warranty of
17
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
// GNU Lesser General Public License for more details.
19
//
20
// You should have received a copy of the GNU Lesser General Public License
21
// along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
22
//
23
//---------------------------------------------------------------------------
24
25
#ifndef WROI_H
26
#define WROI_H
27
28
#include <list>
29
#include <string>
30
31
#include <boost/signals2/signal.hpp>
32
#include <boost/signals2/connection.hpp>
33
34
#include <osg/Geode>
35
36
#include "../common/WProperties.h"
37
38
class
WPickHandler
;
39
40
/**
41
* Superclass for different ROI (region of interest) types.
42
*/
43
class
WROI
:
public
osg::Geode
44
{
45
public
:
46
/**
47
* Ref Pointer type.
48
*/
49
typedef
osg::ref_ptr< WROI >
RefPtr
;
50
51
WROI
();
52
53
/**
54
* Need virtual destructor because of virtual function.
55
*/
56
virtual
~WROI
();
57
58
/**
59
* sets the NOT flag
60
*
61
* \param isNot
62
*/
63
void
setNot
(
bool
isNot
=
true
);
64
65
/**
66
* getter for NOT flag
67
*
68
* \return the flag
69
*/
70
bool
isNot
();
71
72
/**
73
* getter
74
*
75
* \return the active flag
76
*/
77
bool
active
();
78
79
/**
80
* setter
81
*
82
* \param active
83
*/
84
void
setActive
(
bool
active
);
85
86
/**
87
* hides the roi in the scene
88
*/
89
void
hide
();
90
91
/**
92
* unhides the roi in the scene
93
*/
94
void
unhide
();
95
96
/**
97
* Getter for modified flag
98
* \return the dirty flag
99
*/
100
bool
dirty
();
101
102
/**
103
* sets the dirty flag
104
*/
105
void
setDirty
();
106
107
/**
108
* Getter
109
* \return the properties object for this roi
110
*/
111
boost::shared_ptr< WProperties >
getProperties
();
112
113
/**
114
* Add a specified notifier to the list of default notifiers which get connected to each roi.
115
*
116
* \param notifier the notifier function
117
*/
118
void
addROIChangeNotifier
( boost::shared_ptr< boost::function<
void
() > > notifier );
119
120
/**
121
* Remove a specified notifier from the list of default notifiers which get connected to each roi.
122
*
123
* \param notifier the notifier function
124
*/
125
void
removeROIChangeNotifier
( boost::shared_ptr< boost::function<
void
() > > notifier );
126
127
/**
128
* Invert property.
129
*
130
* \return the property
131
*/
132
WPropBool
invertProperty
();
133
134
/**
135
* The property for toggling ROI visibility.
136
*
137
* \return the property
138
*/
139
WPropBool
showProperty
();
140
141
/**
142
* The active property
143
*
144
* \return the property.
145
*/
146
WPropBool
activeProperty
();
147
148
/**
149
* The name property
150
*
151
* \return the property.
152
*/
153
WPropString
nameProperty
();
154
protected
:
155
/**
156
* initializes the roi's properties
157
*/
158
void
properties
();
159
160
/**
161
* callback when a property gets changed
162
*/
163
void
propertyChanged
();
164
165
/**
166
* signals a roi change to all subscribers
167
*/
168
void
signalRoiChange
();
169
170
171
osg::ref_ptr< WPickHandler >
m_pickHandler
;
//!< A pointer to the pick handler used to get gui events for moving the box.
172
173
/**
174
* the property object for the module
175
*/
176
boost::shared_ptr< WProperties >
m_properties
;
177
178
/**
179
* dirty flag, indicating the graphics needs updating, it is no longer used for bitfield updating
180
* since these customers get the update notification via callback
181
*/
182
WPropBool
m_dirty
;
183
184
/**
185
* indicates if the roi is active
186
*/
187
WPropBool
m_active
;
188
189
/**
190
* indicates if the roi is visible in the scene
191
*/
192
WPropBool
m_show
;
193
194
/**
195
* indicates if the roi is negated
196
*/
197
WPropBool
m_not
;
198
199
/**
200
* name of the ROI.
201
*/
202
WPropString
m_name
;
203
204
/**
205
* threshold for an arbitrary roi
206
*/
207
WPropDouble
m_threshold
;
208
209
/**
210
* A color for painting the roi in the scene
211
*/
212
WPropColor
m_color
;
213
214
/**
215
* The notifiers connected to added rois by default.
216
*/
217
std::list< boost::shared_ptr< boost::function< void() > > >
m_changeNotifiers
;
218
219
220
/**
221
* Lock for associated notifiers set.
222
*/
223
boost::shared_mutex
m_associatedNotifiersLock
;
224
225
private
:
226
/**
227
* updates the graphics
228
*/
229
virtual
void
updateGFX
() = 0;
230
};
231
232
#endif // WROI_H
Generated by
1.8.3.1