Skip to content
Permalink
Browse files

[globe] Fix extent synchronisation

  • Loading branch information
m-kuhn committed Aug 26, 2013
1 parent a4cfbb1 commit 1e01caea29c054868a0c10608f4ac5b5637ca756
Showing with 9 additions and 4 deletions.
  1. +9 −4 src/plugins/globe/globe_plugin.cpp
@@ -507,15 +507,20 @@ double GlobePlugin::getSelectedElevation()

void GlobePlugin::syncExtent()
{
QgsMapCanvas* mapCanvas = mQGisIface->mapCanvas();
QgsMapRenderer* mapRenderer = mapCanvas->mapRenderer();
QgsRectangle extent = mapCanvas->extent();

osgEarth::Util::EarthManipulator* manip = dynamic_cast<osgEarth::Util::EarthManipulator*>( mOsgViewer->getCameraManipulator() );
//rotate earth to north and perpendicular to camera
manip->setRotation( osg::Quat() );

//get mapCanvas->extent().height() in meters
QgsRectangle extent = mQGisIface->mapCanvas()->extent();
QgsDistanceArea dist;
dist.setEllipsoidalMode( true );
//dist.setProjectionsEnabled( true );

dist.setSourceCrs( mapRenderer->destinationCrs().srsid() );
dist.setEllipsoidalMode( mapRenderer->hasCrsTransformEnabled() );
dist.setEllipsoid( QgsProject::instance()->readEntry( "Measure", "/Ellipsoid", GEO_NONE ) );

QgsPoint ll = QgsPoint( extent.xMinimum(), extent.yMinimum() );
QgsPoint ul = QgsPoint( extent.xMinimum(), extent.yMaximum() );
double height = dist.measureLine( ll, ul );

0 comments on commit 1e01cae

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