Exemple #1
0
  @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));
    }
  }
Exemple #2
0
  @Test
  public void getVertices() {
    PolygonElement oblong = new OblongImpl(MINX, MINY, WIDTH, HEIGHT, null);
    Coordinate[] expected = {
      new Coordinate(MINX, MINY),
      new Coordinate(MINX, MINY + HEIGHT),
      new Coordinate(MINX + WIDTH, MINY + HEIGHT),
      new Coordinate(MINX + WIDTH, MINY),
    };

    Coordinate[] actual = oblong.getVertices();
    assertEquals(expected.length, actual.length);
    for (int i = 0; i < expected.length; i++) {
      assertCoordinate(expected[i], actual[i]);
    }
  }