2013-07-31 22 views
2

我正在WhirlyGlobe組件測試應用程序(mousebird團隊的ios全球應用程序的偉大框架)上工作,並嘗試創建緯度和經度。我創建了利用該方法對地球經度:- (void)addGreatCircles:(LocationInfo *)locations len:(int)len stride:(int)stride offset:(int)offset 和陣列中分配的值:LocationInfo locations[NumLocations]但是當我嘗試通過提供的座標中,以創建全球緯度:使用WhirlyGlobeComponet在地球上創建緯度線時的問題

LocationInfo locations[NumLocations] = { 
{"twenty five",0, 180}, 
{"twenty six",0, -10} 
// {"three",30,180.0}, 
// {"four",30,0}, 
// {"five",60, 180}, 
//{"six",60, 0}, 
} 

和兒子......我只能得到全球緯度線的一半。我不知道爲什麼會出現這個問題。這是由於OpenGL或什麼。有人請幫助我做到這一點。 當我給起點的屏幕截圖(0,-180)結束點(0,0)出現像示於圖像 - 1,2:

IMAGE-1 enter image description here

IMAGE-2 enter image description here

我需要的是在地球上繪製完整的緯度線。使用起點(0,0)到終點(0,360)爲我提供一個空白輸出(地球上沒有畫線)。 我已經嘗試開始點(0,10)終點(0,-10),以便線覆蓋完整的球體,但沒有成功yet.Please幫助傢伙!

回答

3

首先,您需要移至github上的develop分支。這是即將發佈的2.2版本。

我已經在測試應用程序中添加了一個例子來完成此操作。

enter image description here

下面是我們如何拉其關閉。

- (void)addLinesLon:(float)lonDelta lat:(float)latDelta color:(UIColor *)color 
{ 
    NSMutableArray *vectors = [[NSMutableArray alloc] init]; 
    NSDictionary *desc = @{kMaplyColor: color, kMaplySubdivType: kMaplySubdivSimple, kMaplySubdivEpsilon: @(0.001), kMaplyVecWidth: @(4.0), kMaplyDrawPriority: @(1000)}; 
    // Longitude lines 
    for (float lon = -180;lon < 180;lon += lonDelta) 
    { 
     MaplyCoordinate coords[3]; 
     coords[0] = MaplyCoordinateMakeWithDegrees(lon, -90); 
     coords[1] = MaplyCoordinateMakeWithDegrees(lon, 0); 
     coords[2] = MaplyCoordinateMakeWithDegrees(lon, +90); 
     MaplyVectorObject *vec = [[MaplyVectorObject alloc] initWithLineString:coords numCoords:3 attributes:nil]; 
     [vectors addObject:vec]; 
    } 
    // Latitude lines 
    for (float lat = -90;lat < 90;lat += latDelta) 
    { 
     MaplyCoordinate coords[5]; 
     coords[0] = MaplyCoordinateMakeWithDegrees(-180, lat); 
     coords[1] = MaplyCoordinateMakeWithDegrees(-90, lat); 
     coords[2] = MaplyCoordinateMakeWithDegrees(0, lat); 
     coords[3] = MaplyCoordinateMakeWithDegrees(90, lat); 
     coords[4] = MaplyCoordinateMakeWithDegrees(+180, lat); 
     MaplyVectorObject *vec = [[MaplyVectorObject alloc] initWithLineString:coords numCoords:5 attributes:nil]; 
     [vectors addObject:vec]; 
    } 

    latLonObj = [baseViewC addVectors:vectors desc:desc]; 
} 

WhirlyGlobe-Maply 2.2爲向量渲染和細分添加了一些技巧。現在你可以告訴工具箱把行分成一個epsilon以使它們可以接受。我們也可以渲染一個東西而不用擔心z緩衝。所以你去了,現在很容易。

這裏唯一真正的技巧就是我們必須把線條分解成幾部分。我們至少需要三個點,或者細分邏輯只會檢測一個退化的情況。緯度的5個點線用於一些錯誤測試邏輯。

+0

感謝您的快速響應。我將通過添加上面的代碼開始開發branch.check。我是否需要將此代碼直接添加到TestViewController並在需要時調用此方法?希望查看更改新的2.2版本即將推出。我面臨的一個最新問題是點擊標註/覆蓋視圖。不接受點擊十字按鈕我應該怎麼做。我已經添加了上述問題本身的屏幕截圖。 – sac

+0

圖5顯示了我面臨的問題。對此問題也提出了一些建議。謝謝! – sac

+0

我不知道你的標註是怎麼回事。你可以看看這個:https://github.com/mousebird/WhirlyGlobe/issues/29 – mousebird

相關問題