#include <select2DTool.h>
Public Member Functions | |
void | draw () const |
Draws the rubber band as well as any highlighted points during the 'update' phase (i.e. before the selection is made by a call to end). | |
void | end (int x, int y, BitMask modifiers, BitMask mouseButton) |
Update the coordinates of the lower right corner of the rubber band and process the points in the rubber band. | |
bool | isInSelectBox (const Point3D &pt, const GLfloat *project, const GLint *viewport) const |
Checks whether a point is inside the selection region. | |
Select2DTool (SelectionPtr selection_ptr, CloudPtr cloud_ptr) | |
Constructor. | |
void | start (int x, int y, BitMask modifiers, BitMask mouseButton) |
Initializes the selection tool with the initial mouse screen coordinates and key modifiers. The passed coordinates are used for determining the coordinates of the upper left corner of the rubber band. | |
void | update (int x, int y, BitMask modifiers, BitMask mouseButton) |
Update the selection tool from the current mouse screen coordinates and key modifiers. | |
~Select2DTool () | |
Destructor. | |
Static Public Attributes | |
static const float | DEFAULT_TOOL_DISPLAY_COLOR_BLUE_ = 1.0f |
The default color of the rubberband tool - blue component. | |
static const float | DEFAULT_TOOL_DISPLAY_COLOR_GREEN_ = 1.0f |
The default color of the rubberband tool - green component. | |
static const float | DEFAULT_TOOL_DISPLAY_COLOR_RED_ = 1.0f |
The default color of the rubberband tool - red component. | |
static const float | DEFAULT_TOOL_DISPLAY_SIZE_ = 2.0f |
The default size in pixels of the rubberband tool outline. | |
Private Member Functions | |
void | drawRubberBand (GLint *viewport) const |
draw the 2D selection rubber band. | |
void | highlightPoints (GLint *viewport) const |
highlight all the points in the rubber band. draw the cloud using a stencil buffer. During this time, the points that are highlighted will not be recorded by the selecion object. | |
Select2DTool () | |
Default constructor - object is not default constructable. | |
Private Attributes | |
CloudPtr | cloud_ptr_ |
a shared pointer pointing to the cloud object | |
bool | display_box_ |
switch for selection box rendering | |
int | final_x_ |
the final mouse screen coordinates | |
int | final_y_ |
int | origin_x_ |
the original mouse screen coordinates | |
int | origin_y_ |
SelectionPtr | selection_ptr_ |
a shared pointer pointing to the selection object |
Definition at line 48 of file select2DTool.h.
Select2DTool::Select2DTool | ( | SelectionPtr | selection_ptr, |
CloudPtr | cloud_ptr | ||
) |
Constructor.
selection_ptr | a shared pointer pointing to the selection object. |
cloud_ptr | a shared pointer pointing to the cloud object. |
Definition at line 51 of file select2DTool.cpp.
Destructor.
Definition at line 56 of file select2DTool.cpp.
Select2DTool::Select2DTool | ( | ) | [inline, private] |
Default constructor - object is not default constructable.
Definition at line 119 of file select2DTool.h.
void Select2DTool::draw | ( | ) | const [virtual] |
Draws the rubber band as well as any highlighted points during the 'update' phase (i.e. before the selection is made by a call to end).
Implements ToolInterface.
Definition at line 144 of file select2DTool.cpp.
void Select2DTool::drawRubberBand | ( | GLint * | viewport | ) | const [private] |
draw the 2D selection rubber band.
viewport | the viewport obtained from GL |
Definition at line 157 of file select2DTool.cpp.
void Select2DTool::end | ( | int | x, |
int | y, | ||
BitMask | modifiers, | ||
BitMask | mouseButton | ||
) | [virtual] |
Update the coordinates of the lower right corner of the rubber band and process the points in the rubber band.
The points which fall into the selection region are processed according to the value of the modifier: If shift is pressed, the selected points are appended to the existing selection. If ctrl is pressed, the points will be removed from the existing selection if they were elected previously, otherwise nothing happens.
x | the x value of the mouse screen coordinates. |
y | the y value of the mouse screen coordinates. |
modifiers | the key modifier. |
Implements ToolInterface.
Definition at line 80 of file select2DTool.cpp.
void Select2DTool::highlightPoints | ( | GLint * | viewport | ) | const [private] |
highlight all the points in the rubber band. draw the cloud using a stencil buffer. During this time, the points that are highlighted will not be recorded by the selecion object.
viewport | the viewport obtained from GL |
Definition at line 194 of file select2DTool.cpp.
bool Select2DTool::isInSelectBox | ( | const Point3D & | pt, |
const GLfloat * | project, | ||
const GLint * | viewport | ||
) | const |
Checks whether a point is inside the selection region.
pt | the point to be checked against the selection region. |
project | the projection matrix obtained from GL. |
viewport | the current viewport obtained from GL. |
Definition at line 123 of file select2DTool.cpp.
void Select2DTool::start | ( | int | x, |
int | y, | ||
BitMask | modifiers, | ||
BitMask | mouseButton | ||
) | [virtual] |
Initializes the selection tool with the initial mouse screen coordinates and key modifiers. The passed coordinates are used for determining the coordinates of the upper left corner of the rubber band.
x | the x value of the mouse screen coordinates. |
y | the y value of the mouse screen coordinates. |
modifiers | the key modifier. There are three possible values for modifiers: 1. shift key, 2. ctrl key, 3. no modifier is pressed. Note that the ctrl key may be evaluated as the command key in OSX. |
Implements ToolInterface.
Definition at line 61 of file select2DTool.cpp.
void Select2DTool::update | ( | int | x, |
int | y, | ||
BitMask | modifiers, | ||
BitMask | mouseButton | ||
) | [virtual] |
Update the selection tool from the current mouse screen coordinates and key modifiers.
Creates a 2D rubberband. The coordinates of the lower right corner of the rubberband is computed from the passed coordinates.
x | the x value of the mouse screen coordinates. |
y | the y value of the mouse screen coordinates. |
modifiers | the key modifier. |
Implements ToolInterface.
Definition at line 70 of file select2DTool.cpp.
CloudPtr Select2DTool::cloud_ptr_ [private] |
a shared pointer pointing to the cloud object
Definition at line 140 of file select2DTool.h.
const float Select2DTool::DEFAULT_TOOL_DISPLAY_COLOR_BLUE_ = 1.0f [static] |
The default color of the rubberband tool - blue component.
Definition at line 114 of file select2DTool.h.
const float Select2DTool::DEFAULT_TOOL_DISPLAY_COLOR_GREEN_ = 1.0f [static] |
The default color of the rubberband tool - green component.
Definition at line 112 of file select2DTool.h.
const float Select2DTool::DEFAULT_TOOL_DISPLAY_COLOR_RED_ = 1.0f [static] |
The default color of the rubberband tool - red component.
Definition at line 110 of file select2DTool.h.
const float Select2DTool::DEFAULT_TOOL_DISPLAY_SIZE_ = 2.0f [static] |
The default size in pixels of the rubberband tool outline.
Definition at line 107 of file select2DTool.h.
bool Select2DTool::display_box_ [private] |
switch for selection box rendering
Definition at line 149 of file select2DTool.h.
int Select2DTool::final_x_ [private] |
the final mouse screen coordinates
Definition at line 146 of file select2DTool.h.
int Select2DTool::final_y_ [private] |
Definition at line 146 of file select2DTool.h.
int Select2DTool::origin_x_ [private] |
the original mouse screen coordinates
Definition at line 143 of file select2DTool.h.
int Select2DTool::origin_y_ [private] |
Definition at line 143 of file select2DTool.h.
SelectionPtr Select2DTool::selection_ptr_ [private] |
a shared pointer pointing to the selection object
Definition at line 137 of file select2DTool.h.