Search in sources :

Example 6 with TraverseMode

use of org.opentripplanner.routing.core.TraverseMode in project OpenTripPlanner by opentripplanner.

the class ShowGraph method drawGraphPath.

private void drawGraphPath(GraphPath gp) {
    // draw edges in different colors according to mode
    for (State s : gp.states) {
        TraverseMode mode = s.getBackMode();
        Edge e = s.getBackEdge();
        if (e == null)
            continue;
        if (mode != null && mode.isTransit()) {
            stroke(200, 050, 000);
            strokeWeight(6);
            drawEdge(e);
        }
        if (e instanceof StreetEdge) {
            StreetTraversalPermission stp = ((StreetEdge) e).getPermission();
            if (stp == StreetTraversalPermission.PEDESTRIAN) {
                stroke(000, 200, 000);
                strokeWeight(6);
                drawEdge(e);
            } else if (stp == StreetTraversalPermission.BICYCLE) {
                stroke(000, 000, 200);
                strokeWeight(6);
                drawEdge(e);
            } else if (stp == StreetTraversalPermission.PEDESTRIAN_AND_BICYCLE) {
                stroke(000, 200, 200);
                strokeWeight(6);
                drawEdge(e);
            } else if (stp == StreetTraversalPermission.ALL) {
                stroke(200, 200, 200);
                strokeWeight(6);
                drawEdge(e);
            } else {
                stroke(64, 64, 64);
                strokeWeight(6);
                drawEdge(e);
            }
        }
    }
    // mark key vertices
    lastLabelY = -999;
    labelState(gp.states.getFirst(), "begin");
    for (State s : gp.states) {
        Edge e = s.getBackEdge();
        if (e instanceof TransitBoardAlight) {
            if (((TransitBoardAlight) e).boarding) {
                labelState(s, "board");
            } else {
                labelState(s, "alight");
            }
        }
    }
    labelState(gp.states.getLast(), "end");
    if (VIDEO) {
        // freeze on final path for a few frames
        for (int i = 0; i < 10; i++) saveVideoFrame();
        resetVideoFrameNumber();
    }
}
Also used : TransitBoardAlight(org.opentripplanner.routing.edgetype.TransitBoardAlight) State(org.opentripplanner.routing.core.State) TraverseMode(org.opentripplanner.routing.core.TraverseMode) StreetEdge(org.opentripplanner.routing.edgetype.StreetEdge) StreetTraversalPermission(org.opentripplanner.routing.edgetype.StreetTraversalPermission) StreetEdge(org.opentripplanner.routing.edgetype.StreetEdge) PathwayEdge(org.opentripplanner.routing.edgetype.PathwayEdge) PatternEdge(org.opentripplanner.routing.edgetype.PatternEdge) Edge(org.opentripplanner.routing.graph.Edge) Point(java.awt.Point)

Example 7 with TraverseMode

use of org.opentripplanner.routing.core.TraverseMode in project OpenTripPlanner by opentripplanner.

the class Router method startup.

/**
 * Below is functionality moved into Router from the "router lifecycle manager" interface and implementation.
 * Current responsibilities are: 1) Binding proper services (depending on the configuration from command-line or
 * JSON config files) and 2) starting / stopping real-time updaters (delegated to the GraphUpdaterConfigurator class).
 */
/**
 * Start up a new router once it has been created.
 * @param config The configuration (loaded from Graph.properties for example).
 */
public void startup(JsonNode config) {
    this.tileRendererManager = new TileRendererManager(this.graph);
    // Analyst Modules FIXME make these optional based on JSON?
    {
        this.tileCache = new TileCache(this.graph);
        this.renderer = new Renderer(this.tileCache);
        this.sampleGridRenderer = new SampleGridRenderer(this.graph);
        this.isoChroneSPTRenderer = new IsoChroneSPTRendererAccSampling(this.sampleGridRenderer);
    }
    /* Create the default router parameters from the JSON router config. */
    JsonNode routingDefaultsNode = config.get("routingDefaults");
    if (routingDefaultsNode != null) {
        LOG.info("Loading default routing parameters from JSON:");
        ReflectiveInitializer<RoutingRequest> scraper = new ReflectiveInitializer(RoutingRequest.class);
        this.defaultRoutingRequest = scraper.scrape(routingDefaultsNode);
    } else {
        LOG.info("No default routing parameters were found in the router config JSON. Using built-in OTP defaults.");
        this.defaultRoutingRequest = new RoutingRequest();
    }
    /* Apply single timeout. */
    JsonNode timeout = config.get("timeout");
    if (timeout != null) {
        if (timeout.isNumber()) {
            this.timeouts = new double[] { timeout.doubleValue() };
        } else {
            LOG.error("The 'timeout' configuration option should be a number of seconds.");
        }
    }
    /* Apply multiple timeouts. */
    JsonNode timeouts = config.get("timeouts");
    if (timeouts != null) {
        if (timeouts.isArray() && timeouts.size() > 0) {
            this.timeouts = new double[timeouts.size()];
            int i = 0;
            for (JsonNode node : timeouts) {
                this.timeouts[i++] = node.doubleValue();
            }
        } else {
            LOG.error("The 'timeouts' configuration option should be an array of values in seconds.");
        }
    }
    LOG.info("Timeouts for router '{}': {}", this.id, this.timeouts);
    JsonNode requestLogFile = config.get("requestLogFile");
    if (requestLogFile != null) {
        this.requestLogger = createLogger(requestLogFile.asText());
        LOG.info("Logging incoming requests at '{}'", requestLogFile.asText());
    } else {
        LOG.info("Incoming requests will not be logged.");
    }
    JsonNode boardTimes = config.get("boardTimes");
    if (boardTimes != null && boardTimes.isObject()) {
        graph.boardTimes = new EnumMap<>(TraverseMode.class);
        for (TraverseMode mode : TraverseMode.values()) {
            if (boardTimes.has(mode.name())) {
                graph.boardTimes.put(mode, boardTimes.get(mode.name()).asInt(0));
            }
        }
    }
    JsonNode alightTimes = config.get("alightTimes");
    if (alightTimes != null && alightTimes.isObject()) {
        graph.alightTimes = new EnumMap<>(TraverseMode.class);
        for (TraverseMode mode : TraverseMode.values()) {
            if (alightTimes.has(mode.name())) {
                graph.alightTimes.put(mode, alightTimes.get(mode.name()).asInt(0));
            }
        }
    }
    JsonNode stopClusterMode = config.get("stopClusterMode");
    if (stopClusterMode != null) {
        graph.stopClusterMode = stopClusterMode.asText();
    } else {
        graph.stopClusterMode = "proximity";
    }
    /* Create Graph updater modules from JSON config. */
    GraphUpdaterConfigurator.setupGraph(this.graph, config);
    /* Compute ellipsoidToGeoidDifference for this Graph */
    try {
        WorldEnvelope env = graph.getEnvelope();
        double lat = (env.getLowerLeftLatitude() + env.getUpperRightLatitude()) / 2;
        double lon = (env.getLowerLeftLongitude() + env.getUpperRightLongitude()) / 2;
        graph.ellipsoidToGeoidDifference = ElevationUtils.computeEllipsoidToGeoidDifference(lat, lon);
        LOG.info("Computed ellipsoid/geoid offset at (" + lat + ", " + lon + ") as " + graph.ellipsoidToGeoidDifference);
    } catch (Exception e) {
        LOG.error("Error computing ellipsoid/geoid difference");
    }
}
Also used : JsonNode(com.fasterxml.jackson.databind.JsonNode) ReflectiveInitializer(org.opentripplanner.reflect.ReflectiveInitializer) TileRendererManager(org.opentripplanner.inspector.TileRendererManager) RoutingRequest(org.opentripplanner.routing.core.RoutingRequest) TraverseMode(org.opentripplanner.routing.core.TraverseMode) WorldEnvelope(org.opentripplanner.util.WorldEnvelope)

Example 8 with TraverseMode

use of org.opentripplanner.routing.core.TraverseMode in project OpenTripPlanner by opentripplanner.

the class GtfsTest method plan.

public Leg[] plan(long dateTime, String fromVertex, String toVertex, String onTripId, boolean wheelchairAccessible, boolean preferLeastTransfers, TraverseMode preferredMode, String excludedRoute, String excludedStop, int legCount) {
    final TraverseMode mode = preferredMode != null ? preferredMode : TraverseMode.TRANSIT;
    RoutingRequest routingRequest = new RoutingRequest();
    routingRequest.setNumItineraries(1);
    routingRequest.setArriveBy(dateTime < 0);
    routingRequest.dateTime = Math.abs(dateTime);
    if (fromVertex != null && !fromVertex.isEmpty()) {
        routingRequest.from = (new GenericLocation(null, feedId.getId() + ":" + fromVertex));
    }
    if (toVertex != null && !toVertex.isEmpty()) {
        routingRequest.to = new GenericLocation(null, feedId.getId() + ":" + toVertex);
    }
    if (onTripId != null && !onTripId.isEmpty()) {
        routingRequest.startingTransitTripId = (new AgencyAndId(feedId.getId(), onTripId));
    }
    routingRequest.setRoutingContext(graph);
    routingRequest.setWheelchairAccessible(wheelchairAccessible);
    routingRequest.transferPenalty = (preferLeastTransfers ? 300 : 0);
    routingRequest.setModes(new TraverseModeSet(TraverseMode.WALK, mode));
    // TODO route matcher still using underscores because it's quite nonstandard and should be eliminated from the 1.0 release rather than reworked
    if (excludedRoute != null && !excludedRoute.isEmpty()) {
        routingRequest.setBannedRoutes(feedId.getId() + "__" + excludedRoute);
    }
    if (excludedStop != null && !excludedStop.isEmpty()) {
        routingRequest.setBannedStopsHard(feedId.getId() + ":" + excludedStop);
    }
    routingRequest.setOtherThanPreferredRoutesPenalty(0);
    // The walk board cost is set low because it interferes with test 2c1.
    // As long as boarding has a very low cost, waiting should not be "better" than riding
    // since this makes interlining _worse_ than alighting and re-boarding the same line.
    // TODO rethink whether it makes sense to weight waiting to board _less_ than 1.
    routingRequest.setWaitReluctance(1);
    routingRequest.setWalkBoardCost(30);
    List<GraphPath> paths = new GraphPathFinder(router).getPaths(routingRequest);
    TripPlan tripPlan = GraphPathToTripPlanConverter.generatePlan(paths, routingRequest);
    // Stored in instance field for use in individual tests
    itinerary = tripPlan.itinerary.get(0);
    assertEquals(legCount, itinerary.legs.size());
    return itinerary.legs.toArray(new Leg[legCount]);
}
Also used : AgencyAndId(org.onebusaway.gtfs.model.AgencyAndId) GraphPath(org.opentripplanner.routing.spt.GraphPath) TripPlan(org.opentripplanner.api.model.TripPlan) GenericLocation(org.opentripplanner.common.model.GenericLocation) TraverseMode(org.opentripplanner.routing.core.TraverseMode) RoutingRequest(org.opentripplanner.routing.core.RoutingRequest) TraverseModeSet(org.opentripplanner.routing.core.TraverseModeSet) GraphPathFinder(org.opentripplanner.routing.impl.GraphPathFinder)

Example 9 with TraverseMode

use of org.opentripplanner.routing.core.TraverseMode in project OpenTripPlanner by opentripplanner.

the class GTFSPatternHopFactory method run.

/**
 * Generate the edges. Assumes that there are already vertices in the graph for the stops.
 */
public void run(Graph graph) {
    if (fareServiceFactory == null) {
        fareServiceFactory = new DefaultFareServiceFactory();
    }
    fareServiceFactory.processGtfs(_dao);
    // TODO: Why are we loading stops? The Javadoc above says this method assumes stops are aleady loaded.
    loadStops(graph);
    loadPathways(graph);
    loadFeedInfo(graph);
    loadAgencies(graph);
    // TODO: Why is there cached "data", and why are we clearing it? Due to a general lack of comments, I have no idea.
    // Perhaps it is to allow name collisions with previously loaded feeds.
    clearCachedData();
    /* Assign 0-based numeric codes to all GTFS service IDs. */
    for (AgencyAndId serviceId : _dao.getAllServiceIds()) {
        // TODO: FIX Service code collision for multiple feeds.
        graph.serviceCodes.put(serviceId, graph.serviceCodes.size());
    }
    LOG.debug("building hops from trips");
    Collection<Trip> trips = _dao.getAllTrips();
    int tripCount = 0;
    /* First, record which trips are used by one or more frequency entries.
         * These trips will be ignored for the purposes of non-frequency routing, and
         * all the frequency entries referencing the same trip can be added at once to the same
         * Timetable/TripPattern.
         */
    ListMultimap<Trip, Frequency> frequenciesForTrip = ArrayListMultimap.create();
    for (Frequency freq : _dao.getAllFrequencies()) {
        frequenciesForTrip.put(freq.getTrip(), freq);
    }
    /* Then loop over all trips, handling each one as a frequency-based or scheduled trip. */
    int freqCount = 0;
    int nonFreqCount = 0;
    /* The hops don't actually exist when we build their geometries, but we have to build their geometries
         * below, before we throw away the modified stopTimes, saving only the tripTimes (which don't have enough
         * information to build a geometry). So we keep them here.
         *
         *  A trip pattern actually does not have a single geometry, but one per hop, so we store an array.
         *  FIXME _why_ doesn't it have a single geometry?
         */
    Map<TripPattern, LineString[]> geometriesByTripPattern = Maps.newHashMap();
    TRIP: for (Trip trip : trips) {
        if (++tripCount % 100000 == 0) {
            LOG.debug("loading trips {}/{}", tripCount, trips.size());
        }
        // TODO: move to a validator module
        if (!_calendarService.getServiceIds().contains(trip.getServiceId())) {
            LOG.warn(graph.addBuilderAnnotation(new TripUndefinedService(trip)));
            // Invalid trip, skip it, it will break later
            continue TRIP;
        }
        /* Fetch the stop times for this trip. Copy the list since it's immutable. */
        List<StopTime> stopTimes = new ArrayList<StopTime>(_dao.getStopTimesForTrip(trip));
        /* GTFS stop times frequently contain duplicate, missing, or incorrect entries. Repair them. */
        TIntList removedStopSequences = removeRepeatedStops(stopTimes);
        if (!removedStopSequences.isEmpty()) {
            LOG.warn(graph.addBuilderAnnotation(new RepeatedStops(trip, removedStopSequences)));
        }
        filterStopTimes(stopTimes, graph);
        interpolateStopTimes(stopTimes);
        /* If after filtering this trip does not contain at least 2 stoptimes, it does not serve any purpose. */
        if (stopTimes.size() < 2) {
            LOG.warn(graph.addBuilderAnnotation(new TripDegenerate(trip)));
            continue TRIP;
        }
        /* Try to get the direction id for the trip, set to -1 if not found */
        int directionId;
        try {
            directionId = Integer.parseInt(trip.getDirectionId());
        } catch (NumberFormatException e) {
            LOG.debug("Trip {} does not have direction id, defaults to -1");
            directionId = -1;
        }
        /* Get the existing TripPattern for this filtered StopPattern, or create one. */
        StopPattern stopPattern = new StopPattern(stopTimes);
        TripPattern tripPattern = findOrCreateTripPattern(stopPattern, trip.getRoute(), directionId);
        /* Create a TripTimes object for this list of stoptimes, which form one trip. */
        TripTimes tripTimes = new TripTimes(trip, stopTimes, graph.deduplicator);
        /* If this trip is referenced by one or more lines in frequencies.txt, wrap it in a FrequencyEntry. */
        List<Frequency> frequencies = frequenciesForTrip.get(trip);
        if (frequencies != null && !(frequencies.isEmpty())) {
            for (Frequency freq : frequencies) {
                tripPattern.add(new FrequencyEntry(freq, tripTimes));
                freqCount++;
            }
        // TODO replace: createGeometry(graph, trip, stopTimes, hops);
        } else /* This trip was not frequency-based. Add the TripTimes directly to the TripPattern's scheduled timetable. */
        {
            tripPattern.add(tripTimes);
            nonFreqCount++;
        }
        // there would be a trip pattern with no geometry yet because it failed some of these tests
        if (!geometriesByTripPattern.containsKey(tripPattern) && trip.getShapeId() != null && trip.getShapeId().getId() != null && !trip.getShapeId().getId().equals("")) {
            // save the geometry to later be applied to the hops
            geometriesByTripPattern.put(tripPattern, createGeometry(graph, trip, stopTimes));
        }
    }
    // end foreach TRIP
    LOG.info("Added {} frequency-based and {} single-trip timetable entries.", freqCount, nonFreqCount);
    graph.hasFrequencyService = graph.hasFrequencyService || freqCount > 0;
    graph.hasScheduledService = graph.hasScheduledService || nonFreqCount > 0;
    /* Generate unique human-readable names for all the TableTripPatterns. */
    TripPattern.generateUniqueNames(tripPatterns.values());
    /* Generate unique short IDs for all the TableTripPatterns. */
    TripPattern.generateUniqueIds(tripPatterns.values());
    /* Loop over all new TripPatterns, creating edges, setting the service codes and geometries, etc. */
    for (TripPattern tripPattern : tripPatterns.values()) {
        tripPattern.makePatternVerticesAndEdges(graph, context.stationStopNodes);
        // Add the geometries to the hop edges.
        LineString[] geom = geometriesByTripPattern.get(tripPattern);
        if (geom != null) {
            for (int i = 0; i < tripPattern.hopEdges.length; i++) {
                tripPattern.hopEdges[i].setGeometry(geom[i]);
            }
            // Make a geometry for the whole TripPattern from all its constituent hops.
            // This happens only if geometry is found in geometriesByTripPattern,
            // because that means that geometry was created from shapes instead "as crow flies"
            tripPattern.makeGeometry();
        }
        // TODO this could be more elegant
        tripPattern.setServiceCodes(graph.serviceCodes);
        /* Iterate over all stops in this pattern recording mode information. */
        TraverseMode mode = GtfsLibrary.getTraverseMode(tripPattern.route);
        for (TransitStop tstop : tripPattern.stopVertices) {
            tstop.addMode(mode);
            if (mode == TraverseMode.SUBWAY) {
                tstop.setStreetToStopTime(subwayAccessTime);
            }
            graph.addTransitMode(mode);
        }
    }
    /* Identify interlined trips and create the necessary edges. */
    interline(tripPatterns.values(), graph);
    /* Interpret the transfers explicitly defined in transfers.txt. */
    loadTransfers(graph);
    /* Store parent stops in graph, even if not linked. These are needed for clustering*/
    for (TransitStationStop stop : context.stationStopNodes.values()) {
        if (stop instanceof TransitStation) {
            TransitStation parentStopVertex = (TransitStation) stop;
            graph.parentStopById.put(parentStopVertex.getStopId(), parentStopVertex.getStop());
        }
    }
    // it is already done at deserialization, but standalone mode allows using graphs without serializing them.
    for (TripPattern tableTripPattern : tripPatterns.values()) {
        tableTripPattern.scheduledTimetable.finish();
    }
    // eh?
    clearCachedData();
    graph.putService(FareService.class, fareServiceFactory.makeFareService());
    graph.putService(OnBoardDepartService.class, new OnBoardDepartServiceImpl());
}
Also used : AgencyAndId(org.onebusaway.gtfs.model.AgencyAndId) TransitStop(org.opentripplanner.routing.vertextype.TransitStop) FrequencyEntry(org.opentripplanner.routing.trippattern.FrequencyEntry) TripTimes(org.opentripplanner.routing.trippattern.TripTimes) TIntArrayList(gnu.trove.list.array.TIntArrayList) TIntList(gnu.trove.list.TIntList) List(java.util.List) ArrayList(java.util.ArrayList) LinkedList(java.util.LinkedList) TraverseMode(org.opentripplanner.routing.core.TraverseMode) DefaultFareServiceFactory(org.opentripplanner.routing.impl.DefaultFareServiceFactory) StopTime(org.onebusaway.gtfs.model.StopTime) StopPattern(org.opentripplanner.model.StopPattern) Trip(org.onebusaway.gtfs.model.Trip) TripUndefinedService(org.opentripplanner.graph_builder.annotation.TripUndefinedService) ShapePoint(org.onebusaway.gtfs.model.ShapePoint) TripPattern(org.opentripplanner.routing.edgetype.TripPattern) TransitStation(org.opentripplanner.routing.vertextype.TransitStation) TripDegenerate(org.opentripplanner.graph_builder.annotation.TripDegenerate) LineString(com.vividsolutions.jts.geom.LineString) Frequency(org.onebusaway.gtfs.model.Frequency) RepeatedStops(org.opentripplanner.graph_builder.annotation.RepeatedStops) TIntList(gnu.trove.list.TIntList) TransitStationStop(org.opentripplanner.routing.vertextype.TransitStationStop) OnBoardDepartServiceImpl(org.opentripplanner.routing.impl.OnBoardDepartServiceImpl)

Example 10 with TraverseMode

use of org.opentripplanner.routing.core.TraverseMode in project OpenTripPlanner by opentripplanner.

the class SPTWalker method walk.

/**
 * Walk over a SPT. Call a visitor for each visited point.
 */
public void walk(SPTVisitor visitor, double d0) {
    int nTotal = 0, nSkippedDupEdge = 0, nSkippedNoGeometry = 0;
    Collection<? extends State> allStates = spt.getAllStates();
    Set<Vertex> allVertices = new HashSet<Vertex>(spt.getVertexCount());
    for (State s : allStates) {
        allVertices.add(s.getVertex());
    }
    Set<Edge> processedEdges = new HashSet<Edge>(allVertices.size());
    for (Vertex v : allVertices) {
        State s0 = spt.getState(v);
        if (s0 == null || !s0.isFinal())
            continue;
        for (Edge e : s0.getVertex().getIncoming()) {
            // Take only street
            if (e != null && visitor.accept(e)) {
                State s1 = spt.getState(e.getFromVertex());
                if (s1 == null || !s1.isFinal())
                    continue;
                if (e.getFromVertex() != null && e.getToVertex() != null) {
                    // Hack alert: e.hashCode() throw NPE
                    if (processedEdges.contains(e)) {
                        nSkippedDupEdge++;
                        continue;
                    }
                    processedEdges.add(e);
                }
                Vertex vx0 = s0.getVertex();
                Vertex vx1 = s1.getVertex();
                LineString lineString = e.getGeometry();
                if (lineString == null) {
                    nSkippedNoGeometry++;
                    continue;
                }
                // Compute speed along edge
                double speedAlongEdge = spt.getOptions().walkSpeed;
                if (e instanceof StreetEdge) {
                    StreetEdge se = (StreetEdge) e;
                    /*
                         * Compute effective speed, taking into account end state mode (car, bike,
                         * walk...) and edge properties (car max speed, slope, etc...)
                         */
                    TraverseMode mode = s0.getNonTransitMode();
                    speedAlongEdge = se.calculateSpeed(spt.getOptions(), mode, s0.getTimeInMillis());
                    if (mode != TraverseMode.CAR)
                        speedAlongEdge = speedAlongEdge * se.getDistance() / se.getSlopeSpeedEffectiveLength();
                    double avgSpeed = se.getDistance() / Math.abs(s0.getTimeInMillis() - s1.getTimeInMillis()) * 1000;
                    if (avgSpeed < 1e-10)
                        avgSpeed = 1e-10;
                    /*
                         * We can't go faster than the average speed on the edge. We can go slower
                         * however, that simply means that one end vertice has a time higher than
                         * the other end vertice + time to traverse the edge (can happen due to
                         * max walk clamping).
                         */
                    if (speedAlongEdge > avgSpeed)
                        speedAlongEdge = avgSpeed;
                }
                // Length of linestring
                double lineStringLen = SphericalDistanceLibrary.fastLength(lineString);
                visitor.visit(e, vx0.getCoordinate(), s0, s1, 0.0, lineStringLen, speedAlongEdge);
                visitor.visit(e, vx1.getCoordinate(), s0, s1, lineStringLen, 0.0, speedAlongEdge);
                nTotal += 2;
                Coordinate[] pList = lineString.getCoordinates();
                boolean reverse = vx1.getCoordinate().equals(pList[0]);
                // Split the linestring in nSteps
                if (lineStringLen > d0) {
                    // Number of steps
                    int nSteps = (int) Math.floor(lineStringLen / d0) + 1;
                    // Length of step
                    double stepLen = lineStringLen / nSteps;
                    // Distance at start of current seg
                    double startLen = 0;
                    // Distance cursor
                    double curLen = stepLen;
                    int ns = 1;
                    for (int i = 0; i < pList.length - 1; i++) {
                        Coordinate p0 = pList[i];
                        Coordinate p1 = pList[i + 1];
                        double segLen = SphericalDistanceLibrary.fastDistance(p0, p1);
                        while (curLen - startLen < segLen) {
                            double k = (curLen - startLen) / segLen;
                            Coordinate p = new Coordinate(p0.x * (1 - k) + p1.x * k, p0.y * (1 - k) + p1.y * k);
                            visitor.visit(e, p, reverse ? s1 : s0, reverse ? s0 : s1, curLen, lineStringLen - curLen, speedAlongEdge);
                            nTotal++;
                            curLen += stepLen;
                            ns++;
                        }
                        startLen += segLen;
                        if (ns >= nSteps)
                            break;
                    }
                }
            }
        }
    }
    LOG.info("SPTWalker: Generated {} points ({} dup edges, {} no geometry) from {} vertices / {} states.", nTotal, nSkippedDupEdge, nSkippedNoGeometry, allVertices.size(), allStates.size());
}
Also used : Vertex(org.opentripplanner.routing.graph.Vertex) StreetEdge(org.opentripplanner.routing.edgetype.StreetEdge) LineString(com.vividsolutions.jts.geom.LineString) Coordinate(com.vividsolutions.jts.geom.Coordinate) State(org.opentripplanner.routing.core.State) TraverseMode(org.opentripplanner.routing.core.TraverseMode) StreetEdge(org.opentripplanner.routing.edgetype.StreetEdge) Edge(org.opentripplanner.routing.graph.Edge) HashSet(java.util.HashSet)

Aggregations

TraverseMode (org.opentripplanner.routing.core.TraverseMode)13 RoutingRequest (org.opentripplanner.routing.core.RoutingRequest)5 Edge (org.opentripplanner.routing.graph.Edge)5 LineString (com.vividsolutions.jts.geom.LineString)4 StateEditor (org.opentripplanner.routing.core.StateEditor)4 StreetEdge (org.opentripplanner.routing.edgetype.StreetEdge)4 Coordinate (com.vividsolutions.jts.geom.Coordinate)3 ArrayList (java.util.ArrayList)3 State (org.opentripplanner.routing.core.State)3 TraverseModeSet (org.opentripplanner.routing.core.TraverseModeSet)3 Vertex (org.opentripplanner.routing.graph.Vertex)3 HashSet (java.util.HashSet)2 List (java.util.List)2 AgencyAndId (org.onebusaway.gtfs.model.AgencyAndId)2 GenericLocation (org.opentripplanner.common.model.GenericLocation)2 TemporaryStreetLocation (org.opentripplanner.routing.location.TemporaryStreetLocation)2 NonLocalizedString (org.opentripplanner.util.NonLocalizedString)2 JsonNode (com.fasterxml.jackson.databind.JsonNode)1 Iterables (com.google.common.collect.Iterables)1 Envelope (com.vividsolutions.jts.geom.Envelope)1