Revert FlyToExtentHandler

This commit is contained in:
Pirmin Kalberer 2010-11-26 01:12:57 +01:00
parent 655bd091e0
commit a2a391c4a0

View File

@ -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()
{
@ -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()
{
@ -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;
}