OpenWalnut  1.5.0dev
WPanTransformCallback.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 WPANTRANSFORMCALLBACK_H
26 #define WPANTRANSFORMCALLBACK_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 used for the panning.
37  */
38 class WPanTransformCallback : public osg::NodeCallback
39 {
40 public:
41  /**
42  * Constructor
43  *
44  * \param labelsWidth the width of the label display in pixel as property
45  * \param timePos the time position in seconds where to start the graph at
46  * the left edge as property
47  * \param timeRange the width of the graph in seconds as property
48  * \param graphWidth the width of the graph in pixel as property
49  * \param yPos the y position in pixel at the lower edge as property
50  */
51  WPanTransformCallback( WPropInt labelsWidth,
52  WPropDouble timePos,
53  WPropDouble timeRange,
54  WPropInt graphWidth,
55  WPropDouble yPos );
56 
57  /**
58  * Callback method called by the NodeVisitor when visiting a node.
59  * Change the matrix according to the properties.
60  *
61  * \param node The node this callback is connected to. Should be a
62  * MatrixTransform node.
63  * \param nv The node visitor which performs the traversal. Should be an
64  * update visitor.
65  */
66  virtual void operator()( osg::Node* node, osg::NodeVisitor* nv );
67 
68 protected:
69 private:
70  /**
71  * the width of the label display in pixel which is currently used
72  */
74 
75  /**
76  * the time position in seconds where to start the graph at the left edge
77  * which is currently used
78  */
80 
81  /**
82  * the width of the graph in seconds which is currently used
83  */
85 
86  /**
87  * the width of the graph in pixel which is currently used
88  */
90 
91  /**
92  * the y position in pixel at the lower edge which is currently used
93  */
94  double m_currentYPos;
95 
96  /**
97  * the width of the label display in pixel as property
98  */
99  WPropInt m_labelsWidth;
100 
101  /**
102  * the time position in seconds where to start the graph at the left edge as
103  * property
104  */
105  WPropDouble m_timePos;
106 
107  /**
108  * the width of the graph in seconds as property
109  */
110  WPropDouble m_timeRange;
111 
112  /**
113  * the width of the graph in pixel as property
114  */
115  WPropInt m_graphWidth;
116 
117  /**
118  * the y position in pixel at the lower edge as property
119  */
120  WPropDouble m_yPos;
121 };
122 
123 #endif // WPANTRANSFORMCALLBACK_H
OSG Node Callback to update the MatrixTransform Node used for the panning.
WPropDouble m_timeRange
the width of the graph in seconds as property
WPanTransformCallback(WPropInt labelsWidth, WPropDouble timePos, WPropDouble timeRange, WPropInt graphWidth, WPropDouble yPos)
Constructor.
int m_currentGraphWidth
the width of the graph in pixel which is currently used
double m_currentTimePos
the time position in seconds where to start the graph at the left edge which is currently used
double m_currentTimeRange
the width of the graph in seconds which is currently used
WPropDouble m_yPos
the y position in pixel at the lower edge as property
WPropInt m_graphWidth
the width of the graph in pixel as property
int m_currentLabelsWidth
the width of the label display in pixel which is currently used
double m_currentYPos
the y position in pixel at the lower edge which is currently used
WPropInt m_labelsWidth
the width of the label display in pixel as property
WPropDouble m_timePos
the time position in seconds where to start the graph at the left edge as property
virtual void operator()(osg::Node *node, osg::NodeVisitor *nv)
Callback method called by the NodeVisitor when visiting a node.