private void DrawClusters(Graphics painter, IMazeView maze, MazeClusters clusters)
        {
            int clustersNumber = clusters.Count();

            Brush[] brushes = new Brush[clustersNumber];
            for (int i = 0; i < brushes.Length; i++)
            {
                brushes[i] = new SolidBrush(Palette.GetColor(i + 1));
            }

            for (int row = 0; row < maze.RowCount; row++)
            {
                for (int col = 0; col < maze.ColCount; col++)
                {
                    int BaseX = col * cellSize;
                    int BaseY = row * cellSize;

                    if (!clusters.IsNonclustered(row, col))
                    {
                        int circleShift = cellSize / 2 - circleSize / 2;
                        int brushIndex  = clusters.GetClusterIndex(row, col) - 1;
                        painter.FillEllipse(brushes[brushIndex],
                                            BaseX + circleShift,
                                            BaseY + circleShift,
                                            circleSize, circleSize);
                    }
                }
            }
        }
Esempio n. 2
0
        protected virtual void DrawClusters(Graphics graphics, MazeClusters clusters)
        {
            int clustersNumber = clusters.Count();

            Brush[] brushes = new Brush[clustersNumber];
            for (int i = 0; i < brushes.Length; i++)
            {
                brushes[i] = new SolidBrush(Palette.GetColor(i + 1));
            }

            int cellWidth  = drawingSettings.CellWidth;
            int cellHeight = drawingSettings.CellHeight;

            for (int row = 0; row < rowCount; row++)
            {
                for (int col = 0; col < colCount; col++)
                {
                    int index = clusters.GetClusterIndex(row, col);
                    if (index > 0)
                    {
                        Rectangle cellRect = new Rectangle(col * cellWidth, row * cellHeight,
                                                           cellWidth, cellHeight);

                        graphics.FillRectangle(brushes[index - 1], cellRect);
                    }
                }
            }
        }
Esempio n. 3
0
        private void CreateClusterBrushes(MazeClusters clusters)
        {
            int count = clusters.Count();

            clustersBrushes = new Brush[count];
            for (int i = 0; i < count; i++)
            {
                clustersBrushes[i] = new SolidBrush(Palette.GetColor(i + 1));
            }
        }