public void Render(System.Drawing.Graphics g, RndfEditor.Display.Utilities.WorldTransform t) { // draw the sparse polygon of the selected if (this.Toolbox.Partition != null) { DrawingUtility.DrawControlPolygon( this.Toolbox.Partition.SparsePolygon, Color.DarkSeaGreen, System.Drawing.Drawing2D.DashStyle.Solid, g, t); foreach (Coordinates c in this.Toolbox.Partition.SparsePolygon) { DrawingUtility.DrawControlPoint(c, Color.DarkSeaGreen, null, ContentAlignment.MiddleCenter, ControlPointStyle.SmallX, g, t); } foreach (Coordinates c in this.Toolbox.tmpPolyCoords) { DrawingUtility.DrawControlPoint(c, Color.DarkViolet, null, ContentAlignment.MiddleCenter, ControlPointStyle.SmallCircle, g, t); } if (this.Toolbox.tmpPolyCoords.Count > 1) { for (int i = 0; i < this.Toolbox.tmpPolyCoords.Count - 1; i++) { DrawingUtility.DrawControlLine(this.Toolbox.tmpPolyCoords[i], this.Toolbox.tmpPolyCoords[i + 1], g, t, null, Color.DarkViolet); } } } }
/// <summary> /// Renders the lane splint /// </summary> /// <param name="g"></param> /// <param name="t"></param> /// <remarks>TODO: set lane spline</remarks> public void Render(System.Drawing.Graphics g, WorldTransform t) { Color c = DrawingUtility.ColorArbiterLaneSpline; if (DrawingUtility.DisplayArbiterLanes) { Coordinates cp = t.GetWorldPoint(new PointF(t.ScreenSize.Width / 2, t.ScreenSize.Height / 2)); Coordinates lp = this.LanePath().GetClosestPoint(cp).Location; string s = this.LaneId.ToString(); DrawingUtility.DrawControlLabel(lp, Color.DarkBlue, s, ContentAlignment.MiddleCenter, ControlPointStyle.None, g, t); } bool displayPolygon = false; switch (this.LaneId.Number) { case 1: displayPolygon = DrawingUtility.DisplayArbiterLanePolygon1; break; case 2: displayPolygon = DrawingUtility.DisplayArbiterLanePolygon2; break; case 3: displayPolygon = DrawingUtility.DisplayArbiterLanePolygon3; break; case 4: displayPolygon = DrawingUtility.DisplayArbiterLanePolygon4; break; } if (displayPolygon && this.LanePolygon != null) { // show intersection polygon HatchBrush hBrush1 = new HatchBrush(HatchStyle.ForwardDiagonal, DrawingUtility.ColorArbiterLanePolygon, Color.White); // populate polygon List <PointF> polyPoints = new List <PointF>(); foreach (Coordinates lpp in this.LanePolygon.points) { polyPoints.Add(DrawingUtility.ToPointF(lpp)); } // draw poly and fill g.FillPolygon(hBrush1, polyPoints.ToArray()); DrawingUtility.DrawControlPolygon(this.LanePolygon, DrawingUtility.ColorArbiterLanePolygon, System.Drawing.Drawing2D.DashStyle.Solid, g, t); } if (DrawingUtility.DisplayArbiterLanePath) { DrawingUtility.DrawControlLine(this.laneLinePath, g, t, new Pen(Color.MediumVioletRed), Color.MediumVioletRed); } }