Package com.google.appengine.api.datastore

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


      if (r0.getPayload() instanceof Number && r1.getPayload() instanceof Number) {
        float lat = ((Number)r0.getPayload()).floatValue();
        float lon = ((Number)r1.getPayload()).floatValue();
       
        try {
          return new EvaluationResult(new GeoPt(lat, lon), r0, r1)
        } catch (IllegalArgumentException e) {
          // Longitude must be between -180 and 180 and Latitude must be between -90 and 90 (inclusive).
          return r1.withWarning(ErrorCode.W143);
        }
      } else {
View Full Code Here


      entity.setProperty("User", new User("test@example", "google.com"));
      entity.setProperty("Key", KeyFactory.createKey("test", RandomStringUtils
        .randomAlphabetic(5)));
      entity.setProperty("Category", new Category(RandomStringUtils.randomAlphabetic(3)));
      entity.setProperty("Email", new Email("test@example"));
      entity.setProperty("GeoPt", new GeoPt(new Float(new Integer(RandomStringUtils
        .randomNumeric(2)) - 9), new Float(
        new Integer(RandomStringUtils.randomNumeric(2)) - 9)));
      entity.setProperty("IMHandle", new IMHandle(Scheme.valueOf("sip"), RandomStringUtils
        .randomAlphabetic(2)));
      entity.setProperty("Link", new Link("test"));
View Full Code Here

      entity.setProperty("User", new User("test@example", "google.com"));
      entity.setProperty("Key", KeyFactory.createKey("test", RandomStringUtils
        .randomAlphabetic(5)));
      entity.setProperty("Category", new Category(RandomStringUtils.randomAlphabetic(3)));
      entity.setProperty("Email", new Email("test@example"));
      entity.setProperty("GeoPt", new GeoPt(new Float(new Integer(RandomStringUtils
        .randomNumeric(2)) - 9), new Float(
        new Integer(RandomStringUtils.randomNumeric(2)) - 9)));
      entity.setProperty("IMHandle", new IMHandle(Scheme.valueOf("sip"), RandomStringUtils
        .randomAlphabetic(2)));
      entity.setProperty("Link", new Link("test"));
View Full Code Here

    entity.setProperty(GbProperty.SHORT_BLOB, new ShortBlob(RandomStringUtils
      .randomAlphanumeric(500)
      .getBytes()));
    entity.setProperty(
      GbProperty.GEO_PT,
      new GeoPt(new Float(new Integer(RandomStringUtils.randomNumeric(2)) - 9), new Float(
        new Integer(RandomStringUtils.randomNumeric(2)) - 9)));
    entity
      .setProperty(GbProperty.CATEGORY, new Category(RandomStringUtils.randomAlphabetic(3)));
    entity.setProperty(GbProperty.RATING, new Rating(Integer.parseInt(RandomStringUtils
      .randomNumeric(2))));
View Full Code Here

        e1.setProperty("dateProp", new Date());

        e1.setProperty("nullProp", null);

        GeoPt geoPtValue = new GeoPt(47.620339f, -122.349629f);
        e1.setProperty("geoptProp", geoPtValue);

        ArrayList<Object> mvp = new ArrayList<Object>();
        mvp.add("string value");
        mvp.add(true);
View Full Code Here

    public GeoPt decode(JsonReader reader, GeoPt defaultValue) {
        String latitude = reader.readProperty("latitude");
        String longitude = reader.readProperty("longitude");
        if(latitude != null && longitude != null){
            try{
                return new GeoPt(
                    Float.parseFloat(latitude)
                    , Float.parseFloat(longitude)
                    );
            } catch(NumberFormatException e){
            }
View Full Code Here

            this.clear();

            final ArrayJson array = (ArrayJson)json;
            for (Json j: array){

                GeoPt v = j.getValue(GeoPt.class);

                if (null != v){

                    this.add(v);
View Full Code Here

    } else if (obj instanceof IMHandle) {
      IMHandle imh = (IMHandle) obj;
      return imh.getProtocol().replaceAll("\\|", "\\|") + "|" // \\\\|
          + imh.getAddress().replaceAll("\\|", "\\|");// \\\\|
    } else if (obj instanceof GeoPt) {
      GeoPt gpt = (GeoPt) obj;
      return gpt.getLatitude() + "|" + gpt.getLongitude();
    } else if (obj instanceof User) {
      User usr = (User) obj;
      String userId = usr.getUserId();
      String nickname = usr.getNickname();
      String authDomain = usr.getAuthDomain();
View Full Code Here

        String[] arguments = args.split("\\|");
        if (arguments.length != 2) {
          return null;
        }

        return new GeoPt(Float.parseFloat(arguments[0]),
            Float.parseFloat(arguments[1]));
      } else if (obj == User.class) {
        String[] arguments = args.split("\\|");
        if (arguments.length != 4) {
          return null;
View Full Code Here

    CompositeEditor tr = new CompositeEditor(binding, Container.GROUP);

    tr.setCaption(binding.getName());
    tr.setLayoutManager(new HorizontalLayouter());
    if (binding.getValue() == null) {
      binding.setValue(new GeoPt(0f, 0f), null); // Silent
    }

    binding.addBindingChangeListener(new IBindingChangeListener<Object>() {

      public void valueChanged(ISetDelta<Object> valueElements) {
        // TODO Auto-generated method stub
        return;
      }

      public void enablementChanged(boolean isEnabled) {
        Collection<String> childs = binding.getKnownChilds();
        for (String ch : childs) {
          Binding b = binding.getBinding(ch);
          b.setReadOnly(!isEnabled);
        }
      }

      public void changed() {
        // TODO Auto-generated method stub
        return;
      }
    });

    final Binding binding2 = new Binding(binding, "Latitude");
    final Binding binding3 = new Binding(binding, "Longitude");

    // binding2.refresh();
    // binding3.refresh();
    IBindingChangeListener<Object> l = new IBindingChangeListener<Object>() {

      public void changed() {

      }

      public void enablementChanged(boolean isEnabled) {

      }

      public void valueChanged(ISetDelta<Object> valueElements) {
        Object val1 = binding2.getValue();
        Object val2 = binding3.getValue();

        if (val1 instanceof GeoPt) {
          val1 = ((GeoPt) val1).getLatitude();
        }

        if (val2 instanceof GeoPt) {
          val2 = ((GeoPt) val2).getLongitude();
        }

        if (val1 instanceof Number && val2 instanceof Number) {
          Number value = (Number) val1;
          Number value2 = (Number) val2;
          GeoPt pt = new GeoPt((value.floatValue()/* / 1000000 */),
              value2.floatValue()/* / 1000000 */);

          binding.setValueSilent(pt);
        }
      }
 
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.