OpenWalnut
1.3.1
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
39
40
41
class
WPickHandler
;
42
43
/**
44
* Superclass for different ROI (region of interest) types.
45
*/
46
class
WROI
:
public
osg::Geode
47
{
48
public
:
49
WROI
();
50
51
/**
52
* Need virtual destructor because of virtual function.
53
*/
54
virtual
~WROI
();
55
56
/**
57
* sets the NOT flag
58
*
59
* \param isNot
60
*/
61
void
setNot
(
bool
isNot
=
true
);
62
63
/**
64
* getter for NOT flag
65
*
66
* \return the flag
67
*/
68
bool
isNot
();
69
70
/**
71
* getter
72
*
73
* \return the active flag
74
*/
75
bool
active
();
76
77
/**
78
* setter
79
*
80
* \param active
81
*/
82
void
setActive
(
bool
active );
83
84
/**
85
* hides the roi in the scene
86
*/
87
void
hide
();
88
89
/**
90
* unhides the roi in the scene
91
*/
92
void
unhide
();
93
94
/**
95
* Getter for modified flag
96
* \return the dirty flag
97
*/
98
bool
dirty
();
99
100
/**
101
* sets the dirty flag
102
*/
103
void
setDirty
();
104
105
/**
106
* Getter
107
* \return the properties object for this roi
108
*/
109
boost::shared_ptr< WProperties >
getProperties
();
110
111
/**
112
* Add a specified notifier to the list of default notifiers which get connected to each roi.
113
*
114
* \param notifier the notifier function
115
*/
116
void
addROIChangeNotifier
( boost::shared_ptr< boost::function<
void
() > > notifier );
117
118
/**
119
* Remove a specified notifier from the list of default notifiers which get connected to each roi.
120
*
121
* \param notifier the notifier function
122
*/
123
void
removeROIChangeNotifier
( boost::shared_ptr< boost::function<
void
() > > notifier );
124
125
126
protected
:
127
/**
128
* initializes the roi's properties
129
*/
130
void
properties
();
131
132
/**
133
* callback when a property gets changed
134
*/
135
void
propertyChanged
();
136
137
/**
138
* signals a roi change to all subscribers
139
*/
140
void
signalRoiChange
();
141
142
143
osg::ref_ptr< WPickHandler >
m_pickHandler
;
//!< A pointer to the pick handler used to get gui events for moving the box.
144
145
/**
146
* the property object for the module
147
*/
148
boost::shared_ptr< WProperties >
m_properties
;
149
150
/**
151
* dirty flag, indicating the graphics needs updating, it is no longer used for bitfield updating
152
* since these customers get the update notification via callback
153
*/
154
WPropBool
m_dirty
;
155
156
/**
157
* indicates if the roi is active
158
*/
159
WPropBool
m_active
;
160
161
/**
162
* indicates if the roi is visible in the scene
163
*/
164
WPropBool
m_show
;
165
166
/**
167
* indicates if the roi is negated
168
*/
169
WPropBool
m_not
;
170
171
/**
172
* threshold for an arbitrary roi
173
*/
174
WPropDouble
m_threshold
;
175
176
/**
177
* A color for painting the roi in the scene
178
*/
179
WPropColor
m_color
;
180
181
/**
182
* The notifiers connected to added rois by default.
183
*/
184
std::list< boost::shared_ptr< boost::function< void() > > >
m_changeNotifiers
;
185
186
187
/**
188
* Lock for associated notifiers set.
189
*/
190
boost::shared_mutex
m_associatedNotifiersLock
;
191
192
private
:
193
/**
194
* updates the graphics
195
*/
196
virtual
void
updateGFX
() = 0;
197
};
198
199
#endif // WROI_H
Generated by
1.8.4