Commit ad466a38 authored by cornimueller's avatar cornimueller
Browse files

[ADD] The sensitivity of the coloring can now be changed by the mouse wheel...

[ADD] The sensitivity of the coloring can now be changed by the mouse wheel while the left mouse button is pressed.
parent 87f63810
......@@ -48,6 +48,7 @@ WEEGViewHandler::WEEGViewHandler( WPropInt labelsWidth,
WPropDouble yPos,
WPropDouble ySpacing,
WPropDouble ySensitivity,
WPropDouble colorSensitivity,
boost::shared_ptr< WFlag< boost::shared_ptr< WEEGEvent > > > event,
osg::ref_ptr< WGEGroupNode > eventParentNode,
boost::shared_ptr< WEEG2 > eeg,
......@@ -59,6 +60,7 @@ WEEGViewHandler::WEEGViewHandler( WPropInt labelsWidth,
m_yPos( yPos ),
m_ySpacing( ySpacing ),
m_ySensitivity( ySensitivity ),
m_colorSensitivity( colorSensitivity ),
m_event( event ),
m_eventParentNode( eventParentNode ),
m_eeg( eeg ),
......@@ -168,22 +170,42 @@ bool WEEGViewHandler::handle( const osgGA::GUIEventAdapter& ea, osgGA::GUIAction
if( delta != 0.0f )
{
if( ea.getButtonMask() & osgGA::GUIEventAdapter::RIGHT_MOUSE_BUTTON )
switch( ea.getButtonMask() )
{
// change the spacing of the different graphs
const float addend = -0.001f * delta;
m_ySpacing->set( m_ySpacing->get() * ( 1.0f + addend ) );
case osgGA::GUIEventAdapter::LEFT_MOUSE_BUTTON:
{
// change the sensitivity of the color map
m_colorSensitivity->set( m_colorSensitivity->get() * ( 1.0f + 0.001f * delta ) );
// adjust yPos to zoom into the current mouse position
m_yPos->set( m_yPos->get() * ( 1.0f + addend ) + ea.getY() * addend );
}
else
{
// change the sensitivity of the graphs
m_ySensitivity->set( m_ySensitivity->get() * ( 1.0f + 0.001f * delta ) );
}
handled = true;
break;
}
case osgGA::GUIEventAdapter::RIGHT_MOUSE_BUTTON:
{
// change the spacing of the different graphs
const float addend = -0.001f * delta;
m_ySpacing->set( m_ySpacing->get() * ( 1.0f + addend ) );
handled = true;
// adjust yPos to zoom into the current mouse position
m_yPos->set( m_yPos->get() * ( 1.0f + addend ) + ea.getY() * addend );
handled = true;
break;
}
case 0u: // no button pressed
{
// change the sensitivity of the graphs
m_ySensitivity->set( m_ySensitivity->get() * ( 1.0f + 0.001f * delta ) );
handled = true;
break;
}
default:
{
// do nothing
break;
}
}
}
break;
......
......@@ -50,23 +50,26 @@ public:
/**
* Constructor
*
* \param labelsWidth the width of the label display in pixel as
* property
* \param timePos the time position in seconds where to start the
* graph at the left edge as property
* \param timeRange the width of the graph in seconds as property
* \param graphWidth the width of the graph in pixel as property
* \param yPos the y position in pixel at the lower edge as
* property
* \param ySpacing the distance between two curves of the graph in
* pixel as property
* \param ySensitivity the sensitivity of the graph in microvolt per
* pixel as property
* \param event event marking a special time position as WFlag
* \param eventParentNode parent node, where an marked event position is
* inserted and removed from
* \param eeg pointer to the loaded EEG dataset
* \param segmentID number of the segment
* \param labelsWidth the width of the label display in pixel as
* property
* \param timePos the time position in seconds where to start the
* graph at the left edge as property
* \param timeRange the width of the graph in seconds as property
* \param graphWidth the width of the graph in pixel as property
* \param yPos the y position in pixel at the lower edge as
* property
* \param ySpacing the distance between two curves of the graph in
* pixel as property
* \param ySensitivity the sensitivity of the graph in microvolt per
* pixel as property
* \param colorSensitivity The sensitivity of the color map as property. The
* color map ranges from -colorSensitivity to
* +colorSensitivity in microvolt.
* \param event event marking a special time position as WFlag
* \param eventParentNode parent node, where an marked event position is
* inserted and removed from
* \param eeg pointer to the loaded EEG dataset
* \param segmentID number of the segment
*/
WEEGViewHandler( WPropInt labelsWidth,
WPropDouble timePos,
......@@ -75,6 +78,7 @@ public:
WPropDouble yPos,
WPropDouble ySpacing,
WPropDouble ySensitivity,
WPropDouble colorSensitivity,
boost::shared_ptr< WFlag< boost::shared_ptr< WEEGEvent > > > event,
osg::ref_ptr< WGEGroupNode > eventParentNode,
boost::shared_ptr< WEEG2 > eeg,
......@@ -126,6 +130,12 @@ private:
*/
WPropDouble m_ySensitivity;
/**
* The sensitivity of the color map as property. The color map ranges
* from -m_colorSensitivity to +m_colorSensitivity in microvolt.
*/
WPropDouble m_colorSensitivity;
/**
* event marking a special time position as WFlag
*/
......
......@@ -488,6 +488,7 @@ void WMEEGView::redraw()
m_yPos,
m_ySpacing,
m_ySensitivity,
m_colorSensitivity,
m_event,
eventParentNode,
m_eeg,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment