Examples of AreaEdgeList


Examples of org.opentripplanner.routing.edgetype.AreaEdgeList

        Set<Edge> edges = new HashSet<Edge>();

        // create polygon and accumulate nodes for area
        for (Ring ring : group.outermostRings) {

            AreaEdgeList edgeList = new AreaEdgeList();
            // the points corresponding to concave or hole vertices
            // or those linked to ways
            ArrayList<VLPoint> visibilityPoints = new ArrayList<VLPoint>();
            ArrayList<OSMNode> visibilityNodes = new ArrayList<OSMNode>();
            HashSet<P2<OSMNode>> alreadyAddedEdges = new HashSet<P2<OSMNode>>();
            // we need to accumulate visibility points from all contained areas
            // inside this ring, but only for shared nodes; we don't care about
            // convexity, which we'll handle for the grouped area only.

            // we also want to fill in the edges of this area anyway, because we can,
            // and to avoid the numerical problems that they tend to cause
            for (Area area : group.areas) {
                if (!ring.toJtsPolygon().contains(area.toJTSMultiPolygon())) {
                    continue;
                }

                // Add stops from public transit relations into the area
                Collection<OSMNode> nodes = osmdb.getStopsInArea(area.parent);
                if (nodes != null) {
                    for (OSMNode node : nodes) {
                        addtoVisibilityAndStartSets(startingNodes, visibilityPoints,
                                visibilityNodes, node);
                    }
                }

                for (Ring outerRing : area.outermostRings) {
                    for (int i = 0; i < outerRing.nodes.size(); ++i) {
                        OSMNode node = outerRing.nodes.get(i);
                        createEdgesForRingSegment(edges, edgeList, area, outerRing, i,
                                alreadyAddedEdges);
                        addtoVisibilityAndStartSets(startingNodes, visibilityPoints,
                                visibilityNodes, node);
                    }
                    for (Ring innerRing : outerRing.holes) {
                        for (int j = 0; j < innerRing.nodes.size(); ++j) {
                            OSMNode node = innerRing.nodes.get(j);
                            createEdgesForRingSegment(edges, edgeList, area, innerRing, j,
                                    alreadyAddedEdges);
                            addtoVisibilityAndStartSets(startingNodes, visibilityPoints,
                                    visibilityNodes, node);
                        }
                    }
                }
            }
            List<OSMNode> nodes = new ArrayList<OSMNode>();
            List<VLPoint> vertices = new ArrayList<VLPoint>();
            accumulateRingNodes(ring, nodes, vertices);
            VLPolygon polygon = makeStandardizedVLPolygon(vertices, nodes, false);
            accumulateVisibilityPoints(ring.nodes, polygon, visibilityPoints, visibilityNodes,
                    false);

            ArrayList<VLPolygon> polygons = new ArrayList<VLPolygon>();
            polygons.add(polygon);
            // holes
            for (Ring innerRing : ring.holes) {
                ArrayList<OSMNode> holeNodes = new ArrayList<OSMNode>();
                vertices = new ArrayList<VLPoint>();
                accumulateRingNodes(innerRing, holeNodes, vertices);
                VLPolygon hole = makeStandardizedVLPolygon(vertices, holeNodes, true);
                accumulateVisibilityPoints(innerRing.nodes, hole, visibilityPoints,
                        visibilityNodes, true);
                nodes.addAll(holeNodes);
                polygons.add(hole);
            }

            Environment areaEnv = new Environment(polygons);
            // FIXME: temporary hard limit on size of
            // areas to prevent way explosion
            if (visibilityPoints.size() > MAX_AREA_NODES) {
                LOG.warn("Area " + group.getSomeOSMObject() + " is too complicated ("
                        + visibilityPoints.size() + " > " + MAX_AREA_NODES);
                continue;
            }

            if (!areaEnv.is_valid(VISIBILITY_EPSILON)) {
                LOG.warn("Area " + group.getSomeOSMObject() + " is not epsilon-valid (epsilon = "
                        + VISIBILITY_EPSILON + ")");
                continue;
            }

            edgeList.setOriginalEdges(ring.toJtsPolygon());

            createNamedAreas(edgeList, ring, group.areas);

            OSMWithTags areaEntity = group.getSomeOSMObject();
View Full Code Here

Examples of org.opentripplanner.routing.edgetype.AreaEdgeList

            HashSet<Edge> seenEdges = new HashSet<Edge>();
            HashSet<AreaEdgeList> seenAreas = new HashSet<AreaEdgeList>();
            for (Vertex vertex : graph.getVertices()) {
                for (Edge e : vertex.getOutgoing()) {
                    if (e instanceof AreaEdge) {
                        AreaEdgeList areaEdgeList = ((AreaEdge) e).getArea();
                        if (seenAreas.contains(areaEdgeList))
                            continue;
                        seenAreas.add(areaEdgeList);
                        for (NamedArea area : areaEdgeList.getAreas()) {
                            area.setBicycleSafetyMultiplier(area.getBicycleSafetyMultiplier()
                                    / bestBikeSafety);
                        }
                    }
                    if (!(e instanceof StreetEdge)) {
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.