Search in sources :

Example 11 with DataImportIssueStore

use of org.opentripplanner.graph_builder.DataImportIssueStore in project OpenTripPlanner by opentripplanner.

the class TestUnconnectedAreas method testUnconnectedParkAndRide.

/**
 * The P+R.osm.gz file contains 2 park and ride, one a single way area and the other a
 * multipolygon with a hole. Both are not linked to any street, apart from three roads that
 * crosses the P+R with w/o common nodes.
 *
 * This test just make sure we correctly link those P+R with the street network by creating
 * virtual nodes at the place where the street intersects the P+R areas. See ticket #1562.
 */
@Test
public void testUnconnectedParkAndRide() throws Exception {
    Graph gg = new Graph();
    DataImportIssueStore issueStore = new DataImportIssueStore(true);
    OpenStreetMapModule loader = new OpenStreetMapModule();
    loader.setDefaultWayPropertySetSource(new DefaultWayPropertySetSource());
    File file = new File(getClass().getResource("P+R.osm.pbf").getFile());
    BinaryOpenStreetMapProvider provider = new BinaryOpenStreetMapProvider(file, false);
    loader.setProvider(provider);
    loader.buildGraph(gg, new HashMap<Class<?>, Object>(), issueStore);
    assertEquals(1, issueStore.getIssues().size());
    int nParkAndRide = 0;
    int nParkAndRideLink = 0;
    for (Vertex v : gg.getVertices()) {
        if (v instanceof ParkAndRideVertex) {
            nParkAndRide++;
        }
    }
    for (Edge e : gg.getEdges()) {
        if (e instanceof ParkAndRideLinkEdge) {
            nParkAndRideLink++;
        }
    }
    assertEquals(2, nParkAndRide);
    assertEquals(10, nParkAndRideLink);
}
Also used : Vertex(org.opentripplanner.routing.graph.Vertex) ParkAndRideVertex(org.opentripplanner.routing.vertextype.ParkAndRideVertex) ParkAndRideLinkEdge(org.opentripplanner.routing.edgetype.ParkAndRideLinkEdge) BinaryOpenStreetMapProvider(org.opentripplanner.openstreetmap.BinaryOpenStreetMapProvider) Graph(org.opentripplanner.routing.graph.Graph) ParkAndRideVertex(org.opentripplanner.routing.vertextype.ParkAndRideVertex) DataImportIssueStore(org.opentripplanner.graph_builder.DataImportIssueStore) File(java.io.File) ParkAndRideLinkEdge(org.opentripplanner.routing.edgetype.ParkAndRideLinkEdge) ParkAndRideEdge(org.opentripplanner.routing.edgetype.ParkAndRideEdge) Edge(org.opentripplanner.routing.graph.Edge) Test(org.junit.Test)

Example 12 with DataImportIssueStore

use of org.opentripplanner.graph_builder.DataImportIssueStore in project OpenTripPlanner by opentripplanner.

the class BikeRentalUpdater method setup.

@Override
public void setup(Graph graph) {
    // Creation of network linker library will not modify the graph
    linker = new SimpleStreetSplitter(graph, new DataImportIssueStore(false));
    // Adding a bike rental station service needs a graph writer runnable
    service = graph.getService(BikeRentalStationService.class, true);
}
Also used : DataImportIssueStore(org.opentripplanner.graph_builder.DataImportIssueStore) BikeRentalStationService(org.opentripplanner.routing.bike_rental.BikeRentalStationService) SimpleStreetSplitter(org.opentripplanner.graph_builder.linking.SimpleStreetSplitter)

Aggregations

DataImportIssueStore (org.opentripplanner.graph_builder.DataImportIssueStore)12 Test (org.junit.Test)5 Graph (org.opentripplanner.routing.graph.Graph)4 OtpTransitServiceBuilder (org.opentripplanner.model.impl.OtpTransitServiceBuilder)3 File (java.io.File)2 ArrayList (java.util.ArrayList)2 SimpleStreetSplitter (org.opentripplanner.graph_builder.linking.SimpleStreetSplitter)2 Stop (org.opentripplanner.model.Stop)2 HierarchicalVersionMapById (org.opentripplanner.netex.loader.util.HierarchicalVersionMapById)2 BinaryOpenStreetMapProvider (org.opentripplanner.openstreetmap.BinaryOpenStreetMapProvider)2 BikeRentalStationService (org.opentripplanner.routing.bike_rental.BikeRentalStationService)2 TransitStopVertex (org.opentripplanner.routing.vertextype.TransitStopVertex)2 Quay (org.rutebanken.netex.model.Quay)2 Iterables (com.google.common.collect.Iterables)1 TLongList (gnu.trove.list.TLongList)1 Collections (java.util.Collections)1 Comparator (java.util.Comparator)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1