GWT OpenLayers:一起导航和框选择

GWT OpenLayers:一起导航和框选择,gwt,openlayers,gwt-openlayers,Gwt,Openlayers,Gwt Openlayers,考虑一下GWT OpenLayers showcase。该示例分别实现了导航和框选择功能。如何同时实现导航和框选择功能?i、 e.我只在按下“Shift键”或“Ctrl键”时进行选择,并在其余时间导航。我最后做了以下对我有用的事情 使用以下方法创建无控件的地图: defaultMapOptions.setControls(new JObjectArray(new JSObject[0])); 然后将自定义控件添加到地图。(这里我只添加一个) PanZoomBar可以帮助平移和缩放。这修复了导航

考虑一下GWT OpenLayers showcase。该示例分别实现了导航和框选择功能。如何同时实现导航和框选择功能?i、 e.我只在按下“Shift键”或“Ctrl键”时进行选择,并在其余时间导航。

我最后做了以下对我有用的事情

使用以下方法创建无控件的地图:

defaultMapOptions.setControls(new JObjectArray(new JSObject[0]));
然后将自定义控件添加到地图。(这里我只添加一个)

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);

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);