[OpenLayers-Users] Select more than the one Feature

Alexandre Dube adube at mapgears.com
Fri Jan 15 08:29:30 EST 2010


Tom,

Try :

sf.select(boxes.features[i]);

Alexandre


Tom Wasser wrote:
> Hi all,
>
> i have a layer with a lot of Feature.Vectors on it.
>
>                 for (var i = 0; i < box_extents.length; i++) {
>                     ext = box_extents[i];
>                     bounds = new OpenLayers.Bounds(ext[0], ext[1], ext[2],
> ext[3]);
>                     box = new
> OpenLayers.Feature.Vector(bounds.toGeometry());
>                     box.value = box_values[i];
>                     boxes.addFeatures(box);
>                 }
>
> Then there is a SelectFeature:
>
>                 var sf = new OpenLayers.Control.SelectFeature(boxes);
>                 sf.clickout = false;
>                 sf.multiple = true;
>                 sf.onSelect = DoSomething;
>                 map.addControl(sf);
>                 sf.activate();
>
> In the function DoSomething id'd like to select all Features with same
> values. 
> With the following i am able to get all values shown:
>
>             function MachWas() {
>                 for (i in boxes.features) {
>                     alert(boxes.features[i].value);
>                 }
>             };
>
> But with this function can't select the features.
>
>             function MachWas() {
>                 for (i in boxes.features) {
>                     boxes.features[i].select;
>                 }
>             };
>
> My question is: how can i select features by code?
>
> Best regards, Tom.
>   


-- 
Alexandre Dubé
Mapgears
www.mapgears.com




More information about the Users mailing list