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

David Alda Fernandez de Lezea dalda at ikt.es
Mon Mar 21 05:42:44 EDT 2011


Eric, 

Thanks. That piece of code worked for me.
 
Regards,

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: lunes, 21 de marzo de 2011 9:30
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 Mon, Mar 21, 2011 at 8:24 AM, David Alda Fernandez de Lezea <dalda at ikt.es> wrote:
> Eric,
>
> Thanks for your response. I've done something like this:
>
> initialize: function(layer, options) {
>
> ...
>        this.EVENT_TYPES.push("featureselected");

Remove this.


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

Do this instead:

layer.events.on({
    featureselected: function(evt) {
        var feature = evt.feature;
    }
});



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