isard 1.0.0 → 1.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 +51 -0
- package/dist/{basemaps.d.ts → basemap/basemaps.d.ts} +3 -3
- package/dist/{basemaps.js → basemap/basemaps.js} +3 -3
- package/dist/basemap/basemaps.js.map +1 -0
- package/dist/{grid.d.ts → basemap/grid.d.ts} +6 -6
- package/dist/{grid.js → basemap/grid.js} +61 -67
- package/dist/basemap/grid.js.map +1 -0
- package/dist/{mvt.d.ts → basemap/mvt.d.ts} +1 -1
- package/dist/{mvt.js → basemap/mvt.js} +6 -6
- package/dist/basemap/mvt.js.map +1 -0
- package/dist/{pmtiles.d.ts → basemap/pmtiles.d.ts} +16 -10
- package/dist/{pmtiles.js → basemap/pmtiles.js} +41 -33
- package/dist/basemap/pmtiles.js.map +1 -0
- package/dist/{resample.d.ts → basemap/resample.d.ts} +11 -2
- package/dist/{resample.js → basemap/resample.js} +18 -16
- package/dist/basemap/resample.js.map +1 -0
- package/dist/{terrain.d.ts → basemap/terrain.d.ts} +3 -3
- package/dist/{terrain.js → basemap/terrain.js} +7 -7
- package/dist/basemap/terrain.js.map +1 -0
- package/dist/{vectorstyle.d.ts → basemap/vectorstyle.d.ts} +12 -10
- package/dist/{vectorstyle.js → basemap/vectorstyle.js} +129 -111
- package/dist/basemap/vectorstyle.js.map +1 -0
- package/dist/{vectortiles.d.ts → basemap/vectortiles.d.ts} +18 -18
- package/dist/{vectortiles.js → basemap/vectortiles.js} +157 -109
- package/dist/basemap/vectortiles.js.map +1 -0
- package/dist/{wmts.d.ts → basemap/wmts.d.ts} +3 -3
- package/dist/{wmts.js → basemap/wmts.js} +19 -14
- package/dist/basemap/wmts.js.map +1 -0
- package/dist/basemap.worker.js +2 -2
- package/dist/basemap.worker.js.map +14 -13
- package/dist/bind/layers.d.ts +46 -0
- package/dist/bind/layers.js +154 -0
- package/dist/bind/layers.js.map +1 -0
- package/dist/{crs.d.ts → data/crs.d.ts} +11 -11
- package/dist/{crs.js → data/crs.js} +38 -34
- package/dist/data/crs.js.map +1 -0
- package/dist/{gpx.d.ts → data/gpx.d.ts} +2 -2
- package/dist/{gpx.js → data/gpx.js} +20 -20
- package/dist/data/gpx.js.map +1 -0
- package/dist/{kml.d.ts → data/kml.d.ts} +2 -2
- package/dist/{kml.js → data/kml.js} +42 -39
- package/dist/data/kml.js.map +1 -0
- package/dist/{topojson.d.ts → data/topojson.d.ts} +2 -2
- package/dist/{topojson.js → data/topojson.js} +15 -10
- package/dist/data/topojson.js.map +1 -0
- package/dist/{xml.d.ts → data/xml.d.ts} +5 -5
- package/dist/{xml.js → data/xml.js} +19 -18
- package/dist/data/xml.js.map +1 -0
- package/dist/decoder.worker.js +4 -4
- package/dist/decoder.worker.js.map +7 -7
- package/dist/{decoders.d.ts → engine/decoders.d.ts} +3 -3
- package/dist/{decoders.js → engine/decoders.js} +28 -25
- package/dist/engine/decoders.js.map +1 -0
- package/dist/{loader.d.ts → engine/loader.d.ts} +1 -1
- package/dist/{loader.js → engine/loader.js} +17 -14
- package/dist/engine/loader.js.map +1 -0
- package/dist/{protocol.d.ts → engine/protocol.d.ts} +1 -1
- package/dist/engine/protocol.js +3 -0
- package/dist/engine/protocol.js.map +1 -0
- package/dist/{requests.d.ts → engine/requests.d.ts} +1 -1
- package/dist/{requests.js → engine/requests.js} +19 -16
- package/dist/engine/requests.js.map +1 -0
- package/dist/engine-loader.d.ts +13 -9
- package/dist/engine-loader.js +30 -30
- package/dist/engine-loader.js.map +1 -1
- package/dist/formats.d.ts +3 -3
- package/dist/formats.js +3 -3
- package/dist/formats.js.map +1 -1
- package/dist/geoplateforme.d.ts +13 -13
- package/dist/geoplateforme.js +23 -21
- package/dist/geoplateforme.js.map +1 -1
- package/dist/index.d.ts +30 -29
- package/dist/index.js +18 -18
- package/dist/index.js.map +1 -1
- package/dist/isard_bg.wasm +0 -0
- package/dist/isard_core_bg.wasm +0 -0
- package/dist/isard_points_bg.wasm +0 -0
- package/dist/{extrusions.d.ts → layers/extrusions.d.ts} +1 -1
- package/dist/{extrusions.js → layers/extrusions.js} +10 -5
- package/dist/layers/extrusions.js.map +1 -0
- package/dist/{features.d.ts → layers/features.d.ts} +10 -10
- package/dist/{features.js → layers/features.js} +44 -45
- package/dist/layers/features.js.map +1 -0
- package/dist/{glyphs.d.ts → layers/glyphs.d.ts} +6 -6
- package/dist/{glyphs.js → layers/glyphs.js} +45 -41
- package/dist/layers/glyphs.js.map +1 -0
- package/dist/{icons.d.ts → layers/icons.d.ts} +10 -10
- package/dist/{icons.js → layers/icons.js} +84 -69
- package/dist/layers/icons.js.map +1 -0
- package/dist/{layers.d.ts → layers/layers.d.ts} +9 -4
- package/dist/{layers.js → layers/layers.js} +35 -31
- package/dist/layers/layers.js.map +1 -0
- package/dist/{panoramas.d.ts → layers/panoramas.d.ts} +3 -3
- package/dist/{panoramas.js → layers/panoramas.js} +54 -43
- package/dist/layers/panoramas.js.map +1 -0
- package/dist/{pointclouds.d.ts → layers/pointclouds.d.ts} +5 -5
- package/dist/{pointclouds.js → layers/pointclouds.js} +26 -34
- package/dist/layers/pointclouds.js.map +1 -0
- package/dist/{symbols.d.ts → layers/symbols.d.ts} +3 -3
- package/dist/{symbols.js → layers/symbols.js} +69 -72
- package/dist/layers/symbols.js.map +1 -0
- package/dist/map/basemap-layers.d.ts +26 -0
- package/dist/map/basemap-layers.js +61 -0
- package/dist/map/basemap-layers.js.map +1 -0
- package/dist/map/canvas.d.ts +17 -0
- package/dist/map/canvas.js +56 -0
- package/dist/map/canvas.js.map +1 -0
- package/dist/map/checks.d.ts +11 -0
- package/dist/map/checks.js +39 -0
- package/dist/map/checks.js.map +1 -0
- package/dist/map/credits.d.ts +17 -0
- package/dist/map/credits.js +34 -0
- package/dist/map/credits.js.map +1 -0
- package/dist/map/engine-settings.d.ts +15 -0
- package/dist/map/engine-settings.js +45 -0
- package/dist/map/engine-settings.js.map +1 -0
- package/dist/map/engines.d.ts +41 -0
- package/dist/map/engines.js +77 -0
- package/dist/map/engines.js.map +1 -0
- package/dist/map/events.d.ts +14 -0
- package/dist/map/events.js +46 -0
- package/dist/map/events.js.map +1 -0
- package/dist/map/frame-loop.d.ts +61 -0
- package/dist/map/frame-loop.js +139 -0
- package/dist/map/frame-loop.js.map +1 -0
- package/dist/map/hover-pick.d.ts +30 -0
- package/dist/map/hover-pick.js +56 -0
- package/dist/map/hover-pick.js.map +1 -0
- package/dist/map/layer-spec.d.ts +42 -0
- package/dist/map/layer-spec.js +34 -0
- package/dist/map/layer-spec.js.map +1 -0
- package/dist/map/layer-stack.d.ts +36 -0
- package/dist/map/layer-stack.js +101 -0
- package/dist/map/layer-stack.js.map +1 -0
- package/dist/map/overlay-host.d.ts +36 -0
- package/dist/map/overlay-host.js +101 -0
- package/dist/map/overlay-host.js.map +1 -0
- package/dist/map/panorama-host.d.ts +5 -0
- package/dist/map/panorama-host.js +32 -0
- package/dist/map/panorama-host.js.map +1 -0
- package/dist/map/raster-source.d.ts +11 -0
- package/dist/map/raster-source.js +26 -0
- package/dist/map/raster-source.js.map +1 -0
- package/dist/map/symbol-atlases.d.ts +26 -0
- package/dist/map/symbol-atlases.js +59 -0
- package/dist/map/symbol-atlases.js.map +1 -0
- package/dist/map/viewshed.d.ts +5 -0
- package/dist/map/viewshed.js +28 -0
- package/dist/map/viewshed.js.map +1 -0
- package/dist/map/workers.d.ts +46 -0
- package/dist/map/workers.js +73 -0
- package/dist/map/workers.js.map +1 -0
- package/dist/map.d.ts +46 -127
- package/dist/map.js +183 -698
- package/dist/map.js.map +1 -1
- package/dist/projections.d.ts +3 -3
- package/dist/projections.js +2 -2
- package/dist/projections.js.map +1 -1
- package/dist/react/Control.d.ts +11 -0
- package/dist/react/Control.js +18 -0
- package/dist/react/Control.js.map +1 -0
- package/dist/react/CustomLayer.d.ts +11 -0
- package/dist/react/CustomLayer.js +30 -0
- package/dist/react/CustomLayer.js.map +1 -0
- package/dist/react/IsardMap.d.ts +43 -0
- package/dist/react/IsardMap.js +146 -0
- package/dist/react/IsardMap.js.map +1 -0
- package/dist/react/Layer.d.ts +42 -0
- package/dist/react/Layer.js +74 -0
- package/dist/react/Layer.js.map +1 -0
- package/dist/react/Marker.d.ts +24 -0
- package/dist/react/Marker.js +53 -0
- package/dist/react/Marker.js.map +1 -0
- package/dist/react/Panel.d.ts +11 -0
- package/dist/react/Panel.js +37 -0
- package/dist/react/Panel.js.map +1 -0
- package/dist/react/Popup.d.ts +18 -0
- package/dist/react/Popup.js +60 -0
- package/dist/react/Popup.js.map +1 -0
- package/dist/react/Swipe.d.ts +9 -0
- package/dist/react/Swipe.js +41 -0
- package/dist/react/Swipe.js.map +1 -0
- package/dist/react/Viewshed.d.ts +5 -0
- package/dist/react/Viewshed.js +28 -0
- package/dist/react/Viewshed.js.map +1 -0
- package/dist/react/context.d.ts +32 -0
- package/dist/react/context.js +20 -0
- package/dist/react/context.js.map +1 -0
- package/dist/react/index.d.ts +26 -0
- package/dist/react/index.js +22 -0
- package/dist/react/index.js.map +1 -0
- package/dist/settings.d.ts +6 -10
- package/dist/settings.js +19 -17
- package/dist/settings.js.map +1 -1
- package/dist/types.d.ts +8 -8
- package/dist/types.js +1 -0
- package/dist/types.js.map +1 -1
- package/dist/{controls.d.ts → ui/controls.d.ts} +1 -1
- package/dist/{controls.js → ui/controls.js} +6 -4
- package/dist/ui/controls.js.map +1 -0
- package/dist/{interaction.d.ts → ui/interaction.d.ts} +9 -5
- package/dist/{interaction.js → ui/interaction.js} +9 -8
- package/dist/ui/interaction.js.map +1 -0
- package/dist/{overlay.d.ts → ui/overlay.d.ts} +2 -2
- package/dist/{overlay.js → ui/overlay.js} +18 -20
- package/dist/ui/overlay.js.map +1 -0
- package/dist/{style.d.ts → ui/style.d.ts} +1 -1
- package/dist/{style.js → ui/style.js} +2 -2
- package/dist/ui/style.js.map +1 -0
- package/dist/{animation.d.ts → util/animation.d.ts} +9 -5
- package/dist/{animation.js → util/animation.js} +6 -6
- package/dist/util/animation.js.map +1 -0
- package/dist/{color.d.ts → util/color.d.ts} +1 -1
- package/dist/{color.js → util/color.js} +14 -16
- package/dist/util/color.js.map +1 -0
- package/dist/{geo.d.ts → util/geo.d.ts} +6 -6
- package/dist/{geo.js → util/geo.js} +12 -12
- package/dist/util/geo.js.map +1 -0
- package/dist/util/guards.d.ts +7 -0
- package/dist/util/guards.js +8 -0
- package/dist/util/guards.js.map +1 -0
- package/dist/util/lru.js.map +1 -0
- package/dist/wasm/isard.d.ts +168 -0
- package/dist/wasm/isard.js +146 -0
- package/dist/wasm/isard_core.d.ts +144 -0
- package/dist/wasm/isard_core.js +122 -0
- package/dist/{basemap.worker.d.ts → workers/basemap.worker.d.ts} +17 -7
- package/dist/workers/basemap.worker.js +658 -0
- package/dist/workers/basemap.worker.js.map +1 -0
- package/package.json +24 -1
- package/vite.js +1 -1
- package/dist/animation.js.map +0 -1
- package/dist/basemaps.js.map +0 -1
- package/dist/color.js.map +0 -1
- package/dist/controls.js.map +0 -1
- package/dist/crs.js.map +0 -1
- package/dist/decoders.js.map +0 -1
- package/dist/extrusions.js.map +0 -1
- package/dist/features.js.map +0 -1
- package/dist/geo.js.map +0 -1
- package/dist/glyphs.js.map +0 -1
- package/dist/gpx.js.map +0 -1
- package/dist/grid.js.map +0 -1
- package/dist/icons.js.map +0 -1
- package/dist/interaction.js.map +0 -1
- package/dist/kml.js.map +0 -1
- package/dist/layers.js.map +0 -1
- package/dist/loader.js.map +0 -1
- package/dist/lru.js.map +0 -1
- package/dist/mvt.js.map +0 -1
- package/dist/overlay.js.map +0 -1
- package/dist/panoramas.js.map +0 -1
- package/dist/pmtiles.js.map +0 -1
- package/dist/pointclouds.js.map +0 -1
- package/dist/protocol.js +0 -2
- package/dist/protocol.js.map +0 -1
- package/dist/requests.js.map +0 -1
- package/dist/resample.js.map +0 -1
- package/dist/style.js.map +0 -1
- package/dist/symbols.js.map +0 -1
- package/dist/terrain.js.map +0 -1
- package/dist/topojson.js.map +0 -1
- package/dist/vectorstyle.js.map +0 -1
- package/dist/vectortiles.js.map +0 -1
- package/dist/wmts.js.map +0 -1
- package/dist/xml.js.map +0 -1
- /package/dist/{lru.d.ts → util/lru.d.ts} +0 -0
- /package/dist/{lru.js → util/lru.js} +0 -0
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* in NGF-IGN69 (Lambert-93, the CC zones) are raised by the RAF20 geoid height onto the ellipsoid of the relief and
|
|
6
6
|
* the 3D Tiles.
|
|
7
7
|
*/
|
|
8
|
-
import { epsgCode, getCrs } from "
|
|
8
|
+
import { epsgCode, getCrs } from "../data/crs.js";
|
|
9
9
|
import { parseColor, rampTexels } from "./features.js";
|
|
10
10
|
import { Layer } from "./layers.js";
|
|
11
11
|
/** The default classes: ASPRS LAS 1.4, then IGN's LiDAR HD (64 permanent structures, 65 artefacts, 66 virtual points,
|
|
@@ -44,7 +44,7 @@ export const ELEVATION_RAMP = [
|
|
|
44
44
|
[1, '#d7191c'],
|
|
45
45
|
];
|
|
46
46
|
/** The colors of the 256 classes (RGBA, alpha 0 hides one) */
|
|
47
|
-
export
|
|
47
|
+
export const classPalette = (overrides = {}) => {
|
|
48
48
|
const out = new Uint8Array(256 * 4);
|
|
49
49
|
for (let code = 0; code < 256; code += 1) {
|
|
50
50
|
const base = CLASSIFICATIONS[code] ?? { color: '#c8c8c8', visible: true };
|
|
@@ -53,9 +53,9 @@ export function classPalette(overrides = {}) {
|
|
|
53
53
|
out.set([r * 255, g * 255, b * 255, (own.visible ?? base.visible) ? 255 : 0], code * 4);
|
|
54
54
|
}
|
|
55
55
|
return out;
|
|
56
|
-
}
|
|
56
|
+
};
|
|
57
57
|
/** The section of a WKT opening with one of `keywords` (`PROJCS[…]`), from its keyword to its closing bracket */
|
|
58
|
-
|
|
58
|
+
const section = (wkt, keywords) => {
|
|
59
59
|
for (const keyword of keywords) {
|
|
60
60
|
const start = wkt.indexOf(`${keyword}[`);
|
|
61
61
|
if (start < 0)
|
|
@@ -69,53 +69,47 @@ function section(wkt, keywords) {
|
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
return undefined;
|
|
72
|
-
}
|
|
72
|
+
};
|
|
73
73
|
/** The EPSG code a WKT section ends with (its own `AUTHORITY`, or `ID` in WKT2), the last of its nested ones */
|
|
74
|
-
|
|
74
|
+
const lastCode = (part) => {
|
|
75
75
|
const codes = [...part.matchAll(/(?:AUTHORITY|ID)\[\s*"EPSG"\s*,\s*"?(\d+)"?\s*\]/g)];
|
|
76
76
|
const last = codes.at(-1)?.[1];
|
|
77
77
|
return last === undefined ? undefined : Number(last);
|
|
78
|
-
}
|
|
78
|
+
};
|
|
79
79
|
/** The factor of the last `UNIT` (`LENGTHUNIT` in WKT2) of a WKT section */
|
|
80
|
-
|
|
80
|
+
const lastUnit = (part) => {
|
|
81
81
|
const units = [...(part ?? '').matchAll(/(?:LENGTH)?UNIT\[\s*"[^"]*"\s*,\s*([\d.eE+-]+)/g)];
|
|
82
82
|
const factor = Number(units.at(-1)?.[1]);
|
|
83
83
|
return Number.isFinite(factor) && factor > 0 ? factor : undefined;
|
|
84
|
-
}
|
|
84
|
+
};
|
|
85
85
|
/** What a WKT says of a CRS: its EPSG code (projected first), the metres of a unit of z */
|
|
86
|
-
export
|
|
86
|
+
export const wktCrs = (wkt) => {
|
|
87
87
|
const projected = section(wkt, ['PROJCS', 'PROJCRS']);
|
|
88
88
|
const geographic = section(wkt, ['GEOGCS', 'GEOGCRS']);
|
|
89
|
-
|
|
90
|
-
if (code === undefined && /Lambert[- ]93/i.test(wkt))
|
|
91
|
-
code = 2154;
|
|
89
|
+
const code = lastCode(projected ?? geographic ?? '') ?? (/Lambert[- ]93/i.test(wkt) ? 2154 : undefined);
|
|
92
90
|
const vertical = section(wkt, ['VERT_CS', 'VERTCRS']);
|
|
93
91
|
const verticalScale = lastUnit(vertical ?? projected);
|
|
94
92
|
return { code, verticalScale };
|
|
95
|
-
}
|
|
93
|
+
};
|
|
96
94
|
/** Whether the altitudes of a CRS are NGF-IGN69 by default: Lambert-93 and the CC zones */
|
|
97
95
|
const FRENCH = (code) => code === 2154 || (code !== undefined && code >= 3942 && code <= 3950);
|
|
98
96
|
/** The CRS of a COPC file for the engine, from its WKT and the options */
|
|
99
|
-
export
|
|
97
|
+
export const pointCloudCrs = (wkt, options) => {
|
|
100
98
|
const parsed = wkt ? wktCrs(wkt) : { code: undefined, verticalScale: undefined };
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
if (
|
|
106
|
-
|
|
107
|
-
}
|
|
108
|
-
else if (code !== undefined) {
|
|
99
|
+
const crs = (() => {
|
|
100
|
+
if (options.crs !== undefined)
|
|
101
|
+
return getCrs(options.crs);
|
|
102
|
+
const code = parsed.code;
|
|
103
|
+
if (code === undefined)
|
|
104
|
+
throw new Error('the file names no CRS: give it as `crs`');
|
|
109
105
|
try {
|
|
110
|
-
|
|
106
|
+
return getCrs(`EPSG:${code}`);
|
|
111
107
|
}
|
|
112
108
|
catch {
|
|
113
109
|
throw new Error(`the CRS of the file, EPSG:${code}, is not built in: give it as \`crs\` (proj4('EPSG:${code}'))`);
|
|
114
110
|
}
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
throw new Error('the file names no CRS: give it as `crs`');
|
|
118
|
-
}
|
|
111
|
+
})();
|
|
112
|
+
const code = typeof options.crs === 'string' ? (epsgCode(options.crs) ?? parsed.code) : parsed.code;
|
|
119
113
|
const inverse = (xy) => {
|
|
120
114
|
const out = new Float64Array(xy.length);
|
|
121
115
|
for (let i = 0; i + 1 < xy.length; i += 2) {
|
|
@@ -130,17 +124,15 @@ export function pointCloudCrs(wkt, options) {
|
|
|
130
124
|
geoid: options.geoid ?? (FRENCH(code) || /IGN69|NGF/.test(wkt ?? '')),
|
|
131
125
|
verticalScale: options.verticalScale ?? parsed.verticalScale ?? 1,
|
|
132
126
|
};
|
|
133
|
-
}
|
|
127
|
+
};
|
|
134
128
|
/** The style numbers of the engine (`setPointCloudStyle`) */
|
|
135
|
-
|
|
129
|
+
const styleNumbers = (s, rate) => {
|
|
136
130
|
const colors = ['rgb', 'classification', 'elevation', 'intensity'];
|
|
137
|
-
|
|
138
|
-
if (s.edl)
|
|
139
|
-
edl = s.edl === true ? {} : s.edl;
|
|
131
|
+
const edl = s.edl === true ? {} : s.edl || undefined;
|
|
140
132
|
const [emin = Number.NaN, emax = Number.NaN] = s.elevationRange ?? [];
|
|
141
133
|
const [imin = Number.NaN, imax = Number.NaN] = s.intensityRange ?? [];
|
|
142
134
|
return Float64Array.of(s.colorBy ? colors.indexOf(s.colorBy) : -1, s.pointSize, s.maxPointSize, s.sizeMode === 'fixed' ? 0 : 1, s.shape === 'square' ? 0 : 1, edl ? (edl.strength ?? 1) : 0, edl?.radius ?? 1.4, emin, emax, imin, imax, s.maxScreenSpaceError, s.pointBudget, rate);
|
|
143
|
-
}
|
|
135
|
+
};
|
|
144
136
|
/** A point cloud (`GeoMap.addPointCloud`): COPC or 3D Tiles points; `pickFeature` gives a COPC point's attributes */
|
|
145
137
|
export class PointCloudLayer extends Layer {
|
|
146
138
|
url;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pointclouds.js","sourceRoot":"","sources":["../../src/layers/pointclouds.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAA0B,QAAQ,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAU1E,OAAO,EAAgB,UAAU,EAAa,UAAU,EAAE,MAAM,eAAe,CAAC;AAChF,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AA6DpC;iCACiC;AACjC,MAAM,CAAC,MAAM,eAAe,GAA6D;IACvF,CAAC,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE;IACtC,CAAC,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE;IACtC,CAAC,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,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AAC,CAAC;QAEhF,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QAEvB,OAAO,EAAE,CAAC;IACZ,CAAC;CACF","sourcesContent":["/**\n * Point clouds: a COPC file (Cloud Optimized Point Cloud: LAZ 1.4 with an octree, read by HTTP range requests, as the\n * IGN distributes LiDAR HD) or a 3D Tiles point cloud (`.pnts`, glTF points), drawn by the engine with 3D Tiles. The\n * COPC file's CRS comes from its WKT (built-in CRSs, or registered ones: `registerCrs`) or the `crs` option; altitudes\n * in NGF-IGN69 (Lambert-93, the CC zones) are raised by the RAF20 geoid height onto the ellipsoid of the relief and\n * the 3D Tiles.\n */\nimport { type Crs, type CrsLike, epsgCode, getCrs } from '../data/crs.ts';\nimport type { LayerHost } from '../types.ts';\nimport type {\n Engine,\n PointCloudCrs,\n PointCloudInfo,\n PointCloudPoint,\n PointCloudStats,\n Tiles3dStats,\n} from '../wasm/isard.js';\nimport { type Feature, parseColor, type Ramp, rampTexels } from './features.ts';\nimport { Layer } from './layers.ts';\n\n/** What the points are colored by */\nexport type PointColor = 'rgb' | 'classification' | 'elevation' | 'intensity';\n\n/** The look of a class of points */\nexport interface ClassStyle {\n /** CSS color */\n color?: string;\n /** false hides the class */\n visible?: boolean;\n}\n\nexport interface PointCloudStyle {\n /** By RGB (files with colors), class (the ASPRS palette, `classifications`), altitude (`elevationRamp` over\n * `elevationRange`) or intensity (grey over `intensityRange`). Default: RGB when the file has colors, else class */\n colorBy?: PointColor;\n /** CSS pixels: the size of the points, or the smallest with `sizeMode: 'adaptive'` (default 2) */\n pointSize: number;\n /** CSS pixels: the largest adaptive size (default 4) */\n maxPointSize: number;\n /** `'adaptive'` (default): the spacing of the points of the finest level drawn there, at their distance (the\n * nearer, the larger, no gap); `'fixed'`: `pointSize` everywhere */\n sizeMode: 'adaptive' | 'fixed';\n /** `'circle'` (default) or `'square'` */\n shape: 'circle' | 'square';\n /** Eye-Dome Lighting: points shaded by the depth of their neighbours on screen, their relief read without normals\n * nor colors (default false; `strength` 1, `radius` 1.4 CSS pixels) */\n edl: boolean | { strength?: number; radius?: number };\n /** Colors and visibility by class code, over the defaults (ASPRS, and IGN's LiDAR HD classes 64 to 67; the noise\n * 7 and 18 and the artefacts 65 hidden): `{ 2: { color: '#a0522d' }, 66: { visible: false } }` */\n classifications: Record<number, ClassStyle>;\n /** Altitudes (metres, the file's vertical datum) mapped onto the ramp; default the file's lowest and highest */\n elevationRange?: [min: number, max: number];\n /** Colors from the lowest altitude (0) to the highest (1) */\n elevationRamp: Ramp;\n /** Intensities mapped from black to white; default the bulk of the first node's (2nd to 98th percentile) */\n intensityRange?: [min: number, max: number];\n /** CSS pixels: a node is refined while the spacing of its points covers more on screen (default 1.5; lower is finer\n * and heavier). For 3D Tiles, their screen-space error (default 16) */\n maxScreenSpaceError: number;\n /** Points drawn at most, the nearest and the coarsest first (default 3 000 000) */\n pointBudget: number;\n}\n\nexport interface PointCloudOptions extends Partial<PointCloudStyle> {\n /** A COPC file (`.copc.laz`) or a 3D Tiles `tileset.json` of points */\n url: string;\n /** Default: `'3dtiles'` for a `.json` URL, else `'copc'` */\n format?: 'copc' | '3dtiles';\n /** The CRS of a COPC file without a WKT, or whose CRS is not built in (`proj4('EPSG:2992')`) */\n crs?: CrsLike;\n /** Its altitudes are above the geoid (NGF-IGN69), raised by the RAF20 geoid height; default for Lambert-93 and the\n * CC zones */\n geoid?: boolean;\n /** Metres of a unit of z; default the vertical unit of the WKT (a US survey foot…), else that of x and y */\n verticalScale?: number;\n /** Requests a second at most: 8 by default for the Géoplateforme (data.geopf.fr allows 10), no limit elsewhere */\n requestsPerSecond?: number;\n}\n\n/** The default classes: ASPRS LAS 1.4, then IGN's LiDAR HD (64 permanent structures, 65 artefacts, 66 virtual points,\n * 67 miscellaneous buildings) */\nexport const CLASSIFICATIONS: Readonly<Record<number, Readonly<Required<ClassStyle>>>> = {\n 0: { color: '#a6a6a6', visible: true },\n 1: { color: '#c8c8c8', visible: true },\n 2: { color: '#b08458', visible: true },\n 3: { color: '#9ccc65', visible: true },\n 4: { color: '#5aa83f', visible: true },\n 5: { color: '#2e7d32', visible: true },\n 6: { color: '#e57352', visible: true },\n 7: { color: '#ff00ff', visible: false },\n 8: { color: '#ff0000', visible: true },\n 9: { color: '#3d8fd6', visible: true },\n 10: { color: '#8e6bb0', visible: true },\n 11: { color: '#7a7a7a', visible: true },\n 12: { color: '#ffe680', visible: true },\n 13: { color: '#ffff00', visible: true },\n 14: { color: '#ffc800', visible: true },\n 15: { color: '#c89600', visible: true },\n 16: { color: '#ff9632', visible: true },\n 17: { color: '#b48cc8', visible: true },\n 18: { color: '#ff00ff', visible: false },\n 64: { color: '#8c6e5a', visible: true },\n 65: { color: '#ff00ff', visible: false },\n 66: { color: '#5a6ec8', visible: true },\n 67: { color: '#e6966e', visible: true },\n};\n\n/** The default ramp of the altitudes, low to high */\nexport const ELEVATION_RAMP: Ramp = [\n [0, '#2b83ba'],\n [0.25, '#abdda4'],\n [0.5, '#ffffbf'],\n [0.75, '#fdae61'],\n [1, '#d7191c'],\n];\n\n/** The colors of the 256 classes (RGBA, alpha 0 hides one) */\nexport const classPalette = (overrides: Record<number, ClassStyle> = {}): Uint8Array => {\n const out = new Uint8Array(256 * 4);\n\n for (let code = 0; code < 256; code += 1) {\n const base = CLASSIFICATIONS[code] ?? { color: '#c8c8c8', visible: true };\n const own = overrides[code] ?? {};\n const [r = 0, g = 0, b = 0] = parseColor(own.color ?? base.color);\n\n out.set([r * 255, g * 255, b * 255, (own.visible ?? base.visible) ? 255 : 0], code * 4);\n }\n\n return out;\n};\n\n/** The section of a WKT opening with one of `keywords` (`PROJCS[…]`), from its keyword to its closing bracket */\nconst section = (wkt: string, keywords: string[]): string | undefined => {\n for (const keyword of keywords) {\n const start = wkt.indexOf(`${keyword}[`);\n\n if (start < 0) continue;\n\n let depth = 0;\n\n for (let i = start + keyword.length; i < wkt.length; i += 1) {\n if (wkt[i] === '[') depth += 1;\n else if (wkt[i] === ']' && --depth === 0) return wkt.slice(start, i + 1);\n }\n }\n\n return undefined;\n};\n\n/** The EPSG code a WKT section ends with (its own `AUTHORITY`, or `ID` in WKT2), the last of its nested ones */\nconst lastCode = (part: string): number | undefined => {\n const codes = [...part.matchAll(/(?:AUTHORITY|ID)\\[\\s*\"EPSG\"\\s*,\\s*\"?(\\d+)\"?\\s*\\]/g)];\n const last = codes.at(-1)?.[1];\n\n return last === undefined ? undefined : Number(last);\n};\n\n/** The factor of the last `UNIT` (`LENGTHUNIT` in WKT2) of a WKT section */\nconst lastUnit = (part: string | undefined): number | undefined => {\n const units = [...(part ?? '').matchAll(/(?:LENGTH)?UNIT\\[\\s*\"[^\"]*\"\\s*,\\s*([\\d.eE+-]+)/g)];\n const factor = Number(units.at(-1)?.[1]);\n\n return Number.isFinite(factor) && factor > 0 ? factor : undefined;\n};\n\n/** What a WKT says of a CRS: its EPSG code (projected first), the metres of a unit of z */\nexport const wktCrs = (wkt: string): { code: number | undefined; verticalScale: number | undefined } => {\n const projected = section(wkt, ['PROJCS', 'PROJCRS']);\n const geographic = section(wkt, ['GEOGCS', 'GEOGCRS']);\n const code = lastCode(projected ?? geographic ?? '') ?? (/Lambert[- ]93/i.test(wkt) ? 2154 : undefined);\n const vertical = section(wkt, ['VERT_CS', 'VERTCRS']);\n const verticalScale = lastUnit(vertical ?? projected);\n\n return { code, verticalScale };\n};\n\n/** Whether the altitudes of a CRS are NGF-IGN69 by default: Lambert-93 and the CC zones */\nconst FRENCH = (code: number | undefined) => code === 2154 || (code !== undefined && code >= 3942 && code <= 3950);\n\n/** The CRS of a COPC file for the engine, from its WKT and the options */\nexport const pointCloudCrs = (\n wkt: string | undefined,\n options: Pick<PointCloudOptions, 'crs' | 'geoid' | 'verticalScale'>,\n): PointCloudCrs => {\n const parsed = wkt ? wktCrs(wkt) : { code: undefined, verticalScale: undefined };\n const crs = ((): Crs => {\n if (options.crs !== undefined) return getCrs(options.crs);\n\n const code = parsed.code;\n\n if (code === undefined) throw new Error('the file names no CRS: give it as `crs`');\n try {\n return getCrs(`EPSG:${code}`);\n } catch {\n throw new Error(`the CRS of the file, EPSG:${code}, is not built in: give it as \\`crs\\` (proj4('EPSG:${code}'))`);\n }\n })();\n const code = typeof options.crs === 'string' ? (epsgCode(options.crs) ?? parsed.code) : parsed.code;\n const inverse = (xy: Float64Array) => {\n const out = new Float64Array(xy.length);\n\n for (let i = 0; i + 1 < xy.length; i += 2) {\n const [lon = Number.NaN, lat = Number.NaN] = crs.inverse([xy[i] as number, xy[i + 1] as number]);\n\n out[i] = lon;\n out[i + 1] = lat;\n }\n\n return out;\n };\n\n return {\n inverse,\n geoid: options.geoid ?? (FRENCH(code) || /IGN69|NGF/.test(wkt ?? '')),\n verticalScale: options.verticalScale ?? parsed.verticalScale ?? 1,\n };\n};\n\n/** The style numbers of the engine (`setPointCloudStyle`) */\nconst styleNumbers = (s: PointCloudStyle, rate: number): Float64Array => {\n const colors: PointColor[] = ['rgb', 'classification', 'elevation', 'intensity'];\n const edl: { strength?: number; radius?: number } | undefined = s.edl === true ? {} : s.edl || undefined;\n const [emin = Number.NaN, emax = Number.NaN] = s.elevationRange ?? [];\n const [imin = Number.NaN, imax = Number.NaN] = s.intensityRange ?? [];\n\n return Float64Array.of(\n s.colorBy ? colors.indexOf(s.colorBy) : -1,\n s.pointSize,\n s.maxPointSize,\n s.sizeMode === 'fixed' ? 0 : 1,\n s.shape === 'square' ? 0 : 1,\n edl ? (edl.strength ?? 1) : 0,\n edl?.radius ?? 1.4,\n emin,\n emax,\n imin,\n imax,\n s.maxScreenSpaceError,\n s.pointBudget,\n rate,\n );\n};\n\n/** A point cloud (`GeoMap.addPointCloud`): COPC or 3D Tiles points; `pickFeature` gives a COPC point's attributes */\nexport class PointCloudLayer extends Layer {\n readonly url: string;\n readonly format: 'copc' | '3dtiles';\n private style: PointCloudStyle;\n private readonly options: PointCloudOptions;\n\n /** @internal */\n constructor(map: LayerHost, options: PointCloudOptions) {\n super(map);\n\n // Against the page: the decoding workers fetch it, and a relative URL would be theirs\n const base = typeof document === 'undefined' ? undefined : document.baseURI;\n\n this.url = base ? new URL(options.url, base).href : options.url;\n this.format = options.format ?? (/\\.json(?:[?#]|$)/i.test(options.url) ? '3dtiles' : 'copc');\n this.options = options;\n\n const tiles = this.format === '3dtiles';\n\n this.style = {\n ...(options.colorBy ? { colorBy: options.colorBy } : {}),\n pointSize: options.pointSize ?? 2,\n maxPointSize: options.maxPointSize ?? 4,\n sizeMode: options.sizeMode ?? 'adaptive',\n shape: options.shape ?? 'circle',\n edl: options.edl ?? false,\n classifications: options.classifications ?? {},\n ...(options.elevationRange ? { elevationRange: options.elevationRange } : {}),\n elevationRamp: options.elevationRamp ?? ELEVATION_RAMP,\n ...(options.intensityRange ? { intensityRange: options.intensityRange } : {}),\n maxScreenSpaceError: options.maxScreenSpaceError ?? (tiles ? 16 : 1.5),\n pointBudget: options.pointBudget ?? 3_000_000,\n };\n }\n\n /** @internal Drawn by the engine with 3D Tiles (the point cloud module loads with the first one) */\n override get needsFullEngine(): boolean {\n return true;\n }\n\n /** Changes the style, the rest kept */\n setStyle(style: Partial<PointCloudStyle>): void {\n this.style = { ...this.style, ...style };\n // Kept for its creation while the engine with 3D Tiles loads\n if (this.id < 0) return;\n this.apply(this.map.engine, this.id);\n this.map.requestRender();\n }\n\n getStyle(): Readonly<PointCloudStyle> {\n return this.style;\n }\n\n /** Loading counters; undefined once removed and while the engine with 3D Tiles loads */\n stats(): PointCloudStats | Tiles3dStats | undefined {\n if (this.id < 0) return undefined;\n\n return this.format === '3dtiles' ? this.map.engine.tiles3dStats(this.id) : this.map.engine.pointCloudStats(this.id);\n }\n\n /** What a COPC file says of itself (points, format, CRS, center, altitudes), once its head is read */\n info(): PointCloudInfo | undefined {\n return this.id < 0 || this.format === '3dtiles' ? undefined : this.map.engine.pointCloudInfo(this.id);\n }\n\n /** @internal The point picked (`pickFeature`, 'hoverfeature'): a Point at its longitude, latitude and height, its\n * attributes as properties */\n featureAt(index: number): Feature<PointCloudPoint> | undefined {\n if (this.id < 0 || this.format === '3dtiles') return undefined;\n\n const point = this.map.engine.pointCloudPoint(this.id, index);\n\n if (!point) return undefined;\n\n return {\n type: 'Feature',\n geometry: { type: 'Point', coordinates: [...point.lonLat, point.height] },\n properties: point,\n };\n }\n\n private apply(engine: Engine, id: number): void {\n const s = this.style;\n\n if (this.format === '3dtiles') {\n engine.setTiles3dStyle(id, s.maxScreenSpaceError, 1, s.pointSize, new Float32Array());\n\n return;\n }\n\n const rate = this.options.requestsPerSecond ?? (/^https?:\\/\\/data\\.geopf\\.fr\\//.test(this.url) ? 8 : 0);\n\n engine.setPointCloudStyle(\n id,\n styleNumbers(s, rate),\n classPalette(s.classifications),\n rampTexels(s.elevationRamp).rgba,\n );\n }\n\n /** @internal */\n protected create(engine: Engine): number {\n const id =\n this.format === '3dtiles'\n ? engine.addTiles3d(this.url, this.style.maxScreenSpaceError)\n : engine.addPointCloud(this.url, (wkt) => pointCloudCrs(wkt, this.options));\n\n this.apply(engine, id);\n\n return id;\n }\n}\n"]}
|
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
* data order), drawn with a halo, standing on the relief. The icons are the map's images (`map.addImage`, a vector
|
|
5
5
|
* basemap's sprite), beside their text or stretched around it.
|
|
6
6
|
*/
|
|
7
|
+
import type { LayerHost } from '../types.ts';
|
|
8
|
+
import type { Anchor } from '../ui/overlay.ts';
|
|
7
9
|
import { type Feature, type FeatureData, type FeatureLayerStyle, type Placement, type Properties, type Size, type Styled } from './features.ts';
|
|
8
10
|
import { type Glyphs, type TextPart } from './glyphs.ts';
|
|
9
11
|
import { type Icons } from './icons.ts';
|
|
10
12
|
import { Layer } from './layers.ts';
|
|
11
|
-
import type { Anchor } from './overlay.ts';
|
|
12
|
-
import type { LayerHost } from './types.ts';
|
|
13
13
|
export interface SymbolStyle<P = Properties> extends Omit<FeatureLayerStyle<P>, 'ramp'> {
|
|
14
14
|
/** The text: a string (`\n` breaks lines) or runs with their own scale and font; empty: no label */
|
|
15
15
|
text: Styled<string | TextPart[], P>;
|
|
@@ -103,4 +103,4 @@ export declare class SymbolLayer<P = Properties> extends Layer {
|
|
|
103
103
|
private send;
|
|
104
104
|
private sendLayer;
|
|
105
105
|
}
|
|
106
|
-
export declare
|
|
106
|
+
export declare const symbolStyle: <P>(options: SymbolOptions<P>) => SymbolStyle<P>;
|
|
@@ -4,18 +4,18 @@
|
|
|
4
4
|
* data order), drawn with a halo, standing on the relief. The icons are the map's images (`map.addImage`, a vector
|
|
5
5
|
* basemap's sprite), beside their text or stretched around it.
|
|
6
6
|
*/
|
|
7
|
+
import { toMercator } from "../util/geo.js";
|
|
7
8
|
import { evaluate, featuresOf, parseColor, stops, } from "./features.js";
|
|
8
|
-
import { toMercator } from "./geo.js";
|
|
9
9
|
import { codes, DEFAULT_FONT, shape } from "./glyphs.js";
|
|
10
10
|
import { layoutIcon } from "./icons.js";
|
|
11
11
|
import { Layer } from "./layers.js";
|
|
12
12
|
/** Where a geometry is labelled: its points, the middle of its longest line (with the direction of the line there),
|
|
13
13
|
* the centroid of its largest polygon */
|
|
14
|
-
|
|
14
|
+
const anchors = (geometry) => {
|
|
15
15
|
return points(geometry).map((p) => (p.length > 2 ? { at: [p[0], p[1]], along: [p[2] ?? 0, p[3] ?? 0] } : { at: p }));
|
|
16
|
-
}
|
|
16
|
+
};
|
|
17
17
|
/** Anchors as positions, a line's carrying the direction (lon, lat, dlon, dlat) */
|
|
18
|
-
|
|
18
|
+
const points = (geometry) => {
|
|
19
19
|
if (!geometry)
|
|
20
20
|
return [];
|
|
21
21
|
switch (geometry.type) {
|
|
@@ -67,7 +67,7 @@ function points(geometry) {
|
|
|
67
67
|
case 'GeometryCollection':
|
|
68
68
|
return geometry.geometries.flatMap(points);
|
|
69
69
|
}
|
|
70
|
-
}
|
|
70
|
+
};
|
|
71
71
|
/** Flags of a label for the engine (`flag` in symbols.rs) */
|
|
72
72
|
const FLAG = {
|
|
73
73
|
textOverlap: 1,
|
|
@@ -83,20 +83,20 @@ const FLAG = {
|
|
|
83
83
|
iconUpright: 1024,
|
|
84
84
|
};
|
|
85
85
|
/** Flags of an overlap: allowed to overlap, ignored by the placement */
|
|
86
|
-
|
|
86
|
+
const overlapFlags = (overlap, allow, ignore) => {
|
|
87
87
|
if (overlap === true)
|
|
88
88
|
return allow | ignore;
|
|
89
89
|
if (overlap === 'allow')
|
|
90
90
|
return allow;
|
|
91
91
|
return overlap === 'ignore' ? ignore : 0;
|
|
92
|
-
}
|
|
92
|
+
};
|
|
93
93
|
/** Room around an icon's box, CSS pixels (MapLibre's default `icon-padding`) */
|
|
94
94
|
const ICON_PADDING = 2;
|
|
95
95
|
/** Numbers per quad: its label's index, its place, its atlas coordinates, its scale (a glyph's; -1 or -2: an icon),
|
|
96
96
|
* its turn */
|
|
97
97
|
const QUAD = 11;
|
|
98
98
|
/** Every character of a run has its glyph */
|
|
99
|
-
|
|
99
|
+
const present = (part, loaded) => {
|
|
100
100
|
const glyphs = loaded.get(part.font ?? DEFAULT_FONT);
|
|
101
101
|
if (!glyphs)
|
|
102
102
|
return false;
|
|
@@ -104,9 +104,9 @@ function present(part, loaded) {
|
|
|
104
104
|
if (ch !== '\n' && !glyphs.has(ch.codePointAt(0) ?? 32))
|
|
105
105
|
return false;
|
|
106
106
|
return true;
|
|
107
|
-
}
|
|
107
|
+
};
|
|
108
108
|
/** The labels of chunks one after the other, the quads' label indices moved past those of the chunks before */
|
|
109
|
-
|
|
109
|
+
const concat = (chunks) => {
|
|
110
110
|
if (chunks.length === 1 && chunks[0])
|
|
111
111
|
return chunks[0];
|
|
112
112
|
const length = (key) => chunks.reduce((n, c) => n + c[key].length, 0);
|
|
@@ -133,7 +133,7 @@ function concat(chunks) {
|
|
|
133
133
|
labels += c.count;
|
|
134
134
|
}
|
|
135
135
|
return out;
|
|
136
|
-
}
|
|
136
|
+
};
|
|
137
137
|
export class SymbolLayer extends Layer {
|
|
138
138
|
host;
|
|
139
139
|
style;
|
|
@@ -211,8 +211,7 @@ export class SymbolLayer extends Layer {
|
|
|
211
211
|
const keep = this.groups !== undefined;
|
|
212
212
|
const glyphs = this.host.glyphs;
|
|
213
213
|
const todo = [];
|
|
214
|
-
|
|
215
|
-
for (const group of groups) {
|
|
214
|
+
groups.reduce((base, group) => {
|
|
216
215
|
const c = keep ? this.chunks.get(group) : undefined;
|
|
217
216
|
const valid = c !== undefined &&
|
|
218
217
|
c.style === this.styleGeneration &&
|
|
@@ -220,18 +219,19 @@ export class SymbolLayer extends Layer {
|
|
|
220
219
|
(c.complete || (c.glyphs === glyphs.version && c.icons === this.host.icons.version));
|
|
221
220
|
if (!valid)
|
|
222
221
|
todo.push({ group, base, parts: this.parts(group, base) });
|
|
223
|
-
base
|
|
224
|
-
}
|
|
222
|
+
return base + group.length;
|
|
223
|
+
}, 0);
|
|
225
224
|
const byFont = new Map();
|
|
226
|
-
|
|
227
|
-
|
|
225
|
+
todo.forEach(({ parts }) => {
|
|
226
|
+
parts.flat().forEach((p) => {
|
|
228
227
|
const key = p.font ?? DEFAULT_FONT;
|
|
229
228
|
const set = byFont.get(key) ?? new Set();
|
|
230
|
-
|
|
229
|
+
codes([p]).forEach((code) => {
|
|
231
230
|
set.add(code);
|
|
231
|
+
});
|
|
232
232
|
byFont.set(key, set);
|
|
233
|
-
}
|
|
234
|
-
}
|
|
233
|
+
});
|
|
234
|
+
});
|
|
235
235
|
const loaded = new Map();
|
|
236
236
|
await Promise.all([...byFont].map(async ([f, set]) => {
|
|
237
237
|
loaded.set(f, await glyphs.load(f, set));
|
|
@@ -239,13 +239,13 @@ export class SymbolLayer extends Layer {
|
|
|
239
239
|
if (generation !== this.generation)
|
|
240
240
|
return;
|
|
241
241
|
const built = new Map();
|
|
242
|
-
|
|
242
|
+
todo.forEach(({ group, base: b, parts }) => {
|
|
243
243
|
const chunk = this.build(group, b, parts, loaded);
|
|
244
244
|
built.set(group, chunk);
|
|
245
245
|
if (keep)
|
|
246
246
|
this.chunks.set(group, chunk);
|
|
247
|
-
}
|
|
248
|
-
this.labels = concat(groups.map((g) => built.get(g) ?? this.chunks.get(g)));
|
|
247
|
+
});
|
|
248
|
+
this.labels = concat(groups.map((g) => built.get(g) ?? this.chunks.get(g)).filter((c) => c !== undefined));
|
|
249
249
|
// The icons packed for them
|
|
250
250
|
this.host.icons.flush();
|
|
251
251
|
this.send(this.map.engine, this.id);
|
|
@@ -285,40 +285,41 @@ export class SymbolLayer extends Layer {
|
|
|
285
285
|
const s0 = evaluate(size, p, i);
|
|
286
286
|
const shaped = shapedAt(s0);
|
|
287
287
|
const scale = scaleOf(s0, shaped);
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
s = shape(text, (name) => loaded.get(name), {
|
|
288
|
+
const shaping = hasText && text
|
|
289
|
+
? shape(text, (name) => loaded.get(name), {
|
|
291
290
|
font: evaluate(font, p, i),
|
|
292
291
|
size: shaped,
|
|
293
292
|
maxWidth: evaluate(maxWidth, p, i),
|
|
294
293
|
lineHeight: evaluate(lineHeight, p, i),
|
|
295
294
|
anchor: evaluate(anchor, p, i),
|
|
296
295
|
offset: evaluate(offset, p, i),
|
|
297
|
-
})
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
}
|
|
296
|
+
})
|
|
297
|
+
: undefined;
|
|
298
|
+
const s = shaping?.quads.length ? shaping : undefined;
|
|
301
299
|
if (!s && !icon)
|
|
302
300
|
return;
|
|
303
301
|
const along = evaluate(placement, p, i) === 'line';
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
if (s)
|
|
308
|
-
flags |= FLAG.text;
|
|
302
|
+
const textFlags = overlapFlags(evaluate(overlap, p, i), FLAG.textOverlap, FLAG.textIgnore) |
|
|
303
|
+
(evaluate(st.textOptional, p, i) ? FLAG.textOptional : 0) |
|
|
304
|
+
(s ? FLAG.text : 0);
|
|
309
305
|
// The icon: beside its text, or stretched around it (then scaled and turned with it)
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
306
|
+
const { iconScale, iconBox, iconColor, quads, iconTurns, fitted, iconFlags } = (() => {
|
|
307
|
+
const none = {
|
|
308
|
+
iconScale: 1,
|
|
309
|
+
iconBox: [0, 0, 0, 0],
|
|
310
|
+
iconColor: [0, 0, 0, 0],
|
|
311
|
+
quads: [],
|
|
312
|
+
iconTurns: false,
|
|
313
|
+
fitted: false,
|
|
314
|
+
iconFlags: 0,
|
|
315
|
+
};
|
|
316
|
+
if (!icon)
|
|
317
|
+
return none;
|
|
317
318
|
const fit = evaluate(st.iconTextFit, p, i);
|
|
318
|
-
fitted = fit !== 'none' && s !== undefined;
|
|
319
|
+
const fitted = fit !== 'none' && s !== undefined;
|
|
319
320
|
const i0 = evaluate(st.iconSize, p, i);
|
|
320
321
|
const iconShaped = fitted ? 1 : shapedAt(i0);
|
|
321
|
-
iconScale = fitted ? scale : scaleOf(i0, iconShaped);
|
|
322
|
+
const iconScale = fitted ? scale : scaleOf(i0, iconShaped);
|
|
322
323
|
const laid = layoutIcon(icon, {
|
|
323
324
|
size: iconShaped,
|
|
324
325
|
anchor: evaluate(st.iconAnchor, p, i),
|
|
@@ -328,25 +329,28 @@ export class SymbolLayer extends Layer {
|
|
|
328
329
|
padding: evaluate(st.iconTextFitPadding, p, i),
|
|
329
330
|
text: s?.layout,
|
|
330
331
|
});
|
|
331
|
-
|
|
332
|
-
if (quads.length)
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
332
|
+
const laidOut = { ...none, fitted, iconScale, quads: laid.quads };
|
|
333
|
+
if (!laid.quads.length)
|
|
334
|
+
return laidOut;
|
|
335
|
+
const iconFlags = FLAG.icon |
|
|
336
|
+
overlapFlags(evaluate(st.iconOverlap, p, i), FLAG.iconOverlap, FLAG.iconIgnore) |
|
|
337
|
+
(evaluate(st.iconOptional, p, i) ? FLAG.iconOptional : 0);
|
|
338
|
+
const alignment = evaluate(st.iconRotationAlignment, p, i);
|
|
339
|
+
const [r, g, b, a] = parseColor(evaluate(st.iconColor, p, i));
|
|
340
|
+
return {
|
|
341
|
+
...laidOut,
|
|
342
|
+
iconFlags: iconFlags | (fitted ? FLAG.iconUpright : 0),
|
|
343
|
+
iconTurns: alignment === 'map' || (alignment === 'auto' && along),
|
|
344
|
+
iconBox: [
|
|
341
345
|
laid.box[0] - ICON_PADDING,
|
|
342
346
|
laid.box[1] - ICON_PADDING,
|
|
343
347
|
laid.box[2] + ICON_PADDING,
|
|
344
348
|
laid.box[3] + ICON_PADDING,
|
|
345
|
-
]
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
349
|
+
],
|
|
350
|
+
iconColor: [r, g, b, a * Math.max(0, Math.min(1, evaluate(st.iconOpacity, p, i)))],
|
|
351
|
+
};
|
|
352
|
+
})();
|
|
353
|
+
const flags = textFlags | iconFlags;
|
|
350
354
|
if (!(flags & (FLAG.text | FLAG.icon)))
|
|
351
355
|
return;
|
|
352
356
|
const halo = s ? evaluate(haloWidth, p, i) : 0;
|
|
@@ -363,18 +367,11 @@ export class SymbolLayer extends Layer {
|
|
|
363
367
|
// point), or with its text when fitted to it
|
|
364
368
|
const textAlong = along && line !== undefined && s !== undefined;
|
|
365
369
|
const iconAlong = (flags & FLAG.icon) !== 0 && (fitted ? textAlong : iconTurns);
|
|
366
|
-
let labelFlags = flags | (textAlong ? FLAG.textAlong : 0) | (iconAlong ? FLAG.iconAlong : 0);
|
|
367
370
|
// The direction of its line in Mercator (y towards the south)
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
}
|
|
373
|
-
else if (iconAlong) {
|
|
374
|
-
direction = [1, 0];
|
|
375
|
-
}
|
|
376
|
-
if (direction[0] === 0 && direction[1] === 0)
|
|
377
|
-
labelFlags &= ~(FLAG.textAlong | FLAG.iconAlong);
|
|
371
|
+
const end = line && (textAlong || iconAlong) ? toMercator([at[0] + line[0], at[1] + line[1]]) : undefined;
|
|
372
|
+
const direction = end ? [end[0] - x, end[1] - y] : [iconAlong ? 1 : 0, 0];
|
|
373
|
+
const alongFlags = (textAlong ? FLAG.textAlong : 0) | (iconAlong ? FLAG.iconAlong : 0);
|
|
374
|
+
const labelFlags = flags | (direction[0] === 0 && direction[1] === 0 ? 0 : alongFlags);
|
|
378
375
|
boxes.push(...textBox);
|
|
379
376
|
styles.push(...fill, ...haloRgba, halo, labelFlags, ...direction, ...stops(scale), ...iconBox, ...iconColor, ...stops(iconScale));
|
|
380
377
|
for (const q of quads)
|
|
@@ -422,7 +419,7 @@ export class SymbolLayer extends Layer {
|
|
|
422
419
|
return id;
|
|
423
420
|
}
|
|
424
421
|
}
|
|
425
|
-
export
|
|
422
|
+
export const symbolStyle = (options) => {
|
|
426
423
|
const { data: _, before: __, ...rest } = options;
|
|
427
424
|
return {
|
|
428
425
|
opacity: 1,
|
|
@@ -457,5 +454,5 @@ export function symbolStyle(options) {
|
|
|
457
454
|
iconOpacity: 1,
|
|
458
455
|
...rest,
|
|
459
456
|
};
|
|
460
|
-
}
|
|
457
|
+
};
|
|
461
458
|
//# sourceMappingURL=symbols.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"symbols.js","sourceRoot":"","sources":["../../src/layers/symbols.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C,OAAO,EACL,QAAQ,EAIR,UAAU,EAKV,UAAU,EAGV,KAAK,GACN,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,KAAK,EAAE,YAAY,EAAyC,KAAK,EAAiB,MAAM,aAAa,CAAC;AAC/G,OAAO,EAAc,UAAU,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAgEpC;yCACyC;AACzC,MAAM,OAAO,GAAG,CAAC,QAAyB,EAAgD,EAAE;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E,GAAG,OAAO,CAAC;IAEjD,OAAO;QACL,OAAO,EAAE,CAAC;QACV,OAAO,EAAE,CAAC;QACV,OAAO,EAAE,EAAE;QACX,OAAO,EAAE,IAAI;QACb,MAAM,EAAE,SAAS;QACjB,IAAI,EAAE,EAAE;QACR,IAAI,EAAE,YAAY;QAClB,IAAI,EAAE,EAAE;QACR,KAAK,EAAE,MAAM;QACb,SAAS,EAAE,MAAM;QACjB,SAAS,EAAE,CAAC;QACZ,MAAM,EAAE,QAAQ;QAChB,SAAS,EAAE,OAAO;QAClB,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;QACd,QAAQ,EAAE,EAAE;QACZ,UAAU,EAAE,GAAG;QACf,OAAO,EAAE,KAAK;QACd,YAAY,EAAE,KAAK;QACnB,IAAI,EAAE,EAAE;QACR,QAAQ,EAAE,CAAC;QACX,UAAU,EAAE,QAAQ;QACpB,UAAU,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;QAClB,UAAU,EAAE,CAAC;QACb,qBAAqB,EAAE,MAAM;QAC7B,WAAW,EAAE,KAAK;QAClB,YAAY,EAAE,KAAK;QACnB,WAAW,EAAE,MAAM;QACnB,kBAAkB,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;QAChC,SAAS,EAAE,MAAM;QACjB,WAAW,EAAE,CAAC;QACd,GAAG,IAAI;KACR,CAAC;AACJ,CAAC,CAAC","sourcesContent":["/**\n * Text labels and icons from GeoJSON: at points, at the middle of lines, at the center of polygons. Shaped on the page,\n * placed by the engine every frame with collisions shared by all symbol layers (the top layer first, each layer in\n * data order), drawn with a halo, standing on the relief. The icons are the map's images (`map.addImage`, a vector\n * basemap's sprite), beside their text or stretched around it.\n */\n\nimport type { LayerHost } from '../types.ts';\nimport type { Anchor } from '../ui/overlay.ts';\nimport { toMercator } from '../util/geo.ts';\nimport type { Engine } from '../wasm/isard.js';\nimport {\n evaluate,\n type Feature,\n type FeatureData,\n type FeatureLayerStyle,\n featuresOf,\n type Geometry,\n type Placement,\n type Position,\n type Properties,\n parseColor,\n type Size,\n type Styled,\n stops,\n} from './features.ts';\nimport { codes, DEFAULT_FONT, type Glyph, type Glyphs, type Shaping, shape, type TextPart } from './glyphs.ts';\nimport { type Icons, layoutIcon } from './icons.ts';\nimport { Layer } from './layers.ts';\n\nexport interface SymbolStyle<P = Properties> extends Omit<FeatureLayerStyle<P>, 'ramp'> {\n /** The text: a string (`\\n` breaks lines) or runs with their own scale and font; empty: no label */\n text: Styled<string | TextPart[], P>;\n /** A font of the map's glyphs (default `Noto Sans Regular`; also Bold and Italic with the default glyphs) */\n font: Styled<string, P>;\n /** CSS pixels, or zoom stops (default 12) */\n size: Styled<Size, P>;\n /** `'point'` (default): horizontal text; `'line'`: along the line at its middle, kept upright */\n placement: Styled<'point' | 'line', P>;\n color: Styled<string, P>;\n haloColor: Styled<string, P>;\n /** CSS pixels (default 0) */\n haloWidth: Styled<number, P>;\n /** Side of the text at the anchor (default `'center'`) */\n anchor: Styled<Anchor, P>;\n /** Shift, ems (default [0, 0]) */\n offset: Styled<[x: number, y: number], P>;\n /** Wrapping width, ems (default 10) */\n maxWidth: Styled<number, P>;\n /** Ems (default 1.2) */\n lineHeight: Styled<number, P>;\n /** Shown even where it overlaps other labels, and hiding none (MapLibre's allow-overlap and ignore-placement);\n * `'allow'`: shown even where it overlaps, still hiding the labels after it; `'ignore'`: shown only where it fits,\n * hiding none (default false) */\n overlap: Styled<Overlap, P>;\n /** Shown without its icon where the icon does not fit (default false) */\n textOptional: Styled<boolean, P>;\n /** An image of the map (`map.addImage`); empty: none (default) */\n icon: Styled<string, P>;\n /** Scale of the image, or zoom stops (default 1) */\n iconSize: Styled<Size, P>;\n /** Side of the icon at the anchor (default `'center'`) */\n iconAnchor: Styled<Anchor, P>;\n /** Shift, CSS pixels at size 1 (default [0, 0]) */\n iconOffset: Styled<[x: number, y: number], P>;\n /** Degrees, clockwise (default 0) */\n iconRotate: Styled<number, P>;\n /** `'viewport'`: facing the screen; `'map'`: turning with the map, along its line when placed on one; `'auto'`\n * (default): `'map'` with the `'line'` placement */\n iconRotationAlignment: Styled<'map' | 'viewport' | 'auto', P>;\n /** As `overlap`, for the icon (default false) */\n iconOverlap: Styled<Overlap, P>;\n /** Shown without its text where the text does not fit (default false) */\n iconOptional: Styled<boolean, P>;\n /** Stretched around its text: its width, its height, both (a road shield; `'none'` by default) */\n iconTextFit: Styled<'none' | 'width' | 'height' | 'both', P>;\n /** Room around the text of a fitted icon: top, right, bottom, left (CSS pixels, default 0) */\n iconTextFitPadding: Styled<[top: number, right: number, bottom: number, left: number], P>;\n /** Color of a signed distance field image (default black) */\n iconColor: Styled<string, P>;\n /** 0 to 1 (default 1) */\n iconOpacity: Styled<number, P>;\n}\n\n/** How a label's text or icon meets the others: `true` shown wherever and hiding none, `'allow'` shown wherever,\n * `'ignore'` hiding none, `false` neither (MapLibre's allow-overlap and ignore-placement) */\nexport type Overlap = boolean | 'allow' | 'ignore';\n\nexport interface SymbolOptions<P = Properties> extends Partial<SymbolStyle<P>>, Placement {\n data: FeatureData<P>;\n}\n\n/** Where a geometry is labelled: its points, the middle of its longest line (with the direction of the line there),\n * the centroid of its largest polygon */\nconst anchors = (geometry: Geometry | null): { at: Position; along?: [number, number] }[] => {\n return points(geometry).map((p) => (p.length > 2 ? { at: [p[0], p[1]], along: [p[2] ?? 0, p[3] ?? 0] } : { at: p }));\n};\n\n/** The icon of a label as packed: its scale, box, color, quads and flags */\ninterface LaidIcon {\n iconScale: Size;\n iconBox: [number, number, number, number];\n iconColor: [number, number, number, number];\n quads: number[][];\n iconTurns: boolean;\n fitted: boolean;\n iconFlags: number;\n}\n\n/** Anchors as positions, a line's carrying the direction (lon, lat, dlon, dlat) */\nconst points = (geometry: Geometry | null): Position[] => {\n if (!geometry) return [];\n switch (geometry.type) {\n case 'Point':\n return [geometry.coordinates];\n case 'MultiPoint':\n return geometry.coordinates;\n case 'LineString':\n case 'MultiLineString': {\n const lines = geometry.type === 'LineString' ? [geometry.coordinates] : geometry.coordinates;\n const length = (l: Position[]) =>\n l.slice(1).reduce((s, p, i) => s + Math.hypot(p[0] - (l[i]?.[0] ?? 0), p[1] - (l[i]?.[1] ?? 0)), 0);\n const line = lines.reduce((a, b) => (length(b) > length(a) ? b : a), lines[0] ?? []);\n let rest = length(line) / 2;\n\n for (let i = 1; i < line.length; i += 1) {\n const [a, b] = [line[i - 1], line[i]];\n\n if (!a || !b) continue;\n\n const d = Math.hypot(b[0] - a[0], b[1] - a[1]);\n\n if (d >= rest && d > 0) {\n return [[a[0] + ((b[0] - a[0]) * rest) / d, a[1] + ((b[1] - a[1]) * rest) / d, b[0] - a[0], b[1] - a[1]]];\n }\n rest -= d;\n }\n\n return line[0] ? [line[0]] : [];\n }\n case 'Polygon':\n case 'MultiPolygon': {\n const polygons = geometry.type === 'Polygon' ? [geometry.coordinates] : geometry.coordinates;\n let best: Position | undefined;\n let bestArea = 0;\n\n for (const p of polygons) {\n const ring = p[0] ?? [];\n let [a, cx, cy] = [0, 0, 0];\n\n for (let i = 0; i + 1 < ring.length; i += 1) {\n const [x0, y0] = ring[i] ?? [0, 0];\n const [x1, y1] = ring[i + 1] ?? [0, 0];\n const cross = x0 * y1 - x1 * y0;\n\n a += cross;\n cx += (x0 + x1) * cross;\n cy += (y0 + y1) * cross;\n }\n if (Math.abs(a) > bestArea) {\n bestArea = Math.abs(a);\n best = [cx / (3 * a), cy / (3 * a)];\n }\n }\n\n return best ? [best] : [];\n }\n case 'GeometryCollection':\n return geometry.geometries.flatMap(points);\n }\n};\n\n/** The map's glyphs and icons, for a layer */\nexport interface GlyphHost extends LayerHost {\n readonly glyphs: Glyphs;\n readonly icons: Icons;\n}\n\n/** Flags of a label for the engine (`flag` in symbols.rs) */\nconst FLAG = {\n textOverlap: 1,\n textIgnore: 2,\n iconOverlap: 4,\n iconIgnore: 8,\n textOptional: 16,\n iconOptional: 32,\n text: 64,\n icon: 128,\n textAlong: 256,\n iconAlong: 512,\n iconUpright: 1024,\n} as const;\n\n/** Flags of an overlap: allowed to overlap, ignored by the placement */\nconst overlapFlags = (overlap: Overlap, allow: number, ignore: number): number => {\n if (overlap === true) return allow | ignore;\n if (overlap === 'allow') return allow;\n\n return overlap === 'ignore' ? ignore : 0;\n};\n\n/** Room around an icon's box, CSS pixels (MapLibre's default `icon-padding`) */\nconst ICON_PADDING = 2;\n\n/** Labels built for the engine: an anchor (Mercator x, y), a collision box, a style per label; glyph quads whose first\n * number is their label's index */\ninterface Labels {\n anchors: Float64Array;\n boxes: Float32Array;\n styles: Float32Array;\n quads: Float32Array;\n}\n\n/** Numbers per quad: its label's index, its place, its atlas coordinates, its scale (a glyph's; -1 or -2: an icon),\n * its turn */\nconst QUAD = 11;\n\n/** The labels of a group of features, kept while they stay valid: same style, the same index of the group's first\n * feature (unless the style reads no index), and their glyphs and icons complete or none added since */\ninterface Chunk extends Labels {\n count: number;\n style: number;\n base: number;\n glyphs: number;\n icons: number;\n complete: boolean;\n}\n\n/** Every character of a run has its glyph */\nconst present = (part: TextPart, loaded: Map<string, Map<number, Glyph>>): boolean => {\n const glyphs = loaded.get(part.font ?? DEFAULT_FONT);\n\n if (!glyphs) return false;\n for (const ch of part.text) if (ch !== '\\n' && !glyphs.has(ch.codePointAt(0) ?? 32)) return false;\n\n return true;\n};\n\n/** The labels of chunks one after the other, the quads' label indices moved past those of the chunks before */\nconst concat = (chunks: readonly Chunk[]): Labels => {\n if (chunks.length === 1 && chunks[0]) return chunks[0];\n\n const length = (key: keyof Labels) => chunks.reduce((n, c) => n + c[key].length, 0);\n const out: Labels = {\n anchors: new Float64Array(length('anchors')),\n boxes: new Float32Array(length('boxes')),\n styles: new Float32Array(length('styles')),\n quads: new Float32Array(length('quads')),\n };\n const at = { anchors: 0, boxes: 0, styles: 0, quads: 0 };\n let labels = 0;\n\n for (const c of chunks) {\n out.anchors.set(c.anchors, at.anchors);\n out.boxes.set(c.boxes, at.boxes);\n out.styles.set(c.styles, at.styles);\n out.quads.set(c.quads, at.quads);\n if (labels > 0)\n for (let q = at.quads; q < at.quads + c.quads.length; q += QUAD) out.quads[q] = (out.quads[q] ?? 0) + labels;\n at.anchors += c.anchors.length;\n at.boxes += c.boxes.length;\n at.styles += c.styles.length;\n at.quads += c.quads.length;\n labels += c.count;\n }\n\n return out;\n};\n\nexport class SymbolLayer<P = Properties> extends Layer {\n private list: Feature<P>[];\n /** The features in groups that do not change (`setGroups`): each group's labels kept between updates */\n private groups: readonly (readonly Feature<P>[])[] | undefined;\n private readonly chunks = new WeakMap<readonly Feature<P>[], Chunk>();\n /** Bumped by each change: a shaping that finished after a newer one began is dropped */\n private generation = 0;\n /** Bumped by each change of style: the labels kept are shaped again */\n private styleGeneration = 0;\n /** No style function takes the index of a feature: a group's labels do not depend on its place */\n private indexFree = true;\n private labels: Labels | undefined;\n\n /** @internal */\n constructor(\n private readonly host: GlyphHost,\n data: FeatureData<P>,\n private style: SymbolStyle<P>,\n ) {\n super(host);\n this.list = featuresOf(data);\n this.styled();\n }\n\n get features(): readonly Feature<P>[] {\n return this.list;\n }\n\n setData(data: FeatureData<P>): void {\n this.list = featuresOf(data);\n this.groups = undefined;\n void this.update();\n }\n\n /**\n * @internal The features as groups that are never changed once given (the labels of a vector tile and style layer),\n * in order: the labels of a group seen before are not shaped again\n */\n setGroups(groups: readonly (readonly Feature<P>[])[]): void {\n this.groups = groups;\n this.list = groups.flat();\n void this.update();\n }\n\n setStyle(style: Partial<SymbolStyle<P>>): void {\n this.style = { ...this.style, ...style };\n this.styled();\n void this.update();\n }\n\n setFilter(filter: ((properties: P, index: number) => boolean) | undefined): void {\n this.setStyle({ filter });\n }\n\n setVisible(visible: boolean): void {\n this.style = { ...this.style, visible };\n this.sendLayer(this.map.engine, this.id);\n this.map.requestRender();\n }\n\n private styled(): void {\n this.styleGeneration += 1;\n // A function of one parameter reads the properties only\n this.indexFree = Object.values(this.style).every((v) => typeof v !== 'function' || v.length < 2);\n }\n\n /** The runs of text of each feature of a group (none for a feature filtered out) */\n private parts(group: readonly Feature<P>[], base: number): TextPart[][] {\n const { text, font, filter } = this.style;\n\n return group.map((f, k): TextPart[] => {\n const i = base + k;\n\n if (filter && !filter(f.properties, i)) return [];\n\n const t = evaluate(text, f.properties, i);\n const own = evaluate(font, f.properties, i);\n\n // Each run in its font, the feature's by default\n return (typeof t === 'string' ? [{ text: t }] : t).map((p) => ({ ...p, font: p.font ?? own }));\n });\n }\n\n /** Shapes the labels (loading their glyphs first) and sends them; the groups' labels still valid are kept */\n private async update(): Promise<void> {\n const generation = ++this.generation;\n const groups = this.groups ?? [this.list];\n const keep = this.groups !== undefined;\n const glyphs = this.host.glyphs;\n const todo: { group: readonly Feature<P>[]; base: number; parts: TextPart[][] }[] = [];\n\n groups.reduce((base, group) => {\n const c = keep ? this.chunks.get(group) : undefined;\n const valid =\n c !== undefined &&\n c.style === this.styleGeneration &&\n (c.base === base || this.indexFree) &&\n (c.complete || (c.glyphs === glyphs.version && c.icons === this.host.icons.version));\n\n if (!valid) todo.push({ group, base, parts: this.parts(group, base) });\n\n return base + group.length;\n }, 0);\n\n const byFont = new Map<string, Set<number>>();\n\n todo.forEach(({ parts }) => {\n parts.flat().forEach((p) => {\n const key = p.font ?? DEFAULT_FONT;\n const set = byFont.get(key) ?? new Set<number>();\n\n codes([p]).forEach((code) => {\n set.add(code);\n });\n byFont.set(key, set);\n });\n });\n\n const loaded = new Map<string, Map<number, Glyph>>();\n\n await Promise.all(\n [...byFont].map(async ([f, set]) => {\n loaded.set(f, await glyphs.load(f, set));\n }),\n );\n if (generation !== this.generation) return;\n\n const built = new Map<readonly Feature<P>[], Chunk>();\n\n todo.forEach(({ group, base: b, parts }) => {\n const chunk = this.build(group, b, parts, loaded);\n\n built.set(group, chunk);\n if (keep) this.chunks.set(group, chunk);\n });\n this.labels = concat(\n groups.map((g) => built.get(g) ?? this.chunks.get(g)).filter((c): c is Chunk => c !== undefined),\n );\n // The icons packed for them\n this.host.icons.flush();\n this.send(this.map.engine, this.id);\n this.map.requestRender();\n }\n\n /** The labels of a group of features, `base` the index of its first feature */\n private build(\n group: readonly Feature<P>[],\n base: number,\n parts: TextPart[][],\n loaded: Map<string, Map<number, Glyph>>,\n ): Chunk {\n const { font, size, anchor, offset, maxWidth, lineHeight, color, haloColor, haloWidth, overlap, placement } =\n this.style;\n const st = this.style;\n const icons = this.host.icons;\n const anchorList: number[] = [];\n const boxes: number[] = [];\n const styles: number[] = [];\n const iconQuads: number[] = [];\n const textQuads: number[] = [];\n let count = 0;\n let complete = true;\n\n group.forEach((f, k) => {\n const i = base + k;\n const p = f.properties;\n const text = parts[k];\n const filtered = st.filter !== undefined && !st.filter(p, i);\n const hasText = !!text?.length && text.some((t) => t.text);\n const iconName = filtered ? '' : evaluate(st.icon, p, i);\n const icon = iconName ? icons.get(iconName) : undefined;\n\n // An image not added yet: laid out again once more are\n if (iconName && !icon) complete = false;\n if (!hasText && !icon) return;\n // Glyphs still missing: shaped again once more glyphs are loaded\n if (complete && text && !text.every((t) => present(t, loaded))) complete = false;\n\n // Shaped at its largest size; the engine scales by the zoom stops\n const shapedAt = (v: Size) => (typeof v === 'number' ? v : Math.max(...v.map(([, x]) => x), 1e-6));\n const scaleOf = (v: Size, at: number): Size =>\n typeof v === 'number' ? 1 : v.map(([z, x]): [number, number] => [z, x / at]);\n const s0 = evaluate(size, p, i);\n const shaped = shapedAt(s0);\n const scale = scaleOf(s0, shaped);\n const shaping =\n hasText && text\n ? shape(text, (name) => loaded.get(name), {\n font: evaluate(font, p, i),\n size: shaped,\n maxWidth: evaluate(maxWidth, p, i),\n lineHeight: evaluate(lineHeight, p, i),\n anchor: evaluate(anchor, p, i),\n offset: evaluate(offset, p, i),\n })\n : undefined;\n const s: Shaping | undefined = shaping?.quads.length ? shaping : undefined;\n\n if (!s && !icon) return;\n\n const along = evaluate(placement, p, i) === 'line';\n const textFlags =\n overlapFlags(evaluate(overlap, p, i), FLAG.textOverlap, FLAG.textIgnore) |\n (evaluate(st.textOptional, p, i) ? FLAG.textOptional : 0) |\n (s ? FLAG.text : 0);\n // The icon: beside its text, or stretched around it (then scaled and turned with it)\n const { iconScale, iconBox, iconColor, quads, iconTurns, fitted, iconFlags } = ((): LaidIcon => {\n const none: LaidIcon = {\n iconScale: 1,\n iconBox: [0, 0, 0, 0],\n iconColor: [0, 0, 0, 0],\n quads: [],\n iconTurns: false,\n fitted: false,\n iconFlags: 0,\n };\n\n if (!icon) return none;\n\n const fit = evaluate(st.iconTextFit, p, i);\n const fitted = fit !== 'none' && s !== undefined;\n const i0 = evaluate(st.iconSize, p, i);\n const iconShaped = fitted ? 1 : shapedAt(i0);\n const iconScale = fitted ? scale : scaleOf(i0, iconShaped);\n const laid = layoutIcon(icon, {\n size: iconShaped,\n anchor: evaluate(st.iconAnchor, p, i),\n offset: evaluate(st.iconOffset, p, i),\n rotate: evaluate(st.iconRotate, p, i),\n fit,\n padding: evaluate(st.iconTextFitPadding, p, i),\n text: s?.layout,\n });\n const laidOut = { ...none, fitted, iconScale, quads: laid.quads };\n\n if (!laid.quads.length) return laidOut;\n\n const iconFlags =\n FLAG.icon |\n overlapFlags(evaluate(st.iconOverlap, p, i), FLAG.iconOverlap, FLAG.iconIgnore) |\n (evaluate(st.iconOptional, p, i) ? FLAG.iconOptional : 0);\n const alignment = evaluate(st.iconRotationAlignment, p, i);\n const [r, g, b, a] = parseColor(evaluate(st.iconColor, p, i));\n\n return {\n ...laidOut,\n iconFlags: iconFlags | (fitted ? FLAG.iconUpright : 0),\n iconTurns: alignment === 'map' || (alignment === 'auto' && along),\n iconBox: [\n laid.box[0] - ICON_PADDING,\n laid.box[1] - ICON_PADDING,\n laid.box[2] + ICON_PADDING,\n laid.box[3] + ICON_PADDING,\n ],\n iconColor: [r, g, b, a * Math.max(0, Math.min(1, evaluate(st.iconOpacity, p, i)))],\n };\n })();\n const flags = textFlags | iconFlags;\n\n if (!(flags & (FLAG.text | FLAG.icon))) return;\n\n const halo = s ? evaluate(haloWidth, p, i) : 0;\n const fill = parseColor(evaluate(color, p, i));\n const haloRgba = parseColor(evaluate(haloColor, p, i));\n // The collision box: the ink, with the halo and a little room\n const pad = halo + 1;\n const textBox = s ? [s.box[0] - pad, s.box[1] - pad, s.box[2] + pad, s.box[3] + pad] : [0, 0, 0, 0];\n\n for (const { at, along: line } of anchors(f.geometry)) {\n const label = count++;\n const [x, y] = toMercator(at);\n\n anchorList.push(x, y);\n\n // The text along its line, kept upright; the icon turning with the map (along its line, or with the east at a\n // point), or with its text when fitted to it\n const textAlong = along && line !== undefined && s !== undefined;\n const iconAlong = (flags & FLAG.icon) !== 0 && (fitted ? textAlong : iconTurns);\n // The direction of its line in Mercator (y towards the south)\n const end = line && (textAlong || iconAlong) ? toMercator([at[0] + line[0], at[1] + line[1]]) : undefined;\n const direction: [number, number] = end ? [end[0] - x, end[1] - y] : [iconAlong ? 1 : 0, 0];\n const alongFlags = (textAlong ? FLAG.textAlong : 0) | (iconAlong ? FLAG.iconAlong : 0);\n const labelFlags = flags | (direction[0] === 0 && direction[1] === 0 ? 0 : alongFlags);\n\n boxes.push(...textBox);\n styles.push(\n ...fill,\n ...haloRgba,\n halo,\n labelFlags,\n ...direction,\n ...stops(scale),\n ...iconBox,\n ...iconColor,\n ...stops(iconScale),\n );\n for (const q of quads) iconQuads.push(label, ...q);\n if (s) for (const q of s.quads) textQuads.push(label, ...q, 0);\n }\n });\n\n return {\n anchors: Float64Array.from(anchorList),\n boxes: Float32Array.from(boxes),\n styles: Float32Array.from(styles),\n // The icons under the texts\n quads: Float32Array.from([...iconQuads, ...textQuads]),\n count,\n style: this.styleGeneration,\n base,\n glyphs: this.host.glyphs.version,\n icons: icons.version,\n complete,\n };\n }\n\n private send(engine: Engine, id: number): void {\n const l = this.labels;\n\n if (l) engine.setSymbols(id, l.anchors, l.boxes, l.styles, l.quads);\n this.sendLayer(engine, id);\n }\n\n private sendLayer(engine: Engine, id: number): void {\n const { opacity, minZoom, maxZoom, visible } = this.style;\n\n // The sizes are per label; the layer's own scale stays 1\n engine.setSymbolLayer(\n id,\n Float32Array.from(stops(1)),\n Float32Array.from(stops(opacity)),\n minZoom,\n maxZoom,\n visible,\n );\n }\n\n /** @internal */\n protected create(engine: Engine): number {\n const id = engine.addSymbols();\n\n if (this.labels) this.send(engine, id);\n else {\n this.sendLayer(engine, id);\n // The first shaping, once the id is known\n queueMicrotask(() => void this.update());\n }\n\n return id;\n }\n}\n\nexport const symbolStyle = <P>(options: SymbolOptions<P>): SymbolStyle<P> => {\n const { data: _, before: __, ...rest } = options;\n\n return {\n opacity: 1,\n minZoom: 0,\n maxZoom: 24,\n visible: true,\n filter: undefined,\n text: '',\n font: DEFAULT_FONT,\n size: 12,\n color: '#000',\n haloColor: '#fff',\n haloWidth: 0,\n anchor: 'center',\n placement: 'point',\n offset: [0, 0],\n maxWidth: 10,\n lineHeight: 1.2,\n overlap: false,\n textOptional: false,\n icon: '',\n iconSize: 1,\n iconAnchor: 'center',\n iconOffset: [0, 0],\n iconRotate: 0,\n iconRotationAlignment: 'auto',\n iconOverlap: false,\n iconOptional: false,\n iconTextFit: 'none',\n iconTextFitPadding: [0, 0, 0, 0],\n iconColor: '#000',\n iconOpacity: 1,\n ...rest,\n };\n};\n"]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/** The layers of a map's basemap: a raster or vector basemap (its labels kept on top) and the IGN hillshade, under the
|
|
2
|
+
* other layers. */
|
|
3
|
+
import type { GeoMap } from '../map.ts';
|
|
4
|
+
import type { BasemapName } from '../types.ts';
|
|
5
|
+
import type { LayerStack } from './layer-stack.ts';
|
|
6
|
+
/** The basemap and the hillshade of a map, replaced together */
|
|
7
|
+
export declare class BasemapLayers {
|
|
8
|
+
private readonly map;
|
|
9
|
+
private readonly stack;
|
|
10
|
+
/** URL of the vector basemaps' workers */
|
|
11
|
+
private readonly workerUrl;
|
|
12
|
+
/** Texture size of the vector basemap's tiles */
|
|
13
|
+
private readonly tileSize;
|
|
14
|
+
private basemap;
|
|
15
|
+
private hillshade;
|
|
16
|
+
/** The vector basemap, if any: its tiles' workers and its labels */
|
|
17
|
+
private vector;
|
|
18
|
+
/** `stack`: the map's drawing order */
|
|
19
|
+
constructor(map: GeoMap, stack: LayerStack, workerUrl: string | URL, tileSize: number | undefined);
|
|
20
|
+
/** Removes the basemap and the hillshade, then adds the basemap `name` (none for 'none') */
|
|
21
|
+
replace(name: BasemapName): void;
|
|
22
|
+
/** Adds the hillshade at `opacity` (0: none), then puts it and the basemap under all the other layers */
|
|
23
|
+
addHillshade(opacity: number): void;
|
|
24
|
+
/** Stops the vector basemap's tiles (their layers removed) */
|
|
25
|
+
destroy(): void;
|
|
26
|
+
}
|