Robotsystem from Robot Group Leipzig: CameraManipulator Class Reference

- Main Page
- Modules
- Namespaces
- Classes
- Files
- Directories
- Examples

- Class List
- Alphabetical List
- Class Hierarchy
- Class Members

# CameraManipulator Class Reference

`#include <cameramanipulator.h>`

Inheritance diagram for CameraManipulator:

[legend]
Collaboration diagram for CameraManipulator:

[legend]
List of all members.

## Detailed Description

CameraManipulator is a MatrixManipulator which provides Flying simulator-like updating of the camera position & orientation.

Left mouse button: Pan and tilt Right mouse button: forward and sideways Middle mouse button: up and sideways

Definition at line 86 of file cameramanipulator.h.

## Public Member Functions
| CameraManipulator (osg::Node *node, GlobalData &global)
virtual const char * | className () const
| returns the classname of the manipulator it's NECCESSARY to define this funtion, otherwise the new manipulator WON'T WORK! (but ask me not why)
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 | setNode (osg::Node *)
| is called every time the draw is updated.
virtual const osg::Node * | getNode () const
virtual osg::Node * | getNode ()
virtual void | setHome (const osg::Vec3 &eye, const osg::Vec3 &view)
| set the home position of the camera. (and place it there)
virtual void | home (const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &us)
| place the camera at its home position
virtual void | init (const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &us)
virtual bool | handle (const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &us)
virtual void | getUsage (osg::ApplicationUsage &usage) const
| Get the keyboard and mouse usage of this manipulator.
virtual void | update ()
| updates the camera module at every drawstep should be called from the simulation loop
## Protected Member Functions
virtual | ~CameraManipulator ()
virtual void | flushMouseEventStack ()
| Reset the internal GUIEvent stack.
virtual void | addMouseEvent (const osgGA::GUIEventAdapter &ea)
| Add the current mouse GUIEvent to internal stack.
virtual void | computeMatrix ()
virtual bool | calcMovement ()
| For the give mouse movement calculate the movement of the camera.
virtual void | manageAgents (const int &fkey)
| This manages the robots, switching between them and so on Is normally called from handle(.
virtual void | calcMovementByAgent ()
| This handles robot movements, so that the camera movemenent is right affected.
virtual void | setHomeViewByAgent ()
| Sets the right view and eye if the robot has changed.
virtual void | setHomeEyeByAgent ()
## Protected Attributes
osg::ref_ptr< const osgGA::GUIEventAdapter > | event_old
osg::ref_ptr< const osgGA::GUIEventAdapter > | event
osg::ref_ptr< osg::Node > | node
float | modelScale
osg::Matrixd | pose
GlobalData & | globalData
double | degreeSmoothness
double | lengthSmoothness
double | degreeAccuracy
double | lengthAccuracy
## Static Protected Attributes
static osg::Vec3 | eye
static osg::Vec3 | view
static osg::Vec3 | home_eye
static osg::Vec3 | home_view
static bool | home_externally_set = false
static osg::Vec3 | desiredEye
static osg::Vec3 | desiredView
static OdeAgent * | watchingAgent
static bool | watchingAgentDefined = false
static Position | oldPositionOfAgent
static bool | oldPositionOfAgentDefined = false
static int | i

## Constructor & Destructor Documentation

CameraManipulator | ( | osg::Node * | node,
|  | GlobalData & | global
| ) |

| Definition at line 109 of file cameramanipulator.cpp.

~CameraManipulator | ( |  | ) | `[protected, virtual]`

| Definition at line 126 of file cameramanipulator.cpp.

## Member Function Documentation

virtual void addMouseEvent | ( | const osgGA::GUIEventAdapter & | ea | ) | `[protected, virtual]`

| Add the current mouse GUIEvent to internal stack.

bool calcMovement | ( |  | ) | `[protected, virtual]`

| For the give mouse movement calculate the movement of the camera. Return true is camera has moved and a redraw is required. Definition at line 350 of file cameramanipulator.cpp.

void calcMovementByAgent | ( |  | ) | `[protected, virtual]`

| This handles robot movements, so that the camera movemenent is right affected. should normally be overwritten by new cameramanipulator Reimplemented in CameraManipulatorFollow, CameraManipulatorRace, and CameraManipulatorTV. Definition at line 403 of file cameramanipulator.cpp.

virtual const char* className | ( |  | ) | const`[inline, virtual]`

| returns the classname of the manipulator it's NECCESSARY to define this funtion, otherwise the new manipulator WON'T WORK! (but ask me not why) Reimplemented in CameraManipulatorRace, and CameraManipulatorTV. Definition at line 97 of file cameramanipulator.h.

void computeMatrix | ( |  | ) | `[protected, virtual]`

| Definition at line 334 of file cameramanipulator.cpp.

void flushMouseEventStack | ( |  | ) | `[protected, virtual]`

| Reset the internal GUIEvent stack. Definition at line 255 of file cameramanipulator.cpp.

Matrixd 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 330 of file cameramanipulator.cpp.

Matrixd getMatrix | ( |  | ) | const`[virtual]`

| get the position of the manipulator as 4x4 Matrix. Definition at line 287 of file cameramanipulator.cpp.

Node * getNode | ( |  | ) | `[virtual]`

| Definition at line 136 of file cameramanipulator.cpp.

const Node * getNode | ( |  | ) | const`[virtual]`

| Definition at line 132 of file cameramanipulator.cpp.

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

| Get the keyboard and mouse usage of this manipulator.

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

virtual void home | ( | const osgGA::GUIEventAdapter & | ea,
|  | osgGA::GUIActionAdapter & | us
| ) | `[virtual]`

| place the camera at its home position

virtual void init | ( | const osgGA::GUIEventAdapter & | ea,
|  | osgGA::GUIActionAdapter & | us
| ) | `[virtual]`

void manageAgents | ( | const int & | fkey | ) | `[protected, virtual]`

| This manages the robots, switching between them and so on Is normally called from handle(. ..) Definition at line 381 of file cameramanipulator.cpp.

virtual void setByInverseMatrix | ( | const osg::Matrixd & | matrix | ) | `[inline, virtual]`

| set the position of the matrix manipulator using a 4x4 Matrix. Definition at line 103 of file cameramanipulator.h.

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

| set the position of the matrix manipulator using a 4x4 Matrix.

void setHome | ( | const osg::Vec3 & | eye,
|  | const osg::Vec3 & | view
| ) | `[virtual]`

| set the home position of the camera. (and place it there) Definition at line 141 of file cameramanipulator.cpp.

void setHomeEyeByAgent | ( |  | ) | `[protected, virtual]`

| Reimplemented in CameraManipulatorTV. Definition at line 415 of file cameramanipulator.cpp.

void setHomeViewByAgent | ( |  | ) | `[protected, virtual]`

| Sets the right view and eye if the robot has changed. Is called from manageRobots(); should be overwritten by new cameramanipulator (if needed) Reimplemented in CameraManipulatorFollow, and CameraManipulatorTV. Definition at line 410 of file cameramanipulator.cpp.

virtual void setNode | ( | osg::Node * |  | ) | `[virtual]`

| is called every time the draw is updated. computes the movement of the camera, which is a difference between the desired pos and view and the actual pos and view.

void update | ( |  | ) | `[virtual]`

| updates the camera module at every drawstep should be called from the simulation loop Definition at line 291 of file cameramanipulator.cpp.

## Member Data Documentation

double degreeAccuracy`[protected]`

| Definition at line 191 of file cameramanipulator.h.

double degreeSmoothness`[protected]`

| Definition at line 189 of file cameramanipulator.h.

osg::Vec3 desiredEye`[static, protected]`

| Definition at line 177 of file cameramanipulator.h.

osg::Vec3 desiredView`[static, protected]`

| Definition at line 178 of file cameramanipulator.h.

osg::ref_ptr<const osgGA::GUIEventAdapter> event`[protected]`

| Definition at line 164 of file cameramanipulator.h.

osg::ref_ptr<const osgGA::GUIEventAdapter> event_old`[protected]`

| Definition at line 163 of file cameramanipulator.h.

osg::Vec3 eye`[static, protected]`

| Definition at line 171 of file cameramanipulator.h.

GlobalData& globalData`[protected]`

| Definition at line 186 of file cameramanipulator.h.

bool home_externally_set = false`[static, protected]`

| Definition at line 175 of file cameramanipulator.h.

osg::Vec3 home_eye`[static, protected]`

| Definition at line 173 of file cameramanipulator.h.

osg::Vec3 home_view`[static, protected]`

| Definition at line 174 of file cameramanipulator.h.

int i`[static, protected]`

| Definition at line 215 of file cameramanipulator.h.

double lengthAccuracy`[protected]`

| Definition at line 192 of file cameramanipulator.h.

double lengthSmoothness`[protected]`

| Definition at line 190 of file cameramanipulator.h.

float modelScale`[protected]`

| Definition at line 168 of file cameramanipulator.h.

osg::ref_ptr<osg::Node> node`[protected]`

| Definition at line 166 of file cameramanipulator.h.

Position oldPositionOfAgent`[static, protected]`

| Definition at line 183 of file cameramanipulator.h.

bool oldPositionOfAgentDefined = false`[static, protected]`

| Definition at line 184 of file cameramanipulator.h.

osg::Matrixd pose`[protected]`

| Definition at line 169 of file cameramanipulator.h.

osg::Vec3 view`[static, protected]`

| Definition at line 172 of file cameramanipulator.h.

OdeAgent * watchingAgent`[static, protected]`

| Definition at line 180 of file cameramanipulator.h.

bool watchingAgentDefined = false`[static, protected]`

| Definition at line 181 of file cameramanipulator.h.