|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ObjectHexagons
public class Hexagons
A utilities class with static methods to create and work with hexagonal grid elements.
Constructor Summary | |
---|---|
Hexagons()
|
Method Summary | |
---|---|
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. |
Methods inherited from class Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Hexagons()
Method Detail |
---|
public static double sideLengthToArea(double sideLen)
sideLen
- side length
IllegalArgumentException
- if sideLen
is not greater than zeropublic static double areaToSideLength(double area)
area
- the area
IllegalArgumentException
- 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
object
IllegalArgumentException
- 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 different
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |