[OpenLayers-Users] changing style of a WFS layer

Eric Lemoine eric.c2c at gmail.com
Tue Nov 25 12:31:20 EST 2008


I'm also suprised that calling map.getZoom on each feature redraw
comes with a noticeable performance penalty. Might be worth doing some
testing here and comparing

var a = map.getZoom();
for (var i = 0; i < 1000; i++) {
    var b = a;
}

with

for (var i = 0; i < 1000; i++) {
    var b = map.getZoom();
}

--
Eric

2008/11/25, Ivan Grcic <ivan.grcic at geofoto.hr>:
> Hi all,
>
> On Tue, Nov 25, 2008 at 4:50 PM, Christopher Schmidt
> <crschmidt at metacarta.com> wrote:
>> On Tue, Nov 25, 2008 at 10:46:32AM -0500, Alexandre Dube wrote:
>>> I'm glad it worked.  But to my eyes there seems to be a flaw in this
>>> solution : performance.  In the example I gave you, there was a need of
>>> calculating the radius for each features because of the cluster
>>> strategy.  But for you, triggering map.getZoom() for each features that
>>> will end up being all at the same size is pretty useless.
>>
>> map.getZoom() is just a property access. There's no significant speed
>> penalty to using it multiple times like this.
>>
> I wouldnt agree with this. I did same thin few weeks ago, and i have
> to say it was slowing things down pretty much. Instead calling it
> every time, you can just do this:
>
> map.events.register('zoomend', map, function(e){
> 			zoomLevel = map.getZoom()+2;
>         });
>
> where zoomLevel is global variable. Then you just use it inside context:
> ...
>            context: {
>            radius: function() {
>                        return  zoomLevel ;
>                         }
>                  }
>            });
> ...
>
> I think you have to register zoomend event before adding a layer (not
> sure bout that)
> Cheers, Ivan
>
>> Regards,
>> --
>> Christopher Schmidt
>> MetaCarta
>> _______________________________________________
>> Users mailing list
>> Users at openlayers.org
>> http://openlayers.org/mailman/listinfo/users
>>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>



More information about the Users mailing list