Commit b24f41d4 by Alexander Wiebel

[CLEAN] changed to use new FunctorCallback. this makes inner class

superfluous
parent 229862c8
......@@ -160,7 +160,7 @@ void WMVectorPlot::moduleMain()
m_rootNode = newRootNode;
m_rootNode->setNodeMask( m_active->get() ? 0xFFFFFFFF : 0x0 );
m_rootNode->addUpdateCallback( new SafeUpdateCallback( this ) );
m_rootNode->addUpdateCallback( new WGEFunctorCallback< osg::Node >( boost::bind( &WMVectorPlot::updateCallback, this ) ) );
m_shader = osg::ref_ptr< WShader > ( new WShader( "WMVectorPlot", m_localPath ) );
m_shader->apply( m_rootNode );
......@@ -398,20 +398,18 @@ osg::ref_ptr<osg::Geometry> WMVectorPlot::buildPlotSlices()
}
void WMVectorPlot::SafeUpdateCallback::operator()( osg::Node* node, osg::NodeVisitor* nv )
void WMVectorPlot::updateCallback()
{
wmath::WPosition current = WKernel::getRunningKernel()->getSelectionManager()->getCrosshair()->getPosition();
wmath::WPosition old( m_module->m_xSlice->get(), m_module->m_ySlice->get(), m_module->m_zSlice->get() );
wmath::WPosition old( m_xSlice->get(), m_ySlice->get(), m_zSlice->get() );
if( ( old != current ) || m_module->m_coloringMode->changed() || m_module->m_aColor->changed() || m_module->m_projectOnSlice->changed() ||
m_module->m_showonX->changed() || m_module->m_showonY->changed() || m_module->m_showonZ->changed() )
if( ( old != current ) || m_coloringMode->changed() || m_aColor->changed() || m_projectOnSlice->changed() ||
m_showonX->changed() || m_showonY->changed() || m_showonZ->changed() )
{
osg::ref_ptr<osg::Drawable> old = osg::ref_ptr<osg::Drawable>( m_module->m_rootNode->getDrawable( 0 ) );
m_module->m_rootNode->removeDrawable( old );
m_module->m_rootNode->addDrawable( m_module->buildPlotSlices() );
osg::ref_ptr<osg::Drawable> old = osg::ref_ptr<osg::Drawable>( m_rootNode->getDrawable( 0 ) );
m_rootNode->removeDrawable( old );
m_rootNode->addDrawable( buildPlotSlices() );
}
traverse( node, nv );
}
......
......@@ -116,6 +116,11 @@ private:
osg::ref_ptr<osg::Geometry> buildPlotSlices();
/**
* The update callback that is called for the osg node of this module.
*/
void updateCallback();
/**
* Transforms the given vertices according to m_matrix
* \param verts These vertices will be transformed.
*/
......@@ -159,37 +164,6 @@ private:
osg::ref_ptr< WShader > m_shader; //!< the shader object for this module
wmath::WMatrix< double > m_mat; //!< The 4x4 transformation matrix for the glyph vertices.
/**
* Node callback to change the color of the shapes inside the root node. For more details on this class, refer to the documentation in
* moduleMain().
*/
class SafeUpdateCallback : public osg::NodeCallback
{
public: // NOLINT
/**
* Constructor.
*
* \param module just set the creating module as pointer for later reference.
*/
explicit SafeUpdateCallback( WMVectorPlot* module ): m_module( module )
{
};
/**
* operator () - called during the update traversal.
*
* \param node the osg node
* \param nv the node visitor
*/
virtual void operator()( osg::Node* node, osg::NodeVisitor* nv );
/**
* Pointer used to access members of the module to modify the node.
*/
WMVectorPlot* m_module;
};
};
#endif // WMVECTORPLOT_H
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