let wasm; export function __wbg_set_wasm(val) { wasm = val; } const lTextDecoder = typeof TextDecoder === 'undefined' ? (0, module.require)('util').TextDecoder : TextDecoder; let cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true }); cachedTextDecoder.decode(); let cachedUint8Memory0 = null; function getUint8Memory0() { if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) { cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer); } return cachedUint8Memory0; } function getStringFromWasm0(ptr, len) { return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); } const heap = new Array(128).fill(undefined); heap.push(undefined, null, true, false); let heap_next = heap.length; function addHeapObject(obj) { if (heap_next === heap.length) heap.push(heap.length + 1); const idx = heap_next; heap_next = heap[idx]; heap[idx] = obj; return idx; } function getObject(idx) { return heap[idx]; } function dropObject(idx) { if (idx < 132) return; heap[idx] = heap_next; heap_next = idx; } function takeObject(idx) { const ret = getObject(idx); dropObject(idx); return ret; } /** */ export function greet() { wasm.greet(); } let WASM_VECTOR_LEN = 0; function passArray8ToWasm0(arg, malloc) { const ptr = malloc(arg.length * 1); getUint8Memory0().set(arg, ptr / 1); WASM_VECTOR_LEN = arg.length; return ptr; } let cachedInt32Memory0 = null; function getInt32Memory0() { if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) { cachedInt32Memory0 = new Int32Array(wasm.memory.buffer); } return cachedInt32Memory0; } /** * 解析地图包Zip * @param {Uint8Array} data * @returns {MapPackage} */ export function parse_map_package(data) { try { const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc); const len0 = WASM_VECTOR_LEN; wasm.parse_map_package(retptr, ptr0, len0); var r0 = getInt32Memory0()[retptr / 4 + 0]; var r1 = getInt32Memory0()[retptr / 4 + 1]; var r2 = getInt32Memory0()[retptr / 4 + 2]; if (r2) { throw takeObject(r1); } return MapPackage.__wrap(r0); } finally { wasm.__wbindgen_add_to_stack_pointer(16); } } function _assertClass(instance, klass) { if (!(instance instanceof klass)) { throw new Error(`expected instance of ${klass.name}`); } return instance.ptr; } function getArrayU8FromWasm0(ptr, len) { return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len); } const lTextEncoder = typeof TextEncoder === 'undefined' ? (0, module.require)('util').TextEncoder : TextEncoder; let cachedTextEncoder = new lTextEncoder('utf-8'); const encodeString = (typeof cachedTextEncoder.encodeInto === 'function' ? function (arg, view) { return cachedTextEncoder.encodeInto(arg, view); } : function (arg, view) { const buf = cachedTextEncoder.encode(arg); view.set(buf); return { read: arg.length, written: buf.length }; }); function passStringToWasm0(arg, malloc, realloc) { if (realloc === undefined) { const buf = cachedTextEncoder.encode(arg); const ptr = malloc(buf.length); getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf); WASM_VECTOR_LEN = buf.length; return ptr; } let len = arg.length; let ptr = malloc(len); const mem = getUint8Memory0(); let offset = 0; for (; offset < len; offset++) { const code = arg.charCodeAt(offset); if (code > 0x7F) break; mem[ptr + offset] = code; } if (offset !== len) { if (offset !== 0) { arg = arg.slice(offset); } ptr = realloc(ptr, len, len = offset + arg.length * 3); const view = getUint8Memory0().subarray(ptr + offset, ptr + len); const ret = encodeString(arg, view); offset += ret.written; } WASM_VECTOR_LEN = offset; return ptr; } /** */ export class MapPackage { static __wrap(ptr) { const obj = Object.create(MapPackage.prototype); obj.ptr = ptr; return obj; } __destroy_into_raw() { const ptr = this.ptr; this.ptr = 0; return ptr; } free() { const ptr = this.__destroy_into_raw(); wasm.__wbg_mappackage_free(ptr); } /** * 地图图片格式 * @returns {string} */ get map_ext() { try { const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); wasm.mappackage_map_ext(retptr, this.ptr); var r0 = getInt32Memory0()[retptr / 4 + 0]; var r1 = getInt32Memory0()[retptr / 4 + 1]; return getStringFromWasm0(r0, r1); } finally { wasm.__wbindgen_add_to_stack_pointer(16); wasm.__wbindgen_free(r0, r1); } } /** * 地图原始像素尺寸 * @returns {Size} */ get src_size() { const ret = wasm.mappackage_src_size(this.ptr); return Size.__wrap(ret); } /** * 地图缩放后后像素尺寸,用于计算新尺寸下地理坐标 * @param {Size} size */ set dst_size(size) { _assertClass(size, Size); var ptr0 = size.__destroy_into_raw(); wasm.mappackage_set_dst_size(this.ptr, ptr0); } /** * 地图图片 * @returns {Uint8Array} */ get map_image_data() { try { const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); wasm.mappackage_map_image_data(retptr, this.ptr); var r0 = getInt32Memory0()[retptr / 4 + 0]; var r1 = getInt32Memory0()[retptr / 4 + 1]; var v0 = getArrayU8FromWasm0(r0, r1).slice(); wasm.__wbindgen_free(r0, r1 * 1); return v0; } finally { wasm.__wbindgen_add_to_stack_pointer(16); } } /** * 图上坐标转经纬度 * @param {Offset} on_pic * @returns {Position} */ pic_to_position(on_pic) { _assertClass(on_pic, Offset); var ptr0 = on_pic.__destroy_into_raw(); const ret = wasm.mappackage_pic_to_position(this.ptr, ptr0); return Position.__wrap(ret); } /** * 经纬度转图上坐标 * @param {Position} position * @returns {Offset} */ position_to_pic(position) { _assertClass(position, Position); var ptr0 = position.__destroy_into_raw(); const ret = wasm.mappackage_position_to_pic(this.ptr, ptr0); return Offset.__wrap(ret); } } /** * 点在图片上的坐标,原点为左上角 */ export class Offset { static __wrap(ptr) { const obj = Object.create(Offset.prototype); obj.ptr = ptr; return obj; } __destroy_into_raw() { const ptr = this.ptr; this.ptr = 0; return ptr; } free() { const ptr = this.__destroy_into_raw(); wasm.__wbg_offset_free(ptr); } /** * @returns {number} */ get x() { const ret = wasm.__wbg_get_offset_x(this.ptr); return ret; } /** * @param {number} arg0 */ set x(arg0) { wasm.__wbg_set_offset_x(this.ptr, arg0); } /** * @returns {number} */ get y() { const ret = wasm.__wbg_get_offset_y(this.ptr); return ret; } /** * @param {number} arg0 */ set y(arg0) { wasm.__wbg_set_offset_y(this.ptr, arg0); } /** */ constructor() { const ret = wasm.offset_new(); return Offset.__wrap(ret); } } /** */ export class Position { static __wrap(ptr) { const obj = Object.create(Position.prototype); obj.ptr = ptr; return obj; } __destroy_into_raw() { const ptr = this.ptr; this.ptr = 0; return ptr; } free() { const ptr = this.__destroy_into_raw(); wasm.__wbg_position_free(ptr); } /** * @returns {number} */ get latitude() { const ret = wasm.__wbg_get_offset_x(this.ptr); return ret; } /** * @param {number} arg0 */ set latitude(arg0) { wasm.__wbg_set_offset_x(this.ptr, arg0); } /** * @returns {number} */ get longitude() { const ret = wasm.__wbg_get_offset_y(this.ptr); return ret; } /** * @param {number} arg0 */ set longitude(arg0) { wasm.__wbg_set_offset_y(this.ptr, arg0); } /** */ constructor() { const ret = wasm.offset_new(); return Position.__wrap(ret); } /** * 计算两点距离,单位:米 * @param {Position} other * @returns {number} */ distance_to(other) { _assertClass(other, Position); var ptr0 = other.__destroy_into_raw(); const ret = wasm.position_distance_to(this.ptr, ptr0); return ret; } } /** */ export class Size { static __wrap(ptr) { const obj = Object.create(Size.prototype); obj.ptr = ptr; return obj; } __destroy_into_raw() { const ptr = this.ptr; this.ptr = 0; return ptr; } free() { const ptr = this.__destroy_into_raw(); wasm.__wbg_size_free(ptr); } /** * @returns {number} */ get width() { const ret = wasm.__wbg_get_offset_x(this.ptr); return ret; } /** * @param {number} arg0 */ set width(arg0) { wasm.__wbg_set_offset_x(this.ptr, arg0); } /** * @returns {number} */ get height() { const ret = wasm.__wbg_get_offset_y(this.ptr); return ret; } /** * @param {number} arg0 */ set height(arg0) { wasm.__wbg_set_offset_y(this.ptr, arg0); } /** */ constructor() { const ret = wasm.offset_new(); return Size.__wrap(ret); } } export function __wbg_alert_43a45fac7dbd48cc(arg0, arg1) { alert(getStringFromWasm0(arg0, arg1)); }; export function __wbindgen_error_new(arg0, arg1) { const ret = new Error(getStringFromWasm0(arg0, arg1)); return addHeapObject(ret); }; export function __wbg_new_abda76e883ba8a5f() { const ret = new Error(); return addHeapObject(ret); }; export function __wbg_stack_658279fe44541cf6(arg0, arg1) { const ret = getObject(arg1).stack; const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); const len0 = WASM_VECTOR_LEN; getInt32Memory0()[arg0 / 4 + 1] = len0; getInt32Memory0()[arg0 / 4 + 0] = ptr0; }; export function __wbg_error_f851667af71bcfc6(arg0, arg1) { try { console.error(getStringFromWasm0(arg0, arg1)); } finally { wasm.__wbindgen_free(arg0, arg1); } }; export function __wbindgen_object_drop_ref(arg0) { takeObject(arg0); }; export function __wbindgen_throw(arg0, arg1) { throw new Error(getStringFromWasm0(arg0, arg1)); };