@nika-js/onlymap 0.13.3 → 0.13.5
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 +9 -5
- package/dist/actions.d.ts +12 -6
- package/dist/attribute-resolution.d.ts +32 -4
- package/dist/{basemap-5NHR6Gio.js → basemap-CErNEhX6.js} +3 -7
- package/dist/basemap.d.ts +1 -5
- package/dist/bbox-tokens.d.ts +70 -0
- package/dist/{build-DJjheWZ2.js → build-ByNIb4VX.js} +1 -1
- package/dist/{client-0mQmDog8.js → client-xe2E4jg4.js} +2 -2
- package/dist/clip-box-controller.d.ts +0 -17
- package/dist/ctx.d.ts +17 -0
- package/dist/data-layer.d.ts +15 -8
- package/dist/dom-tile-layer.d.ts +30 -0
- package/dist/draw-controller.d.ts +1 -1
- package/dist/elements/om-map.d.ts +12 -1
- package/dist/feature-service.d.ts +42 -0
- package/dist/geodesy.d.ts +6 -5
- package/dist/{geoparquet-B_nO2OyP.js → geoparquet-DOhMQl-X.js} +1 -1
- package/dist/{globe-view-BFUa9ksE.js → globe-view-84s_uNZX.js} +1 -1
- package/dist/grid-tiles.d.ts +117 -0
- package/dist/{hillshade-B_CxPhtA.js → hillshade-D8h8CRQq.js} +2 -2
- package/dist/{hillshade-shader-r7GxxjXj.js → hillshade-shader-Bm1O0P76.js} +1 -1
- package/dist/{index-YMu_yLXO.js → index-4Y4Q7RP4.js} +3 -3
- package/dist/{index-DWijIMti.js → index-BG_49YHy.js} +33543 -32098
- package/dist/index-BahtHUrg.js +8458 -0
- package/dist/{index-ChmxbIdj.js → index-DTN2CcOQ.js} +43 -43
- package/dist/{index-BvNxS6dM.js → index-DXxQu9Xi.js} +1 -1
- package/dist/{index-A1FYw2dy.js → index-D_EiGesl.js} +1 -1
- package/dist/{index-CObPGkze.js → index-DrSCLk9i.js} +22 -22
- package/dist/{index-CU7RnKnO.js → index-J_Sj6T0S.js} +32 -32
- package/dist/index-bpdGuZR6.js +478 -0
- package/dist/{index-CgIuV5Oh.js → index-phbljJTZ.js} +3 -3
- package/dist/index.d.ts +1 -1
- package/dist/ir-snapshot.d.ts +2 -0
- package/dist/ir.d.ts +18 -0
- package/dist/layer-registry.d.ts +1 -0
- package/dist/layers/warped-bitmap-layer.d.ts +14 -1
- package/dist/{lerc-Bl4vym9y.js → lerc-DLWS3sYw.js} +1 -1
- package/dist/onlymap.standalone.js +69300 -58870
- package/dist/onlymapjs.js +25 -25
- package/dist/parse-manifest.d.ts +4 -1
- package/dist/plane-gpu/plane-basemap.d.ts +237 -237
- package/dist/plane-vector/plane-mvt-layer.d.ts +237 -237
- package/dist/plane-warp.d.ts +14 -1
- package/dist/pmtiles.d.ts +76 -0
- package/dist/{post-process-effect-gFGVlC77.js → post-process-effect-CHsD0-oP.js} +1 -1
- package/dist/programmatic.d.ts +21 -1
- package/dist/{raster-1ShXyF12.js → raster-B7ILGg0X.js} +4 -4
- package/dist/{raster-pipeline-BMS54TX2.js → raster-pipeline-avMAbONM.js} +11 -11
- package/dist/react/om-layer.d.ts +4 -0
- package/dist/react.js +67 -65
- package/dist/runtime-core.d.ts +106 -4
- package/dist/serialize/emit.d.ts +2 -0
- package/dist/serialize/index.d.ts +2 -0
- package/dist/{terrain-inspect-Cndlmxig.js → terrain-inspect-FKTVm7nv.js} +1 -1
- package/dist/{text-on-path-QInco4aP.js → text-on-path-CpHM02Fs.js} +19 -18
- package/dist/tile-url.d.ts +84 -16
- package/dist/time-dimension.d.ts +25 -0
- package/dist/vector-style-CPvUSy2F.js +518 -0
- package/dist/vector-style.d.ts +59 -0
- package/dist/version.d.ts +1 -1
- package/dist/{zarr-CYD8fyBe.js → zarr-DpbT4eyF.js} +2 -2
- package/dist/zoom-gates.d.ts +60 -0
- package/docs/cartograph.md +2 -2
- package/llms.txt +4 -3
- package/onlymapjs.attributes.json +17 -0
- package/onlymapjs.html-data.json +56 -0
- package/package.json +5 -2
- package/skills/onlymapjs/SKILL.md +10 -3
- package/skills/onlymapjs/references/syntax.md +64 -7
- package/dist/index-DT5d7kFO.js +0 -459
|
@@ -0,0 +1,478 @@
|
|
|
1
|
+
import { aU as B, aV as st, aW as at, aX as X, aY as ct, aZ as lt } from "./index-BG_49YHy.js";
|
|
2
|
+
const J = /* @__PURE__ */ new Set([
|
|
3
|
+
"GeoJsonLayer",
|
|
4
|
+
"PolygonLayer",
|
|
5
|
+
"SolidPolygonLayer",
|
|
6
|
+
"PathLayer",
|
|
7
|
+
"LineLayer",
|
|
8
|
+
"ScatterplotLayer",
|
|
9
|
+
"PointCloudLayer",
|
|
10
|
+
"ArcLayer",
|
|
11
|
+
"TripsLayer",
|
|
12
|
+
"Route",
|
|
13
|
+
"Tracking"
|
|
14
|
+
]), Q = /* @__PURE__ */ new Set(["TextLayer"]), tt = /* @__PURE__ */ new Set(["TextOnPathLayer"]), et = /* @__PURE__ */ new Set([
|
|
15
|
+
"COGLayer",
|
|
16
|
+
"ZarrLayer",
|
|
17
|
+
"BitmapLayer",
|
|
18
|
+
"ImageOverlay",
|
|
19
|
+
"TileLayer",
|
|
20
|
+
"MVTLayer",
|
|
21
|
+
"HillshadeLayer",
|
|
22
|
+
"Tile3DLayer",
|
|
23
|
+
"BIMLayer",
|
|
24
|
+
"ScenegraphLayer",
|
|
25
|
+
"SimpleMeshLayer",
|
|
26
|
+
"TerrainLayer",
|
|
27
|
+
"HeatmapLayer",
|
|
28
|
+
"HexagonLayer",
|
|
29
|
+
"GridLayer",
|
|
30
|
+
"ContourLayer",
|
|
31
|
+
"ScreenGridLayer"
|
|
32
|
+
]);
|
|
33
|
+
function ut(t) {
|
|
34
|
+
return tt.has(t) ? "path-text" : Q.has(t) ? "text" : J.has(t) ? "vector" : (et.has(t), "raster");
|
|
35
|
+
}
|
|
36
|
+
function ft(t) {
|
|
37
|
+
return J.has(t) || Q.has(t) || tt.has(t) || et.has(t);
|
|
38
|
+
}
|
|
39
|
+
function dt(t) {
|
|
40
|
+
const e = [];
|
|
41
|
+
for (const o of t) {
|
|
42
|
+
const i = ut(o.type), n = e[e.length - 1];
|
|
43
|
+
n && n.strategy === "raster" && i === "raster" ? n.ids.push(o.id) : e.push({ strategy: i, ids: [o.id] });
|
|
44
|
+
}
|
|
45
|
+
return e;
|
|
46
|
+
}
|
|
47
|
+
function W(t, e) {
|
|
48
|
+
return e[0] >= t.left && e[0] <= t.right && e[1] >= t.top && e[1] <= t.bottom;
|
|
49
|
+
}
|
|
50
|
+
function nt(t, e) {
|
|
51
|
+
let o = 1 / 0, i = 1 / 0, n = -1 / 0, r = -1 / 0;
|
|
52
|
+
for (const [s, c] of t)
|
|
53
|
+
s < o && (o = s), s > n && (n = s), c < i && (i = c), c > r && (r = c);
|
|
54
|
+
return n < e.left || o > e.right || r < e.top || i > e.bottom;
|
|
55
|
+
}
|
|
56
|
+
function ht(t, e, o) {
|
|
57
|
+
const i = e[0] - t[0], n = e[1] - t[1];
|
|
58
|
+
let r = 0, s = 1;
|
|
59
|
+
const c = (f, u) => {
|
|
60
|
+
if (f === 0) return u >= 0;
|
|
61
|
+
const h = u / f;
|
|
62
|
+
if (f < 0) {
|
|
63
|
+
if (h > s) return !1;
|
|
64
|
+
h > r && (r = h);
|
|
65
|
+
} else {
|
|
66
|
+
if (h < r) return !1;
|
|
67
|
+
h < s && (s = h);
|
|
68
|
+
}
|
|
69
|
+
return !0;
|
|
70
|
+
};
|
|
71
|
+
return !c(-i, t[0] - o.left) || !c(i, o.right - t[0]) || !c(-n, t[1] - o.top) || !c(n, o.bottom - t[1]) ? null : [
|
|
72
|
+
[t[0] + r * i, t[1] + r * n],
|
|
73
|
+
[t[0] + s * i, t[1] + s * n]
|
|
74
|
+
];
|
|
75
|
+
}
|
|
76
|
+
function ot(t, e) {
|
|
77
|
+
if (t.length < 2) return W(e, t[0] ?? [NaN, NaN]) ? [[...t]] : [];
|
|
78
|
+
if (nt(t, e)) return [];
|
|
79
|
+
const o = [];
|
|
80
|
+
let i = null;
|
|
81
|
+
for (let n = 0; n + 1 < t.length; n++) {
|
|
82
|
+
const r = ht(t[n], t[n + 1], e);
|
|
83
|
+
if (!r) {
|
|
84
|
+
i = null;
|
|
85
|
+
continue;
|
|
86
|
+
}
|
|
87
|
+
const [s, c] = r;
|
|
88
|
+
i && i[i.length - 1][0] === s[0] && i[i.length - 1][1] === s[1] ? i.push(c) : (i = [s, c], o.push(i));
|
|
89
|
+
}
|
|
90
|
+
return o;
|
|
91
|
+
}
|
|
92
|
+
function Y(t, e, o) {
|
|
93
|
+
switch (o) {
|
|
94
|
+
case "left":
|
|
95
|
+
return t[0] >= e.left;
|
|
96
|
+
case "right":
|
|
97
|
+
return t[0] <= e.right;
|
|
98
|
+
case "top":
|
|
99
|
+
return t[1] >= e.top;
|
|
100
|
+
case "bottom":
|
|
101
|
+
return t[1] <= e.bottom;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
function G(t, e, o, i) {
|
|
105
|
+
const n = e[0] - t[0], r = e[1] - t[1];
|
|
106
|
+
switch (i) {
|
|
107
|
+
case "left":
|
|
108
|
+
return [o.left, t[1] + r * (o.left - t[0]) / n];
|
|
109
|
+
case "right":
|
|
110
|
+
return [o.right, t[1] + r * (o.right - t[0]) / n];
|
|
111
|
+
case "top":
|
|
112
|
+
return [t[0] + n * (o.top - t[1]) / r, o.top];
|
|
113
|
+
case "bottom":
|
|
114
|
+
return [t[0] + n * (o.bottom - t[1]) / r, o.bottom];
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
function pt(t, e) {
|
|
118
|
+
if (t.length < 3) return [];
|
|
119
|
+
if (nt(t, e)) return [];
|
|
120
|
+
let o = t;
|
|
121
|
+
for (const i of ["left", "right", "top", "bottom"]) {
|
|
122
|
+
const n = o;
|
|
123
|
+
if (o = [], n.length === 0) return [];
|
|
124
|
+
let r = n[n.length - 1];
|
|
125
|
+
for (let s = 0; s < n.length; s++) {
|
|
126
|
+
const c = n[s], f = Y(c, e, i), u = Y(r, e, i);
|
|
127
|
+
f ? (u || o.push(G(r, c, e, i)), o.push(c)) : u && o.push(G(r, c, e, i)), r = c;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
return o;
|
|
131
|
+
}
|
|
132
|
+
const V = (t) => Math.max(0, Math.min(255, Math.round(t)));
|
|
133
|
+
function D(t) {
|
|
134
|
+
if (!Array.isArray(t) || t.length < 3) return { color: "#000000", opacity: 1 };
|
|
135
|
+
const [e, o, i, n] = t, r = (s) => V(s).toString(16).padStart(2, "0");
|
|
136
|
+
return {
|
|
137
|
+
color: `#${r(e)}${r(o)}${r(i)}`,
|
|
138
|
+
// deck's alpha DEFAULT is 255, not 0 — an absent fourth component means
|
|
139
|
+
// opaque. Reading it as zero would emit a whole invisible sheet.
|
|
140
|
+
opacity: n === void 0 ? 1 : V(n) / 255
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
function N(t, e, o, i, n) {
|
|
144
|
+
if (typeof t == "function")
|
|
145
|
+
try {
|
|
146
|
+
return t(e, { index: o, data: i });
|
|
147
|
+
} catch {
|
|
148
|
+
return n;
|
|
149
|
+
}
|
|
150
|
+
return t === void 0 ? n : t;
|
|
151
|
+
}
|
|
152
|
+
const k = (t, e) => typeof t == "number" && Number.isFinite(t) ? t : e, gt = ["getLineColor", "getColor", "getSourceColor"], mt = ["getLineWidth", "getWidth"], yt = ["lineWidthScale", "widthScale"], $t = ["lineWidthUnits", "widthUnits"], xt = ["lineWidthMinPixels", "widthMinPixels"], Pt = ["lineWidthMaxPixels", "widthMaxPixels"], bt = ["getRadius", "getPointRadius"], St = ["radiusScale", "pointRadiusScale"], wt = ["radiusUnits", "pointRadiusUnits"], At = ["radiusMinPixels", "pointRadiusMinPixels"], Tt = ["radiusMaxPixels", "pointRadiusMaxPixels"];
|
|
153
|
+
function P(t, e) {
|
|
154
|
+
for (const o of e) if (t[o] !== void 0) return t[o];
|
|
155
|
+
}
|
|
156
|
+
function Lt(t, e, o, i) {
|
|
157
|
+
const n = t.props, r = k(N(P(n, mt), e, o, t.data, 1), 1), s = k(P(n, yt), 1);
|
|
158
|
+
let u = (P(n, $t) === "meters" ? "meters" : "pixels") === "meters" ? r * s / Math.max(i, 1e-9) : r * s;
|
|
159
|
+
u = Math.max(u, k(P(n, xt), 0));
|
|
160
|
+
const h = P(n, Pt);
|
|
161
|
+
return typeof h == "number" && Number.isFinite(h) && (u = Math.min(u, h)), u;
|
|
162
|
+
}
|
|
163
|
+
function kt(t, e, o, i) {
|
|
164
|
+
const n = t.props, r = k(N(P(n, bt), e, o, t.data, 1), 1), s = k(P(n, St), 1);
|
|
165
|
+
let f = (P(n, wt) === "pixels" ? "pixels" : "meters") === "pixels" ? r * s : r * s / Math.max(i, 1e-9);
|
|
166
|
+
f = Math.max(f, k(P(n, At), 0));
|
|
167
|
+
const u = P(n, Tt);
|
|
168
|
+
return typeof u == "number" && Number.isFinite(u) && (f = Math.min(f, u)), f;
|
|
169
|
+
}
|
|
170
|
+
function vt(t, e) {
|
|
171
|
+
const o = t.props.getDashArray ?? t.props.dashArray, i = typeof o == "function" ? void 0 : o;
|
|
172
|
+
if (!Array.isArray(i) || i.length < 2) return;
|
|
173
|
+
const [n, r] = i;
|
|
174
|
+
if (!Number.isFinite(n) || !Number.isFinite(r) || n <= 0 && r <= 0) return;
|
|
175
|
+
const s = Math.max(e, 1e-6);
|
|
176
|
+
return `${(n * s).toFixed(3)} ${(r * s).toFixed(3)}`;
|
|
177
|
+
}
|
|
178
|
+
function Rt(t, e, o, i) {
|
|
179
|
+
const n = t.props, r = k(n.opacity, 1), s = D(N(n.getFillColor, e, o, t.data, [0, 0, 0, 255])), c = D(N(P(n, gt), e, o, t.data, [0, 0, 0, 255])), f = Lt(t, e, o, i);
|
|
180
|
+
return {
|
|
181
|
+
fill: n.filled === !1 ? "none" : s.color,
|
|
182
|
+
fillOpacity: s.opacity * r,
|
|
183
|
+
// `stroked: false` is a POLYGON prop. A PathLayer has no such prop and is
|
|
184
|
+
// nothing but stroke, so an absent `stroked` must read as "yes", not as
|
|
185
|
+
// deck's polygon default.
|
|
186
|
+
stroke: n.stroked === !1 ? "none" : c.color,
|
|
187
|
+
strokeOpacity: c.opacity * r,
|
|
188
|
+
strokeWidth: f,
|
|
189
|
+
dashArray: vt(t, f),
|
|
190
|
+
radius: kt(t, e, o, i)
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
function U(t, e) {
|
|
194
|
+
const o = [];
|
|
195
|
+
return e === "area" ? (o.push(`fill="${t.fill}"`), t.fill !== "none" && t.fillOpacity < 1 && o.push(`fill-opacity="${t.fillOpacity.toFixed(4)}"`)) : o.push('fill="none"'), t.stroke !== "none" && t.strokeWidth > 0 && (o.push(`stroke="${t.stroke}"`), o.push(`stroke-width="${t.strokeWidth.toFixed(3)}"`), t.strokeOpacity < 1 && o.push(`stroke-opacity="${t.strokeOpacity.toFixed(4)}"`), t.dashArray && o.push(`stroke-dasharray="${t.dashArray}"`), o.push('stroke-linejoin="round"', 'stroke-linecap="round"')), o.join(" ");
|
|
196
|
+
}
|
|
197
|
+
function Mt(t, e, o) {
|
|
198
|
+
return !(t.right + o < e.left || e.right + o < t.left || t.bottom + o < e.top || e.bottom + o < t.top);
|
|
199
|
+
}
|
|
200
|
+
function _t(t, e = 2) {
|
|
201
|
+
const o = t.map((r, s) => ({ box: r, index: s })).sort((r, s) => s.box.priority - r.box.priority || r.index - s.index), i = [], n = [];
|
|
202
|
+
for (const { box: r, index: s } of o) {
|
|
203
|
+
let c = !1;
|
|
204
|
+
for (const f of i)
|
|
205
|
+
if (Mt(r, f, e)) {
|
|
206
|
+
c = !0;
|
|
207
|
+
break;
|
|
208
|
+
}
|
|
209
|
+
c || (i.push(r), n.push(s));
|
|
210
|
+
}
|
|
211
|
+
return n.sort((r, s) => r - s);
|
|
212
|
+
}
|
|
213
|
+
function Ot(t, e, o, i, n = "middle", r = "center") {
|
|
214
|
+
const s = t.length * i * 0.6, c = i * 1.2, f = n === "start" ? e : n === "end" ? e - s : e - s / 2, u = r === "top" ? o : r === "bottom" ? o - c : o - c / 2;
|
|
215
|
+
return { left: f, top: u, right: f + s, bottom: u + c };
|
|
216
|
+
}
|
|
217
|
+
const K = 32;
|
|
218
|
+
function Z(t, e) {
|
|
219
|
+
const o = e.zoom;
|
|
220
|
+
if (!t.minZoom || o === void 0) return null;
|
|
221
|
+
const i = t.minZoom.field;
|
|
222
|
+
if (st(t.data)) {
|
|
223
|
+
const n = at(t.data, i);
|
|
224
|
+
return (r, s) => !X(n[s], o);
|
|
225
|
+
}
|
|
226
|
+
return (n) => !X(ct(n, i, t.shape), o);
|
|
227
|
+
}
|
|
228
|
+
const H = (t) => t.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">"), w = (t) => H(t).replace(/"/g, """), y = (t) => (Math.round(t * 100) / 100).toString();
|
|
229
|
+
function j(t, e) {
|
|
230
|
+
const o = [];
|
|
231
|
+
for (const i of t)
|
|
232
|
+
if (!(i.length < 2)) {
|
|
233
|
+
o.push(`M${y(i[0][0])} ${y(i[0][1])}`);
|
|
234
|
+
for (let n = 1; n < i.length; n++) o.push(`L${y(i[n][0])} ${y(i[n][1])}`);
|
|
235
|
+
e && o.push("Z");
|
|
236
|
+
}
|
|
237
|
+
return o.join("");
|
|
238
|
+
}
|
|
239
|
+
const it = { rings: [], kind: "line" };
|
|
240
|
+
function It(t) {
|
|
241
|
+
const e = t, o = e?.type ?? "", i = e?.coordinates;
|
|
242
|
+
switch (o) {
|
|
243
|
+
case "Polygon":
|
|
244
|
+
return { rings: i, kind: "area" };
|
|
245
|
+
case "MultiPolygon":
|
|
246
|
+
return { rings: i.flat(), kind: "area" };
|
|
247
|
+
case "LineString":
|
|
248
|
+
return { rings: [i], kind: "line" };
|
|
249
|
+
case "MultiLineString":
|
|
250
|
+
return { rings: i, kind: "line" };
|
|
251
|
+
case "Point":
|
|
252
|
+
return { rings: [[i]], kind: "point" };
|
|
253
|
+
case "MultiPoint":
|
|
254
|
+
return { rings: [i], kind: "point" };
|
|
255
|
+
default:
|
|
256
|
+
return it;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
const E = (t) => Array.isArray(t) && typeof t[0] == "number" && typeof t[1] == "number", z = (t) => Array.isArray(t) && E(t[0]);
|
|
260
|
+
function Ct(t, e, o, i) {
|
|
261
|
+
const n = (h) => {
|
|
262
|
+
const d = t[h];
|
|
263
|
+
if (d !== void 0) {
|
|
264
|
+
if (typeof d != "function") return d;
|
|
265
|
+
try {
|
|
266
|
+
return d(e, { index: o, data: i });
|
|
267
|
+
} catch {
|
|
268
|
+
return;
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
}, r = n("getPolygon");
|
|
272
|
+
if (z(r)) return { rings: [r], kind: "area" };
|
|
273
|
+
if (Array.isArray(r) && z(r[0])) return { rings: r, kind: "area" };
|
|
274
|
+
const s = n("getPath");
|
|
275
|
+
if (z(s)) return { rings: [s], kind: "line" };
|
|
276
|
+
const c = n("getSourcePosition"), f = n("getTargetPosition");
|
|
277
|
+
if (E(c) && E(f)) return { rings: [[c, f]], kind: "line" };
|
|
278
|
+
const u = n("getPosition");
|
|
279
|
+
return E(u) ? { rings: [[u]], kind: "point" } : it;
|
|
280
|
+
}
|
|
281
|
+
function Ft(t, e) {
|
|
282
|
+
const o = B(t.data);
|
|
283
|
+
if (o.length === 0) return { markup: "", elementCount: 0 };
|
|
284
|
+
const i = [];
|
|
285
|
+
let n = 0;
|
|
286
|
+
const r = Z(t, e);
|
|
287
|
+
for (let s = 0; s < o.length; s++) {
|
|
288
|
+
const c = o[s];
|
|
289
|
+
if (r?.(c, s)) continue;
|
|
290
|
+
const f = c.geometry ?? c;
|
|
291
|
+
let { rings: u, kind: h } = It(f);
|
|
292
|
+
if (u.length === 0 && ({ rings: u, kind: h } = Ct(t.props, c, s, t.data)), u.length === 0) continue;
|
|
293
|
+
const d = Rt(t, c, s, e.metresPerPixel);
|
|
294
|
+
if (h === "point") {
|
|
295
|
+
for (const a of u)
|
|
296
|
+
for (const l of a) {
|
|
297
|
+
const p = e.project([l[0], l[1]]);
|
|
298
|
+
if (!W(e.frame, p)) continue;
|
|
299
|
+
const g = Math.max(d.radius ?? 1, 0.1);
|
|
300
|
+
i.push(
|
|
301
|
+
`<circle cx="${y(p[0])}" cy="${y(p[1])}" r="${y(g)}" ${U(d, "area")}/>`
|
|
302
|
+
), n++;
|
|
303
|
+
}
|
|
304
|
+
continue;
|
|
305
|
+
}
|
|
306
|
+
const $ = u.map((a) => a.map((l) => e.project([l[0], l[1]])));
|
|
307
|
+
if (h === "area") {
|
|
308
|
+
const a = $.map((l) => pt(l, e.frame)).filter((l) => l.length >= 3);
|
|
309
|
+
if (a.length === 0) continue;
|
|
310
|
+
i.push(
|
|
311
|
+
`<path d="${j(a, !0)}" fill-rule="evenodd" ${U(d, "area")}/>`
|
|
312
|
+
), n++;
|
|
313
|
+
} else {
|
|
314
|
+
const a = $.flatMap((l) => ot(l, e.frame));
|
|
315
|
+
if (a.length === 0) continue;
|
|
316
|
+
i.push(`<path d="${j(a, !1)}" ${U(d, "line")}/>`), n++;
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
return {
|
|
320
|
+
markup: i.length ? `<g id="${w(t.id)}">${i.join("")}</g>` : "",
|
|
321
|
+
elementCount: n
|
|
322
|
+
};
|
|
323
|
+
}
|
|
324
|
+
function Et(t, e, o) {
|
|
325
|
+
const i = B(t.data);
|
|
326
|
+
if (i.length === 0) return { markup: "", elementCount: 0 };
|
|
327
|
+
const n = t.props, r = (a, l, p, g) => {
|
|
328
|
+
if (typeof a != "function") return a ?? g;
|
|
329
|
+
try {
|
|
330
|
+
return a(l, { index: p, data: t.data });
|
|
331
|
+
} catch {
|
|
332
|
+
return g;
|
|
333
|
+
}
|
|
334
|
+
}, s = String(n.fontFamily ?? "sans-serif"), c = typeof n.getTextAnchor == "string" ? n.getTextAnchor : "middle", f = typeof n.getAlignmentBaseline == "string" ? n.getAlignmentBaseline : "center", u = [], h = Z(t, e);
|
|
335
|
+
for (let a = 0; a < i.length; a++) {
|
|
336
|
+
const l = i[a];
|
|
337
|
+
if (h?.(l, a)) continue;
|
|
338
|
+
const p = String(r(n.getText, l, a, "") ?? "");
|
|
339
|
+
if (!p) continue;
|
|
340
|
+
const g = r(n.getPosition, l, a, void 0);
|
|
341
|
+
if (!Array.isArray(g)) continue;
|
|
342
|
+
const m = e.project([g[0], g[1]]);
|
|
343
|
+
if (!W(e.frame, m)) continue;
|
|
344
|
+
const A = Number(r(n.getSize, l, a, K)), R = Number(n.sizeScale ?? 1), M = (Number.isFinite(A) && A > 0 ? A : K) * (Number.isFinite(R) && R > 0 ? R : 1), v = D(r(n.getColor, l, a, [0, 0, 0, 255])), _ = Number(r(n.getCollisionPriority, l, a, 0)) || 0, T = r(n.getPixelOffset, l, a, void 0), O = Array.isArray(T) && typeof T[0] == "number" ? T[0] : 0, F = Array.isArray(T) && typeof T[1] == "number" ? T[1] : 0;
|
|
345
|
+
m[0] += O, m[1] += F;
|
|
346
|
+
const I = String(r(n.getTextAnchor, l, a, c) ?? c), L = I === "start" || I === "end" ? I : "middle", C = String(r(n.getAlignmentBaseline, l, a, f) ?? f), x = C === "top" || C === "bottom" ? C : "center", b = o ? o(p, M, s) : void 0, S = Ot(p, m[0], m[1], M, L, x), rt = b === void 0 ? { id: `${t.id}:${a}`, priority: _, ...S } : {
|
|
347
|
+
id: `${t.id}:${a}`,
|
|
348
|
+
priority: _,
|
|
349
|
+
left: L === "start" ? m[0] : L === "end" ? m[0] - b : m[0] - b / 2,
|
|
350
|
+
top: S.top,
|
|
351
|
+
right: (L === "start" ? m[0] : L === "end" ? m[0] - b : m[0] - b / 2) + b,
|
|
352
|
+
bottom: S.bottom
|
|
353
|
+
};
|
|
354
|
+
u.push({ text: p, p: m, size: M, colour: v, anchor: L, baseline: x, box: rt });
|
|
355
|
+
}
|
|
356
|
+
const $ = (n.collisionEnabled === !1 ? u.map((a, l) => l) : _t(u.map((a) => a.box))).map((a) => {
|
|
357
|
+
const l = u[a], p = l.baseline === "top" ? "hanging" : l.baseline === "bottom" ? "alphabetic" : "central", g = l.colour.opacity < 1 ? ` fill-opacity="${l.colour.opacity.toFixed(4)}"` : "";
|
|
358
|
+
return `<text x="${y(l.p[0])}" y="${y(l.p[1])}" font-family="${w(s)}" font-size="${y(l.size)}" text-anchor="${l.anchor}" dominant-baseline="${p}" fill="${l.colour.color}"${g}>${H(l.text)}</text>`;
|
|
359
|
+
});
|
|
360
|
+
return {
|
|
361
|
+
markup: $.length ? `<g id="${w(t.id)}">${$.join("")}</g>` : "",
|
|
362
|
+
elementCount: $.length
|
|
363
|
+
};
|
|
364
|
+
}
|
|
365
|
+
function Dt(t, e) {
|
|
366
|
+
const o = B(t.data);
|
|
367
|
+
if (o.length === 0) return { markup: "", elementCount: 0 };
|
|
368
|
+
const i = t.props, n = (p, g, m, A) => {
|
|
369
|
+
if (typeof p != "function") return p ?? A;
|
|
370
|
+
try {
|
|
371
|
+
return p(g, { index: m, data: t.data });
|
|
372
|
+
} catch {
|
|
373
|
+
return A;
|
|
374
|
+
}
|
|
375
|
+
}, r = String(i.fontFamily ?? "sans-serif"), s = String(i.fontWeight ?? "normal"), c = Number(i.letterSpacing ?? 0) || 0, f = Number(i.offset ?? 0) || 0, u = String(i.placement ?? "middle"), h = u === "start" ? "0%" : u === "end" ? "100%" : "50%", d = u === "start" ? "start" : u === "end" ? "end" : "middle", $ = [], a = [], l = Z(t, e);
|
|
376
|
+
for (let p = 0; p < o.length; p++) {
|
|
377
|
+
const g = o[p];
|
|
378
|
+
if (l?.(g, p)) continue;
|
|
379
|
+
const m = n(i.getPath, g, p, void 0), A = String(n(i.getText, g, p, "") ?? "");
|
|
380
|
+
if (!Array.isArray(m) || m.length < 2 || !A) continue;
|
|
381
|
+
const R = m.map((x) => e.project([x[0], x[1]])), M = ot(R, e.frame);
|
|
382
|
+
let v = null, _ = 0;
|
|
383
|
+
for (const x of M) {
|
|
384
|
+
let b = 0;
|
|
385
|
+
for (let S = 1; S < x.length; S++) b += Math.hypot(x[S][0] - x[S - 1][0], x[S][1] - x[S - 1][1]);
|
|
386
|
+
b > _ && (_ = b, v = x);
|
|
387
|
+
}
|
|
388
|
+
if (!v || v.length < 2) continue;
|
|
389
|
+
const T = Number(n(i.getSize, g, p, 14)) || 14, O = D(n(i.getColor, g, p, [30, 30, 30, 255])), F = `${t.id}-path-${p}`;
|
|
390
|
+
$.push(`<path id="${w(F)}" d="${j([v], !1)}" fill="none"/>`);
|
|
391
|
+
const I = O.opacity < 1 ? ` fill-opacity="${O.opacity.toFixed(4)}"` : "", L = c !== 0 ? ` letter-spacing="${y(c)}"` : "", C = f !== 0 ? ` dy="${y(-f)}"` : "";
|
|
392
|
+
a.push(
|
|
393
|
+
`<text font-family="${w(r)}" font-weight="${w(s)}" font-size="${y(T)}" fill="${O.color}"${I}${L}><textPath href="#${w(F)}" startOffset="${h}" text-anchor="${d}"${C}>${H(A)}</textPath></text>`
|
|
394
|
+
);
|
|
395
|
+
}
|
|
396
|
+
return a.length === 0 ? { markup: "", elementCount: 0 } : {
|
|
397
|
+
markup: `<defs>${$.join("")}</defs><g id="${w(t.id)}">${a.join("")}</g>`,
|
|
398
|
+
elementCount: a.length
|
|
399
|
+
};
|
|
400
|
+
}
|
|
401
|
+
function q(t, e, o) {
|
|
402
|
+
return `<image id="${w(`band:${o.join("+")}`)}" x="${y(e.left)}" y="${y(e.top)}" width="${y(e.right - e.left)}" height="${y(e.bottom - e.top)}" preserveAspectRatio="none" href="${w(t)}"/>`;
|
|
403
|
+
}
|
|
404
|
+
const Nt = 600, Ut = 5e4;
|
|
405
|
+
function jt(t) {
|
|
406
|
+
return Math.max(1, t / 96);
|
|
407
|
+
}
|
|
408
|
+
async function Bt(t, e) {
|
|
409
|
+
const o = [], i = { left: 0, top: 0, right: e.width, bottom: e.height }, n = e.effectDpi ?? Nt, r = {
|
|
410
|
+
project: e.project,
|
|
411
|
+
frame: i,
|
|
412
|
+
metresPerPixel: e.metresPerPixel,
|
|
413
|
+
featureBudget: e.featureBudget ?? Ut,
|
|
414
|
+
zoom: e.zoom
|
|
415
|
+
}, s = `<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="${e.width}" height="${e.height}" viewBox="0 0 ${e.width} ${e.height}">`;
|
|
416
|
+
if (e.hasPostProcessPass) {
|
|
417
|
+
const d = await e.captureBand(null, n);
|
|
418
|
+
return o.push({
|
|
419
|
+
code: "rasterised-by-effect",
|
|
420
|
+
message: `The map frame was rasterised at ${n} dpi because a post-process pass${e.postProcessLabel ? ` (${e.postProcessLabel})` : ""} treats the finished frame, and there is no vector equivalent.`,
|
|
421
|
+
fix: "Remove the finish for fully editable linework, or raise effect-dpi if the type needs to be sharper."
|
|
422
|
+
}), {
|
|
423
|
+
svg: `${s}${q(d, i, ["frame"])}</svg>`,
|
|
424
|
+
notices: o,
|
|
425
|
+
elementCount: 1
|
|
426
|
+
};
|
|
427
|
+
}
|
|
428
|
+
const c = dt(t.map((d) => ({ id: d.id, type: d.type }))), f = new Map(t.map((d) => [d.id, d])), u = [];
|
|
429
|
+
let h = 0;
|
|
430
|
+
for (const d of c) {
|
|
431
|
+
if (d.strategy === "raster") {
|
|
432
|
+
for (const $ of d.ids) {
|
|
433
|
+
const a = f.get($);
|
|
434
|
+
a && !ft(a.type) && o.push({
|
|
435
|
+
code: "unknown-layer-type",
|
|
436
|
+
message: `Layer "${$}" has type "${a.type}", which the serializer does not recognise — it was drawn into a raster band.`,
|
|
437
|
+
fix: "It renders correctly but is not editable. If it should be vector, register its type with the serializer."
|
|
438
|
+
});
|
|
439
|
+
}
|
|
440
|
+
u.push(q(await e.captureBand(d.ids, n), i, d.ids)), h++;
|
|
441
|
+
continue;
|
|
442
|
+
}
|
|
443
|
+
for (const $ of d.ids) {
|
|
444
|
+
const a = f.get($);
|
|
445
|
+
if (!a || a.props.visible === !1 || a.visibleZoomRange && e.zoom !== void 0 && !lt(a.visibleZoomRange, e.zoom)) continue;
|
|
446
|
+
const l = d.strategy === "path-text" ? Dt(a, r) : d.strategy === "text" ? Et(a, r, e.measureText) : Ft(a, r);
|
|
447
|
+
l.markup && u.push(l.markup), h += l.elementCount;
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
return h > r.featureBudget && o.push({
|
|
451
|
+
code: "feature-budget",
|
|
452
|
+
message: `The sheet emitted ${h} elements, past the ${r.featureBudget} budget — editors slow to a crawl well before this.`,
|
|
453
|
+
fix: 'Add <om-transform type="simplify" tolerance="0.15mm"> to the densest layer, or raise the budget deliberately.'
|
|
454
|
+
}), { svg: `${s}${u.join("")}</svg>`, notices: o, elementCount: h };
|
|
455
|
+
}
|
|
456
|
+
export {
|
|
457
|
+
Nt as DEFAULT_EFFECT_DPI,
|
|
458
|
+
Ut as DEFAULT_FEATURE_BUDGET,
|
|
459
|
+
jt as bandScaleFor,
|
|
460
|
+
ot as clipPolyline,
|
|
461
|
+
pt as clipRing,
|
|
462
|
+
ht as clipSegment,
|
|
463
|
+
D as deckColorToSvg,
|
|
464
|
+
_t as declutter,
|
|
465
|
+
q as emitRasterBand,
|
|
466
|
+
Et as emitTextLayer,
|
|
467
|
+
Dt as emitTextOnPathLayer,
|
|
468
|
+
Ft as emitVectorLayer,
|
|
469
|
+
Ot as estimateLabelBox,
|
|
470
|
+
dt as groupIntoRuns,
|
|
471
|
+
ft as isKnownType,
|
|
472
|
+
vt as resolveDashArray,
|
|
473
|
+
Rt as resolveFeatureStyle,
|
|
474
|
+
Lt as resolveLineWidth,
|
|
475
|
+
kt as resolveRadius,
|
|
476
|
+
Bt as serializeToSvg,
|
|
477
|
+
ut as strategyFor
|
|
478
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { A as t, a as o, b as i, C as l, c as p, d as n, D as _, e as c, f as g, F as h, L as m, g as L, h as y, i as f, j as w, M as S, k as V, O as b, l as C, m as E, P as I, T as P, n as T, o as M, U as d, V as A, p as O, q as u, W as N, r as k, s as x, t as D, u as G, G as R, v as j, w as W, x as q, y as v, z, B as F, E as U, H as Y, I as B, J as H, K as J, N as K, Q, R as X, S as Z, X as $, Y as aa, Z as sa, _ as ea, $ as ra, a0 as ta, a1 as oa, a2 as ia } from "./index-
|
|
2
|
-
import { P as s } from "./post-process-effect-
|
|
3
|
-
import { G as pa, a as na } from "./globe-view-
|
|
1
|
+
import { A as t, a as o, b as i, C as l, c as p, d as n, D as _, e as c, f as g, F as h, L as m, g as L, h as y, i as f, j as w, M as S, k as V, O as b, l as C, m as E, P as I, T as P, n as T, o as M, U as d, V as A, p as O, q as u, W as N, r as k, s as x, t as D, u as G, G as R, v as j, w as W, x as q, y as v, z, B as F, E as U, H as Y, I as B, J as H, K as J, N as K, Q, R as X, S as Z, X as $, Y as aa, Z as sa, _ as ea, $ as ra, a0 as ta, a1 as oa, a2 as ia } from "./index-BG_49YHy.js";
|
|
2
|
+
import { P as s } from "./post-process-effect-CHsD0-oP.js";
|
|
3
|
+
import { G as pa, a as na } from "./globe-view-84s_uNZX.js";
|
|
4
4
|
export {
|
|
5
5
|
t as AmbientLight,
|
|
6
6
|
o as Attribute,
|
package/dist/index.d.ts
CHANGED
|
@@ -92,7 +92,7 @@ export { isStoreToken } from "./external-store";
|
|
|
92
92
|
export type { TokenStore, ViewOrigin, ViewportSnapshot, DataVersionSnapshot } from "./external-store";
|
|
93
93
|
export type { LayerMetaSnapshot } from "./ctx";
|
|
94
94
|
export type { Selection, PickMode, PickAtOptions, PickRectOptions, PickRect } from "./selection";
|
|
95
|
-
export type { Camera, CameraOptions } from "./runtime-core";
|
|
95
|
+
export type { Camera, CameraOptions, LayerErrorDetail } from "./runtime-core";
|
|
96
96
|
export type { MapViewport } from "./basemap";
|
|
97
97
|
export { registerAction } from "./actions";
|
|
98
98
|
export { distanceMeters, pathLengthMeters, ringAreaMeters2, ringPerimeterMeters, ringEnclosesPole, midpoint, getMeasureRadiusMeters, setMeasureRadiusMeters, WGS84_MEAN_RADIUS_M, type LngLat, } from "./geodesy";
|
package/dist/ir-snapshot.d.ts
CHANGED
|
@@ -43,6 +43,8 @@ export interface LayerIRSnapshot {
|
|
|
43
43
|
terrain?: "drape" | "offset" | "off";
|
|
44
44
|
/** Per-layer zoom visibility (`visible-zoom-range`) when authored — hidden outside min ≤ zoom < max. */
|
|
45
45
|
visibleZoomRange?: [number, number];
|
|
46
|
+
/** Per-feature minimum zoom (`min-zoom-field`) when authored and given its GPU filter slot. */
|
|
47
|
+
minZoomField?: string;
|
|
46
48
|
/** The `cluster` toggle's options when on (docs/design/clustering.md) — the JSON-safe part; its accessors appear under `clusterAccessors` as fingerprints. */
|
|
47
49
|
cluster?: {
|
|
48
50
|
radius: number;
|
package/dist/ir.d.ts
CHANGED
|
@@ -11,11 +11,22 @@ export interface LayerMeta {
|
|
|
11
11
|
color?: string;
|
|
12
12
|
/** Statically-derived color symbology (spec: "Built-in widgets / legend") — set when get-fill-color is a recognizable scale()/categorical expression. */
|
|
13
13
|
legend?: LegendSpec;
|
|
14
|
+
/** `listed="false"` (public issue #25) — the legend and layer-switcher skip the layer; it stays in `ctx.layers`. Absent = listed. */
|
|
15
|
+
listed?: false;
|
|
14
16
|
}
|
|
15
17
|
export type { Shape } from "./expr";
|
|
16
18
|
import type { Shape } from "./expr";
|
|
17
19
|
import type { LegendSpec } from "./legend-spec";
|
|
18
20
|
import type { ClusterOptions } from "./cluster-options";
|
|
21
|
+
/** Where a layer's `min-zoom-field` slot sits in its packed GPU filter — carried on the IR so `buildLayers` can set the slot's range per camera move. */
|
|
22
|
+
export interface MinZoomGate {
|
|
23
|
+
/** The authored field name. */
|
|
24
|
+
field: string;
|
|
25
|
+
/** Index of the slot in the packed `filterRange` — always the last one (after the authored dimensions). */
|
|
26
|
+
slot: number;
|
|
27
|
+
/** The extension's `filterSize` — at least 2 (with no authored dimension an idle slot 0 sits before it), so `filterRange` is always the packed array of pairs. Part of the deck layer's id (`#mz<size>`), since deck sizes the attribute once. */
|
|
28
|
+
size: number;
|
|
29
|
+
}
|
|
19
30
|
/**
|
|
20
31
|
* Columnar (GeoArrow-style) data: one array per field instead of one object
|
|
21
32
|
* per row (spec: "Columnar / GeoArrow Ingestion"). Produced by the Data
|
|
@@ -98,6 +109,13 @@ export interface LayerIR {
|
|
|
98
109
|
* switcher, ctx) while zoom-hidden.
|
|
99
110
|
*/
|
|
100
111
|
visibleZoomRange?: [number, number];
|
|
112
|
+
/**
|
|
113
|
+
* Per-feature minimum zoom (`min-zoom-field`, public issue #25): which
|
|
114
|
+
* slot of the layer's DataFilterExtension carries each row's min zoom.
|
|
115
|
+
* `buildLayers` sets that slot's range to `[floor, zoom]` on every camera
|
|
116
|
+
* move. Presentation only — never part of `filter`.
|
|
117
|
+
*/
|
|
118
|
+
minZoom?: MinZoomGate;
|
|
101
119
|
/**
|
|
102
120
|
* The authored live-source options that select this layer's transport
|
|
103
121
|
* (spec: "Live & Streaming Data"), retained on the IR rather than consumed
|
package/dist/layer-registry.d.ts
CHANGED
|
@@ -151,6 +151,7 @@ export declare function ensureLayerClass(schema: LayerSchema): Promise<void> | n
|
|
|
151
151
|
export declare function getLayerSchema(type: string): LayerSchema | undefined;
|
|
152
152
|
export declare function getAllLayerSchemas(): ReadonlyMap<string, LayerSchema>;
|
|
153
153
|
export declare const UNDECLARED_DECK_PROPS: Readonly<Record<string, readonly PropDescriptor[]>>;
|
|
154
|
+
export declare const TILE_TEMPLATE_PROPS: readonly PropDescriptor[];
|
|
154
155
|
/**
|
|
155
156
|
* The ONE opt-out predicate for the scene-wide per-layer attributes declared
|
|
156
157
|
* above (issue: three call sites each accepted a different value set —
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
*/
|
|
13
13
|
import { BitmapLayer } from "@deck.gl/layers";
|
|
14
14
|
import { type TileBoundsLngLat } from "../plane-warp";
|
|
15
|
-
import type { PlaneFrame } from "../projection";
|
|
15
|
+
import type { LngLatPair, PlaneFrame } from "../projection";
|
|
16
16
|
export interface WarpedBitmapProps {
|
|
17
17
|
/** The map's projection plane. Absent → a plain BitmapLayer. */
|
|
18
18
|
_planeFrame?: PlaneFrame | null;
|
|
@@ -20,6 +20,19 @@ export interface WarpedBitmapProps {
|
|
|
20
20
|
_planeBounds?: TileBoundsLngLat;
|
|
21
21
|
/** Cells per axis (`subdivisionFor`). */
|
|
22
22
|
_subdivision?: number;
|
|
23
|
+
/**
|
|
24
|
+
* Where in the image each point samples, for an image in ANOTHER CRS than
|
|
25
|
+
* the tile (a `{bbox-epsg-XXXX}` WMS answer): the mesh still covers exactly
|
|
26
|
+
* the tile, so neighbours never overlap, and the texture is pulled into
|
|
27
|
+
* place per vertex. Works on a Web Mercator map too (no plane needed).
|
|
28
|
+
*/
|
|
29
|
+
_texCoordOf?: (lngLat: LngLatPair) => [number, number];
|
|
30
|
+
/**
|
|
31
|
+
* Where each point of the IMAGE lies (u east, v south), for a tile that is
|
|
32
|
+
* a rectangle in another CRS (a national grid's WMTS tile): the mesh
|
|
33
|
+
* follows that rectangle onto the map. Takes the place of `_planeBounds`.
|
|
34
|
+
*/
|
|
35
|
+
_sampleLngLat?: (u: number, v: number) => LngLatPair;
|
|
23
36
|
}
|
|
24
37
|
export declare class WarpedBitmapLayer extends BitmapLayer<WarpedBitmapProps> {
|
|
25
38
|
static layerName: string;
|