Ejemplo n.º 1
0
 private static void WriteNodes(InvariantWriter sw, IEnumerable <TaxiNode> nodes)
 {
     foreach (TaxiNode node in nodes)
     {
         sw.WriteLine($"  <Placemark><styleUrl>#TaxiNode</styleUrl><name>{node.Id}</name><Point><coordinates>{node.Longitude * VortexMath.Rad2Deg},{node.Latitude * VortexMath.Rad2Deg},0</coordinates></Point></Placemark>");
     }
 }
Ejemplo n.º 2
0
 public static void Write(Airport airport)
 {
     using (InvariantWriter sw = new InvariantWriter(Path.Combine(Settings.DataFolder, airport.ICAO + ".kml"), Encoding.UTF8))
     {
         sw.WriteLine("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
         sw.WriteLine("<kml xmlns=\"http://www.opengis.net/kml/2.2\">");
         sw.WriteLine(" <Document>");
         sw.WriteLine("  <Style id=\"Runway\"><LineStyle><color>ff0000ff</color><width>3</width><gx:labelVisibility>0</gx:labelVisibility></LineStyle></Style>");
         sw.WriteLine("  <Style id=\"RunwayIcon\"><IconStyle><Icon><href>http://maps.google.com/mapfiles/kml/pal2/icon48.png</href></Icon></IconStyle></Style>");
         sw.WriteLine("  <Style id=\"NearestRunway\"><IconStyle><Icon><href>http://maps.google.com/mapfiles/kml/paddle/red-diamond-lv.png</href></Icon></IconStyle></Style>");
         sw.WriteLine("  <Style id=\"TaxiNode\"><IconStyle><Icon><href>http://maps.google.com/mapfiles/kml/pal4/icon57.png</href></Icon></IconStyle></Style>");
         WriteNodes(sw, airport.TaxiNodes);
         WriteRunways(sw, airport.Runways);
         sw.WriteLine(" </Document>");
         sw.WriteLine("</kml>");
     }
 }
Ejemplo n.º 3
0
        private static void WriteRunways(InvariantWriter sw, IEnumerable <Runway> runways)
        {
            foreach (Runway runway in runways)
            {
                if (runway.RunwayNodes == null)
                {
                    continue;
                }

                sw.WriteLine($"  <Placemark><styleUrl>#RunwayIcon</styleUrl><name>{runway.Designator}</name><Point><coordinates>{runway.DisplacedLongitude * VortexMath.Rad2Deg},{runway.DisplacedLatitude * VortexMath.Rad2Deg},0</coordinates></Point></Placemark>");
                sw.WriteLine($"  <Placemark><styleUrl>#NearestRunway</styleUrl><name>{runway.Designator}</name><Point><coordinates>{runway.Longitude * VortexMath.Rad2Deg},{runway.Latitude * VortexMath.Rad2Deg},0</coordinates></Point></Placemark>");

                sw.WriteLine("  <Placemark>\n");
                sw.WriteLine($"   <name>{runway.Designator}</name>\n   <styleUrl>#Runway</styleUrl>\n");
                sw.WriteLine("   <LineString>\n    <coordinates>\n");
                foreach (TaxiNode node in runway.RunwayNodes)
                {
                    sw.WriteLine($"     {node.Longitude * VortexMath.Rad2Deg}, {node.Latitude * VortexMath.Rad2Deg}, 0.0\n");
                }
                sw.WriteLine("    </coordinates>\n   </LineString>\n  </Placemark>\n");
            }
        }