Class Polygon

java.lang.Object
com.graphhopper.util.shapes.Polygon
All Implemented Interfaces:
Shape

public class Polygon extends Object implements Shape
This class represents a polygon that is defined by a set of points. Every point i is connected to point i-1 and i+1.
Author:
Robin Boldt
  • Field Details

    • prepPolygon

      public final org.locationtech.jts.geom.prep.PreparedGeometry prepPolygon
    • rectangle

      public final boolean rectangle
    • envelope

      public final org.locationtech.jts.geom.Envelope envelope
    • bbox

      public final BBox bbox
  • Constructor Details

    • Polygon

      public Polygon(org.locationtech.jts.geom.prep.PreparedPolygon prepPolygon)
    • Polygon

      public Polygon(double[] lats, double[] lons)
  • Method Details

    • create

      public static Polygon create(org.locationtech.jts.geom.Polygon polygon)
    • intersects

      public boolean intersects(PointList pointList)
      Specified by:
      intersects in interface Shape
    • contains

      public boolean contains(double lat, double lon)
      Does the point in polygon check.
      Specified by:
      contains in interface Shape
      Parameters:
      lat - Latitude of the point to be checked
      lon - Longitude of the point to be checked
      Returns:
      true if point is inside polygon
    • getBounds

      public BBox getBounds()
      Specified by:
      getBounds in interface Shape
      Returns:
      the minimal rectangular bounding box of this shape
    • getMinLat

      public double getMinLat()
    • getMinLon

      public double getMinLon()
    • getMaxLat

      public double getMaxLat()
    • getMaxLon

      public double getMaxLon()
    • isRectangle

      public boolean isRectangle()
    • toString

      public String toString()
      Overrides:
      toString in class Object