This file is indexed.

/usr/include/osgGA/KeySwitchMatrixManipulator is in libopenscenegraph-3.4-dev 3.4.1+dfsg1-3.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
/* -*-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;

/**
KeySwitchMatrixManipulator is a decorator which allows the type of camera manipulator
being used to be switched by pressing a key. E.g. '1' for a TrackballManipulator,
'2' for a DriveManipulator, '3' for a FlightManipulator. The manipulators available,
and the associated switch keys, can be configured.
*/
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"; }

        /**
        Add a camera manipulator with an associated name, and a key to
        trigger the switch,
        */
        void addMatrixManipulator(int key, std::string name, CameraManipulator *cm);

        /**
        Add a camera manipulator with an autogenerated keybinding which is '1' + previous number of camera's registerd.
        */
        void addNumberedMatrixManipulator(CameraManipulator *cm);

        unsigned int getNumMatrixManipulators() const { return _manips.size(); }

        void selectMatrixManipulator(unsigned int num);

        /** Get the complete list of manipulators attached to this keyswitch manipulator.*/
        KeyManipMap& getKeyManipMap() { return _manips; }

        /** Get the const complete list of manipulators attached to this keyswitch manipulator.*/
        const KeyManipMap& getKeyManipMap() const { return _manips; }


        /** Get the current active manipulators.*/
        CameraManipulator* getCurrentMatrixManipulator() { return _current.get(); }

        /** Get the const current active manipulators.*/
        const CameraManipulator* getCurrentMatrixManipulator() const { return _current.get(); }


        /** Get manipulator assigned to a specified index.*/
        CameraManipulator* getMatrixManipulatorWithIndex(unsigned int key);

        /** Get const manipulator assigned to a specified index.*/
        const CameraManipulator* getMatrixManipulatorWithIndex(unsigned int key) const;

        /** Get manipulator assigned to a specified key.*/
        CameraManipulator* getMatrixManipulatorWithKey(unsigned int key);

        /** Get const manipulator assigned to a specified key.*/
        const CameraManipulator* getMatrixManipulatorWithKey(unsigned int key) const;


        // Overrides from CameraManipulator...

        /** set the coordinate frame which callback tells the manipulator which way is up, east and north.*/
        virtual void setCoordinateFrameCallback(CoordinateFrameCallback* cb);

        /** Set the position of the matrix manipulator using a 4x4 Matrix.*/
        virtual void setByMatrix(const osg::Matrixd& matrix) { _current->setByMatrix(matrix); }

        /** set the position of the matrix manipulator using a 4x4 Matrix.*/
        virtual void setByInverseMatrix(const osg::Matrixd& matrix) { _current->setByInverseMatrix(matrix); }

        /** get the position of the manipulator as 4x4 Matrix.*/
        virtual osg::Matrixd getMatrix() const { return _current->getMatrix(); }

        /** get the position of the manipulator as a inverse matrix of the manipulator, typically used as a model view matrix.*/
        virtual osg::Matrixd getInverseMatrix() const { return _current->getInverseMatrix(); }

        /** Get the FusionDistanceMode. Used by SceneView for setting up stereo convergence.*/
        virtual osgUtil::SceneView::FusionDistanceMode getFusionDistanceMode() const { return _current->getFusionDistanceMode(); }

        /** Get the FusionDistanceValue. Used by SceneView for setting up stereo convergence.*/
        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);

        /** Get the keyboard and mouse usage of this manipulator.*/
        virtual void getUsage(osg::ApplicationUsage& usage) const;

    private:

        KeyManipMap _manips;

        osg::ref_ptr<CameraManipulator> _current;
};

}

#endif