Search in sources :

Example 1 with RegionPoint

use of com.google.apphosting.datastore.DatastoreV3Pb.RegionPoint in project appengine-java-standard by GoogleCloudPlatform.

the class FilterMatcherTest method testGeo_MultiPreintersection.

@Test
public void testGeo_MultiPreintersection() {
    RegionPoint sw = new RegionPoint().setLatitude(0).setLongitude(-180);
    RegionPoint ne = new RegionPoint().setLatitude(90).setLongitude(0);
    RectangleRegion rect = new RectangleRegion().setSouthwest(sw).setNortheast(ne);
    filterMatcher.addFilter(geoFilter(new GeoRegion().setRectangle(rect)));
    filterMatcher.addFilter(filter(Operator.EQUAL, 1732));
    filterMatcher.addFilter(filter(Operator.EQUAL, 87));
    assertMatch("bob", new GeoPt(12, -100), 87, 1732, 99);
    assertNoMatch(new GeoPt(12, 24), 1732);
    assertNoMatch(1732, 87);
}
Also used : RectangleRegion(com.google.apphosting.datastore.DatastoreV3Pb.RectangleRegion) GeoRegion(com.google.apphosting.datastore.DatastoreV3Pb.GeoRegion) RegionPoint(com.google.apphosting.datastore.DatastoreV3Pb.RegionPoint) Test(org.junit.Test)

Example 2 with RegionPoint

use of com.google.apphosting.datastore.DatastoreV3Pb.RegionPoint in project appengine-java-standard by GoogleCloudPlatform.

the class FilterMatcherTest method testGeo_Rectangle.

@Test
public void testGeo_Rectangle() {
    RegionPoint sw = new RegionPoint().setLatitude(0).setLongitude(-180);
    RegionPoint ne = new RegionPoint().setLatitude(90).setLongitude(0);
    RectangleRegion rect = new RectangleRegion().setSouthwest(sw).setNortheast(ne);
    filterMatcher.addFilter(geoFilter(new GeoRegion().setRectangle(rect)));
    assertNoMatch("bob");
    assertMatch("bob", new GeoPt(12, -100));
    assertNoMatch(new GeoPt(12, 24));
    assertNoMatch(new GeoPt(-12, -24));
}
Also used : RectangleRegion(com.google.apphosting.datastore.DatastoreV3Pb.RectangleRegion) GeoRegion(com.google.apphosting.datastore.DatastoreV3Pb.GeoRegion) RegionPoint(com.google.apphosting.datastore.DatastoreV3Pb.RegionPoint) Test(org.junit.Test)

Aggregations

GeoRegion (com.google.apphosting.datastore.DatastoreV3Pb.GeoRegion)2 RectangleRegion (com.google.apphosting.datastore.DatastoreV3Pb.RectangleRegion)2 RegionPoint (com.google.apphosting.datastore.DatastoreV3Pb.RegionPoint)2 Test (org.junit.Test)2