Skip to content
Permalink
Browse files

Revert FlyToExtentHandler

  • Loading branch information
pka committed Nov 26, 2010
1 parent 655bd09 commit a2a391c4a0fd09d766c0c389ab34a1175bceadb3
Showing with 22 additions and 67 deletions.
  1. +22 −67 src/plugins/globe/globe_plugin.cpp
@@ -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;
}

0 comments on commit a2a391c

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