~ubuntu-branches/ubuntu/precise/openwalnut/precise

« back to all changes in this revision

Viewing changes to src/core/graphicsEngine/WGENoOpManipulator.h

  • Committer: Bazaar Package Importer
  • Author(s): Sebastian Eichelbaum
  • Date: 2011-06-21 10:26:54 UTC
  • Revision ID: james.westby@ubuntu.com-20110621102654-rq0zf436q949biih
Tags: upstream-1.2.5
ImportĀ upstreamĀ versionĀ 1.2.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//---------------------------------------------------------------------------
 
2
//
 
3
// Project: OpenWalnut ( http://www.openwalnut.org )
 
4
//
 
5
// Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
 
6
// For more information see http://www.openwalnut.org/copying
 
7
//
 
8
// This file is part of OpenWalnut.
 
9
//
 
10
// OpenWalnut is free software: you can redistribute it and/or modify
 
11
// it under the terms of the GNU Lesser General Public License as published by
 
12
// the Free Software Foundation, either version 3 of the License, or
 
13
// (at your option) any later version.
 
14
//
 
15
// OpenWalnut is distributed in the hope that it will be useful,
 
16
// but WITHOUT ANY WARRANTY; without even the implied warranty of
 
17
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
18
// GNU Lesser General Public License for more details.
 
19
//
 
20
// You should have received a copy of the GNU Lesser General Public License
 
21
// along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
 
22
//
 
23
//---------------------------------------------------------------------------
 
24
 
 
25
#ifndef WGENOOPMANIPULATOR_H
 
26
#define WGENOOPMANIPULATOR_H
 
27
 
 
28
#include <osg/Version>
 
29
 
 
30
// OSG interface changed in 2.9.7, to make it compile also with those versions we do this:
 
31
// OSG_MIN_VERSION_REQUIRED(2, 9, 8) macro is not available in e.g. OSG 2.8.1, hence we use the old way
 
32
#if ( ( OPENSCENEGRAPH_MAJOR_VERSION > 2 ) || ( OPENSCENEGRAPH_MAJOR_VERSION == 2 && ( OPENSCENEGRAPH_MINOR_VERSION > 9 || \
 
33
                            ( OPENSCENEGRAPH_MINOR_VERSION == 9 && OPENSCENEGRAPH_PATCH_VERSION >= 8 ) ) ) )
 
34
    #include <osgGA/CameraManipulator>
 
35
    namespace osgGA
 
36
    {
 
37
        typedef CameraManipulator MatrixManipulator;
 
38
    }
 
39
#else
 
40
    #include <osgGA/MatrixManipulator>
 
41
#endif
 
42
 
 
43
/**
 
44
 * This is an OSG Manipulator implementation which does nothing. It is very useful for simple two-d views.
 
45
 */
 
46
class WGENoOpManipulator: public osgGA::MatrixManipulator
 
47
{
 
48
public:
 
49
 
 
50
    /**
 
51
     * Convenience typedef for a boost::shared_ptr< WGENoOpManipulator >.
 
52
     */
 
53
    typedef osg::ref_ptr< WGENoOpManipulator > SPtr;
 
54
 
 
55
    /**
 
56
     * Convenience typedef for a boost::shared_ptr< const WGENoOpManipulator >.
 
57
     */
 
58
    typedef osg::ref_ptr< const WGENoOpManipulator > ConstSPtr;
 
59
 
 
60
    /**
 
61
     * Default constructor.
 
62
     */
 
63
    WGENoOpManipulator();
 
64
 
 
65
    /**
 
66
     * Destructor.
 
67
     */
 
68
    virtual ~WGENoOpManipulator();
 
69
 
 
70
    /**
 
71
     * Return the name of the object's class type.
 
72
     *
 
73
     * \return the name of the object's class type
 
74
     */
 
75
    virtual const char* className() const;
 
76
 
 
77
 
 
78
    /**
 
79
     * Set the position of the matrix manipulator using a 4x4 matrix.
 
80
     *
 
81
     * \param matrix a 4x4 matrix
 
82
     */
 
83
    virtual void setByMatrix( const osg::Matrixd& matrix );
 
84
 
 
85
    /**
 
86
     * Set the position of the matrix manipulator using a 4x4 matrix.
 
87
     *
 
88
     * \param matrix a 4x4 matrix
 
89
     */
 
90
    virtual void setByInverseMatrix( const osg::Matrixd& matrix );
 
91
 
 
92
    /**
 
93
     * Get the position of the manipulator as 4x4 matrix.
 
94
     *
 
95
     * \return the position of the manipulator as 4x4 matrix
 
96
     */
 
97
    virtual osg::Matrixd getMatrix() const;
 
98
 
 
99
    /**
 
100
     * Get the position of the manipulator as a inverse matrix of the
 
101
     * manipulator, typically used as a model view matrix.
 
102
     *
 
103
     * \return the position of the manipulator as a inverse matrix
 
104
     */
 
105
    virtual osg::Matrixd getInverseMatrix() const;
 
106
 
 
107
    /**
 
108
     * Move the camera to the default position.
 
109
     *
 
110
     * \param us the action adapter used to request actions of the GUI
 
111
     */
 
112
    virtual void home( const osgGA::GUIEventAdapter& /*ea*/, osgGA::GUIActionAdapter& us ); // NOLINT We can not change the interface of OSG
 
113
 
 
114
    /**
 
115
     * Start/restart the manipulator.
 
116
     *
 
117
     * \param us the action adapter used to request actions of the GUI
 
118
     */
 
119
    virtual void init( const osgGA::GUIEventAdapter& /*ea*/, osgGA::GUIActionAdapter& us ); // NOLINT We can not change the interface of OSG
 
120
 
 
121
    /**
 
122
     * Handle events
 
123
     *
 
124
     * \param ea event class for storing keyboard, mouse and window events
 
125
     * \param us the action adapter used to request actions of the GUI
 
126
     * \return true if handled, false otherwise
 
127
     */
 
128
    virtual bool handle( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us );
 
129
 
 
130
protected:
 
131
 
 
132
private:
 
133
};
 
134
 
 
135
#endif  // WGENOOPMANIPULATOR_H
 
136