public static void DrawBox(PointF p, float h, float width, float length, string label, bool rotate90, DrawRef drawRef) { DrawBox(p, h, width, length, label, rotate90, drawRef, Color.Tomato); }
public static void DrawBox(PointF p, float h, float width, float length, string label, bool rotate90, DrawRef drawRef, Color color) { GLUtility.GoToVehicleCoordinates(h, p, rotate90); RectangleF r = new RectangleF(); if (drawRef == DrawRef.RearAxle) { r = new RectangleF(-width / 2, 0, width, length); } else if (drawRef == DrawRef.Center) { r = new RectangleF(-width / 2, -length / 2, width, length); } else if (drawRef == DrawRef.BottomCorner) { r = new RectangleF(0, 0, width, length); } GLPen pen = new GLPen(color, 1.0f); GLUtility.DrawRectangle(pen, r); GLUtility.DrawLine(pen, r.Left + 0.2f, r.Bottom - r.Width / 2, r.Left + r.Width / 2, r.Bottom - .2f); GLUtility.DrawLine(pen, r.Right - 0.2f, r.Bottom - r.Width / 2, r.Right - r.Width / 2, r.Bottom - .2f); if (label != "") { GLUtility.DrawString(label, new Font("verdana", 1.0f), Color.Black, r.Location); } GLUtility.ComeBackFromVehicleCoordinates(); }
public static void DrawBox(PointF p, float h, float width, float length, string label, bool rotate90, DrawRef drawRef, Color color) { GLUtility.GoToVehicleCoordinates(h, p, rotate90); RectangleF r = new RectangleF(); if (drawRef == DrawRef.RearAxle) r = new RectangleF(-width / 2, 0, width, length); else if (drawRef == DrawRef.Center) r = new RectangleF(-width / 2, -length / 2, width, length); else if (drawRef == DrawRef.BottomCorner) r = new RectangleF(0, 0, width, length); GLPen pen = new GLPen(color, 1.0f); GLUtility.DrawRectangle(pen, r); GLUtility.DrawLine(pen, r.Left + 0.2f, r.Bottom - r.Width / 2, r.Left + r.Width / 2, r.Bottom - .2f); GLUtility.DrawLine(pen, r.Right - 0.2f, r.Bottom - r.Width / 2, r.Right - r.Width / 2, r.Bottom - .2f); if (label != "") GLUtility.DrawString(label, new Font("verdana", 1.0f), Color.Black, r.Location); GLUtility.ComeBackFromVehicleCoordinates(); }