On 11 June 2012 11:47, Jorge Gaspar Sanz Salinas <[email protected]> wrote: > On 11 June 2012 02:23, jmorley <[email protected]> wrote: >> >> jamarks wrote >>> >>> I want to programmatically select features using GWT. It appears there >>> had been a SelectFeature.select(VectorFeature) method, but that maybe it >>> no longer exists. I haven't been able to find any discussion confirming >>> or refuting this. >>> >>> If there is a supported way of programmatically selecting a feature, I'd >>> love to hear about it. >>> >>> Jett >>> >> >> I haven't found any reply to this, or confirmation on the web of whether >> SelectFeatures.select() should work in v2.11. In an experiment it didn't >> seem to work but this was in the middle of a complex application and maybe I >> had something else wrong. >> >> What's the best way of programmatically selecting a feature in a layer, >> please? >> >> Thanks, >> Jeremy >> >> > > Hi Jeremy, I've tried this on the Select example[1], > > 1st) draw a couple of polygons > > 2nd) open a console (I'm using Chrome) > > c = this.map.getControlsByClass("OpenLayers.Control.SelectFeature")[0] > > l1 = this.map.getLayersByClass("OpenLayers.Layer.Vector")[0] > > 3rd) select features > > c.select(l1.features[0]) > c.select(l1.features[1]) > c.unselectAll() > > So the select method seems to work as expected on this minimal and rude > example. > > Cheers >
ups sorry [1] http://dev.openlayers.org/releases/OpenLayers-2.11/examples/select-feature.html -- Jorge Sanz http://es.osgeo.org _______________________________________________ Users mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/openlayers-users
