Updraft  1.0
Open source glider flight visualisation tool.
Updraft::Core::PickHandler Class Reference

Handler of osg events that implements clicking of map objects. More...

#include <pickhandler.h>

Collaboration diagram for Updraft::Core::PickHandler:

List of all members.

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.
MapObjectgetMapObject (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< PairgetIntersectedMapObjects (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
SettingInterfacemouseEventTolerance
 The setting for the mouse event tolerance used in the method eventsCloseEnough()
QList< QAction * > ownedActions

Detailed Description

Handler of osg events that implements clicking of map objects.


Constructor & Destructor Documentation


Member Function Documentation

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.

Parameters:
x1X-coordinate of the first event
y1Y-coordinate of the first event
x2X-coordinate of the second event
y2Y-coordinate of the second event
Returns:
True if the events are close enough.
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.

Parameters:
xThe normalized X-coordinate of the mouse click
yThe normalized Y-coordinate of the mouse click
viewerThe viewer currently used to render the scene
Returns:
QVector of all map objects that were intersected by the click action with the given normalized coordinates.
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.

Parameters:
eaThe osg event adapter for the event that is being handled.
aaThe osg action adapter for the current event. This is not used in thecurrent implementation.
Returns:
true If the event was accepted and handled.
void Updraft::Core::PickHandler::raiseLeftClick ( QVector< Pair mapObjects) [protected]

Method that calls the click handlers for all interested plugins for all intersected map objects.

Parameters:
mapObjectsThe 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.

Parameters:
mapObjectsThe vector of intersected map objects.

Member Data Documentation

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]

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines