Interface S2Region

All Known Implementing Classes:
S2Cap, S2Cell, S2CellUnion, S2LatLngRect, S2LatLngRect.Builder, S2LatLngRectBase, S2Loop, S2Point, S2PointRegion, S2Polygon, S2Polyline, S2RegionIntersection, S2RegionUnion, S2Shape.ReferencePoint, S2ShapeIndexRegion

@GwtCompatible public interface S2Region
An S2Region represents a two-dimensional region over the unit sphere. It is an abstract interface with various concrete subtypes.

The main purpose of this interface is to allow complex regions to be approximated as simpler regions. So rather than having a wide variety of virtual methods that are implemented by all subtypes, the interface is restricted to methods that are useful for computing approximations.

  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    If this method returns true, the region completely contains the given cell.
    boolean
    Returns true if and only if the given point is contained by the region.
    Return a bounding spherical cap.
    Return a bounding latitude-longitude rectangle.
    boolean
    If this method returns false, the region does not intersect the given cell.
  • Method Details

    • getCapBound

      S2Cap getCapBound()
      Return a bounding spherical cap.
    • getRectBound

      S2LatLngRect getRectBound()
      Return a bounding latitude-longitude rectangle.
    • contains

      boolean contains(S2Cell cell)
      If this method returns true, the region completely contains the given cell. Otherwise, either the region does not contain the cell or the containment relationship could not be determined.
    • contains

      boolean contains(S2Point p)
      Returns true if and only if the given point is contained by the region. p is generally required to be unit length, although some subtypes may relax this restriction.
    • mayIntersect

      boolean mayIntersect(S2Cell cell)
      If this method returns false, the region does not intersect the given cell. Otherwise, either region intersects the cell, or the intersection relationship could not be determined.