我使用Gwt 2.6.1 (带有活动和场所框架)和gwt-openlayers 1.0。
当我使用google层(Google或GoogleV3实例)作为基本层时,问题就出现了。地图会出现,但我无法缩放或拖动,显示中缺少开始层控件(缩放按钮、图层切换程序、缩放线)。点击F5 (刷新)之后,问题就消失了,一切都很好。对于Bing baselayer来说,这些问题并没有发生。
情况很复杂,但可以复制:你需要3页。
在浏览器中打开应用程序时,可以看到欢迎页面。然后在url之后键入第二个页面的令牌(# second page )。显示第二页后,在基本url (#mapPage)之后键入第三页的令牌。如果您遵循此方案,就会出现上述问题。
第三页的ui.xml:
<gxt:ContentPanel headerVisible="false" borders="false" bodyBorder="false" height="500px" width="500px"/>第三页的视图:
...
@Override
public Widget asWidget() {
this.widget = TestView.uiBinder.createAndBindUi(this);
((ContentPanel) TestView.this.widget).add(TestGoogle.getMap());
return this.widget;
}
...TestGoogle类:
public class TestGoogle {
public static MapWidget getMap() {
MapOptions defaultMapOptions = new MapOptions();
defaultMapOptions.setNumZoomLevels(16);
MapWidget mapWidget = new MapWidget("100%", "100%", defaultMapOptions);
GoogleV3Options gHybridOptions = new GoogleV3Options();
gHybridOptions.setIsBaseLayer(true);
gHybridOptions.setType(GoogleV3MapType.G_NORMAL_MAP);
GoogleV3 gHybrid = new GoogleV3("Google Hybrid", gHybridOptions);
Map map = mapWidget.getMap();
map.addLayer(gHybrid);
map.addControl(new LayerSwitcher());
map.addControl(new OverviewMap());
map.addControl(new ScaleLine());
LonLat lonLat = new LonLat(6.95, 50.94);
lonLat.transform(ProjectionCode.LONGLAT.getEpsgCode(), map.getProjection());
map.setCenter(lonLat, 12);
return mapWidget;
}
}发布于 2014-09-12 10:50:13
我发现了问题所在。我两次在主页中包含了google脚本。
https://stackoverflow.com/questions/25366984
复制相似问题