Package org.opentripplanner.openstreetmap.model

Examples of org.opentripplanner.openstreetmap.model.OSMLevel


        }

        // areas that can be joined must share nodes and levels
        for (OSMNode osmNode : areasForNode.keySet()) {
            for (Area area1 : areasForNode.get(osmNode)) {
                OSMLevel level1 = areasLevels.get(area1);
                for (Area area2 : areasForNode.get(osmNode)) {
                    OSMLevel level2 = areasLevels.get(area2);
                    if ((level1 == null && level2 == null)
                            || (level1 != null && level1.equals(level2))) {
                        groups.union(area1, area2);
                    }
                }
View Full Code Here


         * @param way the way that has the level
         * @param node the node to record for
         * @author mattwigway
         */
        private IntersectionVertex recordLevel(OSMNode node, OSMWithTags way) {
            OSMLevel level = osmdb.getLevelForWay(way);
            HashMap<OSMLevel, IntersectionVertex> vertices;
            long nodeId = node.getId();
            if (multiLevelNodes.containsKey(nodeId)) {
                vertices = multiLevelNodes.get(nodeId);
            } else {
View Full Code Here

        }

        // For each way, intersect with areas
        int nCreatedNodes = 0;
        for (OSMWay way : waysById.values()) {
            OSMLevel wayLevel = getLevelForWay(way);

            // For each segment of the way
            for (int i = 0; i < way.getNodeRefs().size() - 1; i++) {

                OSMNode nA = nodesById.get(way.getNodeRefs().get(i));
                OSMNode nB = nodesById.get(way.getNodeRefs().get(i + 1));
                if (nA == null || nB == null) {
                    continue;
                }

                Envelope env = new Envelope(nA.lon, nB.lon, nA.lat, nB.lat);
                List<RingSegment> ringSegments = spndx.query(env);
                if (ringSegments.size() == 0)
                    continue;
                LineString seg = GeometryUtils.makeLineString(nA.lon, nA.lat, nB.lon, nB.lat);

                for (RingSegment ringSegment : ringSegments) {

                    // Skip if both segments share a common node
                    if (ringSegment.nA.getId() == nA.getId()
                            || ringSegment.nA.getId() == nB.getId()
                            || ringSegment.nB.getId() == nA.getId()
                            || ringSegment.nB.getId() == nB.getId())
                        continue;

                    // Check for real intersection
                    LineString seg2 = GeometryUtils.makeLineString(ringSegment.nA.lon,
                            ringSegment.nA.lat, ringSegment.nB.lon, ringSegment.nB.lat);
                    Geometry intersection = seg2.intersection(seg);
                    Point p = null;
                    if (intersection.isEmpty()) {
                        continue;
                    } else if (intersection instanceof Point) {
                        p = (Point) intersection;
                    } else {
                        /*
                         * This should never happen (intersection between two lines should be a
                         * point or a multi-point).
                         */
                        LOG.error("Alien intersection type between {} ({}--{}) and {} ({}--{}): ",
                                way, nA, nB, ringSegment.area.parent, ringSegment.nA,
                                ringSegment.nB, intersection);
                        continue;
                    }

                    // Skip if area and way are from "incompatible" levels
                    OSMLevel areaLevel = getLevelForWay(ringSegment.area.parent);
                    if (!wayLevel.equals(areaLevel))
                        continue;

                    // Create a virtual node and insert it in both the way and the ring
                    OSMNode virtualNode = createVirtualNode(p.getCoordinate());
View Full Code Here

            // if this way is not a key in the wayLevels map, a level map was not
            // already applied in processRelations

            /* try to find a level name in tags */
            String levelName = null;
            OSMLevel level = OSMLevel.DEFAULT;
            if (way.hasTag("level")) { // TODO: floating-point levels &c.
                levelName = way.getTag("level");
                level = OSMLevel.fromString(levelName, OSMLevel.Source.LEVEL_TAG, noZeroLevels);
            } else if (way.hasTag("layer")) {
                levelName = way.getTag("layer");
View Full Code Here

TOP

Related Classes of org.opentripplanner.openstreetmap.model.OSMLevel

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.