Package com.google.common.geometry
Class S2RegionIntersection
- java.lang.Object
-
- com.google.common.geometry.S2RegionIntersection
-
- All Implemented Interfaces:
S2Region
,java.io.Serializable
@GwtCompatible(serializable=true) public class S2RegionIntersection extends java.lang.Object implements S2Region, java.io.Serializable
An S2RegionIntersection represents an intersection of overlapping regions. It is convenient for computing a covering of the intersection of a set of regions. The regions are assumed to be immutable. Note: An intersection of no regions covers the entire sphere.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private S2LatLngRect
cachedRectBound
(package private) S2Region[]
regions
-
Constructor Summary
Constructors Constructor Description S2RegionIntersection(java.util.Collection<S2Region> regions)
Create an intersection from a copy ofregions
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
contains(S2Cell cell)
Returns true if all the regions fully contain the cell.boolean
contains(S2Point point)
Returns true if all the regions fully contain the point.boolean
equals(java.lang.Object thatObject)
Returns true if this S2RegionIntersection is equal to another S2RegionIntersection, where each region must be equal and in the same order.S2Cap
getCapBound()
Return a bounding spherical cap.S2LatLngRect
getRectBound()
Return a bounding latitude-longitude rectangle.int
hashCode()
boolean
mayIntersect(S2Cell cell)
Returns true if the cell may intersect all regions in this collection.
-
-
-
Field Detail
-
regions
final S2Region[] regions
-
cachedRectBound
private transient S2LatLngRect cachedRectBound
-
-
Constructor Detail
-
S2RegionIntersection
public S2RegionIntersection(java.util.Collection<S2Region> regions)
Create an intersection from a copy ofregions
.
-
-
Method Detail
-
contains
public boolean contains(S2Cell cell)
Returns true if all the regions fully contain the cell.
-
contains
public boolean contains(S2Point point)
Returns true if all the regions fully contain the point.
-
getCapBound
public S2Cap getCapBound()
Description copied from interface:S2Region
Return a bounding spherical cap.- Specified by:
getCapBound
in interfaceS2Region
-
getRectBound
public S2LatLngRect getRectBound()
Description copied from interface:S2Region
Return a bounding latitude-longitude rectangle.- Specified by:
getRectBound
in interfaceS2Region
-
mayIntersect
public boolean mayIntersect(S2Cell cell)
Returns true if the cell may intersect all regions in this collection.- Specified by:
mayIntersect
in interfaceS2Region
-
equals
public boolean equals(java.lang.Object thatObject)
Returns true if this S2RegionIntersection is equal to another S2RegionIntersection, where each region must be equal and in the same order. This method is intended only for testing purposes. NOTE: This should be rewritten to disregard order if such functionality is ever required.- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
-