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.ToXContentObject
public class GeoBoundingBox extends java.lang.Object implements org.elasticsearch.common.xcontent.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
org.elasticsearch.common.xcontent.ToXContent.DelegatingMapParams, org.elasticsearch.common.xcontent.ToXContent.MapParams, org.elasticsearch.common.xcontent.ToXContent.ParamsNested 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 org.elasticsearch.common.ParseFieldBOTTOM_RIGHT_FIELDstatic org.elasticsearch.common.ParseFieldBOUNDS_FIELDstatic org.elasticsearch.common.ParseFieldLAT_FIELDstatic org.elasticsearch.common.ParseFieldLON_FIELDstatic org.elasticsearch.common.ParseFieldTOP_LEFT_FIELDFields inherited from interface org.elasticsearch.common.xcontent.ToXContent
EMPTY_PARAMS -
Constructor Summary
Constructors Constructor Description GeoBoundingBox(GeoPoint topLeft, GeoPoint bottomRight)GeoBoundingBox(StreamInput input) -
Method Summary
Modifier and Type Method Description doublebottom()GeoPointbottomRight()booleanequals(java.lang.Object o)inthashCode()booleanisUnbounded()doubleleft()static GeoBoundingBoxparseBoundingBox(org.elasticsearch.common.xcontent.XContentParser parser)Parses the bounding box and returns bottom, top, left, right coordinatesbooleanpointInBounds(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.doubleright()doubletop()GeoPointtopLeft()java.lang.StringtoString()org.elasticsearch.common.xcontent.XContentBuildertoXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params)org.elasticsearch.common.xcontent.XContentBuildertoXContentFragment(org.elasticsearch.common.xcontent.XContentBuilder builder, boolean buildLatLonFields)voidwriteTo(StreamOutput out)Write this into the StreamOutput.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.elasticsearch.common.xcontent.ToXContentObject
isFragment
-
Field Details
-
BOUNDS_FIELD
public static final org.elasticsearch.common.ParseField BOUNDS_FIELD -
LAT_FIELD
public static final org.elasticsearch.common.ParseField LAT_FIELD -
LON_FIELD
public static final org.elasticsearch.common.ParseField LON_FIELD -
TOP_LEFT_FIELD
public static final org.elasticsearch.common.ParseField TOP_LEFT_FIELD -
BOTTOM_RIGHT_FIELD
public static final org.elasticsearch.common.ParseField BOTTOM_RIGHT_FIELD
-
-
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 org.elasticsearch.common.xcontent.XContentBuilder toXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params) throws java.io.IOException- Specified by:
toXContentin interfaceorg.elasticsearch.common.xcontent.ToXContent- Throws:
java.io.IOException
-
toXContentFragment
public org.elasticsearch.common.xcontent.XContentBuilder toXContentFragment(org.elasticsearch.common.xcontent.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:WriteableWrite this into the StreamOutput. -
equals
public boolean equals(java.lang.Object o)- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()- Overrides:
toStringin classjava.lang.Object
-
parseBoundingBox
public static GeoBoundingBox parseBoundingBox(org.elasticsearch.common.xcontent.XContentParser parser) throws java.io.IOException, ElasticsearchParseExceptionParses the bounding box and returns bottom, top, left, right coordinates- Throws:
java.io.IOExceptionElasticsearchParseException
-