/* Create by Mika on 19/18/2008
**Extension de la class OpenLayers.Handler.RegularPolygon
** afin de surdefinir la methode down 
*/
OpenLayers.Handler.RegularPolygonUx = OpenLayers.Class(OpenLayers.Handler.RegularPolygon, {
    fStyles: [],
    initialize: function(control, callbacks, options) {
        OpenLayers.Handler.RegularPolygon.prototype.initialize.apply(this,arguments);
    },
    /**
     * Method: downFeature
     * Start drawing a new feature
     *
     * Parameters:
     * evt - {Event} The drag start event
     */
    down: function(evt) {
        this.fixedRadius = !!(this.radius);
        var maploc = this.map.getLonLatFromPixel(evt.xy);
        this.origin = new OpenLayers.Geometry.Point(maploc.lon, maploc.lat);
        if(!this.fixedRadius || this.irregular) {
          // smallest radius should not be less one pixel in map units
            // VML doesn't behave well with smaller
            this.radius = this.map.getResolution();
        }
        if(this.persist) {
            this.clear();
        }
        this.feature = null;
        this.feature = new OpenLayers.Feature.Vector();
        //this.style = OpenLayers.Util.extend({}, OpenLayers.Feature.Vector.style['default']);
        //this.feature.style = OpenLayers.Util.extend({}, OpenLayers.Feature.Vector.style['default']);
        this.createGeometry();
        this.layer.addFeatures([this.feature], {silent: true});
        this.layer.drawFeature(this.feature, this.style);
    },
    CLASS_NAME: "OpenLayers.Handler.RegularPolygonUx"
});
