/// <summary> /// If the waypoint is in format like 1030N, then return id. Otherwise, try /// to parse the waypoint id as a coordinate. If success, returns /// the coordinate in ... format (e.g. 4820N15054E). Otherwise, returns /// the id. /// </summary> public static string FormatWaypointId(this string id) { if (Format5Letter.Parse(id) != null) { return(id); } var c = Formatter.ParseLatLon(id); if (c == null) { return(id); } return(FormatDegMinNoSymbol.ToString(c)); }
public void ToFormatDegMinNoSymbolTest() { Assert.AreEqual("2100S13530E", FormatDegMinNoSymbol.ToString(new LatLon(-21, 135.5), 0)); Assert.AreEqual("2121.40S13521.19E", FormatDegMinNoSymbol.ToString(new LatLon(-21.3567, 135.3531), 2)); }