Examples of VLPolygon


Examples of org.opentripplanner.visibility.VLPolygon

        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

Examples of org.opentripplanner.visibility.VLPolygon

            }
            VLPoint point = new VLPoint(node.lon, node.lat);
            nodes.add(node);
            vertices.add(point);
        }
        geometry = new VLPolygon(vertices);
    }
View Full Code Here

Examples of org.opentripplanner.visibility.VLPolygon

public class TestVisibilityGraph extends TestCase {

    // test the polygon.reverse() function
    public void testPolygonReverse() {
        VLPolygon poly = poly(12.3402039, 45.4342526, 12.3401691, 45.4343433, 12.3401433, 45.4343973,
                12.3402433, 45.4344174, 12.3402845, 45.4344296, 12.3404923, 45.4338996, 12.3401159,
                45.4338161, 12.339956, 45.43421);
        VLPolygon poly2 = poly(12.3402039, 45.4342526, 12.339956, 45.43421, 12.3401159, 45.4338161,
                12.3404923, 45.4338996, 12.3402845, 45.4344296, 12.3402433, 45.4344174, 12.3401433,
                45.4343973, 12.3401691, 45.4343433);
        poly.reverse();
        assertTrue(poly.equals(poly2));
    }
View Full Code Here

Examples of org.opentripplanner.visibility.VLPolygon

        assertTrue(poly.equals(poly2));
    }

    // Another Venice test case
    public void testPalazzo() {
        VLPolygon poly = poly(12.3402039, 45.4342526, 12.339956, 45.43421, 12.3401159, 45.4338161,
                12.3404923, 45.4338996, 12.3402845, 45.4344296, 12.3402433, 45.4344174, 12.3401433,
                45.4343973, 12.3401691, 45.4343433);

        Environment environment = new Environment(Arrays.asList(poly));
        environment.enforce_standard_form();
View Full Code Here

Examples of org.opentripplanner.visibility.VLPolygon

        }
    }

    // The Piazza San Marco in Venice, from OSM.
    public void testSanMarco() {
        VLPolygon poly = poly(12.3389861, 45.4339415, 12.3389153, 45.4340763, 12.3390769, 45.4341172,
                12.3391694, 45.4341388, 12.3392136, 45.4340533, 12.3397036, 45.434177, 12.339797,
                45.4341939, 12.3397873, 45.4342286, 12.339706, 45.4342158, 12.3396866, 45.4342575,
                12.3393905, 45.434195, 12.3391779, 45.4346848, 12.3391272, 45.4347845, 12.3390937,
                45.4347676, 12.3389625, 45.4347071, 12.3386095, 45.4345509, 12.3379792, 45.4342771,
                12.3378901, 45.4342367, 12.3376881, 45.4341478, 12.337471, 45.4340513, 12.3373322,
View Full Code Here

Examples of org.opentripplanner.visibility.VLPolygon

    }

    // A massively reduced version of the Piazza San Marco, which
    // caused problems when the code was buggy
    public void testConcavePolygon2() {
        VLPolygon poly = poly(17.0, 14.0, 70.0, 18.0, 69.0, 26.0, 39.0, 20.0, 13.0, 78.0, -111.0,
                24.0

        );

        Environment environment = new Environment(Arrays.asList(poly));
View Full Code Here

Examples of org.opentripplanner.visibility.VLPolygon

            }
        }
    }

    public void testConcavePolygon() {
        VLPolygon poly = poly(1, 1, 5, 1, 5, 5, 3, 5, 3, 4, 4, 4, 4, 2, 2, 2, 2, 3, 1, 3);

        if (poly.area() < 0) {
            poly.reverse();
        }
        Environment environment = new Environment(Arrays.asList(poly));
        environment.enforce_standard_form();

        VisibilityGraph vg = new VisibilityGraph(environment, 0.01);
View Full Code Here

Examples of org.opentripplanner.visibility.VLPolygon

        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

Examples of org.opentripplanner.visibility.VLPolygon

                }
            }
            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);
            }
View Full Code Here

Examples of org.opentripplanner.visibility.VLPolygon

        }
    }

    private VLPolygon makeStandardizedVLPolygon(List<VLPoint> vertices, List<OSMNode> nodes,
            boolean reversed) {
        VLPolygon polygon = new VLPolygon(vertices);

        if ((reversed && polygon.area() > 0) || (!reversed && polygon.area() < 0)) {
            polygon.reverse();
            // need to reverse nodes as well
            reversePolygonOfOSMNodes(nodes);
        }

        if (!polygon.is_in_standard_form()) {
            standardize(polygon.vertices, nodes);
        }
        return polygon;
    }
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.