Examples of StreetWithElevationEdge


Examples of org.opentripplanner.routing.edgetype.StreetWithElevationEdge

        // Split each edge independently. If a only one splitter vertex is used, routing may take
        // shortcuts thought the splitter vertex to avoid turn penalties.
        IntersectionVertex e1midpoint = new IntersectionVertex(linker.graph, "split 1 at " + label, midCoord.x, midCoord.y, name);
        // We are replacing two edges with four edges
        // Note: Always enable elevation. This should not be a big waste of memory.
        StreetWithElevationEdge forward1 = new StreetWithElevationEdge(e1v1, e1midpoint, forward1Geom, name, lengthIn,
                e1.getPermission(), e1.isBack());
        StreetWithElevationEdge forward2 = new StreetWithElevationEdge(e1midpoint, e1v2, forward2Geom, name, lengthOut,
                e1.getPermission(), e1.isBack());
        if (e1 instanceof AreaEdge) {
            ((AreaEdge) e1).getArea().addVertex(e1midpoint, linker.graph);
        }

        addEdges(forward1, forward2);

        StreetWithElevationEdge backward1 = null;
        StreetWithElevationEdge backward2 = null;
        IntersectionVertex e2midpoint = null;
        if (e2 != null) {
            e2midpoint  = new IntersectionVertex(linker.graph, "split 2 at " + label, midCoord.x, midCoord.y, name);
            backward1 = new StreetWithElevationEdge(e2v1, e2midpoint, backGeometryPair.first,
                    name, lengthOut, e2.getPermission(), e2.isBack());
            backward2 = new StreetWithElevationEdge(e2midpoint, e2v2, backGeometryPair.second,
                    name, lengthIn, e2.getPermission(), e2.isBack());
            if (e2 instanceof AreaEdge) {
                ((AreaEdge) e2).getArea().addVertex(e2midpoint, linker.graph);
            }
            backward1.setBicycleSafetyFactor(e2.getBicycleSafetyFactor());
            backward2.setBicycleSafetyFactor(e2.getBicycleSafetyFactor());
            backward1.setElevationProfile(ElevationUtils.getPartialElevationProfile(
                    e2.getElevationProfile(), 0, lengthOut), false);
            backward2.setElevationProfile(ElevationUtils.getPartialElevationProfile(
                    e2.getElevationProfile(), lengthIn, totalGeomLength), false);
            backward1.setHasBogusName(e2.hasBogusName());
            backward2.setHasBogusName(e2.hasBogusName());
            backward1.setStairs(e2.isStairs());
            backward2.setStairs(e2.isStairs());
            backward1.setWheelchairAccessible(e2.isWheelchairAccessible());
            backward2.setWheelchairAccessible(e2.isWheelchairAccessible());
            addEdges(backward1, backward2);
        }

        forward1.setBicycleSafetyFactor(e1.getBicycleSafetyFactor());
        forward2.setBicycleSafetyFactor(e1.getBicycleSafetyFactor());
View Full Code Here

Examples of org.opentripplanner.routing.edgetype.StreetWithElevationEdge

        int nProcessed = 0;
        int nTotal = graph.countEdges();
        for (Vertex gv : graph.getVertices()) {
            for (Edge ee : gv.getOutgoing()) {
                if (ee instanceof StreetWithElevationEdge) {
                    StreetWithElevationEdge edgeWithElevation = (StreetWithElevationEdge) ee;
                    processEdge(graph, edgeWithElevation);
                    if (edgeWithElevation.getElevationProfile() != null && !edgeWithElevation.isElevationFlattened()) {
                        edgesWithElevation.add(edgeWithElevation);
                    }
                    nProcessed += 1;
                    if (nProcessed % 50000 == 0)
                        log.info("set elevation on {}/{} edges", nProcessed, nTotal);
View Full Code Here

Examples of org.opentripplanner.routing.edgetype.StreetWithElevationEdge

        // do actual assignments
        for (Vertex v : graph.getVertices()) {
            Double fromElevation = elevations.get(v);
            for (Edge e : v.getOutgoing()) {
                if (e instanceof StreetWithElevationEdge) {
                    StreetWithElevationEdge edge = ((StreetWithElevationEdge) e);

                    Double toElevation = elevations.get(edge.getToVertex());

                    if (fromElevation == null || toElevation == null) {
                        if (!edge.isElevationFlattened() && !edge.isSlopeOverride())
                            log.warn("Unexpectedly missing elevation for edge " + edge);
                        continue;
                    }

                    if (edge.getElevationProfile() != null && edge.getElevationProfile().size() > 2) {
                        continue;
                    }

                    Coordinate[] coords = new Coordinate[2];
                    coords[0] = new Coordinate(0, fromElevation);
                    coords[1] = new Coordinate(edge.getDistance(), toElevation);

                    PackedCoordinateSequence profile = new PackedCoordinateSequence.Double(coords);

                    if (edge.setElevationProfile(profile, true)) {
                        log.trace(graph.addBuilderAnnotation(new ElevationFlattened(edge)));
                    }
                }
            }
        }
View Full Code Here

Examples of org.opentripplanner.routing.edgetype.StreetWithElevationEdge

        double lengthRatioIn = geometries.first.getLength() / totalGeomLength;

        double lengthIn = street.getDistance() * lengthRatioIn;
        double lengthOut = street.getDistance() * (1 - lengthRatioIn);

        StreetWithElevationEdge newLeft = new PartialStreetEdge(street, fromv, base,
                geometries.first, name, lengthIn);
        StreetWithElevationEdge newRight = new PartialStreetEdge(street, base, tov,
                geometries.second, name, lengthOut);

        newLeft.setElevationProfile(ElevationUtils.getPartialElevationProfile(
                street.getElevationProfile(), 0, lengthIn), false);
        newLeft.setNoThruTraffic(street.isNoThruTraffic());
        newLeft.setStreetClass(street.getStreetClass());

        newRight.setElevationProfile(ElevationUtils.getPartialElevationProfile(
                street.getElevationProfile(), lengthIn, lengthIn + lengthOut), false);
        newRight.setStreetClass(street.getStreetClass());
        newRight.setNoThruTraffic(street.isNoThruTraffic());
       
        // Copy turn restrictions onto the outgoing half-edge.
        for (TurnRestriction turnRestriction : graph.getTurnRestrictions(street)) {
            graph.addTurnRestriction(newRight, turnRestriction);
        }
View Full Code Here

Examples of org.opentripplanner.routing.edgetype.StreetWithElevationEdge

    public StreetEdge createEdge(IntersectionVertex startEndpoint, IntersectionVertex endEndpoint,
            LineString geometry, String name, double length, StreetTraversalPermission permissions,
            boolean back) {
        StreetEdge pse;
        if (useElevationData) {
            pse = new StreetWithElevationEdge(startEndpoint, endEndpoint, geometry, name, length,
                    permissions, back);
        } else {
            pse = new StreetEdge(startEndpoint, endEndpoint, geometry, name, length, permissions,
                    back);
        }
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.