【发布时间】:2016-01-29 19:09:41
【问题描述】:
我正在使用 Google GWT 地图 API V3 java binding 3.8.0 更新地图应用程序。它是由 ANT 使用下载的 3 岁的 gwt-maps.jar 构建的。当前代码在旧 jar (3.8.0) 上运行良好:
import com.google.maps.gwt.client.MapOptions;
import com.google.maps.gwt.client.LatLng;
import com.google.maps.gwt.client.MapTypeId;
import com.google.maps.gwt.client.GoogleMap;
In GWT code take a button and write down the map loading code in to buttons onClick Event.
// This is the layout which will hold the button
final HLayout actionbuttonsLayout = new HLayout(10);
final IButton showMap = new IButton("Locate your Store");
actionbuttonsLayout.addMember(showMap);
//--- This is the layout which will hold the Map
final HLayout mapLayout = new HLayout(50);
final SimplePanel widg = new SimplePanel() ;
widg.setSize("700px", "200px");
layout.addMember(mapLayout);
mapLayout.setVisible(false);
// This is the Click Handler where the map rendering process has been written
showMap.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
MapOptions options = MapOptions.create();
options.setCenter(LatLng.create(39.509, -98.434));
options.setZoom(6);
options.setMapTypeId(MapTypeId.ROADMAP);
options.setDraggable(true);
options.setMapTypeControl(true);
options.setScaleControl(true);
options.setScrollwheel(true);
GoogleMap theMap = GoogleMap.create(widg.getElement(), options) ;
mapLayout.addMember(widg);
mapLayout.setVisible(true);
}
});
但如果我根据https://github.com/branflake2267/GWT-Maps-V3-Api/ 上的 branflake2267 指令将其更新为 Maven 存储库中可用的 API java 绑定的 3.9.0 或 3.10.0 版本)
<!-- GWT Maps API V3 -->
<dependency>
<groupId>com.github.branflake2267</groupId>
<artifactId>gwt-maps-api</artifactId>
<version>3.10.0-alpha-7</version>
</dependency>
2. Add the inherits statement to your module.gwt.xml.
```xml
<inherits name='com.google.gwt.maps.Maps' />
上面的代码不再起作用了!! Maven 构建找不到符号:GoogleMap、Marker、InfoWindow .... GoogleMap 类似乎不再在库中 - 是什么替换它? Marker 和 InfoWindow 类已在 3.9.0 中移至其他包。等等... 任何地方都没有支持更新的教程或示例。谁能告诉我将我的代码更新到 3.9.0 或 3.10.0 需要什么?非常感谢!
【问题讨论】:
标签: api gwt google-maps-api-3 maps