OpenWalnut  1.5.0dev
WGEZoomTrackballNodeVisitor.h
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 WGEZOOMTRACKBALLNODEVISITOR_H
26 #define WGEZOOMTRACKBALLNODEVISITOR_H
27 
28 #include <limits>
29 #include <vector>
30 
31 #include <osg/BoundingBox>
32 #include <osg/NodeVisitor>
33 
34 /**
35  * A visitor that ignores specific nodes that are irrelevant for the trackball.
36  */
37 class WGEZoomTrackballNodeVisitor : public osg::NodeVisitor
38 {
39 public:
40  /**
41  * Creates a new node visitor.
42  * \param traversalMode The traversal mode.
43  */
44  explicit WGEZoomTrackballNodeVisitor( TraversalMode traversalMode = TRAVERSE_ACTIVE_CHILDREN );
45 
46  /**
47  * Resets this visitor.
48  */
49  virtual void reset();
50 
51  /**
52  * Handles camera nodes.
53  * \param node The camera node.
54  */
55  void apply( osg::Camera& node ); // NOLINT
56 
57  /**
58  * Handles projection nodes.
59  * \param node The projection node.
60  */
61  void apply( osg::Projection& node ); // NOLINT
62 
63  /**
64  * Handles drawable nodes.
65  * \param node The drawable node.
66  */
67  void apply( osg::Drawable& node ); // NOLINT
68 
69  /**
70  * Handles matrixtransform nodes.
71  * \param node The matrixtransform node.
72  */
73  void apply( osg::MatrixTransform& node ); // NOLINT
74 
75  /**
76  * Gets the bounding box.
77  * \return osg::BoundingBox& The bounding box.
78  */
79  osg::BoundingBox& getBoundingBox();
80 
81 private:
82  osg::BoundingBox m_bb; //!< The bounding box that is generated.
83  std::vector< osg::Matrix > m_matrixStack; //!< The stack for the matrices.
84 };
85 
86 #endif // WGEZOOMTRACKBALLNODEVISITOR_H
A visitor that ignores specific nodes that are irrelevant for the trackball.
std::vector< osg::Matrix > m_matrixStack
The stack for the matrices.
virtual void reset()
Resets this visitor.
osg::BoundingBox & getBoundingBox()
Gets the bounding box.
void apply(osg::Camera &node)
Handles camera nodes.
osg::BoundingBox m_bb
The bounding box that is generated.
WGEZoomTrackballNodeVisitor(TraversalMode traversalMode=TRAVERSE_ACTIVE_CHILDREN)
Creates a new node visitor.