Package org.opentripplanner.routing.vertextype

Examples of org.opentripplanner.routing.vertextype.IntersectionVertex


                    lastLon = node.lon;
                    lastLat = node.lat;
                    lastLevel = level;
                }

                IntersectionVertex startEndpoint = null, endEndpoint = null;

                ArrayList<Coordinate> segmentCoordinates = new ArrayList<Coordinate>();

                /*
                 * Traverse through all the nodes of this edge. For nodes which are not shared with any other edge, do not create endpoints -- just
View Full Code Here


                OSMLevel[] levels = vertices.keySet().toArray(new OSMLevel[0]);
                Arrays.sort(levels);
                ArrayList<Vertex> onboardVertices = new ArrayList<Vertex>();
                for (OSMLevel level : levels) {
                    // get the node to build the elevator out from
                    IntersectionVertex sourceVertex = vertices.get(level);
                    String sourceVertexLabel = sourceVertex.getLabel();
                    String levelName = level.longName;

                    ElevatorOffboardVertex offboardVertex = new ElevatorOffboardVertex(graph,
                            sourceVertexLabel + "_offboard", sourceVertex.getX(),
                            sourceVertex.getY(), levelName);

                    new FreeEdge(sourceVertex, offboardVertex);
                    new FreeEdge(offboardVertex, sourceVertex);

                    ElevatorOnboardVertex onboardVertex = new ElevatorOnboardVertex(graph,
                            sourceVertexLabel + "_onboard", sourceVertex.getX(),
                            sourceVertex.getY(), levelName);

                    new ElevatorBoardEdge(offboardVertex, onboardVertex);
                    new ElevatorAlightEdge(onboardVertex, offboardVertex, level.longName);

                    // accumulate onboard vertices to so they can be connected by hop edges later
View Full Code Here

                multiLevelNodes.put(nodeId, vertices);
            }
            if (!vertices.containsKey(level)) {
                Coordinate coordinate = getCoordinate(node);
                String label = this.getLevelNodeLabel(node, level);
                IntersectionVertex vertex = new IntersectionVertex(graph, label, coordinate.x,
                        coordinate.y, label);
                vertices.put(level, vertex);
                // multilevel nodes should also undergo turn-conversion
                endpoints.add(vertex);
                return vertex;
View Full Code Here

        // TODO Set this to private once WalkableAreaBuilder is gone
        protected IntersectionVertex getVertexForOsmNode(OSMNode node, OSMWithTags way) {
            // If the node should be decomposed to multiple levels,
            // use the numeric level because it is unique, the human level may not be (although
            // it will likely lead to some head-scratching if it is not).
            IntersectionVertex iv = null;
            if (node.isMultiLevel()) {
                // make a separate node for every level
                return recordLevel(node, way);
            }
            // single-level case
            long nid = node.getId();
            iv = intersectionNodes.get(nid);
            if (iv == null) {
                Coordinate coordinate = getCoordinate(node);
                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()) {
                    String ref = node.getTag("ref");
                    String name = node.getTag("name");
                    if (ref != null) {
                        TransitStopStreetVertex tsv = new TransitStopStreetVertex(graph, label, coordinate.x, coordinate.y, name, ref);
                        iv = tsv;
                    }
                }

                if (iv == null) {
                    iv = new IntersectionVertex(graph, label, coordinate.x, coordinate.y, label);
                    if (node.hasTrafficLight()) {
                        iv.trafficLight = (true);
                    }
                }
View Full Code Here

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

        // 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) {
View Full Code Here

            LOG.error("No stops found within {} meters.", radiusMeters);
            return null;
        }
        if (shpName == null)
            shpName = stops.get(0).getName().split(" ")[0];  
        StreetVertex origin = new IntersectionVertex(graph, "iso_temp", originCoord.x, originCoord.y);
        for (TransitStop stop : stops) {
            new StreetTransitLink(origin, stop, false);
            LOG.debug("linked to stop {}", stop.getName());
        }
        request.setRoutingContext(graph, origin, null);
View Full Code Here

        emptyGraph.save(new ObjectOutputStream(baos));
        emptyGraphData = baos.toByteArray();

        // Create a small graph with 2 vertices and one edge and it's serialized form
        smallGraph = new Graph();
        StreetVertex v1 = new IntersectionVertex(smallGraph, "v1", 0, 0);
        StreetVertex v2 = new IntersectionVertex(smallGraph, "v2", 0, 0.1);
        new StreetEdge(v1, v2, null, "v1v2", 11000, StreetTraversalPermission.PEDESTRIAN, false);
        baos = new ByteArrayOutputStream();
        smallGraph.save(new ObjectOutputStream(baos));
        smallGraphData = baos.toByteArray();
    }
View Full Code Here

    /****
     * Private Methods
     ****/

    private StreetVertex vertex(String label, double lat, double lon) {
        IntersectionVertex v = new IntersectionVertex(_graph, label, lat, lon);
        return v;
    }
View Full Code Here

    public void testTriangle() {
        Coordinate c1 = new Coordinate(-122.575033, 45.456773);
        Coordinate c2 = new Coordinate(-122.576668, 45.451426);

        StreetVertex v1 = new IntersectionVertex(null, "v1", c1.x, c1.y, null);
        StreetVertex v2 = new IntersectionVertex(null, "v2", c2.x, c2.y, null);

        GeometryFactory factory = new GeometryFactory();
        LineString geometry = factory.createLineString(new Coordinate[] { c1, c2 });

        double length = 650.0;
View Full Code Here

        TransitStop transitStopB = new TransitStop(graph, stopB);
        TransitStop transitStopC = new TransitStop(graph, stopC);
        TransitStop transitStopD = new TransitStop(graph, stopD);
        TransitStop transitStopE = new TransitStop(graph, stopE);

        IntersectionVertex intersectionA = new IntersectionVertex(graph, "Intersection A", 1, 1);
        IntersectionVertex intersectionB = new IntersectionVertex(graph, "Intersection B", 1, 2);
        IntersectionVertex intersectionC = new IntersectionVertex(graph, "Intersection C", 2, 2);
        IntersectionVertex intersectionD = new IntersectionVertex(graph, "Intersection D", 2, 1);

        intersectionA.freeFlowing = (true);
        intersectionB.freeFlowing = (true);
        intersectionC.freeFlowing = (true);
        intersectionD.freeFlowing = (true);
View Full Code Here

TOP

Related Classes of org.opentripplanner.routing.vertextype.IntersectionVertex

Copyright © 2018 www.massapicom. 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.