Class LatLonPolygon2D.Double

    • Field Detail

      • westLon

        public double westLon
      • eastLon

        public double eastLon
      • northLat

        public double northLat
      • southLat

        public double southLat
    • Constructor Detail

      • Double

        public Double()
        Create an empty polygon with no vertices
      • Double

        public Double​(LatLonPoint2D point)
        Create a new polygon with a single starting point.
        Parameters:
        point - the starting point for the polygon
      • Double

        public Double​(double lat,
                      double lon)
        Create a new polygon with a single starting point.
        Parameters:
        lat - the latitude of the starting point
        lon - the longitude of the starting point
      • Double

        public Double​(List<LatLonPoint2D> vertices)
        Create a new polygon from the provided vertices. The resulting polygon is NOT closed
        Parameters:
        vertices - the vertices of the polygon
      • Double

        public Double​(LatLonPoint2D[] vertices)
        Create a new polygon from the provided vertices. The resulting polygon is NOT closed
        Parameters:
        vertices - the vertices of the polygon
      • Double

        public Double​(double[] lats,
                      double[] lons)
        Create a new polygon from the provided arrays. If the arrays are not the same length, the resulting polygon is empty. The resulting polygon is NOT closed
        Parameters:
        lats -
        lons -
    • Method Detail

      • lineTo

        public void lineTo​(double lat,
                           double lon)
        Adds the point specified by the provided lat and lon to the end of the polygon
        Specified by:
        lineTo in class LatLonPolygon2D
        Parameters:
        lat - the latitude of the point to add
        lon - the longitude of the point to add
      • contains

        public boolean contains​(double lat,
                                double lon)
        Determines if the point represented by lat, lon is within this polygon
        Specified by:
        contains in class LatLonPolygon2D
        Parameters:
        lat - the latitude (y) of the point to test
        lon - the longitude (x) of the point to test
        Returns:
        true if the point is contained within this polygon; false otherwise
      • getBoundingLatLonValues

        public double[] getBoundingLatLonValues()
        Calculates the bounding box of this LatLonPolygon2D and returns the coordinates as a double array with a length of 4. The coordinates are arranged in the order of southern lat, western lon, northern lat, and eastern lon

        In terms of points where LL = lower left and UR = upper right, this is equivalent to the arrangement of double[] {lly, llx, ury, urx}.
        Specified by:
        getBoundingLatLonValues in class LatLonPolygon2D
        Returns:
        a double array with a length of 4 containing the lat/lon points of the bounding box of this LatLonPolygon2D. If this object contains no vertices null is returned.