コード例 #1
0
ファイル: Parcours.cs プロジェクト: helios57/anrl
 public Parcours(Map parentMap)
     : base()
 {
     this.forbiddenZones = new ForbiddenZoneCollection();
     this.routes = new RouteCollection();
     this.nbLine = new Gate();
     this.parentMap = parentMap;
 }
コード例 #2
0
ファイル: Parcours.cs プロジェクト: helios57/anrl
 public Parcours(string filepath, Map parentMap)
     : base()
 {
     this.forbiddenZones = new ForbiddenZoneCollection();
     this.routes = new RouteCollection();
     this.nbLine = new Gate();
     this.parentMap = parentMap;
     this.importFromDxf(filepath);
 }
コード例 #3
0
ファイル: Race.cs プロジェクト: helios57/anrl
 public Race(string filename)
     : base()
 {
     competitors = new CompetitorCollection();
     competitorGroups = new CompetitorGroupCollection();
     flights = new FlightCollection();
     map = new Map();
     this.loadRace(filename);
 }
コード例 #4
0
ファイル: MapCollection.cs プロジェクト: helios57/anrl
 public void Remove(Map item)
 {
     items.Remove(item);
 }
コード例 #5
0
ファイル: MapCollection.cs プロジェクト: helios57/anrl
 public bool Contains(Map item)
 {
     return items.Contains(item);
 }
コード例 #6
0
ファイル: MapCollection.cs プロジェクト: helios57/anrl
 public void Add(Map item)
 {
     items.Add(item);
 }
コード例 #7
0
ファイル: Common.cs プロジェクト: helios57/anrl
        /// <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;
        }
コード例 #8
0
ファイル: GUI.cs プロジェクト: helios57/anrl
 private void competitionMapsCmbSelectMaps_SelectedIndexChanged(object sender, EventArgs e)
 {
     currentMap = (Map)competitionMapsCmbSelectMaps.SelectedItem;
     UpdateMapView();
 }
コード例 #9
0
ファイル: GUI.cs プロジェクト: helios57/anrl
 void MapLoad_FileOk(object sender, CancelEventArgs e)
 {
     string filename = ((OpenFileDialog)sender).FileName;
     Map map = new Map(filename, competition);
     competition.MapCollection.Add(map);
     currentMap = map;
     UpdateCompetitionMapsCmbSelectMaps();
     UpdateMapView();
 }
コード例 #10
0
ファイル: GUI.cs プロジェクト: helios57/anrl
 void ImportCompetition_FileOk(object sender, CancelEventArgs e)
 {
     IFormatter formatter = new BinaryFormatter();
     Stream stream = new FileStream(((OpenFileDialog)sender).FileName, FileMode.Open, FileAccess.Read, FileShare.Read);
     competition = (Competition)formatter.Deserialize(stream);
     stream.Close();
     currentCompetitor = null;
     currentMap = null;
     currentParcours = null;
     competitionUpdateBaseData();
     UpdateCompetitionMapsCmbSelectMaps();
     UpdateCompetitionParcoursCmbParcoursSelection();
     UpdateMapView();
     UpdateParcoursView();
 }
コード例 #11
0
ファイル: Race.cs プロジェクト: helios57/anrl
 public void loadRace(string filename)
 {
     BinaryFormatter binaryFormatter = new BinaryFormatter();
     Stream fStream = File.OpenRead(filename);
     Race r = (Race)binaryFormatter.Deserialize(fStream);
     this.competitors = r.Competitors;
     this.competitorGroups = r.CompetitorGroups;
     this.flights = r.Flights;
     this.map = r.map;
 }