public class Hexagons extends Object
Constructor and Description |
---|
Hexagons() |
Modifier and Type | Method and Description |
---|---|
static double |
areaToSideLength(double area)
Calculates the side length of a hexagon with the given area.
|
static Hexagon |
create(double minX,
double minY,
double sideLen,
HexagonOrientation orientation,
CoordinateReferenceSystem crs)
Creates a new
Hexagon object. |
static SimpleFeatureSource |
createGrid(ReferencedEnvelope bounds,
double sideLen,
double vertexSpacing,
HexagonOrientation orientation,
GridFeatureBuilder gridFeatureBuilder)
Creates a new grid of tesselated hexagons within a bounding rectangle with grid elements
represented by densified polygons (ie. additional vertices added to each edge).
|
static SimpleFeatureSource |
createGrid(ReferencedEnvelope bounds,
double sideLen,
HexagonOrientation orientation,
GridFeatureBuilder gridBuilder)
Creates a new grid of tesselated hexagons within a bounding rectangle with grid elements
represented by simple (ie. undensified) polygons.
|
static double |
sideLengthToArea(double sideLen)
Calculates the area of a hexagon with the given side length.
|
public static double sideLengthToArea(double sideLen)
sideLen
- side lengthIllegalArgumentException
- if sideLen
is not greater than zeropublic static double areaToSideLength(double area)
area
- the areaIllegalArgumentException
- if area
is not greater than zeropublic static Hexagon create(double minX, double minY, double sideLen, HexagonOrientation orientation, CoordinateReferenceSystem crs)
Hexagon
object.minX
- the min X ordinate of the bounding rectangleminY
- the min Y ordinate of the bounding rectanglesideLen
- the side lengthorientation
- either Hexagon.Orientation.FLAT
or Hexagon.Orientation.ANGLED
crs
- the coordinate reference system (may be null
)Hexagon
objectIllegalArgumentException
- if sideLen
is <=
0 or if orientation
is null
public static SimpleFeatureSource createGrid(ReferencedEnvelope bounds, double sideLen, HexagonOrientation orientation, GridFeatureBuilder gridBuilder)
bounds
- the bounding rectanglesideLen
- hexagon side lengthorientation
- hexagon orientationgridBuilder
- an instance of GridFeatureBuilder
IllegalArgumentException
- if bounds is null or empty; or if sideLen is <=
0;
or if the CoordinateReferenceSystems
set for the bounds and the GridFeatureBuilder
are both non-null but differentpublic static SimpleFeatureSource createGrid(ReferencedEnvelope bounds, double sideLen, double vertexSpacing, HexagonOrientation orientation, GridFeatureBuilder gridFeatureBuilder)
bounds
- the bounding rectanglesideLen
- hexagon side lengthvertexSpacing
- maximum distance between adjacent vertices in a grid element; if <= 0
or >= min(width, height) / 2.0
it is ignored and the polygons will not be
densifiedorientation
- hexagon orientationgridFeatureBuilder
- an instance of GridFeatureBuilder
IllegalArgumentException
- if bounds is null or empty; or if sideLen is <=
0;
or if the CoordinateReferenceSystems
set for the bounds and the GridFeatureBuilder
are both non-null but differentCopyright © 1996–2019 Geotools. All rights reserved.