Package org.geotools.grid.hexagon
Class HexagonImpl
- Object
-
- HexagonImpl
-
- All Implemented Interfaces:
GridElement,Hexagon,PolygonElement
public class HexagonImpl extends Object implements Hexagon
Default implementation ofHexagon.- Since:
- 2.7
- Author:
- mbedward
-
-
Constructor Summary
Constructors Constructor Description HexagonImpl(double minX, double minY, double sideLen, HexagonOrientation orientation, CoordinateReferenceSystem crs)Creates a new hexagon.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description doublegetArea()Gets the area of this grid element.ReferencedEnvelopegetBounds()Gets the bounds of this grid element.CoordinategetCenter()Gets the center coordinates of this grid element.HexagonOrientationgetOrientation()Gets the orientation of this hexagon.doublegetSideLength()Gets the side length of this hexagon.Coordinate[]getVertices()Gets the vertices of this grid element.GeometrytoDenseGeometry(double maxSpacing)Creates a new, densifiedGeometryfrom this grid element.GeometrytoGeometry()Creates a newGeometryfrom this grid element.
-
-
-
Constructor Detail
-
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.FLATorHexagon.Orientation.ANGLEDcrs- the coordinate reference system (may benull)
-
-
Method Detail
-
getSideLength
public double getSideLength()
Gets the side length of this hexagon.- Specified by:
getSideLengthin interfaceHexagon- Returns:
- side length
-
getArea
public double getArea()
Gets the area of this grid element.- Specified by:
getAreain interfacePolygonElement- Returns:
- the area
-
getOrientation
public HexagonOrientation getOrientation()
Gets the orientation of this hexagon.- Specified by:
getOrientationin interfaceHexagon- Returns:
- either Orientation#ANGLED or Orientation#FLAT
-
getVertices
public Coordinate[] getVertices()
Gets the vertices of this grid element.- Specified by:
getVerticesin interfaceGridElement- Returns:
- an array of copies of the vertex
Coordinates
-
getBounds
public ReferencedEnvelope getBounds()
Gets the bounds of this grid element.- Specified by:
getBoundsin interfaceGridElement- Returns:
- the bounding rectangle
-
getCenter
public Coordinate getCenter()
Gets the center coordinates of this grid element.- Specified by:
getCenterin interfacePolygonElement- Returns:
- the center coordinates
-
toGeometry
public Geometry toGeometry()
Creates a newGeometryfrom this grid element.- Specified by:
toGeometryin interfaceGridElement- Returns:
- a new
Geometry
-
toDenseGeometry
public Geometry toDenseGeometry(double maxSpacing)
Creates a new, densifiedGeometryfrom this grid element.- Specified by:
toDenseGeometryin interfaceGridElement- Parameters:
maxSpacing- the maximum distance between adjacent vertices- Returns:
- a new
Geometry - Throws:
IllegalArgumentException- ifmaxSpacingis not a positive value
-
-