Package com.graphhopper.routing.util
Class RoadDensityCalculator
java.lang.Object
com.graphhopper.routing.util.RoadDensityCalculator
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
calcRoadDensities
(Graph graph, BiConsumer<RoadDensityCalculator, EdgeIteratorState> edgeHandler, int threads) Loops over all edges of the graph and calls the given edgeHandler for each edge.double
calcRoadDensity
(EdgeIteratorState edge, double radius, ToDoubleFunction<EdgeIteratorState> calcRoadFactor)
-
Constructor Details
-
RoadDensityCalculator
-
-
Method Details
-
calcRoadDensities
public static void calcRoadDensities(Graph graph, BiConsumer<RoadDensityCalculator, EdgeIteratorState> edgeHandler, int threads) Loops over all edges of the graph and calls the given edgeHandler for each edge. This is done in parallel using the given number of threads. For every call we can calculate the road density using the provided thread local road density calculator. -
calcRoadDensity
public double calcRoadDensity(EdgeIteratorState edge, double radius, ToDoubleFunction<EdgeIteratorState> calcRoadFactor) - Parameters:
radius
- in meterscalcRoadFactor
- weighting function. use this to define how different kinds of roads shall contribute to the calculated road density- Returns:
- the road density in the vicinity of the given edge, i.e. the weighted road length divided by the squared radius
-