public void Paint(Graphics g) { g.SmoothingMode = SmoothingMode.AntiAlias; // Draw the selected hexagons. foreach (HexagonData hex in collection.List()) { if (showTerrain) { PaintTerrain(hex, g); } else { PaintElevation(collection.MaxElevation, collection.MinElevation, hex, g); } } // Draw the grid. DrawHexGrid(g, Pens.Black); }
// Mutates the collection. public static void FillAll(HexagonCollection collection, int maxRow) { var seeds = collection.List().Where(h => h.Terrain.TerrainEnum != TerrainEnum.NoTerrain); if (!seeds.Any()) { throw new InvalidOperationException("Needs seeds to generate."); } else { foreach (var seed in seeds) { stack.Push(new RecursiveFillCommand() { collection = collection, hex = seed }); } } while (stack.Count > 0) { FillAllRecursive(stack.Pop(), maxRow); } }