Beispiel #1
0
 public Flight()
     : base()
 {
     this.track = new TrackPointCollection();
     customPenalties = new PenaltyCollection();
     automaticPenalties = new PenaltyCollection();
 }
Beispiel #2
0
 public void AddRange(TrackPointCollection itemCollection)
 {
     foreach (TrackPoint item in itemCollection)
     {
         base.Add(item);
     }
 }
Beispiel #3
0
        /// <summary>
        /// Imports a GAC File of a Flight.
        /// </summary>
        /// <param name="filepath"></param>
        /// <returns>The created Flight object</returns>
        public void dataFromGAC(string filename)
        {
            TrackPointCollection trackpoints = new TrackPointCollection();
            StreamReader gacFileStreamReader = new StreamReader(filename);
            string line = string.Empty;
            DateTime newPointTimeStamp = DateTime.Now;
            double newPointLatitude = 0;
            double newPointLongitude = 0;
            line = gacFileStreamReader.ReadLine();
            while (!line.Substring(0, 1).Equals("I") && !gacFileStreamReader.EndOfStream)
            {
                line = gacFileStreamReader.ReadLine();
            }
            {
                while (!gacFileStreamReader.EndOfStream)
                {
                    line = gacFileStreamReader.ReadLine();
                    if (line.Substring(0, 1).Equals("B"))
                    {
                        // timestamp
                        newPointTimeStamp = new DateTime(1, 1, 1, Convert.ToInt32(line.Substring(1, 2)), Convert.ToInt32(line.Substring(3, 2)), Convert.ToInt32(line.Substring(5, 2)));
                        // latitude
                        newPointLatitude = Convert.ToDouble(line.Substring(7, 2)) * 3600 + Convert.ToDouble(line.Substring(9, 2)) * 60 + Convert.ToDouble(line.Substring(11, 3)) * 60 / 1000;
                        switch (line.Substring(14, 1))
                        {
                            case "N":
                                break;
                            case "S":
                                newPointLatitude *= (-1);
                                break;
                            default:
                                // TODO: Error
                                break;
                        }
                        // longitude
                        newPointLongitude = Convert.ToDouble(line.Substring(15, 3)) * 3600 + Convert.ToDouble(line.Substring(18, 2)) * 60 + Convert.ToDouble(line.Substring(20, 3)) * 60 / 1000;
                        switch (line.Substring(23, 1))
                        {
                            case "E":
                                break;
                            case "W":
                                newPointLongitude *= (-1);
                                break;
                            default:
                                // ToDo: Error
                                break;
                        }
                        TrackPoint newTrackPoint = new TrackPoint(newPointLatitude, newPointLongitude, newPointTimeStamp, GpsPointFormatImport.WGS84);

                        trackpoints.Add(newTrackPoint);
                    }
                }
            }
            this.track = trackpoints;
        }