public class HexagonBuilder extends PolygonBuilder
Hexagons
class to build grids.gridBounds
Constructor and Description |
---|
HexagonBuilder(ReferencedEnvelope gridBounds,
double sideLen,
HexagonOrientation orientation) |
Modifier and Type | Method and Description |
---|---|
Hexagon |
createNeighbor(PolygonElement el,
Neighbor neighbor)
Creates a new
Hexagon positioned at the given neighbor position relative to the
reference element. |
PolygonElement |
getFirstElement() |
PolygonElement |
getNextXElement(PolygonElement el) |
PolygonElement |
getNextYElement(PolygonElement el) |
boolean |
isValidDenseVertexSpacing(double v) |
boolean |
isValidNeighbor(Neighbor neighbor)
Tests whether a neighbor position is valid for a given orientation.
|
buildGrid
public HexagonBuilder(ReferencedEnvelope gridBounds, double sideLen, HexagonOrientation orientation)
public boolean isValidNeighbor(Neighbor neighbor)
Hexagon
class is intended to work within a grid (ie. a perfect tesselation) some combinations of
neighbour position and hexagon orientation are invalid. For example, a FLAT
hexagon
does not have a LEFT
, rather it has UPPER_LEFT
and LOWER_LEFT
.isValidNeighbor
in class PolygonBuilder
orientation
- hexagon orientationneighbor
- neighbor positiontrue
if the combination is valid; false
otherwisepublic Hexagon createNeighbor(PolygonElement el, Neighbor neighbor)
Hexagon
positioned at the given neighbor position relative to the
reference element.createNeighbor
in class PolygonBuilder
el
- the reference hexagonneighbor
- a valid neighbour position given the reference hexagon's orientationHexagon
objectIllegalArgumentException
- if either argument is null
or if el
is not
an instance of Hexagon
or if the neighbor position is not valid for the reference
hexagon's orientation#isValidNeighbor(Hexagon.Orientation, Hexagon.Neighbor)
public PolygonElement getFirstElement()
getFirstElement
in class PolygonBuilder
public PolygonElement getNextXElement(PolygonElement el)
getNextXElement
in class PolygonBuilder
public PolygonElement getNextYElement(PolygonElement el)
getNextYElement
in class PolygonBuilder
public boolean isValidDenseVertexSpacing(double v)
isValidDenseVertexSpacing
in class PolygonBuilder
Copyright © 1996–2019 Geotools. All rights reserved.