Updraft
1.0
Open source glider flight visualisation tool.
|
Handler of osg events that implements clicking of map objects. More...
#include <pickhandler.h>
Public Member Functions | |
PickHandler () | |
bool | handle (const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &aa) |
Handles the osg gui event. | |
Protected Member Functions | |
void | raiseLeftClick (QVector< Pair > mapObjects) |
Method that calls the click handlers for all interested plugins for all intersected map objects. | |
void | raiseRightClick (QVector< Pair > mapObjects) |
Requests the context menu actions from all plugins for all intersected map objects. | |
MapObject * | getMapObject (osg::Node *node) |
bool | eventsCloseEnough (float x1, float y1, float x2, float y2) |
Says whether two mouse events are close enough to belong together. | |
QVector< Pair > | getIntersectedMapObjects (const double x, const double y, osgViewer::Viewer *viewer) |
Get all MapObjectes associated with nodes intersected by a click. | |
Protected Attributes | |
float | mX |
Store mouse xy location for button press & move events. | |
float | mY |
SettingInterface * | mouseEventTolerance |
The setting for the mouse event tolerance used in the method eventsCloseEnough() | |
QList< QAction * > | ownedActions |
Handler of osg events that implements clicking of map objects.
bool Updraft::Core::PickHandler::eventsCloseEnough | ( | float | x1, |
float | y1, | ||
float | x2, | ||
float | y2 | ||
) | [protected] |
Says whether two mouse events are close enough to belong together.
x1 | X-coordinate of the first event |
y1 | Y-coordinate of the first event |
x2 | X-coordinate of the second event |
y2 | Y-coordinate of the second event |
QVector< Pair > Updraft::Core::PickHandler::getIntersectedMapObjects | ( | const double | x, |
const double | y, | ||
osgViewer::Viewer * | viewer | ||
) | [protected] |
Get all MapObjectes associated with nodes intersected by a click.
x | The normalized X-coordinate of the mouse click |
y | The normalized Y-coordinate of the mouse click |
viewer | The viewer currently used to render the scene |
MapObject * Updraft::Core::PickHandler::getMapObject | ( | osg::Node * | node | ) | [protected] |
bool Updraft::Core::PickHandler::handle | ( | const osgGA::GUIEventAdapter & | ea, |
osgGA::GUIActionAdapter & | aa | ||
) |
Handles the osg gui event.
It gets all of the intersected map objects and then, according to the event type, either a left click or right click is raised.
ea | The osg event adapter for the event that is being handled. |
aa | The osg action adapter for the current event. This is not used in thecurrent implementation. |
void Updraft::Core::PickHandler::raiseLeftClick | ( | QVector< Pair > | mapObjects | ) | [protected] |
Method that calls the click handlers for all interested plugins for all intersected map objects.
mapObjects | The vector of intersected map objects. |
void Updraft::Core::PickHandler::raiseRightClick | ( | QVector< Pair > | mapObjects | ) | [protected] |
Requests the context menu actions from all plugins for all intersected map objects.
The context menu is then executed.
mapObjects | The vector of intersected map objects. |
The setting for the mouse event tolerance used in the method eventsCloseEnough()
float Updraft::Core::PickHandler::mX [protected] |
Store mouse xy location for button press & move events.
float Updraft::Core::PickHandler::mY [protected] |
QList<QAction*> Updraft::Core::PickHandler::ownedActions [protected] |