private void EvaluateMergingWalls(Wall wall1, Wall wall2)
        {
            bool theyAreContinuous        = wall1.IsCollinearContinuous(wall2);
            bool LengthsSumTheLimitOrLess = wall1.Length() + wall2.Length() <= Constants.MAX_WALL_LENGTH;

            if (theyAreContinuous && LengthsSumTheLimitOrLess)
            {
                MergeWalls(wall1, wall2);
            }
        }
Пример #2
0
        public bool IsCollinearContinuous(Wall otherWall)
        {
            bool continuous = false;

            if (IsConnected(otherWall))
            {
                Wall merge = MergeCollinearContinuous(otherWall);
                continuous = merge.Length() == (Length() + otherWall.Length());
            }
            return(continuous);
        }
        private void InsertOversizedWall(Wall newWall)
        {
            int   maxLengthWallsCount   = (int)(newWall.Length() / Constants.MAX_WALL_LENGTH);
            float lengthOfRemainingWall = newWall.Length() % Constants.MAX_WALL_LENGTH;
            Point vector = newWall.End() - newWall.Beginning();
            Point from   = newWall.Beginning();
            Point to;

            for (int i = 0; i < maxLengthWallsCount; i++)
            {
                to = from.PointInSameLineAtSomeDistance(vector, Constants.MAX_WALL_LENGTH);
                CreateAndPlaceWall(from, to);
                from = to;
            }
            if (lengthOfRemainingWall > 0)
            {
                to = from.PointInSameLineAtSomeDistance(vector, lengthOfRemainingWall);
                CreateAndPlaceWall(from, to);
            }
        }
 private bool Oversized(Wall aWall)
 {
     return(aWall.Length() > Constants.MAX_WALL_LENGTH);
 }