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

[ADD #452] enabled hiding coordinate values in scene

parent 7b1b9b8d
......@@ -49,7 +49,8 @@
W_LOADABLE_MODULE( WMBoundingBox )
WMBoundingBox::WMBoundingBox():
WModule()
WModule(),
m_recompute( boost::shared_ptr< WCondition >( new WCondition() ) )
{
// WARNING: initializing connectors inside the constructor will lead to an exception.
// Implement WModule::initializeConnectors instead.
......@@ -86,6 +87,7 @@ void WMBoundingBox::moduleMain()
// use the m_input "data changed" flag
m_moduleState.setResetable( true, true );
m_moduleState.add( m_input->getDataChangedCondition() );
m_moduleState.add( m_recompute );
// signal ready state
ready();
......@@ -93,7 +95,6 @@ void WMBoundingBox::moduleMain()
// loop until the module container requests the module to quit
while( !m_shutdownFlag() )
{
bool dataUpdated = m_input->updated();
boost::shared_ptr< WDataSetSingle > dataSet = m_input->getData();
bool dataValid = ( dataSet );
......@@ -106,10 +107,7 @@ void WMBoundingBox::moduleMain()
continue;
}
if( dataUpdated )
{
createGFX();
}
// this waits for m_moduleState to fire. By default, this is only the m_shutdownFlag condition.
// NOTE: you can add your own conditions to m_moduleState using m_moduleState.add( ... )
......@@ -136,6 +134,8 @@ void WMBoundingBox::createGFX()
m_bBoxNode->insert( wge::generateBoundingBoxGeode( bb.first, bb.second, WColor( 0.3, 0.3, 0.3, 1 ) ) );
if( m_showCornerCoordinates->get( true ) )
{
wmath::WVector3D pos1 = bb.first;
wmath::WVector3D pos2 = bb.second;
m_bBoxNode->addChild( wge::vector2label( osg::Vec3( pos1[0], pos1[1], pos1[2] ) ) );
......@@ -146,6 +146,7 @@ void WMBoundingBox::createGFX()
m_bBoxNode->addChild( wge::vector2label( osg::Vec3( pos1[0], pos2[1], pos2[2] ) ) );
m_bBoxNode->addChild( wge::vector2label( osg::Vec3( pos2[0], pos1[1], pos2[2] ) ) );
m_bBoxNode->addChild( wge::vector2label( osg::Vec3( pos1[0], pos1[1], pos2[2] ) ) );
}
WGraphicsEngine::getGraphicsEngine()->getScene()->insert( m_bBoxNode );
......@@ -169,6 +170,7 @@ void WMBoundingBox::connectors()
void WMBoundingBox::properties()
{
m_showCornerCoordinates = m_properties->addProperty( "Show coordinates", "Show coordinates at the corners of the box.", true, m_recompute );
WModule::properties();
}
......
......@@ -117,6 +117,13 @@ private:
*/
void createGFX();
/**
* This condition denotes whether we need to recompute the surface
*/
boost::shared_ptr< WCondition > m_recompute;
WPropBool m_showCornerCoordinates; //!< Show/hide the coordinates in the rendering.
osg::ref_ptr< WGEGroupNode > m_bBoxNode; //!< OSG root node for this module
boost::shared_ptr< WModuleInputData< WDataSetSingle > > m_input; //!< Input connector required by this module.
};
......
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