Class HexagonImpl

Object
HexagonImpl
All Implemented Interfaces:
GridElement, Hexagon, PolygonElement

public class HexagonImpl extends Object implements Hexagon
Default implementation of Hexagon.
Since:
2.7
Author:
mbedward
  • 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 rectangle
      minY - the min Y ordinate of the bounding rectangle
      sideLen - the side length
      orientation - either Hexagon.Orientation.FLAT or Hexagon.Orientation.ANGLED
      crs - the coordinate reference system (may be null)
  • Method Details

    • getSideLength

      public double getSideLength()
      Gets the side length of this hexagon.
      Specified by:
      getSideLength in interface Hexagon
      Returns:
      side length
    • getArea

      public double getArea()
      Gets the area of this grid element.
      Specified by:
      getArea in interface PolygonElement
      Returns:
      the area
    • getOrientation

      public HexagonOrientation getOrientation()
      Gets the orientation of this hexagon.
      Specified by:
      getOrientation in interface Hexagon
      Returns:
      either Orientation#ANGLED or Orientation#FLAT
    • getVertices

      public Coordinate[] getVertices()
      Gets the vertices of this grid element.
      Specified by:
      getVertices in interface GridElement
      Returns:
      an array of copies of the vertex Coordinates
    • getBounds

      public ReferencedEnvelope getBounds()
      Gets the bounds of this grid element.
      Specified by:
      getBounds in interface GridElement
      Returns:
      the bounding rectangle
    • getCenter

      public Coordinate getCenter()
      Gets the center coordinates of this grid element.
      Specified by:
      getCenter in interface PolygonElement
      Returns:
      the center coordinates
    • toGeometry

      public Geometry toGeometry()
      Creates a new Geometry from this grid element.
      Specified by:
      toGeometry in interface GridElement
      Returns:
      a new Geometry
    • toDenseGeometry

      public Geometry toDenseGeometry(double maxSpacing)
      Creates a new, densified Geometry from this grid element.
      Specified by:
      toDenseGeometry in interface GridElement
      Parameters:
      maxSpacing - the maximum distance between adjacent vertices
      Returns:
      a new Geometry
      Throws:
      IllegalArgumentException - if maxSpacing is not a positive value