Package org.geotools.grid

Examples of org.geotools.grid.PolygonElement


*/
public class OblongsTest extends TestBase {

    @Test
    public void create() {
        PolygonElement oblong = Oblongs.create(1, 2, 3, 4, null);
        assertNotNull(oblong);
        assertEnvelope(new ReferencedEnvelope(1, 4, 2, 6, null), oblong.getBounds());
    }
View Full Code Here


    @Test
    public void getVerticesFlat() {
        double minx = 1.0;
        double miny = -1.0;
        PolygonElement hexagon = new HexagonImpl(minx, miny, SIDE_LEN, HexagonOrientation.FLAT, null);

        assertVertices(hexagon, minx, miny, SIDE_LEN, HexagonOrientation.FLAT);
    }
View Full Code Here

        assertVertices(hexagon, minx, miny, SIDE_LEN, HexagonOrientation.FLAT);
    }

    @Test(expected=IllegalArgumentException.class)
    public void badSideLen() throws Exception {
        PolygonElement h = new HexagonImpl(0.0, 0.0, 0.0, HexagonOrientation.FLAT, null);
    }
View Full Code Here

        PolygonElement h = new HexagonImpl(0.0, 0.0, 0.0, HexagonOrientation.FLAT, null);
    }

    @Test(expected=IllegalArgumentException.class)
    public void badOrientation() throws Exception {
        PolygonElement h = new HexagonImpl(0.0, 0.0, SIDE_LEN, null, null);
    }
View Full Code Here

    @Test
    public void getVerticesAngled() {
        double minx = 1.0;
        double miny = -1.0;
        PolygonElement hexagon = new HexagonImpl(minx, miny, SIDE_LEN, HexagonOrientation.ANGLED, null);

        assertVertices(hexagon, minx, miny, SIDE_LEN, HexagonOrientation.ANGLED);
    }
View Full Code Here

        assertVertices(hexagon, minx, miny, SIDE_LEN, HexagonOrientation.ANGLED);
    }

    @Test
    public void getCenterFlat() throws Exception {
        PolygonElement hexagon = new HexagonImpl(0.0, 0.0, SIDE_LEN, HexagonOrientation.FLAT, null);
        Coordinate expected = new Coordinate(SIDE_LEN, 0.5 * Math.sqrt(3.0) * SIDE_LEN);
        Coordinate result = hexagon.getCenter();

        assertCoordinate(expected, result);
    }
View Full Code Here

    private static final double WIDTH = 2.0;
    private static final double HEIGHT = 1.0;

    @Test
    public void createValid() {
        PolygonElement oblong = new OblongImpl(0, 0, WIDTH, HEIGHT, null);
        assertNotNull(oblong);
    }
View Full Code Here

        assertCoordinate(expected, result);
    }

    @Test
    public void getCenterAngled() {
        PolygonElement hexagon = new HexagonImpl(0.0, 0.0, SIDE_LEN, HexagonOrientation.ANGLED, null);
        Coordinate expected = new Coordinate(0.5 * Math.sqrt(3.0) * SIDE_LEN, SIDE_LEN);
        Coordinate result = hexagon.getCenter();

        assertCoordinate(expected, result);
    }
View Full Code Here

        assertNotNull(oblong);
    }

    @Test(expected=IllegalArgumentException.class)
    public void negativeWidth() {
        PolygonElement oblong = new OblongImpl(0, 0, -1, HEIGHT, null);
    }
View Full Code Here

        assertCoordinate(expected, result);
    }

    @Test
    public void getBoundsFlat() {
        PolygonElement hexagon = new HexagonImpl(0.0, 0.0, SIDE_LEN, HexagonOrientation.FLAT, null);

        Envelope expected = new Envelope(
                0.0,
                2.0 * SIDE_LEN,
                0.0,
                Math.sqrt(3.0) * SIDE_LEN);

        Envelope result = hexagon.getBounds();

        assertEnvelope(expected, result);
    }
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.