public Flight() : base() { this.track = new TrackPointCollection(); customPenalties = new PenaltyCollection(); automaticPenalties = new PenaltyCollection(); }
public void AddRange(PenaltyCollection itemCollection) { foreach (Penalty item in itemCollection) { items.Add(item); } }
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; }
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; }
public void resetPenalties() { this.penalties = null; }