dart
|
Public Member Functions | |
DefaultEventHandler (Viewer *_viewer) | |
Constructor takes in a pointer to a viewer. | |
virtual | ~DefaultEventHandler () |
Destructor. | |
MouseButtonEvent | getButtonEvent (MouseButton button) const |
Returns the last event performed by a mouse button. | |
int | getModKeyMask () const |
Returns the last modkey mask. | |
double | getWindowCursorX () const |
Get the last x value of the cursor in Window coordinates. | |
double | getWindowCursorY () const |
Get the last y value of the cursor in Window coordinates. | |
Eigen::Vector3d | getDeltaCursor (const Eigen::Vector3d &_fromPosition, ConstraintType _constraint=UNCONSTRAINED, const Eigen::Vector3d &_constraintVector=Eigen::Vector3d::UnitZ()) const |
Get the change change in the cursor position with respect to some previous location in the world (_fromPosition). More... | |
void | getNearAndFarPointUnderCursor (Eigen::Vector3d &near, Eigen::Vector3d &far, double distance=1.0) const |
Get two points that are under the current cursor position. More... | |
const std::vector< PickInfo > & | getButtonPicks (MouseButton button, MouseButtonEvent event) const |
Get the most recent picks for the specified button and event type. | |
const std::vector< PickInfo > & | getMovePicks () const |
Get the most recent picks for a mouse movement (click-and-drag actions do not qualify as movements) | |
void | suppressButtonPicks (MouseButton button, MouseButtonEvent event) |
Suppress pick detection for the specified button event. | |
void | suppressMovePicks () |
Suppress pick detection for mouse movements. | |
void | activateButtonPicks (MouseButton button, MouseButtonEvent event) |
Activate pick detection for the specified button event (on by default) | |
void | activateMovePicks () |
Activate pick detection for mouse movements (on by default) | |
void | pick (std::vector< PickInfo > &infoVector, const ::osgGA::GUIEventAdapter &ea) |
Detect picks TODO(MXG): Consider putting this functionality in a more accessible place. | |
void | addMouseEventHandler (MouseEventHandler *handler) |
Add a MouseEventHandler that will get invoked whenever a mouse event occurs. More... | |
const std::set< MouseEventHandler * > & | getMouseEventHandlers () const |
Get the list of MouseEventHandlers that are currently held by this DefaultEventHandler. | |
bool | handle (const ::osgGA::GUIEventAdapter &ea, ::osgGA::GUIActionAdapter &) override |
Handle incoming user input. | |
![]() | |
virtual | ~Subject () |
Destructor will notify all Observers that it is destructing. | |
![]() | |
virtual | ~Observer () |
Destructor will notify all Subjects that it is destructing. | |
Protected Member Functions | |
void | triggerMouseEventHandlers () |
Calls update on all MouseEventHandlers. | |
void | eventPick (const ::osgGA::GUIEventAdapter &ea) |
Gather current picks and assign them to the latest event. | |
void | clearButtonEvents () |
Clear out the current button events. | |
void | handleDestructionNotification (const dart::common::Subject *_subject) override |
Called by receiveDestructionNotification(). More... | |
![]() | |
void | sendDestructionNotification () const |
Send a destruction notification to all Observers. More... | |
void | addObserver (Observer *_observer) const |
Add an Observer to the list of Observers. | |
void | removeObserver (Observer *_observer) const |
Remove an Observer from the list of Observers. | |
![]() | |
void | receiveDestructionNotification (const Subject *_subject) |
Called whenever a Subject is destroyed (or sends out a destruction notification). More... | |
void | addSubject (const Subject *_subject) |
Add a Subject for this Observer. | |
void | removeSubject (const Subject *_subject) |
Remove a Subject from this Observer. | |
void | removeAllSubjects () |
Remove all Subjects from this Observer. | |
Protected Attributes | |
Viewer * | mViewer |
dart::gui::osg::Viewer that this event handler is tied to | |
std::set< MouseEventHandler * > | mMouseEventHandlers |
Set of MouseEventHandlers that are tied to this DefaultEventHandler. | |
std::vector< PickInfo > | mButtonPicks [NUM_MOUSE_BUTTONS][BUTTON_NOTHING] |
The objects that were under the cursor during the last button event. | |
bool | mSuppressButtonPicks [NUM_MOUSE_BUTTONS][BUTTON_NOTHING] |
Suppress pick detection. | |
std::vector< PickInfo > | mMovePicks |
The objects that were under the cursor during the last move. | |
bool | mSuppressMovePicks |
Suppress pick detection for moves. | |
std::vector< PickInfo > | mTempPicks |
Cache for pick data. | |
MouseButtonEvent | mLastButtonEvent [NUM_MOUSE_BUTTONS] |
The last mouse event that was registered by the event handler. | |
Eigen::Vector2d | mLastCursorPosition |
X/Y values of the cursor (in the window coordinates) during the last mouse event. | |
int | mLastModKeyMask |
Storage for the last modkey mask. | |
![]() | |
std::set< Observer * > | mObservers |
List of current Observers. | |
![]() | |
std::set< const Subject * > | mSubjects |
List of current Subjects for this Observer. | |
void dart::gui::osg::DefaultEventHandler::addMouseEventHandler | ( | MouseEventHandler * | handler | ) |
Add a MouseEventHandler that will get invoked whenever a mouse event occurs.
You never need to worry about removing a MouseEventHandler from a DefaultEventHandler, because it will get removed automatically upon deletion
Eigen::Vector3d dart::gui::osg::DefaultEventHandler::getDeltaCursor | ( | const Eigen::Vector3d & | _fromPosition, |
ConstraintType | _constraint = UNCONSTRAINED , |
||
const Eigen::Vector3d & | _constraintVector = Eigen::Vector3d::UnitZ() |
||
) | const |
Get the change change in the cursor position with respect to some previous location in the world (_fromPosition).
For the unconstrained case, this change is projected onto a plane parallel to the camera's orientation.
If _constraint is set to LINE_CONSTRAINT, the change in cursor position will be constrained to a line that passes through _fromPosition with a slope of _constraintVector.
If _constraint is set to PLANE_CONSTRAINT, the change in cursor position will be constrained to a plane that passes through _fromPosition with a normal vector of _constraintVector.
void dart::gui::osg::DefaultEventHandler::getNearAndFarPointUnderCursor | ( | Eigen::Vector3d & | near, |
Eigen::Vector3d & | far, | ||
double | distance = 1.0 |
||
) | const |
Get two points that are under the current cursor position.
The near point will be inside the plane of the camera. The far point will have the given distance from the plane of the camera (default is 1.0).
|
overrideprotectedvirtual |
Called by receiveDestructionNotification().
Override this function to customize your class's response to destruction notifications.
Reimplemented from dart::common::Observer.