Package org.opentripplanner.routing.graph

Examples of org.opentripplanner.routing.graph.Graph


        cs[1] = b.getCoordinate();
        return factory.createLineString(cs);
    }

    public void setUp() {
        graph = new Graph();
        // a 0.1 degree x 0.1 degree square
        tl = new IntersectionVertex(graph, "tl", -74.01, 40.01);
        tr = new IntersectionVertex(graph, "tr", -74.0, 40.01);
        bl = new IntersectionVertex(graph, "bl", -74.01, 40.0);
        br = new IntersectionVertex(graph, "br", -74.00, 40.0);
View Full Code Here


   
    private RoutingRequest proto;

    @Before
    public void before() {
        _graph = new Graph();

        // Graph for a fictional grid city with turn restrictions
        StreetVertex maple1 = vertex("maple_1st", 2.0, 2.0);
        StreetVertex maple2 = vertex("maple_2nd", 1.0, 2.0);
        StreetVertex maple3 = vertex("maple_3rd", 0.0, 2.0);
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

    private Graph _graph;

    @Before
    public void before() {

        _graph = new Graph();

        vertex("56th_24th", 47.669457, -122.387577);
        vertex("56th_22nd", 47.669462, -122.384739);
        vertex("56th_20th", 47.669457, -122.382106);
View Full Code Here

        return factory.createLineString(cs);
    }

    @Before
    public void before() {
        graph = new Graph();
        // a 0.1 degree x 0.1 degree square
        tl = new IntersectionVertex(graph, "tl", -74.01, 40.01);
        tr = new IntersectionVertex(graph, "tr", -74.0, 40.01);
        bl = new IntersectionVertex(graph, "bl", -74.01, 40.0);
        br = new IntersectionVertex(graph, "br", -74.00, 40.0);
View Full Code Here

    private Graph graph;
    private StreetVertex A,B,C,D;

    @Override
    protected void setUp() throws Exception {
        graph = new Graph();

        // Generate a very simple graph
        A = new IntersectionVertex(graph, "A", 0.000, 45, "A");
        B = new IntersectionVertex(graph, "B", 0.001, 45, "B");
        C = new IntersectionVertex(graph, "C", 0.002, 45, "C");
View Full Code Here

        station.name = "bike rental station";
        service.addBikeRentalStation(station);
    }

    private Graph makeSimpleGraph() {
        Graph graph = new Graph();
        StreetVertex tl = new IntersectionVertex(graph, "tl", -80.01, 40.01, "top and left");
        StreetVertex tr = new IntersectionVertex(graph, "tr", -80.0, 40.01, "top and right");
        StreetVertex bl = new IntersectionVertex(graph, "bl", -80.01, 40.0, "bottom and left");
        StreetVertex br = new IntersectionVertex(graph, "br", -80.0, 40.0, "bottom and right");
View Full Code Here

    GenericAStar aStar = new GenericAStar();

    public void testBannedRoutes() {

        Graph graph = ConstantsForTests.getInstance().getPortlandGraph();

        RoutingRequest options = new RoutingRequest();
        Vertex start = graph.getVertex("TriMet:8371");
        Vertex end = graph.getVertex("TriMet:8374");
        options.dateTime = TestUtils.dateInSeconds("America/Los_Angeles", 2009, 11, 1, 12, 34, 25);
        // must set routing context _after_ options is fully configured (time)
        options.setRoutingContext(graph, start, end);
        ShortestPathTree spt = null;
View Full Code Here

     * @param partial True to test partial trip banning, false for complete trip
     * @param seed Value to use for random generator seed -- Keep the same value for consistency.
     */
    public void doTestBannedTrips(boolean partial, int seed) {

        Graph graph = ConstantsForTests.getInstance().getPortlandGraph();
        Random rand = new Random(seed);

        for (int i = 0; i < 20; i++) {
            RoutingRequest options = new RoutingRequest();
            options.dateTime = TestUtils.dateInSeconds("America/Los_Angeles", 2009, 11, 1, 12, 34,
                    25);
            // Pick two random locations
            Vertex start = null;
            Vertex end = null;
            while (start == null)
                start = graph.getVertex("TriMet:" + rand.nextInt(10000));
            while (end == null)
                end = graph.getVertex("TriMet:" + rand.nextInt(10000));
            options.setRoutingContext(graph, start, end);
            ShortestPathTree spt = null;

            int n = rand.nextInt(5) + 3;
            for (int j = 0; j < n; j++) {
View Full Code Here

import org.opentripplanner.routing.vertextype.StreetVertex;

public class TestBikeRental extends TestCase {
    public void testBasic() throws Exception {
        // generate a very simple graph
        Graph graph = new Graph();
        StreetVertex v1 = new IntersectionVertex(graph, "v1", -77.0492, 38.856, "v1");
        StreetVertex v2 = new IntersectionVertex(graph, "v2", -77.0492, 38.857, "v2");
        StreetVertex v3 = new IntersectionVertex(graph, "v3", -77.0492, 38.858, "v3");

        @SuppressWarnings("unused")
View Full Code Here

TOP

Related Classes of org.opentripplanner.routing.graph.Graph

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.