gwt中的路线规划

时间:2012-04-02 12:44:51

标签: api gwt routes

有没有办法在我的gwt-application中显示像google-maps这样的地图。

我想实现一个页面,用户可以计划到2-4个不同名称的路由。

或者从A点到B点的距离。

你能给我一些例子和提示。

1 个答案:

答案 0 :(得分: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绑定。