Beispiel #1
0
        /// <summary>
        /// Transforms a <see cref="SharpMap.Geometries.MultiPoint"/>.
        /// </summary>
        /// <param name="points">MultiPoint to transform</param>
        /// <param name="transform">MathTransform</param>
        /// <returns>Transformed MultiPoint</returns>
        public static MultiPoint TransformMultiPoint(MultiPoint points, IMathTransform transform)
        {
            MultiPoint pOut = new MultiPoint();

            pOut.Points = transform.TransformList(points.Points);
            return(pOut);
        }
	    /// <summary>
	    /// 
	    /// </summary>
	    /// <param name="ls"></param>
	    /// <param name="transform"></param>
	    /// <returns></returns>
	    private static ICoordinate[] ExtractCoordinates(IGeometry ls, IMathTransform transform)
	    {
	        List<double[]> points = new List<double[]>(ls.NumPoints);
	        foreach (ICoordinate c in ls.Coordinates)
	            points.Add(ToArray(c.X, c.Y));
	        points = transform.TransformList(points);
	        List<ICoordinate> coords = new List<ICoordinate>(points.Count);
	        foreach (double[] p in points)
	            coords.Add(new Coordinate(p[0], p[1]));
	        return coords.ToArray();
	    }
Beispiel #3
0
        /// <summary>
        /// Transforms a <see cref="MultiPoint"/>.
        /// </summary>
        /// <param name="points">MultiPoint to transform</param>
        /// <param name="transform">MathTransform</param>
        /// <returns>Transformed MultiPoint</returns>
        public static MultiPoint TransformMultiPoint(MultiPoint points, IMathTransform transform)
        {
            List <Point> pointList = new List <Point>(points.Geometries.Length);

            foreach (Point p in points.Geometries)
            {
                pointList.Add(p);
            }
            pointList = transform.TransformList(pointList);
            return(new MultiPoint(pointList.ToArray()));
        }
Beispiel #4
0
        /// <summary>
        /// Transforms a <see cref="SharpMap.Geometries.MultiPoint"/>.
        /// </summary>
        /// <param name="points">MultiPoint to transform</param>
        /// <param name="transform">MathTransform</param>
        /// <returns>Transformed MultiPoint</returns>
        public static MultiPoint TransformMultiPoint(MultiPoint points, IMathTransform transform)
        {
            List <double[]> pts = new List <double[]>();

            for (int i = 0; i < points.NumGeometries; i++)
            {
                pts.Add(new double[2] {
                    points[0].X, points[1].Y
                });
            }

            return(new MultiPoint(transform.TransformList(pts)));
        }
Beispiel #5
0
        /// <summary>
        /// Transforms coordinates of the multipoint.
        /// </summary>
        /// <param name="multiPoint">Multipoint to transform</param>
        /// <param name="transform">The transformation to apply</param>
        /// <returns>The transformed multipoint</returns>
        public static MultiPoint TransformMultiPoint(MultiPoint multiPoint, IMathTransform transform)
        {
            List <double[]> points = new List <double[]>();

            for (int i = 0; i < multiPoint.Points.Count; i++)
            {
                points.Add(new double[2] {
                    multiPoint.Points[i].X, multiPoint.Points[i].Y
                });
            }

            return(new MultiPoint(transform.TransformList(points)));
        }
Beispiel #6
0
        /// <summary>
        /// Transforms coordinates of the contour.
        /// </summary>
        /// <param name="contour">Contour to transform</param>
        /// <param name="transform">The transformation to apply</param>
        /// <returns>The transformed contour</returns>
        public static Contour TransformContour(Contour contour, IMathTransform transform)
        {
            List <double[]> points = new List <double[]>();

            for (int i = 0; i < contour.Vertices.Count; i++)
            {
                points.Add(new double[2] {
                    contour.Vertices[i].X, contour.Vertices[i].Y
                });
            }

            return(new Contour(transform.TransformList(points)));
        }
Beispiel #7
0
        /// <summary>
        /// Transforms coordinates of the line path.
        /// </summary>
        /// <param name="linePath">Line path to transform</param>
        /// <param name="transform">The transformation to apply</param>
        /// <returns>The transformed line path</returns>
        public static LinePath TransformLinePath(LinePath linePath, IMathTransform transform)
        {
            List <double[]> points = new List <double[]>();

            for (int i = 0; i < linePath.Vertices.Count; i++)
            {
                points.Add(new double[2] {
                    linePath.Vertices[i].X, linePath.Vertices[i].Y
                });
            }

            return(new LinePath(transform.TransformList(points)));
        }
Beispiel #8
0
        /// <summary>
        /// Transforms a <see cref="MultiPoint"/>.
        /// </summary>
        /// <param name="points">MultiPoint to transform</param>
        /// <param name="transform">MathTransform</param>
        /// <returns>Transformed MultiPoint</returns>
        public static IMultiPoint TransformMultiPoint(IMultiPoint points, IMathTransform transform)
        {
            List <double[]> pointList = new List <double[]>(points.Geometries.Length);

            foreach (IPoint p in points.Geometries)
            {
                pointList.Add(ToLightStruct(p.X, p.Y));
            }
            pointList = transform.TransformList(pointList);
            IPoint[] array = new IPoint[pointList.Count];
            for (int i = 0; i < pointList.Count; i++)
            {
                array[i] = ToNTS(pointList[i][0], pointList[i][1]);
            }
            return(new MultiPoint(array));
        }
Beispiel #9
0
        /// <summary>
        /// Transforms a <see cref="SharpMap.Geometries.LinearRing"/>.
        /// </summary>
        /// <param name="r">LinearRing to transform</param>
        /// <param name="transform">MathTransform</param>
        /// <returns>Transformed LinearRing</returns>
        public static LinearRing TransformLinearRing(LinearRing r, IMathTransform transform)
        {
            try
            {
                List <double[]> points = new List <double[]>();

                for (int i = 0; i < r.Vertices.Count; i++)
                {
                    points.Add(new double[2] {
                        r.Vertices[i].X, r.Vertices[i].Y
                    });
                }

                return(new LinearRing(transform.TransformList(points)));
            }
            catch { return(null); }
        }
Beispiel #10
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="ls"></param>
        /// <param name="transform"></param>
        /// <returns></returns>
        private static ICoordinate[] ExtractCoordinates(IGeometry ls, IMathTransform transform)
        {
            List <double[]> points = new List <double[]>(ls.NumPoints);

            foreach (ICoordinate c in ls.Coordinates)
            {
                points.Add(ToArray(c.X, c.Y));
            }
            points = transform.TransformList(points);
            List <ICoordinate> coords = new List <ICoordinate>(points.Count);

            foreach (double[] p in points)
            {
                coords.Add(new Coordinate(p[0], p[1]));
            }
            return(coords.ToArray());
        }
Beispiel #11
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="ls"></param>
        /// <param name="transform"></param>
        /// <returns></returns>
        private static List <ICoordinate> ExtractCoordinates(LineString ls, IMathTransform transform)
        {
            List <Point> points = new List <Point>(ls.Count);

            foreach (ICoordinate c in ls.Coordinates)
            {
                points.Add(new Point(c));
            }
            points = transform.TransformList(points);
            List <ICoordinate> coords = new List <ICoordinate>(points.Count);

            foreach (Point p in points)
            {
                coords.Add(p.Coordinate);
            }
            return(coords);
        }
Beispiel #12
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="ls"></param>
        /// <param name="transform"></param>
        /// <returns></returns>
        private static List <Coordinate> ExtractCoordinates(ILineString ls, IMathTransform transform)
        {
            IList <double[]> points =
                new List <double[]>(ls.NumPoints);

            foreach (Coordinate c in ls.Coordinates)
            {
                points.Add(ToArray(c.X, c.Y));
            }
            points = transform.TransformList(points);
            List <Coordinate> coords = new List <Coordinate>(points.Count);

            foreach (double[] p in points)
            {
                coords.Add(GeometryFactoryEx.CreateCoordinate(p[0], p[1]));
            }
            return(coords);
        }
Beispiel #13
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="ls"></param>
        /// <param name="transform"></param>
        /// <returns></returns>
        private static List <ICoordinate> ExtractCoordinates(ILineString ls, IMathTransform transform)
        {
            List <double[]> points =
                new List <double[]>(ls.NumPoints);

            foreach (ICoordinate c in ls.Coordinates)
            {
                points.Add(ToLightStruct(c.X, c.Y));
            }
            points = transform.TransformList(points);
            List <ICoordinate> coords = new List <ICoordinate>(points.Count);

            foreach (double[] p in points)
            {
                coords.Add(new Coordinate(p[0], p[1]));
            }
            return(coords);
        }
Beispiel #14
0
		/// <summary>
		/// Transforms a <see cref="MultiPoint" /> object.
		/// </summary>
		/// <param name="points"></param>
		/// <param name="transform"></param>
		/// <returns></returns>
		public static IMultiPoint TransformMultiPoint(IMultiPoint points, IMathTransform transform)
		{
            List<double[]> pointList = new List<double[]>(points.Geometries.Length);
			foreach (IPoint p in points.Geometries)
                pointList.Add(ToArray(p.X, p.Y));
			pointList = transform.TransformList(pointList);
			IPoint[] array = new IPoint[pointList.Count];
            for (int i = 0; i < pointList.Count; i++)
                array[i] = ToNTS(pointList[i][0], pointList[i][1]);
			return new MultiPoint(array);
		}
Beispiel #15
0
        /// <summary>
        /// Transforms coordinates of the contour.
        /// </summary>
        /// <param name="contour">Contour to transform</param>
        /// <param name="transform">The transformation to apply</param>
        /// <returns>The transformed contour</returns>
        public static Contour TransformContour(Contour contour, IMathTransform transform)
        {
            List<double[]> points = new List<double[]>();

            for (int i = 0; i < contour.Vertices.Count; i++)
                points.Add(new double[2] { contour.Vertices[i].X, contour.Vertices[i].Y });

            return new Contour(transform.TransformList(points));
        }
Beispiel #16
0
 /// <summary>
 /// Transforms a <see cref="SharpMap.Geometries.MultiPoint"/>.
 /// </summary>
 /// <param name="points">MultiPoint to transform</param>
 /// <param name="transform">MathTransform</param>
 /// <returns>Transformed MultiPoint</returns>
 public static MultiPoint TransformMultiPoint(MultiPoint points, IMathTransform transform)
 {
     MultiPoint pOut = new MultiPoint();
     pOut.Points = transform.TransformList(points.Points);
     return pOut;
 }
Beispiel #17
0
        /// <summary>
        /// Transforms coordinates of the line path.
        /// </summary>
        /// <param name="linePath">Line path to transform</param>
        /// <param name="transform">The transformation to apply</param>
        /// <returns>The transformed line path</returns>
        public static LinePath TransformLinePath(LinePath linePath, IMathTransform transform)
        {
            List<double[]> points = new List<double[]>();

            for (int i = 0; i < linePath.Vertices.Count; i++)
                points.Add(new double[2] { linePath.Vertices[i].X, linePath.Vertices[i].Y });

            return new LinePath(transform.TransformList(points));
        }
Beispiel #18
0
        /// <summary>
        /// Transforms a <see cref="SharpMap.Geometries.MultiPoint"/>.
        /// </summary>
        /// <param name="points">MultiPoint to transform</param>
        /// <param name="transform">MathTransform</param>
        /// <returns>Transformed MultiPoint</returns>
        public static MultiPoint TransformMultiPoint(MultiPoint points, IMathTransform transform)
        {
            List<double[]> pts = new List<double[]>();
            for (int i = 0; i < points.NumGeometries; i++)
                pts.Add(new double[2] {points[i].X, points[i].Y});

            return new MultiPoint(transform.TransformList(pts));
        }
Beispiel #19
0
        /// <summary>
        /// Transforms a <see cref="SharpMap.Geometries.LinearRing"/>.
        /// </summary>
        /// <param name="r">LinearRing to transform</param>
        /// <param name="transform">MathTransform</param>
        /// <returns>Transformed LinearRing</returns>
        public static LinearRing TransformLinearRing(LinearRing r, IMathTransform transform)
        {
            try
            {
                List<double[]> points = new List<double[]>();

                for (int i = 0; i < r.Vertices.Count; i++)
                    points.Add(new double[2] {r.Vertices[i].X, r.Vertices[i].Y});

                return new LinearRing(transform.TransformList(points));
            }
            catch
            {
                return null;
            }
        }
Beispiel #20
0
 /// <summary>
 /// Transforms a <see cref="SharpMap.Geometries.LinearRing"/>.
 /// </summary>
 /// <param name="r">LinearRing to transform</param>
 /// <param name="transform">MathTransform</param>
 /// <returns>Transformed LinearRing</returns>
 public static LinearRing TransformLinearRing(LinearRing r, IMathTransform transform)
 {
     try { return(new LinearRing(transform.TransformList(r.Vertices))); }
     catch { return(null); }
 }
Beispiel #21
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="ls"></param>
 /// <param name="transform"></param>
 /// <returns></returns>
 private static List<ICoordinate> ExtractCoordinates(ILineString ls, IMathTransform transform)
 {
     List<double[]> points =
         new List<double[]>(ls.NumPoints);
     foreach (ICoordinate c in ls.Coordinates)
         points.Add(ToLightStruct(c.X, c.Y));
     points = transform.TransformList(points);
     List<ICoordinate> coords = new List<ICoordinate>(points.Count);
     foreach (double[] p in points)
         coords.Add(GeometryFactory.CreateCoordinate(p[0], p[1]));
     return coords;
 }
		/// <summary>
		/// Transforms a <see cref="SharpMap.Geometries.LinearRing"/>.
		/// </summary>
		/// <param name="r">LinearRing to transform</param>
		/// <param name="transform">MathTransform</param>
		/// <returns>Transformed LinearRing</returns>
		public static LinearRing TransformLinearRing(LinearRing r, IMathTransform transform)
		{
			try { return new LinearRing(transform.TransformList(r.Vertices)); }
			catch { return null; }
		}
		/// <summary>
		/// Transforms a <see cref="SharpMap.Geometries.LineString"/>.
		/// </summary>
		/// <param name="l">LineString to transform</param>
		/// <param name="transform">MathTransform</param>
		/// <returns>Transformed LineString</returns>
		public static LineString TransformLineString(LineString l, IMathTransform transform)
		{
			try { return new LineString(transform.TransformList(l.Vertices)); }
			catch { return null; }
		}
Beispiel #24
0
        /// <summary>
        /// Transforms coordinates of the multipoint.
        /// </summary>
        /// <param name="multiPoint">Multipoint to transform</param>
        /// <param name="transform">The transformation to apply</param>
        /// <returns>The transformed multipoint</returns>
        public static MultiPoint TransformMultiPoint(MultiPoint multiPoint, IMathTransform transform)
        {
            List<double[]> points = new List<double[]>();

            for (int i = 0; i < multiPoint.Points.Count; i++)
                points.Add(new double[2] { multiPoint.Points[i].X, multiPoint.Points[i].Y });

            return new MultiPoint(transform.TransformList(points));
        }