public TopoTrailInfo(GpxFileData data) { Name = data.Name; Description = data.Description; Keywords = data.Keywords; UrlText = data.UrlText; UrlLink = data.UrlLink; Timezone = GeoTimezoneInfo.Find(data.Extensions.Timezone); if (Timezone == null) { Timezone = GeoTimezoneInfo.UTC; } Country = GeoCountryInfo.Find(data.Extensions.Country); Region = GeoRegionInfo.Find(data.Extensions.Region); Location = data.Extensions.Location; foreach (var track in data.Tracks) { var t = new TopoTrackInfo(this, track); _tracks.Add(t); } }
private void Load(string uri) { try { var reader = new GpxFileReader(uri); _data = reader.ReadFile(); } catch (Exception ex) { Error = ex; } }
/// <summary> /// Reads the file header data /// </summary> public GpxFileData ReadHeader() { var data = new GpxFileData(); // built in attributes Creator = TypeConvert.ToString(_xml.DocumentElement.Attributes["creator"].InnerText); Version = TypeConvert.ToDecimal(_xml.DocumentElement.Attributes["version"].InnerText); // common top elements data.Name = ReadString(GetMetaDataNode(), "name"); data.Description = ReadString(GetMetaDataNode(), "desc"); data.Timestamp = ReadDateTime(GetMetaDataNode(), "time"); // optional top elements data.UrlLink = ReadString(GetMetaDataNode(), "url"); data.UrlText = ReadString(GetMetaDataNode(), "urlname"); data.Keywords = ReadString(GetMetaDataNode(), "keywords"); // TODO: support other optional elements return(data); }