isard 0.0.0-stage → 0.2.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 +114 -0
- package/LICENSE +21 -0
- package/README.md +150 -2
- package/dist/basemap.worker.d.ts +66 -0
- package/dist/basemap.worker.js +4 -0
- package/dist/basemap.worker.js.map +13 -0
- package/dist/basemaps.d.ts +46 -0
- package/dist/basemaps.js +95 -0
- package/dist/basemaps.js.map +1 -0
- package/dist/color.d.ts +8 -0
- package/dist/color.js +98 -0
- package/dist/color.js.map +1 -0
- package/dist/controls.d.ts +43 -0
- package/dist/controls.js +115 -0
- package/dist/controls.js.map +1 -0
- package/dist/decoder.worker.js +6 -0
- package/dist/decoder.worker.js.map +12 -0
- package/dist/decoders.d.ts +27 -0
- package/dist/decoders.js +109 -0
- package/dist/decoders.js.map +1 -0
- package/dist/equirectangular.d.ts +35 -0
- package/dist/equirectangular.js +113 -0
- package/dist/equirectangular.js.map +1 -0
- package/dist/extrusions.d.ts +79 -0
- package/dist/extrusions.js +215 -0
- package/dist/extrusions.js.map +1 -0
- package/dist/features.d.ts +159 -0
- package/dist/features.js +387 -0
- package/dist/features.js.map +1 -0
- package/dist/geoplateforme.d.ts +35 -0
- package/dist/geoplateforme.js +56 -0
- package/dist/geoplateforme.js.map +1 -0
- package/dist/glyphs.d.ts +104 -0
- package/dist/glyphs.js +383 -0
- package/dist/glyphs.js.map +1 -0
- package/dist/index.d.ts +34 -0
- package/dist/index.js +25 -0
- package/dist/index.js.map +1 -0
- package/dist/interaction.d.ts +50 -0
- package/dist/interaction.js +243 -0
- package/dist/interaction.js.map +1 -0
- package/dist/isard_bg.wasm +0 -0
- package/dist/isard_core_bg.wasm +0 -0
- package/dist/layers.d.ts +100 -0
- package/dist/layers.js +281 -0
- package/dist/layers.js.map +1 -0
- package/dist/loader.d.ts +30 -0
- package/dist/loader.js +102 -0
- package/dist/loader.js.map +1 -0
- package/dist/map.d.ts +203 -0
- package/dist/map.js +1083 -0
- package/dist/map.js.map +1 -0
- package/dist/mvt.d.ts +19 -0
- package/dist/mvt.js +231 -0
- package/dist/mvt.js.map +1 -0
- package/dist/overlay.d.ts +118 -0
- package/dist/overlay.js +334 -0
- package/dist/overlay.js.map +1 -0
- package/dist/protocol.d.ts +30 -0
- package/dist/protocol.js +2 -0
- package/dist/protocol.js.map +1 -0
- package/dist/style.d.ts +7 -0
- package/dist/style.js +130 -0
- package/dist/style.js.map +1 -0
- package/dist/symbols.d.ts +61 -0
- package/dist/symbols.js +238 -0
- package/dist/symbols.js.map +1 -0
- package/dist/terrain.d.ts +14 -0
- package/dist/terrain.js +44 -0
- package/dist/terrain.js.map +1 -0
- package/dist/types.d.ts +304 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/vectorstyle.d.ts +83 -0
- package/dist/vectorstyle.js +518 -0
- package/dist/vectorstyle.js.map +1 -0
- package/dist/vectortiles.d.ts +121 -0
- package/dist/vectortiles.js +507 -0
- package/dist/vectortiles.js.map +1 -0
- package/dist/wasm/isard.d.ts +611 -0
- package/dist/wasm/isard.js +2606 -0
- package/dist/wasm/isard_core.d.ts +468 -0
- package/dist/wasm/isard_core.js +2360 -0
- package/package.json +49 -4
package/dist/map.d.ts
ADDED
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import { type Control, type ControlPosition } from './controls.ts';
|
|
2
|
+
import { ExtrusionLayer, type ExtrusionOptions } from './extrusions.ts';
|
|
3
|
+
import { CircleLayer, type CircleOptions, FillLayer, type FillOptions, LineLayer, type LineOptions } from './features.ts';
|
|
4
|
+
import { GroundLayer, type GroundOptions, type Layer, NetworkLayer, RasterLayer, Tiles3dLayer } from './layers.ts';
|
|
5
|
+
import { SymbolLayer, type SymbolOptions } from './symbols.ts';
|
|
6
|
+
import type { AnimationOptions, AtmosphereOptions, Basemap, FeatureHit, FlyToOptions, GeoMapOptions, LoadingMode, LonLat, MapEvents, NetworkOptions, Point, Projection, RasterOptions, TerrainModel, TerrainOptions, Tiles3dOptions } from './types.ts';
|
|
7
|
+
import { VectorTiles, type VectorTilesOptions } from './vectortiles.ts';
|
|
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
|
+
/** A map (see `GeoMap.create`); layers take it as their host */
|
|
12
|
+
export declare class GeoMap {
|
|
13
|
+
#private;
|
|
14
|
+
readonly canvas: HTMLCanvasElement;
|
|
15
|
+
/** Layers new layers go under */
|
|
16
|
+
private readonly onTop;
|
|
17
|
+
/** The vector basemap, if any: its tiles' workers and its labels */
|
|
18
|
+
private vector;
|
|
19
|
+
private readonly glyphsUrl;
|
|
20
|
+
private readonly basemapWorkerUrl;
|
|
21
|
+
private readonly container;
|
|
22
|
+
/** Markers and popups, over the canvas */
|
|
23
|
+
private readonly overlay;
|
|
24
|
+
private readonly corners;
|
|
25
|
+
private readonly controls;
|
|
26
|
+
private readonly positioned;
|
|
27
|
+
/** Canvas size in CSS pixels, kept on resize so placing overlays never reads the layout */
|
|
28
|
+
private size;
|
|
29
|
+
/** Layers in drawing order (bottom first), to recreate them after a context loss */
|
|
30
|
+
private readonly layers;
|
|
31
|
+
private readonly settings;
|
|
32
|
+
/** The WebGL context is lost: nothing is drawn until it is restored */
|
|
33
|
+
private lost;
|
|
34
|
+
private readonly listeners;
|
|
35
|
+
private readonly resizeObserver;
|
|
36
|
+
private readonly interaction;
|
|
37
|
+
private loader;
|
|
38
|
+
/** The class of the engine: without 3D Tiles until a 3D Tiles layer is added, unless asked for from the start */
|
|
39
|
+
private engineClass;
|
|
40
|
+
/** The module of the engine with 3D Tiles once it runs this map (the decoding workers run it too) */
|
|
41
|
+
private tiles3dModule;
|
|
42
|
+
/** The engine with 3D Tiles is loading, for the 3D Tiles layers added on the core engine */
|
|
43
|
+
private upgrading;
|
|
44
|
+
/** What loading the engine with 3D Tiles and its workers needs */
|
|
45
|
+
private readonly tiles3dOptions;
|
|
46
|
+
private gone;
|
|
47
|
+
/** The map is of the Earth: a basemap by default */
|
|
48
|
+
private readonly earth;
|
|
49
|
+
/** The body, as the option named it */
|
|
50
|
+
private readonly body;
|
|
51
|
+
private basemap;
|
|
52
|
+
private hillshade;
|
|
53
|
+
/** Called when the credits of the layers or relief change (the attribution controls) */
|
|
54
|
+
private readonly attributionListeners;
|
|
55
|
+
/** Credits of the raster layers that have some (basemaps, hillshade, the Géoplateforme's rasters…) */
|
|
56
|
+
private readonly rasterCredits;
|
|
57
|
+
private animation;
|
|
58
|
+
private hoverPoint;
|
|
59
|
+
/** Frame polling the engine for the answer of the hover picking, 0 if none */
|
|
60
|
+
private hoverPoll;
|
|
61
|
+
/** What 'hoverfeature' looks for: within `radius` CSS pixels, in `layers` only if given */
|
|
62
|
+
hoverPicking: {
|
|
63
|
+
radius?: number;
|
|
64
|
+
layers?: readonly Layer[];
|
|
65
|
+
};
|
|
66
|
+
private frameRequest;
|
|
67
|
+
private lastCamera;
|
|
68
|
+
/** The camera moved since the last 'moveend' */
|
|
69
|
+
private moving;
|
|
70
|
+
/** The last frame found everything loaded ('idle' sent) */
|
|
71
|
+
private settled;
|
|
72
|
+
private inFrame;
|
|
73
|
+
/** Vector tiles made by `vectorTiles()`, destroyed with the map */
|
|
74
|
+
private readonly vectorSets;
|
|
75
|
+
/** The workers drawing vector tiles, shared by every `VectorTiles` of the map; created on first use */
|
|
76
|
+
private basemapPool;
|
|
77
|
+
/** Stops watching the device pixel ratio */
|
|
78
|
+
private unwatchRatio;
|
|
79
|
+
/** Loads the engine (once per page) and creates a map filling `container` */
|
|
80
|
+
static create(container: HTMLElement, options?: GeoMapOptions): Promise<GeoMap>;
|
|
81
|
+
private constructor();
|
|
82
|
+
/** The element the map was created in */
|
|
83
|
+
getContainer(): HTMLElement;
|
|
84
|
+
getCanvas(): HTMLCanvasElement;
|
|
85
|
+
private createEngine;
|
|
86
|
+
/** The decoding workers of 3D Tiles, with the engine that has them (they run its module) and unless turned off */
|
|
87
|
+
private startLoader;
|
|
88
|
+
/** A 3D Tiles layer on the core engine: loads the engine with 3D Tiles, then rebuilds the map on it (camera,
|
|
89
|
+
* settings and layers kept, as after a context loss); the layer is created then */
|
|
90
|
+
private upgrade;
|
|
91
|
+
/** After a context loss: a new engine with the same camera, settings and layers (same handles, same order) */
|
|
92
|
+
private restore;
|
|
93
|
+
/** Takes a layer out of the drawing order (to put it back elsewhere, or for good) */
|
|
94
|
+
private unlist;
|
|
95
|
+
private add;
|
|
96
|
+
/** Index in the engine of the layer at `index`: the layers waiting for the engine with 3D Tiles are not in it yet */
|
|
97
|
+
private engineIndex;
|
|
98
|
+
/** Moves a layer under all the others */
|
|
99
|
+
private toBottom;
|
|
100
|
+
/** Listens to an event; returns the function that stops listening */
|
|
101
|
+
on<K extends keyof MapEvents>(type: K, listener: (event: MapEvents[K]) => void): () => void;
|
|
102
|
+
getCamera(): Camera;
|
|
103
|
+
setCamera(camera: Partial<Camera>): void;
|
|
104
|
+
/** Animated move to a camera: over `duration` milliseconds (or the options), ease-out by default */
|
|
105
|
+
easeTo(camera: Partial<Camera>, options?: number | AnimationOptions): void;
|
|
106
|
+
/**
|
|
107
|
+
* Flight to a camera that zooms out on its way and back in (van Wijk and Nuij's optimal path, as MapLibre's
|
|
108
|
+
* `flyTo`): long moves stay readable. Pitch and bearing follow the progress.
|
|
109
|
+
*/
|
|
110
|
+
flyTo(camera: Partial<Camera>, options?: FlyToOptions): void;
|
|
111
|
+
/** Longitudes and latitudes the view covers on the ground: `[west, south, east, north]` */
|
|
112
|
+
getBounds(): [west: number, south: number, east: number, north: number];
|
|
113
|
+
/** Lowest zoom the camera accepts (the widest view) */
|
|
114
|
+
setMinZoom(zoom: number): void;
|
|
115
|
+
setMaxZoom(zoom: number): void;
|
|
116
|
+
/** Highest pitch, degrees, up to 85 */
|
|
117
|
+
setMaxPitch(pitch: number): void;
|
|
118
|
+
/** Sky over the plane and the fog of the ground (see `GeoMapOptions.atmosphere`); undefined to remove them */
|
|
119
|
+
setAtmosphere(options: AtmosphereOptions | undefined): void;
|
|
120
|
+
setProjection(projection: Projection): void;
|
|
121
|
+
/** How tiles load and show (see `LoadingMode`) */
|
|
122
|
+
setLoading(mode: LoadingMode): void;
|
|
123
|
+
/** Space behind the globe (stars, atmosphere halo) */
|
|
124
|
+
setSky(enabled: boolean): void;
|
|
125
|
+
/** Relief under the basemap: true for the body's terrain model (on the Earth the worldwide Terrain Tiles, NASA's
|
|
126
|
+
* on the Moon and Mars), one of the Earth's models by name (`'ign'`), its options, or false; on another body, its
|
|
127
|
+
* options with a `url` */
|
|
128
|
+
setTerrain(terrain: boolean | TerrainModel | TerrainOptions): void;
|
|
129
|
+
private attributionChanged;
|
|
130
|
+
/** Color behind the map, a CSS color (its alpha ignored) */
|
|
131
|
+
setBackground(color: string): void;
|
|
132
|
+
/** Tile counters of the raster layers, for diagnostics */
|
|
133
|
+
stats(): RasterLayerStats[];
|
|
134
|
+
/**
|
|
135
|
+
* Network edge under a screen point (CSS pixels), undefined if none. Reads one pixel of an offscreen picking pass:
|
|
136
|
+
* cheap whatever the number of features, call it on hover.
|
|
137
|
+
*/
|
|
138
|
+
pick(point: Point, radius?: number, layers?: readonly Layer[]): PickHit | undefined;
|
|
139
|
+
/**
|
|
140
|
+
* The feature under a screen point (CSS pixels), or the nearest one within `radius` pixels: its layer handle, its
|
|
141
|
+
* index there and, for line, circle and fill layers, the feature itself; undefined if none. `layers` restricts the
|
|
142
|
+
* search to some layers (the others hide nothing).
|
|
143
|
+
*/
|
|
144
|
+
pickFeature(point: Point, options?: {
|
|
145
|
+
radius?: number;
|
|
146
|
+
layers?: readonly Layer[];
|
|
147
|
+
}): FeatureHit | undefined;
|
|
148
|
+
/** A hit with its layer handle and feature; undefined if the layer is gone */
|
|
149
|
+
private featureHit;
|
|
150
|
+
/** Asks the engine what is under the pointer; its answer, read without waiting for the GPU, comes on a later frame */
|
|
151
|
+
private requestHoverPick;
|
|
152
|
+
private readonly pollHoverPick;
|
|
153
|
+
private cancelHoverPick;
|
|
154
|
+
/** Screen point (CSS pixels) of a position, undefined behind the camera */
|
|
155
|
+
project(lonLat: LonLat): Point | undefined;
|
|
156
|
+
/** Position under a screen point (CSS pixels), undefined above the horizon */
|
|
157
|
+
unproject(point: Point): LonLat | undefined;
|
|
158
|
+
/** Adds a control in a corner of the map; controls stack from the corner inward */
|
|
159
|
+
addControl(control: Control, position?: ControlPosition): this;
|
|
160
|
+
removeControl(control: Control): this;
|
|
161
|
+
/** Replaces the basemap and the IGN hillshade, under the other layers (hillshade by default: 0, none). The former
|
|
162
|
+
* names of the Géoplateforme basemaps (`LegacyBasemap`) are taken under their new ones */
|
|
163
|
+
setBasemap(basemap: Basemap, hillshade?: number): void;
|
|
164
|
+
/** Raster tiles ({z}, {x}, {y} URL; Web Mercator, or reprojected from an equirectangular `grid`), over the layers
|
|
165
|
+
* already added */
|
|
166
|
+
addRaster(options: RasterOptions & {
|
|
167
|
+
before?: Layer;
|
|
168
|
+
}): RasterLayer;
|
|
169
|
+
/** Line network colored by a value per node; `layer.setValues` recolors it in one texture upload */
|
|
170
|
+
addNetwork(options: NetworkOptions): NetworkLayer;
|
|
171
|
+
/** Lines from GeoJSON (line strings, and polygon outlines), styled per feature */
|
|
172
|
+
addLines<P = Record<string, unknown>>(options: LineOptions<P>): LineLayer<P>;
|
|
173
|
+
/** Discs from GeoJSON points, styled per feature */
|
|
174
|
+
addCircles<P = Record<string, unknown>>(options: CircleOptions<P>): CircleLayer<P>;
|
|
175
|
+
/** Filled polygons from GeoJSON (holes included), styled per feature; over the relief they lie on the ground */
|
|
176
|
+
addFills<P = Record<string, unknown>>(options: FillOptions<P>): FillLayer<P>;
|
|
177
|
+
/** The application's fragment shader over the ground (see `GroundOptions`); under `before` if given */
|
|
178
|
+
addGround(options: GroundOptions & {
|
|
179
|
+
before?: Layer;
|
|
180
|
+
}): GroundLayer;
|
|
181
|
+
/** Polygons raised into blocks with depth (buildings), styled per feature; tiles of them come with `setTile` */
|
|
182
|
+
addExtrusions<P = Record<string, unknown>>(options?: ExtrusionOptions<P>): ExtrusionLayer<P>;
|
|
183
|
+
/** Text labels from GeoJSON (points, the middle of lines, the center of polygons), placed without overlaps */
|
|
184
|
+
addSymbols<P = Record<string, unknown>>(options: SymbolOptions<P>): SymbolLayer<P>;
|
|
185
|
+
/**
|
|
186
|
+
* Vector tiles with a MapLibre style (OpenFreeMap's Positron by default): `tiles.raster(…)` draws its fills and lines
|
|
187
|
+
* (or a subset) as a raster layer, `tiles.labels(…)` its labels. `setBasemap('osm-positron')` does both for the
|
|
188
|
+
* basemap.
|
|
189
|
+
*/
|
|
190
|
+
vectorTiles(options?: VectorTilesOptions): VectorTiles;
|
|
191
|
+
/** Adds a layer, under `before` if given */
|
|
192
|
+
private place;
|
|
193
|
+
/** Textured meshes in 3D Tiles (photogrammetry, buildings), drawn with depth over the basemap */
|
|
194
|
+
addTiles3d(options: Tiles3dOptions): Tiles3dLayer;
|
|
195
|
+
/** Asks for a frame; several calls before the next frame draw it once */
|
|
196
|
+
requestRender(): void;
|
|
197
|
+
private frame;
|
|
198
|
+
private drawFrame;
|
|
199
|
+
/** Resizes when the device pixel ratio changes (browser zoom, a window moved to another screen) */
|
|
200
|
+
private watchRatio;
|
|
201
|
+
private resize;
|
|
202
|
+
destroy(): void;
|
|
203
|
+
}
|