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]);
} 
_______________________________________________
Users mailing list
[email protected]
http://openlayers.org/mailman/listinfo/users

Reply via email to