isard 1.4.0 → 1.6.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.
Files changed (135) hide show
  1. package/CHANGELOG.md +220 -2
  2. package/README.md +23 -7
  3. package/dist/basemap/furniture.d.ts +8 -0
  4. package/dist/basemap/furniture.js +26 -0
  5. package/dist/basemap/furniture.js.map +1 -0
  6. package/dist/basemap/trees.d.ts +35 -8
  7. package/dist/basemap/trees.js +105 -52
  8. package/dist/basemap/trees.js.map +1 -1
  9. package/dist/basemap/vectorstyle.d.ts +9 -3
  10. package/dist/basemap/vectorstyle.js +5 -6
  11. package/dist/basemap/vectorstyle.js.map +1 -1
  12. package/dist/basemap/vectortiles/context.d.ts +46 -0
  13. package/dist/basemap/vectortiles/context.js +6 -0
  14. package/dist/basemap/vectortiles/context.js.map +1 -0
  15. package/dist/basemap/vectortiles/extrusions.d.ts +15 -0
  16. package/dist/basemap/vectortiles/extrusions.js +61 -0
  17. package/dist/basemap/vectortiles/extrusions.js.map +1 -0
  18. package/dist/basemap/vectortiles/labels.d.ts +25 -0
  19. package/dist/basemap/vectortiles/labels.js +250 -0
  20. package/dist/basemap/vectortiles/labels.js.map +1 -0
  21. package/dist/basemap/vectortiles/lamps.d.ts +23 -0
  22. package/dist/basemap/vectortiles/lamps.js +90 -0
  23. package/dist/basemap/vectortiles/lamps.js.map +1 -0
  24. package/dist/basemap/vectortiles/requests.d.ts +28 -0
  25. package/dist/basemap/vectortiles/requests.js +74 -0
  26. package/dist/basemap/vectortiles/requests.js.map +1 -0
  27. package/dist/basemap/vectortiles/street-wind.d.ts +19 -0
  28. package/dist/basemap/vectortiles/street-wind.js +133 -0
  29. package/dist/basemap/vectortiles/street-wind.js.map +1 -0
  30. package/dist/basemap/vectortiles/style.d.ts +47 -0
  31. package/dist/basemap/vectortiles/style.js +141 -0
  32. package/dist/basemap/vectortiles/style.js.map +1 -0
  33. package/dist/basemap/vectortiles/tiles.d.ts +34 -0
  34. package/dist/basemap/vectortiles/tiles.js +62 -0
  35. package/dist/basemap/vectortiles/tiles.js.map +1 -0
  36. package/dist/basemap/vectortiles/trees.d.ts +28 -0
  37. package/dist/basemap/vectortiles/trees.js +178 -0
  38. package/dist/basemap/vectortiles/trees.js.map +1 -0
  39. package/dist/basemap/vectortiles/vectors.d.ts +37 -0
  40. package/dist/basemap/vectortiles/vectors.js +231 -0
  41. package/dist/basemap/vectortiles/vectors.js.map +1 -0
  42. package/dist/basemap/vectortiles.d.ts +49 -96
  43. package/dist/basemap/vectortiles.js +99 -774
  44. package/dist/basemap/vectortiles.js.map +1 -1
  45. package/dist/basemap/workerpool.js +25 -6
  46. package/dist/basemap/workerpool.js.map +1 -1
  47. package/dist/basemap.worker.js +2 -2
  48. package/dist/basemap.worker.js.map +14 -12
  49. package/dist/bind/layers.js +1 -0
  50. package/dist/bind/layers.js.map +1 -1
  51. package/dist/data/collada.d.ts +19 -0
  52. package/dist/data/collada.js +319 -0
  53. package/dist/data/collada.js.map +1 -0
  54. package/dist/data/ifc.d.ts +100 -0
  55. package/dist/data/ifc.js +372 -0
  56. package/dist/data/ifc.js.map +1 -0
  57. package/dist/decoder.worker.js +5 -4
  58. package/dist/decoder.worker.js.map +8 -6
  59. package/dist/engine/decoders.d.ts +4 -8
  60. package/dist/engine/decoders.js +29 -2
  61. package/dist/engine/decoders.js.map +1 -1
  62. package/dist/formats.d.ts +7 -2
  63. package/dist/formats.js +7 -2
  64. package/dist/formats.js.map +1 -1
  65. package/dist/index.d.ts +15 -2
  66. package/dist/index.js +7 -2
  67. package/dist/index.js.map +1 -1
  68. package/dist/isard_bg.wasm +0 -0
  69. package/dist/isard_core_bg.wasm +0 -0
  70. package/dist/isard_grid_bg.wasm +0 -0
  71. package/dist/isard_tess_bg.wasm +0 -0
  72. package/dist/layers/extrusions.d.ts +10 -0
  73. package/dist/layers/extrusions.js +28 -2
  74. package/dist/layers/extrusions.js.map +1 -1
  75. package/dist/layers/flow.d.ts +9 -2
  76. package/dist/layers/flow.js +51 -10
  77. package/dist/layers/flow.js.map +1 -1
  78. package/dist/layers/layers.d.ts +12 -0
  79. package/dist/layers/layers.js +44 -1
  80. package/dist/layers/layers.js.map +1 -1
  81. package/dist/layers/panoramas.d.ts +2 -0
  82. package/dist/layers/panoramas.js +27 -6
  83. package/dist/layers/panoramas.js.map +1 -1
  84. package/dist/layers/photos.d.ts +48 -0
  85. package/dist/layers/photos.js +140 -0
  86. package/dist/layers/photos.js.map +1 -0
  87. package/dist/layers/symbols.d.ts +5 -1
  88. package/dist/layers/symbols.js +111 -32
  89. package/dist/layers/symbols.js.map +1 -1
  90. package/dist/layers/trees.d.ts +28 -0
  91. package/dist/layers/trees.js +51 -0
  92. package/dist/layers/trees.js.map +1 -0
  93. package/dist/layers/vectors.d.ts +28 -2
  94. package/dist/layers/vectors.js +81 -7
  95. package/dist/layers/vectors.js.map +1 -1
  96. package/dist/map/layer-spec.d.ts +3 -0
  97. package/dist/map/layer-spec.js +2 -0
  98. package/dist/map/layer-spec.js.map +1 -1
  99. package/dist/map/workers.js +3 -0
  100. package/dist/map/workers.js.map +1 -1
  101. package/dist/map.d.ts +8 -0
  102. package/dist/map.js +15 -2
  103. package/dist/map.js.map +1 -1
  104. package/dist/panoramax.d.ts +49 -0
  105. package/dist/panoramax.js +71 -0
  106. package/dist/panoramax.js.map +1 -0
  107. package/dist/react/Layer.d.ts +1 -0
  108. package/dist/react/Layer.js.map +1 -1
  109. package/dist/react/VectorGeometry.d.ts +5 -0
  110. package/dist/react/VectorGeometry.js +12 -4
  111. package/dist/react/VectorGeometry.js.map +1 -1
  112. package/dist/util/gltf.d.ts +9 -0
  113. package/dist/util/gltf.js +27 -0
  114. package/dist/util/gltf.js.map +1 -0
  115. package/dist/util/read.d.ts +4 -0
  116. package/dist/util/read.js +28 -0
  117. package/dist/util/read.js.map +1 -0
  118. package/dist/util/roofs.d.ts +10 -0
  119. package/dist/util/roofs.js +30 -0
  120. package/dist/util/roofs.js.map +1 -0
  121. package/dist/wasm/isard.d.ts +74 -22
  122. package/dist/wasm/isard.js +153 -22
  123. package/dist/wasm/isard_core.d.ts +62 -22
  124. package/dist/wasm/isard_core.js +129 -22
  125. package/dist/wasm/isard_tess.d.ts +6 -3
  126. package/dist/wasm/isard_tess.js +27 -4
  127. package/dist/workers/basemap/geometry.d.ts +38 -22
  128. package/dist/workers/basemap/labels.d.ts +14 -1
  129. package/dist/workers/basemap/lamps.d.ts +10 -0
  130. package/dist/workers/basemap/street.d.ts +1 -1
  131. package/dist/workers/basemap/trees.d.ts +3 -1
  132. package/dist/workers/basemap.worker.d.ts +43 -3
  133. package/dist/workers/basemap.worker.js +14 -2
  134. package/dist/workers/basemap.worker.js.map +1 -1
  135. package/package.json +1 -1
@@ -7,38 +7,24 @@
7
7
  *
8
8
  * Any subset of the style can be drawn on its own raster layer (`raster({ layers })`), at its own place in the stack:
9
9
  * rivers from the basemap's data over a flood layer, for instance, restyled with `extraLayers`.
10
+ *
11
+ * The layers other than the raster ones are made in `vectortiles/` (one module each), from what they use of the
12
+ * instance (`VectorTilesContext`); the style's loading is in `vectortiles/style.ts`.
10
13
  */
11
- import type { ExtrusionLayer, ExtrusionOptions } from '../layers/extrusions.ts';
12
- import type { Feature, Size } from '../layers/features.ts';
13
- import type { FlowLayer, FlowOptions } from '../layers/flow.ts';
14
- import type { Layer, ModelLayer, RasterLayer } from '../layers/layers.ts';
14
+ import type { ExtrusionLayer } from '../layers/extrusions.ts';
15
+ import type { ModelLayer, RasterLayer } from '../layers/layers.ts';
15
16
  import type { SymbolLayer } from '../layers/symbols.ts';
16
17
  import type { VectorLayer } from '../layers/vectors.ts';
17
18
  import type { GeoMap } from '../map.ts';
18
- import { type TreeColors } from './trees.ts';
19
- import { type Json, type LabelCandidate, type RasterSource, type Style, type StyleLayer } from './vectorstyle.ts';
20
- /** OpenFreeMap's styles: OpenStreetMap data in the OpenMapTiles schema, worldwide, free and without a key */
21
- export declare const OPENFREEMAP_STYLES: {
22
- readonly positron: "https://tiles.openfreemap.org/styles/positron";
23
- readonly liberty: "https://tiles.openfreemap.org/styles/liberty";
24
- readonly bright: "https://tiles.openfreemap.org/styles/bright";
25
- readonly dark: "https://tiles.openfreemap.org/styles/dark";
26
- readonly fiord: "https://tiles.openfreemap.org/styles/fiord";
27
- };
28
- /** PLAN.IGN vector styles of the Géoplateforme (France) */
29
- export declare const PLAN_STYLES: {
30
- readonly standard: "https://data.geopf.fr/annexes/ressources/vectorTiles/styles/PLAN.IGN/standard.json";
31
- readonly grey: "https://data.geopf.fr/annexes/ressources/vectorTiles/styles/PLAN.IGN/gris.json";
32
- };
33
- /** Vector basemaps by name (see `BasemapName`) */
34
- export declare const VECTOR_BASEMAPS: {
35
- readonly 'osm-positron': "https://tiles.openfreemap.org/styles/positron";
36
- readonly 'osm-liberty': "https://tiles.openfreemap.org/styles/liberty";
37
- readonly 'osm-bright': "https://tiles.openfreemap.org/styles/bright";
38
- readonly 'osm-dark': "https://tiles.openfreemap.org/styles/dark";
39
- readonly 'ign-plan-vector': "https://data.geopf.fr/annexes/ressources/vectorTiles/styles/PLAN.IGN/standard.json";
40
- readonly 'ign-plan-grey-vector': "https://data.geopf.fr/annexes/ressources/vectorTiles/styles/PLAN.IGN/gris.json";
41
- };
19
+ import type { LabelCandidate, Style, StyleLayer } from './vectorstyle.ts';
20
+ import { type VectorExtrusionOptions } from './vectortiles/extrusions.ts';
21
+ import { type LabelsOptions, size, tileLabels } from './vectortiles/labels.ts';
22
+ import { type LampsOptions } from './vectortiles/lamps.ts';
23
+ import { type StreetWindLayer, type StreetWindOptions } from './vectortiles/street-wind.ts';
24
+ import { type LoadedStyle, OPENFREEMAP_STYLES, PLAN_STYLES, styleAttribution, VECTOR_BASEMAPS } from './vectortiles/style.ts';
25
+ import { type TreesOptions } from './vectortiles/trees.ts';
26
+ import { dashes, type VectorsOptions } from './vectortiles/vectors.ts';
27
+ export { dashes, OPENFREEMAP_STYLES, PLAN_STYLES, size, styleAttribution, tileLabels, VECTOR_BASEMAPS };
42
28
  export interface VectorTilesOptions {
43
29
  /** A style URL or object (default OpenFreeMap's Positron) */
44
30
  style?: string | Style;
@@ -52,15 +38,6 @@ export interface VectorTilesOptions {
52
38
  * IGN's for PLAN.IGN's) */
53
39
  attribution?: string;
54
40
  }
55
- /** The credits of a known style: OpenFreeMap's, PLAN.IGN's */
56
- export declare const styleAttribution: (style: string | Style) => string | undefined;
57
- /** Text or icon size of a style (a number, legacy stops, or the stops of a zoom expression made by the worker) as a
58
- * size for the symbol layer */
59
- export declare const size: (value: Json, fallback?: number) => Size;
60
- /** The labels of a vector tile: features by style layer (its index in the style), the higher layers first */
61
- type TileLabels = [layer: number, features: Feature<LabelCandidate>[]][];
62
- /** A tile's label candidates as features, by style layer */
63
- export declare const tileLabels: (candidates: readonly LabelCandidate[]) => TileLabels;
64
41
  export declare class VectorTiles {
65
42
  private readonly map;
66
43
  private readonly pool;
@@ -79,28 +56,30 @@ export declare class VectorTiles {
79
56
  private readonly layers;
80
57
  /** Its first raster layer: the ground its labels follow */
81
58
  private ground;
59
+ /** What its layers made in `vectortiles/` use of it */
60
+ private readonly context;
82
61
  /** The style once loaded, with its source resolved */
83
- readonly ready: Promise<{
84
- style: Style;
85
- tiles: string;
86
- maxzoom: number;
87
- rasters: Record<string, RasterSource>;
88
- }>;
62
+ readonly ready: Promise<LoadedStyle>;
89
63
  /**
90
64
  * Its workers are the map's (shared by every `VectorTiles` of the map, a vector tile decoded once for all of them),
91
65
  * unless `workers` or `workerUrl` asks for others than the map's: then it has workers of its own
92
66
  */
93
67
  constructor(map: GeoMap, options?: VectorTilesOptions);
94
- private load;
95
- /** The fonts of the style's labels, for its glyphs (the first of each `text-font`, as the workers take it) */
96
- private static fonts;
97
68
  /** The style's sprites (their JSON and their images), loaded once, for the fill patterns and the icons */
98
69
  private sprites;
70
+ /** The style's sprites, kept once all of them came: one that failed is asked for again by the next layer */
99
71
  private loadSprites;
72
+ /** The style's sprites added to the map's icons, once */
73
+ private spritesAdded;
74
+ /** The style's sprites among the map's icons (under `iconPrefix`), added once: the labels' icons, the fills'
75
+ * patterns */
76
+ private addSprites;
100
77
  /** Prefix of the names of its sprites' images among the map's icons */
101
78
  private get iconPrefix();
102
79
  private request;
103
- /** Sends a renderer of these layers to every worker (again under `again`, restyled); returns its key */
80
+ /** Sends a renderer of these layers to every worker (again under `again`, restyled), with the style's sprites if it
81
+ * `draws` the tiles into images with patterns (the raster path: the others take their images in the page); returns
82
+ * its key */
104
83
  private renderer;
105
84
  /**
106
85
  * A raster layer drawing the style's fills, lines and circles (or those `layers` keeps, then `extraLayers`, of the
@@ -122,11 +101,7 @@ export declare class VectorTiles {
122
101
  * the source's deepest level, the `maxTiles` nearest to the center, from `minZoom` on (15 by default); the tiles
123
102
  * leaving the view are dropped.
124
103
  */
125
- extrusions<P = Record<string, unknown>>(options?: Omit<ExtrusionOptions<P>, 'data'> & {
126
- layers?: (layer: StyleLayer) => boolean;
127
- minZoom?: number;
128
- maxTiles?: number;
129
- }): ExtrusionLayer<P>;
104
+ extrusions<P = Record<string, unknown>>(options?: VectorExtrusionOptions<P>): ExtrusionLayer<P>;
130
105
  /**
131
106
  * The wind through the streets around the view, as particles at street level (`height`, default 3 metres) between
132
107
  * the style's buildings (`layers`, default its `building` and `bati_surf` layers): their footprints laid on a grid of
@@ -138,17 +113,7 @@ export declare class VectorTiles {
138
113
  * (`windAt`) for instance; `computed` resolves once the first square's flow is there. The other options are the flow
139
114
  * layer's (`addFlow`)
140
115
  */
141
- streetWind(options?: Omit<FlowOptions, 'field' | 'fields' | 'time'> & {
142
- wind?: [u: number, v: number];
143
- size?: number;
144
- cell?: number;
145
- iterations?: number;
146
- layers?: (layer: StyleLayer) => boolean;
147
- minZoom?: number;
148
- }): FlowLayer & {
149
- setWind(wind: [u: number, v: number]): void;
150
- computed: Promise<void>;
151
- };
116
+ streetWind(options?: StreetWindOptions): StreetWindLayer;
152
117
  /**
153
118
  * Trees on the style's woods, forests and grass (or the fill layers `layers` keeps) as 3D models, from street level
154
119
  * (`minZoom`, default 15): the workers scatter them over the polygons of the vector tiles around the view, `spacing`
@@ -159,18 +124,15 @@ export declare class VectorTiles {
159
124
  * 25000); at most `maxTiles` tiles (default 9) and `maxTrees` trees in each (default 30000). The models load the
160
125
  * engine with 3D Tiles.
161
126
  */
162
- trees(options?: {
163
- layers?: (layer: StyleLayer) => boolean;
164
- spacing?: number | ((layer: StyleLayer) => number);
165
- minZoom?: number;
166
- maxTiles?: number;
167
- maxTrees?: number;
168
- maxInstances?: number;
169
- colors?: Partial<TreeColors>;
170
- url?: string;
171
- data?: ArrayBuffer | ArrayBufferView<ArrayBuffer>;
172
- before?: Layer;
173
- }): ModelLayer;
127
+ trees(options?: TreesOptions): ModelLayer;
128
+ /**
129
+ * Street lamps along the style's streets (the road line layers, or those `layers` keeps) as 3D models, from street
130
+ * level (`minZoom`, default 16): the workers place them `spacing` metres apart (default 30) along each street, every
131
+ * other one on its other side, as far from its middle as its class says; their heads lit at night (`light`). All of
132
+ * them near the ground under the camera, fewer and fewer away from it, at most `maxInstances` drawn (default 15000).
133
+ * The models load the engine with 3D Tiles.
134
+ */
135
+ lamps(options?: LampsOptions): ModelLayer;
174
136
  /**
175
137
  * A layer drawing the style's fills, lines and buildings (or those `layers` keeps; backgrounds as fills, the
176
138
  * `fill-extrusion` layers raised into buildings by their height and base height) as geometry instead of images: the
@@ -179,18 +141,18 @@ export declare class VectorTiles {
179
141
  * and pitch, picked by feature (`pick` gives its properties and style layer), restyled without cutting the tiles
180
142
  * again (`setPaintProperty`, `setLayoutProperty`). Its tiles follow the view, while it moves too, coarser far away in a
181
143
  * tilted view, and those leaving it stay until the ones replacing them are there; past the source's deepest level,
182
- * cut again from its tiles down to level 18 (overzoom: their filters and styles those of their level). The fills' outlines are drawn one
183
- * pixel wide, the lines' ends as their `line-cap` says (their joins round), the colors follow the camera's zoom. The
184
- * layers drawn with a pattern and the circles are left out (the raster path draws them), as are `line-offset`,
185
- * `line-blur` and the translations (`fill-translate`, `line-translate`); `raster` stays the lighter path for heavy
186
- * styles and small devices. At night (`setSun`) the line layers `streets` keeps glow (by default those whose id names
144
+ * cut again from its tiles down to level 18 (overzoom: their styles those of their level; a filter reading the zoom
145
+ * holds at the whole zoom under the camera's, as MapLibre evaluates it). The fills' outlines are drawn one
146
+ * pixel wide, the lines' ends as their `line-cap` says, their joins as their `line-join` says (and `line-miter-limit`),
147
+ * offset by `line-offset`; the colors follow the camera's zoom; the fills', lines' and buildings' patterns from the
148
+ * style's sprite (the fills' over the relief too; on the globe, their average color there), the circle layers' points
149
+ * as circles facing the screen, the lines' blur, the fills' and lines' translations. The buildings' roofs (`roofs`)
150
+ * as their data says (`roof:shape`, `roof:height`; flat without, the default), generated from their outline where
151
+ * they have none (`'generated'`), or all flat. `raster` stays the lighter path for heavy styles and small devices.
152
+ * At night (`setSun`) the line layers `streets` keeps glow (by default those whose id names
187
153
  * a road, not its casing, a railway, a path or a tunnel).
188
154
  */
189
- vectors(options?: {
190
- layers?: (layer: StyleLayer) => boolean;
191
- streets?: (layer: StyleLayer) => boolean;
192
- before?: Layer;
193
- }): VectorLayer;
155
+ vectors(options?: VectorsOptions): VectorLayer;
194
156
  /**
195
157
  * A symbol layer with the labels of the style's symbol layers (or those `layers` keeps), updated as the view
196
158
  * moves: the labels of the vector tiles in view, the higher style layers placed first. With a raster layer of
@@ -198,21 +160,12 @@ export declare class VectorTiles {
198
160
  * away, with the few labels of a lower zoom, as near the camera it takes the fine ones. Without, the tiles around
199
161
  * the center at the zoom of the view. It stays above the layers added after it unless one is moved over it.
200
162
  */
201
- labels(options?: {
202
- layers?: (layer: StyleLayer) => boolean;
203
- maxTiles?: number;
204
- }): SymbolLayer<LabelCandidate>;
163
+ labels(options?: LabelsOptions): SymbolLayer<LabelCandidate>;
205
164
  /**
206
165
  * Makes a layer's tiles follow the view: `update` now and where the camera stops (`moveend`), `moving` every
207
- * `VECTOR_MOVE_REFRESH_MS` while it moves; the requests `held` aborted when destroyed
166
+ * `VECTOR_MOVE_REFRESH_MS` while it moves; the `requests` aborted when destroyed
208
167
  */
209
168
  private followView;
210
169
  /** Stops its workers' work and removes its raster and label layers from the map (those still there) */
211
170
  destroy(): void;
212
171
  }
213
- /**
214
- * A `line-dasharray` as the engine takes it: two dashes and gaps in line widths (an odd count repeated, as the
215
- * canvas's `setLineDash`; past four, the first four), zeros for a solid line
216
- */
217
- export declare const dashes: (value: Json | undefined, zoom: number) => [number, number, number, number];
218
- export {};