Search in sources :

Example 11 with GraphHopperStorage

use of com.graphhopper.storage.GraphHopperStorage in project graphhopper by graphhopper.

the class PrepareRoutingSubnetworksTest method createSubnetworkTestStorage.

GraphHopperStorage createSubnetworkTestStorage() {
    GraphHopperStorage g = createStorage(em);
    // big network
    g.edge(1, 2, 1, true);
    g.edge(1, 4, 1, false);
    g.edge(1, 8, 1, true);
    g.edge(2, 4, 1, true);
    g.edge(8, 4, 1, false);
    g.edge(8, 11, 1, true);
    g.edge(12, 11, 1, true);
    g.edge(9, 12, 1, false);
    g.edge(9, 15, 1, true);
    // large network
    g.edge(0, 13, 1, true);
    g.edge(0, 3, 1, true);
    g.edge(0, 7, 1, true);
    g.edge(3, 7, 1, true);
    g.edge(3, 5, 1, true);
    g.edge(13, 5, 1, true);
    // small network
    g.edge(6, 14, 1, true);
    g.edge(10, 14, 1, true);
    return g;
}
Also used : GraphHopperStorage(com.graphhopper.storage.GraphHopperStorage)

Example 12 with GraphHopperStorage

use of com.graphhopper.storage.GraphHopperStorage in project graphhopper by graphhopper.

the class PrepareRoutingSubnetworksTest method createSubnetworkTestStorage2.

GraphHopperStorage createSubnetworkTestStorage2(EncodingManager em) {
    GraphHopperStorage g = createStorage(em);
    // large network
    g.edge(0, 1, 1, true);
    g.edge(1, 3, 1, true);
    g.edge(0, 2, 1, true);
    g.edge(2, 3, 1, true);
    g.edge(3, 7, 1, true);
    g.edge(7, 8, 1, true);
    // connecting both but do not allow CAR!
    g.edge(3, 4).setDistance(1);
    // small network
    g.edge(4, 5, 1, true);
    g.edge(5, 6, 1, true);
    g.edge(4, 6, 1, true);
    return g;
}
Also used : GraphHopperStorage(com.graphhopper.storage.GraphHopperStorage)

Example 13 with GraphHopperStorage

use of com.graphhopper.storage.GraphHopperStorage in project graphhopper by graphhopper.

the class PrepareRoutingSubnetworksTest method testRemoveDeadEndUnvisitedNetworks.

@Test
public void testRemoveDeadEndUnvisitedNetworks() {
    GraphHopperStorage g = createDeadEndUnvisitedNetworkStorage(em);
    assertEquals(11, g.getNodes());
    PrepareRoutingSubnetworks instance = new PrepareRoutingSubnetworks(g, Collections.singletonList(carFlagEncoder)).setMinOneWayNetworkSize(3);
    int removed = instance.removeDeadEndUnvisitedNetworks(new PrepEdgeFilter(carFlagEncoder));
    assertEquals(3, removed);
    instance.markNodesRemovedIfUnreachable();
    g.optimize();
    assertEquals(8, g.getNodes());
}
Also used : PrepEdgeFilter(com.graphhopper.routing.subnetwork.PrepareRoutingSubnetworks.PrepEdgeFilter) GraphHopperStorage(com.graphhopper.storage.GraphHopperStorage) Test(org.junit.Test)

Example 14 with GraphHopperStorage

use of com.graphhopper.storage.GraphHopperStorage in project graphhopper by graphhopper.

the class PrepareRoutingSubnetworksTest method createTarjanTestStorage.

GraphHopperStorage createTarjanTestStorage() {
    GraphHopperStorage g = createStorage(em);
    g.edge(1, 2, 1, false);
    g.edge(2, 3, 1, false);
    g.edge(3, 1, 1, false);
    g.edge(4, 2, 1, false);
    g.edge(4, 3, 1, false);
    g.edge(4, 5, 1, true);
    g.edge(5, 6, 1, false);
    g.edge(6, 3, 1, false);
    g.edge(6, 7, 1, true);
    g.edge(8, 5, 1, false);
    g.edge(8, 7, 1, false);
    g.edge(8, 8, 1, false);
    return g;
}
Also used : GraphHopperStorage(com.graphhopper.storage.GraphHopperStorage)

Example 15 with GraphHopperStorage

use of com.graphhopper.storage.GraphHopperStorage in project graphhopper by graphhopper.

the class AbstractEdgeElevationInterpolatorTest method setUp.

@SuppressWarnings("resource")
@Before
public void setUp() {
    dataFlagEncoder = new DataFlagEncoder();
    graph = new GraphHopperStorage(new RAMDirectory(), new EncodingManager(Arrays.asList(dataFlagEncoder, new FootFlagEncoder()), 8), true, new GraphExtension.NoOpExtension()).create(100);
    edgeElevationInterpolator = createEdgeElevationInterpolator();
    interpolatableWay = createInterpolatableWay();
    normalWay = new ReaderWay(0);
    normalWay.setTag("highway", "primary");
}
Also used : DataFlagEncoder(com.graphhopper.routing.util.DataFlagEncoder) EncodingManager(com.graphhopper.routing.util.EncodingManager) ReaderWay(com.graphhopper.reader.ReaderWay) FootFlagEncoder(com.graphhopper.routing.util.FootFlagEncoder) RAMDirectory(com.graphhopper.storage.RAMDirectory) GraphHopperStorage(com.graphhopper.storage.GraphHopperStorage) GraphExtension(com.graphhopper.storage.GraphExtension) Before(org.junit.Before)

Aggregations

GraphHopperStorage (com.graphhopper.storage.GraphHopperStorage)33 Test (org.junit.Test)25 GraphBuilder (com.graphhopper.storage.GraphBuilder)8 EncodingManager (com.graphhopper.routing.util.EncodingManager)7 PrepEdgeFilter (com.graphhopper.routing.subnetwork.PrepareRoutingSubnetworks.PrepEdgeFilter)6 EdgeIteratorState (com.graphhopper.util.EdgeIteratorState)5 IntArrayList (com.carrotsearch.hppc.IntArrayList)4 FastestWeighting (com.graphhopper.routing.weighting.FastestWeighting)4 EdgeExplorer (com.graphhopper.util.EdgeExplorer)4 CarFlagEncoder (com.graphhopper.routing.util.CarFlagEncoder)3 FlagEncoder (com.graphhopper.routing.util.FlagEncoder)3 Weighting (com.graphhopper.routing.weighting.Weighting)3 RAMDirectory (com.graphhopper.storage.RAMDirectory)3 TurnCostExtension (com.graphhopper.storage.TurnCostExtension)3 GraphHopper (com.graphhopper.GraphHopper)2 EdgeFilter (com.graphhopper.routing.util.EdgeFilter)2 HintsMap (com.graphhopper.routing.util.HintsMap)2 AlgoHelperEntry (com.graphhopper.routing.util.TestAlgoCollector.AlgoHelperEntry)2 CHGraph (com.graphhopper.storage.CHGraph)2 GraphExtension (com.graphhopper.storage.GraphExtension)2