OpenSceneGraph  3.0.1
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes
osgGA::SphericalManipulator Class Reference
Inheritance diagram for osgGA::SphericalManipulator:
Inheritance graph
[legend]

List of all members.

Public Types

enum  RotationMode { ELEVATION_HEADING = 0, HEADING, ELEVATION, MAP }

Public Member Functions

 SphericalManipulator ()
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
osgUtil::SceneView::FusionDistanceMode 
getFusionDistanceMode () const
 Get the FusionDistanceMode.
virtual float getFusionDistanceValue () const
 Get the FusionDistanceValue.
virtual void setNode (osg::Node *)
 Attach a node to the manipulator.
virtual const osg::NodegetNode () const
 Return node if attached.
virtual osg::NodegetNode ()
 Return node if attached.
virtual void home (const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &us)
 Move the camera to the default position.
virtual void home (double)
 Move the camera to the default position.
virtual void init (const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &us)
 Start/restart the manipulator.
void zoomOn (const osg::BoundingSphere &bound)
virtual bool handle (const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &us)
 handle events, return true if handled, false otherwise.
virtual void computeHomePosition ()
 Compute the home position.
void computeViewPosition (const osg::BoundingSphere &bound, double &scale, double &distance, osg::Vec3d &center)
void setCenter (const osg::Vec3d &center)
const osg::Vec3dgetCenter () const
bool setDistance (double distance)
double getDistance () const
double getHomeDistance () const
void setHeading (double azimuth)
double getHeading () const
void setElevation (double elevation)
double getElevtion () const
double getMinimumZoomScale () const
 get the minimum distance (as ratio) the eye point can be zoomed in
void setMinimumZoomScale (double minimumZoomScale)
 set the minimum distance (as ratio) the eye point can be zoomed in towards the center before the center is pushed forward.
void setScroolWheelZoomDelta (double zoomDelta)
 set the mouse scroll wheel zoom delta.
double getScroolWheelZoomDelta () const
 get the mouse scroll wheel zoom delta.
virtual void getUsage (osg::ApplicationUsage &usage) const
 Get the keyboard and mouse usage of this manipulator.
RotationMode getRotationMode () const
void setRotationMode (RotationMode mode)
bool getAllowThrow () const
 Returns true if the camera can be thrown, false otherwise.
void setAllowThrow (bool allowThrow)
 Set the 'allow throw' flag.

Protected Member Functions

virtual ~SphericalManipulator ()
void flushMouseEventStack ()
 Reset the internal GUIEvent stack.
void addMouseEvent (const osgGA::GUIEventAdapter &ea)
 Add the current mouse GUIEvent to internal stack.
bool calcMovement ()
 For the give mouse movement calculate the movement of the camera.
bool isMouseMoving ()
 Check the speed at which the mouse is moving.

Protected Attributes

osg::ref_ptr< const
osgGA::GUIEventAdapter
_ga_t1
osg::ref_ptr< const
osgGA::GUIEventAdapter
_ga_t0
osg::observer_ptr< osg::Node_node
double _modelScale
double _minimumZoomScale
bool _thrown
bool _allowThrow
double _delta_frame_time
 The approximate amount of time it is currently taking to draw a frame.
double _last_frame_time
 The time the last frame started.
RotationMode _rotationMode
osg::Vec3d _center
double _distance
double _heading
double _elevation
double _homeDistance
double _zoomDelta

Member Enumeration Documentation

Enumerator:
ELEVATION_HEADING 
HEADING 
ELEVATION 
MAP 

Constructor & Destructor Documentation

osgGA::SphericalManipulator::SphericalManipulator ( )
virtual osgGA::SphericalManipulator::~SphericalManipulator ( ) [protected, virtual]

Member Function Documentation

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

Add the current mouse GUIEvent to internal stack.

bool osgGA::SphericalManipulator::calcMovement ( ) [protected]

For the give mouse movement calculate the movement of the camera.

Return true is camera has moved and a redraw is required.

virtual const char* osgGA::SphericalManipulator::className ( ) const [inline, virtual]

return the name of the object's class type.

Must be defined by derived classes.

Reimplemented from osgGA::CameraManipulator.

virtual void osgGA::SphericalManipulator::computeHomePosition ( ) [virtual]

Compute the home position.

void osgGA::SphericalManipulator::computeViewPosition ( const osg::BoundingSphere bound,
double &  scale,
double &  distance,
osg::Vec3d center 
)
void osgGA::SphericalManipulator::flushMouseEventStack ( ) [protected]

Reset the internal GUIEvent stack.

bool osgGA::SphericalManipulator::getAllowThrow ( ) const [inline]

Returns true if the camera can be thrown, false otherwise.

This defaults to true.

const osg::Vec3d& osgGA::SphericalManipulator::getCenter ( ) const [inline]
double osgGA::SphericalManipulator::getDistance ( ) const [inline]
double osgGA::SphericalManipulator::getElevtion ( ) const [inline]
virtual osgUtil::SceneView::FusionDistanceMode osgGA::SphericalManipulator::getFusionDistanceMode ( ) const [inline, virtual]

Get the FusionDistanceMode.

Used by SceneView for setting up stereo convergence.

Reimplemented from osgGA::CameraManipulator.

virtual float osgGA::SphericalManipulator::getFusionDistanceValue ( ) const [inline, virtual]

Get the FusionDistanceValue.

Used by SceneView for setting up stereo convergence.

Reimplemented from osgGA::CameraManipulator.

double osgGA::SphericalManipulator::getHeading ( ) const [inline]
double osgGA::SphericalManipulator::getHomeDistance ( ) const [inline]
virtual osg::Matrixd osgGA::SphericalManipulator::getInverseMatrix ( ) const [virtual]

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

Implements osgGA::CameraManipulator.

virtual osg::Matrixd osgGA::SphericalManipulator::getMatrix ( ) const [virtual]

get the position of the manipulator as 4x4 Matrix.

Implements osgGA::CameraManipulator.

double osgGA::SphericalManipulator::getMinimumZoomScale ( ) const [inline]

get the minimum distance (as ratio) the eye point can be zoomed in

virtual const osg::Node* osgGA::SphericalManipulator::getNode ( ) const [virtual]

Return node if attached.

Reimplemented from osgGA::CameraManipulator.

virtual osg::Node* osgGA::SphericalManipulator::getNode ( ) [virtual]

Return node if attached.

Reimplemented from osgGA::CameraManipulator.

RotationMode osgGA::SphericalManipulator::getRotationMode ( ) const [inline]
double osgGA::SphericalManipulator::getScroolWheelZoomDelta ( ) const [inline]

get the mouse scroll wheel zoom delta.

virtual void osgGA::SphericalManipulator::getUsage ( osg::ApplicationUsage usage) const [virtual]

Get the keyboard and mouse usage of this manipulator.

Reimplemented from osgGA::GUIEventHandler.

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

handle events, return true if handled, false otherwise.

Reimplemented from osgGA::CameraManipulator.

virtual void osgGA::SphericalManipulator::home ( const osgGA::GUIEventAdapter ea,
osgGA::GUIActionAdapter us 
) [virtual]

Move the camera to the default position.

May be ignored by manipulators if home functionality is not appropriate.

Reimplemented from osgGA::CameraManipulator.

virtual void osgGA::SphericalManipulator::home ( double  ) [virtual]

Move the camera to the default position.

This version does not require GUIEventAdapter and GUIActionAdapter so may be called from somewhere other than a handle() method in GUIEventHandler. Application must be aware of implications.

Reimplemented from osgGA::CameraManipulator.

virtual void osgGA::SphericalManipulator::init ( const osgGA::GUIEventAdapter ea,
osgGA::GUIActionAdapter us 
) [virtual]

Start/restart the manipulator.

Reimplemented from osgGA::CameraManipulator.

bool osgGA::SphericalManipulator::isMouseMoving ( ) [protected]

Check the speed at which the mouse is moving.

If speed is below a threshold then return false, otherwise return true.

void osgGA::SphericalManipulator::setAllowThrow ( bool  allowThrow) [inline]

Set the 'allow throw' flag.

Releasing the mouse button while moving the camera results in a throw.

virtual void osgGA::SphericalManipulator::setByInverseMatrix ( const osg::Matrixd matrix) [inline, virtual]

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

Implements osgGA::CameraManipulator.

References osg::Matrixd::inverse().

virtual void osgGA::SphericalManipulator::setByMatrix ( const osg::Matrixd matrix) [virtual]

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

Implements osgGA::CameraManipulator.

void osgGA::SphericalManipulator::setCenter ( const osg::Vec3d center) [inline]
bool osgGA::SphericalManipulator::setDistance ( double  distance)
void osgGA::SphericalManipulator::setElevation ( double  elevation) [inline]
void osgGA::SphericalManipulator::setHeading ( double  azimuth) [inline]
void osgGA::SphericalManipulator::setMinimumZoomScale ( double  minimumZoomScale) [inline]

set the minimum distance (as ratio) the eye point can be zoomed in towards the center before the center is pushed forward.

virtual void osgGA::SphericalManipulator::setNode ( osg::Node ) [virtual]

Attach a node to the manipulator.

Automatically detaches previously attached node. setNode(NULL) detaches previously nodes. Is ignored by manipulators which do not require a reference model.

Reimplemented from osgGA::CameraManipulator.

void osgGA::SphericalManipulator::setRotationMode ( RotationMode  mode)
void osgGA::SphericalManipulator::setScroolWheelZoomDelta ( double  zoomDelta) [inline]

set the mouse scroll wheel zoom delta.

Range -1.0 to +1.0, -ve value inverts wheel direction and zero switches off scroll wheel.

void osgGA::SphericalManipulator::zoomOn ( const osg::BoundingSphere bound)

Member Data Documentation

The approximate amount of time it is currently taking to draw a frame.

This is used to compute the delta in translation/rotation during a thrown display update. It allows us to match an delta in position/rotation independent of the rendering frame rate.

The time the last frame started.

Used when _rate_sensitive is true so that we can match display update rate to rotation/translation rate.


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

osg logo
Generated at Mon Oct 3 2011 12:39:47 for the OpenSceneGraph by doxygen 1.7.5.