@reearth/ezu 0.6.1 → 0.8.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.
- package/README.md +5 -0
- package/bundler/ezu.d.ts +45 -0
- package/bundler/ezu_bg.js +85 -0
- package/bundler/ezu_bg.wasm +0 -0
- package/bundler/ezu_bg.wasm.d.ts +3 -0
- package/nodejs/ezu.d.ts +45 -0
- package/nodejs/ezu.js +85 -0
- package/nodejs/ezu_bg.wasm +0 -0
- package/nodejs/ezu_bg.wasm.d.ts +3 -0
- package/package.json +1 -1
- package/simd/bundler/ezu.d.ts +45 -0
- package/simd/bundler/ezu_bg.js +85 -0
- package/simd/bundler/ezu_bg.wasm +0 -0
- package/simd/bundler/ezu_bg.wasm.d.ts +3 -0
- package/simd/nodejs/ezu.d.ts +45 -0
- package/simd/nodejs/ezu.js +85 -0
- package/simd/nodejs/ezu_bg.wasm +0 -0
- package/simd/nodejs/ezu_bg.wasm.d.ts +3 -0
- package/simd/web/ezu.d.ts +48 -0
- package/simd/web/ezu.js +85 -0
- package/simd/web/ezu_bg.wasm +0 -0
- package/simd/web/ezu_bg.wasm.d.ts +3 -0
- package/web/ezu.d.ts +48 -0
- package/web/ezu.js +85 -0
- package/web/ezu_bg.wasm +0 -0
- package/web/ezu_bg.wasm.d.ts +3 -0
package/README.md
CHANGED
|
@@ -128,6 +128,11 @@ class Renderer {
|
|
|
128
128
|
format?: "png" | "webp" | "rgba"; // default "png"
|
|
129
129
|
tileSize?: number;
|
|
130
130
|
pad?: number;
|
|
131
|
+
// Render-time overrides for the style's declared `params`, validated
|
|
132
|
+
// against the declarations (type, min/max) — an unknown name or an
|
|
133
|
+
// out-of-range value throws. Names left out keep their default. One
|
|
134
|
+
// built graph serves every combination.
|
|
135
|
+
params?: Record<string, number | boolean | string>;
|
|
131
136
|
png?: { compression?: "fast" | "default" | "best" };
|
|
132
137
|
}): Uint8Array;
|
|
133
138
|
|
package/bundler/ezu.d.ts
CHANGED
|
@@ -111,6 +111,16 @@ export class Renderer {
|
|
|
111
111
|
* Drop every pending source binding. Call between tile renders.
|
|
112
112
|
*/
|
|
113
113
|
clearSources(): void;
|
|
114
|
+
/**
|
|
115
|
+
* The style's declared `legend`, or `undefined` when it declares
|
|
116
|
+
* none. Pass a zoom to keep only the entries that apply there.
|
|
117
|
+
*
|
|
118
|
+
* Entries name the node that draws the symbol rather than restating
|
|
119
|
+
* a colour, so a host lays out the labels and asks the map itself
|
|
120
|
+
* for the swatches. The CLI's `ezu legend` renders those swatches;
|
|
121
|
+
* in a browser, render the named node.
|
|
122
|
+
*/
|
|
123
|
+
legend(zoom?: number | null): any;
|
|
114
124
|
/**
|
|
115
125
|
* What this renderer is holding, in bytes, so a host can shed load
|
|
116
126
|
* *before* an allocation fails rather than after.
|
|
@@ -200,6 +210,10 @@ export class Renderer {
|
|
|
200
210
|
* - `format`: `"png"` (default) / `"webp"` / `"rgba"`
|
|
201
211
|
* - `tileSize`, `pad`: override the style's canvas size for this
|
|
202
212
|
* call (hi-DPI / preview)
|
|
213
|
+
* - `params`: `{ name: number | boolean | string }` — render-time
|
|
214
|
+
* overrides for the style's declared `params`, validated the same
|
|
215
|
+
* way the CLI's `--param` is. Omitted names keep their declared
|
|
216
|
+
* default.
|
|
203
217
|
* - `png`: `{ compression?: "fast" | "default" | "best" }`
|
|
204
218
|
*/
|
|
205
219
|
renderTile(z: number, x: number, y: number, opts?: object | null): Uint8Array;
|
|
@@ -216,6 +230,11 @@ export class Renderer {
|
|
|
216
230
|
* fetches exactly what the recipe needs. An empty array means the
|
|
217
231
|
* centre tile is enough.
|
|
218
232
|
*
|
|
233
|
+
* A `dem` or `raster` source that declares `neighbor-fetch: false`
|
|
234
|
+
* reports no offsets whatever the graph asks for: the style has said
|
|
235
|
+
* not to stitch a neighbourhood for it, and this list is what a host
|
|
236
|
+
* fetches from.
|
|
237
|
+
*
|
|
219
238
|
* Throws `UnknownSource` if `name` is not declared in the style.
|
|
220
239
|
*/
|
|
221
240
|
requestedNeighborOffsets(name: string): Array<any>;
|
|
@@ -249,12 +268,38 @@ export class Renderer {
|
|
|
249
268
|
* the intermediate cache and drops any pending source bindings.
|
|
250
269
|
*/
|
|
251
270
|
setStyle(style_json: string): number;
|
|
271
|
+
/**
|
|
272
|
+
* The tile a host should actually fetch from `name` in order to draw
|
|
273
|
+
* `z/x/y`, as `{ z, x, y }`.
|
|
274
|
+
*
|
|
275
|
+
* For a source that declares `max-zoom`, a request past the ceiling
|
|
276
|
+
* answers with the covering ancestor — bind those bytes with
|
|
277
|
+
* `{ sourceZoom: <returned z> }` and the renderer resamples or
|
|
278
|
+
* reprojects them into the requested tile. Below the ceiling, and for
|
|
279
|
+
* a source that declares no ceiling, the answer is the tile itself.
|
|
280
|
+
*
|
|
281
|
+
* This exists so the ceiling lives in one place. A host that hard-codes
|
|
282
|
+
* the maxzoom of each source keeps a second copy of something the style
|
|
283
|
+
* already states, and the two drift.
|
|
284
|
+
*
|
|
285
|
+
* Throws `UnknownSource` if `name` is not declared in the style.
|
|
286
|
+
*/
|
|
287
|
+
sourceTile(name: string, z: number, x: number, y: number): any;
|
|
252
288
|
/**
|
|
253
289
|
* Effective attribution declared by the style (document +
|
|
254
290
|
* sources), joined with ` | `. Upstream TileJSON / PMTiles
|
|
255
291
|
* metadata is the JS host's concern — merge it on that side.
|
|
256
292
|
*/
|
|
257
293
|
readonly attribution: string | undefined;
|
|
294
|
+
/**
|
|
295
|
+
* JSON Schema for the current style's `params` — types, defaults,
|
|
296
|
+
* ranges, descriptions. The same document the CLI's tile server
|
|
297
|
+
* serves at `/style/params`. Generate sliders and colour pickers
|
|
298
|
+
* from this rather than parsing the style; it follows `setStyle`,
|
|
299
|
+
* so a params panel driven off it cannot drift from the graph
|
|
300
|
+
* being rendered.
|
|
301
|
+
*/
|
|
302
|
+
readonly paramsSchema: any;
|
|
258
303
|
/**
|
|
259
304
|
* `tile-size` declared by the current style.
|
|
260
305
|
*/
|
package/bundler/ezu_bg.js
CHANGED
|
@@ -197,6 +197,24 @@ export class Renderer {
|
|
|
197
197
|
clearSources() {
|
|
198
198
|
wasm.renderer_clearSources(this.__wbg_ptr);
|
|
199
199
|
}
|
|
200
|
+
/**
|
|
201
|
+
* The style's declared `legend`, or `undefined` when it declares
|
|
202
|
+
* none. Pass a zoom to keep only the entries that apply there.
|
|
203
|
+
*
|
|
204
|
+
* Entries name the node that draws the symbol rather than restating
|
|
205
|
+
* a colour, so a host lays out the labels and asks the map itself
|
|
206
|
+
* for the swatches. The CLI's `ezu legend` renders those swatches;
|
|
207
|
+
* in a browser, render the named node.
|
|
208
|
+
* @param {number | null} [zoom]
|
|
209
|
+
* @returns {any}
|
|
210
|
+
*/
|
|
211
|
+
legend(zoom) {
|
|
212
|
+
const ret = wasm.renderer_legend(this.__wbg_ptr, isLikeNone(zoom) ? 0xFFFFFF : zoom);
|
|
213
|
+
if (ret[2]) {
|
|
214
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
215
|
+
}
|
|
216
|
+
return takeFromExternrefTable0(ret[0]);
|
|
217
|
+
}
|
|
200
218
|
/**
|
|
201
219
|
* What this renderer is holding, in bytes, so a host can shed load
|
|
202
220
|
* *before* an allocation fails rather than after.
|
|
@@ -311,6 +329,22 @@ export class Renderer {
|
|
|
311
329
|
RendererFinalization.register(this, this.__wbg_ptr, this);
|
|
312
330
|
return this;
|
|
313
331
|
}
|
|
332
|
+
/**
|
|
333
|
+
* JSON Schema for the current style's `params` — types, defaults,
|
|
334
|
+
* ranges, descriptions. The same document the CLI's tile server
|
|
335
|
+
* serves at `/style/params`. Generate sliders and colour pickers
|
|
336
|
+
* from this rather than parsing the style; it follows `setStyle`,
|
|
337
|
+
* so a params panel driven off it cannot drift from the graph
|
|
338
|
+
* being rendered.
|
|
339
|
+
* @returns {any}
|
|
340
|
+
*/
|
|
341
|
+
get paramsSchema() {
|
|
342
|
+
const ret = wasm.renderer_paramsSchema(this.__wbg_ptr);
|
|
343
|
+
if (ret[2]) {
|
|
344
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
345
|
+
}
|
|
346
|
+
return takeFromExternrefTable0(ret[0]);
|
|
347
|
+
}
|
|
314
348
|
/**
|
|
315
349
|
* Render a single tile using whatever sources are currently bound.
|
|
316
350
|
*
|
|
@@ -318,6 +352,10 @@ export class Renderer {
|
|
|
318
352
|
* - `format`: `"png"` (default) / `"webp"` / `"rgba"`
|
|
319
353
|
* - `tileSize`, `pad`: override the style's canvas size for this
|
|
320
354
|
* call (hi-DPI / preview)
|
|
355
|
+
* - `params`: `{ name: number | boolean | string }` — render-time
|
|
356
|
+
* overrides for the style's declared `params`, validated the same
|
|
357
|
+
* way the CLI's `--param` is. Omitted names keep their declared
|
|
358
|
+
* default.
|
|
321
359
|
* - `png`: `{ compression?: "fast" | "default" | "best" }`
|
|
322
360
|
* @param {number} z
|
|
323
361
|
* @param {number} x
|
|
@@ -347,6 +385,11 @@ export class Renderer {
|
|
|
347
385
|
* fetches exactly what the recipe needs. An empty array means the
|
|
348
386
|
* centre tile is enough.
|
|
349
387
|
*
|
|
388
|
+
* A `dem` or `raster` source that declares `neighbor-fetch: false`
|
|
389
|
+
* reports no offsets whatever the graph asks for: the style has said
|
|
390
|
+
* not to stitch a neighbourhood for it, and this list is what a host
|
|
391
|
+
* fetches from.
|
|
392
|
+
*
|
|
350
393
|
* Throws `UnknownSource` if `name` is not declared in the style.
|
|
351
394
|
* @param {string} name
|
|
352
395
|
* @returns {Array<any>}
|
|
@@ -403,6 +446,36 @@ export class Renderer {
|
|
|
403
446
|
}
|
|
404
447
|
return ret[0] >>> 0;
|
|
405
448
|
}
|
|
449
|
+
/**
|
|
450
|
+
* The tile a host should actually fetch from `name` in order to draw
|
|
451
|
+
* `z/x/y`, as `{ z, x, y }`.
|
|
452
|
+
*
|
|
453
|
+
* For a source that declares `max-zoom`, a request past the ceiling
|
|
454
|
+
* answers with the covering ancestor — bind those bytes with
|
|
455
|
+
* `{ sourceZoom: <returned z> }` and the renderer resamples or
|
|
456
|
+
* reprojects them into the requested tile. Below the ceiling, and for
|
|
457
|
+
* a source that declares no ceiling, the answer is the tile itself.
|
|
458
|
+
*
|
|
459
|
+
* This exists so the ceiling lives in one place. A host that hard-codes
|
|
460
|
+
* the maxzoom of each source keeps a second copy of something the style
|
|
461
|
+
* already states, and the two drift.
|
|
462
|
+
*
|
|
463
|
+
* Throws `UnknownSource` if `name` is not declared in the style.
|
|
464
|
+
* @param {string} name
|
|
465
|
+
* @param {number} z
|
|
466
|
+
* @param {number} x
|
|
467
|
+
* @param {number} y
|
|
468
|
+
* @returns {any}
|
|
469
|
+
*/
|
|
470
|
+
sourceTile(name, z, x, y) {
|
|
471
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
|
|
472
|
+
const len0 = WASM_VECTOR_LEN;
|
|
473
|
+
const ret = wasm.renderer_sourceTile(this.__wbg_ptr, ptr0, len0, z, x, y);
|
|
474
|
+
if (ret[2]) {
|
|
475
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
476
|
+
}
|
|
477
|
+
return takeFromExternrefTable0(ret[0]);
|
|
478
|
+
}
|
|
406
479
|
/**
|
|
407
480
|
* `tile-size` declared by the current style.
|
|
408
481
|
* @returns {number}
|
|
@@ -511,6 +584,10 @@ export function __wbg_get_78f252d074a84d0b() { return handleError(function (arg0
|
|
|
511
584
|
const ret = Reflect.get(arg0, arg1);
|
|
512
585
|
return ret;
|
|
513
586
|
}, arguments); }
|
|
587
|
+
export function __wbg_get_unchecked_6e0ad6d2a41b06f6(arg0, arg1) {
|
|
588
|
+
const ret = arg0[arg1 >>> 0];
|
|
589
|
+
return ret;
|
|
590
|
+
}
|
|
514
591
|
export function __wbg_instanceof_Object_33f20e6f12439f3e(arg0) {
|
|
515
592
|
let result;
|
|
516
593
|
try {
|
|
@@ -525,6 +602,10 @@ export function __wbg_isArray_0677c962b281d01a(arg0) {
|
|
|
525
602
|
const ret = Array.isArray(arg0);
|
|
526
603
|
return ret;
|
|
527
604
|
}
|
|
605
|
+
export function __wbg_keys_58421f8f96795607(arg0) {
|
|
606
|
+
const ret = Object.keys(arg0);
|
|
607
|
+
return ret;
|
|
608
|
+
}
|
|
528
609
|
export function __wbg_length_370319915dc99107(arg0) {
|
|
529
610
|
const ret = arg0.length;
|
|
530
611
|
return ret;
|
|
@@ -549,6 +630,10 @@ export function __wbg_now_86c0d4ba3fa605b8() {
|
|
|
549
630
|
const ret = Date.now();
|
|
550
631
|
return ret;
|
|
551
632
|
}
|
|
633
|
+
export function __wbg_parse_1c0d8a8656d7e016() { return handleError(function (arg0, arg1) {
|
|
634
|
+
const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
|
|
635
|
+
return ret;
|
|
636
|
+
}, arguments); }
|
|
552
637
|
export function __wbg_push_d2ae3af0c1217ae6(arg0, arg1) {
|
|
553
638
|
const ret = arg0.push(arg1);
|
|
554
639
|
return ret;
|
package/bundler/ezu_bg.wasm
CHANGED
|
Binary file
|
package/bundler/ezu_bg.wasm.d.ts
CHANGED
|
@@ -16,14 +16,17 @@ export const renderer_attribution: (a: number) => [number, number];
|
|
|
16
16
|
export const renderer_bindSource: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
|
|
17
17
|
export const renderer_boundSources: (a: number) => [number, number];
|
|
18
18
|
export const renderer_clearSources: (a: number) => void;
|
|
19
|
+
export const renderer_legend: (a: number, b: number) => [number, number, number];
|
|
19
20
|
export const renderer_memoryUsage: (a: number) => [number, number, number];
|
|
20
21
|
export const renderer_neededCodepoints: (a: number) => [number, number, number];
|
|
21
22
|
export const renderer_neededGlyphRanges: (a: number) => [number, number, number];
|
|
22
23
|
export const renderer_new: (a: number, b: number) => [number, number, number];
|
|
24
|
+
export const renderer_paramsSchema: (a: number) => [number, number, number];
|
|
23
25
|
export const renderer_renderTile: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
|
|
24
26
|
export const renderer_requestedNeighborOffsets: (a: number, b: number, c: number) => [number, number, number];
|
|
25
27
|
export const renderer_setGlyphBudget: (a: number, b: number) => void;
|
|
26
28
|
export const renderer_setStyle: (a: number, b: number, c: number) => [number, number, number];
|
|
29
|
+
export const renderer_sourceTile: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
|
|
27
30
|
export const renderer_tileSize: (a: number) => number;
|
|
28
31
|
export const simdEnabled: () => number;
|
|
29
32
|
export const threadsEnabled: () => number;
|
package/nodejs/ezu.d.ts
CHANGED
|
@@ -111,6 +111,16 @@ export class Renderer {
|
|
|
111
111
|
* Drop every pending source binding. Call between tile renders.
|
|
112
112
|
*/
|
|
113
113
|
clearSources(): void;
|
|
114
|
+
/**
|
|
115
|
+
* The style's declared `legend`, or `undefined` when it declares
|
|
116
|
+
* none. Pass a zoom to keep only the entries that apply there.
|
|
117
|
+
*
|
|
118
|
+
* Entries name the node that draws the symbol rather than restating
|
|
119
|
+
* a colour, so a host lays out the labels and asks the map itself
|
|
120
|
+
* for the swatches. The CLI's `ezu legend` renders those swatches;
|
|
121
|
+
* in a browser, render the named node.
|
|
122
|
+
*/
|
|
123
|
+
legend(zoom?: number | null): any;
|
|
114
124
|
/**
|
|
115
125
|
* What this renderer is holding, in bytes, so a host can shed load
|
|
116
126
|
* *before* an allocation fails rather than after.
|
|
@@ -200,6 +210,10 @@ export class Renderer {
|
|
|
200
210
|
* - `format`: `"png"` (default) / `"webp"` / `"rgba"`
|
|
201
211
|
* - `tileSize`, `pad`: override the style's canvas size for this
|
|
202
212
|
* call (hi-DPI / preview)
|
|
213
|
+
* - `params`: `{ name: number | boolean | string }` — render-time
|
|
214
|
+
* overrides for the style's declared `params`, validated the same
|
|
215
|
+
* way the CLI's `--param` is. Omitted names keep their declared
|
|
216
|
+
* default.
|
|
203
217
|
* - `png`: `{ compression?: "fast" | "default" | "best" }`
|
|
204
218
|
*/
|
|
205
219
|
renderTile(z: number, x: number, y: number, opts?: object | null): Uint8Array;
|
|
@@ -216,6 +230,11 @@ export class Renderer {
|
|
|
216
230
|
* fetches exactly what the recipe needs. An empty array means the
|
|
217
231
|
* centre tile is enough.
|
|
218
232
|
*
|
|
233
|
+
* A `dem` or `raster` source that declares `neighbor-fetch: false`
|
|
234
|
+
* reports no offsets whatever the graph asks for: the style has said
|
|
235
|
+
* not to stitch a neighbourhood for it, and this list is what a host
|
|
236
|
+
* fetches from.
|
|
237
|
+
*
|
|
219
238
|
* Throws `UnknownSource` if `name` is not declared in the style.
|
|
220
239
|
*/
|
|
221
240
|
requestedNeighborOffsets(name: string): Array<any>;
|
|
@@ -249,12 +268,38 @@ export class Renderer {
|
|
|
249
268
|
* the intermediate cache and drops any pending source bindings.
|
|
250
269
|
*/
|
|
251
270
|
setStyle(style_json: string): number;
|
|
271
|
+
/**
|
|
272
|
+
* The tile a host should actually fetch from `name` in order to draw
|
|
273
|
+
* `z/x/y`, as `{ z, x, y }`.
|
|
274
|
+
*
|
|
275
|
+
* For a source that declares `max-zoom`, a request past the ceiling
|
|
276
|
+
* answers with the covering ancestor — bind those bytes with
|
|
277
|
+
* `{ sourceZoom: <returned z> }` and the renderer resamples or
|
|
278
|
+
* reprojects them into the requested tile. Below the ceiling, and for
|
|
279
|
+
* a source that declares no ceiling, the answer is the tile itself.
|
|
280
|
+
*
|
|
281
|
+
* This exists so the ceiling lives in one place. A host that hard-codes
|
|
282
|
+
* the maxzoom of each source keeps a second copy of something the style
|
|
283
|
+
* already states, and the two drift.
|
|
284
|
+
*
|
|
285
|
+
* Throws `UnknownSource` if `name` is not declared in the style.
|
|
286
|
+
*/
|
|
287
|
+
sourceTile(name: string, z: number, x: number, y: number): any;
|
|
252
288
|
/**
|
|
253
289
|
* Effective attribution declared by the style (document +
|
|
254
290
|
* sources), joined with ` | `. Upstream TileJSON / PMTiles
|
|
255
291
|
* metadata is the JS host's concern — merge it on that side.
|
|
256
292
|
*/
|
|
257
293
|
readonly attribution: string | undefined;
|
|
294
|
+
/**
|
|
295
|
+
* JSON Schema for the current style's `params` — types, defaults,
|
|
296
|
+
* ranges, descriptions. The same document the CLI's tile server
|
|
297
|
+
* serves at `/style/params`. Generate sliders and colour pickers
|
|
298
|
+
* from this rather than parsing the style; it follows `setStyle`,
|
|
299
|
+
* so a params panel driven off it cannot drift from the graph
|
|
300
|
+
* being rendered.
|
|
301
|
+
*/
|
|
302
|
+
readonly paramsSchema: any;
|
|
258
303
|
/**
|
|
259
304
|
* `tile-size` declared by the current style.
|
|
260
305
|
*/
|
package/nodejs/ezu.js
CHANGED
|
@@ -200,6 +200,24 @@ class Renderer {
|
|
|
200
200
|
clearSources() {
|
|
201
201
|
wasm.renderer_clearSources(this.__wbg_ptr);
|
|
202
202
|
}
|
|
203
|
+
/**
|
|
204
|
+
* The style's declared `legend`, or `undefined` when it declares
|
|
205
|
+
* none. Pass a zoom to keep only the entries that apply there.
|
|
206
|
+
*
|
|
207
|
+
* Entries name the node that draws the symbol rather than restating
|
|
208
|
+
* a colour, so a host lays out the labels and asks the map itself
|
|
209
|
+
* for the swatches. The CLI's `ezu legend` renders those swatches;
|
|
210
|
+
* in a browser, render the named node.
|
|
211
|
+
* @param {number | null} [zoom]
|
|
212
|
+
* @returns {any}
|
|
213
|
+
*/
|
|
214
|
+
legend(zoom) {
|
|
215
|
+
const ret = wasm.renderer_legend(this.__wbg_ptr, isLikeNone(zoom) ? 0xFFFFFF : zoom);
|
|
216
|
+
if (ret[2]) {
|
|
217
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
218
|
+
}
|
|
219
|
+
return takeFromExternrefTable0(ret[0]);
|
|
220
|
+
}
|
|
203
221
|
/**
|
|
204
222
|
* What this renderer is holding, in bytes, so a host can shed load
|
|
205
223
|
* *before* an allocation fails rather than after.
|
|
@@ -314,6 +332,22 @@ class Renderer {
|
|
|
314
332
|
RendererFinalization.register(this, this.__wbg_ptr, this);
|
|
315
333
|
return this;
|
|
316
334
|
}
|
|
335
|
+
/**
|
|
336
|
+
* JSON Schema for the current style's `params` — types, defaults,
|
|
337
|
+
* ranges, descriptions. The same document the CLI's tile server
|
|
338
|
+
* serves at `/style/params`. Generate sliders and colour pickers
|
|
339
|
+
* from this rather than parsing the style; it follows `setStyle`,
|
|
340
|
+
* so a params panel driven off it cannot drift from the graph
|
|
341
|
+
* being rendered.
|
|
342
|
+
* @returns {any}
|
|
343
|
+
*/
|
|
344
|
+
get paramsSchema() {
|
|
345
|
+
const ret = wasm.renderer_paramsSchema(this.__wbg_ptr);
|
|
346
|
+
if (ret[2]) {
|
|
347
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
348
|
+
}
|
|
349
|
+
return takeFromExternrefTable0(ret[0]);
|
|
350
|
+
}
|
|
317
351
|
/**
|
|
318
352
|
* Render a single tile using whatever sources are currently bound.
|
|
319
353
|
*
|
|
@@ -321,6 +355,10 @@ class Renderer {
|
|
|
321
355
|
* - `format`: `"png"` (default) / `"webp"` / `"rgba"`
|
|
322
356
|
* - `tileSize`, `pad`: override the style's canvas size for this
|
|
323
357
|
* call (hi-DPI / preview)
|
|
358
|
+
* - `params`: `{ name: number | boolean | string }` — render-time
|
|
359
|
+
* overrides for the style's declared `params`, validated the same
|
|
360
|
+
* way the CLI's `--param` is. Omitted names keep their declared
|
|
361
|
+
* default.
|
|
324
362
|
* - `png`: `{ compression?: "fast" | "default" | "best" }`
|
|
325
363
|
* @param {number} z
|
|
326
364
|
* @param {number} x
|
|
@@ -350,6 +388,11 @@ class Renderer {
|
|
|
350
388
|
* fetches exactly what the recipe needs. An empty array means the
|
|
351
389
|
* centre tile is enough.
|
|
352
390
|
*
|
|
391
|
+
* A `dem` or `raster` source that declares `neighbor-fetch: false`
|
|
392
|
+
* reports no offsets whatever the graph asks for: the style has said
|
|
393
|
+
* not to stitch a neighbourhood for it, and this list is what a host
|
|
394
|
+
* fetches from.
|
|
395
|
+
*
|
|
353
396
|
* Throws `UnknownSource` if `name` is not declared in the style.
|
|
354
397
|
* @param {string} name
|
|
355
398
|
* @returns {Array<any>}
|
|
@@ -406,6 +449,36 @@ class Renderer {
|
|
|
406
449
|
}
|
|
407
450
|
return ret[0] >>> 0;
|
|
408
451
|
}
|
|
452
|
+
/**
|
|
453
|
+
* The tile a host should actually fetch from `name` in order to draw
|
|
454
|
+
* `z/x/y`, as `{ z, x, y }`.
|
|
455
|
+
*
|
|
456
|
+
* For a source that declares `max-zoom`, a request past the ceiling
|
|
457
|
+
* answers with the covering ancestor — bind those bytes with
|
|
458
|
+
* `{ sourceZoom: <returned z> }` and the renderer resamples or
|
|
459
|
+
* reprojects them into the requested tile. Below the ceiling, and for
|
|
460
|
+
* a source that declares no ceiling, the answer is the tile itself.
|
|
461
|
+
*
|
|
462
|
+
* This exists so the ceiling lives in one place. A host that hard-codes
|
|
463
|
+
* the maxzoom of each source keeps a second copy of something the style
|
|
464
|
+
* already states, and the two drift.
|
|
465
|
+
*
|
|
466
|
+
* Throws `UnknownSource` if `name` is not declared in the style.
|
|
467
|
+
* @param {string} name
|
|
468
|
+
* @param {number} z
|
|
469
|
+
* @param {number} x
|
|
470
|
+
* @param {number} y
|
|
471
|
+
* @returns {any}
|
|
472
|
+
*/
|
|
473
|
+
sourceTile(name, z, x, y) {
|
|
474
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
|
|
475
|
+
const len0 = WASM_VECTOR_LEN;
|
|
476
|
+
const ret = wasm.renderer_sourceTile(this.__wbg_ptr, ptr0, len0, z, x, y);
|
|
477
|
+
if (ret[2]) {
|
|
478
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
479
|
+
}
|
|
480
|
+
return takeFromExternrefTable0(ret[0]);
|
|
481
|
+
}
|
|
409
482
|
/**
|
|
410
483
|
* `tile-size` declared by the current style.
|
|
411
484
|
* @returns {number}
|
|
@@ -521,6 +594,10 @@ function __wbg_get_imports() {
|
|
|
521
594
|
const ret = Reflect.get(arg0, arg1);
|
|
522
595
|
return ret;
|
|
523
596
|
}, arguments); },
|
|
597
|
+
__wbg_get_unchecked_6e0ad6d2a41b06f6: function(arg0, arg1) {
|
|
598
|
+
const ret = arg0[arg1 >>> 0];
|
|
599
|
+
return ret;
|
|
600
|
+
},
|
|
524
601
|
__wbg_instanceof_Object_33f20e6f12439f3e: function(arg0) {
|
|
525
602
|
let result;
|
|
526
603
|
try {
|
|
@@ -535,6 +612,10 @@ function __wbg_get_imports() {
|
|
|
535
612
|
const ret = Array.isArray(arg0);
|
|
536
613
|
return ret;
|
|
537
614
|
},
|
|
615
|
+
__wbg_keys_58421f8f96795607: function(arg0) {
|
|
616
|
+
const ret = Object.keys(arg0);
|
|
617
|
+
return ret;
|
|
618
|
+
},
|
|
538
619
|
__wbg_length_370319915dc99107: function(arg0) {
|
|
539
620
|
const ret = arg0.length;
|
|
540
621
|
return ret;
|
|
@@ -559,6 +640,10 @@ function __wbg_get_imports() {
|
|
|
559
640
|
const ret = Date.now();
|
|
560
641
|
return ret;
|
|
561
642
|
},
|
|
643
|
+
__wbg_parse_1c0d8a8656d7e016: function() { return handleError(function (arg0, arg1) {
|
|
644
|
+
const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
|
|
645
|
+
return ret;
|
|
646
|
+
}, arguments); },
|
|
562
647
|
__wbg_push_d2ae3af0c1217ae6: function(arg0, arg1) {
|
|
563
648
|
const ret = arg0.push(arg1);
|
|
564
649
|
return ret;
|
package/nodejs/ezu_bg.wasm
CHANGED
|
Binary file
|
package/nodejs/ezu_bg.wasm.d.ts
CHANGED
|
@@ -16,14 +16,17 @@ export const renderer_attribution: (a: number) => [number, number];
|
|
|
16
16
|
export const renderer_bindSource: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
|
|
17
17
|
export const renderer_boundSources: (a: number) => [number, number];
|
|
18
18
|
export const renderer_clearSources: (a: number) => void;
|
|
19
|
+
export const renderer_legend: (a: number, b: number) => [number, number, number];
|
|
19
20
|
export const renderer_memoryUsage: (a: number) => [number, number, number];
|
|
20
21
|
export const renderer_neededCodepoints: (a: number) => [number, number, number];
|
|
21
22
|
export const renderer_neededGlyphRanges: (a: number) => [number, number, number];
|
|
22
23
|
export const renderer_new: (a: number, b: number) => [number, number, number];
|
|
24
|
+
export const renderer_paramsSchema: (a: number) => [number, number, number];
|
|
23
25
|
export const renderer_renderTile: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
|
|
24
26
|
export const renderer_requestedNeighborOffsets: (a: number, b: number, c: number) => [number, number, number];
|
|
25
27
|
export const renderer_setGlyphBudget: (a: number, b: number) => void;
|
|
26
28
|
export const renderer_setStyle: (a: number, b: number, c: number) => [number, number, number];
|
|
29
|
+
export const renderer_sourceTile: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
|
|
27
30
|
export const renderer_tileSize: (a: number) => number;
|
|
28
31
|
export const simdEnabled: () => number;
|
|
29
32
|
export const threadsEnabled: () => number;
|
package/package.json
CHANGED
package/simd/bundler/ezu.d.ts
CHANGED
|
@@ -111,6 +111,16 @@ export class Renderer {
|
|
|
111
111
|
* Drop every pending source binding. Call between tile renders.
|
|
112
112
|
*/
|
|
113
113
|
clearSources(): void;
|
|
114
|
+
/**
|
|
115
|
+
* The style's declared `legend`, or `undefined` when it declares
|
|
116
|
+
* none. Pass a zoom to keep only the entries that apply there.
|
|
117
|
+
*
|
|
118
|
+
* Entries name the node that draws the symbol rather than restating
|
|
119
|
+
* a colour, so a host lays out the labels and asks the map itself
|
|
120
|
+
* for the swatches. The CLI's `ezu legend` renders those swatches;
|
|
121
|
+
* in a browser, render the named node.
|
|
122
|
+
*/
|
|
123
|
+
legend(zoom?: number | null): any;
|
|
114
124
|
/**
|
|
115
125
|
* What this renderer is holding, in bytes, so a host can shed load
|
|
116
126
|
* *before* an allocation fails rather than after.
|
|
@@ -200,6 +210,10 @@ export class Renderer {
|
|
|
200
210
|
* - `format`: `"png"` (default) / `"webp"` / `"rgba"`
|
|
201
211
|
* - `tileSize`, `pad`: override the style's canvas size for this
|
|
202
212
|
* call (hi-DPI / preview)
|
|
213
|
+
* - `params`: `{ name: number | boolean | string }` — render-time
|
|
214
|
+
* overrides for the style's declared `params`, validated the same
|
|
215
|
+
* way the CLI's `--param` is. Omitted names keep their declared
|
|
216
|
+
* default.
|
|
203
217
|
* - `png`: `{ compression?: "fast" | "default" | "best" }`
|
|
204
218
|
*/
|
|
205
219
|
renderTile(z: number, x: number, y: number, opts?: object | null): Uint8Array;
|
|
@@ -216,6 +230,11 @@ export class Renderer {
|
|
|
216
230
|
* fetches exactly what the recipe needs. An empty array means the
|
|
217
231
|
* centre tile is enough.
|
|
218
232
|
*
|
|
233
|
+
* A `dem` or `raster` source that declares `neighbor-fetch: false`
|
|
234
|
+
* reports no offsets whatever the graph asks for: the style has said
|
|
235
|
+
* not to stitch a neighbourhood for it, and this list is what a host
|
|
236
|
+
* fetches from.
|
|
237
|
+
*
|
|
219
238
|
* Throws `UnknownSource` if `name` is not declared in the style.
|
|
220
239
|
*/
|
|
221
240
|
requestedNeighborOffsets(name: string): Array<any>;
|
|
@@ -249,12 +268,38 @@ export class Renderer {
|
|
|
249
268
|
* the intermediate cache and drops any pending source bindings.
|
|
250
269
|
*/
|
|
251
270
|
setStyle(style_json: string): number;
|
|
271
|
+
/**
|
|
272
|
+
* The tile a host should actually fetch from `name` in order to draw
|
|
273
|
+
* `z/x/y`, as `{ z, x, y }`.
|
|
274
|
+
*
|
|
275
|
+
* For a source that declares `max-zoom`, a request past the ceiling
|
|
276
|
+
* answers with the covering ancestor — bind those bytes with
|
|
277
|
+
* `{ sourceZoom: <returned z> }` and the renderer resamples or
|
|
278
|
+
* reprojects them into the requested tile. Below the ceiling, and for
|
|
279
|
+
* a source that declares no ceiling, the answer is the tile itself.
|
|
280
|
+
*
|
|
281
|
+
* This exists so the ceiling lives in one place. A host that hard-codes
|
|
282
|
+
* the maxzoom of each source keeps a second copy of something the style
|
|
283
|
+
* already states, and the two drift.
|
|
284
|
+
*
|
|
285
|
+
* Throws `UnknownSource` if `name` is not declared in the style.
|
|
286
|
+
*/
|
|
287
|
+
sourceTile(name: string, z: number, x: number, y: number): any;
|
|
252
288
|
/**
|
|
253
289
|
* Effective attribution declared by the style (document +
|
|
254
290
|
* sources), joined with ` | `. Upstream TileJSON / PMTiles
|
|
255
291
|
* metadata is the JS host's concern — merge it on that side.
|
|
256
292
|
*/
|
|
257
293
|
readonly attribution: string | undefined;
|
|
294
|
+
/**
|
|
295
|
+
* JSON Schema for the current style's `params` — types, defaults,
|
|
296
|
+
* ranges, descriptions. The same document the CLI's tile server
|
|
297
|
+
* serves at `/style/params`. Generate sliders and colour pickers
|
|
298
|
+
* from this rather than parsing the style; it follows `setStyle`,
|
|
299
|
+
* so a params panel driven off it cannot drift from the graph
|
|
300
|
+
* being rendered.
|
|
301
|
+
*/
|
|
302
|
+
readonly paramsSchema: any;
|
|
258
303
|
/**
|
|
259
304
|
* `tile-size` declared by the current style.
|
|
260
305
|
*/
|