Examples of OnboardDepartVertex


Examples of org.opentripplanner.routing.vertextype.OnboardDepartVertex

                lon = start.x;
                lat = start.y;
            }
        }

        OnboardDepartVertex onboardDepart = new OnboardDepartVertex("on_board_depart", lon, lat);
        OnBoardDepartPatternHop startHop = new OnBoardDepartPatternHop(onboardDepart, nextStop,
                bestTripTimes, bestServiceDay, bestStopIndex, fractionCovered);
        startHop.setGeometry(geomRemaining);
        return onboardDepart;
    }
View Full Code Here

Examples of org.opentripplanner.routing.vertextype.OnboardDepartVertex

        // Routing context creation and initialization
        ServiceDay serviceDay = new ServiceDay(graph, 0, calendarServiceImpl, null);

        // Temporary graph objects for onboard depart tests
        OnboardDepartVertex onboardDepartVertex = new OnboardDepartVertex("Onboard", 23.0, 12.0);
        OnBoardDepartPatternHop onBoardDepartPatternHop = new OnBoardDepartPatternHop(
                onboardDepartVertex, v12, firstTripPattern.scheduledTimetable.getTripTimes(0), serviceDay, 0, 0.5);

        // Traverse the path forward first
        RoutingRequest forwardOptions = options.clone();
View Full Code Here

Examples of org.opentripplanner.routing.vertextype.OnboardDepartVertex

                    + new Date(newStart * 1000L));

            /* And use it for onboard departure */
            double lat = end.getLat();
            double lon = end.getLon(); // Mock location, not really important here.
            OnboardDepartVertex onboardOrigin = new OnboardDepartVertex("OnBoard_Origin", lat, lon);
            @SuppressWarnings("unused")
            OnBoardDepartPatternHop currentHop = new OnBoardDepartPatternHop(onboardOrigin, nextV,
                    tripTimes, options.rctx.serviceDays.get(1), stopIndex, k);

            options.dateTime = newStart;
            options.setRoutingContext(graph, onboardOrigin, destination);
            spt = aStar.getShortestPathTree(options);

            /* Re-compute a new path starting boarded */
            GraphPath path2 = spt.getPath(destination, false);
            assertNotNull(path2);
            if (verbose)
                System.out.println("PATH 2 ---------------------");
            long arrivalTime2 = 0L;
            long elapsedTime2 = 0L;
            int numBoardings2 = 0;
            Vertex arrivalVertex2 = null;
            for (State s : path2.states) {
                if (verbose)
                    System.out.println(s + " [" + s.getVertex().getClass().getName() + "]");
                arrivalTime2 = s.getTimeSeconds();
                arrivalVertex2 = s.getVertex();
                elapsedTime2 = s.getElapsedTimeSeconds();
                numBoardings2 = s.getNumBoardings();
            }
            /* Arrival time and vertex *must* match */
            assertEquals(arrivalTime1, arrivalTime2);
            assertEquals(arrivalVertex1, destination);
            assertEquals(arrivalVertex2, destination);
            /* On-board *must* be shorter in time */
            assertTrue(elapsedTime2 <= elapsedTime1);
            /* On-board *must* have less boardings */
            assertTrue(numBoardings2 < numBoardings1);

            /* Cleanup edges */
            int nRemoved = onboardOrigin.removeTemporaryEdges(graph);
            assertEquals(1, nRemoved);

            n++;
            if (n > NTESTS)
                break;
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.