Package com.google.common.geometry
Class S2PointRegion
java.lang.Object
com.google.common.geometry.S2PointRegion
- All Implemented Interfaces:
S2Region
,Serializable
,Comparable<S2PointRegion>
@GwtCompatible(serializable=true)
public final class S2PointRegion
extends Object
implements S2Region, Comparable<S2PointRegion>, Serializable
An S2PointRegion is a region that contains a single point. It is more expensive than the raw
S2Point type and is useful mainly for completeness.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final S2Point
private static final byte
The byte in a stream that signifies the lossless encoding of an S2PointRegion follows. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
compareTo
(S2PointRegion other) 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.(package private) static S2PointRegion
Returns a new S2PointRegion decoded from the given little endian input stream.static S2PointRegion
decode
(InputStream is) Returns a new S2PointRegion decoded from the given input stream.(package private) void
Writes this point region to the given little endian output stream.void
encode
(OutputStream os) Writes this point region to the given output stream.boolean
Return a bounding spherical cap.getPoint()
Return a bounding latitude-longitude rectangle.double
getX()
double
getY()
double
getZ()
int
hashCode()
Calcualates hashcode based on stored coordinates.boolean
boolean
mayIntersect
(S2Cell cell) If this method returns false, the region does not intersect the given cell.toString()
-
Field Details
-
POINT_REGION_LOSSLESS_ENCODING_VERSION
private static final byte POINT_REGION_LOSSLESS_ENCODING_VERSIONThe byte in a stream that signifies the lossless encoding of an S2PointRegion follows.- See Also:
-
point
-
-
Constructor Details
-
S2PointRegion
public S2PointRegion() -
S2PointRegion
public S2PointRegion(double x, double y, double z) -
S2PointRegion
-
-
Method Details
-
getPoint
-
getX
public double getX() -
getY
public double getY() -
getZ
public double getZ() -
equals
-
lessThan
-
compareTo
- Specified by:
compareTo
in interfaceComparable<S2PointRegion>
-
toString
-
toDegreesString
-
hashCode
public int hashCode()Calcualates hashcode based on stored coordinates. Since we want +0.0 and -0.0 to be treated the same, we ignore the sign of the coordinates. -
contains
Description copied from interface:S2Region
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
Description copied from interface:S2Region
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. -
getCapBound
Description copied from interface:S2Region
Return a bounding spherical cap.- Specified by:
getCapBound
in interfaceS2Region
-
getRectBound
Description copied from interface:S2Region
Return a bounding latitude-longitude rectangle.- Specified by:
getRectBound
in interfaceS2Region
-
mayIntersect
Description copied from interface:S2Region
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.- Specified by:
mayIntersect
in interfaceS2Region
-
encode
Writes this point region to the given output stream.- Throws:
IOException
-
encode
Writes this point region to the given little endian output stream.- Throws:
IOException
-
decode
Returns a new S2PointRegion decoded from the given input stream.- Throws:
IOException
-
decode
Returns a new S2PointRegion decoded from the given little endian input stream.- Throws:
IOException
-