2013-07-30 44 views
0

試着用ARCGIS SDK的路由ios.I有我AGSPoint作爲創建AGSStopGraphic,路由IOS

AGSSpatialReference *sr = [AGSSpatialReference spatialReferenceWithWKID:102100]; 
    AGSPoint *myMarkerPoint =[AGSPoint pointWithX:-13626235.170442 
              y:4549170.396625 spatialReference:sr]; 

我必須做出AGSStopGraphic關於這一點,怎麼可以做什麼?這是基本的,但不知道如何去做。

怎麼辦這個路由呢?有沒有更好的計算策略

回答

0

您需要使用AGSPoint創建AGStopGraphic。您的myMarkerPoint是定義位置的幾何圖形。事情是這樣的:

AGSPictureMarkerSymbol* destSymbol = [AGSPictureMarkerSymbol pictureMarkerSymbolWithImage:[UIImage imageNamed:@"RedPin.png"]]; 

AGSStopGraphic* stop = [AGSStopGraphic graphicWithGeometry:myMarkerPoint 
                symbol:destSymbol 
               attributes:{@"Destination" : @"Name"}]; 

做路由請求,則需要使用setStopsWithFeatures:方法啓動與AGSRouteTaskParameters對象和停止添加到它(與所有其他參數)。然後使用AGSRouteTask對象,調用方法solveWithParameters:並將其傳遞給路由任務參數。

根據AGSRouteTask documentation有一個Routing sample應用程序,你可以看看。

+0

謝謝,那麼圖形中設置的「AGSPoint」在哪裏? –

+0

它的參數爲'graphicWithGeometry:',在我上面的例子中,我使用'myMarkerPoint'作爲值。 – progrmr