/** * Overrides {@linkplain GridFeatureBuilder#setAttributes(GridElement, Map)} to assign a * sequential integer id value to each grid element feature as it is constructed. * * @param el the element from which the new feature is being constructed * @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); }
@Test public void getCenter() { PolygonElement oblong = new OblongImpl(MINX, MINY, WIDTH, HEIGHT, null); Coordinate expected = new Coordinate(WIDTH / 2 + MINX, HEIGHT / 2 + MINY); assertCoordinate(expected, oblong.getCenter()); }