WayGenerator

Constructors

Link copied to clipboard
constructor()

Functions

Link copied to clipboard
fun addFeature(feature: Feature)
Link copied to clipboard
fun addLine(line: ArrayList<Pair<Int, Int>>)

addLine is called for any line feature that is being added to the FeatureCollection.

Link copied to clipboard
fun addSegmentFeatureToWay(feature: Feature, currentSegment: LineString, currentSegmentLength: Double, segmentIndex: Int, way: Way)

Inside generateIntersections, first traverse every line that was added and generate a new segment Feature at every intersection that we hit. Add these to Ways as we go. Intersections are spotted using the coordinate key (x + shr(y)). Put those features in two HashMaps a 'start' an 'end' one, again keyed by the coordinate key. Once we've traversed all of the lines we should have a Way for every segment between intersections. Now we generate the intersections and add the Ways directly to them. Let's do this in a separate class for now so that we can test it.

Link copied to clipboard
fun generateWays(intersectionCollection: FeatureCollection, waysCollection: FeatureCollection, intersectionMap: HashMap<LngLatAlt, Intersection>, xTile: Int, yTile: Int, tileZoom: Int)