Package com.google.appengine.api.datastore

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


      @RequestHeader("Host") String host, HttpSession session) {
   
    try {
      MediationService mediationService = form.getMediationService();
      if(form.getLatitude() != null && form.getLongitude() != null) {
        mediationService.setGeoLocation(new GeoPt(form.getLatitude(), form.getLongitude()));
      }
      mediationService.addUsers(form.getMembers()); // TODO I think that this donĀ“t do anything useful, because there are not member fields in the form.
      this.validator.validate(mediationService, result);
      if(result.hasErrors()) {
        return "mediation.form";
View Full Code Here


    } else if (value instanceof ShortBlob) {
      return NOT_SUPPORTED;
    } else if (value instanceof Category) {
      val = ((Category) value).getCategory();
    } else if (value instanceof GeoPt) {
      GeoPt geoPt = (GeoPt) value;
      val =
        Float.valueOf(geoPt.getLatitude())
          + VALUE_SEPARATER
          + Float.valueOf(geoPt.getLongitude());
    } else if (value instanceof Rating) {
      val = String.valueOf(((Rating) value).getRating());
    } else if (value instanceof PhoneNumber) {
      val = ((PhoneNumber) value).getNumber();
    } else if (value instanceof PostalAddress) {
View Full Code Here

      val = new Link((String) value);
    } else if (valueType.equals(SHORT_BLOB)) {
      throw new RuntimeException("ShortBlob is not supported.");
    } else if (valueType.equals(GEO_PT)) {
      String[] split = ((String) value).split(VALUE_SEPARATER);
      val = new GeoPt(Float.parseFloat(split[0]), Float.parseFloat(split[1]));
    } else if (valueType.equals(CATEGORY)) {
      val = new Category((String) value);
    } else if (valueType.equals(RATING)) {
      val = new Rating(Integer.parseInt((String) value));
    } else if (valueType.equals(PHONE_NUMBER)) {
View Full Code Here

   
    @Override
    public String getAsText() {
      StringBuffer sb = new StringBuffer();
      if(getValue() != null) {
        GeoPt geoPt = (GeoPt) getValue();
        if(geoPt != null) {
          sb.append(geoPt.getLatitude()).append(",").append(geoPt.getLongitude());
        }
      }
      return sb.toString();
    }
View Full Code Here

        String[] coords = text.split(",");
        if(coords != null && coords.length == 2) {
          try {
            float latitude = Float.parseFloat(coords[0]);
            float longitude = Float.parseFloat(coords[1]);
            GeoPt geoPt = new GeoPt(latitude, longitude);
            setValue(geoPt);
          } catch(Exception e) {
            LOGGER.severe(StackTraceUtil.getStackTrace(e));
          }
        }
View Full Code Here

     * </code></pre>
     */
    public static <T> T asType(List<?> list, Class<T> clazz) {
        if (list == null || clazz == null) return null;
        if (clazz == GeoPt.class && list.size() == 2 && list.get(0) instanceof Number && list.get(1) instanceof Number) {
            return clazz.cast(new GeoPt(((Number) list.get(0)).floatValue(), ((Number) list.get(1)).floatValue()));
        }
       
        if (clazz == Key.class) {
            if (list.size() == 2 && list.get(0) instanceof String) {
                if (list.get(1) instanceof Number) {
View Full Code Here

   * @return an unsorted list, or an empty list if something went wrong.
   */
  public static List<WikiPlace> box(GeoPt sw, GeoPt ne, int count)
  {
    GeoDelta delta = new GeoDelta(ne.getLatitude() - sw.getLatitude(), ne.getLongitude() - sw.getLongitude());
    GeoPt center = new GeoPt(sw.getLatitude() + delta.getLatitude() / 2, sw.getLongitude() + delta.getLongitude() / 2);

    return box(center, delta, count);
  }
View Full Code Here

    {
      JsonNode pointNode = polygonNode.get(pointIndex);
      double polyLat = pointNode.get("y").asDouble();
      double polyLon = pointNode.get("x").asDouble();

      GeoPt thisPoint = new GeoPt((float)polyLat, (float)polyLon);
      if (!visited.contains(thisPoint))
        visited.add(thisPoint);
    }

    if (visited.size() < 3)
View Full Code Here

    int plng = 0;
    //int counter = 0;

    int listSize = track.length;

    GeoPt trackpoint;

    for (int i = 0; i < listSize; i++)
    {
      //counter++;
      trackpoint = track[i];

      int late5 = floor1e5(trackpoint.getLatitude());
      int lnge5 = floor1e5(trackpoint.getLongitude());

      int dlat = late5 - plat;
      int dlng = lnge5 - plng;

      plat = late5;
View Full Code Here

  /**
   * Convert to the google version
   */
  public static GeoPt toGeoPt(Point point)
  {
    return new GeoPt((float)point.getLat(), (float)point.getLon());
  }
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.