Commit e6990231 authored by Alexander Wiebel's avatar Alexander Wiebel

[REFAC] extract method

parent a164568a
...@@ -219,10 +219,6 @@ void WMPickingDVR::moduleMain() ...@@ -219,10 +219,6 @@ void WMPickingDVR::moduleMain()
m_rootNode = osg::ref_ptr< WGEManagedGroupNode >( new WGEManagedGroupNode( m_active ) ); m_rootNode = osg::ref_ptr< WGEManagedGroupNode >( new WGEManagedGroupNode( m_active ) );
WKernel::getRunningKernel()->getGraphicsEngine()->getScene()->insert( m_rootNode ); WKernel::getRunningKernel()->getGraphicsEngine()->getScene()->insert( m_rootNode );
//Get Camera and Register the callback
boost::shared_ptr< WGraphicsEngine > graphicsEngine = WGraphicsEngine::getGraphicsEngine();
boost::shared_ptr< WGEViewer > mainView = graphicsEngine->getViewerByName( "Main View" );
// Main loop // Main loop
while( !m_shutdownFlag() ) while( !m_shutdownFlag() )
{ {
...@@ -235,27 +231,7 @@ void WMPickingDVR::moduleMain() ...@@ -235,27 +231,7 @@ void WMPickingDVR::moduleMain()
break; break;
} }
if( m_externalScreenPos->isConnected() == 0 ) setPickPositionSource();
{
if( !m_pickHandlerConnected )
{
// Register PickHandler
mainView->getPickHandler()->getPickSignal()->connect( boost::bind( &WMPickingDVR::pickHandler, this, _1 ) );
m_pickHandlerConnected = true;
}
}
else
{
if( m_pickHandlerConnected )
{
// Register PickHandler
mainView->getPickHandler()->getPickSignal()->disconnect( boost::bind( &WMPickingDVR::pickHandler, this, _1 ) );
m_pickHandlerConnected = false;
}
}
std::string pickingMode; std::string pickingMode;
...@@ -418,6 +394,33 @@ void WMPickingDVR::pickHandler( WPickInfo pickInfo ) ...@@ -418,6 +394,33 @@ void WMPickingDVR::pickHandler( WPickInfo pickInfo )
} }
} }
void WMPickingDVR::setPickPositionSource()
{
// Get Camera and Register the callback
boost::shared_ptr< WGraphicsEngine > graphicsEngine = WGraphicsEngine::getGraphicsEngine();
boost::shared_ptr< WGEViewer > mainView = graphicsEngine->getViewerByName( "Main View" );
if( m_externalScreenPos->isConnected() == 0 )
{
if( !m_pickHandlerConnected )
{
// Register PickHandler
mainView->getPickHandler()->getPickSignal()->connect( boost::bind( &WMPickingDVR::pickHandler, this, _1 ) );
m_pickHandlerConnected = true;
}
}
else
{
if( m_pickHandlerConnected )
{
// Register PickHandler
mainView->getPickHandler()->getPickSignal()->disconnect( boost::bind( &WMPickingDVR::pickHandler, this, _1 ) );
m_pickHandlerConnected = false;
}
}
}
void WMPickingDVR::updateModuleGUI( std::string pickingMode ) void WMPickingDVR::updateModuleGUI( std::string pickingMode )
{ {
const bool picking = ( m_selectionType->get( true ).getItemIndexOfSelected( 0 ) == 0 ); const bool picking = ( m_selectionType->get( true ).getItemIndexOfSelected( 0 ) == 0 );
......
...@@ -105,6 +105,11 @@ private: ...@@ -105,6 +105,11 @@ private:
*/ */
void pickHandler( WPickInfo pickInfo ); void pickHandler( WPickInfo pickInfo );
/**
* Check if a \ref WSinglePosition is connected and dis/connects pick signal from clicking accordingly.
*/
void setPickPositionSource();
/** /**
* Shows and hide relevant properties according to chosen picking mode. * Shows and hide relevant properties according to chosen picking mode.
* *
...@@ -112,8 +117,6 @@ private: ...@@ -112,8 +117,6 @@ private:
*/ */
void updateModuleGUI( std::string pickingMode ); void updateModuleGUI( std::string pickingMode );
/** /**
* Calculates which interval is the most visible according * Calculates which interval is the most visible according
* to WYSIWYP (http://dx.doi.org/10.1109/TVCG.2012.292) * to WYSIWYP (http://dx.doi.org/10.1109/TVCG.2012.292)
......
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