Commit 0ae7ff3b authored by Alexander Wiebel's avatar Alexander Wiebel
Browse files

[ADD #163] time label next to time marker line

parent fcf50a8e
......@@ -36,8 +36,10 @@
#include <osg/Vec3>
#include <osg/Vec4>
#include <osg/ref_ptr>
#include <osgText/Text>
#include "core/common/exceptions/WOutOfBounds.h"
#include "core/common/WStringUtils.h"
#include "core/dataHandler/WEEG2.h"
#include "core/dataHandler/WEEG2Segment.h"
#include "core/dataHandler/WEEGValueMatrix.h"
......@@ -46,6 +48,7 @@
WEEGEvent::WEEGEvent( double time,
double yPos,
boost::shared_ptr< WEEG2 > eeg,
std::size_t segmentID,
osg::ref_ptr< WGEGroupNode > parentNode ) throw( WOutOfBounds )
......@@ -89,8 +92,23 @@ WEEGEvent::WEEGEvent( double time,
geometry->addPrimitiveSet( new osg::DrawArrays( osg::PrimitiveSet::LINES, 0, 2 ) );
// create text for the time label
osgText::Text* text = new osgText::Text;
text->setText( string_utils::toString( time ).c_str() );
text->setPosition( osg::Vec3( time, yPos + 10.0, 0.0 ) );
text->setAlignment( osgText::Text::LEFT_CENTER );
text->setAxisAlignment( osgText::Text::SCREEN );
text->setCharacterSize( 12 );
text->setCharacterSizeMode( osgText::Text::SCREEN_COORDS );
text->setColor( osg::Vec4( 0.0, 0.0, 1.0, 1.0 ) );
text->setBackdropType( osgText::Text::OUTLINE );
text->setBackdropColor( osg::Vec4( 1.0, 1.0, 1.0, 1.0 ) );
text->setBackdropOffset( 0.1 );
osg::Geode* geode = new osg::Geode;
geode->addDrawable( geometry );
geode->addDrawable( text );
m_node = geode;
......
......@@ -49,11 +49,13 @@ public:
* Constructor
*
* \param time time position in seconds
* \param yPos y position in pixels
* \param eeg pointer to the loaded EEG dataset
* \param segmentID number of the segment
* \param parentNode node where m_node is inserted and removed from
*/
WEEGEvent( double time,
double yPos,
boost::shared_ptr< WEEG2 > eeg,
std::size_t segmentID,
osg::ref_ptr< WGEGroupNode > parentNode ) throw( WOutOfBounds );
......
......@@ -229,6 +229,7 @@ bool WEEGViewHandler::markEvent( float x )
{
boost::shared_ptr< WEEGEvent > event( new WEEGEvent(
m_timePos->get() + ( x - labelsWidth ) * m_timeRange->get() / m_graphWidth->get(),
m_yPos->get(),
m_eeg,
m_segmentID,
m_eventParentNode ) );
......
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