Examples of StreetEdge


Examples of org.opentripplanner.routing.edgetype.StreetEdge

        double originalTravelSpeed = edge.getDistance() / traverseTime; // this may be wrong for u-shapes

        if (originalTravelSpeed < userSpeed) {
            // we may have slope effects
            if (edge instanceof StreetEdge) {
                StreetEdge pe = (StreetEdge) edge;
                double maxSlope = pe.getMaxSlope();
                // if we are over the slope limit, then we should use the slower speed
                if (maxSlope > 0.06) { // limit 6m/100m = 3.4 degree
                    userSpeed = originalTravelSpeed;
                }
            }
        } else {
            // in this case we may have a u-shape, or the user speeds are too small, or something else.
            double vdiff = Math.abs(originalTravelSpeed - userSpeed);
            double vDiffPercent = vdiff / (userSpeed / 100.0);
            if (vDiffPercent > 20) {
                isTooFast = true;
                // [sstein Dec 2012]: Note, it seems like most of these edges are indeed of u-shape type,
                // i.e. small roads that come from and return from (the same) main road
                msg = "v_traversed is much faster than (allowed) v_user, edgeName: "
                        + edge.getName() + ", >>> (in m/s): v_traversed="
                        + (int) Math.floor(originalTravelSpeed) + ", v_maxUser="
                        + (int) Math.floor(userSpeed);
                if (hasUshape) {
                    msg = msg + ", known u-shape, ";
                }
                if ((usesCar == false) && (hasUshape == false)) {
                    this.tooFastTraversedEdgeGeoms.add(edge.getGeometry());
                    LOG.debug(msg);
                } // otherwise we print msg below
            }
        }
        // correct speed for car use, as each road has its speed limits
        if (usesCar) {
            if (edge instanceof StreetEdge) {
                StreetEdge pe = (StreetEdge) edge;
                userSpeed = pe.getCarSpeed();
                // we need to check again if the originalTravelSpeed is faster
                if ((isTooFast == true) && (originalTravelSpeed > userSpeed)
                        && (hasUshape == false)) {
                    this.tooFastTraversedEdgeGeoms.add(edge.getGeometry());
                    LOG.debug(msg + "; setting v_PlainStreetEdge=" + (int) Math.floor(userSpeed));
View Full Code Here

Examples of org.opentripplanner.routing.edgetype.StreetEdge

     */
    private void calculateElevations(Itinerary itinerary, Edge[] edges) {
        for (Edge edge : edges) {
            if (!(edge instanceof StreetEdge)) continue;

            StreetEdge edgeWithElevation = (StreetEdge) edge;
            PackedCoordinateSequence coordinates = edgeWithElevation.getElevationProfile();

            if (coordinates == null) continue;
            // TODO Check the test below, AFAIU current elevation profile has 3 dimensions.
            if (coordinates.getDimension() != 2) continue;

View Full Code Here

Examples of org.opentripplanner.routing.edgetype.StreetEdge

    private static List<P2<Double>> encodeElevationProfile(Edge edge, double offset) {
        if (!(edge instanceof StreetEdge)) {
            return new ArrayList<P2<Double>>();
        }
        StreetEdge elevEdge = (StreetEdge) edge;
        if (elevEdge.getElevationProfile() == null) {
            return new ArrayList<P2<Double>>();
        }
        ArrayList<P2<Double>> out = new ArrayList<P2<Double>>();
        Coordinate[] coordArr = elevEdge.getElevationProfile().toCoordinateArray();
        for (int i = 0; i < coordArr.length; i++) {
            out.add(new P2<Double>(coordArr[i].x + offset, coordArr[i].y));
        }
        return out;
    }
View Full Code Here

Examples of org.opentripplanner.routing.edgetype.StreetEdge

        StreetLocation closestStreet = null;
        CandidateEdgeBundle bundle = getClosestEdges(location, options, extraEdges, null, false);
        CandidateEdge candidate = bundle.best;
        double closestStreetDistance = Double.POSITIVE_INFINITY;
        if (candidate != null) {
            StreetEdge bestStreet = candidate.edge;
            Coordinate nearestPoint = candidate.nearestPointOnEdge;
            closestStreetDistance = distanceLibrary.distance(coord, nearestPoint);
            LOG.debug("best street: {} dist: {}", bestStreet.toString(), closestStreetDistance);
            if (calculatedName == null || "".equals(calculatedName)) {
                calculatedName = bestStreet.getName();
            }
            String closestName = String.format("%s_%s", bestStreet.getName(), location.toString());
            closestStreet = StreetLocation.createStreetLocation(graph, closestName, calculatedName,
                    bundle.toEdgeList(), nearestPoint, coord);
        }

        // decide whether to return street, or street + stop
View Full Code Here

Examples of org.opentripplanner.routing.edgetype.StreetEdge

            for (Edge e : nearbyEdges) {
                // Ignore invalid edges.
                if (e == null || e.getFromVertex() == null || !(e instanceof StreetEdge)) {
                    continue;
                }
                StreetEdge se = (StreetEdge)e;

                // Ignore those edges we can't traverse. canBeTraversed checks internally if
                // walking a bike is possible on this StreetEdge.
                if (!reqs.canBeTraversed(se)) {
                    continue;
View Full Code Here

Examples of org.opentripplanner.routing.edgetype.StreetEdge

                v48, v50, l49, "Edge 49", 2.0, StreetTraversalPermission.ALL, false);

        // Edges for legs 6, 7 and 8
        LegSwitchingEdge e51 = new LegSwitchingEdge(
                v50, v52);
        StreetEdge e53p = new StreetEdge(v52, v54, l53, "Edge 53", 1.0,
                StreetTraversalPermission.ALL, false);
        PartialStreetEdge e53 = new PartialStreetEdge(e53p, v52, v54, l53, "Edge 53",
                1.0, StreetTraversalPermission.ALL, false);
        StreetBikeRentalLink e55 = new StreetBikeRentalLink(
                v54, v56);
        RentABikeOffEdge e57 = new RentABikeOffEdge(
                v56, v58, Collections.singleton(""));
        StreetBikeRentalLink e59 = new StreetBikeRentalLink(
                v58, v60);

        // Alert for testing GTFS-RT
        AlertPatch alertPatch = new AlertPatch();

        alertPatch.setTimePeriods(Collections.singletonList(new TimePeriod(0, Long.MAX_VALUE)));
        alertPatch.setAlert(Alert.createSimpleAlerts(alertsExample));

        // Edge initialization that can't be done using the constructor
        e3.setElevationProfile(elevation3, false);
        e17.add(firstTrip, secondTrip);
        e39.setElevationProfile(elevation39, false);
        e41.setElevationProfile(elevation41, false);
        e41.setHasBogusName(true);
        e49.setElevationProfile(elevation49, false);
        e53.setElevationProfile(elevation53, false);
        graph.streetNotesService.addStaticNote(e53p, Alert.createSimpleAlerts(alertsExample),
                StreetNotesService.ALWAYS_MATCHER);

        // Add an extra edge to the graph in order to generate stayOn = true for one walk step.
        new StreetEdge(v40,
                new IntersectionVertex(graph, "Extra vertex", 180, 88),
                new LineString(new PackedCoordinateSequence.Double(
                        new double[]{180, 89, 180, 88}, 2), geometryFactory),
                "Extra edge", 1.9, StreetTraversalPermission.NONE, true);
View Full Code Here

Examples of org.opentripplanner.routing.edgetype.StreetEdge

    private static final Color PARK_AND_RIDE_COLOR_VERTEX = Color.RED;

    @Override
    public boolean renderEdge(Edge e, EdgeVisualAttributes attrs) {
        if (e instanceof StreetEdge) {
            StreetEdge pse = (StreetEdge) e;
            if (pse.isStairs()) {
                attrs.color = STAIRS_COLOR_EDGE;
                attrs.label = "stairs";
            } else {
                attrs.color = getColor(pse.getPermission());
                attrs.label = getLabel(pse.getPermission());
            }
        } else if (e instanceof StreetTransitLink) {
            attrs.color = LINK_COLOR_EDGE;
            attrs.label = "link";
        } else if (e instanceof StreetBikeRentalLink) {
View Full Code Here

Examples of org.opentripplanner.routing.edgetype.StreetEdge

        for (Iterator<Vertex> vIter = island.streetIterator(); vIter.hasNext();) {
            Vertex v = vIter.next();
            Collection<Edge> outgoing = new ArrayList<Edge>(v.getOutgoing());
            for (Edge e : outgoing) {
                if (e instanceof StreetEdge) {
                    StreetEdge pse = (StreetEdge) e;
                    StreetTraversalPermission permission = pse.getPermission();
                    permission = permission.remove(StreetTraversalPermission.PEDESTRIAN);
                    permission = permission.remove(StreetTraversalPermission.BICYCLE);
                    if (permission == StreetTraversalPermission.NONE) {
                        // TODO Shouldn't we have a graph.removeEdge()?
                        graph.streetNotesService.removeStaticNotes(pse);
                        pse.detach(graph);
                    } else {
                        pse.setPermission(permission);
                    }
                }
            }
        }
View Full Code Here

Examples of org.opentripplanner.routing.edgetype.StreetEdge

    }

    @Override
    public boolean renderEdge(Edge e, EdgeVertexTileRenderer.EdgeVisualAttributes attrs) {
        if (e instanceof StreetEdge) {
            StreetEdge pse = (StreetEdge) e;
            if (!pse.isWheelchairAccessible()) {
                attrs.color = NO_WHEELCHAIR_COLOR;
                attrs.label = "wheelchair=no";
            } else {
                attrs.color = slopePalette.getColor(pse.getMaxSlope());
                attrs.label = String.format("%.02f", pse.getMaxSlope());
            }
        } else {
            return false;
        }
        return true;
View Full Code Here

Examples of org.opentripplanner.routing.edgetype.StreetEdge

        coords[0] = vA.getCoordinate();
        coords[1] = vB.getCoordinate();
        LineString geom = GeometryUtils.getGeometryFactory().createLineString(coords);

        StreetTraversalPermission perm = StreetTraversalPermission.ALL;
        return new StreetEdge(vA, vB, geom, name, length, perm, false);
    }
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.