AW: [OpenLayers-Users] editing tool on multiple layers

Arnd Wippermann arnd.wippermann at web.de
Fri Apr 15 15:36:47 EDT 2011


try
layer1.events.unregister("featureadded",'',FeatureAdded);
 
to unregister your event, before you register the new one.
 
Arnd

  _____  

Von: openlayers-users-bounces at lists.osgeo.org
[mailto:openlayers-users-bounces at lists.osgeo.org] Im Auftrag von Mohammed
Rashad
Gesendet: Freitag, 15. April 2011 17:07
An: openlayers-users at lists.osgeo.org
Betreff: [OpenLayers-Users] editing tool on multiple layers


I have two layers 
layer1
layer2
both are editable vector layers

for layer1 is point layer and layer2 is poygon layers
I had registered some events. both are sharing same events but the behaviour
of events is different
for example

layer1.events.register("featureadded",'',FeatureAdded);
function FeatureAdded(){
alert('layer1');
};
layer2.events.register("featureadded",'',FeatureAdded);
function FeatureAdded(){
alert('layer2');
};

how to define the function as local to a specific layer so that I can use
the same function defined twice whose defenition is different.?

Can I remove the function from the code dynamically?

How to register a function local to the layer.
I will dynamically change the layer using checkboxes which are not part of
OpenLayers.
when I check the checkbox 

I can do the following
    Toggle layer visibility
    destroy controlpanel and create tie it to the new layer (say layer 2)

I redefined the functions for featureadded event (FeatureAdded) but the old
function is in use not the redefined one
How can I use the newly defined FeatureAdded function for a featureadded
event after changing the layer

I think some questions are not related to OpenLayers. if so forgive me


Any help will be greatly appreciated


-- 

Thanks && Regards
Rashad

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20110415/1650cbda/attachment.html


More information about the Users mailing list