2012-04-02 59 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绑定。