[OpenLayers-Dev] multiple select controls on multiple layers in
same map not working
crb
jcbeaude at yahoo.com
Fri Oct 1 09:38:49 EDT 2010
I have a map that when I add a single vector layer and associated
SelectFeature control works fine, but when I add a 2nd vector layer and a
SelectFeature control associated with it, neither SelectFeature control
works. I've seen other posts related to multiple SelectFeature controls on
the same vector layer, but none on multiple layers so I'm not sure why it
doesn't work.
If I keep the commented sections below, my SelectFeature works on the first
layer added. If I uncomment, neither SelectFeature works.
var locsLayerDef = GetLayerDef('Monitoring Locations'); // creates
1st OpenLayers.Layer.Vector, applies styles, strategies, etc.
var locSelectCtrl = GetSelectControl(locsLayerDef); // creates 1st
SelectFeature for vector layer
//var selsLayerDef = GetLayerDef('selectedFeatures'); // creates
2nd OpenLayers.Layer.Vector,
//var selsSelectCtrl = GetSelectControl(selsLayerDef); // creates
2nd SelectFeature for vector layer
var mapOptions = GetDefaultMapOptions();
var searchMap = new OpenLayers.Map('searchMap', mapOptions);
SetBasemapLayers(initSettings.MapLayers); // adds base layers to
map
searchMap.addLayer(locsLayerDef); // adds 1st vector
//searchMap.addLayer(selsLayerDef); // adds 2nd vector
AddDefaultMapControls(searchMap); // adds PanZoomBar,
LayerSwitcher, etc.
AddFeatureSelectControl(searchMap, locSelectCtrl); // does
map.addControl(locSelectCtrl) and locSelectCtrl.activate()
//AddFeatureSelectControl(searchMap, selsSelectCtrl);
--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/multiple-select-controls-on-multiple-layers-in-same-map-not-working-tp5591394p5591394.html
Sent from the OpenLayers Dev mailing list archive at Nabble.com.
More information about the Dev
mailing list