public void Add(CompetitorGroup item) { items.Add(item); }
public bool Contains(CompetitorGroup item) { return items.Contains(item); }
public void Remove(CompetitorGroup item) { items.Remove(item); }
/// <summary> /// Draw the Image of the flights of a Group /// </summary> /// <param name="map"></param> /// <param name="parcours"></param> /// <param name="group"></param> /// <returns></returns> public static Image drawGroupFlights(Race race, Map map, Parcours parcours, CompetitorGroup group) { int competitorCounter = 0; Image img = drawParcours(parcours); Bitmap pg = new Bitmap(img.Width, img.Height); Graphics gr = Graphics.FromImage(pg); // clear the canvas to white Rectangle pgRect = new Rectangle(0, 0, pg.Width, pg.Height); SolidBrush solidWhite = new SolidBrush(Color.White); gr.FillRectangle(solidWhite, pgRect); // load a new image and draw it centered on our canvas Rectangle rc = new Rectangle(0, 0, img.Width, img.Height); gr.DrawImage(img, rc); img.Dispose(); foreach (CompetitorRouteAssignment cra in group.CompetitorRouteAssignmentCollection) { Competitor competitor = cra.Competitor; Flight flight = race.Flights.GetFlightByGroupAndCompetitorId(group, competitor); Pen[] pens = new Pen[] { new Pen(Brushes.Blue, 3.0f), new Pen(Brushes.Aquamarine, 3.0f), new Pen(Brushes.BlueViolet, 3.0f), new Pen(Brushes.DeepSkyBlue, 3.0f) }; Pen penInZone = new Pen(Brushes.LawnGreen, 5.0f); SolidBrush sb = new SolidBrush(Color.FromArgb(50, 250, 00, 20)); double imagePointsLongitudeDifference = map.BottomRightPoint.Longitude - map.TopLeftPoint.Longitude; double imagePointsLatitudeDifference = map.TopLeftPoint.Latitude - map.BottomRightPoint.Latitude; Point[] points = new Point[flight.Track.Count]; DateTime expectedFinishingTime = flight.StartGateTime.AddMinutes(parcours.DefaultTargetFlightDuration.TotalMinutes + 1); int i = 0; bool lastPointWasOffTrack = false; bool passedFinishingGate = false; List<Point> penaltyPoints = new List<Point>(); List<List<Point>> penaltyPointsList = new List<List<Point>>(); foreach (TrackPoint trackPoint in flight.Track) { double currentPointLongitudeDifference = trackPoint.Longitude - map.TopLeftPoint.Longitude; double currentPointLatitudeDifference = map.TopLeftPoint.Latitude - trackPoint.Latitude; double currentPointImageX = (currentPointLongitudeDifference / imagePointsLongitudeDifference) * pg.Width; double currentPointImageY = (currentPointLatitudeDifference / imagePointsLatitudeDifference) * pg.Height; int mapPointX = int.Parse(Math.Ceiling(currentPointImageX).ToString()); int mapPointY = int.Parse(Math.Ceiling(currentPointImageY).ToString()); GraphicsPath p = new GraphicsPath(); foreach (Route route in parcours.Routes) { if (route.EndGate.gatePassed(trackPoint, flight.Track[i + 1]) || trackPoint.TimeStamp > expectedFinishingTime) { passedFinishingGate = true; } } if (!passedFinishingGate && parcours.IsPointOffTrack(trackPoint)) { lastPointWasOffTrack = true; penaltyPoints.Add(new Point(mapPointX, mapPointY)); } else { if (lastPointWasOffTrack) { penaltyPointsList.Add(penaltyPoints); penaltyPoints = new List<Point>(); } lastPointWasOffTrack = false; } points[i] = new Point(mapPointX, mapPointY); if (i < flight.Track.Count - 2) { i++; } } gr.DrawLines(pens[competitorCounter], points); foreach (List<Point> penaltyPts in penaltyPointsList) { Point[] pointarray = penaltyPts.ToArray(); gr.DrawLines(penInZone, pointarray); } competitorCounter++; } return pg; }
public GroupsForm(Competition competition, Race race, CompetitorGroup group) { InitializeComponent(); this.competition = competition; this.race = race; this.competitorGroup = group; }
private void raceGroupsCmdNewGroup_Click(object sender, EventArgs e) { CompetitorGroup newGroup = new CompetitorGroup(); newGroup.Name = "New Group"; newGroup.Parcours = raceCurrentRace.Parcours; if (raceCurrentRace.CompetitorGroups.Count > 0) { newGroup.StartingTime = raceCurrentRace.CompetitorGroups[raceCurrentRace.CompetitorGroups.Count - 1].StartingTime.Add(competition.IntervalBetweenGroupTakeoffs); } else { newGroup.StartingTime = DateTime.Now.Subtract(TimeSpan.FromSeconds((double)DateTime.Now.Second)); } raceCurrentRace.CompetitorGroups.Add(newGroup); raceCurrentCompetitorGroup = newGroup; raceCurrentCompetitorGroup.Interval = competition.IntervalBetweenGroupCompetitorTakeoffs; raceCurrentCompetitorGroup.ParcoursTime = raceCurrentRace.Parcours.DefaultTargetFlightDuration; raceCurrentCompetitorGroup.TakeoffToStartGateTime = raceCurrentRace.Parcours.TimeToStartGateDefaultRunway; raceUpdateGroupGrid(); }
private void raceUpdateGroupGrid() { CompetitorGroup currentCompetitorGroupTempCopy = raceCurrentCompetitorGroup; //cause clearing the Rows also sets raceCurrentCompetitorGroup to null... raceDataGridGroups.Rows.Clear(); foreach (CompetitorGroup group in raceCurrentRace.CompetitorGroups) { string team1Text = string.Empty; string team2Text = string.Empty; string team3Text = string.Empty; string team4Text = string.Empty; if (group.Parcours.Routes.Contains("A")) { if (group.CompetitorRouteAssignmentCollection.Contains(group.Parcours.Routes["A"])) { Competitor c = group.CompetitorRouteAssignmentCollection[group.Parcours.Routes["A"]].Competitor; team1Text = c.CompetitionNumber + ": " + c.AcCallsign + "(" + c.PilotName + " / " + c.NavigatorName + ")"; } } if (group.Parcours.Routes.Contains("B")) { if (group.CompetitorRouteAssignmentCollection.Contains(group.Parcours.Routes["B"])) { Competitor c = group.CompetitorRouteAssignmentCollection[group.Parcours.Routes["B"]].Competitor; team2Text = c.CompetitionNumber + ": " + c.AcCallsign + "(" + c.PilotName + " / " + c.NavigatorName + ")"; } } if (group.Parcours.Routes.Contains("C")) { if (group.CompetitorRouteAssignmentCollection.Contains(group.Parcours.Routes["C"])) { Competitor c = group.CompetitorRouteAssignmentCollection[group.Parcours.Routes["C"]].Competitor; team3Text = c.CompetitionNumber + ": " + c.AcCallsign + "(" + c.PilotName + " / " + c.NavigatorName + ")"; } } if (group.Parcours.Routes.Contains("D")) { if (group.CompetitorRouteAssignmentCollection.Contains(group.Parcours.Routes["D"])) { Competitor c = group.CompetitorRouteAssignmentCollection[group.Parcours.Routes["D"]].Competitor; team4Text = c.CompetitionNumber + ": " + c.AcCallsign + "(" + c.PilotName + " / " + c.NavigatorName + ")"; } } int index = raceDataGridGroups.Rows.Add(new object[]{ group.Name, team1Text, team2Text, team3Text, team4Text, group.StartingTime.ToString("HH:mm"), group.Interval.ToString()}); raceDataGridGroups.Rows[index].Tag = group; if (group == currentCompetitorGroupTempCopy) { raceDataGridGroups.Rows[index].Selected = true; } } raceCurrentCompetitorGroup = currentCompetitorGroupTempCopy; raceUpdateGroupView(); }
private void raceGroupsCmdDeleteGroup_Click(object sender, EventArgs e) { if (raceCurrentCompetitorGroup != null) { raceCurrentRace.CompetitorGroups.Remove(raceCurrentCompetitorGroup); raceCurrentCompetitorGroup = null; raceUpdateGroupView(); raceUpdateGroupGrid(); } }
private void raceDataGridGroups_SelectionChanged(object sender, EventArgs e) { if (raceDataGridGroups.SelectedRows.Count > 0) { raceCurrentCompetitorGroup = (CompetitorGroup)raceDataGridGroups.SelectedRows[0].Tag; } raceUpdateGroupView(); }
private void raceDataGridGroups_CellClick(object sender, DataGridViewCellEventArgs e) { raceCurrentCompetitorGroup = (CompetitorGroup)raceDataGridGroups.Rows[e.RowIndex].Tag; raceUpdateGroupView(); }
void flightTreeViewGroupsAndCompetitors_AfterSelect(object sender, TreeViewEventArgs e) { if (e.Node.Tag.GetType() == typeof(Competitor)) { flightCurrentCompetitor = e.Node.Tag as Competitor; flightCurrentGroup = e.Node.Parent.Tag as CompetitorGroup; flightCurrentRace = e.Node.Parent.Parent.Tag as Race; updateFlightView(); } }
public static void savePdf(Competitor competitor, CompetitorGroup group, string filename) { // ToDo: get flight //Common.savePdf(competitor, competitor.getFlight(group), race, group.Parcours, filename); }