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 /** 00051 * Convenience typedef for a boost::shared_ptr< WGENoOpManipulator >. 00052 */ 00053 typedef osg::ref_ptr< WGENoOpManipulator > SPtr; 00054 00055 /** 00056 * Convenience typedef for a boost::shared_ptr< const WGENoOpManipulator >. 00057 */ 00058 typedef osg::ref_ptr< const WGENoOpManipulator > ConstSPtr; 00059 00060 /** 00061 * Default constructor. 00062 */ 00063 WGENoOpManipulator(); 00064 00065 /** 00066 * Destructor. 00067 */ 00068 virtual ~WGENoOpManipulator(); 00069 00070 /** 00071 * Return the name of the object's class type. 00072 * 00073 * \return the name of the object's class type 00074 */ 00075 virtual const char* className() const; 00076 00077 00078 /** 00079 * Set the position of the matrix manipulator using a 4x4 matrix. 00080 * 00081 * \param matrix a 4x4 matrix 00082 */ 00083 virtual void setByMatrix( const osg::Matrixd& matrix ); 00084 00085 /** 00086 * Set the position of the matrix manipulator using a 4x4 matrix. 00087 * 00088 * \param matrix a 4x4 matrix 00089 */ 00090 virtual void setByInverseMatrix( const osg::Matrixd& matrix ); 00091 00092 /** 00093 * Get the position of the manipulator as 4x4 matrix. 00094 * 00095 * \return the position of the manipulator as 4x4 matrix 00096 */ 00097 virtual osg::Matrixd getMatrix() const; 00098 00099 /** 00100 * Get the position of the manipulator as a inverse matrix of the 00101 * manipulator, typically used as a model view matrix. 00102 * 00103 * \return the position of the manipulator as a inverse matrix 00104 */ 00105 virtual osg::Matrixd getInverseMatrix() const; 00106 00107 /** 00108 * Move the camera to the default position. 00109 * 00110 * \param us the action adapter used to request actions of the GUI 00111 */ 00112 virtual void home( const osgGA::GUIEventAdapter& /*ea*/, osgGA::GUIActionAdapter& us ); // NOLINT We can not change the interface of OSG 00113 00114 /** 00115 * Start/restart the manipulator. 00116 * 00117 * \param us the action adapter used to request actions of the GUI 00118 */ 00119 virtual void init( const osgGA::GUIEventAdapter& /*ea*/, osgGA::GUIActionAdapter& us ); // NOLINT We can not change the interface of OSG 00120 00121 /** 00122 * Handle events 00123 * 00124 * \param ea event class for storing keyboard, mouse and window events 00125 * \param us the action adapter used to request actions of the GUI 00126 * \return true if handled, false otherwise 00127 */ 00128 virtual bool handle( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us ); 00129 00130 protected: 00131 00132 private: 00133 }; 00134 00135 #endif // WGENOOPMANIPULATOR_H 00136