native_LBS.js 889 Bytes
var Coordinates = function(lat, lng) {
    /**
     * The latitude of the position.
     */
    this.latitude = lat;
    /**
     * The longitude of the position,
     */
    this.longitude = lng;
};

var Placemark = function(p) {
    // 国家
    this.country = p["Country"];
    // 国家代号
    this.countryCode = p["CountryCode"];
    // 城市
    this.city = p["City"];
    // 省
    this.state = p["State"];
    // 街道
    this.street = p["Street"];
    // 区
    this.sublocality = p["SubLocality"];
    // 完整地址名称
    this.name = p["Name"];
};

function native_LBS_callbackWithInfo(result, onSuccess, action) {
    if (action === "getLocation") {
        var c = new Coordinates(result["latitude"], result["longitude"]);
        onSuccess(c);
    } else if (action === "getLocationDetail") {
        var c = new Placemark(result);
        onSuccess(c);
    }
}