Ejemplo n.º 1
0
        internal void DebugAtcNodes()
        {
            using (InvariantWriter sw = new InvariantWriter(Path.Combine(Settings.DataFolder, "atcnodes.csv"), Encoding.UTF8))
            {
                sw.WriteLine("latitude,longitude,name\n");

                foreach (TaxiNode node in _taxiNodes)
                {
                    sw.WriteLine($"{node.Latitude * VortexMath.Rad2Deg},{node.Longitude * VortexMath.Rad2Deg},{node.Id}");
                }
            }
        }
Ejemplo n.º 2
0
        internal void DebugParkings()
        {
            using (InvariantWriter sw = new InvariantWriter(Path.Combine(Settings.DataFolder, "starts.csv"), Encoding.UTF8))
            {
                sw.WriteLine("latitude,longitude,name\n");
                foreach (Parking parking in _parkings)
                {
                    sw.WriteLine($"{parking.Latitude * VortexMath.Rad2Deg},{parking.Longitude * VortexMath.Rad2Deg},{parking.Name}");
                }
            }

            using (InvariantWriter sw = new InvariantWriter(Path.Combine(Settings.DataFolder, "pushback.csv"), Encoding.UTF8))
            {
                sw.WriteLine("latitude,longitude,name\n");
                foreach (Parking parking in _parkings)
                {
                    sw.WriteLine($"{parking.PushBackLatitude * VortexMath.Rad2Deg},{parking.PushBackLongitude * VortexMath.Rad2Deg},{parking.Name}");
                }
            }
        }
Ejemplo n.º 3
0
        public void WriteParkingDef()
        {
            string filename = Path.Combine(Settings.WorldTrafficParkingDefs, _airport.ICAO, Name) + ".txt";

            using (InvariantWriter sw = new InvariantWriter(filename, Encoding.ASCII))
            {
                int military = (Operation == OperationType.Military) ? 1 : 0;
                int cargo    = (Operation == OperationType.Cargo) ? 1 : 0;
                sw.WriteLine($"Auto Generated by GRG \n<{_airport.ICAO}.{Name}> Ops: <{Operation}> Cat: <{MaxSize}> XpTypes: <{string.Join(" ", XpTypes)}>\n");
                sw.WriteLine("START");
                sw.WriteLine($"Name              {Name}");
                sw.WriteLine($"Types             {string.Join(" ", PossibleWtTypes.Select(w => (int)w).OrderBy(w => w))}");
                sw.WriteLine($"Operators         {string.Join(" ", Operators).ToUpper()}");
                sw.WriteLine($"AcName            ");
                sw.WriteLine($"Tailnum           ");
                sw.WriteLine($"Cargo             {cargo}");
                sw.WriteLine($"Military          {military}");
                sw.WriteLine($"Lat               {Latitude * VortexMath.Rad2Deg}");
                sw.WriteLine($"Lon               {Longitude * VortexMath.Rad2Deg}");
                sw.WriteLine($"AdjLat            {Latitude * VortexMath.Rad2Deg}");
                sw.WriteLine($"AdjLon            {Longitude * VortexMath.Rad2Deg}");
                sw.WriteLine($"HdgDegT           {((Bearing * VortexMath.Rad2Deg)+360) % 360:0}");
                sw.WriteLine($"ParkCenter        {Settings.ParkingReference}");
                sw.WriteLine($"PushBackDist1_ft  0"); // Push is part of route
                sw.WriteLine($"PushBackTurnHdg   0");
                sw.WriteLine($"PushBackDist2_ft  0");
                sw.WriteLine($"Has1300_data      1");
                sw.WriteLine($"Priority          0");
                sw.WriteLine($"International     1");
                sw.WriteLine($"SmallPropAllowed  1");
                sw.WriteLine($"LightPropAllowed  1");
                sw.WriteLine($"Enabled           1");
                sw.WriteLine("END");
            }
        }
Ejemplo n.º 4
0
        internal void Write(string icao)
        {
            string operationFile = Path.Combine(Settings.WorldTrafficOperations, $"{icao}.txt");

            using (InvariantWriter sw = new InvariantWriter(operationFile, Encoding.ASCII))
            {
                sw.WriteLine("                                                                            Start  End");
                sw.WriteLine("INDEX   Low Wind Speed    High Wind Speed    Low Wind Dir   High Wind Dir   Time   Time  Comments (not parsed)");
                sw.WriteLine("---------------------------------------------------------------------------------------------------------------------");
                sw.WriteLine("START_OPERATIONS");
                foreach (string op in _operations)
                {
                    sw.WriteLine(op);
                }
                sw.WriteLine("END_OPERATIONS\n\n");

                sw.WriteLine("Ops                           1   2     Start End");
                sw.WriteLine("Index    Active Runway       Arr Dep    Time   Time   Comments (not parsed)");
                sw.WriteLine("-------------------------------------------------------------------------------------------------");
                sw.WriteLine("START_RUNWAY_OPS");
                foreach (string rwop in _runwayOps)
                {
                    sw.WriteLine(rwop);
                }
                sw.WriteLine("END_RUNWAY_OPS\n\n");

                sw.WriteLine("        Supported AC Types    Supported Approaches");
                sw.WriteLine("Runway  0 1 2 3 4 5 6 7 8 9     1 2 3 4 5 6 7 8");
                sw.WriteLine("---------------------------------------------------------------------------");
                sw.WriteLine("START_RUNWAYS");


                IEnumerable <IGrouping <string, RunwayUse> > uses = TrafficRules.SelectMany(tr => tr.RunwayUses).GroupBy(ru => ru.Designator);
                foreach (IGrouping <string, RunwayUse> use in uses)
                {
                    IEnumerable <XPlaneAircraftType>       types   = use.SelectMany(u => u.XpTypes).Distinct();
                    IEnumerable <WorldTrafficAircraftType> wtTypes = AircraftTypeConverter.WTTypesFromXPlaneTypes(types);
                    List <int> onOffs = new List <int>();
                    for (WorldTrafficAircraftType t = WorldTrafficAircraftType.Fighter; t < WorldTrafficAircraftType.Ground; t++)
                    {
                        onOffs.Add(wtTypes.Contains(t) ? 1 : 0);
                    }

                    sw.WriteLine($"{use.Key,-7} {string.Join(" ", onOffs)}     1 1 1 1 1 1 1 0");
                }

                sw.WriteLine("END_RUNWAYS");
            }
        }