isard 0.6.1 → 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
  /**
@@ -1006,20 +1007,23 @@ export class Engine {
1006
1007
  * (16 at most): longitude, latitude (degrees), metres above the ground, range (metres), then to look one way
1007
1008
  * only heading, tilt, angles of view across and up (degrees), the heading NaN to look all around. What some
1008
1009
  * observer sees is tinted with `visible`, what is hidden from all those that reach it with `hidden` (RGB 0-1),
1009
- * at `opacity`
1010
+ * at `opacity`; `outline` (RGB 0-1, or empty) the color of the cones' edges drawn in 3D
1010
1011
  * @param {Float64Array} observers
1011
1012
  * @param {Float32Array} visible
1012
1013
  * @param {Float32Array} hidden
1013
1014
  * @param {number} opacity
1015
+ * @param {Float32Array} outline
1014
1016
  */
1015
- setViewshed(observers, visible, hidden, opacity) {
1017
+ setViewshed(observers, visible, hidden, opacity, outline) {
1016
1018
  const ptr0 = passArrayF64ToWasm0(observers, wasm.__wbindgen_malloc);
1017
1019
  const len0 = WASM_VECTOR_LEN;
1018
1020
  const ptr1 = passArrayF32ToWasm0(visible, wasm.__wbindgen_malloc);
1019
1021
  const len1 = WASM_VECTOR_LEN;
1020
1022
  const ptr2 = passArrayF32ToWasm0(hidden, wasm.__wbindgen_malloc);
1021
1023
  const len2 = WASM_VECTOR_LEN;
1022
- const ret = wasm.engine_setViewshed(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, opacity);
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);
1023
1027
  if (ret[1]) {
1024
1028
  throw takeFromExternrefTable0(ret[0]);
1025
1029
  }
@@ -1039,6 +1043,30 @@ export class Engine {
1039
1043
  const ret = wasm.engine_stats(this.__wbg_ptr);
1040
1044
  return ret;
1041
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
+ }
1042
1070
  /**
1043
1071
  * Compressed texture formats of the GPU (their WebGL extensions get enabled), for the KTX2 transcoding
1044
1072
  * @returns {TextureFormats}
@@ -1117,6 +1145,18 @@ export class Engine {
1117
1145
  const len0 = WASM_VECTOR_LEN;
1118
1146
  wasm.engine_updateIconAtlas(this.__wbg_ptr, x, y, width, height, ptr0, len0);
1119
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
+ }
1120
1160
  /**
1121
1161
  * @param {number} delta
1122
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;
@@ -362,14 +362,26 @@ export class Engine {
362
362
  * (16 at most): longitude, latitude (degrees), metres above the ground, range (metres), then to look one way
363
363
  * only heading, tilt, angles of view across and up (degrees), the heading NaN to look all around. What some
364
364
  * observer sees is tinted with `visible`, what is hidden from all those that reach it with `hidden` (RGB 0-1),
365
- * at `opacity`
365
+ * at `opacity`; `outline` (RGB 0-1, or empty) the color of the cones' edges drawn in 3D
366
366
  */
367
- setViewshed(observers: Float64Array, visible: Float32Array, hidden: Float32Array, opacity: number): void;
367
+ setViewshed(observers: Float64Array, visible: Float32Array, hidden: Float32Array, opacity: number, outline: Float32Array): void;
368
368
  setZoomRange(min: number, max: number): void;
369
369
  /**
370
370
  * Tile counters of the raster layers, for diagnostics
371
371
  */
372
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;
373
385
  /**
374
386
  * A region of the first page of the glyph atlas: `width` × `height` bytes at (`x`, `y`)
375
387
  */
@@ -386,6 +398,11 @@ export class Engine {
386
398
  * A region of the icon atlas: `width` × `height` RGBA texels (premultiplied) at (`x`, `y`)
387
399
  */
388
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;
389
406
  zoomAt(delta: number, x: number, y: number): void;
390
407
  }
391
408
 
@@ -417,7 +434,7 @@ export interface InitOutput {
417
434
  readonly engine_pick: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => any;
418
435
  readonly engine_pollPick: (a: number) => any;
419
436
  readonly engine_preload: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
420
- 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;
421
438
  readonly engine_removeExtrusionBatch: (a: number, b: number, c: number) => void;
422
439
  readonly engine_removeLayer: (a: number, b: number) => void;
423
440
  readonly engine_render: (a: number) => number;
@@ -461,13 +478,16 @@ export interface InitOutput {
461
478
  readonly engine_setSymbolLayer: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
462
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];
463
480
  readonly engine_setTerrain: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number];
464
- readonly engine_setViewshed: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: 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];
465
482
  readonly engine_setZoomRange: (a: number, b: number, c: number) => void;
466
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;
467
486
  readonly engine_updateGlyphAtlas: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
468
487
  readonly engine_updateGlyphPage: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
469
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];
470
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];
471
491
  readonly engine_zoomAt: (a: number, b: number, c: number, d: number) => void;
472
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;
473
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
  /**
@@ -877,20 +878,23 @@ export class Engine {
877
878
  * (16 at most): longitude, latitude (degrees), metres above the ground, range (metres), then to look one way
878
879
  * only heading, tilt, angles of view across and up (degrees), the heading NaN to look all around. What some
879
880
  * observer sees is tinted with `visible`, what is hidden from all those that reach it with `hidden` (RGB 0-1),
880
- * at `opacity`
881
+ * at `opacity`; `outline` (RGB 0-1, or empty) the color of the cones' edges drawn in 3D
881
882
  * @param {Float64Array} observers
882
883
  * @param {Float32Array} visible
883
884
  * @param {Float32Array} hidden
884
885
  * @param {number} opacity
886
+ * @param {Float32Array} outline
885
887
  */
886
- setViewshed(observers, visible, hidden, opacity) {
888
+ setViewshed(observers, visible, hidden, opacity, outline) {
887
889
  const ptr0 = passArrayF64ToWasm0(observers, wasm.__wbindgen_malloc);
888
890
  const len0 = WASM_VECTOR_LEN;
889
891
  const ptr1 = passArrayF32ToWasm0(visible, wasm.__wbindgen_malloc);
890
892
  const len1 = WASM_VECTOR_LEN;
891
893
  const ptr2 = passArrayF32ToWasm0(hidden, wasm.__wbindgen_malloc);
892
894
  const len2 = WASM_VECTOR_LEN;
893
- const ret = wasm.engine_setViewshed(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, opacity);
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);
894
898
  if (ret[1]) {
895
899
  throw takeFromExternrefTable0(ret[0]);
896
900
  }
@@ -910,6 +914,30 @@ export class Engine {
910
914
  const ret = wasm.engine_stats(this.__wbg_ptr);
911
915
  return ret;
912
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
+ }
913
941
  /**
914
942
  * A region of the first page of the glyph atlas: `width` × `height` bytes at (`x`, `y`)
915
943
  * @param {number} x
@@ -971,6 +999,18 @@ export class Engine {
971
999
  const len0 = WASM_VECTOR_LEN;
972
1000
  wasm.engine_updateIconAtlas(this.__wbg_ptr, x, y, width, height, ptr0, len0);
973
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
+ }
974
1014
  /**
975
1015
  * @param {number} delta
976
1016
  * @param {number} x
@@ -1621,6 +1661,10 @@ function __wbg_get_imports() {
1621
1661
  const ret = Array.of(arg0, arg1);
1622
1662
  return ret;
1623
1663
  },
1664
+ __wbg_of_dde0b9d3265685ee: function(arg0, arg1, arg2) {
1665
+ const ret = Array.of(arg0, arg1, arg2);
1666
+ return ret;
1667
+ },
1624
1668
  __wbg_performance_d0d7b03fc649b694: function(arg0) {
1625
1669
  const ret = arg0.performance;
1626
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.1",
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",