platform/bb/rhodes/src/rhomobile/mapview/Annotation.java in rhodes-3.2.3 vs platform/bb/rhodes/src/rhomobile/mapview/Annotation.java in rhodes-3.3.0.beta.1

- old
+ new

@@ -24,10 +24,14 @@ * http://rhomobile.com *------------------------------------------------------------------------*/ package rhomobile.mapview; +import com.rho.Sprintf; +import com.xruby.runtime.builtin.ObjectFactory; +import com.xruby.runtime.builtin.RubyArray; + public class Annotation { public static class Coordinates { public double latitude; public double longitude; @@ -42,7 +46,20 @@ public String subtitle = ""; public String street_address = null; public String resolved_address = null; public String url = null; public Coordinates coordinates = null; + public boolean pass_location = false; + + public String make_url() + { + if (!pass_location) + return url; + + RubyArray args = new RubyArray(); + args.add(ObjectFactory.createFloat(coordinates.latitude)); + args.add(ObjectFactory.createFloat(coordinates.longitude)); + + return url + ( url.indexOf('?') >= 0 ? "&" : "?" ) + Sprintf.sprintf("latitude=%.5f&longitude=%.5f", args); + } }