OpenWalnut
1.5.0dev
|
Class to handle events with a pick. More...
#include <WPickHandler.h>
Public Member Functions | |
WPickHandler () | |
Constructor that initalizes members with sensible defaults. More... | |
WPickHandler (std::string viewerName) | |
Constructor that initalizes members with sensible defaults and sets the name of the viewer. More... | |
bool | handle (const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &aa) |
Deals with the events found by the osg. More... | |
virtual void | pick (osgViewer::View *view, const osgGA::GUIEventAdapter &ea) |
Send a pick signal with the pick information as string. More... | |
virtual void | unpick () |
Send a pick signal with the unpickString. More... | |
WPickInfo | getHitResult () |
Gives information about the picked object. More... | |
boost::signals2::signal< void(WPickInfo) > * | getPickSignal () |
OW_API_DEPRECATED void | setPaintMode (int mode) |
setter for paint mode More... | |
void | setPaintMode (bool paintMode) |
Set in paint mode. More... | |
Static Public Attributes | |
static const std::string | unpickString = "unpick" |
The string indicating picking has stopped. More... | |
Protected Member Functions | |
virtual | ~WPickHandler () |
Virtual destructor needed because of virtual function. More... | |
Private Member Functions | |
void | updatePickInfoModifierKeys (WPickInfo *pickInfo) |
Sets the current modifiers to the provided pickInfo. More... | |
Private Attributes | |
boost::signals2::signal< void(WPickInfo) > | m_pickSignal |
One can register to this signal to receive pick events. More... | |
WPickInfo | m_hitResult |
Textual representation of the result of a pick. More... | |
WPickInfo | m_startPick |
indicates what was first picked. Should be "" after unpick. More... | |
bool | m_shift |
is shift pressed? More... | |
bool | m_ctrl |
is ctrl pressed? More... | |
std::string | m_viewerName |
which viewer sends the signal More... | |
bool | m_paintMode |
the paint mode More... | |
WPickInfo::WMouseButton | m_mouseButton |
stores mouse button that initiated the pick More... | |
bool | m_inPickMode |
if true, the pick handler currently is in pick mode. More... | |
int32_t | m_scrollWheel |
the virtual value of the scrollwheel More... | |
Class to handle events with a pick.
The handler ignores any geometry whose name starts with an underscore ("_").
Definition at line 43 of file WPickHandler.h.
WPickHandler::WPickHandler | ( | ) |
Constructor that initalizes members with sensible defaults.
Definition at line 32 of file WPickHandler.cpp.
|
explicit |
Constructor that initalizes members with sensible defaults and sets the name of the viewer.
viewerName | name of the viewer |
Definition at line 45 of file WPickHandler.cpp.
|
protectedvirtual |
Virtual destructor needed because of virtual function.
This desctructor is protected to avoid accidentally deleting an instance of WPickHandler. This follows the philosophy of OSG to avoid problems in multithreaded environments, since these pointers are used deep in the OSG where a deletion could cause a segfault.
Definition at line 58 of file WPickHandler.cpp.
WPickInfo WPickHandler::getHitResult | ( | ) |
Gives information about the picked object.
Definition at line 62 of file WPickHandler.cpp.
References m_hitResult.
Referenced by pick(), and unpick().
boost::signals2::signal< void(WPickInfo) > * WPickHandler::getPickSignal | ( | ) |
Definition at line 67 of file WPickHandler.cpp.
References m_pickSignal.
bool WPickHandler::handle | ( | const osgGA::GUIEventAdapter & | ea, |
osgGA::GUIActionAdapter & | aa | ||
) |
Deals with the events found by the osg.
ea | Event class for storing Keyboard, mouse and window events. |
aa | Interface by which GUIEventHandlers may request actions of the GUI system |
Definition at line 72 of file WPickHandler.cpp.
References m_ctrl, m_inPickMode, m_mouseButton, m_paintMode, m_scrollWheel, m_shift, pick(), and unpick().
|
virtual |
Send a pick signal with the pick information as string.
view | the view in which we pick. |
ea | Event class for storing Keyboard, mouse and window events. |
Definition at line 221 of file WPickHandler.cpp.
References getHitResult(), WPickInfo::getModifierKey(), WPickInfo::getName(), WPickInfo::getPickNormal(), WPickInfo::getPickPosition(), m_ctrl, m_hitResult, m_inPickMode, m_mouseButton, m_paintMode, m_pickSignal, m_scrollWheel, m_startPick, m_viewerName, unpickString, and updatePickInfoModifierKeys().
Referenced by handle().
void WPickHandler::setPaintMode | ( | bool | paintMode | ) |
Set in paint mode.
paintMode | Should we switch to paint mode? |
Definition at line 388 of file WPickHandler.cpp.
References m_paintMode.
void WPickHandler::setPaintMode | ( | int | mode | ) |
setter for paint mode
mode | the paint mode |
Definition at line 393 of file WPickHandler.cpp.
References m_paintMode.
|
virtual |
Send a pick signal with the unpickString.
Definition at line 182 of file WPickHandler.cpp.
References getHitResult(), m_hitResult, m_inPickMode, m_pickSignal, m_scrollWheel, m_startPick, m_viewerName, and unpickString.
Referenced by handle().
|
private |
Sets the current modifiers to the provided pickInfo.
pickInfo | This pickInfo will be updated. |
Definition at line 208 of file WPickHandler.cpp.
References m_ctrl, m_shift, and WPickInfo::setModifierKey().
Referenced by pick().
|
private |
is ctrl pressed?
Definition at line 131 of file WPickHandler.h.
Referenced by handle(), pick(), and updatePickInfoModifierKeys().
|
private |
Textual representation of the result of a pick.
Definition at line 128 of file WPickHandler.h.
Referenced by getHitResult(), pick(), and unpick().
|
private |
if true, the pick handler currently is in pick mode.
Definition at line 136 of file WPickHandler.h.
|
private |
stores mouse button that initiated the pick
Definition at line 134 of file WPickHandler.h.
|
private |
the paint mode
Definition at line 133 of file WPickHandler.h.
Referenced by handle(), pick(), and setPaintMode().
|
private |
One can register to this signal to receive pick events.
Definition at line 126 of file WPickHandler.h.
Referenced by getPickSignal(), pick(), and unpick().
|
private |
the virtual value of the scrollwheel
Definition at line 138 of file WPickHandler.h.
|
private |
is shift pressed?
Definition at line 130 of file WPickHandler.h.
Referenced by handle(), and updatePickInfoModifierKeys().
|
private |
indicates what was first picked. Should be "" after unpick.
Definition at line 129 of file WPickHandler.h.
|
private |
which viewer sends the signal
Definition at line 132 of file WPickHandler.h.
|
static |
The string indicating picking has stopped.
Definition at line 104 of file WPickHandler.h.
Referenced by pick(), WMPickingDVR::pickHandler(), WMPaintTexture::queuePaint(), unpick(), WROIBox::updateGFX(), and WROISphere::updateGFX().