Commit 31c48716 by Alexander Wiebel

[REFAC] made members private and changed type of m_paintMode

parent 2577c723
Pipeline #236 passed with stages
in 21 minutes 14 seconds
......@@ -27,6 +27,7 @@
#include "../common/WLogger.h"
#include "WPickHandler.h"
#include "../common/WAssert.h"
const std::string WPickHandler::unpickString = "unpick";
......@@ -36,7 +37,7 @@ WPickHandler::WPickHandler()
m_shift( false ),
m_ctrl( false ),
m_viewerName( "" ),
m_paintMode( 0 ),
m_paintMode( false ),
m_mouseButton( WPickInfo::NOMOUSE ),
m_inPickMode( false ),
m_scrollWheel( 0 )
......@@ -49,7 +50,7 @@ WPickHandler::WPickHandler( std::string viewerName )
m_shift( false ),
m_ctrl( false ),
m_viewerName( viewerName ),
m_paintMode( 0 ),
m_paintMode( false ),
m_mouseButton( WPickInfo::NOMOUSE ),
m_inPickMode( false ),
m_scrollWheel( 0 )
......@@ -87,7 +88,7 @@ bool WPickHandler::handle( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAda
pick( view, ea );
}
}
if( ( buttonMask == osgGA::GUIEventAdapter::LEFT_MOUSE_BUTTON ) && ( m_paintMode == 1 ) )
if( ( buttonMask == osgGA::GUIEventAdapter::LEFT_MOUSE_BUTTON ) && ( m_paintMode ) )
{
m_mouseButton = WPickInfo::MOUSE_LEFT;
osgViewer::View* view = static_cast< osgViewer::View* >( &aa );
......@@ -260,7 +261,7 @@ void WPickHandler::pick( osgViewer::View* view, const osgGA::GUIEventAdapter& ea
{
std::string nodeName = extractSuitableName( hitr );
// now we skip everything that starts with an underscore if not in paint mode
if( nodeName[0] == '_' && ( m_paintMode == 0 ) )
if( nodeName[0] == '_' && ( !m_paintMode ) )
{
++hitr;
}
......@@ -355,7 +356,20 @@ void WPickHandler::pick( osgViewer::View* view, const osgGA::GUIEventAdapter& ea
m_pickSignal( getHitResult() );
}
void WPickHandler::setPaintMode( bool paintMode )
{
m_paintMode = paintMode;
}
void WPickHandler::setPaintMode( int mode )
{
m_paintMode = mode;
WAssert( mode == 1 || mode == 0, "Unexpected value" );
if( mode == 1 )
{
m_paintMode = true;
}
else
{
m_paintMode = false;
}
}
......@@ -90,9 +90,16 @@ public:
/**
* setter for paint mode
* \deprecated use variant taking bool instead.
* \param mode the paint mode
*/
void setPaintMode( int mode );
OW_API_DEPRECATED void setPaintMode( int mode );
/**
* Set in paint mode
* \param paintMode Should we switch to paint mode?
*/
void setPaintMode( bool paintMode );
static const std::string unpickString; //!< The string indicating picking has stopped.
......@@ -108,27 +115,27 @@ protected:
*/
virtual ~WPickHandler();
private:
/**
* Sets the current modifiers to the provided pickInfo
*
* \param pickInfo This pickInfo will be updated.
*/
void updatePickInfoModifierKeys( WPickInfo* pickInfo );
boost::signals2::signal< void( WPickInfo ) > m_pickSignal; //!< One can register to this signal to receive pick events.
WPickInfo m_hitResult; //!< Textual representation of the result of a pick.
WPickInfo m_startPick; //!< indicates what was first picked. Should be "" after unpick.
bool m_shift; //!< is shift pressed?
bool m_ctrl; //!< is ctrl pressed?
std::string m_viewerName; //!< which viewer sends the signal
int m_paintMode; //!< the paint mode
bool m_paintMode; //!< the paint mode
WPickInfo::WMouseButton m_mouseButton; //!< stores mouse button that initiated the pick
bool m_inPickMode; //!< if true, the pick handler currently is in pick mode.
int32_t m_scrollWheel; //!< the virtual value of the scrollwheel
private:
/**
* Sets the current modifiers to the provided pickInfo
*
* \param pickInfo This pickInfo will be updated.
*/
void updatePickInfoModifierKeys( WPickInfo* pickInfo );
boost::signals2::signal< void( WPickInfo ) > m_pickSignal; //!< One can register to this signal to receive pick events.
};
#endif // WPICKHANDLER_H
......@@ -140,7 +140,7 @@ void WSelectionManager::setPaintMode( WPaintMode mode )
osg::static_pointer_cast<WGEZoomTrackballManipulator>(
WKernel::getRunningKernel()->getGraphicsEngine()->getViewer()->getCameraManipulator() )->setPaintMode( mode );
WKernel::getRunningKernel()->getGraphicsEngine()->getViewer()->getPickHandler()->setPaintMode( mode );
WKernel::getRunningKernel()->getGraphicsEngine()->getViewer()->getPickHandler()->setPaintMode( mode == PAINTMODE_PAINT );
}
WPaintMode WSelectionManager::getPaintMode()
......
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