Search in sources :

Example 1 with GHUtility.createMockedEdgeIteratorState

use of com.graphhopper.util.GHUtility.createMockedEdgeIteratorState in project graphhopper by graphhopper.

the class FastestWeightingTest method testTime.

@Test
public void testTime() {
    FlagEncoder tmpEnc = new Bike2WeightFlagEncoder();
    GraphHopperStorage g = new GraphBuilder(EncodingManager.create(tmpEnc)).create();
    Weighting w = new FastestWeighting(tmpEnc);
    IntsRef edgeFlags = GHUtility.setSpeed(15, 15, tmpEnc, g.getEncodingManager().createEdgeFlags());
    tmpEnc.getAverageSpeedEnc().setDecimal(true, edgeFlags, 10.0);
    EdgeIteratorState edge = GHUtility.createMockedEdgeIteratorState(100000, edgeFlags);
    assertEquals(375 * 60 * 1000, w.calcEdgeMillis(edge, false));
    assertEquals(600 * 60 * 1000, w.calcEdgeMillis(edge, true));
    g.close();
}
Also used : Bike2WeightFlagEncoder(com.graphhopper.routing.util.Bike2WeightFlagEncoder) CarFlagEncoder(com.graphhopper.routing.util.CarFlagEncoder) Bike2WeightFlagEncoder(com.graphhopper.routing.util.Bike2WeightFlagEncoder) FlagEncoder(com.graphhopper.routing.util.FlagEncoder) VirtualEdgeIteratorState(com.graphhopper.routing.querygraph.VirtualEdgeIteratorState) GHUtility.createMockedEdgeIteratorState(com.graphhopper.util.GHUtility.createMockedEdgeIteratorState) GraphBuilder(com.graphhopper.storage.GraphBuilder) IntsRef(com.graphhopper.storage.IntsRef) GraphHopperStorage(com.graphhopper.storage.GraphHopperStorage) Test(org.junit.jupiter.api.Test)

Aggregations

VirtualEdgeIteratorState (com.graphhopper.routing.querygraph.VirtualEdgeIteratorState)1 Bike2WeightFlagEncoder (com.graphhopper.routing.util.Bike2WeightFlagEncoder)1 CarFlagEncoder (com.graphhopper.routing.util.CarFlagEncoder)1 FlagEncoder (com.graphhopper.routing.util.FlagEncoder)1 GraphBuilder (com.graphhopper.storage.GraphBuilder)1 GraphHopperStorage (com.graphhopper.storage.GraphHopperStorage)1 IntsRef (com.graphhopper.storage.IntsRef)1 GHUtility.createMockedEdgeIteratorState (com.graphhopper.util.GHUtility.createMockedEdgeIteratorState)1 Test (org.junit.jupiter.api.Test)1