1
Vote

Math Transform returns more than 2 point???

description

See:
 
http://sharpmap.codeplex.com/Thread/View.aspx?ThreadId=210317
 
/// <summary>
    /// Create a new point by a douuble[] array
    /// </summary>
    /// <param name="point"></param>
    public Point(double[] point)
    {
        if (point.Length §!= 2)
            throw new Exception("Only 2 dimensions are supported for points");
 
        _X = point[0];
        _Y = point[1];
    }
This is the "point" constructor with a double array point.... ok it is perfect...
 
BUT.. here...
 
/// <summary>
    /// Transforms a <see cref="SharpMap.Geometries.BoundingBox"/>.
    /// </summary>
    /// <param name="box">BoundingBox to transform</param>
    /// <param name="transform">Math Transform</param>
    /// <returns>Transformed object</returns>
    public static BoundingBox TransformBox(BoundingBox box, IMathTransform transform)
    {
        if (box == null)
            return null;
        Point[] corners = new Point[4];
        corners[0] = new Point(transform.Transform(box.Min.ToDoubleArray())); //LL
        corners[1] = new Point(transform.Transform(box.Max.ToDoubleArray())); //UR
        corners[2] = new Point(transform.Transform(new Point(box.Min.X, box.Max.Y).ToDoubleArray())); //UL
        corners[3] = new Point(transform.Transform(new Point(box.Max.X, box.Min.Y).ToDoubleArray())); //LR
 
        BoundingBox result = corners[0].GetBoundingBox();
        for (int i = 1; i < 4; i++)
            result = result.Join(corners[i].GetBoundingBox());
        return result;
    }
When you use a Coordinate Projection... some times it returns back more than 2 points... this is a bug. of projnet????
 

 
    /// <summary>
    /// Transforms a point
    /// </summary>
    /// <param name="point"></param>
    /// <returns></returns>
    public override double[] Transform(double[] point)
    {
        foreach (ICoordinateTransformation ct in _CoordinateTransformationList)
            point = ct.MathTransform.Transform(point);
        return point;
    }
 
Ciao
 
Alberto

comments