On Wed, May 13, 2009 at 04:23:24PM -0400, Stéphane Poirier wrote: > I am using the hosted version http://www.openlayers.org/api/OpenLayers.js, > is this 2.7 or 2.8? Is it possible to download the 2.8?
2.7. http://openlayers.org/download/OpenLayers-2.8-rc2.zip And, as described in : http://openlayers.org/pipermail/dev/2009-May/004807.html http://openlayers.org/api/2.8-rc2/OpenLayers.js > Thanks anyway for trying. > > Stephane > > > ----- Original Message ----- > From: "Christopher Schmidt" <[email protected]> > To: "Christopher Schmidt" <[email protected]> > Cc: "Stéphane Poirier" <[email protected]>; > <[email protected]> > Sent: Wednesday, May 13, 2009 15:32 > Subject: Re: [OpenLayers-Users] How to use layer.events.register() and > layer.events.on()? > > > On Wed, May 13, 2009 at 11:28:57AM -0400, Christopher Schmidt wrote: > > On Wed, May 13, 2009 at 11:13:38AM -0400, Stéphane Poirier wrote: > > > Hi All (and Tim), > > > > > > Catching events using predefined function hook works fine for me (case 2 > > > and 3), > > > but I do not have any success catching events using > > > layer.events.register (case > > > 4) nor layer.events.on (case 5). What do I do wrong? Should > > > layer.events.register and/or layer.events.on be used before the layer is > > > created? And what is the difference between these two? > > > > > > //1) create layer > > > rectangleLayer=new OpenLayers.Layer.Vector("Selection"); > > > > > > //2) works fine > > > rectangleLayer.preFeatureInsert=function(feature) > > > { > > > feature_tobeinserted(); > > > } > > > > > > //3) works fine > > > rectangleLayer.onFeatureInsert=function(feature) > > > { > > > feature_inserted(); > > > } > > > > > > //4) does not seem to catch event > > > rectangleLayer.events.register("sketchcomplete",rectangleLayer, > > > function(event){ var feature = event.feature; > > > return (feature.geometry.getArea() > 10); // false to not add > > > }); > > > > The order of arguments in this one is wrong: it should be > > ("sketchcomplete", function(){}). (The rectangleLayer is totally > > unneccesary in the given function.) > > Actually, my memory was playing tricks on me here. My statement is > wrong. > > Out of curiousity, are you using OpenLayers 2.8? sketchcomplete doesn't > exist in OpenLayers 2.7. > > > > //5) does not seem to catch event > > > rectangleLayer.events.on({ > > > sketchcomplete: function(event) { > > > var feature = event.feature; > > > return (feature.geometry.getArea() > 10); // false to not add > > > }}); > > > > > > Regards, > > > > > > > > > Stéphane Poirier > > > Professionel de recherche au CARTEL > > > Centre d'Applications et de Recherches en Télédétection > > > Département de géomatique appliquée > > > Université de Sherbrooke > > > Sherbrooke (Québec), CANADA J1K 2R1 > > > Tel.: (+1 819) 821 8000 #61904 > > > Fax.: (+1 819) 821 7944 > > > [email protected] > > > http://www.usherbrooke.ca/cartel > > > _______________________________________________ > > > Users mailing list > > > [email protected] > > > http://openlayers.org/mailman/listinfo/users > > > > -- > > Christopher Schmidt > > MetaCarta > > _______________________________________________ > > Users mailing list > > [email protected] > > http://openlayers.org/mailman/listinfo/users > > -- > Christopher Schmidt > MetaCarta > -- Christopher Schmidt MetaCarta _______________________________________________ Users mailing list [email protected] http://openlayers.org/mailman/listinfo/users
