2012-08-29 29 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];