public void Generate(BaseLayer parentLayer) { DistrictLayer = parentLayer as DistrictLayer; StreetGraph = new Graph <Vertex>(); //BuildStreetGraph(); var pointOnBounds = CreatePointOnBounds(StreetCount); for (var i = 0; i < StreetCount; i++) { var street = new List <Vertex>(); // Generate points var vertexOnBounds = Vertex.Factory.Create(pointOnBounds[i]); var maxSegmentLength = StreetSmoothness == 0 ? 1f : 0.5f / StreetSmoothness; if (vertexOnBounds.FindClosestIn(DistrictLayer.DistrictControlPoints, out var closestPointToStart)) { var connection1 = GeometryUtils.CreateLineTowardsPoint(vertexOnBounds, closestPointToStart, maxSegmentLength, StreetNoise); street.AddRange(connection1); AddLineToGraph(street); } } }
public void Generate(BaseLayer parentLayer) { DistrictLayer = parentLayer as DistrictLayer; if (DistrictLayer == null) { throw new Exception($"Cannot cast parent layer to type {typeof(DistrictLayer).Name} "); } TernaryStreetGraph = new Graph<Vertex>(); PolygonIdToNeighborhoodMap = new Dictionary<Polygon, WardData>(); Neighborhoods = new List<Polygon>(); DevelopNeighborhoods(); SubdivideNeighborhoods(); CreateTernaryStreetGraph(); }