1
//---------------------------------------------------------------------------
3
// Project: OpenWalnut ( http://www.openwalnut.org )
5
// Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
6
// For more information see http://www.openwalnut.org/copying
8
// This file is part of OpenWalnut.
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.
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.
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/>.
23
//---------------------------------------------------------------------------
25
#ifndef WELECTRODEPOSITIONCALLBACK_H
26
#define WELECTRODEPOSITIONCALLBACK_H
30
#include <boost/shared_ptr.hpp>
32
#include <osg/Drawable>
33
#include <osg/ref_ptr>
34
#include <osgSim/ScalarsToColors>
36
#include "core/common/WFlag.h"
37
#include "core/common/WPropertyTypes.h"
38
#include "WEEGEvent.h"
42
* OSG Update Callback to change the color of an electrode position when the
43
* event position changed.
44
* \note Only add it to a ShapeDrawable!
46
class WElectrodePositionCallback : public osg::Drawable::UpdateCallback
52
* \param channelID the number of the channel
53
* \param colorSensitivity The sensitivity of the color map as property. The
54
* color map ranges from -colorSensitivity to
55
* +colorSensitivity in microvolt.
56
* \param event event marking a special time position as WFlag
57
* \param colorMap the object mapping the electrode potentials to
60
WElectrodePositionCallback( std::size_t channelID,
61
WPropDouble colorSensitivity,
62
boost::shared_ptr< WFlag< boost::shared_ptr< WEEGEvent > > > event,
63
osg::ref_ptr< const osgSim::ScalarsToColors > colorMap );
66
* Callback method called by the NodeVisitor.
67
* Changes the color of the electrode position according to the event.
69
* \param drawable The drawable this callback is connected to. Should be
72
virtual void update( osg::NodeVisitor* /*nv*/, osg::Drawable* drawable );
77
* the number of the channel
79
const std::size_t m_channelID;
82
* the sensitivity of the color map which is currently used
84
double m_currentColorSensitivity;
87
* The time position which is currently used.
88
* The color is updated if the new time from the m_event is different to
94
* The sensitivity of the color map as property. The color map ranges
95
* from -m_colorSensitivity to +m_colorSensitivity in microvolt.
97
WPropDouble m_colorSensitivity;
100
* event marking a special time position as WFlag
102
boost::shared_ptr< WFlag< boost::shared_ptr< WEEGEvent > > > m_event;
105
* the ScalarsToColors object mapping the potentials at the electrodes
108
const osg::ref_ptr< const osgSim::ScalarsToColors > m_colorMap;
111
#endif // WELECTRODEPOSITIONCALLBACK_H