[OpenLayers-Dev] Layer.Vector: getStrategyByClass

Eric Lemoine eric.c2c at gmail.com
Sun Nov 23 10:28:50 EST 2008


On Tue, Nov 18, 2008 at 9:38 AM,  <bartvde at osgis.nl> wrote:
> Hi list,
>
> it would be convenient if the Vector Layer would have a getStrategyByClass
> function or not?

Yes it would.

>
> On a side note, should the getBy function of Map.js not be a Util one?

In that case it'd look like:

function(obj, array, property, match) {
    var test = (typeof match.test == "function");
    var found = OpenLayers.Array.filter(obj[array], function(item) {
        return item[property] == match || (test && match.test(item[property]));
    });
    return found;
}

Given that Map.getBy is an API method it should remain. However it
could rely on the getBy function defined in Util.js:

getBy: function(array, property, match) {
    return OpenLayers.Util.getBy(this, array, property, match)
},

I'm +1 on adding a  getStrategyByClass method to the Layer.Vector
class and on adding a GetBy function to Util.js.

Thanks Bart,
--
Eric



More information about the Dev mailing list