OpenWalnut
1.5.0dev
|
A manipulator which changes the view of a 2D scene. More...
#include <WGE2DManipulator.h>
Public Member Functions | |
WGE2DManipulator () | |
Constructor. More... | |
virtual const char * | className () const |
Return the name of the object's class type. More... | |
virtual void | setByMatrix (const osg::Matrixd &matrix) |
Set the position of the matrix manipulator using a 4x4 matrix. More... | |
virtual void | setByInverseMatrix (const osg::Matrixd &matrix) |
Set the position of the matrix manipulator using a 4x4 matrix. More... | |
virtual osg::Matrixd | getMatrix () const |
Get the position of the manipulator as 4x4 matrix. More... | |
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. More... | |
virtual void | home (const osgGA::GUIEventAdapter &, osgGA::GUIActionAdapter &us) |
Move the camera to the default position. More... | |
virtual void | init (const osgGA::GUIEventAdapter &, osgGA::GUIActionAdapter &us) |
Start/restart the manipulator. More... | |
virtual bool | handle (const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &us) |
Handle events. More... | |
virtual void | getUsage (osg::ApplicationUsage &usage) const |
Get the keyboard and mouse usage of this manipulator. More... | |
Protected Member Functions | |
virtual | ~WGE2DManipulator () |
Destructor. More... | |
void | flushMouseEventStack () |
Reset the internal GUIEvent stack. More... | |
void | addMouseEvent (const osgGA::GUIEventAdapter &ea) |
Add the current mouse GUIEvent to the internal stack. More... | |
bool | calcMovement () |
Calculate the movement of the camera for the given mouse movement. More... | |
Protected Attributes | |
osg::ref_ptr< const osgGA::GUIEventAdapter > | m_ga_t1 |
The older event from the internal event stack. More... | |
osg::ref_ptr< const osgGA::GUIEventAdapter > | m_ga_t0 |
The newer event from the internal event stack. More... | |
Private Member Functions | |
bool | zoom (const osgGA::GUIEventAdapter &ea) |
Handles events related to zooming. More... | |
Private Attributes | |
double | m_positionX |
The x-position of the viewing window's lower left corner. More... | |
double | m_positionY |
The y-position of the viewing window's lower left corner. More... | |
double | m_zoom |
zoom factor More... | |
A manipulator which changes the view of a 2D scene.
Does things like panning and zooming.
Definition at line 49 of file WGE2DManipulator.h.
WGE2DManipulator::WGE2DManipulator | ( | ) |
Constructor.
Definition at line 28 of file WGE2DManipulator.cpp.
|
protectedvirtual |
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.
|
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().
|
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().
|
virtual |
Return the name of the object's class type.
Definition at line 35 of file WGE2DManipulator.cpp.
|
protected |
|
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.
|
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.
|
virtual |
Get the keyboard and mouse usage of this manipulator.
usage | the application usage |
Definition at line 132 of file WGE2DManipulator.cpp.
|
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().
|
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().
|
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().
|
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.
|
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.
|
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().
|
protected |
The newer event from the internal event stack.
Definition at line 160 of file WGE2DManipulator.h.
Referenced by addMouseEvent(), calcMovement(), and flushMouseEventStack().
|
protected |
The older event from the internal event stack.
Definition at line 155 of file WGE2DManipulator.h.
Referenced by addMouseEvent(), calcMovement(), and flushMouseEventStack().
|
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().
|
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().
|
private |
zoom factor
Definition at line 185 of file WGE2DManipulator.h.
Referenced by calcMovement(), getInverseMatrix(), getMatrix(), home(), setByInverseMatrix(), setByMatrix(), and zoom().