Class XYPolygon


  • public class XYPolygon
    extends java.lang.Object
    Represents a polygon in cartesian space. You can construct the Polygon directly with double[], double[] x, y arrays coordinates.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private XYPolygon[] holes  
      double maxX
      maximum x of this polygon's bounding box area
      double maxY
      maximum y of this polygon's bounding box area
      double minX
      minimum x of this polygon's bounding box area
      double minY
      minimum y of this polygon's bounding box area
      private GeoUtils.WindingOrder windingOrder
      winding order of the vertices
      private double[] x  
      private double[] y  
    • Constructor Summary

      Constructors 
      Constructor Description
      XYPolygon​(float[] x, float[] y, XYPolygon... holes)
      Creates a new Polygon from the supplied x, y arrays, and optionally any holes.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object obj)  
      (package private) XYPolygon getHole​(int i)  
      XYPolygon[] getHoles()
      Returns a copy of the internal holes array
      double[] getPolyX()
      Returns a copy of the internal x array
      double getPolyX​(int vertex)
      Returns x value at given index
      double[] getPolyY()
      Returns a copy of the internal y array
      double getPolyY​(int vertex)
      Returns y value at given index
      GeoUtils.WindingOrder getWindingOrder()
      Returns the winding order (CW, COLINEAR, CCW) for the polygon shell
      int hashCode()  
      int numHoles()
      returns the number of holes for the polygon
      int numPoints()
      returns the number of vertex points
      java.lang.String toGeoJSON()
      prints polygons as geojson
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • x

        private final double[] x
      • y

        private final double[] y
      • minX

        public final double minX
        minimum x of this polygon's bounding box area
      • maxX

        public final double maxX
        maximum x of this polygon's bounding box area
      • minY

        public final double minY
        minimum y of this polygon's bounding box area
      • maxY

        public final double maxY
        maximum y of this polygon's bounding box area
    • Constructor Detail

      • XYPolygon

        public XYPolygon​(float[] x,
                         float[] y,
                         XYPolygon... holes)
        Creates a new Polygon from the supplied x, y arrays, and optionally any holes.
    • Method Detail

      • numPoints

        public int numPoints()
        returns the number of vertex points
      • getPolyX

        public double[] getPolyX()
        Returns a copy of the internal x array
      • getPolyX

        public double getPolyX​(int vertex)
        Returns x value at given index
      • getPolyY

        public double[] getPolyY()
        Returns a copy of the internal y array
      • getPolyY

        public double getPolyY​(int vertex)
        Returns y value at given index
      • getHoles

        public XYPolygon[] getHoles()
        Returns a copy of the internal holes array
      • getWindingOrder

        public GeoUtils.WindingOrder getWindingOrder()
        Returns the winding order (CW, COLINEAR, CCW) for the polygon shell
      • numHoles

        public int numHoles()
        returns the number of holes for the polygon
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • toGeoJSON

        public java.lang.String toGeoJSON()
        prints polygons as geojson