/// <exception cref="ArgumentException"></exception>
        public static Route ToRoute(this IEnumerable <ICoordinate> coordinates)
        {
            var items = coordinates.ToList();

            if (items.Count < 2)
            {
                throw new ArgumentException();
            }

            var result = new Route();

            foreach (var i in items)
            {
                double lat = i.Lat;
                double lon = i.Lon;

                string latLonTxt =
                    Format5Letter.To5LetterFormat(lat, lon) ??
                    FormatDecimal.ToDecimalFormat(lat, lon);

                var wpt = new Waypoint(latLonTxt, lat, lon);
                result.AddLastWaypoint(wpt, "DCT");
            }

            return(result);
        }
Exemplo n.º 2
0
 private static void AddLatLons(WaypointList wptList)
 {
     for (int lon = -180; lon <= 180; lon++)
     {
         for (int lat = -90; lat <= 90; lat++)
         {
             wptList.AddWaypoint(
                 new Waypoint(Format5Letter.To5LetterFormat(lat, lon), lat, lon));
         }
     }
 }
Exemplo n.º 3
0
        public static string AutoChooseFormat(this LatLon item)
        {
            string result = Format5Letter.To5LetterFormat(item.Lat, item.Lon);

            return(result ?? FormatDecimal.ToDecimalFormat(item.Lat, item.Lon));
        }