[MapQuery] Re: Return value of Layer.remove()

Christian Wygoda arsgeografica at googlemail.com
Tue Feb 28 14:43:33 EST 2012


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

That sounds good.

Cheers,
 C


On 02/28/2012 07:23 PM, Volker Mische wrote:
> On 02/27/2012 12:47 AM, Volker Mische wrote:
>> Hi all,
>> 
>> I currently work on the event handling a bit and I stumbled upon
>> the Layer.remove() function. According to the docs, it returns
>> the ID of the layer (the implementation doesn't, but that would
>> be easy to fix).
>> 
>> Though I don't think this makes much sense. But what are the 
>> alternatives? For the "removelayer" event, I've gone for
>> including the just removed layer in the event. This is also what
>> OpenLayers does. It makes sense, as you can now use its data to
>> so some cleanup in your application.
>> 
>> A good return value is a harder problem. Returning the removed
>> layer doesn't make much sense, as we want some kind of chaining.
>> It would be odd to have a chain with a non-attached layer.
>> 
>> Another possible value would be the Map object, so you can keep
>> the chain and e.g. add a new layer.
>> 
>> What do you think?
>> 
>> Cheers, Volker
> 
> After a quick discussion with Steven on the IRC channel, here's
> what we concluded.
> 
> Normally, if you remove a layer, you don't need the return value.
> But in what cases do you need one? For example if you want to have
> a popup saying that layer xyz was removed. But those things should
> be done asynchronously. This is what the "layerremoved" event is
> for, which will include the removed layer.
> 
> Hence we thought returning the map instead is a easy to remember 
> behaviour. The mnemonic will be "if you remove something, the
> upper level will be returned". For layers it's the map, for
> features (which I code atm) it will be the layer.
> 
> Any comments? :)
> 
> Cheers, Volker
> 
> 
> _______________________________________________ MapQuery mailing
> list MapQuery at lists.osgeo.org 
> http://lists.osgeo.org/mailman/listinfo/mapquery

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iQEcBAEBAgAGBQJPTS5lAAoJEE6L5yZHE/iHLOsH/iaTL79Fm4YNQTj6cqCw329l
3hagwjSLuXTb4fT33hnidgWNV4Oq3UASWwbPHbSBBB2xLFiIpZXQqeFY3SZcDdI1
H7rYpVJHHKabQof0/fRvP3hXhrRwxqI3yyV84/ZUJneh8IRu9Iu+4DVdq/QgFven
oyfy9Z+Rb9q5dyHxrDVt5Z6tkqbdh7emEMgCX3q4ZRkjTSGir+9XzOUc5o13Dk8/
XyDlKLPyitLLJsq4HATJtTtPvFtLF+XFtHlaZ9KTGJY7FzKuf7Av+h8DeI1ljf3r
briY61fe6oZ0cyt5jv4FK2byCmRWKnZRjWVuRBIDtKZ6zL6F6gRZwb2Vl7rpngs=
=iXdS
-----END PGP SIGNATURE-----


More information about the MapQuery mailing list