public void RepaintMap(Rectangle[] obstacles, Rectangle destination, Road road, List<PointF> pointsForCreatingRoad) { PointF[] pointCar = null; PointF[][] detectors = null; RepaintMap(obstacles, pointCar, detectors, destination, road, pointsForCreatingRoad); }
private void DrawRoad(Road road, Graphics gr) { PointF point1 = new PointF(0, road.InterpolationPolynomialLagrandg(0)); PointF point2 = new PointF(1, road.InterpolationPolynomialLagrandg(1)); for (int i = 0; i <= WidthMap; i += 5) { DrawLineRoad(point1, point2, road.Width, gr); point1 = new PointF(point2.X, point2.Y); point2 = new PointF(i, road.InterpolationPolynomialLagrandg(i)); } foreach (var elem in road._points) { DrawPointForCreatingRoad(elem, gr); } }
/// <summary> /// Основной метод отрисовки /// </summary> /// <param name="obstacles">препятствия</param> /// <param name="pointsCar">машина</param> /// <param name="detectors">парковочные датчики машины</param> /// <param name="destination">конечная точка</param> /// <param name="road">дорога</param> public void RepaintMap(Rectangle[] obstacles, PointF[] pointsCar, PointF[][] detectors, Rectangle destination, Road road, List<PointF> pointsForCreatingRoad) { Image image = new Bitmap(pbMap.Width, pbMap.Height); Graphics next = Graphics.FromImage(image); if (road != null) DrawRoad(road, next); else { //При отрисовке дороги эти точки тоже отрисовываются. pointsForCreatingRoad?.ForEach(point => DrawPointForCreatingRoad(point, next)); } if (pointsCar != null) DrawMap(obstacles, pointsCar, detectors, destination, next); if (destination != null) DrawDestination(destination, next); pbMap.Image = image; }