Skip to content
Permalink
Browse files

added HomeControlHandler

  • Loading branch information
Marco Bernasocchi authored and pka committed Dec 1, 2010
1 parent ab9bc85 commit 7a9695605792238dc7bc6361a7a1baf4f36a12d0
Showing with 12 additions and 15 deletions.
  1. +7 −10 src/plugins/globe/globe_plugin.cpp
  2. +5 −5 src/plugins/globe/globe_plugin.h
@@ -259,7 +259,7 @@ void GlobePlugin::setupMap()
struct PanControlHandler : public NavigationControlHandler
{
PanControlHandler( osgEarthUtil::EarthManipulator* manip, double dx, double dy ) : _manip( manip ), _dx( dx ), _dy( dy ) { }
virtual void onMouseDown( Control* control, int mouseButtonMask )
virtual void onMouseDown( Control* control, int mouseButtonMask, const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa )
{
_manip->pan( _dx, _dy );
}
@@ -272,7 +272,7 @@ struct PanControlHandler : public NavigationControlHandler
struct RotateControlHandler : public NavigationControlHandler
{
RotateControlHandler( osgEarthUtil::EarthManipulator* manip, double dx, double dy ) : _manip( manip ), _dx( dx ), _dy( dy ) { }
virtual void onMouseDown( Control* control, int mouseButtonMask )
virtual void onMouseDown( Control* control, int mouseButtonMask, const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa )
{
if( 0 == _dx && 0 == _dy )
{
@@ -292,7 +292,7 @@ struct RotateControlHandler : public NavigationControlHandler
struct ZoomControlHandler : public NavigationControlHandler
{
ZoomControlHandler( osgEarthUtil::EarthManipulator* manip, double dx, double dy ) : _manip( manip ), _dx( dx ), _dy( dy ) { }
virtual void onMouseDown( Control* control, int mouseButtonMask )
virtual void onMouseDown( Control* control, int mouseButtonMask, const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa )
{
_manip->zoom( _dx, _dy );
}
@@ -302,15 +302,12 @@ struct ZoomControlHandler : public NavigationControlHandler
double _dy;
};

struct HomeControlHandler : public ControlEventHandler
struct HomeControlHandler : public NavigationControlHandler
{
HomeControlHandler( osgEarthUtil::EarthManipulator* manip ) : _manip( manip ) { }
virtual void onClick( Control* control, int mouseButtonMask )
virtual void onMouseDown( Control* control, int mouseButtonMask, const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa )
{
_manip->setRotation( osg::Quat() );
//FIXME: instead of next 2 lines use _manip->home( control->ea, control->aa );
osgEarthUtil::Viewpoint viewpoint( osg::Vec3d( -90, 0, 0.0 ), 0.0, -90.0, 3e7 );
_manip->setViewpoint( viewpoint, 4.0 );
_manip->home( ea, aa );
}
private:
osg::observer_ptr<osgEarthUtil::EarthManipulator> _manip;
@@ -699,7 +696,7 @@ bool NavigationControl::handle( const osgGA::GUIEventAdapter& ea, osgGA::GUIActi
for( ControlEventHandlerList::const_iterator i = _eventHandlers.begin(); i != _eventHandlers.end(); ++i )
{
NavigationControlHandler* handler = dynamic_cast<NavigationControlHandler*>( i->get() );
if( handler ) handler->onMouseDown( this, ea.getButtonMask() );
if( handler ) handler->onMouseDown( this, ea.getButtonMask(), ea, aa );
}
}
return Control::handle( ea, aa, cx );
@@ -112,7 +112,7 @@ class GlobePlugin : public QObject, public QgisPlugin
osgEarthUtil::ObjectPlacer* mObjectPlacer;
};

class FlyToExtentHandler : public osgGA::GUIEventHandler
class FlyToExtentHandler : public osgGA::GUIEventHandler
{
public:
FlyToExtentHandler( GlobePlugin* globe ) : mGlobe ( globe ) { }
@@ -123,7 +123,7 @@ class FlyToExtentHandler : public osgGA::GUIEventHandler
GlobePlugin* mGlobe;
};

class KeyboardControlHandler : public osgGA::GUIEventHandler
class KeyboardControlHandler : public osgGA::GUIEventHandler
{
public:
KeyboardControlHandler( osgEarthUtil::EarthManipulator* manip, QgisInterface *qGisIface ) : _manip(manip), mQGisIface(qGisIface) { }
@@ -137,14 +137,14 @@ class KeyboardControlHandler : public osgGA::GUIEventHandler
QgisInterface *mQGisIface;
};

namespace osgEarthUtil
{
namespace osgEarthUtil
{
namespace Controls2
{
class NavigationControlHandler : public ControlEventHandler
{
public:
virtual void onMouseDown( class Control* control, int mouseButtonMask ) { }
virtual void onMouseDown( class Control* control, int mouseButtonMask, const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa ) { }
};

class NavigationControl : public ImageControl

0 comments on commit 7a96956

Please sign in to comment.
You can’t perform that action at this time.