考虑一下GWT上的这个例子 -OpenLayers展示。该示例分别实现导航和框选择功能。如何在一起实现导航和框选择功能?也就是说,只有当我按下“Shift键”或“Ctrl键”,并在剩余时间内导航时,我才会做出选择。
发布于 2014-03-28 08:07:52
最后,我做了以下对我有用的事情。
使用以下方法创建没有控件的映射:
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);附加参考
https://stackoverflow.com/questions/22631304
复制相似问题