@@ -530,15 +530,28 @@ void GlobePlugin::syncExtent()
530
530
const QgsMapSettings &mapSettings = mapCanvas->mapSettings ();
531
531
QgsRectangle extent = mapCanvas->extent ();
532
532
533
+ long epsgGlobe = 4326 ;
534
+ QgsCoordinateReferenceSystem globeCrs;
535
+ globeCrs.createFromOgcWmsCrs ( QString ( " EPSG:%1" ).arg ( epsgGlobe ) );
536
+
537
+ // transform extent to WGS84
538
+ if ( mapSettings.destinationCrs ().authid ().compare ( QString ( " EPSG:%1" ).arg ( epsgGlobe ), Qt::CaseInsensitive ) != 0 )
539
+ {
540
+ QgsCoordinateReferenceSystem srcCRS ( mapSettings.destinationCrs () );
541
+ QgsCoordinateTransform* coordTransform = new QgsCoordinateTransform ( srcCRS, globeCrs );
542
+ extent = coordTransform->transformBoundingBox ( extent );
543
+ delete coordTransform;
544
+ }
545
+
533
546
osgEarth::Util::EarthManipulator* manip = dynamic_cast <osgEarth::Util::EarthManipulator*>( mOsgViewer ->getCameraManipulator () );
534
547
// rotate earth to north and perpendicular to camera
535
548
manip->setRotation ( osg::Quat () );
536
549
537
550
QgsDistanceArea dist;
538
551
539
- dist.setSourceCrs ( mapSettings. destinationCrs (). srsid () );
540
- dist.setEllipsoidalMode ( mapSettings. hasCrsTransformEnabled () );
541
- dist.setEllipsoid ( QgsProject::instance ()-> readEntry ( " Measure " , " /Ellipsoid " , GEO_NONE ) );
552
+ dist.setSourceCrs ( globeCrs );
553
+ dist.setEllipsoidalMode ( true );
554
+ dist.setEllipsoid ( " WGS84 " );
542
555
543
556
QgsPoint ll = QgsPoint ( extent.xMinimum (), extent.yMinimum () );
544
557
QgsPoint ul = QgsPoint ( extent.xMinimum (), extent.yMaximum () );
0 commit comments