2012-08-29 27 views
0

如何使地球在特定坐标上旋转?我想要将地球仪旋转到来自URL的特定坐标。我设法做到这一点,但只有当应用程序关闭。当它在背景中时,它只是移动到南极附近的某个位置,不管我给它的坐标。WhirlyGlobe框架 - 旋转到坐标

下面的代码:

- (void)moveToLocation 
{ 
    WhirlyGlobe::GeoCoord startCoord; 

    // If the app wasn started from URL 
    if ([[GlobalValues sharedGlobalValues] enteredFromURL]) 
    { 
     float lat = [[GlobalValues sharedGlobalValues] sharedLat]; 
     float lon = [[GlobalValues sharedGlobalValues] sharedLon]; 

     // Set the shared location 
     startCoord = WhirlyGlobe::GeoCoord::CoordFromDegrees(lon, lat); 
     // Calculate the rotation and make it 
     Eigen::Quaternionf startLoc = [self.theView makeRotationToGeoCoord:startCoord keepNorthUp:YES]; 
     self.theView.delegate = [[[AnimateViewRotation alloc] initWithView:self.theView rot:startLoc howLong:5.0] autorelease]; 
    } 
} 

而且,我怎么可以把它放大?当应用程序从url开始时,它会进行旋转+缩放,但是当它位于后台时,它不会缩放。

回答

0

请尽量保持AnimateViewRotation委托。如果它在幕后发布,动画可能会消失。

此外,如果可以,我建议切换到WhirlyGlobe组件。使用起来更简单。

+0

我会尝试,但问题是,地球是动画的坐标,但只有一个,无论坐标我是给予。 –

+0

我建议用一些众所周知的值试一下。确保它做它应该做的事情,然后看看解析。 – mousebird

0

检查方法命名为“animateToPosition”
例子:

[globeViewC animateToPosition:MaplyCoordinateMakeWithDegrees(75.011509, 15.8377301) time:1.0];