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

Pierre GIRAUD bluecarto at gmail.com
Mon Jul 21 10:46:39 EDT 2008


You answered as I was working on that code and committing it.
Please have a look at the revision 7555 when you get a chance.

Regards,
Pierre

On Mon, Jul 21, 2008 at 4:22 PM, Tim Schaub <tschaub at opengeo.org> wrote:
> 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!
>>
>
> _______________________________________________
> Dev mailing list
> Dev at openlayers.org
> http://openlayers.org/mailman/listinfo/dev
>



More information about the Dev mailing list