public void test4() { IntersectionChecker i = new IntersectionChecker(); Edge road = new Edge(new Node(20, 155), new Node(75, 200), RoadTypes.STREET); i.fixRoad(road); RoadVisualizer.placeRoad(road, "0"); }
public Edge validateRoad(Edge road) { if (CityGeneratorUI.DebugMode) { Debug.Log("Localconstraints, checking: " + road); } // Try to legalize the position Edge newRoad = PositionLegalizer.legalizeRoad(road); if (newRoad == null) { if (CityGeneratorUI.DebugMode) { Debug.Log("Position legalizer could not fix: " + road); } return(null); } else { // Fix intersections newRoad = intersectionChecker.fixRoad(newRoad); if (newRoad == null) { if (CityGeneratorUI.DebugMode) { Debug.Log("Intersection checker could not fix: " + road); } return(null); } //Check if the road has a valid length if (!CoordinateHelper.validRoadLength(newRoad)) { if (CityGeneratorUI.DebugMode) { Debug.Log("Road was fixed but was not long enough: " + road); } return(null); } else { return(newRoad); } } }