OpenWalnut  1.3.1
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
WPickHandler Class Reference

Class to handle events with a pick. More...

#include <WPickHandler.h>

+ Inheritance diagram for WPickHandler:

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.

Detailed Description

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 & Destructor Documentation

WPickHandler::WPickHandler ( )

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.

Parameters
viewerNamename of the viewer

Definition at line 44 of file WPickHandler.cpp.

WPickHandler::~WPickHandler ( )
protectedvirtual

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.

Member Function Documentation

WPickInfo WPickHandler::getHitResult ( )

Gives information about the picked object.

Returns
info object for this hit

Definition at line 61 of file WPickHandler.cpp.

References m_hitResult.

Referenced by pick(), and unpick().

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.

Parameters
eaEvent class for storing Keyboard, mouse and window events.
aaInterface by which GUIEventHandlers may request actions of the GUI system
Returns
true if the event was handled.

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.

Parameters
viewthe view in which we pick.
eaEvent 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

Parameters
modethe 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.

Parameters
pickInfoThis pickInfo will be updated.

Definition at line 206 of file WPickHandler.cpp.

References m_ctrl, m_shift, and WPickInfo::setModifierKey().

Referenced by pick().

Member Data Documentation

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.

Referenced by handle(), pick(), and unpick().

WPickInfo::WMouseButton WPickHandler::m_mouseButton
protected

stores mouse button that initiated the pick

Definition at line 115 of file WPickHandler.h.

Referenced by handle(), and pick().

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.

Referenced by handle(), pick(), and unpick().

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.

Referenced by pick(), and unpick().

std::string WPickHandler::m_viewerName
protected

which viewer sends the signal

Definition at line 113 of file WPickHandler.h.

Referenced by pick(), and unpick().


The documentation for this class was generated from the following files: