Package org.geotools.grid

Examples of org.geotools.grid.PolygonElement


        }
    }

    @Test
    public void toGeometry() {
        PolygonElement oblong = new OblongImpl(MINX, MINY, WIDTH, HEIGHT, null);
        Geometry polygon = oblong.toGeometry();
        assertNotNull(polygon);
        assertTrue(polygon instanceof Polygon);

        Set<Coordinate> polyCoords = new HashSet<Coordinate>(Arrays.asList(polygon.getCoordinates()));
        for (Coordinate c : oblong.getVertices()) {
            assertTrue(polyCoords.contains(c));
        }
    }
View Full Code Here


        }
    }

    @Test
    public void toDenseGeometry() {
        PolygonElement oblong = new OblongImpl(0, 0, WIDTH, HEIGHT, null);

        final int density = 10;
        final double maxSpacing = Math.min(WIDTH, HEIGHT) / density;

        Geometry polygon = oblong.toDenseGeometry(maxSpacing);
        assertNotNull(polygon);
        assertTrue(polygon instanceof Polygon);
        assertTrue(polygon.getCoordinates().length - 1 >= 2 * (WIDTH + HEIGHT) * density);
    }
View Full Code Here

         * @param attributes
         *            a {@code Map} with the single key "id"
         */
        @Override
        public void setAttributes(GridElement ge, Map<String, Object> attributes) {
          PolygonElement pe = (PolygonElement) ge;
            attributes.put("id", id);
            attributes.put("centerX", pe.getCenter().x);
            attributes.put("centerY", pe.getCenter().y);
        }
View Full Code Here

TOP

Related Classes of org.geotools.grid.PolygonElement

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.