[OpenLayers-Users] rounding-off coordinate of feature geometry at
creation
stephane.poirier at usherbrooke.ca
stephane.poirier at usherbrooke.ca
Thu Jan 22 11:59:16 EST 2009
Hi All,
I use the following code for handling point and rectangle creation. It works fine. Now, how can one round-off coordinates of the feature geometry before it is created (for point and rectangle)? And also, how can one restrict the drawing of a rectangle
to discreet sizes?
Stephane
P.S.: considering the standard point and rectangle handler 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);}}})
};
for(var key in drawControls)
{
map.addControl(drawControls[key]);
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20090122/2982b2ee/attachment.html
More information about the Users
mailing list