Point.prototype= new Extra_Graphics();
Point.prototype.constructor= Point;
// x and y espressed in geographical coordinates
function Point(x,y)
{
    if (_COORDINATES_PRECISION != 0)
    {
        this._x=parseFloat(new Number(x).toFixed(_COORDINATES_PRECISION));
        this._y=parseFloat(new Number(y).toFixed(_COORDINATES_PRECISION));
    } else {
        this._x=parseFloat(new Number(x));
        this._y=parseFloat(new Number(y));
    }
    this._w=10;
    this._h=10;
    this._filled=false;
	
}
Point.prototype.draw=function()
{
    try{
        var pxl = _MAP_WRAPPER.convert_to_pixel(this._x,this._y,true);
        _jg.setStroke(this.get_stroke());
        _jg.setColor(this.get_color());
        _jg.setPrintable(this._printable);
        if(this._filled)
            _jg.fillEllipse(pxl[0]-this._w*0.5,pxl[1]-this._h*0.5,this._w,this._h);
        else
            _jg.drawEllipse(pxl[0]-this._w*0.5,pxl[1]-this._h*0.5,this._w,this._h);
		
    }catch(e)
    {
        alert("Point.draw(): "+e);
        return false;
    }
};
Point.prototype.snap_point=function(x,y) 
{
    //take the first line the first point, first is the start point
    var res = false;
    var geo_min= new Array(this._x-0.5*_SNAP_TOLERANCE,this._y-0.5*_SNAP_TOLERANCE);
    var geo_max = new Array(this._x+0.5*_SNAP_TOLERANCE,this._y+0.5*_SNAP_TOLERANCE);
    if( (x > geo_min[0] ) && (x < geo_max[0] ) 
        && (y > geo_min[1] ) && (y < geo_max[1] ) )
    {
        res = new Array(this._x,this._x);
        return res;
    }
    return false;
};

Point.prototype.distance=function(point) 
{
    return Math.sqrt( Math.pow(this._x-point._x,2)+Math.pow(this._y-point._y,2) );
};
Point.prototype.clone=function() 
{
    return new Point(this._x,this._y);
};
Point.prototype.equals=function(point) 
{
    return ( (this._x==point._x) && (this._y ==point._y) );
};