[OpenLayers-Users] How can I catch an OL event inside a custom tool

David Alda Fernandez de Lezea dalda at ikt.es
Mon Mar 21 03:24:08 EDT 2011


Eric,

Thanks for your response. I've done something like this:

initialize: function(layer, options) {
        
...
	this.EVENT_TYPES.push("featureselected"); 
...

this.events.on({
	featureselected: function(evt) {
		var myEvt = evt;	
	}
});

}

But I can't get inside this method (I'm debugging with firebug). Is this the way you meant??

Thanks.
 
Un saludo,
 
··················································································

David Alda Fernández de Lezea
Lurralde eta Biodibertsitate Saila / Dpto. de Territorio y Biodiversidad
 
IKT
Granja Modelo s/n · 01192 · Arkaute (Araba)

··················································································
Tlfnos.: 945-00-32-95                         Fax: 945-00.32.90
··················································································
email: dalda at ikt.es                                web: www.ikt.es
··················································································

-----Mensaje original-----
De: Eric Lemoine [mailto:eric.lemoine at camptocamp.com] 
Enviado el: viernes, 18 de marzo de 2011 14:32
Para: David Alda Fernandez de Lezea
CC: users at openlayers.org
Asunto: Re: [OpenLayers-Users] How can I catch an OL event inside a custom tool

On Friday, March 18, 2011, David Alda Fernandez de Lezea <dalda at ikt.es> wrote:
> Hi list,
>
> I've developed a custom tool that makes some geometric operations using a selected feature, and I want this tool to be active only when there is 1 feature selected in the layer. If the selection is empty the tool must deactitvated. How can I catch that event (featureselected) from my tool?? Any ideas?

Your tool must have a reference to the vector layer and register to the "featureselected" events.

--
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