public CompetitorRouteAssignment this[Route route] { get { foreach (CompetitorRouteAssignment competitorRouteAssignment in items) { if (route == competitorRouteAssignment.Route) { return competitorRouteAssignment; } } return null; } }
/// <summary> /// Imports a DxfFile that is in the specified Format. Any changes on the import schema may cause Errors! /// </summary> /// <param name="filepath"></param> public void importFromDxf(string filepath) { StreamReader sr = new StreamReader(filepath); List<string> lineList = new List<string>(); while (!sr.EndOfStream) { lineList.Add(sr.ReadLine()); } string[] lines = lineList.ToArray(); for (int i = 1; i < lines.Length; i++) //Looping through Array, starting with 1 (lines[0] is "0") { //Find Lines Containing a new Element Definition if (lines[i] == "LWPOLYLINE" && lines[i - 1] == " 0") // { //Reading out Layer ( "8" [\n] layerName) = Type of Element if (lines[i + 5] == " 8" && lines[i + 6].Contains("PROH")) // "Prohibited Zone" = ForbiddenZone { if (lines[i + 9] == " 90") { int numberOfVertexes = int.Parse(lines[i + 10]); ForbiddenZone forbiddenZone = new ForbiddenZone(); for (int j = 0; j < numberOfVertexes; j++) { forbiddenZone.AddGpsPoint(new GpsPoint(double.Parse(lines[i + (j * 4) + 18]) * 1000, double.Parse(lines[i + (j * 4) + 16]) * 1000, GpsPointFormatImport.Swiss)); } this.ForbiddenZones.Add(forbiddenZone); } } else if (lines[i + 5] == " 8" && lines[i + 6].Contains("STARTPOINT-")) { Gate g = new Gate(new GpsPoint(double.Parse(lines[i + 18]) * 1000, double.Parse(lines[i + 16]) * 1000, GpsPointFormatImport.Swiss), new GpsPoint(double.Parse(lines[i + 22]) * 1000, double.Parse(lines[i + 20]) * 1000, GpsPointFormatImport.Swiss)); string gatename = lines[i + 6].Substring(11, 1); if (!this.Routes.Contains(gatename)) { Route newRoute = new Route(this); newRoute.RouteName = gatename; this.Routes.Add(newRoute); } this.Routes[gatename].StartGate = g; } else if (lines[i + 5] == " 8" && lines[i + 6].Contains("ENDPOINT-")) { Gate g = new Gate(new GpsPoint(double.Parse(lines[i + 18]) * 1000, double.Parse(lines[i + 16]) * 1000, GpsPointFormatImport.Swiss), new GpsPoint(double.Parse(lines[i + 22]) * 1000, double.Parse(lines[i + 20]) * 1000, GpsPointFormatImport.Swiss)); string gatename = lines[i + 6].Substring(9, 1); if (!this.Routes.Contains(gatename)) { Route newRoute = new Route(this); newRoute.RouteName = gatename; this.Routes.Add(newRoute); } this.Routes[gatename].EndGate = g; } else if (lines[i + 5] == " 8" && lines[i + 6].Contains("NBLINE")) { if (lines[i + 9] == " 90" && double.Parse(lines[10]) == 2) { this.NbLine = new Gate(new GpsPoint(double.Parse(lines[i + 18]) * 1000, double.Parse(lines[i + 16]) * 1000, GpsPointFormatImport.Swiss), new GpsPoint(double.Parse(lines[i + 22]) * 1000, double.Parse(lines[i + 20]) * 1000, GpsPointFormatImport.Swiss)); } } } } }
public void Remove(Route item) { items.Remove(item); }
public bool Contains(Route item) { foreach (CompetitorRouteAssignment competitorRouteAssignment in items) { if (competitorRouteAssignment.Route == item) { return true; } } return false; }
public bool Contains(Route item) { return items.Contains(item); }
public void Add(Route item) { items.Add(item); // ToDo: key unique?! }
public CompetitorRouteAssignment(Competitor competitor, Route route, DateTime takeOffTime) { this.competitor = competitor; this.route = route; }
private void raceGroupCmdLoadFlightCompetitor_Click(object sender, EventArgs e) { raceCurrentButton = sender as Button; if (raceCurrentButton == raceGroupCmdLoadFlightCompetitor1) { raceAddFlightSelectedRoute = raceCurrentCompetitorGroup.Parcours.Routes["A"]; } else if (raceCurrentButton == raceGroupCmdLoadFlightCompetitor2) { raceAddFlightSelectedRoute = raceCurrentCompetitorGroup.Parcours.Routes["B"]; } else if (raceCurrentButton == raceGroupCmdLoadFlightCompetitor3) { raceAddFlightSelectedRoute = raceCurrentCompetitorGroup.Parcours.Routes["C"]; } else if (raceCurrentButton == raceGroupCmdLoadFlightCompetitor4) { raceAddFlightSelectedRoute = raceCurrentCompetitorGroup.Parcours.Routes["D"]; } OpenFileDialog ImportFlight = new OpenFileDialog(); ImportFlight.FileOk += new CancelEventHandler(ImportFlight_FileOk); ImportFlight.Title = "GAC File"; ImportFlight.Filter = "GAC Files|*.GAC"; ImportFlight.ShowDialog(); }
private void raceCmdSelectCompetitor_Click(object sender, EventArgs e) { Button currentButton = sender as Button; if(currentButton == raceCmdRoute1Select) { raceRouteToAssignCompetitor = raceCurrentCompetitorGroup.Parcours.Routes["A"]; } else if (currentButton == raceCmdRoute2Select) { raceRouteToAssignCompetitor = raceCurrentCompetitorGroup.Parcours.Routes["B"]; } else if (currentButton == raceCmdRoute3Select) { raceRouteToAssignCompetitor = raceCurrentCompetitorGroup.Parcours.Routes["C"]; } else if (currentButton == raceCmdRoute4Select) { raceRouteToAssignCompetitor = raceCurrentCompetitorGroup.Parcours.Routes["D"]; } CompetitorSelection cs = new CompetitorSelection(raceCurrentRace); cs.SubmitButtonClick += new EventHandler(cs_SubmitButtonClick); cs.Show(); }