Commit a876a0c2 authored by Alexander Wiebel's avatar Alexander Wiebel
Browse files

[CHANGE] adapted to new properties

parent fde09285
......@@ -175,47 +175,34 @@ void WMFiberDisplay::activate()
void WMFiberDisplay::properties()
{
m_properties->addString( "Fibers Display Module", "Display fibers" );
// this bool is hidden
m_properties->addBool( "Local Color", false )->connect( boost::bind( &WMFiberDisplay::slotPropertyChanged, this, _1 ) );
m_properties->addBool( "Use Tubes", false )->connect( boost::bind( &WMFiberDisplay::slotPropertyChanged, this, _1 ) );
}
void WMFiberDisplay::toggleTubes()
{
if ( m_properties->getValue< bool >( "Use Tubes" ) )
{
m_tubeDrawable->setUseTubes( true );
m_tubeDrawable->dirtyDisplayList();
m_useTubesProp = m_properties2->addProperty( "Use Tubes", "Draw fiber tracts as fake tubes.", false );
m_shader->apply( m_osgNode );
osg::ref_ptr<osg::Uniform>( new osg::Uniform( "globalColor", 1 ) );
osg::StateSet* rootState = m_osgNode->getOrCreateStateSet();
rootState->addUniform( osg::ref_ptr<osg::Uniform>( new osg::Uniform( "globalColor", 1 ) ) );
}
else
{
m_tubeDrawable->setUseTubes( false );
m_tubeDrawable->dirtyDisplayList();
}
// TODO( all ): remove the "true" that hides this property when local coloring is available again.
m_localColorProp = m_properties2->addProperty( "Local Color",
"Use local direction of fiber tract for coloring the line instead of global direction.",
false,
true );
}
void WMFiberDisplay::slotPropertyChanged( std::string propertyName )
void WMFiberDisplay::toggleTubes()
{
if ( propertyName == "Local Color" )
{
updateColoring();
}
else if ( propertyName == "Use Tubes" )
if( m_useTubesProp->changed() )
{
toggleTubes();
}
if ( m_useTubesProp->get( true ) )
{
m_tubeDrawable->setUseTubes( true );
m_tubeDrawable->dirtyDisplayList();
else
{
// instead of WLogger we must use std::cerr since WLogger needs to much time!
std::cerr << propertyName << std::endl;
assert( 0 && "This property name is not supported by this function yet." );
m_shader->apply( m_osgNode );
osg::ref_ptr<osg::Uniform>( new osg::Uniform( "globalColor", 1 ) );
osg::StateSet* rootState = m_osgNode->getOrCreateStateSet();
rootState->addUniform( osg::ref_ptr<osg::Uniform>( new osg::Uniform( "globalColor", 1 ) ) );
}
else
{
m_tubeDrawable->setUseTubes( false );
m_tubeDrawable->dirtyDisplayList();
}
}
}
......
......@@ -81,12 +81,6 @@ public:
*/
virtual const char** getXPMIcon() const;
/**
* Determine what to do if a property was changed.
* \param propertyName Name of the property.
*/
void slotPropertyChanged( std::string propertyName );
protected:
/**
* Callback for m_active. Overwrite this in your modules to handle m_active changes separately.
......@@ -124,9 +118,10 @@ protected:
*/
void updateColoring();
WPropBool m_localColor;
private:
WPropBool m_localColorProp; //!< Property indicating whether to use ocal or global coloring of fiber tracts
WPropBool m_useTubesProp; //!< Property indicating whether to use tubes for the fibers tracts.
/**
* Input connector for a fiber dataset.
*/
......@@ -191,6 +186,7 @@ private:
if ( module )
{
module->update();
module->toggleTubes();
}
traverse( node, nv );
}
......
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