@Test public void createGrid() throws Exception { final SimpleFeatureType TYPE = DataUtilities.createType("hextype", "hexagon:Polygon,id:Integer"); final double SPAN = 100; final ReferencedEnvelope bounds = new ReferencedEnvelope(0, SPAN, 0, SPAN, null); class Setter extends GridFeatureBuilder { int id = 0; public Setter(SimpleFeatureType type) { super(type); } @Override public void setAttributes(GridElement el, Map<String, Object> attributes) { attributes.put("id", ++id); } } Setter setter = new Setter(TYPE); SimpleFeatureSource gridSource = Hexagons.createGrid(bounds, SIDE_LEN, HexagonOrientation.FLAT, setter); assertNotNull(gridSource); int expectedCols = (int) ((SPAN - 2 * SIDE_LEN) / (1.5 * SIDE_LEN)) + 1; int expectedRows = (int) (SPAN / (Math.sqrt(3.0) * SIDE_LEN)); assertEquals(expectedCols * expectedRows, setter.id); assertEquals(setter.id, gridSource.getFeatures().size()); }
public static SimpleFeatureSource createGrid( ReferencedEnvelope bounds, double sideLen, HexagonOrientation orientation, GridFeatureBuilder gridBuilder) { return createGrid(bounds, sideLen, -1, orientation, gridBuilder); }
Hexagons { public static SimpleFeatureSource createGrid( ReferencedEnvelope bounds, double sideLen, HexagonOrientation orientation, GridFeatureBuilder gridBuilder) { return createGrid(bounds, sideLen, -1, orientation, gridBuilder); } }
Hexagons { public static SimpleFeatureSource createGrid( ReferencedEnvelope bounds, double sideLen, HexagonOrientation orientation, GridFeatureBuilder gridBuilder) { return createGrid(bounds, sideLen, -1, orientation, gridBuilder); }  }
Hexagons { public static SimpleFeatureSource createGrid( ReferencedEnvelope bounds, double sideLen, HexagonOrientation orientation, GridFeatureBuilder gridBuilder) { return createGrid(bounds, sideLen, -1, orientation, gridBuilder); }  static double sideLengthToArea(double sideLen); static double areaToSideLength(double area); static Hexagon create(double minX, double minY, double sideLen,
            HexagonOrientation orientation, CoordinateReferenceSystem crs); static SimpleFeatureSource createGrid(
            ReferencedEnvelope bounds,
            double sideLen,
            HexagonOrientation orientation,
            GridFeatureBuilder gridBuilder); static SimpleFeatureSource createGrid(
            ReferencedEnvelope bounds,
            double sideLen,
            double vertexSpacing,
            HexagonOrientation orientation,
            GridFeatureBuilder gridFeatureBuilder); }
Hexagons { public static SimpleFeatureSource createGrid( ReferencedEnvelope bounds, double sideLen, HexagonOrientation orientation, GridFeatureBuilder gridBuilder) { return createGrid(bounds, sideLen, -1, orientation, gridBuilder); }  static double sideLengthToArea(double sideLen); static double areaToSideLength(double area); static Hexagon create(double minX, double minY, double sideLen,
            HexagonOrientation orientation, CoordinateReferenceSystem crs); static SimpleFeatureSource createGrid(
            ReferencedEnvelope bounds,
            double sideLen,
            HexagonOrientation orientation,
            GridFeatureBuilder gridBuilder); static SimpleFeatureSource createGrid(
            ReferencedEnvelope bounds,
            double sideLen,
            double vertexSpacing,
            HexagonOrientation orientation,
            GridFeatureBuilder gridFeatureBuilder);  }