Package org.geotools.grid.hexagon
Class HexagonImpl
Object
HexagonImpl
- All Implemented Interfaces:
GridElement
,Hexagon
,PolygonElement
Default implementation of
Hexagon
.- Since:
- 2.7
- Author:
- mbedward
-
Constructor Summary
ConstructorsConstructorDescriptionHexagonImpl
(double minX, double minY, double sideLen, HexagonOrientation orientation, CoordinateReferenceSystem crs) Creates a new hexagon. -
Method Summary
Modifier and TypeMethodDescriptiondouble
getArea()
Gets the area of this grid element.Gets the bounds of this grid element.Gets the center coordinates of this grid element.Gets the orientation of this hexagon.double
Gets the side length of this hexagon.Gets the vertices of this grid element.toDenseGeometry
(double maxSpacing) Creates a new, densifiedGeometry
from this grid element.Creates a newGeometry
from this grid element.
-
Constructor Details
-
HexagonImpl
public HexagonImpl(double minX, double minY, double sideLen, HexagonOrientation orientation, CoordinateReferenceSystem crs) Creates a new hexagon.- Parameters:
minX
- the min X ordinate of the bounding rectangleminY
- the min Y ordinate of the bounding rectanglesideLen
- the side lengthorientation
- eitherHexagon.Orientation.FLAT
orHexagon.Orientation.ANGLED
crs
- the coordinate reference system (may benull
)
-
-
Method Details
-
getSideLength
public double getSideLength()Gets the side length of this hexagon.- Specified by:
getSideLength
in interfaceHexagon
- Returns:
- side length
-
getArea
public double getArea()Gets the area of this grid element.- Specified by:
getArea
in interfacePolygonElement
- Returns:
- the area
-
getOrientation
Gets the orientation of this hexagon.- Specified by:
getOrientation
in interfaceHexagon
- Returns:
- either Orientation#ANGLED or Orientation#FLAT
-
getVertices
Gets the vertices of this grid element.- Specified by:
getVertices
in interfaceGridElement
- Returns:
- an array of copies of the vertex
Coordinates
-
getBounds
Gets the bounds of this grid element.- Specified by:
getBounds
in interfaceGridElement
- Returns:
- the bounding rectangle
-
getCenter
Gets the center coordinates of this grid element.- Specified by:
getCenter
in interfacePolygonElement
- Returns:
- the center coordinates
-
toGeometry
Creates a newGeometry
from this grid element.- Specified by:
toGeometry
in interfaceGridElement
- Returns:
- a new
Geometry
-
toDenseGeometry
Creates a new, densifiedGeometry
from this grid element.- Specified by:
toDenseGeometry
in interfaceGridElement
- Parameters:
maxSpacing
- the maximum distance between adjacent vertices- Returns:
- a new
Geometry
- Throws:
IllegalArgumentException
- ifmaxSpacing
is not a positive value
-