- Timestamp:
- 07/20/12 22:57:05 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/RoutePlanning/HeuristicLab.Problems.RoutePlanning.Test/Program.cs
r8314 r8315 1 1 2 2 using System; 3 using System.Xml; 3 4 using HeuristicLab.Algorithms.GraphRouting; 5 using HeuristicLab.Problems.RoutePlanning.Graph; 6 using HeuristicLab.Problems.RoutePlanning.Osm; 4 7 using HeuristicLab.Problems.RoutePlanning.Osm.Data; 5 8 namespace HeuristicLab.Problems.RoutePlanning.Test { … … 26 29 foreach (long i in result) System.Console.Write(i + "; "); 27 30 Console.WriteLine(); 31 32 WriteGPXFile(graph, result); 33 28 34 System.Console.Read(); 29 35 } … … 52 58 System.Console.Read(); 53 59 } 60 61 private static void WriteGPXFile(Graph.Graph graph, long[] route) { 62 XmlWriterSettings settings = new XmlWriterSettings(); 63 settings.Indent = true; 64 settings.IndentChars = (" "); 65 66 using (XmlWriter writer = XmlWriter.Create("RoutePath.gpx", settings)) { 67 writer.WriteStartElement("gpx", "http://www.topografix.com/GPX/1/0"); 68 writer.WriteAttributeString("version", "1.1"); 69 writer.WriteAttributeString("creator", "cloudia"); 70 71 foreach (long nodeId in route) { 72 Vertex<Node> node = graph.GetVertex(nodeId); 73 writer.WriteStartElement("wpt"); 74 writer.WriteAttributeString("lat", XmlConvert.ToString(node.Node.Latitude)); 75 writer.WriteAttributeString("lon", XmlConvert.ToString(node.Node.Longitude)); 76 writer.WriteEndElement(); // wpt 77 } 78 79 //writer.WriteStartElement("rte"); 80 //foreach (long nodeId in route) { 81 // Vertex<Node> node = graph.GetVertex(nodeId); 82 // writer.WriteStartElement("rtept"); 83 // writer.WriteAttributeString("lat", XmlConvert.ToString(node.Node.Latitude)); 84 // writer.WriteAttributeString("lon", XmlConvert.ToString(node.Node.Longitude)); 85 // writer.WriteEndElement(); // rtept 86 //} 87 //writer.WriteEndElement(); // rte 88 89 //writer.WriteStartElement("trk"); 90 //writer.WriteElementString("name", "RoutePath"); 91 ////writer.WriteEndElement(); // name 92 //writer.WriteStartElement("trkseq"); 93 //foreach (long nodeId in route) { 94 // Vertex<Node> node = graph.GetVertex(nodeId); 95 // writer.WriteStartElement("trkpt"); 96 // writer.WriteAttributeString("lat", XmlConvert.ToString(node.Node.Latitude)); 97 // writer.WriteAttributeString("lon", XmlConvert.ToString(node.Node.Longitude)); 98 // writer.WriteEndElement(); // trkpt 99 //} 100 //writer.WriteEndElement(); // trkseq 101 //writer.WriteEndElement(); // trk 102 103 writer.WriteEndElement(); // gpx 104 } 105 } 54 106 } 55 107 }
Note: See TracChangeset
for help on using the changeset viewer.