gipy: interface and ui tweaks
parent
86dd2801f2
commit
dafd4a0121
|
|
@ -122,3 +122,5 @@
|
|||
* New option: sleep between waypoints
|
||||
* Removed sharp turns auto-detection
|
||||
* Interface: centered svg preview + display file sizes
|
||||
* Interface: disable/enable waypoints detection and elevation
|
||||
* Touching the screen when sleeping will wake up but not change screen
|
||||
|
|
@ -1689,11 +1689,12 @@ function start_gipy(path, maps, interests, heights) {
|
|||
status.display();
|
||||
|
||||
Bangle.on("touch", () => {
|
||||
let active = this.active;
|
||||
status.activate();
|
||||
if (in_menu) {
|
||||
return;
|
||||
}
|
||||
if (status.heights !== null) {
|
||||
if (active && status.heights !== null) {
|
||||
status.screen = (status.screen + 1) % 3;
|
||||
status.display();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,6 +51,10 @@
|
|||
|
||||
|
||||
<input type="button" id="upload" name="upload" value="Upload" disabled>
|
||||
<input type="checkbox" id="autodetect_waypoints" name="autodetect_waypoints" checked/>
|
||||
<label for="autodetect_waypoints">detect waypoints</label>
|
||||
<input type="checkbox" id="include_elevation" name="include_elevation" checked/>
|
||||
<label for="include_elevation">include elevation</label>
|
||||
<div id="status"></div>
|
||||
<div id="svgmap"></div>
|
||||
|
||||
|
|
@ -111,10 +115,11 @@ function display_polygon(map) {
|
|||
}
|
||||
|
||||
map.fitBounds(L.latLngBounds(L.latLng(min_lat, min_lng), L.latLng(max_lat, max_lng)));
|
||||
|
||||
document.getElementById('convert').disabled = false;
|
||||
}
|
||||
|
||||
import init, { load_gps_from_string, get_polygon, get_polyline, request_map, get_gps_content, get_gps_map_svg, gps_from_area } from "./pkg/gps.js";
|
||||
import init, { disable_elevation, load_gps_from_string, get_polygon, get_polyline, request_map, get_gps_content, get_gps_map_svg, gps_from_area } from "./pkg/gps.js";
|
||||
console.log("imported wasm");
|
||||
|
||||
// start map
|
||||
|
|
@ -187,7 +192,8 @@ document
|
|||
status.innerHTML = "file reading completed";
|
||||
let gpx_content = reader.result;
|
||||
|
||||
gps_data = load_gps_from_string(gpx_content);
|
||||
let autodetect_waypoints = document.getElementById("autodetect_waypoints").checked;
|
||||
gps_data = load_gps_from_string(gpx_content, autodetect_waypoints);
|
||||
display_polygon(map);
|
||||
};
|
||||
reader.readAsText(this.files[0]);
|
||||
|
|
@ -211,6 +217,10 @@ document
|
|||
request_map(gps_data, key1, value1, key2, value2, key3, value3, key4, value4).then(
|
||||
() => {
|
||||
|
||||
let include_elevation = document.getElementById("include_elevation").checked;
|
||||
if (!include_elevation) {
|
||||
disable_elevation(gps_data);
|
||||
}
|
||||
gps_content = get_gps_content(gps_data);
|
||||
status.innerHTML = "file converted (" + gps_content.length + " bytes)";
|
||||
let svg_string = get_gps_map_svg(gps_data);
|
||||
|
|
|
|||
|
|
@ -2,6 +2,10 @@
|
|||
/* eslint-disable */
|
||||
/**
|
||||
* @param {Gps} gps
|
||||
*/
|
||||
export function disable_elevation(gps: Gps): void;
|
||||
/**
|
||||
* @param {Gps} gps
|
||||
* @returns {string}
|
||||
*/
|
||||
export function get_gps_map_svg(gps: Gps): string;
|
||||
|
|
@ -40,9 +44,10 @@ export function get_gps_content(gps: Gps): Uint8Array;
|
|||
export function request_map(gps: Gps, key1: string, value1: string, key2: string, value2: string, key3: string, value3: string, key4: string, value4: string): Promise<void>;
|
||||
/**
|
||||
* @param {string} input
|
||||
* @param {boolean} autodetect_waypoints
|
||||
* @returns {Gps}
|
||||
*/
|
||||
export function load_gps_from_string(input: string): Gps;
|
||||
export function load_gps_from_string(input: string, autodetect_waypoints: boolean): Gps;
|
||||
/**
|
||||
* @param {number} xmin
|
||||
* @param {number} ymin
|
||||
|
|
@ -62,22 +67,23 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
|
|||
export interface InitOutput {
|
||||
readonly memory: WebAssembly.Memory;
|
||||
readonly __wbg_gps_free: (a: number) => void;
|
||||
readonly disable_elevation: (a: number) => void;
|
||||
readonly get_gps_map_svg: (a: number, b: number) => void;
|
||||
readonly get_polygon: (a: number, b: number) => void;
|
||||
readonly has_heights: (a: number) => number;
|
||||
readonly get_polyline: (a: number, b: number) => void;
|
||||
readonly get_gps_content: (a: number, b: number) => void;
|
||||
readonly request_map: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: number, p: number, q: number) => number;
|
||||
readonly load_gps_from_string: (a: number, b: number) => number;
|
||||
readonly load_gps_from_string: (a: number, b: number, c: number) => number;
|
||||
readonly gps_from_area: (a: number, b: number, c: number, d: number) => number;
|
||||
readonly __wbindgen_malloc: (a: number) => number;
|
||||
readonly __wbindgen_realloc: (a: number, b: number, c: number) => number;
|
||||
readonly __wbindgen_export_2: WebAssembly.Table;
|
||||
readonly _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h6c255cfec18e1b11: (a: number, b: number, c: number) => void;
|
||||
readonly wasm_bindgen__convert__closures__invoke1_mut__hccd55e4c61cc9011: (a: number, b: number, c: number) => void;
|
||||
readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
|
||||
readonly __wbindgen_free: (a: number, b: number) => void;
|
||||
readonly __wbindgen_exn_store: (a: number) => void;
|
||||
readonly wasm_bindgen__convert__closures__invoke2_mut__h362c9c5a9f7b102a: (a: number, b: number, c: number, d: number) => void;
|
||||
readonly wasm_bindgen__convert__closures__invoke2_mut__h7730cf2f7eba7070: (a: number, b: number, c: number, d: number) => void;
|
||||
}
|
||||
|
||||
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
||||
|
|
|
|||
|
|
@ -98,14 +98,6 @@ function takeObject(idx) {
|
|||
return ret;
|
||||
}
|
||||
|
||||
const cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
||||
|
||||
cachedTextDecoder.decode();
|
||||
|
||||
function getStringFromWasm0(ptr, len) {
|
||||
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
|
||||
}
|
||||
|
||||
function addHeapObject(obj) {
|
||||
if (heap_next === heap.length) heap.push(heap.length + 1);
|
||||
const idx = heap_next;
|
||||
|
|
@ -115,6 +107,14 @@ function addHeapObject(obj) {
|
|||
return idx;
|
||||
}
|
||||
|
||||
const cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
||||
|
||||
cachedTextDecoder.decode();
|
||||
|
||||
function getStringFromWasm0(ptr, len) {
|
||||
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
|
||||
}
|
||||
|
||||
function debugString(val) {
|
||||
// primitive types
|
||||
const type = typeof val;
|
||||
|
|
@ -205,7 +205,7 @@ function makeMutClosure(arg0, arg1, dtor, f) {
|
|||
return real;
|
||||
}
|
||||
function __wbg_adapter_24(arg0, arg1, arg2) {
|
||||
wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h6c255cfec18e1b11(arg0, arg1, addHeapObject(arg2));
|
||||
wasm.wasm_bindgen__convert__closures__invoke1_mut__hccd55e4c61cc9011(arg0, arg1, addHeapObject(arg2));
|
||||
}
|
||||
|
||||
function _assertClass(instance, klass) {
|
||||
|
|
@ -214,6 +214,14 @@ function _assertClass(instance, klass) {
|
|||
}
|
||||
return instance.ptr;
|
||||
}
|
||||
/**
|
||||
* @param {Gps} gps
|
||||
*/
|
||||
export function disable_elevation(gps) {
|
||||
_assertClass(gps, Gps);
|
||||
wasm.disable_elevation(gps.ptr);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Gps} gps
|
||||
* @returns {string}
|
||||
|
|
@ -350,12 +358,13 @@ export function request_map(gps, key1, value1, key2, value2, key3, value3, key4,
|
|||
|
||||
/**
|
||||
* @param {string} input
|
||||
* @param {boolean} autodetect_waypoints
|
||||
* @returns {Gps}
|
||||
*/
|
||||
export function load_gps_from_string(input) {
|
||||
export function load_gps_from_string(input, autodetect_waypoints) {
|
||||
const ptr0 = passStringToWasm0(input, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len0 = WASM_VECTOR_LEN;
|
||||
const ret = wasm.load_gps_from_string(ptr0, len0);
|
||||
const ret = wasm.load_gps_from_string(ptr0, len0, autodetect_waypoints);
|
||||
return Gps.__wrap(ret);
|
||||
}
|
||||
|
||||
|
|
@ -378,8 +387,8 @@ function handleError(f, args) {
|
|||
wasm.__wbindgen_exn_store(addHeapObject(e));
|
||||
}
|
||||
}
|
||||
function __wbg_adapter_85(arg0, arg1, arg2, arg3) {
|
||||
wasm.wasm_bindgen__convert__closures__invoke2_mut__h362c9c5a9f7b102a(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
|
||||
function __wbg_adapter_86(arg0, arg1, arg2, arg3) {
|
||||
wasm.wasm_bindgen__convert__closures__invoke2_mut__h7730cf2f7eba7070(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -440,6 +449,9 @@ async function load(module, imports) {
|
|||
function getImports() {
|
||||
const imports = {};
|
||||
imports.wbg = {};
|
||||
imports.wbg.__wbg_log_d04343b58be82b0f = function(arg0, arg1) {
|
||||
console.log(getStringFromWasm0(arg0, arg1));
|
||||
};
|
||||
imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
|
||||
const obj = getObject(arg1);
|
||||
const ret = typeof(obj) === 'string' ? obj : undefined;
|
||||
|
|
@ -448,12 +460,13 @@ function getImports() {
|
|||
getInt32Memory0()[arg0 / 4 + 1] = len0;
|
||||
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
|
||||
};
|
||||
imports.wbg.__wbg_log_d04343b58be82b0f = function(arg0, arg1) {
|
||||
console.log(getStringFromWasm0(arg0, arg1));
|
||||
};
|
||||
imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
|
||||
takeObject(arg0);
|
||||
};
|
||||
imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
|
||||
const ret = getObject(arg0);
|
||||
return addHeapObject(ret);
|
||||
};
|
||||
imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
|
||||
const ret = getStringFromWasm0(arg0, arg1);
|
||||
return addHeapObject(ret);
|
||||
|
|
@ -462,29 +475,6 @@ function getImports() {
|
|||
const ret = fetch(getObject(arg0));
|
||||
return addHeapObject(ret);
|
||||
};
|
||||
imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
|
||||
const ret = getObject(arg0);
|
||||
return addHeapObject(ret);
|
||||
};
|
||||
imports.wbg.__wbg_fetch_749a56934f95c96c = function(arg0, arg1) {
|
||||
const ret = getObject(arg0).fetch(getObject(arg1));
|
||||
return addHeapObject(ret);
|
||||
};
|
||||
imports.wbg.__wbg_newwithstrandinit_05d7180788420c40 = function() { return handleError(function (arg0, arg1, arg2) {
|
||||
const ret = new Request(getStringFromWasm0(arg0, arg1), getObject(arg2));
|
||||
return addHeapObject(ret);
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_signal_31753ac644b25fbb = function(arg0) {
|
||||
const ret = getObject(arg0).signal;
|
||||
return addHeapObject(ret);
|
||||
};
|
||||
imports.wbg.__wbg_new_6396e586b56e1dff = function() { return handleError(function () {
|
||||
const ret = new AbortController();
|
||||
return addHeapObject(ret);
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_abort_064ae59cda5cd244 = function(arg0) {
|
||||
getObject(arg0).abort();
|
||||
};
|
||||
imports.wbg.__wbg_new_2d0053ee81e4dd2a = function() { return handleError(function () {
|
||||
const ret = new Headers();
|
||||
return addHeapObject(ret);
|
||||
|
|
@ -521,6 +511,25 @@ function getImports() {
|
|||
const ret = getObject(arg0).text();
|
||||
return addHeapObject(ret);
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_fetch_749a56934f95c96c = function(arg0, arg1) {
|
||||
const ret = getObject(arg0).fetch(getObject(arg1));
|
||||
return addHeapObject(ret);
|
||||
};
|
||||
imports.wbg.__wbg_signal_31753ac644b25fbb = function(arg0) {
|
||||
const ret = getObject(arg0).signal;
|
||||
return addHeapObject(ret);
|
||||
};
|
||||
imports.wbg.__wbg_new_6396e586b56e1dff = function() { return handleError(function () {
|
||||
const ret = new AbortController();
|
||||
return addHeapObject(ret);
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_abort_064ae59cda5cd244 = function(arg0) {
|
||||
getObject(arg0).abort();
|
||||
};
|
||||
imports.wbg.__wbg_newwithstrandinit_05d7180788420c40 = function() { return handleError(function (arg0, arg1, arg2) {
|
||||
const ret = new Request(getStringFromWasm0(arg0, arg1), getObject(arg2));
|
||||
return addHeapObject(ret);
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_new_abda76e883ba8a5f = function() {
|
||||
const ret = new Error();
|
||||
return addHeapObject(ret);
|
||||
|
|
@ -620,7 +629,7 @@ function getImports() {
|
|||
const a = state0.a;
|
||||
state0.a = 0;
|
||||
try {
|
||||
return __wbg_adapter_85(a, state0.b, arg0, arg1);
|
||||
return __wbg_adapter_86(a, state0.b, arg0, arg1);
|
||||
} finally {
|
||||
state0.a = a;
|
||||
}
|
||||
|
|
@ -685,8 +694,8 @@ function getImports() {
|
|||
const ret = wasm.memory;
|
||||
return addHeapObject(ret);
|
||||
};
|
||||
imports.wbg.__wbindgen_closure_wrapper2263 = function(arg0, arg1, arg2) {
|
||||
const ret = makeMutClosure(arg0, arg1, 264, __wbg_adapter_24);
|
||||
imports.wbg.__wbindgen_closure_wrapper2330 = function(arg0, arg1, arg2) {
|
||||
const ret = makeMutClosure(arg0, arg1, 254, __wbg_adapter_24);
|
||||
return addHeapObject(ret);
|
||||
};
|
||||
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -2,19 +2,20 @@
|
|||
/* eslint-disable */
|
||||
export const memory: WebAssembly.Memory;
|
||||
export function __wbg_gps_free(a: number): void;
|
||||
export function disable_elevation(a: number): void;
|
||||
export function get_gps_map_svg(a: number, b: number): void;
|
||||
export function get_polygon(a: number, b: number): void;
|
||||
export function has_heights(a: number): number;
|
||||
export function get_polyline(a: number, b: number): void;
|
||||
export function get_gps_content(a: number, b: number): void;
|
||||
export function request_map(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: number, p: number, q: number): number;
|
||||
export function load_gps_from_string(a: number, b: number): number;
|
||||
export function load_gps_from_string(a: number, b: number, c: number): number;
|
||||
export function gps_from_area(a: number, b: number, c: number, d: number): number;
|
||||
export function __wbindgen_malloc(a: number): number;
|
||||
export function __wbindgen_realloc(a: number, b: number, c: number): number;
|
||||
export const __wbindgen_export_2: WebAssembly.Table;
|
||||
export function _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h6c255cfec18e1b11(a: number, b: number, c: number): void;
|
||||
export function wasm_bindgen__convert__closures__invoke1_mut__hccd55e4c61cc9011(a: number, b: number, c: number): void;
|
||||
export function __wbindgen_add_to_stack_pointer(a: number): number;
|
||||
export function __wbindgen_free(a: number, b: number): void;
|
||||
export function __wbindgen_exn_store(a: number): void;
|
||||
export function wasm_bindgen__convert__closures__invoke2_mut__h362c9c5a9f7b102a(a: number, b: number, c: number, d: number): void;
|
||||
export function wasm_bindgen__convert__closures__invoke2_mut__h7730cf2f7eba7070(a: number, b: number, c: number, d: number): void;
|
||||
|
|
|
|||
Loading…
Reference in New Issue