Search in sources :

Example 1 with RoundaboutInstruction

use of com.graphhopper.util.RoundaboutInstruction in project graphhopper by graphhopper.

the class GraphHopperWebIT method readRoundabout.

@Test
public void readRoundabout() {
    GHRequest req = new GHRequest().addPoint(new GHPoint(52.261434, 13.485718)).addPoint(new GHPoint(52.399067, 13.469238));
    GHResponse res = gh.route(req);
    int counter = 0;
    for (Instruction i : res.getBest().getInstructions()) {
        if (i instanceof RoundaboutInstruction) {
            counter++;
            RoundaboutInstruction ri = (RoundaboutInstruction) i;
            assertEquals("turn_angle was incorrect:" + ri.getTurnAngle(), -1.5, ri.getTurnAngle(), 0.1);
            // This route contains only one roundabout and no (via) point in a roundabout
            assertEquals("exited was incorrect:" + ri.isExited(), ri.isExited(), true);
        }
    }
    assertTrue("no roundabout in route?", counter > 0);
}
Also used : GHRequest(com.graphhopper.GHRequest) RoundaboutInstruction(com.graphhopper.util.RoundaboutInstruction) Instruction(com.graphhopper.util.Instruction) RoundaboutInstruction(com.graphhopper.util.RoundaboutInstruction) GHPoint(com.graphhopper.util.shapes.GHPoint) GHResponse(com.graphhopper.GHResponse) GHPoint(com.graphhopper.util.shapes.GHPoint) Test(org.junit.Test)

Aggregations

GHRequest (com.graphhopper.GHRequest)1 GHResponse (com.graphhopper.GHResponse)1 Instruction (com.graphhopper.util.Instruction)1 RoundaboutInstruction (com.graphhopper.util.RoundaboutInstruction)1 GHPoint (com.graphhopper.util.shapes.GHPoint)1 Test (org.junit.Test)1