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 DrawCar(PointF rearAxle, float h, int txid) * { * * //the rear axle point is just the center of the car in x and the rear of the car in y * PointF carPoint = new PointF(rearAxle.X - (carWidth / 2), rearAxle.Y); * GLUtility.GoToVehicleCoordinates(h, carPoint); * RectangleF r = new RectangleF(0, 0, carWidth, carHeight); * GLPen pen = new GLPen(Color.LightBlue, 1.0f); * GLUtility.FillTexturedRectangle(txid, r); * GLUtility.ComeBackFromVehicleCoordinates(); * } */ //0 degree heading means positive X and means EAST public static void DrawCar(PointF rearAxle, float h, Color color, string label, bool rotate90, Color labelColor) { float carWidth = (float)TahoeParams.T; float carIMUtoFront = (float)(TahoeParams.FL - TahoeParams.IL); float carHeight = (float)TahoeParams.VL; //the rear axle point is just the center of the car in x and the rear of the car in y PointF IMU = new PointF(rearAxle.X, rearAxle.Y); GLUtility.GoToVehicleCoordinates(h, IMU, rotate90); RectangleF r = new RectangleF(-carWidth / 2, carIMUtoFront - carHeight, carWidth, carHeight); 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), labelColor, new PointF(+.20f, 0)); } GLUtility.DrawCross(new GLPen(Color.Pink, 1.0f), new PointF(0, 0), r.Width / 2); GLUtility.ComeBackFromVehicleCoordinates(); }