[OpenLayers-Users] Select more than the one Feature

Tom Wasser tom.wasser at gmx.de
Fri Jan 15 07:47:01 EST 2010


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.
-- 
View this message in context: http://n2.nabble.com/Select-more-than-the-one-Feature-tp4398464p4398464.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.



More information about the Users mailing list