Package dev.morphia.query
Class Shape
- java.lang.Object
-
- dev.morphia.query.Shape
-
public class Shape extends java.lang.Object
This encapsulates the data necessary to define a shape for queries.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Shape.Point
Defines a Point
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Shape
box(Shape.Point bottomLeft, Shape.Point upperRight)
Specifies a rectangle for a geospatial $geoWithin query to return documents that are within the bounds of the rectangle, according to their point-based location data.static Shape
center(Shape.Point center, double radius)
Specifies a circle for a $geoWithin query.static Shape
centerSphere(Shape.Point center, double radius)
Specifies a circle for a geospatial query that uses spherical geometry.java.lang.String
getGeometry()
Shape.Point[]
getPoints()
static Shape
polygon(Shape.Point... points)
Specifies a polygon for a geospatial $geoWithin query on legacy coordinate pairs.com.mongodb.DBObject
toDBObject()
Creates a DBObject from this Shape
-
-
-
Method Detail
-
box
public static Shape box(Shape.Point bottomLeft, Shape.Point upperRight)
Specifies a rectangle for a geospatial $geoWithin query to return documents that are within the bounds of the rectangle, according to their point-based location data.- Parameters:
bottomLeft
- the bottom left boundupperRight
- the upper right bound- Returns:
- the box
- MongoDB documentation
- reference/operator/query/box/ $box
- reference/operator/query/geoWithin/ $geoWithin
-
center
public static Shape center(Shape.Point center, double radius)
Specifies a circle for a $geoWithin query.- Parameters:
center
- the center of the circleradius
- the radius circle- Returns:
- the box
- MongoDB documentation
- reference/operator/query/center/ $center
- reference/operator/query/geoWithin/ $geoWithin
-
centerSphere
public static Shape centerSphere(Shape.Point center, double radius)
Specifies a circle for a geospatial query that uses spherical geometry.- Parameters:
center
- the center of the circleradius
- the radius circle- Returns:
- the box
- MongoDB documentation
- reference/operator/query/centerSphere/ $centerSphere
-
polygon
public static Shape polygon(Shape.Point... points)
Specifies a polygon for a geospatial $geoWithin query on legacy coordinate pairs.- Parameters:
points
- the points of the polygon- Returns:
- the box
- MongoDB documentation
- reference/operator/query/polygon/ $polygon
- reference/operator/query/geoWithin/ $geoWithin
-
getGeometry
public java.lang.String getGeometry()
- Returns:
- the geometry of the shape
-
getPoints
public Shape.Point[] getPoints()
- Returns:
- the points of the shape
-
toDBObject
public com.mongodb.DBObject toDBObject()
Creates a DBObject from this Shape- Returns:
- the DBObject
-
-