public static void DrawGrid(int gridStep, WorldTransform w, bool drawRadii, Color lineColor, Color textColor, Color radiiColor) { GLUtility.DisableNiceLines(); for (int i = (int)w.WorldLowerLeft.Y; i < w.WorldUpperRight.Y; i++) { if (i % gridStep == 0) { GLUtility.DrawLine(new GLPen(lineColor, 1.0f), (float)w.WorldLowerLeft.X, i, (float)w.WorldUpperRight.X, i); GLUtility.DrawString(i.ToString() + "m", new Font("verdana", 1), textColor, new PointF(0, i + .25f)); } } for (int i = (int)w.WorldLowerLeft.X; i < w.WorldUpperRight.X; i++) { if (i % gridStep == 0) { GLUtility.DrawLine(new GLPen(lineColor, 1.0f), i, (float)w.WorldLowerLeft.Y, i, (float)w.WorldUpperRight.Y); GLUtility.DrawString(i.ToString() + "m", new Font("verdana", 1), textColor, new PointF(i, (float)(w.WorldUpperRight.Y - w.WorldLowerLeft.Y) / 2.0f)); } } if (drawRadii) { RectangleF r = new RectangleF(new PointF(-gridStep, -gridStep), new SizeF(gridStep * 2.0f, gridStep * 2.0f)); for (int i = 0; i < 20; i++) { r.Inflate(gridStep, gridStep); GLUtility.DrawEllipse(new GLPen(radiiColor, 1), r); } } GLUtility.EnableNiceLines(); }
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 DrawCluster(PointF p, float h, float width, string label, bool rotate90) { GLUtility.GoToVehicleCoordinates(h, p, rotate90); GLPen pen = new GLPen(Color.Blue, 1.0f); GLUtility.DrawLine(pen, -width / 2, 0, width / 2, 0); GLUtility.DrawLine(pen, 0, .1f, 0, -.1f); if (label != "") { GLUtility.DrawString(label, new Font("verdana", 1.0f), Color.Black, new PointF(0, 0)); } 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(); }