Package org.elasticsearch.common.geo
Class GeoBoundingBox
java.lang.Object
org.elasticsearch.common.geo.GeoBoundingBox
- All Implemented Interfaces:
Writeable
,ToXContent
,ToXContentObject
public class GeoBoundingBox extends java.lang.Object implements ToXContentObject, Writeable
A class representing a Geo-Bounding-Box for use by Geo queries and aggregations
that deal with extents/rectangles representing rectangular areas of interest.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.elasticsearch.common.xcontent.ToXContent
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.Params
Nested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V>
-
Field Summary
Fields Modifier and Type Field Description static ParseField
BOTTOM_RIGHT_FIELD
static ParseField
BOUNDS_FIELD
static ParseField
LAT_FIELD
static ParseField
LON_FIELD
static ParseField
TOP_LEFT_FIELD
-
Constructor Summary
Constructors Constructor Description GeoBoundingBox(GeoPoint topLeft, GeoPoint bottomRight)
GeoBoundingBox(StreamInput input)
-
Method Summary
Modifier and Type Method Description double
bottom()
GeoPoint
bottomRight()
boolean
equals(java.lang.Object o)
int
hashCode()
boolean
isUnbounded()
double
left()
static GeoBoundingBox
parseBoundingBox(XContentParser parser)
Parses the bounding box and returns bottom, top, left, right coordinatesboolean
pointInBounds(double lon, double lat)
If the bounding box crosses the date-line (left greater-than right) then the longitude of the point need only to be higher than the left or lower than the right.double
right()
double
top()
GeoPoint
topLeft()
java.lang.String
toString()
XContentBuilder
toXContent(XContentBuilder builder, ToXContent.Params params)
XContentBuilder
toXContentFragment(XContentBuilder builder, boolean buildLatLonFields)
void
writeTo(StreamOutput out)
Write this into the StreamOutput.
-
Field Details
-
Constructor Details
-
GeoBoundingBox
-
GeoBoundingBox
- Throws:
java.io.IOException
-
-
Method Details
-
isUnbounded
public boolean isUnbounded() -
topLeft
-
bottomRight
-
top
public double top() -
bottom
public double bottom() -
left
public double left() -
right
public double right() -
toXContent
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws java.io.IOException- Specified by:
toXContent
in interfaceToXContent
- Throws:
java.io.IOException
-
toXContentFragment
public XContentBuilder toXContentFragment(XContentBuilder builder, boolean buildLatLonFields) throws java.io.IOException- Throws:
java.io.IOException
-
pointInBounds
public boolean pointInBounds(double lon, double lat)If the bounding box crosses the date-line (left greater-than right) then the longitude of the point need only to be higher than the left or lower than the right. Otherwise, it must be both.- Parameters:
lon
- the longitude of the pointlat
- the latitude of the point- Returns:
- whether the point (lon, lat) is in the specified bounding box
-
writeTo
Description copied from interface:Writeable
Write this into the StreamOutput. -
equals
public boolean equals(java.lang.Object o)- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()- Overrides:
toString
in classjava.lang.Object
-
parseBoundingBox
public static GeoBoundingBox parseBoundingBox(XContentParser parser) throws java.io.IOException, ElasticsearchParseExceptionParses the bounding box and returns bottom, top, left, right coordinates- Throws:
java.io.IOException
ElasticsearchParseException
-