Example #1
0
        private void ReadStartPoint(string line)
        {
            string[] tokens  = line.Split(_splitters, StringSplitOptions.RemoveEmptyEntries);
            string[] xpTypes = tokens[5].Split('|');

            Parking sp = new Parking(this)
            {
                Latitude     = VortexMath.ParseDegreesToRadians(tokens[1]),
                Longitude    = VortexMath.ParseDegreesToRadians(tokens[2]),
                Bearing      = ((VortexMath.Parse(tokens[3]) + 540) * VortexMath.Deg2Rad) % (VortexMath.PI2) - Math.PI,
                LocationType = StartUpLocationTypeConverter.FromString(tokens[4]),
                XpTypes      = AircraftTypeConverter.XPlaneTypesFromStrings(xpTypes),
                Name         = string.Join(" ", tokens.Skip(6))
            };

            if (Settings.FixDuplicateParkingNames)
            {
                if (_parkings.Count(p => p.Name == sp.Name) > 0)
                {
                    if (!_parkingNameDuplicates.ContainsKey(sp.Name))
                    {
                        _parkingNameDuplicates.Add(sp.Name, 1);
                    }

                    _parkingNameDuplicates[sp.Name]++;
                    sp.Name += $" - {_parkingNameDuplicates[sp.Name]}";
                    Logger.Log($"Renamed a parking to: {sp.Name}");
                }
            }

            _parkings.Add(sp);
        }
Example #2
0
 private void ReadLineEnd(string line)
 {
     if (inLine)
     {
         string[]    tokens     = line.Split(_splitters, StringSplitOptions.RemoveEmptyEntries);
         LineElement le         = new LineElement();
         double      latitude1  = VortexMath.ParseDegreesToRadians(tokens[1]);
         double      longitude1 = VortexMath.ParseDegreesToRadians(tokens[2]);
         le.Latitude  = latitude1;
         le.Longitude = longitude1;
         cle.Segments.Add(le);
         cle    = null;
         inLine = false;
     }
 }
Example #3
0
 private void ReadLineSegment(string line)
 {
     if (cle == null)
     {
         cle = new LineElement();
         string[] tokens     = line.Split(_splitters, StringSplitOptions.RemoveEmptyEntries);
         double   latitude1  = VortexMath.ParseDegreesToRadians(tokens[1]);
         double   longitude1 = VortexMath.ParseDegreesToRadians(tokens[2]);
         cle.Latitude  = latitude1;
         cle.Longitude = longitude1;
         _lines.Add(cle);
     }
     else
     {
         // skipping intermediates now.
     }
 }
Example #4
0
        private void ReadRunwayRecord(string line)
        {
            string[] tokens = line.Split(_splitters, StringSplitOptions.RemoveEmptyEntries);

            double latitude1  = VortexMath.ParseDegreesToRadians(tokens[9]);
            double longitude1 = VortexMath.ParseDegreesToRadians(tokens[10]);
            double latitude2  = VortexMath.ParseDegreesToRadians(tokens[18]);
            double longitude2 = VortexMath.ParseDegreesToRadians(tokens[19]);

            Runway r1 = new Runway(tokens[8], latitude1, longitude1, VortexMath.Parse(tokens[11]) / 1000.0);

            r1.LogMessage += RelayMessage;

            Runway r2 = new Runway(tokens[17], latitude2, longitude2, VortexMath.Parse(tokens[20]) / 1000.0);

            r2.LogMessage += RelayMessage;

            r1.OppositeEnd = r2;
            r2.OppositeEnd = r1;

            _runways.Add(r1);
            _runways.Add(r2);
        }
Example #5
0
 public void ComputeLonLat()
 {
     Latitude  = VortexMath.ParseDegreesToRadians(LatitudeString);
     Longitude = VortexMath.ParseDegreesToRadians(LongitudeString);
 }