OpenWalnut  1.5.0dev
WLabelsTransformCallback.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 WLABELSTRANSFORMCALLBACK_H
26 #define WLABELSTRANSFORMCALLBACK_H
27 
28 #include <osg/Node>
29 #include <osg/NodeCallback>
30 #include <osg/NodeVisitor>
31 
32 #include "core/common/WPropertyTypes.h"
33 
34 
35 /**
36  * OSG Node Callback to update the MatrixTransform Node of the labels used for
37  * panning and zooming.
38  */
39 class WLabelsTransformCallback : public osg::NodeCallback
40 {
41 public:
42  /**
43  * Constructor
44  *
45  * \param yPos the y position in pixel at the lower edge as property
46  * \param ySpacing the distance between two curves of the graph in pixel as
47  * property
48  */
49  WLabelsTransformCallback( WPropDouble yPos, WPropDouble ySpacing );
50 
51  /**
52  * Callback method called by the NodeVisitor when visiting a node.
53  * Change the matrix according to the properties.
54  *
55  * \param node The node this callback is connected to. Should be a
56  * MatrixTransform node.
57  * \param nv The node visitor which performs the traversal. Should be an
58  * update visitor.
59  */
60  virtual void operator()( osg::Node* node, osg::NodeVisitor* nv );
61 
62 protected:
63 private:
64  /**
65  * the y position in pixel at the lower edge which is currently used
66  */
67  double m_currentYPos;
68 
69  /**
70  * the distance between two curves of the graph in pixel which is currently
71  * used
72  */
74 
75  /**
76  * the y position in pixel at the lower edge as property
77  */
78  WPropDouble m_yPos;
79 
80  /**
81  * the distance between two curves of the graph in pixel as property
82  */
83  WPropDouble m_ySpacing;
84 };
85 
86 #endif // WLABELSTRANSFORMCALLBACK_H
OSG Node Callback to update the MatrixTransform Node of the labels used for panning and zooming.
double m_currentYPos
the y position in pixel at the lower edge which is currently used
double m_currentYSpacing
the distance between two curves of the graph in pixel which is currently used
WPropDouble m_yPos
the y position in pixel at the lower edge as property
WPropDouble m_ySpacing
the distance between two curves of the graph in pixel as property
WLabelsTransformCallback(WPropDouble yPos, WPropDouble ySpacing)
Constructor.
virtual void operator()(osg::Node *node, osg::NodeVisitor *nv)
Callback method called by the NodeVisitor when visiting a node.