OpenWalnut
1.4.0
|
Class to handle events with a pick. More...
#include <WPickHandler.h>
Public Member Functions | |
WPickHandler () | |
Constructor that initalizes members with sensible defaults. | |
WPickHandler (std::string viewerName) | |
Constructor that initalizes members with sensible defaults and sets the name of the viewer. | |
bool | handle (const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &aa) |
Deals with the events found by the osg. | |
virtual void | pick (osgViewer::View *view, const osgGA::GUIEventAdapter &ea) |
Send a pick signal with the pick information as string. | |
virtual void | unpick () |
Send a pick signal with the string "unpick". | |
WPickInfo | getHitResult () |
Gives information about the picked object. | |
boost::signals2::signal1< void, WPickInfo > * | getPickSignal () |
returns the m_pickSignal to for registering to it. | |
void | setPaintMode (int mode) |
setter for paint mode | |
Protected Member Functions | |
virtual | ~WPickHandler () |
Virtual destructor needed because of virtual function. | |
Protected Attributes | |
WPickInfo | m_hitResult |
Textual representation of the result of a pick. | |
WPickInfo | m_startPick |
indicates what was first picked. Should be "" after unpick. | |
bool | m_shift |
is shift pressed? | |
bool | m_ctrl |
is ctrl pressed? | |
std::string | m_viewerName |
which viewer sends the signal | |
int | m_paintMode |
the paint mode | |
WPickInfo::WMouseButton | m_mouseButton |
stores mouse button that initiated the pick | |
bool | m_inPickMode |
if true, the pick handler currently is in pick mode. | |
int32_t | m_scrollWheel |
the virtual value of the scrollwheel | |
Private Member Functions | |
void | updatePickInfoModifierKeys (WPickInfo *pickInfo) |
Sets the current modifiers to the provided pickInfo. | |
Private Attributes | |
boost::signals2::signal1< void, WPickInfo > | m_pickSignal |
One can register to this signal to receive pick events. |
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.
Constructor that initalizes members with sensible defaults.
Definition at line 31 of file WPickHandler.cpp.
WPickHandler::WPickHandler | ( | std::string | viewerName | ) | [explicit] |
Constructor that initalizes members with sensible defaults and sets the name of the viewer.
viewerName | name of the viewer |
Definition at line 44 of file WPickHandler.cpp.
WPickHandler::~WPickHandler | ( | ) | [protected, virtual] |
Virtual destructor needed because of virtual function.
This desctructor is protected to avoid accidentally deleting a 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 57 of file WPickHandler.cpp.
Gives information about the picked object.
Definition at line 61 of file WPickHandler.cpp.
References m_hitResult.
boost::signals2::signal1< void, WPickInfo > * WPickHandler::getPickSignal | ( | ) |
returns the m_pickSignal to for registering to it.
Definition at line 66 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 71 of file WPickHandler.cpp.
References m_ctrl, m_inPickMode, m_mouseButton, m_paintMode, m_scrollWheel, m_shift, pick(), and unpick().
void WPickHandler::pick | ( | osgViewer::View * | view, |
const osgGA::GUIEventAdapter & | ea | ||
) | [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 219 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, and updatePickInfoModifierKeys().
Referenced by handle().
void WPickHandler::setPaintMode | ( | int | mode | ) |
setter for paint mode
mode | the paint mode |
Definition at line 351 of file WPickHandler.cpp.
References m_paintMode.
void WPickHandler::unpick | ( | ) | [virtual] |
Send a pick signal with the string "unpick".
Definition at line 180 of file WPickHandler.cpp.
References getHitResult(), m_hitResult, m_inPickMode, m_pickSignal, m_scrollWheel, m_startPick, and m_viewerName.
Referenced by handle().
void WPickHandler::updatePickInfoModifierKeys | ( | WPickInfo * | pickInfo | ) | [private] |
Sets the current modifiers to the provided pickInfo.
pickInfo | This pickInfo will be updated. |
Definition at line 206 of file WPickHandler.cpp.
References m_ctrl, m_shift, and WPickInfo::setModifierKey().
Referenced by pick().
bool WPickHandler::m_ctrl [protected] |
is ctrl pressed?
Definition at line 112 of file WPickHandler.h.
Referenced by handle(), pick(), and updatePickInfoModifierKeys().
WPickInfo WPickHandler::m_hitResult [protected] |
Textual representation of the result of a pick.
Definition at line 109 of file WPickHandler.h.
Referenced by getHitResult(), pick(), and unpick().
bool WPickHandler::m_inPickMode [protected] |
if true, the pick handler currently is in pick mode.
Definition at line 117 of file WPickHandler.h.
WPickInfo::WMouseButton WPickHandler::m_mouseButton [protected] |
stores mouse button that initiated the pick
Definition at line 115 of file WPickHandler.h.
int WPickHandler::m_paintMode [protected] |
the paint mode
Definition at line 114 of file WPickHandler.h.
Referenced by handle(), pick(), and setPaintMode().
boost::signals2::signal1< void, WPickInfo > WPickHandler::m_pickSignal [private] |
One can register to this signal to receive pick events.
Definition at line 129 of file WPickHandler.h.
Referenced by getPickSignal(), pick(), and unpick().
int32_t WPickHandler::m_scrollWheel [protected] |
the virtual value of the scrollwheel
Definition at line 119 of file WPickHandler.h.
bool WPickHandler::m_shift [protected] |
is shift pressed?
Definition at line 111 of file WPickHandler.h.
Referenced by handle(), and updatePickInfoModifierKeys().
WPickInfo WPickHandler::m_startPick [protected] |
indicates what was first picked. Should be "" after unpick.
Definition at line 110 of file WPickHandler.h.
std::string WPickHandler::m_viewerName [protected] |
which viewer sends the signal
Definition at line 113 of file WPickHandler.h.