Package org.opentripplanner.routing.impl

Examples of org.opentripplanner.routing.impl.MemoryGraphSource


        }
        LOG.debug("deserializing graph from POST data stream...");
        Graph graph;
        try {
            graph = Graph.load(is, level);
            server.graphService.registerGraph(routerId, new MemoryGraphSource(routerId, graph));
            return Response.status(Status.CREATED).entity(graph.toString() + "\n").build();
        } catch (Exception e) {
            return Response.status(Status.BAD_REQUEST).entity(e.toString() + "\n").build();
        }
    }
View Full Code Here


        tempDir.delete();
       
        Graph graph = graphBuilder.getGraph();
        graph.index(new DefaultStreetVertexIndexFactory());
       
        server.graphService.registerGraph(routerId, new MemoryGraphSource(routerId, graph));
        return Response.status(Status.CREATED).entity(graph.toString() + "\n").build();
    }
View Full Code Here

        if (graph != null && (params.inMemory || params.preFlight)) {
            /* Hand off graph in memory to server in a in-memory GraphSource. */
            try {
                FileInputStream graphConfiguration = new FileInputStream(params.graphConfigFile);
                Preferences config = new PropertiesPreferences(graphConfiguration);
                this.graphService.registerGraph("", new MemoryGraphSource("", graph, config));
            } catch (Exception e) {
                if (params.graphConfigFile != null)
                    LOG.error("Can't read config file", e);
                this.graphService.registerGraph("", new MemoryGraphSource("", graph));
            }
        }
        if (params.routerIds.size() > 0 || params.autoScan) {
            /* Auto-register pre-existing graph on disk, with optional auto-scan. */
            GraphScanner graphScanner = new GraphScanner(graphService, params.autoScan);
View Full Code Here

public class RoutersTest {
    @Test
    public void testRouters() {
        OTPServer otpServer = new OTPServer(new CommandLineParameters(), new GraphServiceImpl());
        otpServer.graphService.registerGraph("", new MemoryGraphSource(null, new Graph()));
        otpServer.graphService.registerGraph("A", new MemoryGraphSource("", new Graph()));
        otpServer.graphService.getGraph("A").addVertex(new ExitVertex(null, "A", 0, 0));
        otpServer.graphService.getGraph("A").addVertex(new ExitVertex(null, "B", 0, 1));
        otpServer.graphService.getGraph("A").addVertex(new ExitVertex(null, "C", 1, 1));

        Routers routerApi = new Routers();
View Full Code Here

        }
        return instance;
    }

    public Context() {
        graphService.registerGraph("", new MemoryGraphSource("", makeSimpleGraph())); // default graph is tiny test graph
        graphService.registerGraph("portland", new MemoryGraphSource("portland", graph));
        ShapefileStreetGraphBuilderImpl builder = new ShapefileStreetGraphBuilderImpl();
        FeatureSourceFactory factory = new ShapefileFeatureSourceFactoryImpl(new File(
                "src/test/resources/portland/Streets_pdx.shp"));
        builder.setFeatureSourceFactory(factory);
        ShapefileStreetSchema schema = new ShapefileStreetSchema();
View Full Code Here

TOP

Related Classes of org.opentripplanner.routing.impl.MemoryGraphSource

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.