[OpenLayers-Dev] Constructor and functions of the same class

Vidal, Antoni antoni.vidal at icc.cat
Thu Dec 4 09:24:13 EST 2008


Forget it !

 

I got the answer. The context of "this" is Measure object.

 

The new question is: How can I access a function in EditingTolbar.js with a value of longitude var in new line

 

layer.events.register("beforefeaturemodified", controls[1], function(e){var longitude = this.getBestLength(e.feature.geometry)});

 

I would like to pass "longitude" to handleMeasurementsPartial: function(event) {...} 

 

In other words, how can I call the father (superclass) of Measure ? In this case is EditingToolbar.

 

Thank's again.

 

-----Mensaje original-----
De: Vidal, Antoni 
Enviado el: jueves, 04 de diciembre de 2008 13:48
Para: 'dev at openlayers.org'
Asunto: Constructor and functions of the same class

 

Hello,

 

I added the fllowing lines into the initialize function of the EditingToolbar class:

 

Controls[1] = new OpenLayers.Control.Measure(OpenLayers.Handler.Path, OpenLayers.Util.extend({displayClass: 'olControlDrawFeaturePath', title:_("Longitude")}, measureOptions));

 

layer.events.register("beforefeaturemodified", controls[1], function(e){this.mesurar(e.feature.geometry)});

 

 

and bellow the function:

 

          mesurar: function(g) {

              alert("works!");

          },

 

When I execute it, it generates the error: "this.mesurar is not a function"

 

Why the constructor don't understand mesurar as a function of his class?

 

Thank's a lot

 

Antoni Vidal

Institut Cartogràfic de Catalunya    Tel: +34-93 567 1500 Ext. 3228

Parc de Montjuïc                             Fax: +34-93 567 1567

08038 Barcelona                            http://www.icc.cat <http://www.icc.cat/> 

Spain

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-dev/attachments/20081204/45df8f94/attachment.html


More information about the Dev mailing list