[OpenLayers-Dev] clearing handlers

Eric Lemoine eric.c2c at gmail.com
Fri Nov 7 13:05:26 EST 2008


Ok, so this was for working around a bug in OpenLayers. In my opinion
this is a mistake that the regular polygon handler's clear method
belongs to the user API. Eric

2008/11/7, Bart van den Eijnden (OSGIS) <bartvde at osgis.nl>:
> Right that was my concern, and my use case used to be (the bug is now
> fixed fortunately) clearing the sketch layer of the measure control.
> Since the measure control can have different types of Handlers I would
> now need to do different things according to which is the underlying
> Handler.
>
> Btw the bug was that when using the mouse wheel for zooming, the measure
> geometry would not scale so it needed to be cleared.
>
> Best regards,
> Bart
>
> Eric Lemoine wrote:
>> I guess Bart is saying that the RegularPolygon handler has an API
>> method named "clear" (which clear the sketch layer's renderer and
>> destroy the features in that layer), which the other drawing handlers
>> don't have. I'm personally wondering why "clear" is in an API method
>> in the reg polygon handler in the first place. Eric
>>
>> 2008/11/7, Christopher Schmidt <crschmidt at metacarta.com>:
>>
>>> On Thu, Nov 06, 2008 at 09:10:20AM +0100, bartvde at osgis.nl wrote:
>>>
>>>> Hi list,
>>>>
>>>> why is the interface for clearing handlers not standardized? Maybe there
>>>> is a good reason for it that I am missing.
>>>>
>>> Why do you need to clear handlers? I'm not seeing the use case, I don't
>>> think.
>>>
>>>
>>>
>>>> For Handler/RegularPolygon.js the function is called clear. It will
>>>> clear
>>>> the renderer of the layer and call destroyFeatures() on the layer.
>>>>
>>>> For Handler/Path.js, Handler/Point.js and Handler/Polygon.js you have to
>>>> call destroyFeature directly.
>>>>
>>>> Would it not be better to have a API method called clear on all these
>>>> Handlers?
>>>>
>>>> Thoughts?
>>>>
>>>> Best regards,
>>>> Bart
>>>>
>>>> _______________________________________________
>>>> Dev mailing list
>>>> Dev at openlayers.org
>>>> http://openlayers.org/mailman/listinfo/dev
>>>>
>>> --
>>> Christopher Schmidt
>>> MetaCarta
>>> _______________________________________________
>>> Dev mailing list
>>> Dev at openlayers.org
>>> http://openlayers.org/mailman/listinfo/dev
>>>
>>>
>>
>>
>>
>
>
> --
> Bart van den Eijnden
> OSGIS, Open Source GIS
> bartvde at osgis.nl
> http://www.osgis.nl
>
>



More information about the Dev mailing list