public class CircleQueryImpl implements GeospatialQuery
{
@Override
public Object createGeospatialQuery(String geolocationColumnName, Object shape, Object query)
{
Circle circle = (Circle) shape;
List circleList = new ArrayList();
circleList.add(new double[] { circle.getCentre().x, circle.getCentre().y }); // Centre
// of
// circle
circleList.add(circle.getRadius()); // Radius
BasicDBObject q = (BasicDBObject) query;
if (q == null)
q = new BasicDBObject();
if (circle.getSurfaceType().equals(SurfaceType.SPHERICAL))
{
q.put(geolocationColumnName, new BasicDBObject("$within", new BasicDBObject("$centerSphere", circleList)));
}
else
{