isard 0.2.0 → 0.3.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/CHANGELOG.md +134 -14
- package/README.md +2 -2
- package/dist/animation.d.ts +18 -0
- package/dist/animation.js +84 -0
- package/dist/animation.js.map +1 -0
- package/dist/basemap.worker.d.ts +26 -1
- package/dist/basemap.worker.js +2 -2
- package/dist/basemap.worker.js.map +8 -4
- package/dist/basemaps.d.ts +5 -3
- package/dist/basemaps.js +5 -3
- package/dist/basemaps.js.map +1 -1
- package/dist/crs.d.ts +72 -0
- package/dist/crs.js +243 -0
- package/dist/crs.js.map +1 -0
- package/dist/decoder.worker.js +4 -4
- package/dist/decoder.worker.js.map +4 -4
- package/dist/engine-loader.d.ts +27 -0
- package/dist/engine-loader.js +112 -0
- package/dist/engine-loader.js.map +1 -0
- package/dist/extrusions.js +11 -2
- package/dist/extrusions.js.map +1 -1
- package/dist/features.d.ts +8 -0
- package/dist/features.js +17 -10
- package/dist/features.js.map +1 -1
- package/dist/geo.d.ts +16 -0
- package/dist/geo.js +32 -0
- package/dist/geo.js.map +1 -0
- package/dist/geoplateforme.d.ts +21 -5
- package/dist/geoplateforme.js +47 -12
- package/dist/geoplateforme.js.map +1 -1
- package/dist/glyphs.d.ts +10 -3
- package/dist/glyphs.js +14 -2
- package/dist/glyphs.js.map +1 -1
- package/dist/gpx.d.ts +11 -0
- package/dist/gpx.js +74 -0
- package/dist/gpx.js.map +1 -0
- package/dist/grid.d.ts +81 -0
- package/dist/grid.js +270 -0
- package/dist/grid.js.map +1 -0
- package/dist/index.d.ts +7 -1
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -1
- package/dist/interaction.d.ts +3 -4
- package/dist/interaction.js +27 -7
- package/dist/interaction.js.map +1 -1
- package/dist/isard_bg.wasm +0 -0
- package/dist/isard_core_bg.wasm +0 -0
- package/dist/kml.d.ts +12 -0
- package/dist/kml.js +159 -0
- package/dist/kml.js.map +1 -0
- package/dist/layers.d.ts +5 -2
- package/dist/layers.js +22 -18
- package/dist/layers.js.map +1 -1
- package/dist/lru.d.ts +22 -0
- package/dist/lru.js +52 -0
- package/dist/lru.js.map +1 -0
- package/dist/map.d.ts +26 -6
- package/dist/map.js +196 -287
- package/dist/map.js.map +1 -1
- package/dist/resample.d.ts +41 -0
- package/dist/resample.js +164 -0
- package/dist/resample.js.map +1 -0
- package/dist/settings.d.ts +39 -0
- package/dist/settings.js +104 -0
- package/dist/settings.js.map +1 -0
- package/dist/symbols.d.ts +12 -1
- package/dist/symbols.js +124 -26
- package/dist/symbols.js.map +1 -1
- package/dist/terrain.d.ts +19 -7
- package/dist/terrain.js +50 -26
- package/dist/terrain.js.map +1 -1
- package/dist/topojson.d.ts +29 -0
- package/dist/topojson.js +66 -0
- package/dist/topojson.js.map +1 -0
- package/dist/types.d.ts +23 -7
- package/dist/types.js.map +1 -1
- package/dist/vectortiles.d.ts +13 -3
- package/dist/vectortiles.js +85 -46
- package/dist/vectortiles.js.map +1 -1
- package/dist/wasm/isard.d.ts +14 -7
- package/dist/wasm/isard.js +33 -10
- package/dist/wasm/isard_core.d.ts +6 -5
- package/dist/wasm/isard_core.js +41 -10
- package/dist/wmts.d.ts +14 -0
- package/dist/wmts.js +76 -0
- package/dist/wmts.js.map +1 -0
- package/dist/xml.d.ts +26 -0
- package/dist/xml.js +109 -0
- package/dist/xml.js.map +1 -0
- package/package.json +1 -1
- package/dist/equirectangular.d.ts +0 -35
- package/dist/equirectangular.js +0 -113
- package/dist/equirectangular.js.map +0 -1
package/dist/lru.js
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A cache keeping its most recently used entries (the decoded tiles and images of the workers, the source tiles of a
|
|
3
|
+
* reprojection, the labels of the vector tiles): a `Map` in order of use, the least recent dropped past `capacity`.
|
|
4
|
+
*/
|
|
5
|
+
export class Lru {
|
|
6
|
+
capacity;
|
|
7
|
+
evict;
|
|
8
|
+
entries = new Map();
|
|
9
|
+
/** `evict`: told of each entry dropped for room (not of those deleted) */
|
|
10
|
+
constructor(capacity, evict) {
|
|
11
|
+
this.capacity = capacity;
|
|
12
|
+
this.evict = evict;
|
|
13
|
+
}
|
|
14
|
+
get size() {
|
|
15
|
+
return this.entries.size;
|
|
16
|
+
}
|
|
17
|
+
/** The value of a key, now the most recently used; undefined if absent */
|
|
18
|
+
get(key) {
|
|
19
|
+
const value = this.entries.get(key);
|
|
20
|
+
if (value !== undefined) {
|
|
21
|
+
this.entries.delete(key);
|
|
22
|
+
this.entries.set(key, value);
|
|
23
|
+
}
|
|
24
|
+
return value;
|
|
25
|
+
}
|
|
26
|
+
/** Whether a key is kept, without using it */
|
|
27
|
+
has(key) {
|
|
28
|
+
return this.entries.has(key);
|
|
29
|
+
}
|
|
30
|
+
/** Adds or replaces a value, the most recently used; drops the least recent ones past the capacity */
|
|
31
|
+
set(key, value) {
|
|
32
|
+
this.entries.delete(key);
|
|
33
|
+
this.entries.set(key, value);
|
|
34
|
+
for (const [oldest, old] of this.entries) {
|
|
35
|
+
if (this.entries.size <= this.capacity)
|
|
36
|
+
break;
|
|
37
|
+
this.entries.delete(oldest);
|
|
38
|
+
this.evict?.(old, oldest);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
delete(key) {
|
|
42
|
+
return this.entries.delete(key);
|
|
43
|
+
}
|
|
44
|
+
/** The values, least recently used first */
|
|
45
|
+
values() {
|
|
46
|
+
return this.entries.values();
|
|
47
|
+
}
|
|
48
|
+
clear() {
|
|
49
|
+
this.entries.clear();
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=lru.js.map
|
package/dist/lru.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lru.js","sourceRoot":"","sources":["../src/lru.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,OAAO,GAAG;IAKL;IACU;IALF,OAAO,GAAG,IAAI,GAAG,EAAQ,C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,GAAG,CAAC,CAAC;IAClC,CAAC;IAED,4CAA4C;IAC5C,MAAM;QACJ,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;IAC/B,CAAC;IAED,KAAK;QACH,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;IACvB,CAAC;CACF","sourcesContent":["/**\n * A cache keeping its most recently used entries (the decoded tiles and images of the workers, the source tiles of a\n * reprojection, the labels of the vector tiles): a `Map` in order of use, the least recent dropped past `capacity`.\n */\nexport class Lru<K, V> {\n private readonly entries = new Map<K, V>();\n\n /** `evict`: told of each entry dropped for room (not of those deleted) */\n constructor(\n public capacity: number,\n private readonly evict?: (value: V, key: K) => void,\n ) {}\n\n get size(): number {\n return this.entries.size;\n }\n\n /** The value of a key, now the most recently used; undefined if absent */\n get(key: K): V | undefined {\n const value = this.entries.get(key);\n if (value !== undefined) {\n this.entries.delete(key);\n this.entries.set(key, value);\n }\n return value;\n }\n\n /** Whether a key is kept, without using it */\n has(key: K): boolean {\n return this.entries.has(key);\n }\n\n /** Adds or replaces a value, the most recently used; drops the least recent ones past the capacity */\n set(key: K, value: V): void {\n this.entries.delete(key);\n this.entries.set(key, value);\n for (const [oldest, old] of this.entries) {\n if (this.entries.size <= this.capacity) break;\n this.entries.delete(oldest);\n this.evict?.(old, oldest);\n }\n }\n\n delete(key: K): boolean {\n return this.entries.delete(key);\n }\n\n /** The values, least recently used first */\n values(): IterableIterator<V> {\n return this.entries.values();\n }\n\n clear(): void {\n this.entries.clear();\n }\n}\n"]}
|
package/dist/map.d.ts
CHANGED
|
@@ -6,8 +6,6 @@ import { SymbolLayer, type SymbolOptions } from './symbols.ts';
|
|
|
6
6
|
import type { AnimationOptions, AtmosphereOptions, Basemap, FeatureHit, FlyToOptions, GeoMapOptions, LoadingMode, LonLat, MapEvents, NetworkOptions, Point, Projection, RasterOptions, TerrainModel, TerrainOptions, Tiles3dOptions } from './types.ts';
|
|
7
7
|
import { VectorTiles, type VectorTilesOptions } from './vectortiles.ts';
|
|
8
8
|
import type { Camera, PickHit, RasterLayerStats } from './wasm/isard.js';
|
|
9
|
-
/** MapLibre's default easing: cubic Bézier (0.25, 0.1, 0.25, 1) */
|
|
10
|
-
export declare function defaultEasing(t: number): number;
|
|
11
9
|
/** A map (see `GeoMap.create`); layers take it as their host */
|
|
12
10
|
export declare class GeoMap {
|
|
13
11
|
#private;
|
|
@@ -18,6 +16,8 @@ export declare class GeoMap {
|
|
|
18
16
|
private vector;
|
|
19
17
|
private readonly glyphsUrl;
|
|
20
18
|
private readonly basemapWorkerUrl;
|
|
19
|
+
/** Texture size of the vector basemap's tiles */
|
|
20
|
+
private readonly basemapTileSize;
|
|
21
21
|
private readonly container;
|
|
22
22
|
/** Markers and popups, over the canvas */
|
|
23
23
|
private readonly overlay;
|
|
@@ -58,6 +58,8 @@ export declare class GeoMap {
|
|
|
58
58
|
private hoverPoint;
|
|
59
59
|
/** Frame polling the engine for the answer of the hover picking, 0 if none */
|
|
60
60
|
private hoverPoll;
|
|
61
|
+
/** Polls of the hover picking under way: given up after `MAX_POLLS` (an answer that never comes) */
|
|
62
|
+
private hoverPolls;
|
|
61
63
|
/** What 'hoverfeature' looks for: within `radius` CSS pixels, in `layers` only if given */
|
|
62
64
|
hoverPicking: {
|
|
63
65
|
radius?: number;
|
|
@@ -76,6 +78,11 @@ export declare class GeoMap {
|
|
|
76
78
|
private basemapPool;
|
|
77
79
|
/** Stops watching the device pixel ratio */
|
|
78
80
|
private unwatchRatio;
|
|
81
|
+
/** Stops listening to the canvas's context loss and restoration */
|
|
82
|
+
private readonly unwatchContext;
|
|
83
|
+
/** The loaders of the relief by encoding, URL and floor: the same loader for the same tiles (the engine keeps its
|
|
84
|
+
* tiles when only the exaggeration changes) */
|
|
85
|
+
private readonly terrainLoaders;
|
|
79
86
|
/** Loads the engine (once per page) and creates a map filling `container` */
|
|
80
87
|
static create(container: HTMLElement, options?: GeoMapOptions): Promise<GeoMap>;
|
|
81
88
|
private constructor();
|
|
@@ -88,6 +95,9 @@ export declare class GeoMap {
|
|
|
88
95
|
/** A 3D Tiles layer on the core engine: loads the engine with 3D Tiles, then rebuilds the map on it (camera,
|
|
89
96
|
* settings and layers kept, as after a context loss); the layer is created then */
|
|
90
97
|
private upgrade;
|
|
98
|
+
/** Downloads and compiles the engine with 3D Tiles once the map is idle (`tiles3d: 'preload'`), without running
|
|
99
|
+
* it: the first 3D Tiles layer then only instantiates it */
|
|
100
|
+
private preloadTiles3d;
|
|
91
101
|
/** After a context loss: a new engine with the same camera, settings and layers (same handles, same order) */
|
|
92
102
|
private restore;
|
|
93
103
|
/** Takes a layer out of the drawing order (to put it back elsewhere, or for good) */
|
|
@@ -132,8 +142,9 @@ export declare class GeoMap {
|
|
|
132
142
|
/** Tile counters of the raster layers, for diagnostics */
|
|
133
143
|
stats(): RasterLayerStats[];
|
|
134
144
|
/**
|
|
135
|
-
*
|
|
136
|
-
*
|
|
145
|
+
* The feature under a screen point (CSS pixels), undefined if none: its layer id and index. Reads one pixel of an
|
|
146
|
+
* offscreen picking pass, whatever the number of features, but waits for the GPU to finish the frame (a stall): for
|
|
147
|
+
* clicks and one-off queries. On hover, listen to 'hoverfeature' instead, which picks without waiting.
|
|
137
148
|
*/
|
|
138
149
|
pick(point: Point, radius?: number, layers?: readonly Layer[]): PickHit | undefined;
|
|
139
150
|
/**
|
|
@@ -161,8 +172,8 @@ export declare class GeoMap {
|
|
|
161
172
|
/** Replaces the basemap and the IGN hillshade, under the other layers (hillshade by default: 0, none). The former
|
|
162
173
|
* names of the Géoplateforme basemaps (`LegacyBasemap`) are taken under their new ones */
|
|
163
174
|
setBasemap(basemap: Basemap, hillshade?: number): void;
|
|
164
|
-
/** Raster tiles ({z}, {x}, {y} URL; Web Mercator, or reprojected from
|
|
165
|
-
* already added */
|
|
175
|
+
/** Raster tiles ({z}, {x}, {y} URL; Web Mercator, or reprojected from another `grid`: longitudes and latitudes,
|
|
176
|
+
* Lambert-93, UTM…), over the layers already added */
|
|
166
177
|
addRaster(options: RasterOptions & {
|
|
167
178
|
before?: Layer;
|
|
168
179
|
}): RasterLayer;
|
|
@@ -188,6 +199,15 @@ export declare class GeoMap {
|
|
|
188
199
|
* basemap.
|
|
189
200
|
*/
|
|
190
201
|
vectorTiles(options?: VectorTilesOptions): VectorTiles;
|
|
202
|
+
/**
|
|
203
|
+
* The workers decoding the relief and reprojecting rasters: the map's pool, unless the map has no workers
|
|
204
|
+
* (`workers: false` or 0, or none in this browser): that is done in the page then
|
|
205
|
+
*/
|
|
206
|
+
private decodingPool;
|
|
207
|
+
private readonly remoteHeights;
|
|
208
|
+
private readonly remoteReprojection;
|
|
209
|
+
/** The loader of the relief tiles of `url` in a PNG encoding (one per URL, encoding and floor) */
|
|
210
|
+
private readonly terrainLoader;
|
|
191
211
|
/** Adds a layer, under `before` if given */
|
|
192
212
|
private place;
|
|
193
213
|
/** Textured meshes in 3D Tiles (photogrammetry, buildings), drawn with depth over the basemap */
|