Package org.geotools.grid.hexagon
Class HexagonBuilder
Object
PolygonBuilder
HexagonBuilder
Used by
Hexagons
class to build grids.- Since:
- 2.7
- Author:
- mbedward
-
Field Summary
Fields inherited from class PolygonBuilder
gridBounds
-
Constructor Summary
ConstructorsConstructorDescriptionHexagonBuilder
(ReferencedEnvelope gridBounds, double sideLen, HexagonOrientation orientation) -
Method Summary
Modifier and TypeMethodDescriptioncreateNeighbor
(PolygonElement el, Neighbor neighbor) Creates a newHexagon
positioned at the given neighbor position relative to the reference element.boolean
isValidDenseVertexSpacing
(double v) boolean
isValidNeighbor
(Neighbor neighbor) Tests whether a neighbor position is valid for a given orientation.Methods inherited from class PolygonBuilder
buildGrid
-
Constructor Details
-
HexagonBuilder
public HexagonBuilder(ReferencedEnvelope gridBounds, double sideLen, HexagonOrientation orientation)
-
-
Method Details
-
isValidNeighbor
Tests whether a neighbor position is valid for a given orientation. Since theHexagon
class is intended to work within a grid (ie. a perfect tesselation) some combinations of neighbour position and hexagon orientation are invalid. For example, aFLAT
hexagon does not have aLEFT
, rather it hasUPPER_LEFT
andLOWER_LEFT
.- Specified by:
isValidNeighbor
in classPolygonBuilder
- Parameters:
neighbor
- neighbor position- Returns:
true
if the combination is valid;false
otherwise
-
createNeighbor
Creates a newHexagon
positioned at the given neighbor position relative to the reference element.- Specified by:
createNeighbor
in classPolygonBuilder
- Parameters:
el
- the reference hexagonneighbor
- a valid neighbour position given the reference hexagon's orientation- Returns:
- a new
Hexagon
object - Throws:
IllegalArgumentException
- if either argument isnull
or ifel
is not an instance ofHexagon
or if the neighbor position is not valid for the reference hexagon's orientation- See Also:
-
#isValidNeighbor(Hexagon.Orientation, Hexagon.Neighbor)
-
getFirstElement
- Specified by:
getFirstElement
in classPolygonBuilder
-
getNextXElement
- Specified by:
getNextXElement
in classPolygonBuilder
-
getNextYElement
- Specified by:
getNextYElement
in classPolygonBuilder
-
isValidDenseVertexSpacing
public boolean isValidDenseVertexSpacing(double v) - Specified by:
isValidDenseVertexSpacing
in classPolygonBuilder
-