root/OpenSceneGraph/trunk/include/osgPresentation/PickEventHandler @ 13041

Revision 13041, 2.7 kB (checked in by robert, 3 years ago)

Ran script to remove trailing spaces and tabs

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1/* -*-c++-*- Present3D - Copyright (C) 1999-2006 Robert Osfield
2 *
3 * This software is open source and may be redistributed and/or modified under
4 * the terms of the GNU General Public License (GPL) version 2.0.
5 * The full license is in LICENSE.txt file included with this distribution,.
6 *
7 * This software is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10 * include LICENSE.txt for more details.
11*/
12
13#ifndef PICKEVENTHANDLER
14#define PICKEVENTHANDLER 1
15
16#include <osg/StateSet>
17#include <osg/Point>
18
19#include <osgGA/GUIEventHandler>
20
21#include <osgPresentation/SlideEventHandler>
22
23namespace osgPresentation
24{
25
26class OSGPRESENTATION_EXPORT PickEventHandler : public osgGA::GUIEventHandler
27{
28    public:
29
30        PickEventHandler(osgPresentation::Operation operation, bool relativeJump=true, int slideNum=0, int layerNum=0);
31        PickEventHandler(const std::string& str, osgPresentation::Operation operation, bool relativeJump=true, int slideNum=0, int layerNum=0);
32        PickEventHandler(const osgPresentation::KeyPosition& keyPos, bool relativeJump=true, int slideNum=0, int layerNum=0);
33
34        void setOperation(osgPresentation::Operation operation) { _operation = operation; }
35        osgPresentation::Operation getOperation() const { return _operation; }
36
37        void setCommand(const std::string& str) { _command = str; }
38        const std::string& getCommand() const { return _command; }
39
40        void setKeyPosition(const osgPresentation::KeyPosition& keyPos) { _keyPos = keyPos; }
41        const osgPresentation::KeyPosition&  getKeyPosition() const { return _keyPos; }
42
43        void setRelativeJump(int slideDelta, int layerDelta);
44        void setAbsoluteJump(int slideNum, int layerNum);
45
46        bool getRelativeJump() const { return _relativeJump; }
47        int getSlideNum() const { return _slideNum; }
48        int getLayerNum() const { return _layerNum; }
49
50        bool requiresJump() const { return _relativeJump ? (_slideNum!=0 || _layerNum!=0) : true; }
51
52        virtual bool handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter& aa, osg::Object* object, osg::NodeVisitor* nv);
53
54        virtual void accept(osgGA::GUIEventHandlerVisitor& v);
55
56        virtual void getUsage(osg::ApplicationUsage& usage) const;
57
58        void doOperation();
59
60        std::string                         _command;
61        osgPresentation::KeyPosition        _keyPos;
62        osgPresentation::Operation          _operation;
63
64        bool                                _relativeJump;
65        int                                 _slideNum;
66        int                                 _layerNum;
67};
68
69}
70
71#endif
Note: See TracBrowser for help on using the browser.