1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
3 * This library is open source and may be redistributed and/or modified under
4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
5 * (at your option) any later version. The full license is in LICENSE file
6 * included with this distribution, and on the openscenegraph.org website.
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * OpenSceneGraph Public License for more details.
14#ifndef OSGGA_VIEWLISTMANIPULATOR
15#define OSGGA_VIEWLISTMANIPULATOR 1
17#include <osgGA/CameraManipulator>
19#include <osg/CameraView>
23class OSGGA_EXPORT CameraViewSwitchManipulator : public CameraManipulator
26 CameraViewSwitchManipulator() {}
28 virtual const char* className() const { return "CameraViewSwitcher"; }
30 /** set the position of the matrix manipulator using a 4x4 Matrix.*/
31 virtual void setByMatrix(const osg::Matrixd& /*matrix*/) {}
33 /** set the position of the matrix manipulator using a 4x4 Matrix.*/
34 virtual void setByInverseMatrix(const osg::Matrixd& /*matrix*/) {}
36 /** get the position of the manipulator as 4x4 Matrix.*/
37 virtual osg::Matrixd getMatrix() const;
39 /** get the position of the manipulator as a inverse matrix of the manipulator, typically used as a model view matrix.*/
40 virtual osg::Matrixd getInverseMatrix() const;
43 /** Attach a node to the manipulator.
44 Automatically detaches previously attached node.
45 setNode(NULL) detaches previously nodes.
46 Is ignored by manipulators which do not require a reference model.*/
47 virtual void setNode(osg::Node*);
49 /** Return node if attached.*/
50 virtual const osg::Node* getNode() const { return _node.get();}
52 /** Return node if attached.*/
53 virtual osg::Node* getNode() { return _node.get();}
55 /** Start/restart the manipulator.*/
56 virtual void init(const GUIEventAdapter& /*ea*/,GUIActionAdapter& /*aa*/) { _currentView = 0; }
58 /** handle events, return true if handled, false otherwise.*/
59 virtual bool handle(const GUIEventAdapter& ea,GUIActionAdapter& us);
61 /** Get the keyboard and mouse usage of this manipulator.*/
62 virtual void getUsage(osg::ApplicationUsage& usage) const;
64 typedef std::vector< osg::ref_ptr<osg::CameraView> > CameraViewList;
68 virtual ~CameraViewSwitchManipulator() {}
70 osg::ref_ptr<osg::Node> _node;
72 CameraViewList _cameraViews;
73 unsigned int _currentView;