Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Revert FlyToExtentHandler
  • Loading branch information
pka committed Jul 5, 2011
1 parent 655bd09 commit a2a391c
Showing 1 changed file with 22 additions and 67 deletions.
89 changes: 22 additions & 67 deletions src/plugins/globe/globe_plugin.cpp
Expand Up @@ -104,28 +104,6 @@ void GlobePlugin::initGui()
this, SLOT( layersChanged() ) );
}

struct MyClickHandler : public ControlEventHandler
{
void onClick( Control* control, int mouseButtonMask)
{
OE_NOTICE << "Thank you for clicking on " << typeid(control).name()
<< std::endl;
}
};

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 )
{
_manip->pan( _dx, _dy );
}
private:
osg::observer_ptr<osgEarthUtil::EarthManipulator> _manip;
double _dx;
double _dy;
};


void GlobePlugin::run()
{
Expand Down Expand Up @@ -274,6 +252,28 @@ void GlobePlugin::setupMap()
#endif
}

struct MyClickHandler : public ControlEventHandler
{
void onClick( Control* control, int mouseButtonMask)
{
OE_NOTICE << "Thank you for clicking on " << typeid(control).name()
<< std::endl;
}
};

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 )
{
_manip->pan( _dx, _dy );
}
private:
osg::observer_ptr<osgEarthUtil::EarthManipulator> _manip;
double _dx;
double _dy;
};

void GlobePlugin::setupControls()
{

Expand Down Expand Up @@ -554,57 +554,12 @@ void GlobePlugin::copyFolder(QString sourceFolder, QString destFolder)

bool FlyToExtentHandler::handle( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa )
{
float deg = 3.14159 / 180;

//this should be the way to implement this I think, but it segfaults...
//TODO: put this in the correct place, here is ok for now to test
//_manipSettings.bindKey(osgEarthUtil::EarthManipulator::ACTION_ZOOM_IN, osgGA::GUIEventAdapter::KEY_Page_Up);
//_manip->applySettings( _manipSettings );


if ( ea.getEventType() == ea.KEYDOWN && ea.getKey() == '1' )

{
QgsPoint center = mQGisIface->mapCanvas()->extent().center();
osgEarthUtil::Viewpoint viewpoint( osg::Vec3d( center.x(), center.y(), 0.0 ), 0.0, -90.0, 1e4 );
_manip->setViewpoint( viewpoint, 4.0 );
}


/*if ( ea.getEventType() == ea.KEYDOWN && ea.getKey() == '4' )
{
_manip->pan(-1,0);
}
if ( ea.getEventType() == ea.KEYDOWN && ea.getKey() == '6' )
{
_manip->pan(1,0);
}
if ( ea.getEventType() == ea.KEYDOWN && ea.getKey() == '8' )
{
_manip->pan(0,1);
}
if ( ea.getEventType() == ea.KEYDOWN && ea.getKey() == '2' )
{
_manip->pan(0,-1);
}
if ( ea.getEventType() == ea.KEYDOWN && ea.getKey() == '+' )
{
_manip->rotate(0,1*deg);
}
*/
if ( ea.getEventType() == ea.KEYDOWN && ea.getKey() == '-' )
{
_manip->rotate(0,-1*deg);
}
if ( ea.getEventType() == ea.KEYDOWN && ea.getKey() == '/' )
{
_manip->rotate(1*deg,0);
}
if ( ea.getEventType() == ea.KEYDOWN && ea.getKey() == '*' )
{
_manip->rotate(-1*deg,0);
}

return false;
}

Expand Down

0 comments on commit a2a391c

Please sign in to comment.