Exemple #1
0
 public Flight()
     : base()
 {
     this.track = new TrackPointCollection();
     customPenalties = new PenaltyCollection();
     automaticPenalties = new PenaltyCollection();
 }
Exemple #2
0
 public void AddRange(PenaltyCollection itemCollection)
 {
     foreach (Penalty item in itemCollection)
     {
         items.Add(item);
     }
 }
Exemple #3
0
        private PenaltyCollection calculateForbiddenZonePenalties()
        {
            bool lastPointWasOffTrack = false;
            bool finishingGatePassed = false;

            List<TrackPoint> penaltyPoints = new List<TrackPoint>();

            PenaltyCollection penalties = new PenaltyCollection();
            List<List<TrackPoint>> penaltyPointsList = new List<List<TrackPoint>>();

            for (int i = 0; i < this.Track.Count - 1; i++)
            {
                if (!finishingGatePassed)
                {
                    TrackPoint trackpoint = this.Track[i];

                    if(route.EndGate.gatePassed(trackpoint, this.Track[i+1]))
                    {
                        break;
                    }
                    if(trackpoint.TimeStamp > PlannedFinishGateTime.AddSeconds(120))
                    {
                        break;
                    }
                    if (this.Parcours.IsPointOffTrack(trackpoint))
                    {
                        lastPointWasOffTrack = true;
                        penaltyPoints.Add(trackpoint);
                    }
                    else
                    {
                        if (lastPointWasOffTrack)
                        {
                            penaltyPointsList.Add(penaltyPoints);
                            penaltyPoints = new List<TrackPoint>();
                        }
                        lastPointWasOffTrack = false;
                    }
                }
            }

            foreach (List<TrackPoint> penaltySequence in penaltyPointsList)
            {
                int durance = penaltySequence.Count;
                Penalty penalty = new Penalty();
                penalty.PenaltyType = PenaltyType.Navigation;
                if(durance > 5 && durance*3 < 200)
                {
                    penalty.PenaltyPoints = durance * 3;
                }
                else if(durance * 3 > 200)
                {
                    penalty.PenaltyPoints = 200;
                }
                penalty.Comment = "Entering Restricted Area (" + penaltySequence[0].TimeStamp.ToString("HH:mm:ss") + " until " +
                        penaltySequence[penaltySequence.Count - 1].TimeStamp.ToString("HH:mm:ss") + "), total " + Math.Floor((penaltySequence[penaltySequence.Count - 1].TimeStamp.Subtract(penaltySequence[0].TimeStamp)).TotalSeconds + 1).ToString() + " seconds";
                penalties.Add(penalty);
            }
            return penalties;
        }
Exemple #4
0
 private PenaltyCollection calculateGatePenalties()
 {
     PenaltyCollection pc = new PenaltyCollection();
     pc.Add(getTakeOffGatePenaltyPoints(PlannedTakeOffTime, TakeOffTime));
     pc.Add(getGatePenaltyPoints("Start Gate", PlannedStartGateTime, StartGateTime));
     pc.Add(getGatePenaltyPoints("Finishing Gate", PlannedFinishGateTime, FinishGateTime));
     return pc;
 }
Exemple #5
0
 public void resetPenalties()
 {
     this.penalties = null;
 }