OpenWalnut
1.4.0
|
00001 //--------------------------------------------------------------------------- 00002 // 00003 // Project: OpenWalnut ( http://www.openwalnut.org ) 00004 // 00005 // Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS 00006 // For more information see http://www.openwalnut.org/copying 00007 // 00008 // This file is part of OpenWalnut. 00009 // 00010 // OpenWalnut is free software: you can redistribute it and/or modify 00011 // it under the terms of the GNU Lesser General Public License as published by 00012 // the Free Software Foundation, either version 3 of the License, or 00013 // (at your option) any later version. 00014 // 00015 // OpenWalnut is distributed in the hope that it will be useful, 00016 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00018 // GNU Lesser General Public License for more details. 00019 // 00020 // You should have received a copy of the GNU Lesser General Public License 00021 // along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>. 00022 // 00023 //--------------------------------------------------------------------------- 00024 00025 #ifndef WGENOOPMANIPULATOR_H 00026 #define WGENOOPMANIPULATOR_H 00027 00028 #include <osg/Version> 00029 00030 // OSG interface changed in 2.9.7, to make it compile also with those versions we do this: 00031 // OSG_MIN_VERSION_REQUIRED(2, 9, 8) macro is not available in e.g. OSG 2.8.1, hence we use the old way 00032 #if ( ( OPENSCENEGRAPH_MAJOR_VERSION > 2 ) || ( OPENSCENEGRAPH_MAJOR_VERSION == 2 && ( OPENSCENEGRAPH_MINOR_VERSION > 9 || \ 00033 ( OPENSCENEGRAPH_MINOR_VERSION == 9 && OPENSCENEGRAPH_PATCH_VERSION >= 8 ) ) ) ) 00034 #include <osgGA/CameraManipulator> 00035 namespace osgGA 00036 { 00037 typedef CameraManipulator MatrixManipulator; 00038 } 00039 #else 00040 #include <osgGA/MatrixManipulator> 00041 #endif 00042 00043 /** 00044 * This is an OSG Manipulator implementation which does nothing. It is very useful for simple two-d views. 00045 */ 00046 class WGENoOpManipulator: public osgGA::MatrixManipulator 00047 { 00048 public: 00049 /** 00050 * Convenience typedef for a boost::shared_ptr< WGENoOpManipulator >. 00051 */ 00052 typedef osg::ref_ptr< WGENoOpManipulator > SPtr; 00053 00054 /** 00055 * Convenience typedef for a boost::shared_ptr< const WGENoOpManipulator >. 00056 */ 00057 typedef osg::ref_ptr< const WGENoOpManipulator > ConstSPtr; 00058 00059 /** 00060 * Default constructor. 00061 */ 00062 WGENoOpManipulator(); 00063 00064 /** 00065 * Destructor. 00066 */ 00067 virtual ~WGENoOpManipulator(); 00068 00069 /** 00070 * Return the name of the object's class type. 00071 * 00072 * \return the name of the object's class type 00073 */ 00074 virtual const char* className() const; 00075 00076 00077 /** 00078 * Set the position of the matrix manipulator using a 4x4 matrix. 00079 * 00080 * \param matrix a 4x4 matrix 00081 */ 00082 virtual void setByMatrix( const osg::Matrixd& matrix ); 00083 00084 /** 00085 * Set the position of the matrix manipulator using a 4x4 matrix. 00086 * 00087 * \param matrix a 4x4 matrix 00088 */ 00089 virtual void setByInverseMatrix( const osg::Matrixd& matrix ); 00090 00091 /** 00092 * Get the position of the manipulator as 4x4 matrix. 00093 * 00094 * \return the position of the manipulator as 4x4 matrix 00095 */ 00096 virtual osg::Matrixd getMatrix() const; 00097 00098 /** 00099 * Get the position of the manipulator as a inverse matrix of the 00100 * manipulator, typically used as a model view matrix. 00101 * 00102 * \return the position of the manipulator as a inverse matrix 00103 */ 00104 virtual osg::Matrixd getInverseMatrix() const; 00105 00106 /** 00107 * Move the camera to the default position. 00108 * 00109 * \param us the action adapter used to request actions of the GUI 00110 */ 00111 virtual void home( const osgGA::GUIEventAdapter& /*ea*/, osgGA::GUIActionAdapter& us ); // NOLINT We can not change the interface of OSG 00112 00113 /** 00114 * Start/restart the manipulator. 00115 * 00116 * \param us the action adapter used to request actions of the GUI 00117 */ 00118 virtual void init( const osgGA::GUIEventAdapter& /*ea*/, osgGA::GUIActionAdapter& us ); // NOLINT We can not change the interface of OSG 00119 00120 /** 00121 * Handle events 00122 * 00123 * \param ea event class for storing keyboard, mouse and window events 00124 * \param us the action adapter used to request actions of the GUI 00125 * \return true if handled, false otherwise 00126 */ 00127 virtual bool handle( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us ); 00128 00129 protected: 00130 private: 00131 }; 00132 00133 #endif // WGENOOPMANIPULATOR_H 00134