source: osgVisual/include/manip_ObjectMounted/manip_objectMounted.h @ 101

Last change on this file since 101 was 88, checked in by Torben Dannhauer, 14 years ago

Moved memory leak detection from source file to headerfile. Its still in the class but at least not in the source file.

The leak detection works, but the false positives are not stopped.
Use Linux/Valgrind? to make your final leak detection beyond the easy first approach in MSVC

File size: 3.5 KB
Line 
1#pragma once
2/* -*-c++-*- osgVisual - Copyright (C) 2009-2010 Torben Dannhauer
3 *
4 * This library is based on OpenSceneGraph, open source and may be redistributed and/or modified under
5 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
6 * (at your option) any later version.  The full license is in LICENSE file
7 * included with this distribution, and on the openscenegraph.org website.
8 *
9 * osgVisual requires for some proprietary modules a license from the correspondig manufacturer.
10 * You have to aquire licenses for all used proprietary modules.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 * OpenSceneGraph Public License for more details.
16*/
17
18#include <osgGA/CameraManipulator>
19
20#include <osg/Quat>
21#include <osg/observer_ptr>
22
23#include <visual_object.h>
24
25
26namespace osgVisual
27{ 
28
29/**
30 * \brief This class is a free spacemouse manipulator. It uses the 3DConnexion SpaceNavigator, which interface is implemented in manip_spaceMouse.h
31 *
32 * @author Torben Dannhauer
33 * @date  Aug 2009
34 */ 
35class objectMountedManipulator : public osgGA::CameraManipulator
36{
37        #include <leakDetection.h>
38    public:
39                /**
40                 * \brief Constructor
41                 *
42                 */ 
43        objectMountedManipulator();
44
45                /**
46                 * \brief This function returns the classname.
47                 *
48                 * @return Classname of this manipulator.
49                 */ 
50        virtual const char* className() const { return "objectMountedManipulator"; }
51
52                /**
53                 * \brief Set the position of the matrix manipulator using a 4x4 Matrix.
54                 *
55                 * @param matrix : Matrix to set.
56                 */ 
57        virtual void setByMatrix(const osg::Matrixd& matrix);
58
59                /**
60                 * \brief Set the position of the matrix manipulator using a 4x4 Matrix.
61                 *
62                 * @param matrix : Inverse Matrix to set.
63                 */ 
64        virtual void setByInverseMatrix(const osg::Matrixd& matrix) { setByMatrix(osg::Matrixd::inverse(matrix)); }
65
66        /** get the position of the manipulator as 4x4 Matrix.*/
67        virtual osg::Matrixd getMatrix() const;
68
69        /** get the position of the manipulator as a inverse matrix of the manipulator, typically used as a model view matrix.*/
70        virtual osg::Matrixd getInverseMatrix() const;
71
72                /**
73                 * \brief Start/restart the manipulator.
74                 *
75                 * No further implementation
76                 *
77                 * @param ea : GUI eventadapter to use for initialization.
78                 * @param us : GUI actionadapter to use for initialization.
79                 */ 
80        virtual void init(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us);
81
82        /** handle events, return true if handled, false otherwise.*/
83        virtual bool handle(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us);
84
85        /** Get the keyboard and mouse usage of this manipulator.*/
86        virtual void getUsage(osg::ApplicationUsage& usage) const;
87
88                virtual void setAttachedObject( 
89                        osgVisual::visual_object* object_ ) {attachedObject = object_;};
90
91                virtual osgVisual::visual_object* getAttachedObject() {return attachedObject.get();};
92
93
94    protected:
95                /**
96                 * \brief Destructor. Because it is protected, no explicit delete myPointer by external caller is possible.
97                 * This forces the class to be used with osg::ref pointers.
98                 */ 
99        virtual ~objectMountedManipulator();
100
101                osg::Matrixd manipMatrix;
102       
103
104                osg::ref_ptr<osgVisual::visual_object> attachedObject;
105};
106
107}       // END NAMESPACE
Note: See TracBrowser for help on using the repository browser.