Esempio n. 1
0
        public static PointF[] ToGdi(LineString lineString)
        {
            var result = new List <PointF>();

            foreach (var coordinate in lineString.Coordinates)
            {
                var position = (GeographicPosition)coordinate;
                result.Add(SphericalMercator.FromLonLat(position.Longitude, position.Latitude));
            }
            return(result.ToArray());
        }
        private static float[] ToOpenTK(LineString lineString)
        {
            const int dimensions = 2; // x and y are both in one array
            var       points     = new float[lineString.Coordinates.Count * dimensions];

            var counter = 0;

            foreach (var coordinate in lineString.Coordinates)
            {
                var position = (GeographicPosition)coordinate;
                var point    = SphericalMercator.FromLonLat(position.Longitude, position.Latitude);
                points[counter * 2 + 0] = point.X;
                points[counter * 2 + 1] = point.Y;
                counter++;
            }

            return(points);
        }