use of com.graphhopper.util.details.PathDetailsFromEdges in project graphhopper by graphhopper.
the class Path method calcDetails.
/**
* Calculates the PathDetails for this Path. This method will return fast, if there are no calculators.
*
* @param pathBuilderFactory Generates the relevant PathBuilders
* @return List of PathDetails for this Path
*/
public Map<String, List<PathDetail>> calcDetails(List<String> requestedPathDetails, PathDetailsBuilderFactory pathBuilderFactory, int previousIndex) {
if (!isFound() || requestedPathDetails.isEmpty())
return Collections.EMPTY_MAP;
List<PathDetailsBuilder> pathBuilders = pathBuilderFactory.createPathDetailsBuilders(requestedPathDetails, encoder, weighting);
if (pathBuilders.isEmpty())
return Collections.EMPTY_MAP;
forEveryEdge(new PathDetailsFromEdges(pathBuilders, previousIndex));
Map<String, List<PathDetail>> pathDetails = new HashMap<>(pathBuilders.size());
for (PathDetailsBuilder builder : pathBuilders) {
Map.Entry<String, List<PathDetail>> entry = builder.build();
List<PathDetail> existing = pathDetails.put(entry.getKey(), entry.getValue());
if (existing != null)
throw new IllegalStateException("Some PathDetailsBuilders use duplicate key: " + entry.getKey());
}
return pathDetails;
}
Aggregations