OpenWalnut
1.4.0
|
A manipulator which changes the view of a 2D scene. More...
#include <WGE2DManipulator.h>
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 |
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.
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.
void WGE2DManipulator::addMouseEvent | ( | const osgGA::GUIEventAdapter & | ea | ) | [protected] |
Add the current mouse GUIEvent to the internal stack.
ea | the 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.
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.
Definition at line 35 of file WGE2DManipulator.cpp.
void WGE2DManipulator::flushMouseEventStack | ( | ) | [protected] |
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.
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.
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.
usage | the application usage |
Definition at line 132 of file WGE2DManipulator.cpp.
bool WGE2DManipulator::handle | ( | const osgGA::GUIEventAdapter & | ea, |
osgGA::GUIActionAdapter & | us | ||
) | [virtual] |
Handle events.
ea | event class for storing keyboard, mouse and window events |
us | the action adapter used to request actions of the GUI |
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.
us | the 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.
us | the 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.
matrix | a 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.
matrix | a 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.
ea | event class for storing keyboard, mouse and window events |
Definition at line 172 of file WGE2DManipulator.cpp.
References m_zoom.
Referenced by handle().
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().
double WGE2DManipulator::m_positionX [private] |
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().
double WGE2DManipulator::m_positionY [private] |
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().