Point Cloud Library (PCL)
1.15.1
Toggle main menu visibility
Loading...
Searching...
No Matches
pcl
visualization
mouse_event.h
1
/*
2
* Software License Agreement (BSD License)
3
*
4
* Point Cloud Library (PCL) - www.pointclouds.org
5
* Copyright (c) 2011, Willow Garage, Inc.
6
* Copyright (c) 2012-, Open Perception, Inc.
7
*
8
* All rights reserved.
9
*
10
* Redistribution and use in source and binary forms, with or without
11
* modification, are permitted provided that the following conditions
12
* are met:
13
*
14
* * Redistributions of source code must retain the above copyright
15
* notice, this list of conditions and the following disclaimer.
16
* * Redistributions in binary form must reproduce the above
17
* copyright notice, this list of conditions and the following
18
* disclaimer in the documentation and/or other materials provided
19
* with the distribution.
20
* * Neither the name of the copyright holder(s) nor the names of its
21
* contributors may be used to endorse or promote products derived
22
* from this software without specific prior written permission.
23
*
24
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
25
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
26
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
27
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
28
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
29
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
30
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
31
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
32
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
34
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35
* POSSIBILITY OF SUCH DAMAGE.
36
*
37
*/
38
39
#pragma once
40
41
#include <pcl/visualization/keyboard_event.h>
42
43
namespace
pcl
44
{
45
namespace
visualization
46
{
47
class
MouseEvent
48
{
49
public
:
50
enum
Type
51
{
52
MouseMove
= 1,
53
MouseButtonPress
,
54
MouseButtonRelease
,
55
MouseScrollDown
,
56
MouseScrollUp
,
57
MouseDblClick
58
};
59
60
enum
MouseButton
61
{
62
NoButton
= 0,
63
LeftButton
,
64
MiddleButton
,
65
RightButton
,
66
VScroll
/*other buttons, scroll wheels etc. may follow*/
67
};
68
69
/** Constructor.
70
* \param[in] type event type
71
* \param[in] button The Button that causes the event
72
* \param[in] x x position of mouse pointer at that time where event got fired
73
* \param[in] y y position of mouse pointer at that time where event got fired
74
* \param[in] alt whether the ALT key was pressed at that time where event got fired
75
* \param[in] ctrl whether the CTRL key was pressed at that time where event got fired
76
* \param[in] shift whether the Shift key was pressed at that time where event got fired
77
* \param[in] selection_mode whether we are in selection mode
78
*/
79
inline
MouseEvent
(
const
Type
& type,
const
MouseButton
& button,
80
unsigned
int
x,
unsigned
int
y,
81
bool
alt,
bool
ctrl,
bool
shift,
82
bool
selection_mode =
false
);
83
84
/**
85
* \return type of mouse event
86
*/
87
inline
const
Type
&
88
getType
()
const
;
89
90
/**
91
* \brief Sets the mouse event type
92
*/
93
inline
void
94
setType
(
const
Type
& type);
95
96
/**
97
* \return the Button that caused the action
98
*/
99
inline
const
MouseButton
&
100
getButton
()
const
;
101
102
/** \brief Set the button that caused the event */
103
inline
void
104
setButton
(
const
MouseButton
& button);
105
106
/**
107
* \return the x position of the mouse pointer at that time where the event got fired
108
*/
109
inline
unsigned
int
110
getX
()
const
;
111
112
/**
113
* \return the y position of the mouse pointer at that time where the event got fired
114
*/
115
inline
unsigned
int
116
getY
()
const
;
117
118
/**
119
* \return returns the keyboard modifiers state at that time where the event got fired
120
*/
121
inline
unsigned
int
122
getKeyboardModifiers
()
const
;
123
124
/**
125
* \return selection mode status
126
*/
127
inline
bool
128
getSelectionMode
()
const
;
129
130
protected
:
131
Type
type_
;
132
MouseButton
button_
;
133
unsigned
int
pointer_x_
;
134
unsigned
int
pointer_y_
;
135
unsigned
int
key_state_
{0};
136
bool
selection_mode_
;
137
};
138
139
MouseEvent::MouseEvent
(
const
Type
& type,
const
MouseButton
& button,
140
unsigned
x,
unsigned
y,
141
bool
alt,
bool
ctrl,
bool
shift,
142
bool
selection_mode)
143
:
type_
(type)
144
,
button_
(button)
145
,
pointer_x_
(x)
146
,
pointer_y_
(y)
147
,
148
selection_mode_
(selection_mode)
149
{
150
if
(alt)
151
key_state_
=
KeyboardEvent::Alt
;
152
153
if
(ctrl)
154
key_state_
|=
KeyboardEvent::Ctrl
;
155
156
if
(shift)
157
key_state_
|=
KeyboardEvent::Shift
;
158
}
159
160
const
MouseEvent::Type
&
161
MouseEvent::getType
()
const
162
{
163
return
(
type_
);
164
}
165
166
void
167
MouseEvent::setType
(
const
Type
& type)
168
{
169
type_
= type;
170
}
171
172
const
MouseEvent::MouseButton
&
173
MouseEvent::getButton
()
const
174
{
175
return
(
button_
);
176
}
177
178
void
179
MouseEvent::setButton
(
const
MouseButton
& button)
180
{
181
button_
= button;
182
}
183
184
unsigned
int
185
MouseEvent::getX
()
const
186
{
187
return
(
pointer_x_
);
188
}
189
190
unsigned
int
191
MouseEvent::getY
()
const
192
{
193
return
(
pointer_y_
);
194
}
195
196
unsigned
int
197
MouseEvent::getKeyboardModifiers
()
const
198
{
199
return
(
key_state_
);
200
}
201
202
bool
203
MouseEvent::getSelectionMode
()
const
204
{
205
return
(
selection_mode_
);
206
}
207
208
}
//namespace visualization
209
}
//namespace pcl
pcl::visualization::KeyboardEvent::Alt
static const unsigned int Alt
bit pattern for the ALT key
Definition
keyboard_event.h:52
pcl::visualization::KeyboardEvent::Shift
static const unsigned int Shift
bit pattern for the Shift key
Definition
keyboard_event.h:56
pcl::visualization::KeyboardEvent::Ctrl
static const unsigned int Ctrl
bit pattern for the Control key
Definition
keyboard_event.h:54
pcl::visualization::MouseEvent::setType
void setType(const Type &type)
Sets the mouse event type.
Definition
mouse_event.h:167
pcl::visualization::MouseEvent::selection_mode_
bool selection_mode_
Definition
mouse_event.h:136
pcl::visualization::MouseEvent::key_state_
unsigned int key_state_
Definition
mouse_event.h:135
pcl::visualization::MouseEvent::getButton
const MouseButton & getButton() const
Definition
mouse_event.h:173
pcl::visualization::MouseEvent::getX
unsigned int getX() const
Definition
mouse_event.h:185
pcl::visualization::MouseEvent::type_
Type type_
Definition
mouse_event.h:131
pcl::visualization::MouseEvent::getY
unsigned int getY() const
Definition
mouse_event.h:191
pcl::visualization::MouseEvent::button_
MouseButton button_
Definition
mouse_event.h:132
pcl::visualization::MouseEvent::MouseButton
MouseButton
Definition
mouse_event.h:61
pcl::visualization::MouseEvent::VScroll
@ VScroll
Definition
mouse_event.h:66
pcl::visualization::MouseEvent::LeftButton
@ LeftButton
Definition
mouse_event.h:63
pcl::visualization::MouseEvent::NoButton
@ NoButton
Definition
mouse_event.h:62
pcl::visualization::MouseEvent::RightButton
@ RightButton
Definition
mouse_event.h:65
pcl::visualization::MouseEvent::MiddleButton
@ MiddleButton
Definition
mouse_event.h:64
pcl::visualization::MouseEvent::setButton
void setButton(const MouseButton &button)
Set the button that caused the event.
Definition
mouse_event.h:179
pcl::visualization::MouseEvent::MouseEvent
MouseEvent(const Type &type, const MouseButton &button, unsigned int x, unsigned int y, bool alt, bool ctrl, bool shift, bool selection_mode=false)
Constructor.
Definition
mouse_event.h:139
pcl::visualization::MouseEvent::getKeyboardModifiers
unsigned int getKeyboardModifiers() const
Definition
mouse_event.h:197
pcl::visualization::MouseEvent::Type
Type
Definition
mouse_event.h:51
pcl::visualization::MouseEvent::MouseScrollUp
@ MouseScrollUp
Definition
mouse_event.h:56
pcl::visualization::MouseEvent::MouseScrollDown
@ MouseScrollDown
Definition
mouse_event.h:55
pcl::visualization::MouseEvent::MouseButtonRelease
@ MouseButtonRelease
Definition
mouse_event.h:54
pcl::visualization::MouseEvent::MouseButtonPress
@ MouseButtonPress
Definition
mouse_event.h:53
pcl::visualization::MouseEvent::MouseDblClick
@ MouseDblClick
Definition
mouse_event.h:57
pcl::visualization::MouseEvent::MouseMove
@ MouseMove
Definition
mouse_event.h:52
pcl::visualization::MouseEvent::getType
const Type & getType() const
Definition
mouse_event.h:161
pcl::visualization::MouseEvent::getSelectionMode
bool getSelectionMode() const
Definition
mouse_event.h:203
pcl::visualization::MouseEvent::pointer_y_
unsigned int pointer_y_
Definition
mouse_event.h:134
pcl::visualization::MouseEvent::pointer_x_
unsigned int pointer_x_
Definition
mouse_event.h:133
pcl::visualization
Definition
color_handler.h:46
pcl
Definition
convolution.h:46