Package org.elasticsearch.common.geo
Class GeoBoundingBox
java.lang.Object
org.elasticsearch.common.geo.GeoBoundingBox
- All Implemented Interfaces:
Writeable
,org.elasticsearch.common.xcontent.ToXContent
,org.elasticsearch.common.xcontent.ToXContentFragment
public class GeoBoundingBox
extends Object
implements org.elasticsearch.common.xcontent.ToXContentFragment, 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
org.elasticsearch.common.xcontent.ToXContent.DelegatingMapParams, org.elasticsearch.common.xcontent.ToXContent.MapParams, org.elasticsearch.common.xcontent.ToXContent.Params
Nested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V>
-
Field Summary
Modifier and TypeFieldDescriptionstatic org.elasticsearch.common.xcontent.ParseField
static org.elasticsearch.common.xcontent.ParseField
static org.elasticsearch.common.xcontent.ParseField
static org.elasticsearch.common.xcontent.ParseField
static org.elasticsearch.common.xcontent.ParseField
Fields inherited from interface org.elasticsearch.common.xcontent.ToXContent
EMPTY_PARAMS
-
Constructor Summary
ConstructorDescriptionGeoBoundingBox(GeoPoint topLeft, GeoPoint bottomRight)
GeoBoundingBox(StreamInput input)
-
Method Summary
Modifier and TypeMethodDescriptiondouble
bottom()
boolean
int
hashCode()
boolean
double
left()
static GeoBoundingBox
parseBoundingBox(org.elasticsearch.common.xcontent.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()
topLeft()
toString()
org.elasticsearch.common.xcontent.XContentBuilder
toXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params)
org.elasticsearch.common.xcontent.XContentBuilder
toXContentFragment(org.elasticsearch.common.xcontent.XContentBuilder builder, boolean buildLatLonFields)
void
writeTo(StreamOutput out)
Write this into the StreamOutput.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.elasticsearch.common.xcontent.ToXContentFragment
isFragment
-
Field Details
-
BOUNDS_FIELD
public static final org.elasticsearch.common.xcontent.ParseField BOUNDS_FIELD -
LAT_FIELD
public static final org.elasticsearch.common.xcontent.ParseField LAT_FIELD -
LON_FIELD
public static final org.elasticsearch.common.xcontent.ParseField LON_FIELD -
TOP_LEFT_FIELD
public static final org.elasticsearch.common.xcontent.ParseField TOP_LEFT_FIELD -
BOTTOM_RIGHT_FIELD
public static final org.elasticsearch.common.xcontent.ParseField BOTTOM_RIGHT_FIELD
-
-
Constructor Details
-
GeoBoundingBox
-
GeoBoundingBox
- Throws:
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 org.elasticsearch.common.xcontent.XContentBuilder toXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params) throws IOException- Specified by:
toXContent
in interfaceorg.elasticsearch.common.xcontent.ToXContent
- Throws:
IOException
-
toXContentFragment
public org.elasticsearch.common.xcontent.XContentBuilder toXContentFragment(org.elasticsearch.common.xcontent.XContentBuilder builder, boolean buildLatLonFields) throws IOException- Throws:
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.- Specified by:
writeTo
in interfaceWriteable
- Throws:
IOException
-
equals
-
hashCode
public int hashCode() -
toString
-
parseBoundingBox
public static GeoBoundingBox parseBoundingBox(org.elasticsearch.common.xcontent.XContentParser parser) throws IOException, ElasticsearchParseExceptionParses the bounding box and returns bottom, top, left, right coordinates
-