public void InitOpponent(int robotId, string name) { PolygonExtended robotShape = new PolygonExtended(); for (int i = 0; i < 7; i++) { robotShape.polygon.Points.Add(new System.Windows.Point(0.25 * Math.Cos(i * 2 * Math.PI / 6), 0.25 * Math.Sin(i * 2 * Math.PI / 6))); } robotShape.borderColor = Color.Black; robotShape.backgroundColor = Color.FromArgb(255, 200, 0, 0); PolygonExtended ghostShape = new PolygonExtended(); for (int i = 0; i < 7; i++) { ghostShape.polygon.Points.Add(new System.Windows.Point(0.27 * Math.Cos(i * 2 * Math.PI / 6), 0.27 * Math.Sin(i * 2 * Math.PI / 6))); } ghostShape.backgroundColor = System.Drawing.Color.FromArgb(20, 0, 255, 0); ghostShape.borderColor = System.Drawing.Color.Black; RobotDisplay rd = new RobotDisplay(robotShape, ghostShape, name); rd.SetLocation(new Location(0, 0, 0, 0, 0, 0)); OpponentDisplayDictionary.Add(robotId, rd); }
public MainWindow() { InitializeComponent(); WorldMap.Init(3.4, 2.4, 3, 2, @"C:\\GITHUB\\RoboCup2020\\C#\\Images\\Eurobot2020.png"); PolygonExtended robotShape = new PolygonExtended(); robotShape.polygon.Points.Add(new System.Windows.Point(-0.14, -0.18)); robotShape.polygon.Points.Add(new System.Windows.Point(0.14, -0.18)); robotShape.polygon.Points.Add(new System.Windows.Point(0.10, 0)); robotShape.polygon.Points.Add(new System.Windows.Point(0.14, 0.18)); robotShape.polygon.Points.Add(new System.Windows.Point(-0.14, 0.18)); robotShape.polygon.Points.Add(new System.Windows.Point(-0.14, -0.18)); robotShape.borderColor = System.Drawing.Color.Blue; robotShape.backgroundColor = System.Drawing.Color.Red; PolygonExtended ghostShape = new PolygonExtended(); ghostShape.polygon.Points.Add(new Point(-0.16, -0.2)); ghostShape.polygon.Points.Add(new Point(0.16, -0.2)); ghostShape.polygon.Points.Add(new Point(0.12, 0)); ghostShape.polygon.Points.Add(new Point(0.16, 0.2)); ghostShape.polygon.Points.Add(new Point(-0.16, 0.2)); ghostShape.polygon.Points.Add(new Point(-0.16, -0.2)); ghostShape.backgroundColor = System.Drawing.Color.FromArgb(20, 0, 255, 0); ghostShape.borderColor = System.Drawing.Color.Black; WorldMap.SetRobotShape(robotShape); WorldMap.SetGhostShape(ghostShape); timerTestPosition = new Timer(100); timerTestPosition.Elapsed += TimerTestPosition_Elapsed; timerTestPosition.Start(); }
public PolygonExtended GetRobotSpeedArrow() { PolygonExtended polygonToDisplay = new PolygonExtended(); double angleTeteFleche = Math.PI / 6; double longueurTeteFleche = 0.30; double LongueurFleche = Math.Sqrt(robotLocation.Vx * robotLocation.Vx + robotLocation.Vy * robotLocation.Vy); double headingAngle = Math.Atan2(robotLocation.Vy, robotLocation.Vx) + robotLocation.Theta; double xTete = LongueurFleche * Math.Cos(headingAngle); double yTete = LongueurFleche * Math.Sin(headingAngle); polygonToDisplay.polygon.Points.Add(new Point(robotLocation.X, robotLocation.Y)); polygonToDisplay.polygon.Points.Add(new Point(robotLocation.X + xTete, robotLocation.Y + yTete)); double angleTeteFleche1 = headingAngle + angleTeteFleche; double angleTeteFleche2 = headingAngle - angleTeteFleche; polygonToDisplay.polygon.Points.Add(new Point(robotLocation.X + xTete - longueurTeteFleche * Math.Cos(angleTeteFleche1), robotLocation.Y + yTete - longueurTeteFleche * Math.Sin(angleTeteFleche1))); polygonToDisplay.polygon.Points.Add(new Point(robotLocation.X + xTete, robotLocation.Y + yTete)); polygonToDisplay.polygon.Points.Add(new Point(robotLocation.X + xTete - longueurTeteFleche * Math.Cos(angleTeteFleche2), robotLocation.Y + yTete - longueurTeteFleche * Math.Sin(angleTeteFleche2))); polygonToDisplay.polygon.Points.Add(new Point(robotLocation.X + xTete, robotLocation.Y + yTete)); polygonToDisplay.borderWidth = 2; polygonToDisplay.borderColor = System.Drawing.Color.FromArgb(0xFF, 0xFF, 0x00, 0x00); polygonToDisplay.borderDashPattern = new double[] { 3, 3 }; polygonToDisplay.borderOpacity = 1; polygonToDisplay.backgroundColor = System.Drawing.Color.FromArgb(0x00, 0x00, 0x00, 0x00); return(polygonToDisplay); }
public void InitTeamMate(int robotId, string name) { PolygonExtended robotShape = new PolygonExtended(); robotShape.polygon.Points.Add(new System.Windows.Point(-0.25, -0.25)); robotShape.polygon.Points.Add(new System.Windows.Point(0.25, -0.25)); robotShape.polygon.Points.Add(new System.Windows.Point(0.2, 0)); robotShape.polygon.Points.Add(new System.Windows.Point(0.25, 0.25)); robotShape.polygon.Points.Add(new System.Windows.Point(-0.25, 0.25)); robotShape.polygon.Points.Add(new System.Windows.Point(-0.25, -0.25)); robotShape.borderColor = Color.Black; robotShape.backgroundColor = Color.FromArgb(255, 0, 0, 200); PolygonExtended ghostShape = new PolygonExtended(); ghostShape.polygon.Points.Add(new System.Windows.Point(-0.27, -0.27)); ghostShape.polygon.Points.Add(new System.Windows.Point(0.27, -0.27)); ghostShape.polygon.Points.Add(new System.Windows.Point(0.22, 0.02)); ghostShape.polygon.Points.Add(new System.Windows.Point(0.27, 0.27)); ghostShape.polygon.Points.Add(new System.Windows.Point(-0.27, 0.27)); ghostShape.polygon.Points.Add(new System.Windows.Point(-0.27, -0.27)); ghostShape.backgroundColor = System.Drawing.Color.FromArgb(20, 0, 255, 0); ghostShape.borderColor = System.Drawing.Color.Black; RobotDisplay rd = new RobotDisplay(robotShape, ghostShape, name); rd.SetLocation(new Location(0, 0, 0, 0, 0, 0)); TeamMatesDisplayDictionary.Add(robotId, rd); }
public PolygonExtended GetRobotDestinationArrow() { PolygonExtended polygonToDisplay = new PolygonExtended(); if (destinationLocation == null) { return(polygonToDisplay); } double angleTeteFleche = Math.PI / 6; double longueurTeteFleche = 0.10; double headingAngle = Math.Atan2(destinationLocation.Y - robotLocation.Y, destinationLocation.X - robotLocation.X); double LongeurFleche = Math.Sqrt(Math.Pow(destinationLocation.X - robotLocation.X, 2.0) + Math.Pow(destinationLocation.Y - robotLocation.Y, 2.0)); if (LongeurFleche >= 0.100) { polygonToDisplay.polygon.Points.Add(new Point(robotLocation.X, robotLocation.Y)); polygonToDisplay.polygon.Points.Add(new Point(destinationLocation.X, destinationLocation.Y)); double angleTeteFleche1 = headingAngle + angleTeteFleche; double angleTeteFleche2 = headingAngle - angleTeteFleche; polygonToDisplay.polygon.Points.Add(new Point(destinationLocation.X - longueurTeteFleche * Math.Cos(angleTeteFleche1), destinationLocation.Y - longueurTeteFleche * Math.Sin(angleTeteFleche1))); polygonToDisplay.polygon.Points.Add(new Point(destinationLocation.X, destinationLocation.Y)); polygonToDisplay.polygon.Points.Add(new Point(destinationLocation.X - longueurTeteFleche * Math.Cos(angleTeteFleche2), destinationLocation.Y - longueurTeteFleche * Math.Sin(angleTeteFleche2))); polygonToDisplay.polygon.Points.Add(new Point(destinationLocation.X, destinationLocation.Y)); polygonToDisplay.borderWidth = 3; polygonToDisplay.borderColor = System.Drawing.Color.FromArgb(0xFF, 0x00, 0x00, 0xFF); polygonToDisplay.borderOpacity = 0.8; polygonToDisplay.backgroundColor = System.Drawing.Color.FromArgb(0x00, 0x00, 0x00, 0x00); } return(polygonToDisplay); }
public RobotDisplay(PolygonExtended pe, System.Drawing.Color color, double transparency) { location = new Location(0, 0, 0, 0, 0, 0); destinationLocation = new Location(0, 0, 0, 0, 0, 0); waypointLocation = new Location(0, 0, 0, 0, 0, 0); shape = pe; lidarMap = new List <PointD>(); displayTransparency = (int)(transparency * 255); displayColor = System.Drawing.Color.FromArgb((byte)displayTransparency, color.R, color.G, color.B); }
public void AddOrUpdatePolygonExtended(int id, PolygonExtended p) { if (polygonList.ContainsKey(id)) { polygonList[id] = p; } else { polygonList.Add(id, p); } }
public RobotDisplay(PolygonExtended rbtShape, PolygonExtended ghstShape, string name) { robotLocation = new Location(0, 0, 0, 0, 0, 0); destinationLocation = new Location(0, 0, 0, 0, 0, 0); waypointLocation = new List <PointD> { }; ghostLocation = new Location(0, 0, 0, 0, 0, 0); robotShape = rbtShape; ghostShape = ghstShape; robotName = name; ballLocationList = new List <Location>(); }
public PolygonExtended GetRobotWaypointArrow() { PolygonExtended polygonToDisplay = new PolygonExtended(); double angleTeteFleche = Math.PI / 6; double longueurTeteFleche = 0.10; polygonToDisplay.borderWidth = 2; polygonToDisplay.borderColor = System.Drawing.Color.FromArgb(0xFF, 0xFF, 0xFF, 0xFF); polygonToDisplay.borderDashPattern = new double[] { 5, 5 }; polygonToDisplay.borderOpacity = 0.8; polygonToDisplay.backgroundColor = System.Drawing.Color.FromArgb(0x00, 0x00, 0x00, 0x00); if (waypointLocation.Count == 0) { return(polygonToDisplay); } PointD lastLocation = waypointLocation[0]; PointD bfLastLocation = new PointD(robotLocation.X, robotLocation.Y); polygonToDisplay.polygon.Points.Add(new Point(robotLocation.X, robotLocation.Y)); polygonToDisplay.polygon.Points.Add(new Point(waypointLocation[0].X, waypointLocation[0].Y)); if (waypointLocation.Count > 1) { lastLocation = waypointLocation[waypointLocation.Count - 1]; bfLastLocation = waypointLocation[waypointLocation.Count - 2]; int i; for (i = 1; i < waypointLocation.Count; i++) { polygonToDisplay.polygon.Points.Add(new Point(waypointLocation[i].X, waypointLocation[i].Y)); } } double headingAngle = Math.Atan2(lastLocation.Y - bfLastLocation.Y, lastLocation.X - bfLastLocation.X); double angleTeteFleche1 = headingAngle + angleTeteFleche; double angleTeteFleche2 = headingAngle - angleTeteFleche; polygonToDisplay.polygon.Points.Add(new Point(lastLocation.X - longueurTeteFleche * Math.Cos(angleTeteFleche1), lastLocation.Y - longueurTeteFleche * Math.Sin(angleTeteFleche1))); polygonToDisplay.polygon.Points.Add(new Point(lastLocation.X, lastLocation.Y)); polygonToDisplay.polygon.Points.Add(new Point(lastLocation.X - longueurTeteFleche * Math.Cos(angleTeteFleche2), lastLocation.Y - longueurTeteFleche * Math.Sin(angleTeteFleche2))); polygonToDisplay.polygon.Points.Add(new Point(lastLocation.X, lastLocation.Y)); return(polygonToDisplay); }
public void InitRobot() { PolygonExtended robotShape = new PolygonExtended(); robotShape.polygon.Points.Add(new Point(-0.15, -0.15)); robotShape.polygon.Points.Add(new Point(0.15, -0.15)); robotShape.polygon.Points.Add(new Point(0.15, -0.05)); robotShape.polygon.Points.Add(new Point(0.25, 0)); robotShape.polygon.Points.Add(new Point(0.15, 0.05)); robotShape.polygon.Points.Add(new Point(0.15, 0.15)); robotShape.polygon.Points.Add(new Point(-0.15, 0.15)); robotShape.polygon.Points.Add(new Point(-0.15, -0.15)); RobotDisplay = new RobotDisplay(robotShape, System.Drawing.Color.Red, 1); RobotDisplay.SetPosition(0, 0, 0); }
public void InitOpponent(int robotId) { PolygonExtended robotShape = new PolygonExtended(); robotShape.polygon.Points.Add(new Point(-0.25, -0.25)); robotShape.polygon.Points.Add(new Point(0.25, -0.25)); robotShape.polygon.Points.Add(new Point(0.2, 0)); robotShape.polygon.Points.Add(new Point(0.25, 0.25)); robotShape.polygon.Points.Add(new Point(-0.25, 0.25)); robotShape.polygon.Points.Add(new Point(-0.25, -0.25)); RobotDisplay rd = new RobotDisplay(robotShape, System.Drawing.Color.Blue, 1); rd.SetPosition(0, 0, 0); OpponentDisplayDictionary.Add(robotId, rd); }
public void InitGhost() { PolygonExtended robotShape = new PolygonExtended(); robotShape.polygon.Points.Add(new Point(-0.15, -0.15)); robotShape.polygon.Points.Add(new Point(0.15, -0.15)); robotShape.polygon.Points.Add(new Point(0.15, -0.05)); robotShape.polygon.Points.Add(new Point(0.25, 0)); robotShape.polygon.Points.Add(new Point(0.15, 0.05)); robotShape.polygon.Points.Add(new Point(0.15, 0.15)); robotShape.polygon.Points.Add(new Point(-0.15, 0.15)); robotShape.polygon.Points.Add(new Point(-0.15, -0.15)); GhostDisplay = new RobotDisplay(robotShape, System.Drawing.Color.DarkSlateGray, 0.4); GhostDisplay.SetPosition(0, 0, 0); }
public List <PolygonExtended> GetRobotLidarObjects() { var polygonExtendedList = new List <PolygonExtended>(); if (this.lidarObjectList == null) { return(polygonExtendedList); } foreach (var obj in this.lidarObjectList) { PolygonExtended polygonToDisplay = new PolygonExtended(); foreach (var pt in obj.polarPointList) { polygonToDisplay.polygon.Points.Add(new Point(robotLocation.X + pt.Distance * Math.Cos(pt.Angle + robotLocation.Theta), robotLocation.Y + pt.Distance * Math.Sin(pt.Angle + robotLocation.Theta))); } //Cas des polygones à un seul point (objets représentés par leur centre : //on trace un second point juste à coté if (obj.polarPointList.Count == 1) { Point pt = polygonToDisplay.polygon.Points[0]; polygonToDisplay.polygon.Points.Add(new Point(pt.X + 0.001, pt.Y + 0.001)); } switch (obj.type) { case ObjectType.Obstacle: polygonToDisplay.borderColor = System.Drawing.Color.Red; polygonToDisplay.borderWidth = 2; polygonToDisplay.backgroundColor = System.Drawing.Color.Yellow; break; case ObjectType.Balle: polygonToDisplay.borderColor = System.Drawing.Color.Black; polygonToDisplay.borderWidth = 2; polygonToDisplay.backgroundColor = System.Drawing.Color.Yellow; break; default: polygonToDisplay.borderColor = System.Drawing.Color.Black; polygonToDisplay.borderWidth = 2; polygonToDisplay.backgroundColor = System.Drawing.Color.LightBlue; break; } polygonExtendedList.Add(polygonToDisplay); } return(polygonExtendedList); }
public PolygonExtended GetRobotGhostPolygon() { PolygonExtended polygonToDisplay = new PolygonExtended(); foreach (var pt in ghostShape.polygon.Points) { Point polyPt = new Point(pt.X * Math.Cos(ghostLocation.Theta) - pt.Y * Math.Sin(ghostLocation.Theta), pt.X * Math.Sin(ghostLocation.Theta) + pt.Y * Math.Cos(ghostLocation.Theta)); polyPt.X += ghostLocation.X; polyPt.Y += ghostLocation.Y; polygonToDisplay.polygon.Points.Add(polyPt); polygonToDisplay.backgroundColor = ghostShape.backgroundColor; polygonToDisplay.borderColor = ghostShape.borderColor; polygonToDisplay.borderWidth = ghostShape.borderWidth; } return(polygonToDisplay); }
public PolygonExtended GetRobotWaypointArrow() { PolygonExtended polygonToDisplay = new PolygonExtended(); double angleTeteFleche = Math.PI / 6; double longueurTeteFleche = 0.30; double headingAngle = Math.Atan2(waypointLocation.Y - robotLocation.Y, waypointLocation.X - robotLocation.X); polygonToDisplay.polygon.Points.Add(new Point(robotLocation.X, robotLocation.Y)); polygonToDisplay.polygon.Points.Add(new Point(waypointLocation.X, waypointLocation.Y)); double angleTeteFleche1 = headingAngle + angleTeteFleche; double angleTeteFleche2 = headingAngle - angleTeteFleche; polygonToDisplay.polygon.Points.Add(new Point(waypointLocation.X - longueurTeteFleche * Math.Cos(angleTeteFleche1), waypointLocation.Y - longueurTeteFleche * Math.Sin(angleTeteFleche1))); polygonToDisplay.polygon.Points.Add(new Point(waypointLocation.X, waypointLocation.Y)); polygonToDisplay.polygon.Points.Add(new Point(waypointLocation.X - longueurTeteFleche * Math.Cos(angleTeteFleche2), waypointLocation.Y - longueurTeteFleche * Math.Sin(angleTeteFleche2))); polygonToDisplay.polygon.Points.Add(new Point(waypointLocation.X, waypointLocation.Y)); return(polygonToDisplay); }
public PolygonExtended GetBallPolygon() { PolygonExtended polygonToDisplay = new PolygonExtended(); if (location != null) { int nbSegments = 10; double radius = 0.4; for (double theta = 0; theta <= Math.PI * 2; theta += Math.PI * 2 / nbSegments) { Point pt = new Point(radius * Math.Cos(theta), radius * Math.Sin(theta)); pt.X += location.X; pt.Y += location.Y; polygonToDisplay.polygon.Points.Add(pt); polygonToDisplay.backgroundColor = backgroundColor; polygonToDisplay.borderColor = borderColor; polygonToDisplay.borderWidth = borderWidth; } } return(polygonToDisplay); }
public RobotDisplay(PolygonExtended rbtShape, PolygonExtended ghstShape, string name) { robotLocation = new Location(0, 0, 0, 0, 0, 0); destinationLocation = new Location(0, 0, 0, 0, 0, 0); waypointLocation = new Location(0, 0, 0, 0, 0, 0); ghostLocation = new Location(0, 0, 0, 0, 0, 0); robotShape = rbtShape; ghostShape = ghstShape; robotName = name; lidarMap = new List <PointDExtended>(); for (int i = 0; i < lidarProcessedMaps.Count(); i++) { lidarProcessedMaps[i] = new List <PointDExtended>(); } //lidarProcessedMap1 = new List<PointD>(); //lidarProcessedMap2 = new List<PointD>(); //lidarProcessedMap3 = new List<PointD>(); ballLocationList = new List <Location>(); lidarSegmentList = new List <SegmentExtended>(); }
public List <PolygonExtended> GetRobotLidarObjects() { var polygonExtendedList = new List <PolygonExtended>(); if (this.lidarObjectList == null) { return(polygonExtendedList); } foreach (var obj in this.lidarObjectList) { PolygonExtended polygonToDisplay = new PolygonExtended(); foreach (var pt in obj.polarPointList) { polygonToDisplay.polygon.Points.Add(new Point(location.X + pt.Distance * Math.Cos(pt.Angle), location.Y + pt.Distance * Math.Sin(pt.Angle))); } polygonToDisplay.borderColor = obj.displayColor; polygonToDisplay.borderWidth = (float)obj.displayWidth; polygonToDisplay.backgroundColor = obj.displayColor; polygonExtendedList.Add(polygonToDisplay); } return(polygonExtendedList); }
public PolygonExtended GetRobotDestinationArrow() { PolygonExtended polygonToDisplay = new PolygonExtended(); double angleTeteFleche = Math.PI / 6; double longueurTeteFleche = 0.30; double headingAngle = Math.Atan2(destinationLocation.Y - robotLocation.Y, destinationLocation.X - robotLocation.X); polygonToDisplay.polygon.Points.Add(new Point(robotLocation.X, robotLocation.Y)); polygonToDisplay.polygon.Points.Add(new Point(destinationLocation.X, destinationLocation.Y)); double angleTeteFleche1 = headingAngle + angleTeteFleche; double angleTeteFleche2 = headingAngle - angleTeteFleche; polygonToDisplay.polygon.Points.Add(new Point(destinationLocation.X - longueurTeteFleche * Math.Cos(angleTeteFleche1), destinationLocation.Y - longueurTeteFleche * Math.Sin(angleTeteFleche1))); polygonToDisplay.polygon.Points.Add(new Point(destinationLocation.X, destinationLocation.Y)); polygonToDisplay.polygon.Points.Add(new Point(destinationLocation.X - longueurTeteFleche * Math.Cos(angleTeteFleche2), destinationLocation.Y - longueurTeteFleche * Math.Sin(angleTeteFleche2))); polygonToDisplay.polygon.Points.Add(new Point(destinationLocation.X, destinationLocation.Y)); polygonToDisplay.borderWidth = 5; polygonToDisplay.borderColor = System.Drawing.Color.FromArgb(0xFF, 0xFF, 0xFF, 0xFF); polygonToDisplay.borderDashPattern = new double[] { 5, 5 }; polygonToDisplay.borderOpacity = 0.4; polygonToDisplay.backgroundColor = System.Drawing.Color.FromArgb(0x00, 0x00, 0x00, 0x00); return(polygonToDisplay); }
void InitRoboCupSoccerField() { double TerrainLowerX = -11; double TerrainUpperX = 11; double TerrainLowerY = -7; double TerrainUpperY = 7; int fieldLineWidth = 2; PolygonExtended p = new PolygonExtended(); p.polygon.Points.Add(new System.Windows.Point(-12, -8)); p.polygon.Points.Add(new System.Windows.Point(12, -8)); p.polygon.Points.Add(new System.Windows.Point(12, 8)); p.polygon.Points.Add(new System.Windows.Point(-12, 8)); p.polygon.Points.Add(new System.Windows.Point(-12, -8)); p.borderWidth = fieldLineWidth; p.borderColor = System.Drawing.Color.FromArgb(0x00, 0x00, 0x00, 0x00); p.backgroundColor = System.Drawing.Color.FromArgb(0xFF, 0x22, 0x22, 0x22); PolygonSeries.AddOrUpdatePolygonExtended((int)Terrain.ZoneProtegee, p); p = new PolygonExtended(); p.polygon.Points.Add(new System.Windows.Point(11, -7)); p.polygon.Points.Add(new System.Windows.Point(0, -7)); p.polygon.Points.Add(new System.Windows.Point(0, 7)); p.polygon.Points.Add(new System.Windows.Point(11, 7)); p.polygon.Points.Add(new System.Windows.Point(11, -7)); p.borderWidth = fieldLineWidth; p.backgroundColor = System.Drawing.Color.FromArgb(0xFF, 0x00, 0x66, 0x00); PolygonSeries.AddOrUpdatePolygonExtended((int)Terrain.DemiTerrainDroit, p); p = new PolygonExtended(); p.polygon.Points.Add(new System.Windows.Point(-11, -7)); p.polygon.Points.Add(new System.Windows.Point(0, -7)); p.polygon.Points.Add(new System.Windows.Point(0, 7)); p.polygon.Points.Add(new System.Windows.Point(-11, 7)); p.polygon.Points.Add(new System.Windows.Point(-11, -7)); p.borderWidth = fieldLineWidth; p.backgroundColor = System.Drawing.Color.FromArgb(0xFF, 0x00, 0x66, 0x00); PolygonSeries.AddOrUpdatePolygonExtended((int)Terrain.DemiTerrainGauche, p); p = new PolygonExtended(); p.polygon.Points.Add(new System.Windows.Point(-11, -1.95)); p.polygon.Points.Add(new System.Windows.Point(-10.25, -1.95)); p.polygon.Points.Add(new System.Windows.Point(-10.25, 1.95)); p.polygon.Points.Add(new System.Windows.Point(-11.00, 1.95)); p.polygon.Points.Add(new System.Windows.Point(-11.00, -1.95)); p.borderWidth = fieldLineWidth; p.backgroundColor = System.Drawing.Color.FromArgb(0x00, 0x00, 0xFF, 0x00); PolygonSeries.AddOrUpdatePolygonExtended((int)Terrain.SurfaceButGauche, p); p = new PolygonExtended(); p.polygon.Points.Add(new System.Windows.Point(11.00, -1.95)); p.polygon.Points.Add(new System.Windows.Point(10.25, -1.95)); p.polygon.Points.Add(new System.Windows.Point(10.25, 1.95)); p.polygon.Points.Add(new System.Windows.Point(11.00, 1.95)); p.polygon.Points.Add(new System.Windows.Point(11.00, -1.95)); p.borderWidth = fieldLineWidth; p.backgroundColor = System.Drawing.Color.FromArgb(0x00, 0x00, 0xFF, 0x00); PolygonSeries.AddOrUpdatePolygonExtended((int)Terrain.SurfaceButDroit, p); p = new PolygonExtended(); p.polygon.Points.Add(new System.Windows.Point(11.00, -3.45)); p.polygon.Points.Add(new System.Windows.Point(8.75, -3.45)); p.polygon.Points.Add(new System.Windows.Point(8.75, 3.45)); p.polygon.Points.Add(new System.Windows.Point(11.00, 3.45)); p.polygon.Points.Add(new System.Windows.Point(11.00, -3.45)); p.borderWidth = fieldLineWidth; p.backgroundColor = System.Drawing.Color.FromArgb(0x00, 0x00, 0xFF, 0x00); PolygonSeries.AddOrUpdatePolygonExtended((int)Terrain.SurfaceReparationDroit, p); p = new PolygonExtended(); p.polygon.Points.Add(new System.Windows.Point(-11.00, -3.45)); p.polygon.Points.Add(new System.Windows.Point(-8.75, -3.45)); p.polygon.Points.Add(new System.Windows.Point(-8.75, 3.45)); p.polygon.Points.Add(new System.Windows.Point(-11.00, 3.45)); p.polygon.Points.Add(new System.Windows.Point(-11.00, -3.45)); p.borderWidth = fieldLineWidth; p.backgroundColor = System.Drawing.Color.FromArgb(0x00, 0x00, 0xFF, 0x00); PolygonSeries.AddOrUpdatePolygonExtended((int)Terrain.SurfaceReparationGauche, p); p = new PolygonExtended(); p.polygon.Points.Add(new System.Windows.Point(-11.00, -1.20)); p.polygon.Points.Add(new System.Windows.Point(-11.00, 1.20)); p.polygon.Points.Add(new System.Windows.Point(-11.50, 1.20)); p.polygon.Points.Add(new System.Windows.Point(-11.50, -1.20)); p.polygon.Points.Add(new System.Windows.Point(-11.00, -1.20)); p.borderWidth = fieldLineWidth; p.backgroundColor = System.Drawing.Color.FromArgb(0x00, 0x00, 0xFF, 0x00); PolygonSeries.AddOrUpdatePolygonExtended((int)Terrain.ButGauche, p); p = new PolygonExtended(); p.polygon.Points.Add(new System.Windows.Point(11.00, -1.20)); p.polygon.Points.Add(new System.Windows.Point(11.00, 1.20)); p.polygon.Points.Add(new System.Windows.Point(11.50, 1.20)); p.polygon.Points.Add(new System.Windows.Point(11.50, -1.20)); p.polygon.Points.Add(new System.Windows.Point(11.00, -1.20)); p.borderWidth = fieldLineWidth; p.backgroundColor = System.Drawing.Color.FromArgb(0x00, 0x00, 0xFF, 0x00); PolygonSeries.AddOrUpdatePolygonExtended((int)Terrain.ButDroit, p); p = new PolygonExtended(); p.polygon.Points.Add(new System.Windows.Point(-12.00, -8.00)); p.polygon.Points.Add(new System.Windows.Point(-12.00, -9.00)); p.polygon.Points.Add(new System.Windows.Point(-4.00, -9.00)); p.polygon.Points.Add(new System.Windows.Point(-4.00, -8.00)); p.polygon.Points.Add(new System.Windows.Point(-12.00, -8.00)); p.borderWidth = fieldLineWidth; p.borderColor = System.Drawing.Color.FromArgb(0x00, 0x00, 0x00, 0x00); p.backgroundColor = System.Drawing.Color.FromArgb(0xFF, 0x00, 0x00, 0xFF); PolygonSeries.AddOrUpdatePolygonExtended((int)Terrain.ZoneTechniqueGauche, p); p = new PolygonExtended(); p.polygon.Points.Add(new System.Windows.Point(+12.00, -8.00)); p.polygon.Points.Add(new System.Windows.Point(+12.00, -9.00)); p.polygon.Points.Add(new System.Windows.Point(+4.00, -9.00)); p.polygon.Points.Add(new System.Windows.Point(+4.00, -8.00)); p.polygon.Points.Add(new System.Windows.Point(+12.00, -8.00)); p.borderWidth = fieldLineWidth; p.borderColor = System.Drawing.Color.FromArgb(0x00, 0x00, 0x00, 0x00); p.backgroundColor = System.Drawing.Color.FromArgb(0xFF, 0x00, 0x00, 0xFF); PolygonSeries.AddOrUpdatePolygonExtended((int)Terrain.ZoneTechniqueDroite, p); p = new PolygonExtended(); int nbSteps = 30; for (int i = 0; i < nbSteps + 1; i++) { p.polygon.Points.Add(new System.Windows.Point(1.0f * Math.Cos((double)i * (2 * Math.PI / nbSteps)), 1.0f * Math.Sin((double)i * (2 * Math.PI / nbSteps)))); } p.borderWidth = fieldLineWidth; p.backgroundColor = System.Drawing.Color.FromArgb(0x00, 0x00, 0xFF, 0x00); PolygonSeries.AddOrUpdatePolygonExtended((int)Terrain.RondCentral, p); p = new PolygonExtended(); for (int i = 0; i < (int)(nbSteps / 4) + 1; i++) { p.polygon.Points.Add(new System.Windows.Point(-11.00 + 0.75 * Math.Cos((double)i * (2 * Math.PI / nbSteps)), -7.0 + 0.75 * Math.Sin((double)i * (2 * Math.PI / nbSteps)))); } p.borderWidth = fieldLineWidth; p.backgroundColor = System.Drawing.Color.FromArgb(0x00, 0x00, 0xFF, 0x00); PolygonSeries.AddOrUpdatePolygonExtended((int)Terrain.CornerBasGauche, p); p = new PolygonExtended(); for (int i = (int)(nbSteps / 4) + 1; i < (int)(2 * nbSteps / 4) + 1; i++) { p.polygon.Points.Add(new System.Windows.Point(11 + 0.75 * Math.Cos((double)i * (2 * Math.PI / nbSteps)), -7 + 0.75 * Math.Sin((double)i * (2 * Math.PI / nbSteps)))); } p.borderWidth = fieldLineWidth; p.backgroundColor = System.Drawing.Color.FromArgb(0x00, 0x00, 0xFF, 0x00); PolygonSeries.AddOrUpdatePolygonExtended((int)Terrain.CornerBasDroite, p); p = new PolygonExtended(); for (int i = (int)(2 * nbSteps / 4); i < (int)(3 * nbSteps / 4) + 1; i++) { p.polygon.Points.Add(new System.Windows.Point(11 + 0.75 * Math.Cos((double)i * (2 * Math.PI / nbSteps)), 7 + 0.75 * Math.Sin((double)i * (2 * Math.PI / nbSteps)))); } p.borderWidth = fieldLineWidth; p.backgroundColor = System.Drawing.Color.FromArgb(0x00, 0x00, 0xFF, 0x00); PolygonSeries.AddOrUpdatePolygonExtended((int)Terrain.CornerHautDroite, p); p = new PolygonExtended(); for (int i = (int)(3 * nbSteps / 4) + 1; i < (int)(nbSteps) + 1; i++) { p.polygon.Points.Add(new System.Windows.Point(-11 + 0.75 * Math.Cos((double)i * (2 * Math.PI / nbSteps)), 7 + 0.75 * Math.Sin((double)i * (2 * Math.PI / nbSteps)))); } p.borderWidth = fieldLineWidth; p.backgroundColor = System.Drawing.Color.FromArgb(0x00, 0x00, 0xFF, 0x00); PolygonSeries.AddOrUpdatePolygonExtended((int)Terrain.CornerHautGauche, p); p = new PolygonExtended(); for (int i = 0; i < (int)(nbSteps) + 1; i++) { p.polygon.Points.Add(new System.Windows.Point(-7.4 + 0.075 * Math.Cos((double)i * (2 * Math.PI / nbSteps)), 0.075 * Math.Sin((double)i * (2 * Math.PI / nbSteps)))); } p.borderWidth = fieldLineWidth; p.backgroundColor = System.Drawing.Color.FromArgb(0x00, 0x00, 0xFF, 0x00); PolygonSeries.AddOrUpdatePolygonExtended((int)Terrain.PtAvantSurfaceGauche, p); p = new PolygonExtended(); for (int i = 0; i < (int)(nbSteps) + 1; i++) { p.polygon.Points.Add(new System.Windows.Point(7.4 + 0.075 * Math.Cos((double)i * (2 * Math.PI / nbSteps)), 0.075 * Math.Sin((double)i * (2 * Math.PI / nbSteps)))); } p.borderWidth = fieldLineWidth; p.backgroundColor = System.Drawing.Color.FromArgb(0x00, 0x00, 0xFF, 0x00); PolygonSeries.AddOrUpdatePolygonExtended((int)Terrain.PtAvantSurfaceDroit, p); }
public void AddOrUpdatePolygonExtended(int id, PolygonExtended p) { polygonList.AddOrUpdate(id, p, (key, value) => p); }
//void InitTeam() //{ // //Team1 // for (int i = 0; i < 1; i++) // { // PolygonExtended robotShape = new PolygonExtended(); // robotShape.polygon.Points.Add(new Point(-0.25, -0.25)); // robotShape.polygon.Points.Add(new Point(0.25, -0.25)); // robotShape.polygon.Points.Add(new Point(0.2, 0)); // robotShape.polygon.Points.Add(new Point(0.25, 0.25)); // robotShape.polygon.Points.Add(new Point(-0.25, 0.25)); // robotShape.polygon.Points.Add(new Point(-0.25, -0.25)); // RobotDisplay rd = new RobotDisplay(robotShape); // rd.SetPosition((float)(i * 0.50), (float)(Math.Pow(i, 1.3) * 0.50), (float)Math.PI / 4 * i); // robotDictionary.Add((int)TeamId.Team1+i, rd); // } //} void InitSoccerField() { int fieldLineWidth = 2; PolygonExtended p = new PolygonExtended(); //p.polygon.Points.Add(new Point(-8, -4)); //p.polygon.Points.Add(new Point(8, -4)); ////p.polygon.Points.Add(new Point(12, 8)); ////p.polygon.Points.Add(new Point(-12, 8)); ////p.polygon.Points.Add(new Point(-12, -8)); //p.borderWidth = fieldLineWidth; //p.borderColor = System.Drawing.Color.FromArgb(0xFF, 0xFF, 0xFF, 0xFF); //p.backgroundColor = System.Drawing.Color.FromArgb(0xFF, 0x22, 0x22, 0x22); //PolygonSeries.AddOrUpdatePolygonExtended((int)Terrain.ZoneProtegee, p); p = new PolygonExtended(); p.polygon.Points.Add(new Point(-0.335, 0)); p.polygon.Points.Add(new Point(-0.335, 1.5)); p.polygon.Points.Add(new Point(-1.815, 1.5)); p.polygon.Points.Add(new Point(-1.815, 0)); p.polygon.Points.Add(new Point(-0.335, 0)); p.borderWidth = fieldLineWidth; p.backgroundColor = System.Drawing.Color.FromArgb(0xFF, 46, 49, 146); PolygonSeries.AddOrUpdatePolygonExtended((int)Terrain.CarreServiceHautGauche, p); p = new PolygonExtended(); p.polygon.Points.Add(new Point(-0.335, 0)); p.polygon.Points.Add(new Point(-0.335, -1.5)); p.polygon.Points.Add(new Point(-1.815, -1.5)); p.polygon.Points.Add(new Point(-1.815, 0)); p.polygon.Points.Add(new Point(-0.335, 0)); p.borderWidth = fieldLineWidth; p.backgroundColor = System.Drawing.Color.FromArgb(0xFF, 46, 49, 146); PolygonSeries.AddOrUpdatePolygonExtended((int)Terrain.CarreServiceBasGauche, p); p = new PolygonExtended(); p.polygon.Points.Add(new Point(0.335, 0)); p.polygon.Points.Add(new Point(0.335, 1.5)); p.polygon.Points.Add(new Point(1.815, 1.5)); p.polygon.Points.Add(new Point(1.815, 0)); p.polygon.Points.Add(new Point(0.335, 0)); p.borderWidth = fieldLineWidth; p.backgroundColor = System.Drawing.Color.FromArgb(0xFF, 46, 49, 146); PolygonSeries.AddOrUpdatePolygonExtended((int)Terrain.CarreServiceHautDroit, p); p = new PolygonExtended(); p.polygon.Points.Add(new Point(0.335, 0)); p.polygon.Points.Add(new Point(0.335, -1.5)); p.polygon.Points.Add(new Point(1.815, -1.5)); p.polygon.Points.Add(new Point(1.815, 0)); p.polygon.Points.Add(new Point(0.335, 0)); p.borderWidth = fieldLineWidth; p.backgroundColor = System.Drawing.Color.FromArgb(0xFF, 46, 49, 146); PolygonSeries.AddOrUpdatePolygonExtended((int)Terrain.CarreServiceBasDroit, p); p = new PolygonExtended(); p.polygon.Points.Add(new Point(-0.335, -2)); p.polygon.Points.Add(new Point(0.335, -2)); p.polygon.Points.Add(new Point(0.335, 2)); p.polygon.Points.Add(new Point(-0.335, 2)); p.polygon.Points.Add(new Point(-0.335, -2)); p.borderWidth = fieldLineWidth; p.backgroundColor = System.Drawing.Color.FromArgb(0xFF, 0xFF, 0xFF, 0xFF); PolygonSeries.AddOrUpdatePolygonExtended((int)Terrain.LigneMediane, p); p = new PolygonExtended(); p.polygon.Points.Add(new Point(0.019, -2)); p.polygon.Points.Add(new Point(0.019, 2)); p.polygon.Points.Add(new Point(-0.019, 2)); p.polygon.Points.Add(new Point(-0.019, -2)); p.polygon.Points.Add(new Point(0.019, -2)); p.borderWidth = fieldLineWidth; p.backgroundColor = System.Drawing.Color.Black; PolygonSeries.AddOrUpdatePolygonExtended((int)Terrain.LigneNoirCentrale, p); p = new PolygonExtended(); p.polygon.Points.Add(new Point(-0.335, -1.5)); p.polygon.Points.Add(new Point(-4, -1.5)); p.polygon.Points.Add(new Point(-4, -2)); p.polygon.Points.Add(new Point(-0.335, -2)); p.polygon.Points.Add(new Point(-0.335, -1.5)); p.borderWidth = fieldLineWidth; p.backgroundColor = System.Drawing.Color.FromArgb(0xFF, 46, 49, 146); PolygonSeries.AddOrUpdatePolygonExtended((int)Terrain.CouloirBasGauche, p); p = new PolygonExtended(); p.polygon.Points.Add(new Point(-0.335, 1.5)); p.polygon.Points.Add(new Point(-4, 1.5)); p.polygon.Points.Add(new Point(-4, 2)); p.polygon.Points.Add(new Point(-0.335, 2)); p.polygon.Points.Add(new Point(-0.335, 1.5)); p.borderWidth = fieldLineWidth; p.backgroundColor = System.Drawing.Color.FromArgb(0xFF, 46, 49, 146); PolygonSeries.AddOrUpdatePolygonExtended((int)Terrain.CouloirHautGauche, p); p = new PolygonExtended(); p.polygon.Points.Add(new Point(0.335, 1.5)); p.polygon.Points.Add(new Point(4, 1.5)); p.polygon.Points.Add(new Point(4, 2)); p.polygon.Points.Add(new Point(0.335, 2)); p.polygon.Points.Add(new Point(0.335, 1.5)); p.borderWidth = fieldLineWidth; p.backgroundColor = System.Drawing.Color.FromArgb(0xFF, 46, 49, 146); PolygonSeries.AddOrUpdatePolygonExtended((int)Terrain.CouloirHautDroit, p); p = new PolygonExtended(); p.polygon.Points.Add(new Point(0.335, -1.5)); p.polygon.Points.Add(new Point(4, -1.5)); p.polygon.Points.Add(new Point(4, -2)); p.polygon.Points.Add(new Point(0.335, -2)); p.polygon.Points.Add(new Point(0.335, -1.5)); p.borderWidth = fieldLineWidth; p.backgroundColor = System.Drawing.Color.FromArgb(0xFF, 46, 49, 146); PolygonSeries.AddOrUpdatePolygonExtended((int)Terrain.CouloirBasDroit, p); p = new PolygonExtended(); p.polygon.Points.Add(new Point(-1.815, 1.5)); p.polygon.Points.Add(new Point(-4, 1.5)); p.polygon.Points.Add(new Point(-4, -1.5)); p.polygon.Points.Add(new Point(-1.815, -1.5)); p.polygon.Points.Add(new Point(-1.815, 1.5)); p.borderWidth = fieldLineWidth; p.backgroundColor = System.Drawing.Color.FromArgb(0xFF, 46, 49, 146); PolygonSeries.AddOrUpdatePolygonExtended((int)Terrain.FontDeCourtGauche, p); p = new PolygonExtended(); p.polygon.Points.Add(new Point(1.815, 1.5)); p.polygon.Points.Add(new Point(4, 1.5)); p.polygon.Points.Add(new Point(4, -1.5)); p.polygon.Points.Add(new Point(1.815, -1.5)); p.polygon.Points.Add(new Point(1.815, 1.5)); p.borderWidth = fieldLineWidth; p.backgroundColor = System.Drawing.Color.FromArgb(0xFF, 46, 49, 146); PolygonSeries.AddOrUpdatePolygonExtended((int)Terrain.FontDeCourtDroit, p); p = new PolygonExtended(); p.polygon.Points.Add(new Point(-4, -0.1)); p.polygon.Points.Add(new Point(-4.2, -0.1)); p.polygon.Points.Add(new Point(-4.2, 0.1)); p.polygon.Points.Add(new Point(-4, 0.1)); p.polygon.Points.Add(new Point(-4, -0.1)); p.borderWidth = fieldLineWidth; p.backgroundColor = System.Drawing.Color.Brown; PolygonSeries.AddOrUpdatePolygonExtended((int)Terrain.BaliseGaucheFontDeCourt, p); p = new PolygonExtended(); p.polygon.Points.Add(new Point(-0.9, -2)); p.polygon.Points.Add(new Point(-0.9, -2.2)); p.polygon.Points.Add(new Point(-1.1, -2.2)); p.polygon.Points.Add(new Point(-1.1, -2)); p.polygon.Points.Add(new Point(-0.9, -2)); p.borderWidth = fieldLineWidth; p.backgroundColor = System.Drawing.Color.Brown; PolygonSeries.AddOrUpdatePolygonExtended((int)Terrain.BaliseGaucheBas, p); p = new PolygonExtended(); p.polygon.Points.Add(new Point(-0.9, 2)); p.polygon.Points.Add(new Point(-0.9, 2.2)); p.polygon.Points.Add(new Point(-1.1, 2.2)); p.polygon.Points.Add(new Point(-1.1, 2)); p.polygon.Points.Add(new Point(-0.9, 2)); p.borderWidth = fieldLineWidth; p.backgroundColor = System.Drawing.Color.Brown; PolygonSeries.AddOrUpdatePolygonExtended((int)Terrain.BaliseGaucheHaut, p); p = new PolygonExtended(); p.polygon.Points.Add(new Point(4, -0.1)); p.polygon.Points.Add(new Point(4.2, -0.1)); p.polygon.Points.Add(new Point(4.2, 0.1)); p.polygon.Points.Add(new Point(4, 0.1)); p.polygon.Points.Add(new Point(4, -0.1)); p.borderWidth = fieldLineWidth; p.backgroundColor = System.Drawing.Color.Brown; PolygonSeries.AddOrUpdatePolygonExtended((int)Terrain.BaliseDroitFontDeCourt, p); p = new PolygonExtended(); p.polygon.Points.Add(new Point(0.9, -2)); p.polygon.Points.Add(new Point(0.9, -2.2)); p.polygon.Points.Add(new Point(1.1, -2.2)); p.polygon.Points.Add(new Point(1.1, -2)); p.polygon.Points.Add(new Point(0.9, -2)); p.borderWidth = fieldLineWidth; p.backgroundColor = System.Drawing.Color.Brown; PolygonSeries.AddOrUpdatePolygonExtended((int)Terrain.BaliseDroitBas, p); p = new PolygonExtended(); p.polygon.Points.Add(new Point(0.9, 2)); p.polygon.Points.Add(new Point(0.9, 2.2)); p.polygon.Points.Add(new Point(1.1, 2.2)); p.polygon.Points.Add(new Point(1.1, 2)); p.polygon.Points.Add(new Point(0.9, 2)); p.borderWidth = fieldLineWidth; p.backgroundColor = System.Drawing.Color.Brown; PolygonSeries.AddOrUpdatePolygonExtended((int)Terrain.BaliseDroitHaut, p); }