コード例 #1
0
        /// <summary>
        /// Draws the soles into a grid. It also calculates the unset area.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="drawer">The drawer.</param>
        /// <param name="grid">The grid.</param>
        /// <param name="sealingSlabs">The sealing slabs.</param>
        /// <returns></returns>
        public List <SealingSlab> DrawSealingSlabs <T>(IDrawer <T> drawer, IGrid <T> grid, IEnumerable <SealingSlab> sealingSlabs) where T : struct
        {
            List <SealingSlab> intersectingSealingSlabs = new List <SealingSlab>();

            sealingSlabs.ToList().ForEach(sealingSlab =>
            {
                if (!grid.Intersects(sealingSlab.X, sealingSlab.Y))
                {
                    drawer.DrawSealingSlab(grid, sealingSlab.X, sealingSlab.Y, sealingSlab.Radius);
                }
                else
                {
                    intersectingSealingSlabs.Add(sealingSlab);
                }
            });

            // Only return the non-intersecting sealing slabs
            return(sealingSlabs.Except(intersectingSealingSlabs).ToList());
        }