Commit 31c48716 authored by Alexander Wiebel's avatar Alexander Wiebel

[REFAC] made members private and changed type of m_paintMode

parent 2577c723
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include "../common/WLogger.h" #include "../common/WLogger.h"
#include "WPickHandler.h" #include "WPickHandler.h"
#include "../common/WAssert.h"
const std::string WPickHandler::unpickString = "unpick"; const std::string WPickHandler::unpickString = "unpick";
...@@ -36,7 +37,7 @@ WPickHandler::WPickHandler() ...@@ -36,7 +37,7 @@ WPickHandler::WPickHandler()
m_shift( false ), m_shift( false ),
m_ctrl( false ), m_ctrl( false ),
m_viewerName( "" ), m_viewerName( "" ),
m_paintMode( 0 ), m_paintMode( false ),
m_mouseButton( WPickInfo::NOMOUSE ), m_mouseButton( WPickInfo::NOMOUSE ),
m_inPickMode( false ), m_inPickMode( false ),
m_scrollWheel( 0 ) m_scrollWheel( 0 )
...@@ -49,7 +50,7 @@ WPickHandler::WPickHandler( std::string viewerName ) ...@@ -49,7 +50,7 @@ WPickHandler::WPickHandler( std::string viewerName )
m_shift( false ), m_shift( false ),
m_ctrl( false ), m_ctrl( false ),
m_viewerName( viewerName ), m_viewerName( viewerName ),
m_paintMode( 0 ), m_paintMode( false ),
m_mouseButton( WPickInfo::NOMOUSE ), m_mouseButton( WPickInfo::NOMOUSE ),
m_inPickMode( false ), m_inPickMode( false ),
m_scrollWheel( 0 ) m_scrollWheel( 0 )
...@@ -87,7 +88,7 @@ bool WPickHandler::handle( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAda ...@@ -87,7 +88,7 @@ bool WPickHandler::handle( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAda
pick( view, ea ); 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; m_mouseButton = WPickInfo::MOUSE_LEFT;
osgViewer::View* view = static_cast< osgViewer::View* >( &aa ); osgViewer::View* view = static_cast< osgViewer::View* >( &aa );
...@@ -260,7 +261,7 @@ void WPickHandler::pick( osgViewer::View* view, const osgGA::GUIEventAdapter& ea ...@@ -260,7 +261,7 @@ void WPickHandler::pick( osgViewer::View* view, const osgGA::GUIEventAdapter& ea
{ {
std::string nodeName = extractSuitableName( hitr ); std::string nodeName = extractSuitableName( hitr );
// now we skip everything that starts with an underscore if not in paint mode // 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; ++hitr;
} }
...@@ -355,7 +356,20 @@ void WPickHandler::pick( osgViewer::View* view, const osgGA::GUIEventAdapter& ea ...@@ -355,7 +356,20 @@ void WPickHandler::pick( osgViewer::View* view, const osgGA::GUIEventAdapter& ea
m_pickSignal( getHitResult() ); m_pickSignal( getHitResult() );
} }
void WPickHandler::setPaintMode( bool paintMode )
{
m_paintMode = paintMode;
}
void WPickHandler::setPaintMode( int mode ) 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: ...@@ -90,9 +90,16 @@ public:
/** /**
* setter for paint mode * setter for paint mode
* \deprecated use variant taking bool instead.
* \param mode the paint mode * \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. static const std::string unpickString; //!< The string indicating picking has stopped.
...@@ -108,27 +115,27 @@ protected: ...@@ -108,27 +115,27 @@ protected:
*/ */
virtual ~WPickHandler(); 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_hitResult; //!< Textual representation of the result of a pick.
WPickInfo m_startPick; //!< indicates what was first picked. Should be "" after unpick. WPickInfo m_startPick; //!< indicates what was first picked. Should be "" after unpick.
bool m_shift; //!< is shift pressed? bool m_shift; //!< is shift pressed?
bool m_ctrl; //!< is ctrl pressed? bool m_ctrl; //!< is ctrl pressed?
std::string m_viewerName; //!< which viewer sends the signal 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 WPickInfo::WMouseButton m_mouseButton; //!< stores mouse button that initiated the pick
bool m_inPickMode; //!< if true, the pick handler currently is in pick mode. bool m_inPickMode; //!< if true, the pick handler currently is in pick mode.
int32_t m_scrollWheel; //!< the virtual value of the scrollwheel 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 #endif // WPICKHANDLER_H
...@@ -140,7 +140,7 @@ void WSelectionManager::setPaintMode( WPaintMode mode ) ...@@ -140,7 +140,7 @@ void WSelectionManager::setPaintMode( WPaintMode mode )
osg::static_pointer_cast<WGEZoomTrackballManipulator>( osg::static_pointer_cast<WGEZoomTrackballManipulator>(
WKernel::getRunningKernel()->getGraphicsEngine()->getViewer()->getCameraManipulator() )->setPaintMode( mode ); 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() 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