OpenWalnut  1.5.0dev
WScaleTransformCallback.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 WSCALETRANSFORMCALLBACK_H
26 #define WSCALETRANSFORMCALLBACK_H
27 
28 #include <cstddef>
29 
30 #include <osg/Node>
31 #include <osg/NodeCallback>
32 #include <osg/NodeVisitor>
33 
34 #include "core/common/WPropertyTypes.h"
35 
36 
37 /**
38  * OSG Node Callback to update the MatrixTransform Nodes of one channel used for
39  * the y-scaling.
40  */
41 class WScaleTransformCallback : public osg::NodeCallback
42 {
43 public:
44  /**
45  * Constructor
46  *
47  * \param channelID the number of the channel
48  * \param ySpacing the distance between two curves of the graph in pixel
49  * as property
50  * \param ySensitivity the sensitivity of the graph in microvolt per pixel
51  * as property
52  */
53  WScaleTransformCallback( std::size_t channelID, WPropDouble ySpacing, WPropDouble ySensitivity );
54 
55  /**
56  * Callback method called by the NodeVisitor when visiting a node.
57  * Change the matrix according to the properties.
58  *
59  * \param node The node this callback is connected to. Should be a
60  * MatrixTransform node.
61  * \param nv The node visitor which performs the traversal. Should be an
62  * update visitor.
63  */
64  virtual void operator()( osg::Node* node, osg::NodeVisitor* nv );
65 
66 protected:
67 private:
68  /**
69  * the number of the channel
70  */
71  const std::size_t m_channelID;
72 
73  /**
74  * the distance between two curves of the graph in pixel which is currently
75  * used
76  */
78 
79  /**
80  * the sensitivity of the graph in microvolt per pixel which is currently
81  * used
82  */
84 
85  /**
86  * the distance between two curves of the graph in pixel as property
87  */
88  WPropDouble m_ySpacing;
89 
90  /**
91  * the sensitivity of the graph in microvolt per pixel as property
92  */
93  WPropDouble m_ySensitivity;
94 };
95 
96 #endif // WSCALETRANSFORMCALLBACK_H
OSG Node Callback to update the MatrixTransform Nodes of one channel used for the y-scaling.
double m_currentYSensitivity
the sensitivity of the graph in microvolt per pixel which is currently used
WPropDouble m_ySensitivity
the sensitivity of the graph in microvolt per pixel as property
const std::size_t m_channelID
the number of the channel
double m_currentYSpacing
the distance between two curves of the graph in pixel which is currently used
WScaleTransformCallback(std::size_t channelID, WPropDouble ySpacing, WPropDouble ySensitivity)
Constructor.
WPropDouble m_ySpacing
the distance between two curves of the graph in pixel as property
virtual void operator()(osg::Node *node, osg::NodeVisitor *nv)
Callback method called by the NodeVisitor when visiting a node.