[OpenLayers-Users] possible "click" events conflict?

Martin Ouellet geomartino at gmail.com
Mon Nov 24 15:54:56 EST 2008


Hi all,

I'am just working on my first app with OpenLayers in a editing context (wow
it's fun) .

Here's my problem:
1) I have a WMS layer of point, The user push a button to start editing (ex:
move a point).  That button register the "click" event and then he click on
the map to identify a point in the WMS layer.  In the background, I launch a
GetFeatureInfo with the X,Y;

map.events.register('click', map, onMapClick);

2) if the GetFeatureInfo find out a element at this location, I activate two
editing tools (DrawFeature et ModifyFeature) and I draw a vector point.  The
user can then click anyone else on the map (I only keep the last point he
click) or move the point.

controls = {
  modify: new OpenLayers.Control.ModifyFeature(vector),
    point: new OpenLayers.Control.DrawFeature(vector,
OpenLayers.Handler.Point)
}

function activetool() {
  for(key in controls) {
    control.activate();
  }
}

3)  When the user as finish, the ACCEPT button update the database with the
new position of the vector point and I unregister the click event.  I also
deactivate the two editing tools (DrawFeature et ModifyFeature).

map.events.unregister('click', this, onMapClick);

function deactivate() {
  for(key in controls) {
    control.deactivate();
  }
}

Everything works great but after that, I can no longer reactivate the
editing tool.  Is it possible that when I unregister the click event for the
GetFeatureInfo, the 'click' event required for the drawfeature tool is also
deactivate?

thank you in advance!

MartinO
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20081124/b5885522/attachment.html


More information about the Users mailing list