Example #1
0
        public BRecord(string rec, DateTime flightdate, ExtensionRecord extensions)
            : base(rec, flightdate, extensions)
        {
            AltitudeDifference = 0;
            Speed = 0;
            TimeDifference = 1;
            Distance = 0;

            Latitude = Convert.ToInt32(rec.Substring(7, 2));
            Latitude = Latitude + ((Convert.ToDouble(rec.Substring(9, 2)) + Convert.ToDouble(rec.Substring(11, 3)) / 1000) / 60);
            if (rec.Substring(14, 1) == "S")
            {
                Latitude = Latitude * -1;
            }

            Longitude = Convert.ToInt32(rec.Substring(15, 3));
            Longitude = Longitude + ((Convert.ToDouble(rec.Substring(18, 2)) + Convert.ToDouble(rec.Substring(20, 3)) / 1000) / 60);
            if (rec.Substring(23, 1) == "W")
            {
                Longitude = Longitude * -1;
            }

            FixValidity = rec.Substring(24, 1);

            PressureAltitude = Convert.ToInt32(rec.Substring(25, 5));
            GnssAltitude = Convert.ToInt32(rec.Substring(30, 5));
        }
Example #2
0
        public BRecord(string rec, DateTime flightdate, ExtensionRecord extensions)
            : base(rec, flightdate, extensions)
        {
            AltitudeDifference = 0;
            Speed          = 0;
            TimeDifference = 1;
            Distance       = 0;

            Latitude = Convert.ToInt32(rec.Substring(7, 2));
            Latitude = Latitude + ((Convert.ToDouble(rec.Substring(9, 2)) + Convert.ToDouble(rec.Substring(11, 3)) / 1000) / 60);
            if (rec.Substring(14, 1) == "S")
            {
                Latitude = Latitude * -1;
            }

            Longitude = Convert.ToInt32(rec.Substring(15, 3));
            Longitude = Longitude + ((Convert.ToDouble(rec.Substring(18, 2)) + Convert.ToDouble(rec.Substring(20, 3)) / 1000) / 60);
            if (rec.Substring(23, 1) == "W")
            {
                Longitude = Longitude * -1;
            }

            FixValidity = rec.Substring(24, 1);

            PressureAltitude = Convert.ToInt32(rec.Substring(25, 5));
            GnssAltitude     = Convert.ToInt32(rec.Substring(30, 5));
        }
Example #3
0
 public ExtendedRecord(string rec, DateTime flightdate, ExtensionRecord extensions)
     : base(rec, flightdate)
 {
     foreach (string k in extensions.Extensions.Keys)
     {
         _attributes.Add(k, rec.Substring(extensions.Extensions[k].StartByte - 1, extensions.Extensions[k].Length()));
     }
 }
Example #4
0
 public ExtendedRecord(string rec, DateTime flightdate, ExtensionRecord extensions)
     : base(rec, flightdate)
 {
     foreach (string k in extensions.Extensions.Keys)
     {
         _attributes.Add(k, rec.Substring(extensions.Extensions[k].StartByte - 1, extensions.Extensions[k].Length()));
     }
 }
Example #5
0
        private void ReadContents()
        {
            using (StringReader sr = new StringReader(Contents))
            {
                while (sr.Peek() >= 0)
                {
                    string l = sr.ReadLine();
                    switch (l.Substring(0, 1))
                    {
                    case "A":
                        ARecord = new ARecord(l);
                        break;

                    case "B":
                        BRecord b = new BRecord(l, FlightDate, IRecord);
                        if (!BRecords.ContainsKey(b.Time))
                        {
                            BRecords.Add(b.Time, b);
                        }
                        break;

                    case "C":
                        break;

                    case "D":
                        break;

                    case "E":
                        ERecord e = new ERecord(l, FlightDate);
                        ERecords.Add(e);
                        if (e.Code == "STA")
                        {
                            DetectedStart = e.Time;
                        }
                        break;

                    case "F":
                        break;

                    case "G":
                        GRecord = GRecord + l.Substring(1);
                        break;

                    case "H":
                        HRecord h = new HRecord(l);
                        HRecords.Add(h.Code, h);
                        if (HRecords.ContainsKey("DTE"))
                        {
                            FlightDate = new DateTime(2000 + int.Parse(HRecords["DTE"].Value.Substring(4, 2)), int.Parse(HRecords["DTE"].Value.Substring(2, 2)), int.Parse(HRecords["DTE"].Value.Substring(0, 2)));
                        }
                        break;

                    case "I":
                        IRecord = new ExtensionRecord(l);
                        break;

                    case "J":
                        JRecord = new ExtensionRecord(l);
                        break;
                    }
                }
            }

            if (DetectedStart == null && BRecords.Count > 0)
            {
                DetectedStart = BRecords.First().Key;
            }

            // Process other H records
            if (HRecords.ContainsKey("PLT"))
            {
                PilotName = HRecords["PLT"].Value.CutOffUntilCharacter(":").Trim();
            }
            if (HRecords.ContainsKey("GTY"))
            {
                GliderType = HRecords["GTY"].Value.CutOffUntilCharacter(":").Trim();
            }
            if (HRecords.ContainsKey("GID"))
            {
                GliderRegistration = HRecords["GID"].Value.CutOffUntilCharacter(":").Trim();
            }
            if (HRecords.ContainsKey("CCL"))
            {
                GliderClass = HRecords["CCL"].Value.CutOffUntilCharacter(":").Trim();
            }

            // Process B records
            BRecord currentRecord = null;

            foreach (DateTime k in BRecords.Keys)
            {
                if (k > DetectedStart & currentRecord != null)
                {
                    if (Takeoff == null)
                    {
                        Takeoff = new Common.Point(currentRecord);
                    }
                    BRecords[k].CompareWith(currentRecord);
                    if (BRecords[k].GnssAltitude > MaxAltitude)
                    {
                        MaxAltitude = BRecords[k].GnssAltitude;
                    }
                    if (BRecords[k].GnssAltitude < MinAltitude)
                    {
                        MinAltitude = BRecords[k].GnssAltitude;
                    }
                    if (BRecords[k].Vario > MaxVario)
                    {
                        MaxVario = BRecords[k].Vario;
                    }
                    if (BRecords[k].Vario < MinVario)
                    {
                        MinVario = BRecords[k].Vario;
                    }
                    if (BRecords[k].Speed > MaxSpeed)
                    {
                        MaxSpeed = BRecords[k].Speed;
                    }
                    Distance = Distance + BRecords[k].Distance;
                }
                currentRecord = BRecords[k];
            }
            DetectedLandingTime = currentRecord.Time;
            FlightTime          = DetectedLandingTime.Subtract(DetectedStart);
            Landing             = new Common.Point(currentRecord);
            AverageSpeed        = Convert.ToSingle((float)Distance / (float)FlightTime.TotalSeconds);
        }
Example #6
0
 public KRecord(string rec, DateTime flightdate, ExtensionRecord extensions)
     : base(rec, flightdate, extensions)
 {
 }
Example #7
0
 public KRecord(string rec, DateTime flightdate, ExtensionRecord extensions) : base(rec, flightdate, extensions)
 {
 }
Example #8
0
        private void ReadContents()
        {
            using (StringReader sr = new StringReader(Contents))
            {
                while (sr.Peek() >= 0)
                {
                    string l = sr.ReadLine();
                    switch (l.Substring(0, 1))
                    {
                        case "A":
                            ARecord = new ARecord(l);
                            break;
                        case "B":
                            BRecord b = new BRecord(l, FlightDate, IRecord);
                            if (!BRecords.ContainsKey(b.Time))
                            {
                                BRecords.Add(b.Time, b);
                            }
                            break;
                        case "C":
                            break;
                        case "D":
                            break;
                        case "E":
                            ERecord e = new ERecord(l, FlightDate);
                            ERecords.Add(e);
                            if (e.Code == "STA")
                            {
                                DetectedStart = e.Time;
                            }
                            break;
                        case "F":
                            break;
                        case "G":
                            GRecord = GRecord + l.Substring(1);
                            break;
                        case "H":
                            HRecord h = new HRecord(l);
                            HRecords.Add(h.Code, h);
                            if (HRecords.ContainsKey("DTE"))
                            {
                                FlightDate = new DateTime(2000 + int.Parse(HRecords["DTE"].Value.Substring(4, 2)), int.Parse(HRecords["DTE"].Value.Substring(2, 2)), int.Parse(HRecords["DTE"].Value.Substring(0, 2)));
                            }
                            break;
                        case "I":
                            IRecord = new ExtensionRecord(l);
                            break;
                        case "J":
                            JRecord = new ExtensionRecord(l);
                            break;
                    }
                }
            }

            if (DetectedStart == null && BRecords.Count > 0)
            {
                DetectedStart = BRecords.First().Key;
            }

            // Process other H records
            if (HRecords.ContainsKey("PLT"))
            {
                PilotName = HRecords["PLT"].Value.CutOffUntilCharacter(":").Trim();
            }
            if (HRecords.ContainsKey("GTY"))
            {
                GliderType = HRecords["GTY"].Value.CutOffUntilCharacter(":").Trim();
            }
            if (HRecords.ContainsKey("GID"))
            {
                GliderRegistration = HRecords["GID"].Value.CutOffUntilCharacter(":").Trim();
            }
            if (HRecords.ContainsKey("CCL"))
            {
                GliderClass = HRecords["CCL"].Value.CutOffUntilCharacter(":").Trim();
            }

            // Process B records
            BRecord currentRecord = null;
            foreach (DateTime k in BRecords.Keys)
            {
                if (k > DetectedStart & currentRecord != null)
                {
                    if (Takeoff == null)
                    {
                        Takeoff = new Common.Point(currentRecord);
                    }
                    BRecords[k].CompareWith(currentRecord);
                    if (BRecords[k].GnssAltitude > MaxAltitude)
                    {
                        MaxAltitude = BRecords[k].GnssAltitude;
                    }
                    if (BRecords[k].GnssAltitude < MinAltitude)
                    {
                        MinAltitude = BRecords[k].GnssAltitude;
                    }
                    if (BRecords[k].Vario > MaxVario)
                    {
                        MaxVario = BRecords[k].Vario;
                    }
                    if (BRecords[k].Vario < MinVario)
                    {
                        MinVario = BRecords[k].Vario;
                    }
                    if (BRecords[k].Speed > MaxSpeed)
                    {
                        MaxSpeed = BRecords[k].Speed;
                    }
                    Distance = Distance + BRecords[k].Distance;
                }
                currentRecord = BRecords[k];
            }
            DetectedLandingTime = currentRecord.Time;
            FlightTime = DetectedLandingTime.Subtract(DetectedStart);
            Landing = new Common.Point(currentRecord);
            AverageSpeed = Convert.ToSingle((float)Distance / (float)FlightTime.TotalSeconds);
        }