2012-04-02 58 views
0

有沒有辦法在我的gwt-應用程序中顯示像google-maps這樣的地圖。gwt中的路線規劃

我想實現一個頁面,用戶可以規劃一個路線,以2-4個不同的名稱。

或者其他類似的從A點的距離到B點。

你能給我一些例子和技巧。

回答

2

看一看http://code.google.com/p/gwt-google-apis/issues/detail?id=381#c53

在當前狀態下,有沒有Widget,但你可以在此期間使用SimplePanel

SimplePanel mapWidget = new SimplePanel(); 
// add the widget to a parent widget, then: 
GoogleMap map = GoogleMap.create(mapWidget.getElement()); 

,或者如果你用UiBinder的:

<div ui:field='mapElement'></div> 
@UiField DivElement mapElement; 

... 

GoogleMap map = GoogleMap.create(mapElement); 

然後,您可以使用DirectionsService獲取路線,並使用com.google.maps.gwt.client.geometry package來計算點之間的距離。

API是從JavaScript自動生成的,它應該足夠相似,以便您可以輕鬆地將您在Web上找到的JS示例修改爲適用於GWT綁定。