28 #include <osg/Drawable>
29 #include <osg/ShapeDrawable>
30 #include <osg/ref_ptr>
31 #include <osgSim/ScalarsToColors>
33 #include "WEEGEvent.h"
34 #include "WElectrodePositionCallback.h"
35 #include "core/common/WFlag.h"
36 #include "core/common/WPropertyTypes.h"
37 #include "core/common/WPropertyVariable.h"
41 WPropDouble colorSensitivity,
42 std::shared_ptr<
WFlag< std::shared_ptr< WEEGEvent > > > event,
43 osg::ref_ptr< const osgSim::ScalarsToColors > colorMap )
44 : m_channelID( channelID ),
45 m_currentColorSensitivity( 0.0 ),
46 m_currentTime( -2.0 ),
47 m_colorSensitivity( colorSensitivity ),
49 m_colorMap( colorMap )
56 std::shared_ptr< WEEGEvent >
event =
m_event->get();
57 const double time =
event->getTime();
60 osg::ShapeDrawable* shape =
static_cast< osg::ShapeDrawable*
>( drawable );
67 color =
event->getValues()[
m_channelID] / colorSensitivity;
74 shape->setColor(
m_colorMap->getColor( color ) );
double m_currentTime
The time position which is currently used.
std::shared_ptr< WFlag< std::shared_ptr< WEEGEvent > > > m_event
event marking a special time position as WFlag
virtual void update(osg::NodeVisitor *, osg::Drawable *drawable)
Callback method called by the NodeVisitor.
WElectrodePositionCallback(std::size_t channelID, WPropDouble colorSensitivity, std::shared_ptr< WFlag< std::shared_ptr< WEEGEvent > > > event, osg::ref_ptr< const osgSim::ScalarsToColors > colorMap)
Constructor.
const osg::ref_ptr< const osgSim::ScalarsToColors > m_colorMap
the ScalarsToColors object mapping the potentials at the electrodes to colors
double m_currentColorSensitivity
the sensitivity of the color map which is currently used
const std::size_t m_channelID
the number of the channel
WPropDouble m_colorSensitivity
The sensitivity of the color map as property.
Class to have a simple notification/condition system for simple flags.