Package com.google.appengine.api.datastore

Examples of com.google.appengine.api.datastore.GeoPt


    }
   
    cLat /= polygon.length;
    cLon /= polygon.length;
   
    return new GeoPt(cLat, cLon);
  }
View Full Code Here


    double factor = 1 / area;
    cLon *= factor;
    cLat *= factor;

    //log.debug("Centroid is " + cLat + ", " + cLon);
    return new GeoPt((float)cLat, (float)cLon);
  }
View Full Code Here

  public static boolean contains(GeoPt[] polygon, GeoPt pt)
  {
    int crossings = 0;
    for (int i=0; i<polygon.length; i++)
    {
      GeoPt p1 = polygon[i];
      GeoPt p2 = polygon[(i+1) == polygon.length ? 0 : i+1];
     
      double slope = (p2.getLongitude() - p1.getLongitude()) / (p2.getLatitude() - p1.getLatitude());
      boolean cond1 = (p1.getLatitude() <= pt.getLatitude()) && (pt.getLatitude() < p2.getLatitude());
      boolean cond2 = (p2.getLatitude() <= pt.getLatitude()) && (pt.getLatitude() < p1.getLatitude());
      boolean cond3 = pt.getLongitude() < slope * (pt.getLatitude() - p1.getLatitude()) + p1.getLongitude();
      if ((cond1 || cond2) && cond3)
        crossings++;
    }
   
View Full Code Here

      @QueryParam("neLng") float neLng)
  {
    if (log.isDebugEnabled())
      log.debug("getPlaces({},{} -- {},{})", new Object[] { swLat, swLng, neLat, neLng });

    List<WikiPlace> wikis = Wikimapia.box(new GeoPt(swLat, swLng), new GeoPt(neLat, neLng), PLACES_TO_FETCH);

    this.syncPlaces(wikis);

    List<Placemark> marks = new ArrayList<Placemark>(wikis.size());
View Full Code Here

        testInequalityQueries(new Rating(1), new Rating(2), new Rating(3));
    }

    @Test
    public void testGeoPtProperty() {
        testEqualityQueries(new GeoPt(45f, 15f), new GeoPt(50f, 20f));
        testInequalityQueries(new GeoPt(20f, 10f), new GeoPt(30f, 10f), new GeoPt(40f, 10f));
        testInequalityQueries(new GeoPt(0f, 10f), new GeoPt(0f, 20f), new GeoPt(0f, 30f));
    }
View Full Code Here

                new BlobKey("xmpp xmpp")
            ),
            asSet(-10f, -10d),
            asSet(10f, 10d),
            asSet(20f, 20d),
            asSet(new GeoPt(10f, 10f)),
            asSet(new GeoPt(20f, 20f)),
            asSet(new User("aaa", "aaa"), new User("aaa", "otherAuthDomain"))// ordering must depend only on the email
            asSet(new User("bbb", "bbb")),
            asSet(KeyFactory.createKey("kind", "aaa")),
            asSet(KeyFactory.createKey("kind", "bbb"))
        );
View Full Code Here

        }
    }

    @Test
    public void testFilter() throws Exception {
        doAllFilters(kindName, propertyName, new GeoPt(Float.valueOf(24).floatValue(), Float.valueOf(-90).floatValue()));
    }
View Full Code Here

    }

    @Test
    public void testGets() throws Exception {
        Query query = new Query(kindName, rootKey);
        GeoPt filter = new GeoPt(Float.valueOf(60).floatValue(), Float.valueOf(145).floatValue());
        query.setFilter(new FilterPredicate(propertyName, Query.FilterOperator.EQUAL, filter));
        Entity entity = service.prepare(query).asSingleEntity();
        GeoPt geopt = (GeoPt) entity.getProperty(propertyName);
        assertTrue(geopt.equals(filter));
        assertEquals(Float.valueOf(geopt.getLatitude()).toString(), Float.valueOf(60).toString());
        assertEquals(Float.valueOf(geopt.getLongitude()).toString(), Float.valueOf(145).toString());
    }
View Full Code Here

    }

    @Test
    public void testGeoptType() {
        List<Entity> elist = doQuery(kindName, propertyName, GeoPt.class, true);
        GeoPt rate = (GeoPt) elist.get(0).getProperty(propertyName);
        GeoPt sameDat = (GeoPt) elist.get(0).getProperty(propertyName);
        GeoPt diffDat = (GeoPt) elist.get(1).getProperty(propertyName);
        assertTrue(rate.equals(sameDat));
        assertFalse(rate.equals(diffDat));
        assertEquals(-12, rate.getLatitude(), 0);
        assertEquals(120, rate.getLongitude(), 0);
        assertEquals(0, rate.compareTo(sameDat));
View Full Code Here

                    newRec.setProperty("booleanData", true);
                } else {
                    newRec.setProperty("booleanData", false);
                }
                newRec.setProperty("geoptData",
                    new GeoPt((float) (i / (props - 9) + 12.0), (float) (i / (props - 9) + 90.0)));
                newRec.setProperty("intList",
                    Arrays.asList(i / (props - 11), 50 + i / (props - 11), 90 + i / (props - 11)));
                elist.add(newRec);
            }
            service.put(elist);
View Full Code Here

TOP

Related Classes of com.google.appengine.api.datastore.GeoPt

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.