0
GWT-OpenLayers展示请考虑this example。该示例分别实现了导航和框选功能。我如何一起实现导航和框选功能?即,只有在按下“Shift键”或“Ctrl键”时才进行选择,并在其余时间导航。GWT-OpenLayers:一起导航和选择框
GWT-OpenLayers展示请考虑this example。该示例分别实现了导航和框选功能。我如何一起实现导航和框选功能?即,只有在按下“Shift键”或“Ctrl键”时才进行选择,并在其余时间导航。GWT-OpenLayers:一起导航和选择框
我最终做了以下哪些工作适合我。
使用没有控制创建地图:
defaultMapOptions.setControls(new JObjectArray(new JSObject[0]));
然后添加自定义控件到地图中。 (在这里,我只是一个增加)
map.addControl(new PanZoomBar());
的PanZoomBar
可以在平移以及缩放帮助。这解决了导航问题。至于框选,
SelectFeatureOptions selectBoxFeatureOptions = new SelectFeatureOptions();
selectBoxFeatureOptions.setBox(true);
SelectFeature boxSelectFeature = new SelectFeature(vectorLayer,selectBoxFeatureOptions);
boxSelectFeature.setClickOut(false);
boxSelectFeature.setToggle(false);
boxSelectFeature.setMultiple(false);
boxSelectFeature.setToggleKey("ctrlKey");
boxSelectFeature.setMultipleKey("shiftKey");
map.addControl(boxSelectFeature);