private static void LoadGpxTrackInfoProperties(GpxTrack info, IEnumerable <XmlNode> nodes) { foreach (var node in nodes) { switch (node.Name) { case "name": info.Name = node.InnerText; break; case "desc": info.Description = node.InnerText; break; case "trkseg": foreach (XmlNode ptNode in node.ChildNodes) { GpxPoint point = new GpxPoint(ptNode); //GpxTrackPoint.LoadGpxTrackPointInfoProperties(point, ptNode); info.Points.Add(point); } break; default: info.OtherProperties.Add(node.Name, node.InnerText); break; } } }
protected override Geo CopyInternal() { GpxPoint p = new GpxPoint() { X = X, Y = Y, Z = Z, Time = Time, Speed = Speed, }; foreach (var o in OtherProperties) { p.OtherProperties.Add(o.Key, o.Value); } return(p); }
public TimeSpan GetMovingTime(double speedDevaluation = 0.3) { double totalDistance = 0; double totalSeconds = 0; GpxPoint last = null; foreach (var point in Points.TimeOrderedPoints) { if (last != null) { double distance = Calculate.Distance(last, point); double second = (point.Time - last.Time).TotalSeconds; double speed = distance / second; if (speed > speedDevaluation) { totalDistance += distance; totalSeconds += second; } } last = point; } return(TimeSpan.FromSeconds(totalSeconds)); }