![]() |
OpenWalnut
1.5.0dev
|
Manages different types of selection. More...
#include <WOnscreenSelection.h>
Collaboration diagram for WOnscreenSelection:Public Types | |
| enum class | WSelectionType { BRUSH , LINELOOP , BOX } |
| The different types of selection. More... | |
| typedef boost::function< void(enum WSelectionType, float, float) > | CallbackType |
| A typedef for the type of the callbacks. More... | |
Public Member Functions | |
| WOnscreenSelection () | |
| Not only creates the Object but also sets up the drawing context. More... | |
| ~WOnscreenSelection () | |
| Cleans up all the now unneeded drawing context stuff. More... | |
| void | start (float x, float y) |
| Starts the selection. More... | |
| void | end (float x, float y) |
| Ends the selection. More... | |
| void | move (float x, float y) |
| Handles mouse move while selecting. More... | |
| enum WSelectionType | getSelectionType () |
| Gets the current selection type. More... | |
| void | clear () |
| Clears the current selection. More... | |
| bool | isSelected (float x, float y, float z) |
| Whether a point is selected or not. More... | |
| std::vector< WPosition > | isSelected (std::vector< WPosition > positions) |
| Checks if the positions are selected and only returns those that are. More... | |
| void | setSelectionType (enum WSelectionType selectionType) |
| Sets the current selection type. More... | |
| void | setOnstart (CallbackType onstart) |
| Sets the callback for the onstart function. More... | |
| void | setOnend (CallbackType onend) |
| Sets the callback for the onend function. More... | |
| void | setOnmove (CallbackType onmove) |
| Sets the callback for the onmove function. More... | |
| bool | isSelecting () |
| Returns whether this manager is currently creating a selection. More... | |
| bool | boxCheck (float x, float y) |
| Check for the box selection. More... | |
| bool | brushCheck (float x, float y) |
| Check for the brush selection. More... | |
| bool | lineloopCheck (float x, float y) |
| Check for the lineloop selection. More... | |
| int | crossingNumberProduct (float x, float y, WPosition b, WPosition c) |
| Calculates the crossing number product. More... | |
| void | setClickType (bool clickType) |
| Sets the click type. More... | |
| bool | getClickType () |
| Gets the click type. More... | |
| bool | hasMoved () |
Private Member Functions | |
| void | updateDisplay () |
| Updates the current rendered data. More... | |
Private Attributes | |
| osg::ref_ptr< osg::Projection > | m_projection |
| The Projection to draw on. More... | |
| enum WSelectionType | m_selectionType |
| The current selection type. More... | |
| osg::ref_ptr< WOnscreenSelectionHandler > | m_selectionHandler |
| The SelectionHandler for this object. More... | |
| std::vector< WPosition > | m_line |
| The points that are used for the selection. More... | |
| bool | m_isSelecting |
| Whether a selection has been started or not. More... | |
| osg::ref_ptr< WGEShader > | m_shader |
| The shader for the selection. More... | |
| float | m_thickness |
| The thickness of the brush. More... | |
| bool | m_clickType |
| Whether this is a left click or not. More... | |
| bool | m_moved |
| Whether the mouse has been moved. More... | |
| CallbackType | m_onstart |
| The Callback for the start function. More... | |
| CallbackType | m_onend |
| The Callback for the end function. More... | |
| CallbackType | m_onmove |
| The Callback for the move function. More... | |
Manages different types of selection.
Definition at line 50 of file WOnscreenSelection.h.
| typedef boost::function< void ( enum WSelectionType, float, float ) > WOnscreenSelection::CallbackType |
A typedef for the type of the callbacks.
Definition at line 64 of file WOnscreenSelection.h.
|
strong |
The different types of selection.
Definition at line 56 of file WOnscreenSelection.h.
| WOnscreenSelection::WOnscreenSelection | ( | ) |
Not only creates the Object but also sets up the drawing context.
Definition at line 29 of file WOnscreenSelection.cpp.
References WKernel::getGraphicsEngine(), WKernel::getRunningKernel(), and m_selectionHandler.
Here is the call graph for this function:| WOnscreenSelection::~WOnscreenSelection | ( | ) |
Cleans up all the now unneeded drawing context stuff.
Definition at line 41 of file WOnscreenSelection.cpp.
References WKernel::getGraphicsEngine(), WKernel::getRunningKernel(), m_projection, and m_selectionHandler.
Here is the call graph for this function:| bool WOnscreenSelection::boxCheck | ( | float | x, |
| float | y | ||
| ) |
Check for the box selection.
| x | The x position of the point. |
| y | The y position of the point. |
Definition at line 316 of file WOnscreenSelection.cpp.
References m_line.
Referenced by isSelected().
Here is the caller graph for this function:| bool WOnscreenSelection::brushCheck | ( | float | x, |
| float | y | ||
| ) |
Check for the brush selection.
| x | The x position of the point. |
| y | The y position of the point. |
Definition at line 329 of file WOnscreenSelection.cpp.
References WKernel::getGraphicsEngine(), WKernel::getRunningKernel(), m_line, and m_thickness.
Referenced by isSelected().
Here is the call graph for this function:
Here is the caller graph for this function:| void WOnscreenSelection::clear | ( | ) |
Clears the current selection.
Definition at line 260 of file WOnscreenSelection.cpp.
References m_line, and updateDisplay().
Referenced by WOnscreenSelectionHandler::handle(), and start().
Here is the call graph for this function:
Here is the caller graph for this function:Calculates the crossing number product.
| x | The x position of the point. |
| y | The y position of the point. |
| b | The start of the line. |
| c | The end of the line. |
Definition at line 388 of file WOnscreenSelection.cpp.
Referenced by lineloopCheck().
Here is the caller graph for this function:| void WOnscreenSelection::end | ( | float | x, |
| float | y | ||
| ) |
Ends the selection.
| x | The normalized x position of the mouse. |
| y | The normalized y position of the mouse. |
Definition at line 73 of file WOnscreenSelection.cpp.
References m_isSelecting, m_line, m_onend, m_selectionType, and updateDisplay().
Referenced by WOnscreenSelectionHandler::handle().
Here is the call graph for this function:
Here is the caller graph for this function:| bool WOnscreenSelection::getClickType | ( | ) |
Gets the click type.
Definition at line 426 of file WOnscreenSelection.cpp.
References m_clickType.
| enum WOnscreenSelection::WSelectionType WOnscreenSelection::getSelectionType | ( | ) |
Gets the current selection type.
Definition at line 101 of file WOnscreenSelection.cpp.
References m_isSelecting, m_line, m_moved, m_onmove, m_selectionType, and updateDisplay().
Here is the call graph for this function:| bool WOnscreenSelection::hasMoved | ( | ) |
Definition at line 431 of file WOnscreenSelection.cpp.
References m_moved.
| bool WOnscreenSelection::isSelected | ( | float | x, |
| float | y, | ||
| float | z | ||
| ) |
Whether a point is selected or not.
| x | The x position. |
| y | The y position. |
| z | The z position. |
Definition at line 266 of file WOnscreenSelection.cpp.
References boxCheck(), brushCheck(), WKernel::getGraphicsEngine(), WKernel::getRunningKernel(), lineloopCheck(), m_line, and m_selectionType.
Referenced by isSelected().
Here is the call graph for this function:
Here is the caller graph for this function:Checks if the positions are selected and only returns those that are.
| positions | The positions to check |
Definition at line 300 of file WOnscreenSelection.cpp.
References isSelected().
Here is the call graph for this function:| bool WOnscreenSelection::isSelecting | ( | ) |
Returns whether this manager is currently creating a selection.
Definition at line 255 of file WOnscreenSelection.cpp.
References m_isSelecting.
| bool WOnscreenSelection::lineloopCheck | ( | float | x, |
| float | y | ||
| ) |
Check for the lineloop selection.
| x | The x position of the point. |
| y | The y position of the point. |
Definition at line 371 of file WOnscreenSelection.cpp.
References crossingNumberProduct(), and m_line.
Referenced by isSelected().
Here is the call graph for this function:
Here is the caller graph for this function:| void WOnscreenSelection::move | ( | float | x, |
| float | y | ||
| ) |
Handles mouse move while selecting.
| x | The normalized x position of the mouse. |
| y | The normalized y position of the mouse. |
Definition at line 101 of file WOnscreenSelection.cpp.
Referenced by WOnscreenSelectionHandler::handle().
Here is the caller graph for this function:| void WOnscreenSelection::setClickType | ( | bool | clickType | ) |
Sets the click type.
| clickType | true for left click, false for right click. |
Definition at line 421 of file WOnscreenSelection.cpp.
References m_clickType.
Referenced by WOnscreenSelectionHandler::handle().
Here is the caller graph for this function:| void WOnscreenSelection::setOnend | ( | CallbackType | onend | ) |
Sets the callback for the onend function.
Use NULL to reset.
| onend | The Callback or NULL. |
Definition at line 245 of file WOnscreenSelection.cpp.
References m_onend.
| void WOnscreenSelection::setOnmove | ( | CallbackType | onmove | ) |
Sets the callback for the onmove function.
Use NULL to reset.
| onmove | The Callback or NULL. |
Definition at line 250 of file WOnscreenSelection.cpp.
References m_onmove.
| void WOnscreenSelection::setOnstart | ( | CallbackType | onstart | ) |
Sets the callback for the onstart function.
Use NULL to reset.
| onstart | The Callback or NULL. |
Definition at line 240 of file WOnscreenSelection.cpp.
References m_onstart.
| void WOnscreenSelection::setSelectionType | ( | enum WSelectionType | selectionType | ) |
Sets the current selection type.
| selectionType | The selection type to set. |
Definition at line 135 of file WOnscreenSelection.cpp.
References m_selectionType.
| void WOnscreenSelection::start | ( | float | x, |
| float | y | ||
| ) |
Starts the selection.
| x | The normalized x position of the mouse. |
| y | The normalized y position of the mouse. |
Definition at line 47 of file WOnscreenSelection.cpp.
References clear(), m_isSelecting, m_line, m_moved, m_onstart, m_selectionType, and updateDisplay().
Referenced by WOnscreenSelectionHandler::handle().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Updates the current rendered data.
Definition at line 140 of file WOnscreenSelection.cpp.
References WKernel::getGraphicsEngine(), WKernel::getRunningKernel(), m_clickType, m_line, m_projection, m_selectionType, m_shader, and m_thickness.
Referenced by clear(), end(), getSelectionType(), and start().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Whether this is a left click or not.
Definition at line 242 of file WOnscreenSelection.h.
Referenced by getClickType(), setClickType(), and updateDisplay().
|
private |
Whether a selection has been started or not.
Definition at line 236 of file WOnscreenSelection.h.
Referenced by end(), getSelectionType(), isSelecting(), and start().
|
private |
The points that are used for the selection.
Definition at line 234 of file WOnscreenSelection.h.
Referenced by boxCheck(), brushCheck(), clear(), end(), getSelectionType(), isSelected(), lineloopCheck(), start(), and updateDisplay().
|
private |
Whether the mouse has been moved.
Definition at line 244 of file WOnscreenSelection.h.
Referenced by getSelectionType(), hasMoved(), and start().
|
private |
The Callback for the end function.
Definition at line 248 of file WOnscreenSelection.h.
Referenced by end(), and setOnend().
|
private |
The Callback for the move function.
Definition at line 250 of file WOnscreenSelection.h.
Referenced by getSelectionType(), and setOnmove().
|
private |
The Callback for the start function.
Definition at line 246 of file WOnscreenSelection.h.
Referenced by setOnstart(), and start().
|
private |
The Projection to draw on.
Definition at line 228 of file WOnscreenSelection.h.
Referenced by updateDisplay(), and ~WOnscreenSelection().
|
private |
The SelectionHandler for this object.
Definition at line 232 of file WOnscreenSelection.h.
Referenced by WOnscreenSelection(), and ~WOnscreenSelection().
|
private |
The current selection type.
Definition at line 228 of file WOnscreenSelection.h.
Referenced by end(), getSelectionType(), isSelected(), setSelectionType(), start(), and updateDisplay().
|
private |
The shader for the selection.
Definition at line 238 of file WOnscreenSelection.h.
Referenced by updateDisplay().
|
private |
The thickness of the brush.
Definition at line 240 of file WOnscreenSelection.h.
Referenced by brushCheck(), and updateDisplay().