Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[globe] Fix extent synchronisation
  • Loading branch information
m-kuhn committed Nov 12, 2013
1 parent a4cfbb1 commit 1e01cae
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/plugins/globe/globe_plugin.cpp
Expand Up @@ -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 );
Expand Down

0 comments on commit 1e01cae

Please sign in to comment.