private void DrawMap() { //pictureBox1.Image = new Bitmap(pictureBox1.Width, pictureBox1.Height); int scale = (int)Math.Ceiling((double)pictureBox1.Width / _cellMap.Width); LayeredCellMap layeredCellMap = new LayeredCellMap(_cellMap); foreach (var obstacle in _obstacles) { layeredCellMap.AddFragment(obstacle); } for (int x = 0; x < layeredCellMap.Width; x++) { for (int y = 0; y < layeredCellMap.Height; y++) { if (!layeredCellMap.IsPassable(x, y)) { int xScaled = x * scale; int yScaled = y * scale; int xDraw = xScaled; int yDraw = yScaled; _graphics.FillRectangle(_mapBrush, xDraw, yDraw, scale, scale); } } } _scale = scale; }
public void AddObstacle(ICellFragment cellCluster) { _layeredCellMap.AddFragment(cellCluster); }