Package org.opentripplanner.routing.vertextype

Examples of org.opentripplanner.routing.vertextype.IntersectionVertex


                    } else {
                        continue;
                    }

                    String label = "area splitter at " + edgeCoordinate;
                    IntersectionVertex newEndpoint = (IntersectionVertex) graph.getVertex(label);
                    if (newEndpoint == null) {
                        newEndpoint = new IntersectionVertex(graph, label, edgeCoordinate.x,
                                edgeCoordinate.y);
                    }

                    createSegments(from, newEndpoint, Arrays.asList(area), graph);
                    createSegments(newEndpoint, to, intersects, graph);
View Full Code Here


       
        String[] stops = {"agency:A", "agency:B", "agency:C", "agency:D", "agency:E"};
        for (int i = 0; i < stops.length; ++i) {
            TransitStop stop = (TransitStop) (graph.getVertex(stops[i]));
           
            IntersectionVertex front = new IntersectionVertex(graph, "near_1_" + stop.getStopId(), stop.getX() + 0.0001, stop.getY() + 0.0001);
            IntersectionVertex back =  new IntersectionVertex(graph, "near_2_" + stop.getStopId(), stop.getX() - 0.0001, stop.getY() - 0.0001);
           
            StreetEdge street1 = new StreetEdge(front, back, GeometryUtils.makeLineString(stop.getX() + 0.0001, stop.getY() + 0.0001, stop.getX() - 0.0001, stop.getY() - 0.0001), "street", 100, StreetTraversalPermission.ALL, false);
            StreetEdge street2 = new StreetEdge(back, front, GeometryUtils.makeLineString(stop.getX() - 0.0001, stop.getY() - 0.0001, stop.getX() + 0.0001, stop.getY() + 0.0001), "street", 100, StreetTraversalPermission.ALL, true);
        }
View Full Code Here

                    OSMNode nodeJ = visibilityNodes.get(j);
                    P2<OSMNode> nodePair = new P2<OSMNode>(nodeI, nodeJ);
                    if (alreadyAddedEdges.contains(nodePair))
                        continue;

                    IntersectionVertex startEndpoint = __handler.getVertexForOsmNode(nodeI,
                            areaEntity);
                    IntersectionVertex endEndpoint = __handler.getVertexForOsmNode(nodeJ,
                            areaEntity);

                    Coordinate[] coordinates = new Coordinate[] { startEndpoint.getCoordinate(),
                            endEndpoint.getCoordinate() };
                    GeometryFactory geometryFactory = GeometryUtils.getGeometryFactory();
                    LineString line = geometryFactory.createLineString(coordinates);
                    if (poly.contains(line)) {

                        createSegments(nodeI, nodeJ, startEndpoint, endEndpoint, group.areas,
View Full Code Here

        P2<OSMNode> nodePair = new P2<OSMNode>(node, nextNode);
        if (alreadyAddedEdges.contains(nodePair)) {
            return;
        }
        alreadyAddedEdges.add(nodePair);
        IntersectionVertex startEndpoint = __handler.getVertexForOsmNode(node, area.parent);
        IntersectionVertex endEndpoint = __handler.getVertexForOsmNode(nextNode, area.parent);

        createSegments(node, nextNode, startEndpoint, endEndpoint, Arrays.asList(area), edgeList,
                edges);
    }
View Full Code Here

                        edgeCoordinate = ((LineString) lineParts).getEndPoint().getCoordinate();
                    } else {
                        continue;
                    }

                    IntersectionVertex newEndpoint = areaBoundaryVertexForCoordinate
                            .get(edgeCoordinate);
                    if (newEndpoint == null) {
                        newEndpoint = new IntersectionVertex(graph, "area splitter at "
                                + edgeCoordinate, edgeCoordinate.x, edgeCoordinate.y);
                        areaBoundaryVertexForCoordinate.put(edgeCoordinate, newEndpoint);
                    }
                    createSegments(fromNode, toNode, startEndpoint, newEndpoint,
                            Arrays.asList(area), edgeList, edges);
View Full Code Here

        loader.setProvider(provider);

        loader.buildGraph(gg, extra);
       
        // These vertices are labeled in the OSM file as having traffic lights.
        IntersectionVertex iv1 = (IntersectionVertex) gg.getVertex("osm:node:1919595918");
        IntersectionVertex iv2 = (IntersectionVertex) gg.getVertex("osm:node:42442273");
        IntersectionVertex iv3 = (IntersectionVertex) gg.getVertex("osm:node:1919595927");
        IntersectionVertex iv4 = (IntersectionVertex) gg.getVertex("osm:node:42452026");
        assertTrue(iv1.trafficLight);
        assertTrue(iv2.trafficLight);
        assertTrue(iv3.trafficLight);
        assertTrue(iv4.trafficLight);
       
        // These are not.
        IntersectionVertex iv5 = (IntersectionVertex) gg.getVertex("osm:node:42435485");
        IntersectionVertex iv6 = (IntersectionVertex) gg.getVertex("osm:node:42439335");
        IntersectionVertex iv7 = (IntersectionVertex) gg.getVertex("osm:node:42436761");
        IntersectionVertex iv8 = (IntersectionVertex) gg.getVertex("osm:node:42442291");
        assertFalse(iv5.trafficLight);
        assertFalse(iv6.trafficLight);
        assertFalse(iv7.trafficLight);
        assertFalse(iv8.trafficLight);
       
View Full Code Here

             * general correctness and specifically for reverse optimization). This means
             * that during reverse traversal, we must also use the speed for the mode of
             * the backEdge, rather than of the current edge.
             */
            if (options.arriveBy && tov instanceof IntersectionVertex) { // arrive-by search
                IntersectionVertex traversedVertex = ((IntersectionVertex) tov);

                realTurnCost = backOptions.getIntersectionTraversalCostModel().computeTraversalCost(
                        traversedVertex, this, backPSE, backMode, backOptions, (float) speed,
                        (float) backSpeed);
            } else if (!options.arriveBy && fromv instanceof IntersectionVertex) { // depart-after search
                IntersectionVertex traversedVertex = ((IntersectionVertex) fromv);

                realTurnCost = options.getIntersectionTraversalCostModel().computeTraversalCost(
                        traversedVertex, backPSE, this, traverseMode, options, (float) backSpeed,
                        (float) speed);               
            } else {
View Full Code Here

                }

                String endIntersectionName = getIntersectionName(coordinateToStreetNames,
                        intersectionNameToId, endCoordinate);

                IntersectionVertex startIntersection = intersectionsByLocation.get(startCoordinate);
                if (startIntersection == null) {
                    startIntersection = new IntersectionVertex(graph, startIntersectionName, startCoordinate.x,
                            startCoordinate.y, startIntersectionName);
                    intersectionsByLocation.put(startCoordinate, startIntersection);
                }

                IntersectionVertex endIntersection = intersectionsByLocation.get(endCoordinate);
                if (endIntersection == null) {
                    endIntersection = new IntersectionVertex(graph, endIntersectionName, endCoordinate.x,
                            endCoordinate.y, endIntersectionName);
                    intersectionsByLocation.put(endCoordinate, endIntersection);
                }

                double length = 0;
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.