Skip to content

Commit

Permalink
Mouse wheel zoom
Browse files Browse the repository at this point in the history
  • Loading branch information
pka committed Jul 5, 2011
1 parent 2fa95c4 commit 3ada3ae
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/plugins/globe/globe_plugin.cpp
Expand Up @@ -117,17 +117,13 @@ void GlobePlugin::run()
// The MapNode will render the Map object in the scene graph.
mMapNode = new osgEarth::MapNode( map );

viewer.setSceneData( mMapNode );

// Set a home viewpoint
manip->setHomeViewpoint(
osgEarthUtil::Viewpoint( osg::Vec3d( -90, 0, 0 ), 0.0, -90.0, 4e7 ),
1.0 );

viewer.setSceneData( mMapNode );

manip->getSettings()->bindMouseDoubleClick(
osgEarthUtil::EarthManipulator::ACTION_GOTO,
osgGA::GUIEventAdapter::LEFT_MOUSE_BUTTON );

// add our fly-to handler
viewer.addEventHandler(new FlyToExtentHandler( manip, mQGisIface ));

Expand Down
5 changes: 5 additions & 0 deletions src/plugins/globe/qgsosgviewer.cpp
Expand Up @@ -87,6 +87,11 @@ void QgsGLWidgetAdapter::mouseMoveEvent( QMouseEvent* event )
}


void QgsGLWidgetAdapter::wheelEvent(QWheelEvent *event)
{
_gw->getEventQueue()->mouseScroll((event->delta()>0) ? osgGA::GUIEventAdapter::SCROLL_UP : osgGA::GUIEventAdapter::SCROLL_DOWN);
}

// int mainAdapterWidget(QApplication& a, osg::ArgumentParser& arguments)
// {
// // load the scene.
Expand Down
1 change: 1 addition & 0 deletions src/plugins/globe/qgsosgviewer.h
Expand Up @@ -48,6 +48,7 @@ class QgsGLWidgetAdapter : public QGLWidget
virtual void mousePressEvent( QMouseEvent* event );
virtual void mouseReleaseEvent( QMouseEvent* event );
virtual void mouseMoveEvent( QMouseEvent* event );
virtual void wheelEvent( QWheelEvent * event );

osg::ref_ptr<osgViewer::GraphicsWindowEmbedded> _gw;
};
Expand Down

0 comments on commit 3ada3ae

Please sign in to comment.