[OpenLayers-Users] Using only one set of modify feature
controls for different layers?
Eric Lemoine
eric.lemoine at camptocamp.com
Wed Jan 6 11:51:31 EST 2010
On Wednesday, January 6, 2010, cgp <carina_palanca at forcorp.com> wrote:
>
>
> I think that would work, but it might make my code too long and
> unmanageable. I'd also like to avoid hard-coding as much as possible. In my
> post, I only used a small example of 3 layers, but my actual application has
> around 50 layers in it, so it's going to be huge if I make a set of controls
> for each of them
I'm not suggesting that. I'm suggesting creating a function that
receives a layer, destroys the existing controls (if any), and creates
new ones (configured with the passed layer). It's only 4 or 5
controls to destroy and create on each call to this function.
Alternatively, you can add a setLayer method to the modify feature
control. I'm not sure but the select feature control may have a
setLayer method already, that would probably help you.
Cheers,
--
Eric Lemoine
Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac, Cedex
Tel : 00 33 4 79 44 44 96
Mail : eric.lemoine at camptocamp.com
http://www.camptocamp.com
More information about the Users
mailing list