@nika-js/onlymap 0.13.1 → 0.13.3
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 +32 -0
- package/README.md +3 -2
- package/bin/dem-tiles.mjs +270 -0
- package/bin/onlymapjs.mjs +138 -34
- package/dist/{basemap-zG1-omic.js → basemap-5NHR6Gio.js} +2 -2
- package/dist/{build-Bbi4SleC.js → build-DJjheWZ2.js} +10 -10
- package/dist/camera-altitude.d.ts +29 -0
- package/dist/{client-CIH6ToMI.js → client-0mQmDog8.js} +2 -2
- package/dist/color.d.ts +15 -0
- package/dist/credit-chrome.d.ts +11 -0
- package/dist/data-layer.d.ts +7 -15
- package/dist/elements/om-map.d.ts +41 -1
- package/dist/geodesy.d.ts +2 -0
- package/dist/{geoparquet-CyWsYt9S.js → geoparquet-B_nO2OyP.js} +3 -3
- package/dist/{globe-view-Xelgj_KW.js → globe-view-BFUa9ksE.js} +1 -1
- package/dist/ground-controller.d.ts +39 -0
- package/dist/{hillshade-Zbg50lm6.js → hillshade-B_CxPhtA.js} +61 -64
- package/dist/{hillshade-shader-DI2uLSNU.js → hillshade-shader-r7GxxjXj.js} +12 -11
- package/dist/hillshade-shader.d.ts +2 -2
- package/dist/hillshade.d.ts +0 -29
- package/dist/{index-JFuN4DCn.js → index-A1FYw2dy.js} +1 -1
- package/dist/{index-BbVnkgld.js → index-BvNxS6dM.js} +38 -38
- package/dist/{index-ClAPAqcm.js → index-CObPGkze.js} +38 -38
- package/dist/{index-BL_YCKiW.js → index-CU7RnKnO.js} +62 -62
- package/dist/{index-6eeSlSqN.js → index-CgIuV5Oh.js} +3 -3
- package/dist/{index-DnCmvLuC.js → index-ChmxbIdj.js} +61 -61
- package/dist/{index-BwtXeP_F.js → index-DT5d7kFO.js} +1 -1
- package/dist/{index-CpFNIkOO.js → index-DWijIMti.js} +22217 -20712
- package/dist/{index-BtRsa5oc.js → index-YMu_yLXO.js} +18 -18
- package/dist/index.d.ts +1 -1
- package/dist/{lerc-C3SKC6CU.js → lerc-Bl4vym9y.js} +1 -1
- package/dist/onlymap.standalone.js +39073 -37485
- package/dist/onlymapjs.js +49 -49
- package/dist/plane-gpu/plane-basemap.d.ts +0 -14
- package/dist/{post-process-effect-C3P9VwC9.js → post-process-effect-gFGVlC77.js} +1 -1
- package/dist/programmatic.d.ts +3 -1
- package/dist/{raster-BgCnz9-Z.js → raster-1ShXyF12.js} +4 -4
- package/dist/{raster-pipeline-CKdpKgFo.js → raster-pipeline-BMS54TX2.js} +11 -11
- package/dist/runtime-core.d.ts +147 -0
- package/dist/sea-surface.d.ts +18 -0
- package/dist/terrain-derive.d.ts +39 -0
- package/dist/terrain-ground.d.ts +31 -0
- package/dist/terrain-heightfield.d.ts +17 -9
- package/dist/terrain-inspect-Cndlmxig.js +96 -0
- package/dist/terrain-inspect.d.ts +34 -0
- package/dist/terrain-nodata.d.ts +50 -0
- package/dist/terrain-priority.d.ts +92 -0
- package/dist/terrain-sample.d.ts +6 -0
- package/dist/terrain-skirt.d.ts +6140 -0
- package/dist/terrain-texture-mask.d.ts +40 -0
- package/dist/terrain-tint.d.ts +61 -0
- package/dist/terrain.d.ts +132 -8
- package/dist/{text-on-path-BpVLX8Yt.js → text-on-path-QInco4aP.js} +1 -1
- package/dist/tile-url.d.ts +94 -0
- package/dist/version.d.ts +1 -1
- package/dist/viewport-filter.d.ts +9 -0
- package/dist/volumetrics.d.ts +11 -0
- package/dist/{zarr-Cur_pzNa.js → zarr-CYD8fyBe.js} +2 -2
- package/docs/cartograph.md +2 -2
- package/llms.txt +2 -2
- package/onlymapjs.html-data.json +163 -3
- package/package.json +2 -1
- package/skills/onlymapjs/SKILL.md +6 -2
- package/skills/onlymapjs/references/syntax.md +12 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { aq as q, ar as T, as as B, at as E, au as j } from "./index-DWijIMti.js";
|
|
2
2
|
const N = (l) => Number.isFinite(l[0]) && Number.isFinite(l[1]);
|
|
3
3
|
function O(l, t, s) {
|
|
4
4
|
const o = T(s.x, s.y, s.z), i = 8, n = [];
|
|
@@ -23,7 +23,7 @@ function O(l, t, s) {
|
|
|
23
23
|
}
|
|
24
24
|
function U(l, t, s, o) {
|
|
25
25
|
try {
|
|
26
|
-
return
|
|
26
|
+
return j(l, t, o(s[0], s[1]));
|
|
27
27
|
} catch {
|
|
28
28
|
return !1;
|
|
29
29
|
}
|
|
@@ -40,21 +40,21 @@ function V(l, t, s, o, i) {
|
|
|
40
40
|
return !1;
|
|
41
41
|
}
|
|
42
42
|
function H(l, t, s, o, i) {
|
|
43
|
-
const { project: n, tears: p } = O(o, i, t), u =
|
|
43
|
+
const { project: n, tears: p } = O(o, i, t), u = q.parseSync(l, {
|
|
44
44
|
// Called directly, the parser does not merge the loader's defaults: name
|
|
45
45
|
// the layer property, which a basemap selects and styles by.
|
|
46
46
|
mvt: { shape: "geojson", coordinates: "wgs84", tileIndex: t, layerProperty: "layerName", ...s.layers ? { layers: s.layers } : null }
|
|
47
|
-
}) ?? [], a = T(t.x, t.y, t.z), g = B(a, n), d = s.cut !== !1, c = s.classify, e = new Y(), r = new Y(), F = new Y(), I = new Y(), M = [], S = [],
|
|
47
|
+
}) ?? [], a = T(t.x, t.y, t.z), g = B(a, n), d = s.cut !== !1, c = s.classify, e = new Y(), r = new Y(), F = new Y(), I = new Y(), M = [], S = [], C = [];
|
|
48
48
|
u.forEach((f, h) => {
|
|
49
49
|
const w = f.properties ?? {};
|
|
50
50
|
M[h] = w;
|
|
51
51
|
const y = f.geometry?.type;
|
|
52
52
|
if (y === "Polygon" || y === "MultiPolygon") {
|
|
53
53
|
const m = c ? c.fillRank[String(w.layerName)] : 0;
|
|
54
|
-
if (m !== void 0 && S.push({ id: h, f, rank: m, casing: !1 }), s.outlines && !c) for (const v of R(f)) for (const P of v)
|
|
54
|
+
if (m !== void 0 && S.push({ id: h, f, rank: m, casing: !1 }), s.outlines && !c) for (const v of R(f)) for (const P of v) k(F, h, w, P);
|
|
55
55
|
} else if (y === "LineString" || y === "MultiLineString") {
|
|
56
56
|
const m = c ? _(c.lineRules, w) : void 0;
|
|
57
|
-
(!c || m) &&
|
|
57
|
+
(!c || m) && C.push({ id: h, f, rank: m?.rank ?? 0, casing: !!m?.casing });
|
|
58
58
|
} else if ((y === "Point" || y === "MultiPoint") && !c) {
|
|
59
59
|
const m = y === "Point" ? [f.geometry.coordinates] : f.geometry.coordinates;
|
|
60
60
|
for (const v of m) {
|
|
@@ -65,19 +65,19 @@ function H(l, t, s, o, i) {
|
|
|
65
65
|
}
|
|
66
66
|
});
|
|
67
67
|
const L = (f, h) => f.rank - h.rank;
|
|
68
|
-
c && (S.sort(L),
|
|
68
|
+
c && (S.sort(L), C.sort(L));
|
|
69
69
|
for (const { id: f, f: h } of S)
|
|
70
70
|
for (const w of R(h)) {
|
|
71
71
|
const y = d ? g.polygon(w) : w;
|
|
72
72
|
y && D(e, f, h.properties ?? {}, y, n, p);
|
|
73
73
|
}
|
|
74
|
-
for (const { id: f, f: h, casing: w } of
|
|
74
|
+
for (const { id: f, f: h, casing: w } of C) {
|
|
75
75
|
const y = h.geometry.type === "LineString" ? [h.geometry.coordinates] : h.geometry.coordinates;
|
|
76
76
|
for (const m of y)
|
|
77
|
-
|
|
77
|
+
k(r, f, h.properties ?? {}, m), w && k(I, f, h.properties ?? {}, m);
|
|
78
78
|
}
|
|
79
79
|
return { fills: e.finish(), lines: r.finish(), outlines: F.finish(), casings: I.finish(), properties: M };
|
|
80
|
-
function
|
|
80
|
+
function k(f, h, w, y) {
|
|
81
81
|
const m = d ? g.line(y) : [{ points: y, startCut: !1, endCut: !1 }];
|
|
82
82
|
for (const v of m) {
|
|
83
83
|
let P = [], z = v.startCut;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/** A geographic camera, plus the frame lift deck's view state may carry. */
|
|
2
|
+
export interface EyeView {
|
|
3
|
+
longitude: number;
|
|
4
|
+
latitude: number;
|
|
5
|
+
zoom: number;
|
|
6
|
+
pitch: number;
|
|
7
|
+
bearing: number;
|
|
8
|
+
position?: readonly number[];
|
|
9
|
+
}
|
|
10
|
+
/** The eye as `[lng, lat, scene metres]`, or null for a viewport with no size yet. */
|
|
11
|
+
export declare function eyeOf(view: EyeView, width: number, height: number): [number, number, number] | null;
|
|
12
|
+
/** A scene height in true metres (`exaggeration` is always positive — the terrain parse guarantees it). */
|
|
13
|
+
export declare function trueMetres(scene: number, exaggeration: number): number;
|
|
14
|
+
/** `camera-clearance`: true metres, or null for no floor (absent, empty, or not a non-negative number — validation reports the last). One parse for the element and the validator. */
|
|
15
|
+
export declare function parseCameraClearance(raw: string | null): number | null;
|
|
16
|
+
/**
|
|
17
|
+
* The highest zoom at which the eye stays `clearance` true metres above the
|
|
18
|
+
* ground beneath it, or null when there is nothing to hold it to (no size,
|
|
19
|
+
* no ground tile yet, or a floor the eye can never reach down to).
|
|
20
|
+
*
|
|
21
|
+
* The eye's height above the frame lift scales as 2^−zoom (deck keeps it 1.5
|
|
22
|
+
* viewport heights from the target, in pixels), so the bound is closed-form.
|
|
23
|
+
* Zooming also moves the eye toward the target, over different ground; the
|
|
24
|
+
* bound is re-taken on every frame (and every gesture state), so it settles.
|
|
25
|
+
*/
|
|
26
|
+
export declare function maxZoomForClearance(view: EyeView & {
|
|
27
|
+
width: number;
|
|
28
|
+
height: number;
|
|
29
|
+
}, groundAt: (lngLat: [number, number]) => number | null, exaggeration: number, clearance: number): number | null;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { aB as _ } from "./index-DWijIMti.js";
|
|
2
2
|
const c = `function Ie(t) {
|
|
3
3
|
t("EPSG:4326", "+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees"), t("EPSG:4269", "+title=NAD83 (long/lat) +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees"), t("EPSG:3857", "+title=WGS 84 / Pseudo-Mercator +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs");
|
|
4
4
|
for (var i = 1; i <= 60; ++i)
|
|
@@ -6869,7 +6869,7 @@ async function E(e, t, n, i) {
|
|
|
6869
6869
|
});
|
|
6870
6870
|
}
|
|
6871
6871
|
async function f(e, t, n, i) {
|
|
6872
|
-
const { buildPlaneTile: s } = await import("./build-
|
|
6872
|
+
const { buildPlaneTile: s } = await import("./build-DJjheWZ2.js");
|
|
6873
6873
|
return s(e, t, n, (a, r) => i.toPlane([a, r]), (a, r) => i.fromPlane([a, r]));
|
|
6874
6874
|
}
|
|
6875
6875
|
export {
|
package/dist/color.d.ts
CHANGED
|
@@ -7,3 +7,18 @@
|
|
|
7
7
|
*/
|
|
8
8
|
export declare function hexToRgb(raw: string): number[] | undefined;
|
|
9
9
|
export declare function cssColorToRgb(raw: string): number[] | undefined;
|
|
10
|
+
/**
|
|
11
|
+
* Is `raw` a CSS colour? `undefined` when it cannot tell — a named or
|
|
12
|
+
* functional colour outside a browser (the validate CLI runs in Node), where
|
|
13
|
+
* a false "not a colour" would be worse than silence. A `#` value is always
|
|
14
|
+
* decidable.
|
|
15
|
+
*/
|
|
16
|
+
export declare function isCssColor(raw: string): boolean | undefined;
|
|
17
|
+
/** 0–255 RGB → "#rrggbb". */
|
|
18
|
+
export declare function rgbToHex(c: readonly number[]): string;
|
|
19
|
+
/**
|
|
20
|
+
* A 0–255 RGB(A) array as a 0–1 RGBA vec4 (alpha 1 when absent), converted
|
|
21
|
+
* once per array — shader extensions read their colours on every draw, per
|
|
22
|
+
* tile, per pass.
|
|
23
|
+
*/
|
|
24
|
+
export declare function unitRgba(c: readonly number[]): number[];
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A credit line in the map's attribution slot, as a MapLibre basemap's
|
|
3
|
+
* control would show it: linked text, one entry per provider. The plane
|
|
4
|
+
* basemap and the terrain presets both credit the data they pick
|
|
5
|
+
* (docs/design/underwater-terrain.md, Phase A).
|
|
6
|
+
*/
|
|
7
|
+
export interface CreditEntry {
|
|
8
|
+
text: string;
|
|
9
|
+
href: string;
|
|
10
|
+
}
|
|
11
|
+
export declare function creditElement(entries: readonly CreditEntry[]): HTMLElement;
|
package/dist/data-layer.d.ts
CHANGED
|
@@ -166,22 +166,14 @@ export declare function assertFetchSizeWithinEntitlement(response: Response): vo
|
|
|
166
166
|
export declare function isDrawUrl(url: string): boolean;
|
|
167
167
|
/**
|
|
168
168
|
* A tile URL template (spec: "Tiled layers"). deck's `TileLayer`/`MVTLayer`
|
|
169
|
-
*
|
|
170
|
-
*
|
|
171
|
-
*
|
|
172
|
-
*
|
|
173
|
-
*
|
|
174
|
-
*
|
|
175
|
-
* basemap tile URLs already use.
|
|
169
|
+
* take their `data` prop as a template STRING it expands per tile, NOT a
|
|
170
|
+
* document to fetch and parse into rows. OnlyMapJS otherwise routes every
|
|
171
|
+
* `data` attribute through getData() (fetch → parse), so a template would be
|
|
172
|
+
* fetched literally and 404; this classifier lets the parser pass it through
|
|
173
|
+
* to deck untouched instead. Both predicates live in tile-url.ts with the
|
|
174
|
+
* token filler, so what is recognised and what is filled cannot disagree.
|
|
176
175
|
*/
|
|
177
|
-
export
|
|
178
|
-
/**
|
|
179
|
-
* A tile template whose tiles are IMAGES (`…/{z}/{x}/{y}.png`) — what a bare
|
|
180
|
-
* `TileLayer` draws as bitmaps, and the one tiled source a projected map can
|
|
181
|
-
* warp into its plane (docs/design/crs.md, gap 2). One predicate, shared by the
|
|
182
|
-
* renderer and the validator, so they cannot disagree about which layers work.
|
|
183
|
-
*/
|
|
184
|
-
export declare function isImageTileTemplate(url: string | null | undefined): boolean;
|
|
176
|
+
export { isTileTemplateUrl, isImageTileTemplate } from "./tile-url";
|
|
185
177
|
/**
|
|
186
178
|
* Push a new sketch snapshot into a `draw:<name>` store (the draw widget's
|
|
187
179
|
* DrawSession.onChange calls this). A FRESH array reference is stored so
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { HTMLElementBase } from "../env";
|
|
2
|
-
import { RuntimeCore } from "../runtime-core";
|
|
2
|
+
import { RuntimeCore, type Camera } from "../runtime-core";
|
|
3
3
|
import { type RuntimeContext } from "../ctx";
|
|
4
4
|
import { type LightingIR } from "../scene-lighting";
|
|
5
5
|
import { type ClipBoxIR } from "../clip-box";
|
|
@@ -37,6 +37,8 @@ export declare class OmMapElement extends HTMLElementBase {
|
|
|
37
37
|
private contextmenuHandler?;
|
|
38
38
|
private mount;
|
|
39
39
|
private reconcilePending;
|
|
40
|
+
/** The `<om-terrain>` markup the terrain was last resolved from (reconcileTerrainSources). */
|
|
41
|
+
private terrainSourceSignature;
|
|
40
42
|
/** Last seen `<om-effect>` markup, so the `effects` watch token fires on real changes only. */
|
|
41
43
|
private effectSignature;
|
|
42
44
|
private readonly dataOwner;
|
|
@@ -232,6 +234,24 @@ export declare class OmMapElement extends HTMLElementBase {
|
|
|
232
234
|
duration?: number;
|
|
233
235
|
curve?: boolean;
|
|
234
236
|
}): void;
|
|
237
|
+
/**
|
|
238
|
+
* The camera now, with where its eye is: `altitude` (the eye against sea
|
|
239
|
+
* level), `targetElevation` (the ground under the view centre) and
|
|
240
|
+
* `clearance` (the eye above the ground beneath it), in true metres —
|
|
241
|
+
* cheap enough to read every animation frame for a depth gauge.
|
|
242
|
+
* `undefined` before the map has mounted.
|
|
243
|
+
*/
|
|
244
|
+
getCamera(): Camera | undefined;
|
|
245
|
+
/**
|
|
246
|
+
* Read the terrain's own tiles for what markup cannot tell
|
|
247
|
+
* (docs/design/underwater-terrain.md, Phase I): a step where two
|
|
248
|
+
* `<om-terrain>` sources meet (a consistent one gets a `vertical-offset`
|
|
249
|
+
* to set) and heights no real ground has, repeated (a `nodata` to set).
|
|
250
|
+
* Fetches tiles, so it is opt-in; returns warnings, never errors — the map
|
|
251
|
+
* draws either way. `onlymapjs inspect-terrain <page.html>` runs it
|
|
252
|
+
* headless.
|
|
253
|
+
*/
|
|
254
|
+
inspectTerrain(): Promise<ValidationEntry[]>;
|
|
235
255
|
setLayerVisible(id: string, visible: boolean): void;
|
|
236
256
|
/** A snapshot of the current layer IRs — the same shape `ctx.layers` is built from. */
|
|
237
257
|
getLayers(): readonly LayerIR[];
|
|
@@ -359,6 +379,12 @@ export declare class OmMapElement extends HTMLElementBase {
|
|
|
359
379
|
/** Current camera state (story initial-state capture) — internal-suffix API. */
|
|
360
380
|
/** Push `max-pitch` to the runtime; absent or unparseable restores the default. */
|
|
361
381
|
private applyMaxPitch;
|
|
382
|
+
/** Push `camera-target` to the runtime; absent or unknown is "sea-level" (validation reports the unknown). */
|
|
383
|
+
private applyCameraTarget;
|
|
384
|
+
/** Push `camera-clearance` (true metres) to the runtime; absent, empty or not a non-negative number is no floor (validation reports the last). */
|
|
385
|
+
private applyCameraClearance;
|
|
386
|
+
/** Push `sea-surface` (a CSS colour) to the runtime; absent or not a colour is no surface (validation reports the latter). */
|
|
387
|
+
private applySeaSurface;
|
|
362
388
|
/** Push `min-zoom` to the runtime; absent or unparseable restores the default. */
|
|
363
389
|
private applyMinZoom;
|
|
364
390
|
getViewStateInternal(): {
|
|
@@ -499,6 +525,14 @@ export declare class OmMapElement extends HTMLElementBase {
|
|
|
499
525
|
* changed.
|
|
500
526
|
*/
|
|
501
527
|
private reconcileEffects;
|
|
528
|
+
/**
|
|
529
|
+
* `<om-terrain>` children are terrain sources (terrain="a, b"): an edit to
|
|
530
|
+
* one — or one added or removed — re-resolves the map's terrain. Compared
|
|
531
|
+
* by markup, so a reconcile for anything else costs a string join.
|
|
532
|
+
*/
|
|
533
|
+
private reconcileTerrainSources;
|
|
534
|
+
/** The markup of this map's direct `<tag>` children — a change signature: equal strings, nothing to re-resolve. */
|
|
535
|
+
private childMarkup;
|
|
502
536
|
private reconcile;
|
|
503
537
|
/**
|
|
504
538
|
* Re-runs on every reconcile when the `validate` attribute is present —
|
|
@@ -548,6 +582,12 @@ declare global {
|
|
|
548
582
|
zoom: number;
|
|
549
583
|
pitch: number;
|
|
550
584
|
bearing: number;
|
|
585
|
+
/** The eye against sea level, true metres (null on a projected map) — see getCamera(). */
|
|
586
|
+
altitude: number | null;
|
|
587
|
+
/** The ground under the view centre, true metres — null without terrain, or until that DEM tile is held (a settle reads held tiles only). */
|
|
588
|
+
targetElevation: number | null;
|
|
589
|
+
/** The eye above the ground beneath it, true metres — null as targetElevation. */
|
|
590
|
+
clearance: number | null;
|
|
551
591
|
/** "user" if any change in the settled burst came from a canvas gesture; "programmatic" for pure API/action/story moves. */
|
|
552
592
|
origin: "user" | "programmatic";
|
|
553
593
|
}>;
|
package/dist/geodesy.d.ts
CHANGED
|
@@ -14,6 +14,8 @@
|
|
|
14
14
|
*/
|
|
15
15
|
/** WGS84 mean radius (2a + b)/3, with a = 6378137 m, 1/f = 298.257223563. */
|
|
16
16
|
export declare const WGS84_MEAN_RADIUS_M = 6371008.7714;
|
|
17
|
+
/** Equatorial circumference (m) — the Web Mercator scale numerator. Here, not in hillshade-shader.ts, so eager code (terrain-skirt.ts) can use it without pulling the lazy hillshade chunk into every map. */
|
|
18
|
+
export declare const EARTH_CIRCUMFERENCE = 40075016.686;
|
|
17
19
|
/** The sphere radius (m) current measurements resolve against. */
|
|
18
20
|
export declare function getMeasureRadiusMeters(): number;
|
|
19
21
|
/** Override the measure radius (e.g. a non-Earth body). Non-positive values reset to WGS84. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { an as i, ao as m, ap as p } from "./index-DWijIMti.js";
|
|
2
2
|
function y(e) {
|
|
3
3
|
if (e == null) return !0;
|
|
4
4
|
const t = e, o = t.id?.code;
|
|
@@ -8,10 +8,10 @@ function g(e, t, o) {
|
|
|
8
8
|
const r = t.primary_column;
|
|
9
9
|
if (!r)
|
|
10
10
|
throw new Error(`data="${o}": GeoParquet "geo" metadata names no primary_column — can't tell which column is geometry.`);
|
|
11
|
-
const a = t.columns?.[r]?.crs, n =
|
|
11
|
+
const a = t.columns?.[r]?.crs, n = d(e, r, o);
|
|
12
12
|
return y(a) || i(n, a), n;
|
|
13
13
|
}
|
|
14
|
-
function
|
|
14
|
+
function d(e, t, o) {
|
|
15
15
|
if (e.length === 0)
|
|
16
16
|
return console.warn(`[onlymapjs] data="${o}": GeoParquet has no rows — empty layer.`), [];
|
|
17
17
|
const r = e.map((n) => n[t]);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { d as L, j as x,
|
|
1
|
+
import { d as L, j as x, av as A, aw as E, ax as d, ay as h, az as u, aA as z, p as V, W as Z, G as D } from "./index-DWijIMti.js";
|
|
2
2
|
const c = Math.PI / 180, G = 180 / Math.PI;
|
|
3
3
|
function w(l, t = 0) {
|
|
4
4
|
const a = Math.min(180, l) * c;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* deck's MapController, for a camera over a terrain
|
|
3
|
+
* (docs/design/underwater-terrain.md, Phase C).
|
|
4
|
+
*
|
|
5
|
+
* 1. Gestures grab the GROUND PLANE. deck's MapState unprojects the pointer
|
|
6
|
+
* onto z = 0 and pans in that plane. With the frame lifted to the ground
|
|
7
|
+
* (`camera-target="terrain"`) the eye can sit below z = 0 — over a
|
|
8
|
+
* seabed — where the pointer's ray meets that plane behind the camera: a
|
|
9
|
+
* drag moved the map hundreds of metres the wrong way. Here pan and wheel
|
|
10
|
+
* zoom unproject onto the lift's own height and move with deck's
|
|
11
|
+
* `panByPosition3D`, as its TerrainController does for rotation.
|
|
12
|
+
* 2. A floor for the eye (`camera-clearance`): `applyConstraints` — which
|
|
13
|
+
* deck runs on every gesture state and every transition frame — caps the
|
|
14
|
+
* zoom at the eye's clearance above the ground beneath it.
|
|
15
|
+
*
|
|
16
|
+
* deck does not export MapState; MapController installs it as
|
|
17
|
+
* `ControllerState`, so this wraps whatever class that is.
|
|
18
|
+
*
|
|
19
|
+
* Every standalone Web Mercator map uses this controller, whatever its
|
|
20
|
+
* attributes: deck re-creates a view's controller when its TYPE changes and
|
|
21
|
+
* never finalizes the old one (view-manager.js `_updateController`), so a
|
|
22
|
+
* live switch MapController ↔ GroundController left the old one handling
|
|
23
|
+
* every gesture too. With no lift and no clearance it is deck's MapState.
|
|
24
|
+
*/
|
|
25
|
+
import { MapController } from "@deck.gl/core";
|
|
26
|
+
/** What the controller reads from the runtime, live (one object per runtime, read through getters). */
|
|
27
|
+
export interface GroundFollow {
|
|
28
|
+
/** The ground under a point, true metres, or null until its tile has loaded. */
|
|
29
|
+
groundAt(lngLat: [number, number]): number | null;
|
|
30
|
+
exaggeration: number;
|
|
31
|
+
/** The eye's floor above the ground under it, true metres; null for none. */
|
|
32
|
+
clearance: number | null;
|
|
33
|
+
}
|
|
34
|
+
export declare class GroundController extends MapController {
|
|
35
|
+
constructor(...args: ConstructorParameters<typeof MapController>);
|
|
36
|
+
setProps(props: Parameters<MapController["setProps"]>[0] & {
|
|
37
|
+
groundFollow?: GroundFollow;
|
|
38
|
+
}): void;
|
|
39
|
+
}
|
|
@@ -1,50 +1,47 @@
|
|
|
1
|
-
import { c as w,
|
|
1
|
+
import { c as w, ab as F, ac as M, ad as B, ae as H, af as $, ag as b, ah as E, ai as _, aj as S, ak as D, aa as O } from "./index-DWijIMti.js";
|
|
2
2
|
import { N as P, c as C } from "./hillshade-apron-Bem3DWyJ.js";
|
|
3
|
-
import { p as N, h as R, m as Z, a as U } from "./hillshade-shader-
|
|
4
|
-
const A = 64,
|
|
5
|
-
function
|
|
6
|
-
const e =
|
|
3
|
+
import { p as N, h as R, m as Z, a as U } from "./hillshade-shader-r7GxxjXj.js";
|
|
4
|
+
const A = 64, f = /* @__PURE__ */ new Map();
|
|
5
|
+
function L(t) {
|
|
6
|
+
const e = f.get(t);
|
|
7
7
|
if (e) return e;
|
|
8
8
|
const a = D(t);
|
|
9
|
-
if (
|
|
10
|
-
const r =
|
|
11
|
-
r !== void 0 &&
|
|
9
|
+
if (f.set(t, a), f.size > A) {
|
|
10
|
+
const r = f.keys().next().value;
|
|
11
|
+
r !== void 0 && f.delete(r);
|
|
12
12
|
}
|
|
13
13
|
return a;
|
|
14
14
|
}
|
|
15
|
-
function
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
async function I(t, e, a) {
|
|
19
|
-
const r = await S(z(t, a.x, a.y, a.z));
|
|
15
|
+
async function j(t, e, a) {
|
|
16
|
+
const r = await L(S(t, a.x, a.y, a.z));
|
|
20
17
|
if (!r) return null;
|
|
21
|
-
const
|
|
22
|
-
width:
|
|
23
|
-
height:
|
|
24
|
-
at: (
|
|
25
|
-
const h = (s *
|
|
26
|
-
return O(e,
|
|
18
|
+
const u = (n) => ({
|
|
19
|
+
width: n.width,
|
|
20
|
+
height: n.height,
|
|
21
|
+
at: (d, s) => {
|
|
22
|
+
const h = (s * n.width + d) * 4;
|
|
23
|
+
return O(e, n.data[h], n.data[h + 1], n.data[h + 2]);
|
|
27
24
|
}
|
|
28
|
-
}),
|
|
25
|
+
}), c = 2 ** a.z, p = /* @__PURE__ */ new Map();
|
|
29
26
|
return await Promise.all(
|
|
30
|
-
P.map(async ({ dx:
|
|
31
|
-
const s = a.y +
|
|
32
|
-
if (s < 0 || s >=
|
|
33
|
-
const h = ((a.x +
|
|
34
|
-
p.set(`${
|
|
27
|
+
P.map(async ({ dx: n, dy: d }) => {
|
|
28
|
+
const s = a.y + d;
|
|
29
|
+
if (s < 0 || s >= c) return;
|
|
30
|
+
const h = ((a.x + n) % c + c) % c;
|
|
31
|
+
p.set(`${n},${d}`, await L(S(t, h, s, a.z)));
|
|
35
32
|
})
|
|
36
|
-
), C(
|
|
37
|
-
const s = p.get(`${
|
|
38
|
-
return s ?
|
|
33
|
+
), C(u(r), (n, d) => {
|
|
34
|
+
const s = p.get(`${n},${d}`);
|
|
35
|
+
return s ? u(s) : null;
|
|
39
36
|
});
|
|
40
37
|
}
|
|
41
|
-
const
|
|
38
|
+
const I = {
|
|
42
39
|
blendColorSrcFactor: "dst",
|
|
43
40
|
blendColorDstFactor: "zero",
|
|
44
41
|
blendAlphaSrcFactor: "zero",
|
|
45
42
|
blendAlphaDstFactor: "one"
|
|
46
43
|
};
|
|
47
|
-
class
|
|
44
|
+
class z extends _ {
|
|
48
45
|
static layerName = "HillshadeBitmapLayer";
|
|
49
46
|
getShaders() {
|
|
50
47
|
const e = super.getShaders();
|
|
@@ -52,21 +49,21 @@ class L extends _ {
|
|
|
52
49
|
}
|
|
53
50
|
draw(e) {
|
|
54
51
|
const a = this.props, r = { ...a.hillshadeUniforms, hillshadeHeights: a.image };
|
|
55
|
-
for (const
|
|
52
|
+
for (const u of this.getModels()) u.shaderInputs.setProps({ hillshade: r });
|
|
56
53
|
super.draw(e);
|
|
57
54
|
}
|
|
58
55
|
}
|
|
59
|
-
class
|
|
56
|
+
class k extends z {
|
|
60
57
|
static layerName = "WarpedHillshadeBitmapLayer";
|
|
61
58
|
_createMesh() {
|
|
62
59
|
const e = this.props, a = e._planeFrame, r = e._planeBounds;
|
|
63
60
|
return !a || !r ? super._createMesh() : E(r, a, e._subdivision ?? 1);
|
|
64
61
|
}
|
|
65
62
|
}
|
|
66
|
-
function
|
|
63
|
+
function W(t, e) {
|
|
67
64
|
if (!t) return e;
|
|
68
65
|
if (typeof t != "string") return t;
|
|
69
|
-
if (t in
|
|
66
|
+
if (t in b) return b[t];
|
|
70
67
|
try {
|
|
71
68
|
const a = JSON.parse(t);
|
|
72
69
|
if ([a?.rScaler, a?.gScaler, a?.bScaler, a?.offset].every((r) => typeof r == "number" && Number.isFinite(r))) return a;
|
|
@@ -78,9 +75,9 @@ function J(t) {
|
|
|
78
75
|
const e = $(t.src);
|
|
79
76
|
return e ? e.requiresKey ? (console.warn(`[onlymapjs] HillshadeLayer: src="${t.src}" needs a ${e.requiresKey} key, which this layer does not plumb — use a keyless source such as "terrarium".`), null) : {
|
|
80
77
|
template: e.elevationData,
|
|
81
|
-
decoder: typeof e.decoder == "string" ?
|
|
78
|
+
decoder: typeof e.decoder == "string" ? b[e.decoder] : e.decoder,
|
|
82
79
|
maxZoom: t.maxZoom ?? e.maxZoom
|
|
83
|
-
} : !t.src || !t.src.includes("{z}") ? (console.warn(`[onlymapjs] HillshadeLayer: src="${t.src}" is neither a registered terrain preset nor a {z}/{x}/{y} DEM URL template.`), null) : { template: t.src, decoder:
|
|
80
|
+
} : !t.src || !t.src.includes("{z}") ? (console.warn(`[onlymapjs] HillshadeLayer: src="${t.src}" is neither a registered terrain preset nor a {z}/{x}/{y} DEM URL template.`), null) : { template: t.src, decoder: W(t.decoder, b.terrarium), maxZoom: t.maxZoom ?? 14 };
|
|
84
81
|
}
|
|
85
82
|
function q(t, e) {
|
|
86
83
|
return !Number.isFinite(t) || !Number.isFinite(e) || e <= 0 ? 0 : Math.max(0, Math.round(Math.log2(Math.max(1, t / e))));
|
|
@@ -113,7 +110,7 @@ class Y extends w {
|
|
|
113
110
|
renderLayers() {
|
|
114
111
|
const e = J(this.props);
|
|
115
112
|
if (!e) return null;
|
|
116
|
-
const { azimuths: a, weights: r } = N(this.props.sunAzimuth, this.props.sunWeight),
|
|
113
|
+
const { azimuths: a, weights: r } = N(this.props.sunAzimuth, this.props.sunWeight), u = this.props.blend === "multiply", c = this.context.device, p = c?.canvasContext?.cssToDeviceRatio?.() ?? 1, n = typeof devicePixelRatio == "number" && devicePixelRatio > 0 ? devicePixelRatio : 1, d = this.state.textures, s = this.props._planeFrame ?? null, h = Math.max(1, p / n), v = this.props.sunDatum === "geographic";
|
|
117
114
|
return new M(
|
|
118
115
|
this.getSubLayerProps({ id: "tiles" }),
|
|
119
116
|
{
|
|
@@ -129,7 +126,7 @@ class Y extends w {
|
|
|
129
126
|
// PYRAMID's zoom range is a different number entirely, and the plane
|
|
130
127
|
// tileset applies it to the geographic zoom it derives.
|
|
131
128
|
...s ? { TilesetClass: this.planeTileset(s), minZoom: -1 / 0 } : {},
|
|
132
|
-
zoomOffset: (this.props.zoomOffset ?? 0) + q(p,
|
|
129
|
+
zoomOffset: (this.props.zoomOffset ?? 0) + q(p, n),
|
|
133
130
|
// deck compares FUNCTION props by their update triggers, never by
|
|
134
131
|
// identity — inline closures would otherwise invalidate everything on
|
|
135
132
|
// every render. So anything a closure captures is invisible to deck
|
|
@@ -145,52 +142,52 @@ class Y extends w {
|
|
|
145
142
|
getTileData: [e.template, JSON.stringify(e.decoder)],
|
|
146
143
|
// The plane itself, not its code: every tile's mesh is warped for
|
|
147
144
|
// one plane, and a live switch must rebuild them (plane-tileset.ts).
|
|
148
|
-
renderSubLayers: [a.join(","), r.join(","), this.props.sunElevation, this.props.zFactor,
|
|
145
|
+
renderSubLayers: [a.join(","), r.join(","), this.props.sunElevation, this.props.zFactor, u, v, s]
|
|
149
146
|
},
|
|
150
147
|
getTileData: async (o) => {
|
|
151
|
-
const
|
|
152
|
-
if (!
|
|
148
|
+
const i = await j(e.template, e.decoder, o.index);
|
|
149
|
+
if (!i || !c) return null;
|
|
153
150
|
const l = `${o.index.z}/${o.index.x}/${o.index.y}`;
|
|
154
|
-
|
|
155
|
-
const m =
|
|
156
|
-
data:
|
|
151
|
+
d.get(l)?.destroy();
|
|
152
|
+
const m = c.createTexture({
|
|
153
|
+
data: i.data,
|
|
157
154
|
format: "r32float",
|
|
158
|
-
width:
|
|
159
|
-
height:
|
|
155
|
+
width: i.width + 2,
|
|
156
|
+
height: i.height + 2,
|
|
160
157
|
// NEAREST, because linear filtering of a float texture needs
|
|
161
158
|
// OES_texture_float_linear, which is not universal (the same
|
|
162
159
|
// constraint raster-pipeline.ts documents).
|
|
163
160
|
sampler: { minFilter: "nearest", magFilter: "nearest", addressModeU: "clamp-to-edge", addressModeV: "clamp-to-edge" }
|
|
164
161
|
});
|
|
165
|
-
return
|
|
162
|
+
return d.set(l, m), { texture: m, width: i.width, height: i.height, key: l };
|
|
166
163
|
},
|
|
167
164
|
onTileUnload: (o) => {
|
|
168
|
-
const
|
|
169
|
-
|
|
165
|
+
const i = `${o.index.z}/${o.index.x}/${o.index.y}`;
|
|
166
|
+
d.get(i)?.destroy(), d.delete(i);
|
|
170
167
|
},
|
|
171
168
|
renderSubLayers: (o) => {
|
|
172
|
-
const
|
|
173
|
-
if (!
|
|
174
|
-
const l = o.tile, [[m,
|
|
169
|
+
const i = o.data;
|
|
170
|
+
if (!i) return null;
|
|
171
|
+
const l = o.tile, [[m, g], [x, y]] = s && l.lngLatBbox ? [[l.lngLatBbox.west, l.lngLatBbox.south], [l.lngLatBbox.east, l.lngLatBbox.north]] : l.boundingBox, T = s ? k : z;
|
|
175
172
|
return new T(o, {
|
|
176
173
|
id: `${o.id}-bitmap`,
|
|
177
174
|
data: void 0,
|
|
178
|
-
image:
|
|
179
|
-
bounds: [m,
|
|
175
|
+
image: i.texture,
|
|
176
|
+
bounds: [m, g, x, y],
|
|
180
177
|
_planeFrame: s,
|
|
181
|
-
_planeBounds: s ? { west: m, south:
|
|
178
|
+
_planeBounds: s ? { west: m, south: g, east: x, north: y } : void 0,
|
|
182
179
|
_subdivision: s ? H(l.index.z, h) : 1,
|
|
183
|
-
multiply:
|
|
184
|
-
parameters:
|
|
180
|
+
multiply: u,
|
|
181
|
+
parameters: u ? I : {},
|
|
185
182
|
hillshadeUniforms: R({
|
|
186
|
-
width:
|
|
187
|
-
height:
|
|
188
|
-
azimuthOffset: s && !v ? B(s, [(m +
|
|
183
|
+
width: i.width,
|
|
184
|
+
height: i.height,
|
|
185
|
+
azimuthOffset: s && !v ? B(s, [(m + x) / 2, (y + g) / 2]) : 0,
|
|
189
186
|
// Web Mercator: one scale for both axes, stated at the equator
|
|
190
187
|
// and given its cos-phi falloff per fragment by the shader.
|
|
191
|
-
...Z(l.index.z,
|
|
188
|
+
...Z(l.index.z, i.width, i.height),
|
|
192
189
|
north: y,
|
|
193
|
-
south:
|
|
190
|
+
south: g,
|
|
194
191
|
azimuths: a,
|
|
195
192
|
weights: r,
|
|
196
193
|
sunElevation: this.props.sunElevation ?? 45,
|
|
@@ -198,7 +195,7 @@ class Y extends w {
|
|
|
198
195
|
// This layer's texture IS the heightfield, so there is no
|
|
199
196
|
// sampled colour to multiply into — a multiply-blended tile emits
|
|
200
197
|
// the shade and lets the GL blend put it in the framebuffer.
|
|
201
|
-
composite:
|
|
198
|
+
composite: u ? "framebuffer" : !1
|
|
202
199
|
})
|
|
203
200
|
});
|
|
204
201
|
}
|
|
@@ -215,7 +212,7 @@ class Y extends w {
|
|
|
215
212
|
}
|
|
216
213
|
export {
|
|
217
214
|
Y as OmHillshadeLayer,
|
|
218
|
-
|
|
215
|
+
j as buildPaddedHeights,
|
|
219
216
|
q as captureZoomOffset,
|
|
220
217
|
J as resolveHillshadeSource
|
|
221
218
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { al as d } from "./index-DWijIMti.js";
|
|
2
|
+
const u = 110574, m = 111320, o = Math.PI / 180, f = { none: 0, mercator: 1, geographic: 2 };
|
|
3
|
+
function E(e, a, s = "HillshadeLayer") {
|
|
3
4
|
const h = (l) => l == null || l === "" ? [] : typeof l == "number" ? Number.isFinite(l) ? [l] : [] : String(l).split(/[\s,]+/).filter(Boolean).map(Number).filter((r) => Number.isFinite(r));
|
|
4
5
|
let t = h(e);
|
|
5
6
|
t.length === 0 && (t = [315]), t.length > 4 && (console.warn(`[onlymapjs] ${s}: sun-azimuth takes at most 4 azimuths — using the first 4 of ${t.length}.`), t = t.slice(0, 4));
|
|
@@ -90,7 +91,7 @@ float hillshade_light(vec3 normal, float azimuth, float elevation) {
|
|
|
90
91
|
color = vec4(vec3(shade) * layer.opacity, layer.opacity);
|
|
91
92
|
}
|
|
92
93
|
`
|
|
93
|
-
),
|
|
94
|
+
), y = {
|
|
94
95
|
name: "hillshade",
|
|
95
96
|
fs: g,
|
|
96
97
|
inject: {
|
|
@@ -120,11 +121,11 @@ function c(e, a) {
|
|
|
120
121
|
function x(e) {
|
|
121
122
|
return Math.log(Math.tan(Math.PI / 4 + Math.max(-85.0511, Math.min(85.0511, e)) * o / 2));
|
|
122
123
|
}
|
|
123
|
-
function
|
|
124
|
+
function T(e, a, s) {
|
|
124
125
|
const h = d / 2 ** e;
|
|
125
126
|
return { metresPerTexel: [h / a, h / s], latMode: "mercator" };
|
|
126
127
|
}
|
|
127
|
-
function
|
|
128
|
+
function w(e) {
|
|
128
129
|
const { unitsPerPixelX: a, unitsPerPixelY: s, crsUnits: h } = e;
|
|
129
130
|
if (h === "degree")
|
|
130
131
|
return {
|
|
@@ -134,7 +135,7 @@ function T(e) {
|
|
|
134
135
|
const t = h === "foot" ? 0.3048 : 1;
|
|
135
136
|
return { metresPerTexel: [a * t, s * t], latMode: "none" };
|
|
136
137
|
}
|
|
137
|
-
function
|
|
138
|
+
function M(e) {
|
|
138
139
|
const a = e.width + 2, s = e.height + 2, h = (t) => e.latMode === "mercator" ? x(t) : t * o;
|
|
139
140
|
return {
|
|
140
141
|
azimuths: c(
|
|
@@ -157,9 +158,9 @@ function w(e) {
|
|
|
157
158
|
};
|
|
158
159
|
}
|
|
159
160
|
export {
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
p,
|
|
164
|
-
|
|
161
|
+
y as a,
|
|
162
|
+
M as h,
|
|
163
|
+
T as m,
|
|
164
|
+
E as p,
|
|
165
|
+
w as r
|
|
165
166
|
};
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
* layer's own source, so reaching for BitmapLayer's `bitmapTexture` there
|
|
23
23
|
* gives "undeclared identifier" on every tap.
|
|
24
24
|
*/
|
|
25
|
-
|
|
26
|
-
export
|
|
25
|
+
import { EARTH_CIRCUMFERENCE } from "./geodesy";
|
|
26
|
+
export { EARTH_CIRCUMFERENCE };
|
|
27
27
|
/** Metres per degree of latitude (mean). Latitude degrees barely vary; longitude degrees do, which is the whole point of `latMode`. */
|
|
28
28
|
export declare const METRES_PER_DEGREE_LAT = 110574;
|
|
29
29
|
/** Metres per degree of longitude AT THE EQUATOR — scaled by cos(latitude) per fragment. */
|