isard 0.6.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -417,13 +417,14 @@ export class Engine {
417
417
  wasm.engine_preload(this.__wbg_ptr, lon, lat, zoom, pitch, bearing);
418
418
  }
419
419
  /**
420
- * Screen point (CSS pixels) of a ground position, undefined behind the camera
420
+ * Screen point (CSS pixels) of a ground position, or `height` metres above it, undefined behind the camera
421
421
  * @param {number} lon
422
422
  * @param {number} lat
423
+ * @param {number | null} [height]
423
424
  * @returns {[x: number, y: number] | undefined}
424
425
  */
425
- project(lon, lat) {
426
- const ret = wasm.engine_project(this.__wbg_ptr, lon, lat);
426
+ project(lon, lat, height) {
427
+ const ret = wasm.engine_project(this.__wbg_ptr, lon, lat, !isLikeNone(height), isLikeNone(height) ? 0 : height);
427
428
  return ret;
428
429
  }
429
430
  /**
@@ -1002,26 +1003,27 @@ export class Engine {
1002
1003
  wasm.engine_setTiles3dStyle(this.__wbg_ptr, id, max_error, opacity, !isLikeNone(point_size), isLikeNone(point_size) ? 0 : point_size);
1003
1004
  }
1004
1005
  /**
1005
- * Shows what can be seen from a point within `range` metres around it: `lon`, `lat` (degrees), `height` metres
1006
- * above the ground; seen and hidden surfaces tinted with `visible` and `hidden` (RGB 0-1) at `opacity`. `cone`:
1007
- * heading, tilt, angles of view across and up (degrees) to look one way only, empty to look all around
1008
- * @param {number} lon
1009
- * @param {number} lat
1010
- * @param {number} height
1011
- * @param {number} range
1006
+ * Shows what can be seen from points, each within its range: `observers` holds 8 numbers per observer
1007
+ * (16 at most): longitude, latitude (degrees), metres above the ground, range (metres), then to look one way
1008
+ * only heading, tilt, angles of view across and up (degrees), the heading NaN to look all around. What some
1009
+ * observer sees is tinted with `visible`, what is hidden from all those that reach it with `hidden` (RGB 0-1),
1010
+ * at `opacity`; `outline` (RGB 0-1, or empty) the color of the cones' edges drawn in 3D
1011
+ * @param {Float64Array} observers
1012
1012
  * @param {Float32Array} visible
1013
1013
  * @param {Float32Array} hidden
1014
1014
  * @param {number} opacity
1015
- * @param {Float64Array} cone
1015
+ * @param {Float32Array} outline
1016
1016
  */
1017
- setViewshed(lon, lat, height, range, visible, hidden, opacity, cone) {
1018
- const ptr0 = passArrayF32ToWasm0(visible, wasm.__wbindgen_malloc);
1017
+ setViewshed(observers, visible, hidden, opacity, outline) {
1018
+ const ptr0 = passArrayF64ToWasm0(observers, wasm.__wbindgen_malloc);
1019
1019
  const len0 = WASM_VECTOR_LEN;
1020
- const ptr1 = passArrayF32ToWasm0(hidden, wasm.__wbindgen_malloc);
1020
+ const ptr1 = passArrayF32ToWasm0(visible, wasm.__wbindgen_malloc);
1021
1021
  const len1 = WASM_VECTOR_LEN;
1022
- const ptr2 = passArrayF64ToWasm0(cone, wasm.__wbindgen_malloc);
1022
+ const ptr2 = passArrayF32ToWasm0(hidden, wasm.__wbindgen_malloc);
1023
1023
  const len2 = WASM_VECTOR_LEN;
1024
- const ret = wasm.engine_setViewshed(this.__wbg_ptr, lon, lat, height, range, ptr0, len0, ptr1, len1, opacity, ptr2, len2);
1024
+ const ptr3 = passArrayF32ToWasm0(outline, wasm.__wbindgen_malloc);
1025
+ const len3 = WASM_VECTOR_LEN;
1026
+ const ret = wasm.engine_setViewshed(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, opacity, ptr3, len3);
1025
1027
  if (ret[1]) {
1026
1028
  throw takeFromExternrefTable0(ret[0]);
1027
1029
  }
@@ -1041,6 +1043,30 @@ export class Engine {
1041
1043
  const ret = wasm.engine_stats(this.__wbg_ptr);
1042
1044
  return ret;
1043
1045
  }
1046
+ /**
1047
+ * The height above the relief (metres) of the top of what stands at a position (degrees): a roof, a mesh, 0 on
1048
+ * the bare ground; undefined where nothing of the last frame is there. The scene is drawn from above into a single
1049
+ * pixel and read back (a stall, cheap: one pixel to fill)
1050
+ * @param {number} lon
1051
+ * @param {number} lat
1052
+ * @returns {any}
1053
+ */
1054
+ surfaceAt(lon, lat) {
1055
+ const ret = wasm.engine_surfaceAt(this.__wbg_ptr, lon, lat);
1056
+ return ret;
1057
+ }
1058
+ /**
1059
+ * What is drawn under a screen point (CSS pixels): longitude, latitude and its height above the relief (metres),
1060
+ * on a roof, a wall or a mesh as on the ground; undefined where nothing was drawn. The scene is drawn again and
1061
+ * read back (a stall): for clicks and drags
1062
+ * @param {number} x
1063
+ * @param {number} y
1064
+ * @returns {[lon: number, lat: number, height: number] | undefined}
1065
+ */
1066
+ surface(x, y) {
1067
+ const ret = wasm.engine_surface(this.__wbg_ptr, x, y);
1068
+ return ret;
1069
+ }
1044
1070
  /**
1045
1071
  * Compressed texture formats of the GPU (their WebGL extensions get enabled), for the KTX2 transcoding
1046
1072
  * @returns {TextureFormats}
@@ -1119,6 +1145,18 @@ export class Engine {
1119
1145
  const len0 = WASM_VECTOR_LEN;
1120
1146
  wasm.engine_updateIconAtlas(this.__wbg_ptr, x, y, width, height, ptr0, len0);
1121
1147
  }
1148
+ /**
1149
+ * Tiles a raster layer wants for the view of the last frame, three numbers per tile (z, x, y), the nearest to
1150
+ * the eye first: the level each area of the ground is drawn at, for the labels of a vector style to follow it
1151
+ * @param {number} id
1152
+ * @returns {Uint32Array}
1153
+ */
1154
+ wantedTiles(id) {
1155
+ const ret = wasm.engine_wantedTiles(this.__wbg_ptr, id);
1156
+ var v1 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
1157
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
1158
+ return v1;
1159
+ }
1122
1160
  /**
1123
1161
  * @param {number} delta
1124
1162
  * @param {number} x
@@ -175,9 +175,9 @@ export class Engine {
175
175
  */
176
176
  preload(lon: number, lat: number, zoom: number, pitch: number, bearing: number): void;
177
177
  /**
178
- * Screen point (CSS pixels) of a ground position, undefined behind the camera
178
+ * Screen point (CSS pixels) of a ground position, or `height` metres above it, undefined behind the camera
179
179
  */
180
- project(lon: number, lat: number): [x: number, y: number] | undefined;
180
+ project(lon: number, lat: number, height?: number | null): [x: number, y: number] | undefined;
181
181
  removeExtrusionBatch(id: number, key: number): void;
182
182
  removeLayer(id: number): void;
183
183
  render(): boolean;
@@ -358,16 +358,30 @@ export class Engine {
358
358
  */
359
359
  setTerrain(url: string | null | undefined, exaggeration: number, max_z: number | null | undefined, geoid: boolean | null | undefined, loader: ((z: number, x: number, y: number, signal: AbortSignal) => Promise<Float32Array | null>) | undefined): void;
360
360
  /**
361
- * Shows what can be seen from a point within `range` metres around it: `lon`, `lat` (degrees), `height` metres
362
- * above the ground; seen and hidden surfaces tinted with `visible` and `hidden` (RGB 0-1) at `opacity`. `cone`:
363
- * heading, tilt, angles of view across and up (degrees) to look one way only, empty to look all around
361
+ * Shows what can be seen from points, each within its range: `observers` holds 8 numbers per observer
362
+ * (16 at most): longitude, latitude (degrees), metres above the ground, range (metres), then to look one way
363
+ * only heading, tilt, angles of view across and up (degrees), the heading NaN to look all around. What some
364
+ * observer sees is tinted with `visible`, what is hidden from all those that reach it with `hidden` (RGB 0-1),
365
+ * at `opacity`; `outline` (RGB 0-1, or empty) the color of the cones' edges drawn in 3D
364
366
  */
365
- setViewshed(lon: number, lat: number, height: number, range: number, visible: Float32Array, hidden: Float32Array, opacity: number, cone: Float64Array): void;
367
+ setViewshed(observers: Float64Array, visible: Float32Array, hidden: Float32Array, opacity: number, outline: Float32Array): void;
366
368
  setZoomRange(min: number, max: number): void;
367
369
  /**
368
370
  * Tile counters of the raster layers, for diagnostics
369
371
  */
370
372
  stats(): RasterLayerStats[];
373
+ /**
374
+ * The height above the relief (metres) of the top of what stands at a position (degrees): a roof, a mesh, 0 on
375
+ * the bare ground; undefined where nothing of the last frame is there. The scene is drawn from above into a single
376
+ * pixel and read back (a stall, cheap: one pixel to fill)
377
+ */
378
+ surfaceAt(lon: number, lat: number): any;
379
+ /**
380
+ * What is drawn under a screen point (CSS pixels): longitude, latitude and its height above the relief (metres),
381
+ * on a roof, a wall or a mesh as on the ground; undefined where nothing was drawn. The scene is drawn again and
382
+ * read back (a stall): for clicks and drags
383
+ */
384
+ surface(x: number, y: number): [lon: number, lat: number, height: number] | undefined;
371
385
  /**
372
386
  * A region of the first page of the glyph atlas: `width` × `height` bytes at (`x`, `y`)
373
387
  */
@@ -384,6 +398,11 @@ export class Engine {
384
398
  * A region of the icon atlas: `width` × `height` RGBA texels (premultiplied) at (`x`, `y`)
385
399
  */
386
400
  updateIconAtlas(x: number, y: number, width: number, height: number, data: Uint8Array): void;
401
+ /**
402
+ * Tiles a raster layer wants for the view of the last frame, three numbers per tile (z, x, y), the nearest to
403
+ * the eye first: the level each area of the ground is drawn at, for the labels of a vector style to follow it
404
+ */
405
+ wantedTiles(id: number): Uint32Array;
387
406
  zoomAt(delta: number, x: number, y: number): void;
388
407
  }
389
408
 
@@ -415,7 +434,7 @@ export interface InitOutput {
415
434
  readonly engine_pick: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => any;
416
435
  readonly engine_pollPick: (a: number) => any;
417
436
  readonly engine_preload: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
418
- readonly engine_project: (a: number, b: number, c: number) => any;
437
+ readonly engine_project: (a: number, b: number, c: number, d: number, e: number) => any;
419
438
  readonly engine_removeExtrusionBatch: (a: number, b: number, c: number) => void;
420
439
  readonly engine_removeLayer: (a: number, b: number) => void;
421
440
  readonly engine_render: (a: number) => number;
@@ -459,13 +478,16 @@ export interface InitOutput {
459
478
  readonly engine_setSymbolLayer: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
460
479
  readonly engine_setSymbols: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => [number, number];
461
480
  readonly engine_setTerrain: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number];
462
- readonly engine_setViewshed: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number) => [number, number];
481
+ readonly engine_setViewshed: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => [number, number];
463
482
  readonly engine_setZoomRange: (a: number, b: number, c: number) => void;
464
483
  readonly engine_stats: (a: number) => any;
484
+ readonly engine_surface: (a: number, b: number, c: number) => any;
485
+ readonly engine_surfaceAt: (a: number, b: number, c: number) => any;
465
486
  readonly engine_updateGlyphAtlas: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
466
487
  readonly engine_updateGlyphPage: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
467
488
  readonly engine_updateGroundTexture: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number) => [number, number];
468
489
  readonly engine_updateIconAtlas: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
490
+ readonly engine_wantedTiles: (a: number, b: number) => [number, number];
469
491
  readonly engine_zoomAt: (a: number, b: number, c: number, d: number) => void;
470
492
  readonly wasm_bindgen_2e566c63402fe7fa___convert__closures_____invoke___js_sys_b1e1c29ba6b0e6b3___Function_fn_wasm_bindgen_2e566c63402fe7fa___JsValue_____wasm_bindgen_2e566c63402fe7fa___sys__Undefined___js_sys_b1e1c29ba6b0e6b3___Function_fn_wasm_bindgen_2e566c63402fe7fa___JsValue_____wasm_bindgen_2e566c63402fe7fa___sys__Undefined_______true_: (a: number, b: number, c: any, d: any) => void;
471
493
  readonly wasm_bindgen_2e566c63402fe7fa___convert__closures_____invoke___wasm_bindgen_2e566c63402fe7fa___JsValue__core_37ee0ce0c4cd57d5___result__Result_____wasm_bindgen_2e566c63402fe7fa___JsError___true_: (a: number, b: number, c: any) => [number, number];
@@ -335,13 +335,14 @@ export class Engine {
335
335
  wasm.engine_preload(this.__wbg_ptr, lon, lat, zoom, pitch, bearing);
336
336
  }
337
337
  /**
338
- * Screen point (CSS pixels) of a ground position, undefined behind the camera
338
+ * Screen point (CSS pixels) of a ground position, or `height` metres above it, undefined behind the camera
339
339
  * @param {number} lon
340
340
  * @param {number} lat
341
+ * @param {number | null} [height]
341
342
  * @returns {[x: number, y: number] | undefined}
342
343
  */
343
- project(lon, lat) {
344
- const ret = wasm.engine_project(this.__wbg_ptr, lon, lat);
344
+ project(lon, lat, height) {
345
+ const ret = wasm.engine_project(this.__wbg_ptr, lon, lat, !isLikeNone(height), isLikeNone(height) ? 0 : height);
345
346
  return ret;
346
347
  }
347
348
  /**
@@ -873,26 +874,27 @@ export class Engine {
873
874
  }
874
875
  }
875
876
  /**
876
- * Shows what can be seen from a point within `range` metres around it: `lon`, `lat` (degrees), `height` metres
877
- * above the ground; seen and hidden surfaces tinted with `visible` and `hidden` (RGB 0-1) at `opacity`. `cone`:
878
- * heading, tilt, angles of view across and up (degrees) to look one way only, empty to look all around
879
- * @param {number} lon
880
- * @param {number} lat
881
- * @param {number} height
882
- * @param {number} range
877
+ * Shows what can be seen from points, each within its range: `observers` holds 8 numbers per observer
878
+ * (16 at most): longitude, latitude (degrees), metres above the ground, range (metres), then to look one way
879
+ * only heading, tilt, angles of view across and up (degrees), the heading NaN to look all around. What some
880
+ * observer sees is tinted with `visible`, what is hidden from all those that reach it with `hidden` (RGB 0-1),
881
+ * at `opacity`; `outline` (RGB 0-1, or empty) the color of the cones' edges drawn in 3D
882
+ * @param {Float64Array} observers
883
883
  * @param {Float32Array} visible
884
884
  * @param {Float32Array} hidden
885
885
  * @param {number} opacity
886
- * @param {Float64Array} cone
886
+ * @param {Float32Array} outline
887
887
  */
888
- setViewshed(lon, lat, height, range, visible, hidden, opacity, cone) {
889
- const ptr0 = passArrayF32ToWasm0(visible, wasm.__wbindgen_malloc);
888
+ setViewshed(observers, visible, hidden, opacity, outline) {
889
+ const ptr0 = passArrayF64ToWasm0(observers, wasm.__wbindgen_malloc);
890
890
  const len0 = WASM_VECTOR_LEN;
891
- const ptr1 = passArrayF32ToWasm0(hidden, wasm.__wbindgen_malloc);
891
+ const ptr1 = passArrayF32ToWasm0(visible, wasm.__wbindgen_malloc);
892
892
  const len1 = WASM_VECTOR_LEN;
893
- const ptr2 = passArrayF64ToWasm0(cone, wasm.__wbindgen_malloc);
893
+ const ptr2 = passArrayF32ToWasm0(hidden, wasm.__wbindgen_malloc);
894
894
  const len2 = WASM_VECTOR_LEN;
895
- const ret = wasm.engine_setViewshed(this.__wbg_ptr, lon, lat, height, range, ptr0, len0, ptr1, len1, opacity, ptr2, len2);
895
+ const ptr3 = passArrayF32ToWasm0(outline, wasm.__wbindgen_malloc);
896
+ const len3 = WASM_VECTOR_LEN;
897
+ const ret = wasm.engine_setViewshed(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, opacity, ptr3, len3);
896
898
  if (ret[1]) {
897
899
  throw takeFromExternrefTable0(ret[0]);
898
900
  }
@@ -912,6 +914,30 @@ export class Engine {
912
914
  const ret = wasm.engine_stats(this.__wbg_ptr);
913
915
  return ret;
914
916
  }
917
+ /**
918
+ * The height above the relief (metres) of the top of what stands at a position (degrees): a roof, a mesh, 0 on
919
+ * the bare ground; undefined where nothing of the last frame is there. The scene is drawn from above into a single
920
+ * pixel and read back (a stall, cheap: one pixel to fill)
921
+ * @param {number} lon
922
+ * @param {number} lat
923
+ * @returns {any}
924
+ */
925
+ surfaceAt(lon, lat) {
926
+ const ret = wasm.engine_surfaceAt(this.__wbg_ptr, lon, lat);
927
+ return ret;
928
+ }
929
+ /**
930
+ * What is drawn under a screen point (CSS pixels): longitude, latitude and its height above the relief (metres),
931
+ * on a roof, a wall or a mesh as on the ground; undefined where nothing was drawn. The scene is drawn again and
932
+ * read back (a stall): for clicks and drags
933
+ * @param {number} x
934
+ * @param {number} y
935
+ * @returns {[lon: number, lat: number, height: number] | undefined}
936
+ */
937
+ surface(x, y) {
938
+ const ret = wasm.engine_surface(this.__wbg_ptr, x, y);
939
+ return ret;
940
+ }
915
941
  /**
916
942
  * A region of the first page of the glyph atlas: `width` × `height` bytes at (`x`, `y`)
917
943
  * @param {number} x
@@ -973,6 +999,18 @@ export class Engine {
973
999
  const len0 = WASM_VECTOR_LEN;
974
1000
  wasm.engine_updateIconAtlas(this.__wbg_ptr, x, y, width, height, ptr0, len0);
975
1001
  }
1002
+ /**
1003
+ * Tiles a raster layer wants for the view of the last frame, three numbers per tile (z, x, y), the nearest to
1004
+ * the eye first: the level each area of the ground is drawn at, for the labels of a vector style to follow it
1005
+ * @param {number} id
1006
+ * @returns {Uint32Array}
1007
+ */
1008
+ wantedTiles(id) {
1009
+ const ret = wasm.engine_wantedTiles(this.__wbg_ptr, id);
1010
+ var v1 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
1011
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
1012
+ return v1;
1013
+ }
976
1014
  /**
977
1015
  * @param {number} delta
978
1016
  * @param {number} x
@@ -1623,6 +1661,10 @@ function __wbg_get_imports() {
1623
1661
  const ret = Array.of(arg0, arg1);
1624
1662
  return ret;
1625
1663
  },
1664
+ __wbg_of_dde0b9d3265685ee: function(arg0, arg1, arg2) {
1665
+ const ret = Array.of(arg0, arg1, arg2);
1666
+ return ret;
1667
+ },
1626
1668
  __wbg_performance_d0d7b03fc649b694: function(arg0) {
1627
1669
  const ret = arg0.performance;
1628
1670
  return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isard",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "description": "A WebGL2 map engine for large, interactive data layers, labels and 3D Tiles over raster or vector basemaps (Rust core in WebAssembly)",
5
5
  "license": "MIT",
6
6
  "author": "Kevin Graff",