Examples of ExitVertex


Examples of org.opentripplanner.routing.vertextype.ExitVertex

        RoutingRequest options = new RoutingRequest("BICYCLE_RENT,TRANSIT");

        Graph graph = new Graph();

        // Vertices for leg 0
        ExitVertex v0 = new ExitVertex(
                graph, "Vertex 0", 0, 0);
        IntersectionVertex v2 = new IntersectionVertex(
                graph, "Vertex 2", 0, 0);
        IntersectionVertex v4 = new IntersectionVertex(
                graph, "Vertex 4", 1, 1);

        // Stops for legs 1, 2 and 4, plus initialization and storage in a list
        Stop trainStopDepart = new Stop();
        Stop trainStopDwell = new Stop();
        Stop trainStopInterline = new Stop();
        Stop trainStopArrive = new Stop();
        Stop ferryStopDepart = new Stop();
        Stop ferryStopArrive = new Stop();

        trainStopDepart.setId(new AgencyAndId("Train", "Depart"));
        trainStopDepart.setName("Train stop depart");
        trainStopDepart.setLon(1);
        trainStopDepart.setLat(1);
        trainStopDepart.setCode("Train depart code");
        trainStopDepart.setPlatformCode("Train depart platform");
        trainStopDepart.setZoneId("Train depart zone");
        trainStopDwell.setId(new AgencyAndId("Train", "Dwell"));
        trainStopDwell.setName("Train stop dwell");
        trainStopDwell.setLon(45);
        trainStopDwell.setLat(23);
        trainStopDwell.setCode("Train dwell code");
        trainStopDwell.setPlatformCode("Train dwell platform");
        trainStopDwell.setZoneId("Train dwell zone");
        trainStopInterline.setId(new AgencyAndId("Train", "Interline"));
        trainStopInterline.setName("Train stop interline");
        trainStopInterline.setLon(89);
        trainStopInterline.setLat(45);
        trainStopInterline.setCode("Train interline code");
        trainStopInterline.setPlatformCode("Train interline platform");
        trainStopInterline.setZoneId("Train interline zone");
        trainStopArrive.setId(new AgencyAndId("Train", "Arrive"));
        trainStopArrive.setName("Train stop arrive");
        trainStopArrive.setLon(133);
        trainStopArrive.setLat(67);
        trainStopArrive.setCode("Train arrive code");
        trainStopArrive.setPlatformCode("Train arrive platform");
        trainStopArrive.setZoneId("Train arrive zone");
        ferryStopDepart.setId(new AgencyAndId("Ferry", "Depart"));
        ferryStopDepart.setName("Ferry stop depart");
        ferryStopDepart.setLon(135);
        ferryStopDepart.setLat(67);
        ferryStopDepart.setCode("Ferry depart code");
        ferryStopDepart.setPlatformCode("Ferry depart platform");
        ferryStopDepart.setZoneId("Ferry depart zone");
        ferryStopArrive.setId(new AgencyAndId("Ferry", "Arrive"));
        ferryStopArrive.setName("Ferry stop arrive");
        ferryStopArrive.setLon(179);
        ferryStopArrive.setLat(89);
        ferryStopArrive.setCode("Ferry arrive code");
        ferryStopArrive.setPlatformCode("Ferry arrive platform");
        ferryStopArrive.setZoneId("Ferry arrive zone");

        ArrayList<Stop> firstStops = new ArrayList<Stop>();
        ArrayList<Stop> secondStops = new ArrayList<Stop>();
        ArrayList<Stop> thirdStops = new ArrayList<Stop>();

        firstStops.add(trainStopDepart);
        firstStops.add(trainStopDwell);
        firstStops.add(trainStopInterline);
        secondStops.add(trainStopInterline);
        secondStops.add(trainStopArrive);
        thirdStops.add(ferryStopDepart);
        thirdStops.add(ferryStopArrive);

        // Agencies for legs 1, 2 and 4, plus initialization
        Agency trainAgency = new Agency();
        Agency ferryAgency = new Agency();

        trainAgency.setId("Train");
        trainAgency.setName("John Train");
        trainAgency.setUrl("http://www.train.org/");
        ferryAgency.setId("Ferry");
        ferryAgency.setName("Brian Ferry");
        ferryAgency.setUrl("http://www.ferry.org/");

        // Routes for legs 1, 2 and 4, plus initialization
        Route firstRoute = new Route();
        Route secondRoute = new Route();
        Route thirdRoute = new Route();

        firstRoute.setId(new AgencyAndId("Train", "A"));
        firstRoute.setAgency(trainAgency);
        firstRoute.setShortName("A");
        firstRoute.setLongName("'A' Train");
        firstRoute.setType(2);
        firstRoute.setColor("White");
        firstRoute.setTextColor("Black");
        secondRoute.setId(new AgencyAndId("Train", "B"));
        secondRoute.setAgency(trainAgency);
        secondRoute.setShortName("B");
        secondRoute.setLongName("Another Train");
        secondRoute.setType(2);
        secondRoute.setColor("Cyan");
        secondRoute.setTextColor("Yellow");
        thirdRoute.setId(new AgencyAndId("Ferry", "C"));
        thirdRoute.setAgency(ferryAgency);
        thirdRoute.setShortName("C");
        thirdRoute.setLongName("Ferry Cross the Mersey");
        thirdRoute.setType(4);
        thirdRoute.setColor("Black");
        thirdRoute.setTextColor("White");

        // Trips for legs 1, 2 and 4, plus initialization
        Trip firstTrip = new Trip();
        Trip secondTrip = new Trip();
        Trip thirdTrip = new Trip();

        firstTrip.setId(new AgencyAndId("Train", "A"));
        firstTrip.setTripShortName("A");
        firstTrip.setBlockId("Alock");
        firstTrip.setRoute(firstRoute);
        BikeAccess.setForTrip(firstTrip, BikeAccess.ALLOWED);
        firstTrip.setTripHeadsign("Street Fighting Man");
        secondTrip.setId(new AgencyAndId("Train", "B"));
        secondTrip.setTripShortName("B");
        secondTrip.setBlockId("Block");
        secondTrip.setRoute(secondRoute);
        BikeAccess.setForTrip(secondTrip, BikeAccess.ALLOWED);
        secondTrip.setTripHeadsign("No Expectations");
        thirdTrip.setId(new AgencyAndId("Ferry", "C"));
        thirdTrip.setTripShortName("C");
        thirdTrip.setBlockId("Clock");
        thirdTrip.setRoute(thirdRoute);
        BikeAccess.setForTrip(thirdTrip, BikeAccess.ALLOWED);
        thirdTrip.setTripHeadsign("Handsome Molly");

        // Scheduled stop times for legs 1, 2 and 4, plus initialization and storage in a list
        StopTime trainStopDepartTime = new StopTime();
        StopTime trainStopDwellTime = new StopTime();
        StopTime trainStopInterlineFirstTime = new StopTime();
        StopTime trainStopInterlineSecondTime = new StopTime();
        StopTime trainStopArriveTime = new StopTime();
        StopTime ferryStopDepartTime = new StopTime();
        StopTime ferryStopArriveTime = new StopTime();

        trainStopDepartTime.setTrip(firstTrip);
        trainStopDepartTime.setStop(trainStopDepart);
        trainStopDepartTime.setStopSequence(Integer.MIN_VALUE);
        trainStopDepartTime.setDepartureTime(4);
        trainStopDepartTime.setPickupType(3);
        trainStopDwellTime.setTrip(firstTrip);
        trainStopDwellTime.setStop(trainStopDwell);
        trainStopDwellTime.setStopSequence(0);
        trainStopDwellTime.setArrivalTime(8);
        trainStopDwellTime.setDepartureTime(12);
        trainStopInterlineFirstTime.setTrip(firstTrip);
        trainStopInterlineFirstTime.setStop(trainStopInterline);
        trainStopInterlineFirstTime.setStopSequence(Integer.MAX_VALUE);
        trainStopInterlineFirstTime.setArrivalTime(16);
        trainStopInterlineSecondTime.setTrip(secondTrip);
        trainStopInterlineSecondTime.setStop(trainStopInterline);
        trainStopInterlineSecondTime.setStopSequence(0);
        trainStopInterlineSecondTime.setDepartureTime(20);
        trainStopArriveTime.setTrip(secondTrip);
        trainStopArriveTime.setStop(trainStopArrive);
        trainStopArriveTime.setStopSequence(1);
        trainStopArriveTime.setArrivalTime(24);
        trainStopArriveTime.setDropOffType(2);
        ferryStopDepartTime.setTrip(thirdTrip);
        ferryStopDepartTime.setStop(ferryStopDepart);
        ferryStopDepartTime.setStopSequence(-1);
        ferryStopDepartTime.setDepartureTime(32);
        ferryStopDepartTime.setPickupType(2);
        ferryStopArriveTime.setTrip(thirdTrip);
        ferryStopArriveTime.setStop(ferryStopArrive);
        ferryStopArriveTime.setStopSequence(0);
        ferryStopArriveTime.setArrivalTime(36);
        ferryStopArriveTime.setDropOffType(3);

        ArrayList<StopTime> firstStopTimes = new ArrayList<StopTime>();
        ArrayList<StopTime> secondStopTimes = new ArrayList<StopTime>();
        ArrayList<StopTime> thirdStopTimes = new ArrayList<StopTime>();

        firstStopTimes.add(trainStopDepartTime);
        firstStopTimes.add(trainStopDwellTime);
        firstStopTimes.add(trainStopInterlineFirstTime);
        secondStopTimes.add(trainStopInterlineSecondTime);
        secondStopTimes.add(trainStopArriveTime);
        thirdStopTimes.add(ferryStopDepartTime);
        thirdStopTimes.add(ferryStopArriveTime);

        // Various patterns that are required to construct a full graph path, plus initialization
        StopPattern firstStopPattern  = new StopPattern(firstStopTimes);
        StopPattern secondStopPattern = new StopPattern(secondStopTimes);
        StopPattern thirdStopPattern  = new StopPattern(thirdStopTimes);

        TripPattern firstTripPattern  = new TripPattern(firstRoute, firstStopPattern);
        TripPattern secondTripPattern = new TripPattern(secondRoute, secondStopPattern);
        TripPattern thirdTripPattern  = new TripPattern(thirdRoute, thirdStopPattern);

        TripTimes firstTripTimes  = new TripTimes(firstTrip, firstStopTimes, new Deduplicator());
        TripTimes secondTripTimes = new TripTimes(secondTrip, secondStopTimes, new Deduplicator());
        TripTimes thirdTripTimes  = new TripTimes(thirdTrip, thirdStopTimes, new Deduplicator());

        firstTripPattern.add(firstTripTimes);
        secondTripPattern.add(secondTripTimes);
        thirdTripPattern.add(thirdTripTimes);

        // Vertices for legs 1, 2 and 3
        TransitStop v6 = new TransitStop(graph, trainStopDepart);
        TransitStopDepart v8 = new TransitStopDepart(graph, trainStopDepart, v6);
        // To understand the stop indexes in the vertex constructors, look at firstStopTimes.add() etc. above
        PatternDepartVertex v10 = new PatternDepartVertex(graph, firstTripPattern, 0);
        PatternArriveVertex v12 = new PatternArriveVertex(graph, firstTripPattern, 1);
        PatternDepartVertex v14 = new PatternDepartVertex(graph, firstTripPattern, 1);
        PatternArriveVertex v16 = new PatternArriveVertex(graph, firstTripPattern, 2);
        PatternDepartVertex v18 = new PatternDepartVertex(graph, secondTripPattern, 0);
        PatternArriveVertex v20 = new PatternArriveVertex(graph, secondTripPattern, 1);
        TransitStop v24 = new TransitStop(graph, trainStopArrive);
        TransitStopArrive v22 = new TransitStopArrive(graph, trainStopArrive, v24);

        // Vertices for legs 3 and 4
        TransitStop v26 = new TransitStop(graph, ferryStopDepart);
        TransitStopDepart v28 = new TransitStopDepart(graph, ferryStopDepart, v26);
        PatternDepartVertex v30 = new PatternDepartVertex(graph, thirdTripPattern, 0);
        PatternArriveVertex v32 = new PatternArriveVertex(graph, thirdTripPattern, 1);
        TransitStop v36 = new TransitStop(graph, ferryStopArrive);
        TransitStopArrive v34 = new TransitStopArrive(graph, ferryStopArrive, v36);

        // Vertices for leg 5
        IntersectionVertex v38 = new IntersectionVertex(graph, "Vertex 38", 179, 89);
        IntersectionVertex v40 = new IntersectionVertex(graph, "Vertex 40", 180, 89);
        IntersectionVertex v42 = new IntersectionVertex(graph, "Vertex 42", 180, 90);

        // Bike rental stations for legs 5, 6 and 7, plus initialization
        BikeRentalStation enterPickupStation = new BikeRentalStation();
        BikeRentalStation exitPickupStation = new BikeRentalStation();
        BikeRentalStation enterDropoffStation = new BikeRentalStation();
        BikeRentalStation exitDropoffStation = new BikeRentalStation();

        enterPickupStation.id = "Enter pickup";
        enterPickupStation.name = "Enter pickup station";
        enterPickupStation.x = 180;
        enterPickupStation.y = 90;
        exitPickupStation.id = "Exit pickup";
        exitPickupStation.name = "Exit pickup station";
        exitPickupStation.x = 180;
        exitPickupStation.y = 90;
        enterDropoffStation.id = "Enter dropoff";
        enterDropoffStation.name = "Enter dropoff station";
        enterDropoffStation.x = 0;
        enterDropoffStation.y = 90;
        exitDropoffStation.id = "Exit dropoff";
        exitDropoffStation.name = "Exit dropoff station";
        exitDropoffStation.x = 0;
        exitDropoffStation.y = 90;

        // Vertices for legs 5 and 6
        BikeRentalStationVertex v44 = new BikeRentalStationVertex(
                graph, enterPickupStation);
        BikeRentalStationVertex v46 = new BikeRentalStationVertex(
                graph, exitPickupStation);
        IntersectionVertex v48 = new IntersectionVertex(
                graph, "Vertex 48", 180, 90);
        IntersectionVertex v50 = new IntersectionVertex(
                graph, "Vertex 50", 90, 90);

        // Vertices for leg 7
        IntersectionVertex v52 = new IntersectionVertex(
                graph, "Vertex 52", 90, 90);
        IntersectionVertex v54 = new IntersectionVertex(
                graph, "Vertex 54", 0, 90);

        // Vertices for legs 7 and 8
        BikeRentalStationVertex v56 = new BikeRentalStationVertex(
                graph, enterDropoffStation);
        BikeRentalStationVertex v58 = new BikeRentalStationVertex(
                graph, exitDropoffStation);
        StreetLocation v60 = new StreetLocation(
                graph, "Vertex 60", new Coordinate(0, 90), "Vertex 60");

        // Vertex initialization that can't be done using the constructor
        v0.setExitName("Ausfahrt");
        v2.freeFlowing = (true);
        v4.freeFlowing = (true);
        v38.freeFlowing = (true);
        v40.freeFlowing = (true);
        v42.freeFlowing = (true);
View Full Code Here

Examples of org.opentripplanner.routing.vertextype.ExitVertex

                String label = getNodeLabel(node);
                String highway = node.getTag("highway");
                if ("motorway_junction".equals(highway)) {
                    String ref = node.getTag("ref");
                    if (ref != null) {
                        ExitVertex ev = new ExitVertex(graph, label, coordinate.x, coordinate.y);
                        ev.setExitName(ref);
                        iv = ev;
                    }
                }

                if (node.isStop()) {
View Full Code Here

Examples of org.opentripplanner.routing.vertextype.ExitVertex

    @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();
        routerApi.server = otpServer;
        RouterList routers = routerApi.getRouterIds();
        assertEquals(2, routers.routerInfo.size());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.