[OpenLayers-Dev] [vector-behavior] strategies and inRange

Tim Schaub tschaub at opengeo.org
Mon Jul 21 10:22:25 EDT 2008


Hey-

I did the same for the BBOX strategy last week (only in the topp/trimet 
sandbox):

http://trac.openlayers.org/changeset/7523

Next week I'll work on merging whatever other changes I've made 
elsewhere to the vector-behavior sandbox.

Tim


Eric Lemoine wrote:
> Yes, by registering a moveend listener on its layer the strategy will
> only receive moveend events if the layer moveTo was called, i.e. if
> the layer is visible and in range. This is making sense to me. What do
> you guys think? Eric
> 
> 2008/7/18, Pierre GIRAUD <bluecarto at gmail.com>:
>> Hi all,
>>
>> I'm playing with the code in the vector-behavior sandbox.
>> I found that the strategies (at least BBOX and Grid) don't check if
>> the layer is in range.
>>
>> We can add code as following to support that :
>> {{{
>> Index: lib/OpenLayers/Strategy/Grid.js
>> ===================================================================
>> --- lib/OpenLayers/Strategy/Grid.js     (revision 7544)
>> +++ lib/OpenLayers/Strategy/Grid.js     (working copy)
>>  -276,7 +276,9 @@
>>      refresh: function(evt) {
>>          var bounds = this.layer.map.getExtent();
>>          var force = evt.zoomChanged || evt.force;
>> -        this.grid.moveTo(bounds, force);
>> +        if (this.layer.inRange && this.layer.visibility) {
>> +            this.grid.moveTo(bounds, force);
>> +        }
>>      },
>>
>>      CLASS_NAME: "OpenLayers.Strategy.Grid"
>> }}}
>>
>> But, it feels like we duplicate some code as the inRange and
>> visibility checks are already made at the map level.
>>
>> Instead we could imagine adding a "moveend" event at the layer level.
>> It would be triggered only when the layer is moved itself. And the
>> strategies would register to this new event.
>>
>> Tshaub and sbenthall, please tell me if you feel confident with this.
>> If so, I can commit something very quickly in the sandbox.
>>
>> Regards,
>> Pierre
>> _______________________________________________
>> Dev mailing list
>> Dev at openlayers.org
>> http://openlayers.org/mailman/listinfo/dev
>>
> _______________________________________________
> Dev mailing list
> Dev at openlayers.org
> http://openlayers.org/mailman/listinfo/dev
> 
> !DSPAM:4033,4880c4fd271554901796417!
> 




More information about the Dev mailing list