use of com.graphhopper.util.details.PathDetail in project graphhopper by graphhopper.
the class PathTest method testCalcAverageSpeedDetails.
@Test
public void testCalcAverageSpeedDetails() {
Path p = new Dijkstra(pathDetailGraph, new ShortestWeighting(encoder), TraversalMode.NODE_BASED).calcPath(1, 5);
assertTrue(p.isFound());
Map<String, List<PathDetail>> details = p.calcDetails(Arrays.asList(new String[] { AVERAGE_SPEED }), new PathDetailsBuilderFactory(), 0);
assertTrue(details.size() == 1);
List<PathDetail> averageSpeedDetails = details.get(AVERAGE_SPEED);
assertEquals(4, averageSpeedDetails.size());
assertEquals(45.0, averageSpeedDetails.get(0).getValue());
assertEquals(90.0, averageSpeedDetails.get(1).getValue());
assertEquals(10.0, averageSpeedDetails.get(2).getValue());
assertEquals(45.0, averageSpeedDetails.get(3).getValue());
assertEquals(0, averageSpeedDetails.get(0).getFirst());
assertEquals(1, averageSpeedDetails.get(1).getFirst());
assertEquals(2, averageSpeedDetails.get(2).getFirst());
assertEquals(3, averageSpeedDetails.get(3).getFirst());
assertEquals(4, averageSpeedDetails.get(3).getLast());
}
Aggregations