Exemplo n.º 1
0
 public static void WriteGpxFile(string filePath, GpxDocument doc)
 {
     using (GpxWriter gw = new GpxWriter(filePath))
     {
         gw.WriteStartDocument();
         gw.WriteStartGpx();
         gw.WriteGpxDocument(doc);
         gw.WriteEndGpx();
         gw.WriteEndDocument();
     }
 }
Exemplo n.º 2
0
        public void WriteGpxDocument(GpxDocument doc)
        {
            if (_open && doc != null)
            {
                if (doc.Metadata != null)
                {
                    WriteMetadata(doc.Metadata);
                }

                if (doc.Waypoints != null && doc.Waypoints.Count > 0)
                {
                    foreach (Point point in doc.Waypoints)
                    {
                        WritePoint(point, PointType.WayPoint);
                    }
                }

                if (doc.Routes != null && doc.Routes.Count > 0)
                {
                    foreach (Route route in doc.Routes)
                    {
                        WriteRoute(route);
                    }
                }

                if (doc.Tracks != null && doc.Tracks.Count > 0)
                {
                    foreach (Track track in doc.Tracks)
                    {
                        WriteTrack(track);
                    }
                }

                if (doc.Extensions != null)
                {
                    WriteExtensions(doc.Extensions);
                }
            }
        }