Exemplo n.º 1
0
        private SimpleCoordinates getDivisionCoordinates(Rect rect)
        {
            DivisionPoint.setStreetParameters(Defs.vertical, rect.lowerBound.y);
            uint xDivisionPoint = DivisionPoint.getDivisionPointBetween(
                rect.lowerBound.x, rect.upperBound.x);

            DivisionPoint.setStreetParameters(Defs.horizontal,
                                              rect.lowerBound.x);
            uint yDivisionPoint = DivisionPoint.getDivisionPointBetween(
                rect.lowerBound.y, rect.upperBound.y);

            return(new SimpleCoordinates(xDivisionPoint, yDivisionPoint));
        }
Exemplo n.º 2
0
        private void makeSubMapQuadrantsOn(Rect rect)
        {
            if (!rect.canBeDividedWithAtLeast(this.minSpaceBetweenStreets) ||
                !DivisionPoint.hasDivisionWithNoAdjacentStreets(rect))
            {
                return;
            }
            SimpleCoordinates divisionCoordinates = getDivisionCoordinates(rect);

            drawStreetsAroundIn(divisionCoordinates, rect);
            (Rect firstQuadrant, Rect secondQuadrant, Rect thirdQuadrant,
             Rect fourthQuadrant) = rect.divideAt(divisionCoordinates);
            // Order matters here! Otherwise checking adjacent street corners may fail.
            makeSubMapQuadrantsOn(secondQuadrant);
            makeSubMapQuadrantsOn(thirdQuadrant);
            makeSubMapQuadrantsOn(firstQuadrant);
            makeSubMapQuadrantsOn(fourthQuadrant);
        }