diff --git a/apps/gipy/README.md b/apps/gipy/README.md index e247e954b..e9444769f 100644 --- a/apps/gipy/README.md +++ b/apps/gipy/README.md @@ -33,7 +33,7 @@ It provides the following features : ### Preparing the file -You first need to have a trace file in *gpx* format. +You typically want to use a trace file in *gpx* format. Usually I download from [komoot](https://www.komoot.com/) or I export from google maps using [mapstogpx](https://mapstogpx.com/). [Brouter](https://brouter.damsy.net) is also a nice open source option. @@ -48,6 +48,11 @@ Just click the disk icon and select your gpx file. This will request additional information from openstreetmap. Your path will be displayed in svg. +Note that it is also possible to just hit the shift key and drag the mouse on the map +to download a map (with no trace). If you want a map, hitting the "ski" checkbox +before selecting the area will parse openstreetmap data in order to get the pistes and +the lifts. Colors will correspond to difficulty levels. + ### Starting Gipy At start you will have a menu for selecting your trace (if more than one). diff --git a/apps/gipy/interface.html b/apps/gipy/interface.html index f8eebabe6..0fb60778f 100644 --- a/apps/gipy/interface.html +++ b/apps/gipy/interface.html @@ -55,6 +55,9 @@ + + +
@@ -140,7 +143,9 @@ if ((e.which !== 1) && (e.button !== 1)) { return; } this._map.containerPointToLatLng(this._point)); let south_west = bounds.getSouthWest(); let north_east = bounds.getNorthEast(); - gps_data = gps_from_area(south_west.lng, south_west.lat, north_east.lng, north_east.lat); + let ski = document.getElementById("ski").checked; + console.log("ski", ski); + gps_data = gps_from_area(south_west.lng, south_west.lat, north_east.lng, north_east.lat, ski); document.getElementById('gps_file').value = ""; display_polygon(this._map); diff --git a/apps/gipy/pkg/gps.d.ts b/apps/gipy/pkg/gps.d.ts index 2adf67de6..9ad646068 100644 --- a/apps/gipy/pkg/gps.d.ts +++ b/apps/gipy/pkg/gps.d.ts @@ -53,9 +53,10 @@ export function load_gps_from_string(input: string, autodetect_waypoints: boolea * @param {number} ymin * @param {number} xmax * @param {number} ymax +* @param {boolean} ski * @returns {Gps} */ -export function gps_from_area(xmin: number, ymin: number, xmax: number, ymax: number): Gps; +export function gps_from_area(xmin: number, ymin: number, xmax: number, ymax: number, ski: boolean): Gps; /** */ export class Gps { @@ -75,15 +76,15 @@ export interface InitOutput { 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, c: number) => number; - readonly gps_from_area: (a: number, b: number, c: number, d: number) => number; + readonly gps_from_area: (a: number, b: number, c: number, d: number, e: 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 wasm_bindgen__convert__closures__invoke1_mut__hb9556e00aeed619f: (a: number, b: number, c: number) => void; + readonly wasm_bindgen__convert__closures__invoke1_mut__hc18aa489d857d6a0: (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__h05b9ac778f1bc584: (a: number, b: number, c: number, d: number) => void; + readonly wasm_bindgen__convert__closures__invoke2_mut__h41c3b5af183df3b2: (a: number, b: number, c: number, d: number) => void; } export type SyncInitInput = BufferSource | WebAssembly.Module; diff --git a/apps/gipy/pkg/gps.js b/apps/gipy/pkg/gps.js index 5afb78d0d..05a00e94b 100644 --- a/apps/gipy/pkg/gps.js +++ b/apps/gipy/pkg/gps.js @@ -7,6 +7,20 @@ heap.push(undefined, null, true, false); function getObject(idx) { return heap[idx]; } +let heap_next = heap.length; + +function dropObject(idx) { + if (idx < 36) return; + heap[idx] = heap_next; + heap_next = idx; +} + +function takeObject(idx) { + const ret = getObject(idx); + dropObject(idx); + return ret; +} + let WASM_VECTOR_LEN = 0; let cachedUint8Memory0 = new Uint8Array(); @@ -84,20 +98,6 @@ function getInt32Memory0() { return cachedInt32Memory0; } -let heap_next = heap.length; - -function dropObject(idx) { - if (idx < 36) return; - heap[idx] = heap_next; - heap_next = idx; -} - -function takeObject(idx) { - const ret = getObject(idx); - dropObject(idx); - return ret; -} - function addHeapObject(obj) { if (heap_next === heap.length) heap.push(heap.length + 1); const idx = heap_next; @@ -205,7 +205,7 @@ function makeMutClosure(arg0, arg1, dtor, f) { return real; } function __wbg_adapter_24(arg0, arg1, arg2) { - wasm.wasm_bindgen__convert__closures__invoke1_mut__hb9556e00aeed619f(arg0, arg1, addHeapObject(arg2)); + wasm.wasm_bindgen__convert__closures__invoke1_mut__hc18aa489d857d6a0(arg0, arg1, addHeapObject(arg2)); } function _assertClass(instance, klass) { @@ -373,10 +373,11 @@ export function load_gps_from_string(input, autodetect_waypoints) { * @param {number} ymin * @param {number} xmax * @param {number} ymax +* @param {boolean} ski * @returns {Gps} */ -export function gps_from_area(xmin, ymin, xmax, ymax) { - const ret = wasm.gps_from_area(xmin, ymin, xmax, ymax); +export function gps_from_area(xmin, ymin, xmax, ymax, ski) { + const ret = wasm.gps_from_area(xmin, ymin, xmax, ymax, ski); return Gps.__wrap(ret); } @@ -388,7 +389,7 @@ function handleError(f, args) { } } function __wbg_adapter_86(arg0, arg1, arg2, arg3) { - wasm.wasm_bindgen__convert__closures__invoke2_mut__h05b9ac778f1bc584(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3)); + wasm.wasm_bindgen__convert__closures__invoke2_mut__h41c3b5af183df3b2(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3)); } /** @@ -452,6 +453,9 @@ function getImports() { 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_string_get = function(arg0, arg1) { const obj = getObject(arg1); const ret = typeof(obj) === 'string' ? obj : undefined; @@ -460,9 +464,6 @@ function getImports() { getInt32Memory0()[arg0 / 4 + 1] = len0; getInt32Memory0()[arg0 / 4 + 0] = ptr0; }; - 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); @@ -694,7 +695,7 @@ function getImports() { const ret = wasm.memory; return addHeapObject(ret); }; - imports.wbg.__wbindgen_closure_wrapper2328 = function(arg0, arg1, arg2) { + imports.wbg.__wbindgen_closure_wrapper2355 = function(arg0, arg1, arg2) { const ret = makeMutClosure(arg0, arg1, 292, __wbg_adapter_24); return addHeapObject(ret); }; diff --git a/apps/gipy/pkg/gps_bg.wasm b/apps/gipy/pkg/gps_bg.wasm index 301db54a2..a5c19613c 100644 Binary files a/apps/gipy/pkg/gps_bg.wasm and b/apps/gipy/pkg/gps_bg.wasm differ diff --git a/apps/gipy/pkg/gps_bg.wasm.d.ts b/apps/gipy/pkg/gps_bg.wasm.d.ts index 8931dfbe4..251d9c3b1 100644 --- a/apps/gipy/pkg/gps_bg.wasm.d.ts +++ b/apps/gipy/pkg/gps_bg.wasm.d.ts @@ -10,12 +10,12 @@ 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, c: number): number; -export function gps_from_area(a: number, b: number, c: number, d: number): number; +export function gps_from_area(a: number, b: number, c: number, d: number, e: 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 wasm_bindgen__convert__closures__invoke1_mut__hb9556e00aeed619f(a: number, b: number, c: number): void; +export function wasm_bindgen__convert__closures__invoke1_mut__hc18aa489d857d6a0(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__h05b9ac778f1bc584(a: number, b: number, c: number, d: number): void; +export function wasm_bindgen__convert__closures__invoke2_mut__h41c3b5af183df3b2(a: number, b: number, c: number, d: number): void; diff --git a/apps/gipy/pkg/package.json b/apps/gipy/pkg/package.json index 0f6ae6a75..6778e3c09 100644 --- a/apps/gipy/pkg/package.json +++ b/apps/gipy/pkg/package.json @@ -8,5 +8,7 @@ ], "module": "gps.js", "types": "gps.d.ts", - "sideEffects": false + "sideEffects": [ + "./snippets/*" + ] } \ No newline at end of file