Esempio n. 1
0
 public Flight()
     : base()
 {
     track = new TrackPointCollection();
     penalties = new PenaltyCollection();
 }
Esempio n. 2
0
        /// <summary>
        /// Returns the Penalties for a flight on a Parcours (Forbidden Zones only)
        /// </summary>
        /// <param name="parcours"></param>
        /// <param name="flight"></param>
        /// <returns></returns>
        public static PenaltyCollection calculateForbiddenZonePenalties(Parcours parcours, Flight flight)
        {
            bool lastPointWasOffTrack = false;
            bool finishingGatePassed = false;
            List<GpsPoint> penaltyPoints = new List<GpsPoint>();

            List<List<GpsPoint>> penaltyPointsList = new List<List<GpsPoint>>();

            for (int i = 0; i< flight.Track.Count-1; i++)
            {
                if(!finishingGatePassed)
                {
                    TrackPoint trackpoint = flight.Track[i];
                    for(int j = 0; j<4;j++)
                    {
                        // ToDo: get gate
                        //if(Common.gatePassed(parcours.Gates[j,1] ,trackpoint, flight.Track[i+1]))
                        //{
                        //    finishingGatePassed = true;
                        //    break;
                        //}
                        if (parcours.IsPointOffTrack(trackpoint))
                        {
                            lastPointWasOffTrack = true;
                            penaltyPoints.Add(trackpoint);
                        }
                        else
                        {
                            if (lastPointWasOffTrack)
                            {
                                penaltyPointsList.Add(penaltyPoints);
                                penaltyPoints = new List<GpsPoint>();
                            }
                            lastPointWasOffTrack = false;
                        }
                    }
                }
                else
                {
                    break;
                }
            }

            PenaltyCollection penalties = new PenaltyCollection();
            foreach (List<GpsPoint> penaltySequence in penaltyPointsList)
            {
                int durance = penaltySequence.Count;
                Rules.RestrictedAreaDuration restrictedAreaDuration;

                if(durance <= 2)
                    restrictedAreaDuration = Rules.RestrictedAreaDuration.ZeroToTwo;
                else if(durance >=3 && durance <= 4)
                    restrictedAreaDuration = Rules.RestrictedAreaDuration.ThreeToFour;
                else if(durance >=5 && durance <= 6)
                    restrictedAreaDuration = Rules.RestrictedAreaDuration.FiveToSix;
                else if(durance >=7 && durance <= 8)
                    restrictedAreaDuration = Rules.RestrictedAreaDuration.SevenToEight;
                else if(durance >=9 && durance <=10)
                    restrictedAreaDuration = Rules.RestrictedAreaDuration.NineToTen;
                else
                    restrictedAreaDuration = Rules.RestrictedAreaDuration.MoreOrEqEleven;

                Penalty newPenalty = new Penalty();
                // ToDo: assign penalty point, comment, etc.
                penalties.Add(newPenalty);
            }
            return penalties;
        }
Esempio n. 3
0
 public void AddRange(PenaltyCollection itemCollection)
 {
     foreach (Penalty item in itemCollection)
     {
         items.Add(item);
     }
 }