예제 #1
0
        private bool FitsInItsWall(Opening newOpening)
        {
            Wall itsWall = materials.GetWalls().FirstOrDefault(w => w.DoesContainComponent(newOpening));
            Wall pieceThatWouldOccupy = PieceOfOccupiedWall(newOpening, itsWall);

            bool fits = false;

            if (!OutOfWallBorder(pieceThatWouldOccupy, itsWall))
            {
                ICollection <Opening> thatWallsOpenings = materials.GetOpenings().Where(o => itsWall.DoesContainComponent(o)).ToList();
                fits = !thatWallsOpenings.Any(o => PieceOfOccupiedWall(o, itsWall).Overlaps(pieceThatWouldOccupy));
            }
            return(fits);
        }
 public override ICollection <Opening> GetOpenings()
 {
     return((ICollection <Opening>)materials.GetOpenings());
 }