KeySwitchMatrixManipulator
Go to the documentation of this file.
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#ifndef OSGUTIL_KEYSWITCMATRIXMANIPULATOR
#define OSGUTIL_KEYSWITCMATRIXMANIPULATOR 1
#include <osgGA/Export>
#include <osgGA/CameraManipulator>
#include <osgGA/GUIEventHandler>
namespace osgGA{
class GUIActionAdapter;
class OSGGA_EXPORT KeySwitchMatrixManipulator : public CameraManipulator
{
public:
typedef std::pair<std::string, osg::ref_ptr<CameraManipulator> > NamedManipulator;
typedef std::map<int, NamedManipulator> KeyManipMap;
virtual const char* className() const { return "KeySwitchMatrixManipulator"; }
void addMatrixManipulator(int key, std::string name, CameraManipulator *cm);
void addNumberedMatrixManipulator(CameraManipulator *cm);
unsigned int getNumMatrixManipulators() const { return _manips.size(); }
void selectMatrixManipulator(unsigned int num);
KeyManipMap& getKeyManipMap() { return _manips; }
const KeyManipMap& getKeyManipMap() const { return _manips; }
CameraManipulator* getCurrentMatrixManipulator() { return _current.get(); }
const CameraManipulator* getCurrentMatrixManipulator() const { return _current.get(); }
CameraManipulator* getMatrixManipulatorWithIndex(unsigned int key);
const CameraManipulator* getMatrixManipulatorWithIndex(unsigned int key) const;
CameraManipulator* getMatrixManipulatorWithKey(unsigned int key);
const CameraManipulator* getMatrixManipulatorWithKey(unsigned int key) const;
// Overrides from CameraManipulator...
virtual void setCoordinateFrameCallback(CoordinateFrameCallback* cb);
virtual void setByMatrix(const osg::Matrixd& matrix) { _current->setByMatrix(matrix); }
virtual void setByInverseMatrix(const osg::Matrixd& matrix) { _current->setByInverseMatrix(matrix); }
virtual osg::Matrixd getMatrix() const { return _current->getMatrix(); }
virtual osg::Matrixd getInverseMatrix() const { return _current->getInverseMatrix(); }
virtual osgUtil::SceneView::FusionDistanceMode getFusionDistanceMode() const { return _current->getFusionDistanceMode(); }
virtual float getFusionDistanceValue() const { return _current->getFusionDistanceValue(); }
virtual void setNode(osg::Node* n);
virtual const osg::Node* getNode() const { return _current->getNode(); }
virtual osg::Node* getNode() { return _current->getNode(); }
virtual void setHomePosition(const osg::Vec3d& eye, const osg::Vec3d& center, const osg::Vec3d& up, bool autoComputeHomePosition=false);
virtual void setAutoComputeHomePosition(bool flag);
virtual void computeHomePosition();
virtual void finishAnimation();
virtual void home(const GUIEventAdapter& ee,GUIActionAdapter& aa);
virtual void init(const GUIEventAdapter& ee,GUIActionAdapter& aa) { if (_current.valid()) _current->init(ee,aa); }
virtual bool handle(const GUIEventAdapter& ea,GUIActionAdapter& us);
virtual void getUsage(osg::ApplicationUsage& usage) const;
private:
KeyManipMap _manips;
osg::ref_ptr<CameraManipulator> _current;
};
}
#endif
CameraManipulator
GUIEventHandler
osgGA::CameraManipulator::CoordinateFrameCallback
Definition CameraManipulator:51
osgGA::CameraManipulator::CameraManipulator
CameraManipulator()
osgGA::GUIActionAdapter
Definition GUIActionAdapter:62
osgGA::GUIEventAdapter
Definition GUIEventAdapter:82
osgGA::KeySwitchMatrixManipulator
Definition KeySwitchMatrixManipulator:32
osgGA::KeySwitchMatrixManipulator::getCurrentMatrixManipulator
const CameraManipulator * getCurrentMatrixManipulator() const
Definition KeySwitchMatrixManipulator:66
osgGA::KeySwitchMatrixManipulator::setByMatrix
virtual void setByMatrix(const osg::Matrixd &matrix)
Definition KeySwitchMatrixManipulator:88
osgGA::KeySwitchMatrixManipulator::getNode
virtual const osg::Node * getNode() const
Definition KeySwitchMatrixManipulator:108
osgGA::KeySwitchMatrixManipulator::getCurrentMatrixManipulator
CameraManipulator * getCurrentMatrixManipulator()
Definition KeySwitchMatrixManipulator:63
osgGA::KeySwitchMatrixManipulator::setByInverseMatrix
virtual void setByInverseMatrix(const osg::Matrixd &matrix)
Definition KeySwitchMatrixManipulator:91
osgGA::KeySwitchMatrixManipulator::getFusionDistanceMode
virtual osgUtil::SceneView::FusionDistanceMode getFusionDistanceMode() const
Definition KeySwitchMatrixManipulator:100
osgGA::KeySwitchMatrixManipulator::setHomePosition
virtual void setHomePosition(const osg::Vec3d &eye, const osg::Vec3d &center, const osg::Vec3d &up, bool autoComputeHomePosition=false)
osgGA::KeySwitchMatrixManipulator::getMatrixManipulatorWithIndex
CameraManipulator * getMatrixManipulatorWithIndex(unsigned int key)
osgGA::KeySwitchMatrixManipulator::getKeyManipMap
const KeyManipMap & getKeyManipMap() const
Definition KeySwitchMatrixManipulator:59
osgGA::KeySwitchMatrixManipulator::getFusionDistanceValue
virtual float getFusionDistanceValue() const
Definition KeySwitchMatrixManipulator:103
osgGA::KeySwitchMatrixManipulator::handle
virtual bool handle(const GUIEventAdapter &ea, GUIActionAdapter &us)
osgGA::KeySwitchMatrixManipulator::finishAnimation
virtual void finishAnimation()
osgGA::KeySwitchMatrixManipulator::getKeyManipMap
KeyManipMap & getKeyManipMap()
Definition KeySwitchMatrixManipulator:56
osgGA::KeySwitchMatrixManipulator::getMatrixManipulatorWithKey
const CameraManipulator * getMatrixManipulatorWithKey(unsigned int key) const
osgGA::KeySwitchMatrixManipulator::setNode
virtual void setNode(osg::Node *n)
osgGA::KeySwitchMatrixManipulator::getMatrixManipulatorWithIndex
const CameraManipulator * getMatrixManipulatorWithIndex(unsigned int key) const
osgGA::KeySwitchMatrixManipulator::getInverseMatrix
virtual osg::Matrixd getInverseMatrix() const
Definition KeySwitchMatrixManipulator:97
osgGA::KeySwitchMatrixManipulator::init
virtual void init(const GUIEventAdapter &ee, GUIActionAdapter &aa)
Definition KeySwitchMatrixManipulator:122
osgGA::KeySwitchMatrixManipulator::KeyManipMap
std::map< int, NamedManipulator > KeyManipMap
Definition KeySwitchMatrixManipulator:36
osgGA::KeySwitchMatrixManipulator::computeHomePosition
virtual void computeHomePosition()
osgGA::KeySwitchMatrixManipulator::getMatrixManipulatorWithKey
CameraManipulator * getMatrixManipulatorWithKey(unsigned int key)
osgGA::KeySwitchMatrixManipulator::setCoordinateFrameCallback
virtual void setCoordinateFrameCallback(CoordinateFrameCallback *cb)
osgGA::KeySwitchMatrixManipulator::addNumberedMatrixManipulator
void addNumberedMatrixManipulator(CameraManipulator *cm)
osgGA::KeySwitchMatrixManipulator::getNode
virtual osg::Node * getNode()
Definition KeySwitchMatrixManipulator:110
osgGA::KeySwitchMatrixManipulator::getUsage
virtual void getUsage(osg::ApplicationUsage &usage) const
osgGA::KeySwitchMatrixManipulator::setAutoComputeHomePosition
virtual void setAutoComputeHomePosition(bool flag)
osgGA::KeySwitchMatrixManipulator::home
virtual void home(const GUIEventAdapter &ee, GUIActionAdapter &aa)
osgGA::KeySwitchMatrixManipulator::NamedManipulator
std::pair< std::string, osg::ref_ptr< CameraManipulator > > NamedManipulator
Definition KeySwitchMatrixManipulator:35
osgGA::KeySwitchMatrixManipulator::getMatrix
virtual osg::Matrixd getMatrix() const
Definition KeySwitchMatrixManipulator:94
osgGA::KeySwitchMatrixManipulator::selectMatrixManipulator
void selectMatrixManipulator(unsigned int num)
osgGA::KeySwitchMatrixManipulator::className
virtual const char * className() const
Definition KeySwitchMatrixManipulator:38
osgGA::KeySwitchMatrixManipulator::addMatrixManipulator
void addMatrixManipulator(int key, std::string name, CameraManipulator *cm)
osgGA::KeySwitchMatrixManipulator::getNumMatrixManipulators
unsigned int getNumMatrixManipulators() const
Definition KeySwitchMatrixManipulator:51
osgUtil::SceneView::FusionDistanceMode
FusionDistanceMode
Definition SceneView:339
osg::ApplicationUsage
Definition ApplicationUsage:26
osg::Matrixd
Definition Matrixd:27
osg::Node
Definition Node:72
osg::Vec3d
Definition Vec3d:30
osg::ref_ptr
Definition ref_ptr:32
osgGA
Definition Callback:21
Export
OSGGA_EXPORT
#define OSGGA_EXPORT
Definition osgGA/Export:40