[OpenLayers-Users] How to override createGeometry
Stéphane Poirier
Stephane.Poirier at USherbrooke.CA
Tue May 12 16:13:12 EDT 2009
Hi All,
In order to prevent creating rectangle that are too small, I would like to
override createGeometry (that is, in my code, the function
OpenLayers.Handler.RegularPolygon.prototype.createGeometry.apply(this,
arguments);)
How can I do this?
Here is my code:
drawControls =
{
point: new OpenLayers.Control.DrawFeature(rectangleLayer,
OpenLayers.Handler.Point, {featureAdded: point_feature_added,
handlerOptions: {createFeature: function() {
this.control.layer.destroyFeatures();
OpenLayers.Handler.Point.prototype.createFeature.apply(this, arguments);
}}}),
rectangle: new OpenLayers.Control.DrawFeature(rectangleLayer,
OpenLayers.Handler.RegularPolygon, {featureAdded:
rectangle_feature_added,
handlerOptions: {sides: 4, irregular: true,'displayClass':
'olControlDrawFeatureRectangle',
createGeometry: function() {
this.control.layer.destroyFeatures();
OpenLayers.Handler.RegularPolygon.prototype.createGeometry.apply(this,
arguments);
}}})
}
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
Stephane.Poirier at USherbrooke.ca
http://www.usherbrooke.ca/cartel
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
Stephane.Poirier at USherbrooke.ca
http://www.usherbrooke.ca/cartel
More information about the Users
mailing list