OpenWalnut  1.4.0
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes
WGE2DManipulator Class Reference

A manipulator which changes the view of a 2D scene. More...

#include <WGE2DManipulator.h>

+ Inheritance diagram for WGE2DManipulator:

List of all members.

Public Member Functions

 WGE2DManipulator ()
 Constructor.
virtual const char * className () const
 Return the name of the object's class type.
virtual void setByMatrix (const osg::Matrixd &matrix)
 Set the position of the matrix manipulator using a 4x4 matrix.
virtual void setByInverseMatrix (const osg::Matrixd &matrix)
 Set the position of the matrix manipulator using a 4x4 matrix.
virtual osg::Matrixd getMatrix () const
 Get the position of the manipulator as 4x4 matrix.
virtual osg::Matrixd getInverseMatrix () const
 Get the position of the manipulator as a inverse matrix of the manipulator, typically used as a model view matrix.
virtual void home (const osgGA::GUIEventAdapter &, osgGA::GUIActionAdapter &us)
 Move the camera to the default position.
virtual void init (const osgGA::GUIEventAdapter &, osgGA::GUIActionAdapter &us)
 Start/restart the manipulator.
virtual bool handle (const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &us)
 Handle events.
virtual void getUsage (osg::ApplicationUsage &usage) const
 Get the keyboard and mouse usage of this manipulator.

Protected Member Functions

virtual ~WGE2DManipulator ()
 Destructor.
void flushMouseEventStack ()
 Reset the internal GUIEvent stack.
void addMouseEvent (const osgGA::GUIEventAdapter &ea)
 Add the current mouse GUIEvent to the internal stack.
bool calcMovement ()
 Calculate the movement of the camera for the given mouse movement.

Protected Attributes

osg::ref_ptr< const
osgGA::GUIEventAdapter > 
m_ga_t1
 The older event from the internal event stack.
osg::ref_ptr< const
osgGA::GUIEventAdapter > 
m_ga_t0
 The newer event from the internal event stack.

Private Member Functions

bool zoom (const osgGA::GUIEventAdapter &ea)
 Handles events related to zooming.

Private Attributes

double m_positionX
 The x-position of the viewing window's lower left corner.
double m_positionY
 The y-position of the viewing window's lower left corner.
double m_zoom
 zoom factor

Detailed Description

A manipulator which changes the view of a 2D scene.

Does things like panning and zooming.

Definition at line 49 of file WGE2DManipulator.h.


Constructor & Destructor Documentation

Constructor.

Definition at line 28 of file WGE2DManipulator.cpp.

WGE2DManipulator::~WGE2DManipulator ( ) [protected, virtual]

Destructor.

Note, is protected so that objects cannot be deleted other than by being dereferenced and the reference count being zero (see osg::Referenced), preventing the deletion of objects which are still in use.

Definition at line 137 of file WGE2DManipulator.cpp.


Member Function Documentation

void WGE2DManipulator::addMouseEvent ( const osgGA::GUIEventAdapter &  ea) [protected]

Add the current mouse GUIEvent to the internal stack.

Parameters:
eathe current event class with a mouse event

Definition at line 147 of file WGE2DManipulator.cpp.

References m_ga_t0, and m_ga_t1.

Referenced by handle().

bool WGE2DManipulator::calcMovement ( ) [protected]

Calculate the movement of the camera for the given mouse movement.

Returns:
true is camera has moved and a redraw is required

Definition at line 153 of file WGE2DManipulator.cpp.

References m_ga_t0, m_ga_t1, m_positionX, m_positionY, and m_zoom.

Referenced by handle().

const char * WGE2DManipulator::className ( ) const [virtual]

Return the name of the object's class type.

Returns:
the name of the object's class type

Definition at line 35 of file WGE2DManipulator.cpp.

Reset the internal GUIEvent stack.

Definition at line 141 of file WGE2DManipulator.cpp.

References m_ga_t0, and m_ga_t1.

Referenced by home(), and init().

osg::Matrixd WGE2DManipulator::getInverseMatrix ( ) const [virtual]

Get the position of the manipulator as a inverse matrix of the manipulator, typically used as a model view matrix.

Returns:
the position of the manipulator as a inverse matrix

Definition at line 59 of file WGE2DManipulator.cpp.

References m_positionX, m_positionY, and m_zoom.

osg::Matrixd WGE2DManipulator::getMatrix ( ) const [virtual]

Get the position of the manipulator as 4x4 matrix.

Returns:
the position of the manipulator as 4x4 matrix

Definition at line 54 of file WGE2DManipulator.cpp.

References m_positionX, m_positionY, and m_zoom.

void WGE2DManipulator::getUsage ( osg::ApplicationUsage &  usage) const [virtual]

Get the keyboard and mouse usage of this manipulator.

Parameters:
usagethe application usage

Definition at line 132 of file WGE2DManipulator.cpp.

bool WGE2DManipulator::handle ( const osgGA::GUIEventAdapter &  ea,
osgGA::GUIActionAdapter &  us 
) [virtual]

Handle events.

Parameters:
eaevent class for storing keyboard, mouse and window events
usthe action adapter used to request actions of the GUI
Returns:
true if handled, false otherwise

Definition at line 81 of file WGE2DManipulator.cpp.

References addMouseEvent(), calcMovement(), home(), and zoom().

void WGE2DManipulator::home ( const osgGA::GUIEventAdapter &  ,
osgGA::GUIActionAdapter &  us 
) [virtual]

Move the camera to the default position.

Parameters:
usthe action adapter used to request actions of the GUI

Definition at line 64 of file WGE2DManipulator.cpp.

References flushMouseEventStack(), m_positionX, m_positionY, and m_zoom.

Referenced by handle().

void WGE2DManipulator::init ( const osgGA::GUIEventAdapter &  ,
osgGA::GUIActionAdapter &  us 
) [virtual]

Start/restart the manipulator.

Parameters:
usthe action adapter used to request actions of the GUI

Definition at line 74 of file WGE2DManipulator.cpp.

References flushMouseEventStack().

void WGE2DManipulator::setByInverseMatrix ( const osg::Matrixd &  matrix) [virtual]

Set the position of the matrix manipulator using a 4x4 matrix.

Parameters:
matrixa 4x4 matrix

Definition at line 47 of file WGE2DManipulator.cpp.

References m_positionX, m_positionY, and m_zoom.

void WGE2DManipulator::setByMatrix ( const osg::Matrixd &  matrix) [virtual]

Set the position of the matrix manipulator using a 4x4 matrix.

Parameters:
matrixa 4x4 matrix

Definition at line 40 of file WGE2DManipulator.cpp.

References m_positionX, m_positionY, and m_zoom.

bool WGE2DManipulator::zoom ( const osgGA::GUIEventAdapter &  ea) [private]

Handles events related to zooming.

Parameters:
eaevent class for storing keyboard, mouse and window events
Returns:
true if event was handled

Definition at line 172 of file WGE2DManipulator.cpp.

References m_zoom.

Referenced by handle().


Member Data Documentation

osg::ref_ptr< const osgGA::GUIEventAdapter > WGE2DManipulator::m_ga_t0 [protected]

The newer event from the internal event stack.

Definition at line 160 of file WGE2DManipulator.h.

Referenced by addMouseEvent(), calcMovement(), and flushMouseEventStack().

osg::ref_ptr< const osgGA::GUIEventAdapter > WGE2DManipulator::m_ga_t1 [protected]

The older event from the internal event stack.

Definition at line 155 of file WGE2DManipulator.h.

Referenced by addMouseEvent(), calcMovement(), and flushMouseEventStack().

The x-position of the viewing window's lower left corner.

Definition at line 175 of file WGE2DManipulator.h.

Referenced by calcMovement(), getInverseMatrix(), getMatrix(), home(), setByInverseMatrix(), and setByMatrix().

The y-position of the viewing window's lower left corner.

Definition at line 180 of file WGE2DManipulator.h.

Referenced by calcMovement(), getInverseMatrix(), getMatrix(), home(), setByInverseMatrix(), and setByMatrix().

double WGE2DManipulator::m_zoom [private]

zoom factor

Definition at line 185 of file WGE2DManipulator.h.

Referenced by calcMovement(), getInverseMatrix(), getMatrix(), home(), setByInverseMatrix(), setByMatrix(), and zoom().


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