Package org.opentripplanner.visibility

Examples of org.opentripplanner.visibility.VLPoint


     */
    public Ring(List<OSMNode> osmNodes, boolean javaSucks) {
        ArrayList<VLPoint> vertices = new ArrayList<VLPoint>();
        nodes = osmNodes;
        for (OSMNode node : osmNodes) {
            VLPoint point = new VLPoint(node.lon, node.lat);
            vertices.add(point);
        }
        geometry = new VLPolygon(vertices);
    }
View Full Code Here


            if (nodes.contains(node)) {
                // hopefully, this only happens in order to
                // close polygons
                continue;
            }
            VLPoint point = new VLPoint(node.lon, node.lat);
            nodes.add(node);
            vertices.add(point);
        }
        geometry = new VLPolygon(vertices);
    }
View Full Code Here

        Coordinate[] coords = new Coordinate[geometry.n() + 1];
        int i = 0;
        for (VLPoint point : geometry.vertices) {
            coords[i++] = new Coordinate(point.x, point.y);
        }
        VLPoint first = geometry.vertices.get(0);
        coords[i++] = new Coordinate(first.x, first.y);
        return coords;
    }
View Full Code Here

    }

    public static VLPolygon poly(double... coords) {
        ArrayList<VLPoint> points = new ArrayList<VLPoint>();
        for (int i = 0; i < coords.length; i += 2) {
            VLPoint point = new VLPoint(coords[i], coords[i + 1]);
            points.add(point);
        }
        return new VLPolygon(points);
    }
View Full Code Here

    private void addtoVisibilityAndStartSets(Set<OSMNode> startingNodes,
            ArrayList<VLPoint> visibilityPoints, ArrayList<OSMNode> visibilityNodes, OSMNode node) {
        if (osmdb.isNodeBelongsToWay(node.getId())
                || osmdb.isNodeSharedByMultipleAreas(node.getId()) || node.isStop()) {
            startingNodes.add(node);
            VLPoint point = new VLPoint(node.lon, node.lat);
            if (!visibilityPoints.contains(point)) {
                visibilityPoints.add(point);
                visibilityNodes.add(node);
            }
        }
View Full Code Here

        // too broken
        // to use here, so we have to fall back to JTS.
        Coordinate[] coordinates = new Coordinate[visibilityPolygon.n() + 1];

        for (int p = 0; p < coordinates.length; ++p) {
            VLPoint vlPoint = visibilityPolygon.get(p);
            coordinates[p] = new Coordinate(vlPoint.x, vlPoint.y);
        }
        LinearRing shell = GeometryUtils.getGeometryFactory().createLinearRing(coordinates);
        Polygon poly = GeometryUtils.getGeometryFactory().createPolygon(shell, new LinearRing[0]);
        return poly;
View Full Code Here

            if (nodes.contains(node)) {
                // hopefully, this only happens in order to
                // close polygons
                continue;
            }
            VLPoint point = new VLPoint(node.lon, node.lat);
            nodes.add(node);
            vertices.add(point);
        }
    }
View Full Code Here

    private void accumulateVisibilityPoints(List<OSMNode> nodes, VLPolygon polygon,
            List<VLPoint> visibilityPoints, List<OSMNode> visibilityNodes, boolean hole) {
        int n = polygon.vertices.size();
        for (int i = 0; i < n; ++i) {
            OSMNode curNode = nodes.get(i);
            VLPoint cur = polygon.vertices.get(i);
            VLPoint prev = polygon.vertices.get((i + n - 1) % n);
            VLPoint next = polygon.vertices.get((i + 1) % n);
            if (hole
                    || (cur.x - prev.x) * (next.y - cur.y) - (cur.y - prev.y) * (next.x - cur.x) > 0) {
                // that math up there is a cross product to check
                // if the point is concave. Note that the sign is reversed because
                // visilibity is either ccw or latitude-major
View Full Code Here

TOP

Related Classes of org.opentripplanner.visibility.VLPoint

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.