use of dev.morphia.query.FindOptions in project morphia by mongodb.
the class TestGeoQueries method testWithinRadius.
@Test
public void testWithinRadius() {
final Place place1 = new Place("place1", new double[] { 1, 1 });
getDs().save(place1);
final Place found = getDs().find(Place.class).filter(center("loc", new Point(new Position(0, 1)), 1.1)).iterator(new FindOptions().limit(1)).next();
Assert.assertNotNull(found);
}
use of dev.morphia.query.FindOptions in project morphia by mongodb.
the class TestGeoQueries method testGeoWithinOutsideBox.
@Test
public void testGeoWithinOutsideBox() {
final Place place1 = new Place("place1", new double[] { 1, 1 });
getDs().save(place1);
final Place found = getDs().find(Place.class).filter(box("loc", new Point(new Position(0, 0)), new Point(new Position(.4, .5)))).iterator(new FindOptions().limit(1)).tryNext();
Assert.assertNull(found);
}
use of dev.morphia.query.FindOptions in project morphia by mongodb.
the class TestGeoQueries method testGeoWithinRadius2.
@Test
public void testGeoWithinRadius2() {
final Place place1 = new Place("place1", new double[] { 1, 1 });
getDs().save(place1);
final Place found = getDs().find(Place.class).filter(center("loc", new Point(new Position(0.5, 0.5)), 0.77)).iterator(new FindOptions().limit(1)).next();
Assert.assertNotNull(found);
}
use of dev.morphia.query.FindOptions in project morphia by mongodb.
the class TestGeoQueries method testWithinOutsideRadius.
@Test
public void testWithinOutsideRadius() {
final Place place1 = new Place("place1", new double[] { 1, 1 });
getDs().save(place1);
final Place found = getDs().find(Place.class).filter(center("loc", new Point(new Position(2, 2)), 0.4)).iterator(new FindOptions().limit(1)).tryNext();
Assert.assertNull(found);
}
use of dev.morphia.query.FindOptions in project morphia by mongodb.
the class TestGeoQueries method testWithinRadiusSphere.
@Test
public void testWithinRadiusSphere() {
final Place place1 = new Place("place1", new double[] { 1, 1 });
getDs().save(place1);
final Place found = getDs().find(Place.class).filter(centerSphere("loc", new Point(new Position(0, 1)), 1)).iterator(new FindOptions().limit(1)).next();
Assert.assertNotNull(found);
}
Aggregations