internal void Save(IEnumerable <wptType> waypoints, string fileName = null) { var gpxFile = new GPXFile(); var gpx = new gpxType(); var rte = new rteType(); rte.name = Title.Trim(); rte.rtept = ToRoute().Points.ToArray(); gpx.rte = new List <rteType>() { rte }.ToArray(); gpx.wpt = waypoints.ToArray(); var fileNameToSave = string.IsNullOrEmpty(fileName) ? FileName : fileName; gpxFile.Save(fileNameToSave, gpx); IsInEditMode = false; }
private void SaveSplitRoute(BikeTouringGISLayer obj) { var baseDirectory = Path.GetDirectoryName(obj.FileName); int i = 1; foreach (var splitRoute in obj.SplitRoutes) { var filename = string.Format(@"{0}\{1}_{2}.gpx", baseDirectory, obj.SplitPrefix, i); var gpxFile = new GPXFile(); var gpx = new gpxType(); var rte = new rteType(); rte.name = $"{i}_{obj.SplitPrefix}"; rte.rtept = splitRoute.Points.ToArray(); gpx.rte = new List <rteType>() { rte }.ToArray(); gpxFile.Save(filename, gpx); i++; } }