@nika-js/onlymap 0.10.4 → 0.10.6
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 +34 -0
- package/README.md +1 -1
- package/dist/{basemap-CEk-fwwQ.js → basemap-Do1r50ff.js} +2 -2
- package/dist/cartograph/elements/om-frame.d.ts +55 -2
- package/dist/cartograph/elements/om-source.d.ts +23 -0
- package/dist/cartograph/frame-sources.d.ts +64 -0
- package/dist/cartograph/live-frame.d.ts +8 -2
- package/dist/cartograph.js +1324 -1126
- package/dist/cartograph.standalone.js +1804 -1606
- package/dist/elements/om-map.d.ts +11 -0
- package/dist/{geoparquet-aBafoHei.js → geoparquet-CfnIgWoq.js} +1 -1
- package/dist/{globe-view-CPzn74yH.js → globe-view-CKrjE2_P.js} +1 -1
- package/dist/{hillshade-fonIyeOe.js → hillshade-DYX4HiM6.js} +1 -1
- package/dist/{index-6uyOjvvx.js → index-CLwi0tl1.js} +1 -1
- package/dist/{index-XlX-ORox.js → index-Cr2lpzhG.js} +9673 -9611
- package/dist/{index-CW9LiA0Z.js → index-D7pGwN4r.js} +2 -2
- package/dist/{index-CIiSsOZG.js → index-DfH_mTX9.js} +1 -1
- package/dist/{index-BOXzqzVq.js → index-DwX39Hco.js} +1 -1
- package/dist/{index-BYOHopZU.js → index-jOAZ7MGr.js} +1 -1
- package/dist/{index-irwJUTjX.js → index-pNSDUva1.js} +1 -1
- package/dist/{index-BlwNB2Fo.js → index-q_KoQjsU.js} +3 -3
- package/dist/{index-FP1-ImsV.js → index-xTIB8sjz.js} +3 -3
- package/dist/legend-spec.d.ts +18 -0
- package/dist/{lerc-B_m7L7RH.js → lerc-DIXeSlBh.js} +1 -1
- package/dist/onlymap.standalone.js +18707 -18590
- package/dist/onlymapjs.js +1 -1
- package/dist/{post-process-effect-D-uTiLdK.js → post-process-effect-BSBhBXeu.js} +1 -1
- package/dist/{raster-D3o26cuQ.js → raster-mlOu3P2H.js} +3 -3
- package/dist/{raster-pipeline-1u0HyuNs.js → raster-pipeline-ByRr7hBG.js} +1 -1
- package/dist/runtime-core.d.ts +19 -0
- package/dist/text-on-path-Q0dF8039.js +201 -0
- package/dist/text-on-path.d.ts +51 -11
- package/dist/version.d.ts +1 -1
- package/dist/{zarr-CVVmWsbf.js → zarr-D6-cCHW4.js} +2 -2
- package/docs/cartograph.md +49 -3
- package/docs/design/carto-substrate.md +12 -0
- package/docs/design/frame-sources.md +229 -0
- package/llms.txt +2 -2
- package/onlymapjs.attributes.json +2 -0
- package/onlymapjs.html-data.json +36 -0
- package/package.json +1 -1
- package/skills/onlymapjs/SKILL.md +3 -2
- package/skills/onlymapjs/references/syntax.md +16 -2
- package/dist/text-on-path-DCS_Eg0_.js +0 -146
package/dist/cartograph.js
CHANGED
|
@@ -1,63 +1,63 @@
|
|
|
1
|
-
let
|
|
2
|
-
function
|
|
3
|
-
|
|
1
|
+
let $t = null, J = null;
|
|
2
|
+
function Ne(r) {
|
|
3
|
+
$t = r;
|
|
4
4
|
}
|
|
5
|
-
function
|
|
5
|
+
function cr() {
|
|
6
6
|
return B !== null;
|
|
7
7
|
}
|
|
8
8
|
let B = null;
|
|
9
|
-
function
|
|
9
|
+
function Y() {
|
|
10
10
|
return B;
|
|
11
11
|
}
|
|
12
|
-
function
|
|
13
|
-
return B ? Promise.resolve(B) :
|
|
14
|
-
throw
|
|
15
|
-
}),
|
|
12
|
+
function Pe() {
|
|
13
|
+
return B ? Promise.resolve(B) : J || ($t ? (J = Promise.resolve($t()).then((r) => (B = r, B)).catch((r) => {
|
|
14
|
+
throw J = null, r;
|
|
15
|
+
}), J) : Promise.reject(
|
|
16
16
|
new Error(
|
|
17
17
|
'[onlymapjs/cartograph] No map runtime loader is configured. Import the cartograph entry ("@nika-js/onlymap/cartograph" or its standalone build) rather than a submodule — the entry installs it.'
|
|
18
18
|
)
|
|
19
19
|
));
|
|
20
20
|
}
|
|
21
|
-
const
|
|
21
|
+
const ur = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
22
22
|
__proto__: null,
|
|
23
|
-
isCoreLoaded:
|
|
24
|
-
loadCore:
|
|
25
|
-
peekCore:
|
|
26
|
-
setCoreLoader:
|
|
23
|
+
isCoreLoaded: cr,
|
|
24
|
+
loadCore: Pe,
|
|
25
|
+
peekCore: Y,
|
|
26
|
+
setCoreLoader: Ne
|
|
27
27
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
28
|
-
function
|
|
29
|
-
return { scale:
|
|
28
|
+
function Bt(r) {
|
|
29
|
+
return { scale: r / 96, pxPerMm: r / 25.4 };
|
|
30
30
|
}
|
|
31
|
-
function ft(
|
|
32
|
-
return typeof
|
|
31
|
+
function ft(r) {
|
|
32
|
+
return typeof r?.paintCartograph == "function";
|
|
33
33
|
}
|
|
34
|
-
const W = (
|
|
35
|
-
const e =
|
|
34
|
+
const W = (r, t) => {
|
|
35
|
+
const e = r.getAttribute(t);
|
|
36
36
|
if (e == null || e.trim() === "") return null;
|
|
37
|
-
const
|
|
38
|
-
return Number.isFinite(
|
|
37
|
+
const n = Number(e);
|
|
38
|
+
return Number.isFinite(n) ? n : null;
|
|
39
39
|
};
|
|
40
|
-
function C(
|
|
40
|
+
function C(r) {
|
|
41
41
|
return {
|
|
42
|
-
x: W(
|
|
43
|
-
y: W(
|
|
44
|
-
w: W(
|
|
45
|
-
h: W(
|
|
46
|
-
rotation: W(
|
|
47
|
-
z: W(
|
|
42
|
+
x: W(r, "x") ?? 0,
|
|
43
|
+
y: W(r, "y") ?? 0,
|
|
44
|
+
w: W(r, "w") ?? 0,
|
|
45
|
+
h: W(r, "h") ?? 0,
|
|
46
|
+
rotation: W(r, "rotation") ?? 0,
|
|
47
|
+
z: W(r, "z")
|
|
48
48
|
};
|
|
49
49
|
}
|
|
50
|
-
function
|
|
51
|
-
if (!
|
|
52
|
-
const e = Number.parseFloat(
|
|
50
|
+
function xt(r, t = 0) {
|
|
51
|
+
if (!r) return t;
|
|
52
|
+
const e = Number.parseFloat(r);
|
|
53
53
|
return Number.isFinite(e) ? e : t;
|
|
54
54
|
}
|
|
55
|
-
function
|
|
56
|
-
if (!
|
|
57
|
-
const t =
|
|
58
|
-
return t === "transparent" || t === "rgba(0, 0, 0, 0)" || t === "none" ? null :
|
|
55
|
+
function R(r) {
|
|
56
|
+
if (!r) return null;
|
|
57
|
+
const t = r.trim().toLowerCase();
|
|
58
|
+
return t === "transparent" || t === "rgba(0, 0, 0, 0)" || t === "none" ? null : r;
|
|
59
59
|
}
|
|
60
|
-
const D = 96 / 25.4,
|
|
60
|
+
const D = 96 / 25.4, Vt = {
|
|
61
61
|
A0: { widthMm: 841, heightMm: 1189 },
|
|
62
62
|
A1: { widthMm: 594, heightMm: 841 },
|
|
63
63
|
A2: { widthMm: 420, heightMm: 594 },
|
|
@@ -66,302 +66,302 @@ const D = 96 / 25.4, Wt = {
|
|
|
66
66
|
A5: { widthMm: 148, heightMm: 210 },
|
|
67
67
|
Letter: { widthMm: 215.9, heightMm: 279.4 },
|
|
68
68
|
Legal: { widthMm: 215.9, heightMm: 355.6 }
|
|
69
|
-
},
|
|
70
|
-
function
|
|
69
|
+
}, Kt = "A4";
|
|
70
|
+
function ht(r, t, e, n) {
|
|
71
71
|
const i = t != null ? Number(t) : NaN, o = e != null ? Number(e) : NaN;
|
|
72
72
|
if (Number.isFinite(i) && i > 0 && Number.isFinite(o) && o > 0) return { widthMm: i, heightMm: o };
|
|
73
|
-
const s =
|
|
74
|
-
return
|
|
73
|
+
const s = Vt[r ?? Kt] ?? Vt[Kt];
|
|
74
|
+
return n === "landscape" ? { widthMm: s.heightMm, heightMm: s.widthMm } : { ...s };
|
|
75
75
|
}
|
|
76
|
-
let
|
|
77
|
-
function
|
|
78
|
-
if (!
|
|
79
|
-
|
|
76
|
+
let rt = null;
|
|
77
|
+
function hr(r) {
|
|
78
|
+
if (!rt) {
|
|
79
|
+
rt = new Uint32Array(256);
|
|
80
80
|
for (let e = 0; e < 256; e++) {
|
|
81
|
-
let
|
|
82
|
-
for (let i = 0; i < 8; i++)
|
|
83
|
-
|
|
81
|
+
let n = e;
|
|
82
|
+
for (let i = 0; i < 8; i++) n = n & 1 ? 3988292384 ^ n >>> 1 : n >>> 1;
|
|
83
|
+
rt[e] = n >>> 0;
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
86
|
let t = 4294967295;
|
|
87
|
-
for (let e = 0; e <
|
|
87
|
+
for (let e = 0; e < r.length; e++) t = rt[(t ^ r[e]) & 255] ^ t >>> 8;
|
|
88
88
|
return (t ^ 4294967295) >>> 0;
|
|
89
89
|
}
|
|
90
|
-
function
|
|
91
|
-
const t = Math.max(1980,
|
|
90
|
+
function mr(r) {
|
|
91
|
+
const t = Math.max(1980, r.getFullYear());
|
|
92
92
|
return {
|
|
93
|
-
time:
|
|
94
|
-
date: t - 1980 << 9 |
|
|
93
|
+
time: r.getHours() << 11 | r.getMinutes() << 5 | Math.floor(r.getSeconds() / 2),
|
|
94
|
+
date: t - 1980 << 9 | r.getMonth() + 1 << 5 | r.getDate()
|
|
95
95
|
};
|
|
96
96
|
}
|
|
97
|
-
async function
|
|
98
|
-
const e = new TextEncoder(), { time:
|
|
97
|
+
async function dr(r, t = /* @__PURE__ */ new Date()) {
|
|
98
|
+
const e = new TextEncoder(), { time: n, date: i } = mr(t), o = [], s = [];
|
|
99
99
|
let a = 0;
|
|
100
|
-
for (const u of
|
|
101
|
-
const h = u.data instanceof Blob ? new Uint8Array(await u.data.arrayBuffer()) : u.data, d = e.encode(u.name), m =
|
|
102
|
-
f.setUint32(0, 67324752, !0), f.setUint16(4, 20, !0), f.setUint16(6, 2048, !0), f.setUint16(8, 0, !0), f.setUint16(10,
|
|
100
|
+
for (const u of r) {
|
|
101
|
+
const h = u.data instanceof Blob ? new Uint8Array(await u.data.arrayBuffer()) : u.data, d = e.encode(u.name), m = hr(h), f = new DataView(new ArrayBuffer(30));
|
|
102
|
+
f.setUint32(0, 67324752, !0), f.setUint16(4, 20, !0), f.setUint16(6, 2048, !0), f.setUint16(8, 0, !0), f.setUint16(10, n, !0), f.setUint16(12, i, !0), f.setUint32(14, m, !0), f.setUint32(18, h.length, !0), f.setUint32(22, h.length, !0), f.setUint16(26, d.length, !0), f.setUint16(28, 0, !0), o.push(new Uint8Array(f.buffer), d, h), s.push({ name: u.name, bytes: h, crc: m, offset: a }), a += 30 + d.length + h.length;
|
|
103
103
|
}
|
|
104
104
|
const l = a;
|
|
105
105
|
for (const u of s) {
|
|
106
106
|
const h = e.encode(u.name), d = new DataView(new ArrayBuffer(46));
|
|
107
|
-
d.setUint32(0, 33639248, !0), d.setUint16(4, 20, !0), d.setUint16(6, 20, !0), d.setUint16(8, 2048, !0), d.setUint16(10, 0, !0), d.setUint16(12,
|
|
107
|
+
d.setUint32(0, 33639248, !0), d.setUint16(4, 20, !0), d.setUint16(6, 20, !0), d.setUint16(8, 2048, !0), d.setUint16(10, 0, !0), d.setUint16(12, n, !0), d.setUint16(14, i, !0), d.setUint32(16, u.crc, !0), d.setUint32(20, u.bytes.length, !0), d.setUint32(24, u.bytes.length, !0), d.setUint16(28, h.length, !0), d.setUint16(30, 0, !0), d.setUint16(32, 0, !0), d.setUint16(34, 0, !0), d.setUint16(36, 0, !0), d.setUint32(38, 0, !0), d.setUint32(42, u.offset, !0), o.push(new Uint8Array(d.buffer), h), a += 46 + h.length;
|
|
108
108
|
}
|
|
109
109
|
const c = new DataView(new ArrayBuffer(22));
|
|
110
110
|
return c.setUint32(0, 101010256, !0), c.setUint16(4, 0, !0), c.setUint16(6, 0, !0), c.setUint16(8, s.length, !0), c.setUint16(10, s.length, !0), c.setUint32(12, a - l, !0), c.setUint32(16, l, !0), c.setUint16(20, 0, !0), o.push(new Uint8Array(c.buffer)), new Blob(o, { type: "application/zip" });
|
|
111
111
|
}
|
|
112
|
-
const mt = ["protanopia", "deuteranopia", "tritanopia", "achromatopsia"],
|
|
112
|
+
const mt = ["protanopia", "deuteranopia", "tritanopia", "achromatopsia"], Te = {
|
|
113
113
|
protan: "protanopia",
|
|
114
114
|
deutan: "deuteranopia",
|
|
115
115
|
tritan: "tritanopia",
|
|
116
116
|
achroma: "achromatopsia"
|
|
117
117
|
};
|
|
118
|
-
function
|
|
119
|
-
const t =
|
|
120
|
-
return !t || t === "none" ? null : mt.includes(t) ? t :
|
|
118
|
+
function Dt(r) {
|
|
119
|
+
const t = r?.trim().toLowerCase();
|
|
120
|
+
return !t || t === "none" ? null : mt.includes(t) ? t : Te[t] ?? null;
|
|
121
121
|
}
|
|
122
|
-
const
|
|
122
|
+
const fr = ["none", ...mt, ...Object.keys(Te)], jt = {
|
|
123
123
|
protanopia: [0.11238, 0.88762, 0, 0.11238, 0.88762, 0, 401e-5, -401e-5, 1],
|
|
124
124
|
deuteranopia: [0.29275, 0.70725, 0, 0.29275, 0.70725, 0, -0.02234, 0.02234, 1],
|
|
125
125
|
tritanopia: [1, 0.14461, -0.14461, 0, 0.85659, 0.14341, 0, 0.85659, 0.14341],
|
|
126
126
|
achromatopsia: [0.2126, 0.7152, 0.0722, 0.2126, 0.7152, 0.0722, 0.2126, 0.7152, 0.0722]
|
|
127
|
-
}, G = (
|
|
128
|
-
const t =
|
|
127
|
+
}, G = (r) => {
|
|
128
|
+
const t = r / 255;
|
|
129
129
|
return t <= 0.04045 ? t / 12.92 : ((t + 0.055) / 1.055) ** 2.4;
|
|
130
|
-
},
|
|
131
|
-
const t = Math.min(1, Math.max(0,
|
|
130
|
+
}, ct = (r) => {
|
|
131
|
+
const t = Math.min(1, Math.max(0, r));
|
|
132
132
|
return 255 * (t <= 31308e-7 ? t * 12.92 : 1.055 * t ** (1 / 2.4) - 0.055);
|
|
133
133
|
};
|
|
134
|
-
function
|
|
135
|
-
const t =
|
|
134
|
+
function gr(r) {
|
|
135
|
+
const t = r.trim().toLowerCase(), e = /^#([0-9a-f]{3}|[0-9a-f]{6})$/.exec(t);
|
|
136
136
|
if (e) {
|
|
137
137
|
const i = e[1], o = (s) => parseInt(s.length === 1 ? s + s : s, 16);
|
|
138
138
|
return i.length === 3 ? { r: o(i[0]), g: o(i[1]), b: o(i[2]) } : { r: o(i.slice(0, 2)), g: o(i.slice(2, 4)), b: o(i.slice(4, 6)) };
|
|
139
139
|
}
|
|
140
|
-
const
|
|
141
|
-
return
|
|
140
|
+
const n = /^rgba?\(\s*([\d.]+)[\s,]+([\d.]+)[\s,]+([\d.]+)/.exec(t);
|
|
141
|
+
return n ? { r: Number(n[1]), g: Number(n[2]), b: Number(n[3]) } : null;
|
|
142
142
|
}
|
|
143
|
-
function
|
|
144
|
-
const e =
|
|
143
|
+
function Ht(r, t) {
|
|
144
|
+
const e = jt[t], [n, i, o] = [G(r.r), G(r.g), G(r.b)];
|
|
145
145
|
return {
|
|
146
|
-
r:
|
|
147
|
-
g:
|
|
148
|
-
b:
|
|
146
|
+
r: ct(e[0] * n + e[1] * i + e[2] * o),
|
|
147
|
+
g: ct(e[3] * n + e[4] * i + e[5] * o),
|
|
148
|
+
b: ct(e[6] * n + e[7] * i + e[8] * o)
|
|
149
149
|
};
|
|
150
150
|
}
|
|
151
|
-
function
|
|
152
|
-
const [
|
|
151
|
+
function Yt({ r, g: t, b: e }) {
|
|
152
|
+
const [n, i, o] = [G(r), G(t), G(e)], s = (n * 0.4124564 + i * 0.3575761 + o * 0.1804375) / 0.95047, a = n * 0.2126729 + i * 0.7151522 + o * 0.072175, l = (n * 0.0193339 + i * 0.119192 + o * 0.9503041) / 1.08883, c = (m) => m > 216 / 24389 ? Math.cbrt(m) : 841 / 108 * m + 4 / 29, [u, h, d] = [c(s), c(a), c(l)];
|
|
153
153
|
return [116 * h - 16, 500 * (u - h), 200 * (h - d)];
|
|
154
154
|
}
|
|
155
|
-
function
|
|
156
|
-
const [e,
|
|
157
|
-
if (U === 0 &&
|
|
158
|
-
const
|
|
159
|
-
return
|
|
155
|
+
function Xt(r, t) {
|
|
156
|
+
const [e, n, i] = Yt(r), [o, s, a] = Yt(t), l = Math.PI / 180, c = 180 / Math.PI, u = (Math.hypot(n, i) + Math.hypot(s, a)) / 2, h = 0.5 * (1 - Math.sqrt(u ** 7 / (u ** 7 + 25 ** 7))), [d, m] = [n * (1 + h), s * (1 + h)], [f, g] = [Math.hypot(d, i), Math.hypot(m, a)], p = (U, et) => {
|
|
157
|
+
if (U === 0 && et === 0) return 0;
|
|
158
|
+
const X = Math.atan2(et, U) * c;
|
|
159
|
+
return X >= 0 ? X : X + 360;
|
|
160
160
|
}, [b, w] = [p(d, i), p(m, a)], y = o - e, M = g - f;
|
|
161
161
|
let v = 0;
|
|
162
162
|
f * g !== 0 && (v = w - b, v > 180 ? v -= 360 : v < -180 && (v += 360));
|
|
163
163
|
const N = 2 * Math.sqrt(f * g) * Math.sin(v * l / 2), _ = (e + o) / 2, $ = (f + g) / 2;
|
|
164
164
|
let P = b + w;
|
|
165
165
|
f * g !== 0 && (Math.abs(b - w) > 180 && (P += b + w < 360 ? 360 : -360), P /= 2);
|
|
166
|
-
const L = 1 - 0.17 * Math.cos((P - 30) * l) + 0.24 * Math.cos(2 * P * l) + 0.32 * Math.cos((3 * P + 6) * l) - 0.2 * Math.cos((4 * P - 63) * l), A = 1 + 0.015 * (_ - 50) ** 2 / Math.sqrt(20 + (_ - 50) ** 2), S = 1 + 0.045 * $,
|
|
167
|
-
return Math.sqrt((y / A) ** 2 + (M / S) ** 2 + (N /
|
|
166
|
+
const L = 1 - 0.17 * Math.cos((P - 30) * l) + 0.24 * Math.cos(2 * P * l) + 0.32 * Math.cos((3 * P + 6) * l) - 0.2 * Math.cos((4 * P - 63) * l), A = 1 + 0.015 * (_ - 50) ** 2 / Math.sqrt(20 + (_ - 50) ** 2), S = 1 + 0.045 * $, x = 1 + 0.015 * $ * L, E = -2 * Math.sqrt($ ** 7 / ($ ** 7 + 25 ** 7)) * Math.sin(60 * Math.exp(-(((P - 275) / 25) ** 2)) * l);
|
|
167
|
+
return Math.sqrt((y / A) ** 2 + (M / S) ** 2 + (N / x) ** 2 + E * (M / S) * (N / x));
|
|
168
168
|
}
|
|
169
|
-
const
|
|
170
|
-
function
|
|
169
|
+
const pr = 10;
|
|
170
|
+
function br(r, t = pr) {
|
|
171
171
|
const e = /* @__PURE__ */ new Map();
|
|
172
|
-
for (const a of
|
|
173
|
-
const l =
|
|
172
|
+
for (const a of r) {
|
|
173
|
+
const l = gr(a.color);
|
|
174
174
|
if (!l) continue;
|
|
175
175
|
const c = a.layer ?? "", u = e.get(c);
|
|
176
176
|
u ? u.push({ entry: a, rgb: l }) : e.set(c, [{ entry: a, rgb: l }]);
|
|
177
177
|
}
|
|
178
|
-
const
|
|
178
|
+
const n = [], i = /* @__PURE__ */ new Map();
|
|
179
179
|
for (const a of mt)
|
|
180
180
|
for (const l of e.values())
|
|
181
181
|
for (let c = 0; c < l.length; c++)
|
|
182
182
|
for (let u = c + 1; u < l.length; u++) {
|
|
183
|
-
if (
|
|
184
|
-
const d = Ht(
|
|
185
|
-
d < t && (
|
|
183
|
+
if (Xt(l[c].rgb, l[u].rgb) < t) continue;
|
|
184
|
+
const d = Xt(Ht(l[c].rgb, a), Ht(l[u].rgb, a));
|
|
185
|
+
d < t && (n.push({ type: a, a: l[c].entry, b: l[u].entry, distance: d }), i.set(a, (i.get(a) ?? 0) + 1));
|
|
186
186
|
}
|
|
187
187
|
let o = null, s = 0;
|
|
188
188
|
for (const [a, l] of i)
|
|
189
189
|
l > s && (s = l, o = a);
|
|
190
|
-
return { collapses:
|
|
190
|
+
return { collapses: n, worstType: o };
|
|
191
191
|
}
|
|
192
|
-
function
|
|
192
|
+
function yr(r, t, e, n) {
|
|
193
193
|
if (t <= 0 || e <= 0) return !0;
|
|
194
194
|
let i;
|
|
195
195
|
try {
|
|
196
|
-
i =
|
|
196
|
+
i = r.getImageData(0, 0, t, e);
|
|
197
197
|
} catch {
|
|
198
198
|
return !1;
|
|
199
199
|
}
|
|
200
200
|
const o = new Float64Array(256);
|
|
201
201
|
for (let h = 0; h < 256; h++) o[h] = G(h);
|
|
202
202
|
const s = 1024, a = new Float64Array(s + 1);
|
|
203
|
-
for (let h = 0; h <= s; h++) a[h] =
|
|
203
|
+
for (let h = 0; h <= s; h++) a[h] = ct(h / s);
|
|
204
204
|
const l = (h) => {
|
|
205
205
|
const d = Math.min(1, Math.max(0, h)) * s, m = Math.floor(d);
|
|
206
206
|
return m >= s ? a[s] : a[m] + (a[m + 1] - a[m]) * (d - m);
|
|
207
|
-
}, c =
|
|
207
|
+
}, c = jt[n], u = i.data;
|
|
208
208
|
for (let h = 0; h < u.length; h += 4) {
|
|
209
209
|
const d = o[u[h]], m = o[u[h + 1]], f = o[u[h + 2]];
|
|
210
210
|
u[h] = l(c[0] * d + c[1] * m + c[2] * f), u[h + 1] = l(c[3] * d + c[4] * m + c[5] * f), u[h + 2] = l(c[6] * d + c[7] * m + c[8] * f);
|
|
211
211
|
}
|
|
212
|
-
return
|
|
212
|
+
return r.putImageData(i, 0, 0), !0;
|
|
213
213
|
}
|
|
214
|
-
const
|
|
215
|
-
function
|
|
216
|
-
if (
|
|
217
|
-
const t =
|
|
214
|
+
const Le = (r) => `om-carto-cvd-${r}`;
|
|
215
|
+
function wr(r) {
|
|
216
|
+
if (r.getElementById("om-carto-cvd-filters")) return;
|
|
217
|
+
const t = r.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
218
218
|
t.id = "om-carto-cvd-filters", t.setAttribute("aria-hidden", "true"), t.setAttribute("width", "0"), t.setAttribute("height", "0"), t.style.cssText = "position:absolute;width:0;height:0;overflow:hidden;";
|
|
219
219
|
for (const e of mt) {
|
|
220
|
-
const
|
|
221
|
-
|
|
222
|
-
const i =
|
|
220
|
+
const n = r.createElementNS("http://www.w3.org/2000/svg", "filter");
|
|
221
|
+
n.id = Le(e), n.setAttribute("color-interpolation-filters", "linearRGB");
|
|
222
|
+
const i = r.createElementNS("http://www.w3.org/2000/svg", "feColorMatrix");
|
|
223
223
|
i.setAttribute("type", "matrix");
|
|
224
|
-
const o =
|
|
225
|
-
i.setAttribute("values", [o[0], o[1], o[2], 0, 0, o[3], o[4], o[5], 0, 0, o[6], o[7], o[8], 0, 0, 0, 0, 0, 1, 0].join(" ")),
|
|
224
|
+
const o = jt[e];
|
|
225
|
+
i.setAttribute("values", [o[0], o[1], o[2], 0, 0, o[3], o[4], o[5], 0, 0, o[6], o[7], o[8], 0, 0, 0, 0, 0, 1, 0].join(" ")), n.appendChild(i), t.appendChild(n);
|
|
226
226
|
}
|
|
227
|
-
|
|
227
|
+
r.body.appendChild(t);
|
|
228
228
|
}
|
|
229
|
-
const
|
|
230
|
-
async function
|
|
231
|
-
const t = [], e = [...
|
|
229
|
+
const Re = 16384, Fe = 134217728;
|
|
230
|
+
async function vr(r) {
|
|
231
|
+
const t = [], e = [...r.querySelectorAll("img")];
|
|
232
232
|
return await Promise.all(
|
|
233
|
-
e.map(async (
|
|
234
|
-
if (!(
|
|
233
|
+
e.map(async (n) => {
|
|
234
|
+
if (!(n.complete && n.naturalWidth > 0))
|
|
235
235
|
try {
|
|
236
|
-
await
|
|
236
|
+
await n.decode();
|
|
237
237
|
} catch {
|
|
238
|
-
t.push(`Image did not load and was skipped: ${
|
|
238
|
+
t.push(`Image did not load and was skipped: ${n.getAttribute("src") ?? "(no src)"}`);
|
|
239
239
|
}
|
|
240
240
|
})
|
|
241
241
|
), t;
|
|
242
242
|
}
|
|
243
|
-
function
|
|
244
|
-
return [...
|
|
243
|
+
function Mr(r) {
|
|
244
|
+
return [...r.children].filter(
|
|
245
245
|
(t) => !t.hasAttribute("hidden") && !t.hasAttribute("data-om-carto-marks") && !t.hasAttribute("data-om-carto-flattened") && t.tagName.toLowerCase() !== "style" && t.tagName.toLowerCase() !== "script"
|
|
246
246
|
).map((t, e) => ({ el: t, index: e, z: C(t).z ?? 0 })).sort((t, e) => t.z - e.z || t.index - e.index).map((t) => t.el);
|
|
247
247
|
}
|
|
248
|
-
async function
|
|
249
|
-
const e =
|
|
248
|
+
async function zt(r, t = {}) {
|
|
249
|
+
const e = r ?? document.querySelector("om-cartograph");
|
|
250
250
|
if (!e) throw new Error("[onlymapjs/cartograph] renderCartograph: no <om-cartograph> to render.");
|
|
251
|
-
const
|
|
251
|
+
const n = [], i = t.dpi ?? (Number(e.getAttribute("dpi")) || 300);
|
|
252
252
|
if (!Number.isFinite(i) || i <= 0) throw new Error(`[onlymapjs/cartograph] renderCartograph: invalid dpi ${t.dpi}.`);
|
|
253
|
-
const { widthMm: o, heightMm: s } =
|
|
253
|
+
const { widthMm: o, heightMm: s } = ht(
|
|
254
254
|
e.getAttribute("size"),
|
|
255
255
|
e.getAttribute("width"),
|
|
256
256
|
e.getAttribute("height"),
|
|
257
257
|
e.getAttribute("orientation")
|
|
258
|
-
), a = Math.max(0, Number(e.getAttribute("bleed")) || 0), l = o + a * 2, c = s + a * 2, u = t.maxDimension ??
|
|
258
|
+
), a = Math.max(0, Number(e.getAttribute("bleed")) || 0), l = o + a * 2, c = s + a * 2, u = t.maxDimension ?? Re, h = t.maxArea ?? Fe;
|
|
259
259
|
let d = i;
|
|
260
260
|
const m = Math.min(u / (l / 25.4), u / (c / 25.4)), f = Math.sqrt(h / (l / 25.4 * (c / 25.4))), g = Math.min(m, f);
|
|
261
|
-
d > g && (d = Math.floor(g),
|
|
262
|
-
const p =
|
|
261
|
+
d > g && (d = Math.floor(g), n.push(`Requested ${i} dpi exceeds this browser's canvas budget for a ${l.toFixed(0)}×${c.toFixed(0)}mm page; rendered at ${d} dpi instead.`)), n.push(...await vr(e)), typeof document < "u" && document.fonts?.ready && await document.fonts.ready;
|
|
262
|
+
const p = Bt(d), b = Math.max(1, Math.round(l * p.pxPerMm)), w = Math.max(1, Math.round(c * p.pxPerMm)), y = Mr(e);
|
|
263
263
|
for (const A of y)
|
|
264
264
|
if (!(!ft(A) || !A.prepareCartograph))
|
|
265
265
|
try {
|
|
266
|
-
await A.prepareCartograph(
|
|
266
|
+
await A.prepareCartograph(Bt(d));
|
|
267
267
|
} catch (S) {
|
|
268
|
-
A.discardCartograph?.(),
|
|
268
|
+
A.discardCartograph?.(), n.push(`${A.tagName.toLowerCase()}${A.id ? `#${A.id}` : ""} could not be captured: ${S.message}`);
|
|
269
269
|
}
|
|
270
270
|
const M = document.createElement("canvas");
|
|
271
271
|
M.width = b, M.height = w;
|
|
272
272
|
const v = M.getContext("2d");
|
|
273
273
|
if (!v) throw new Error("[onlymapjs/cartograph] renderCartograph: could not get a 2D canvas context.");
|
|
274
274
|
const N = typeof getComputedStyle == "function" ? getComputedStyle(e) : null;
|
|
275
|
-
v.fillStyle =
|
|
275
|
+
v.fillStyle = R(N?.backgroundColor) ?? "#ffffff", v.fillRect(0, 0, b, w);
|
|
276
276
|
for (const A of y) {
|
|
277
277
|
if (!ft(A)) continue;
|
|
278
278
|
const S = C(A);
|
|
279
279
|
if (v.save(), v.translate((S.x + a) * p.pxPerMm, (S.y + a) * p.pxPerMm), S.rotation) {
|
|
280
|
-
const
|
|
281
|
-
v.translate(
|
|
280
|
+
const x = S.w / 2 * p.pxPerMm, E = S.h / 2 * p.pxPerMm;
|
|
281
|
+
v.translate(x, E), v.rotate(S.rotation * Math.PI / 180), v.translate(-x, -E);
|
|
282
282
|
}
|
|
283
283
|
try {
|
|
284
284
|
A.paintCartograph(v, p);
|
|
285
|
-
} catch (
|
|
286
|
-
|
|
285
|
+
} catch (x) {
|
|
286
|
+
n.push(`${A.tagName.toLowerCase()}${A.id ? `#${A.id}` : ""} failed to render: ${x.message}`);
|
|
287
287
|
}
|
|
288
288
|
v.restore();
|
|
289
289
|
}
|
|
290
290
|
const _ = e.querySelector(":scope > [data-om-carto-marks]");
|
|
291
291
|
for (const A of _?.querySelectorAll("line") ?? []) {
|
|
292
|
-
const S = Number(A.getAttribute("x1")),
|
|
293
|
-
[S,
|
|
292
|
+
const S = Number(A.getAttribute("x1")), x = Number(A.getAttribute("y1")), E = Number(A.getAttribute("x2")), U = Number(A.getAttribute("y2"));
|
|
293
|
+
[S, x, E, U].every(Number.isFinite) && (v.save(), v.strokeStyle = A.getAttribute("stroke") || "#000000", v.lineWidth = (Number(A.getAttribute("stroke-width")) || 0.2) * p.pxPerMm, v.beginPath(), v.moveTo((S + a) * p.pxPerMm, (x + a) * p.pxPerMm), v.lineTo((E + a) * p.pxPerMm, (U + a) * p.pxPerMm), v.stroke(), v.restore());
|
|
294
294
|
}
|
|
295
|
-
const $ =
|
|
296
|
-
$ && !
|
|
295
|
+
const $ = Dt(t.cvd === "page" ? e.getAttribute("cvd") : t.cvd);
|
|
296
|
+
$ && !yr(v, b, w, $) && n.push("Colour-vision simulation was skipped: a cross-origin image on the page makes the export canvas unreadable.");
|
|
297
297
|
for (const A of y) ft(A) && A.discardCartograph?.();
|
|
298
298
|
const P = t.format === "jpeg" ? "image/jpeg" : "image/png";
|
|
299
|
-
P === "image/jpeg" && e.querySelector("om-text") &&
|
|
299
|
+
P === "image/jpeg" && e.querySelector("om-text") && n.push("JPEG compresses text edges — prefer PNG for a page carrying labels.");
|
|
300
300
|
const L = await new Promise((A) => M.toBlob(A, P, t.quality));
|
|
301
301
|
if (!L) throw new Error("[onlymapjs/cartograph] renderCartograph: the canvas produced no image (it may have exceeded a browser limit).");
|
|
302
|
-
return { blob: L, widthPx: b, heightPx: w, dpi: d, warnings:
|
|
302
|
+
return { blob: L, widthPx: b, heightPx: w, dpi: d, warnings: n };
|
|
303
303
|
}
|
|
304
|
-
async function
|
|
305
|
-
const e =
|
|
304
|
+
async function Ie(r, t = {}) {
|
|
305
|
+
const e = r ?? document.querySelector("om-cartograph");
|
|
306
306
|
if (!e) throw new Error("[onlymapjs/cartograph] renderCartographAtlas: no <om-cartograph> to render.");
|
|
307
|
-
const
|
|
308
|
-
if (!
|
|
309
|
-
if (
|
|
310
|
-
throw new Error(`[onlymapjs/cartograph] renderCartographAtlas: the atlas layer cannot drive pages (${
|
|
311
|
-
const i =
|
|
307
|
+
const n = e.querySelector("om-atlas") ?? null;
|
|
308
|
+
if (!n) throw new Error("[onlymapjs/cartograph] renderCartographAtlas: this cartograph has no <om-atlas>.");
|
|
309
|
+
if (n.problem)
|
|
310
|
+
throw new Error(`[onlymapjs/cartograph] renderCartographAtlas: the atlas layer cannot drive pages (${n.problem}).`);
|
|
311
|
+
const i = n.count;
|
|
312
312
|
if (i === 0) throw new Error("[onlymapjs/cartograph] renderCartographAtlas: the atlas layer produced no features.");
|
|
313
|
-
const o = t.format === "jpeg" ? "jpg" : "png", s =
|
|
313
|
+
const o = t.format === "jpeg" ? "jpg" : "png", s = n.filenames(o), a = [], l = n.index;
|
|
314
314
|
try {
|
|
315
315
|
if (t.page != null) {
|
|
316
316
|
const h = Math.trunc(t.page);
|
|
317
317
|
if (!Number.isInteger(h) || h < 0 || h >= i)
|
|
318
318
|
throw new Error(`[onlymapjs/cartograph] renderCartographAtlas: page ${t.page} is out of range (this atlas has ${i}).`);
|
|
319
|
-
|
|
320
|
-
const d = await
|
|
319
|
+
n.seek(h);
|
|
320
|
+
const d = await Jt(e, t, a);
|
|
321
321
|
return { blob: d.blob, filenames: [s[h]], pages: 1, dpi: d.dpi, warnings: a };
|
|
322
322
|
}
|
|
323
323
|
const c = [];
|
|
324
324
|
let u = t.dpi ?? 300;
|
|
325
325
|
for (let h = 0; h < i; h++) {
|
|
326
|
-
|
|
327
|
-
const d = await
|
|
326
|
+
n.seek(h);
|
|
327
|
+
const d = await Jt(e, t, a);
|
|
328
328
|
u = d.dpi, c.push({ name: s[h], data: d.blob }), t.onPage?.(h + 1, i);
|
|
329
329
|
}
|
|
330
|
-
return { blob: await
|
|
330
|
+
return { blob: await dr(c), filenames: s, pages: i, dpi: u, warnings: a };
|
|
331
331
|
} finally {
|
|
332
|
-
|
|
332
|
+
n.seek(l);
|
|
333
333
|
}
|
|
334
334
|
}
|
|
335
|
-
async function
|
|
336
|
-
for (const i of
|
|
335
|
+
async function Jt(r, t, e) {
|
|
336
|
+
for (const i of r.querySelectorAll("om-frame"))
|
|
337
337
|
await i.mapElement?.whenSettled?.({ timeout: 2e4 });
|
|
338
|
-
const
|
|
339
|
-
return e.push(...
|
|
338
|
+
const n = await zt(r, t);
|
|
339
|
+
return e.push(...n.warnings), n;
|
|
340
340
|
}
|
|
341
|
-
const
|
|
341
|
+
const Ar = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
342
342
|
__proto__: null,
|
|
343
|
-
MAX_CANVAS_AREA:
|
|
344
|
-
MAX_CANVAS_DIMENSION:
|
|
345
|
-
renderCartograph:
|
|
346
|
-
renderCartographAtlas:
|
|
343
|
+
MAX_CANVAS_AREA: Fe,
|
|
344
|
+
MAX_CANVAS_DIMENSION: Re,
|
|
345
|
+
renderCartograph: zt,
|
|
346
|
+
renderCartographAtlas: Ie
|
|
347
347
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
348
|
-
function
|
|
349
|
-
const
|
|
350
|
-
i.href =
|
|
348
|
+
function Zt(r, t, e = {}) {
|
|
349
|
+
const n = URL.createObjectURL(r), i = document.createElement("a");
|
|
350
|
+
i.href = n, i.download = t, document.body.appendChild(i), i.click(), i.remove();
|
|
351
351
|
const o = e.revokeAfterMs ?? 0;
|
|
352
|
-
o > 0 ? setTimeout(() => URL.revokeObjectURL(
|
|
352
|
+
o > 0 ? setTimeout(() => URL.revokeObjectURL(n), o) : URL.revokeObjectURL(n);
|
|
353
353
|
}
|
|
354
|
-
const
|
|
355
|
-
async function
|
|
354
|
+
const Sr = 3e4;
|
|
355
|
+
async function Qt(r, t = Sr) {
|
|
356
356
|
let e = !1;
|
|
357
|
-
const
|
|
357
|
+
const n = new Promise(
|
|
358
358
|
(o) => setTimeout(() => {
|
|
359
359
|
e = !0, o();
|
|
360
360
|
}, t)
|
|
361
361
|
), i = (async () => {
|
|
362
|
-
const o = [...
|
|
362
|
+
const o = [...r.querySelectorAll("om-frame")];
|
|
363
363
|
await Promise.all(o.map((a) => a.ready ?? Promise.resolve()));
|
|
364
|
-
const s = [...
|
|
364
|
+
const s = [...r.querySelectorAll("img")];
|
|
365
365
|
await Promise.all(
|
|
366
366
|
s.map(async (a) => {
|
|
367
367
|
a.complete || await new Promise((l) => {
|
|
@@ -370,55 +370,55 @@ async function Jt(n, t = wr) {
|
|
|
370
370
|
})
|
|
371
371
|
), typeof document < "u" && document.fonts?.ready && document.fonts.status !== "loaded" && await document.fonts.ready;
|
|
372
372
|
})();
|
|
373
|
-
return await Promise.race([i,
|
|
373
|
+
return await Promise.race([i, n]), { timedOut: e };
|
|
374
374
|
}
|
|
375
|
-
async function
|
|
376
|
-
if (!
|
|
375
|
+
async function Cr(r, t = {}) {
|
|
376
|
+
if (!r.hasAttribute("allow-url-actions") || typeof document < "u" && document.documentElement?.dataset?.omHost === "editor") return null;
|
|
377
377
|
const e = t.search ?? (typeof location < "u" ? location.search : "");
|
|
378
378
|
if (!e) return null;
|
|
379
|
-
const
|
|
380
|
-
i &&
|
|
381
|
-
const o =
|
|
379
|
+
const n = new URLSearchParams(e), i = n.get("cvd");
|
|
380
|
+
i && r.setAttribute("cvd", i);
|
|
381
|
+
const o = n.get("export");
|
|
382
382
|
if (o) {
|
|
383
|
-
await
|
|
384
|
-
const s = o === "jpeg" ? "jpeg" : "png", a = Number(
|
|
383
|
+
await Qt(r, t.timeoutMs);
|
|
384
|
+
const s = o === "jpeg" ? "jpeg" : "png", a = Number(n.get("dpi")) || void 0, l = r.getAttribute("cartograph-id") || "cartograph", c = n.get("page");
|
|
385
385
|
if (c != null) {
|
|
386
|
-
const h =
|
|
386
|
+
const h = r.querySelector("om-atlas");
|
|
387
387
|
if (!h) throw new Error(`?page=${c} needs an <om-atlas>; this cartograph is a single sheet.`);
|
|
388
388
|
const d = Number(c);
|
|
389
389
|
if (!Number.isInteger(d) || d < 1) throw new Error(`?page=${c} is not a page number (they start at 1).`);
|
|
390
390
|
h.refresh?.();
|
|
391
|
-
const m = await
|
|
391
|
+
const m = await Ie(r, { dpi: a, format: s, page: d - 1 });
|
|
392
392
|
for (const f of m.warnings) console.warn(`[onlymapjs/cartograph] ${f}`);
|
|
393
|
-
return
|
|
393
|
+
return Zt(m.blob, m.filenames[0] ?? `${l}.${s === "jpeg" ? "jpg" : "png"}`, { revokeAfterMs: 1e4 }), "export";
|
|
394
394
|
}
|
|
395
|
-
const u = await
|
|
395
|
+
const u = await zt(r, { dpi: a, format: s });
|
|
396
396
|
for (const h of u.warnings) console.warn(`[onlymapjs/cartograph] ${h}`);
|
|
397
|
-
return
|
|
397
|
+
return Zt(u.blob, `${l}.${s === "jpeg" ? "jpg" : "png"}`, { revokeAfterMs: 1e4 }), "export";
|
|
398
398
|
}
|
|
399
|
-
return
|
|
399
|
+
return n.get("print") === "1" ? (await Qt(r, t.timeoutMs), typeof r.print == "function" ? await r.print({ dpi: Number(n.get("dpi")) || void 0 }) : typeof window < "u" && window.print(), "print") : i ? "cvd" : null;
|
|
400
400
|
}
|
|
401
|
-
function
|
|
401
|
+
function kr() {
|
|
402
402
|
if (typeof document > "u") return;
|
|
403
|
-
const
|
|
403
|
+
const r = () => {
|
|
404
404
|
for (const t of document.querySelectorAll("om-cartograph[allow-url-actions]"))
|
|
405
|
-
|
|
405
|
+
Cr(t).catch((e) => console.warn(`[onlymapjs/cartograph] URL action failed: ${e.message}`));
|
|
406
406
|
};
|
|
407
|
-
document.readyState === "loading" ? document.addEventListener("DOMContentLoaded",
|
|
407
|
+
document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", r, { once: !0 }) : r();
|
|
408
408
|
}
|
|
409
|
-
const
|
|
409
|
+
const _e = typeof window < "u" && typeof document < "u" && typeof customElements < "u", Oe = _e ? HTMLElement : class {
|
|
410
410
|
};
|
|
411
|
-
function
|
|
412
|
-
|
|
411
|
+
function k(r, t) {
|
|
412
|
+
_e && (customElements.get(r) || customElements.define(r, t));
|
|
413
413
|
}
|
|
414
|
-
function
|
|
414
|
+
function $r(r) {
|
|
415
415
|
if (typeof DOMParser > "u")
|
|
416
416
|
throw new Error(
|
|
417
417
|
"[onlymapjs] Parsing a manifest string needs a DOM implementation (DOMParser). In node, run under a DOM test environment — e.g. vitest with `environment: 'happy-dom'` (or jsdom) — or pass an already-parsed Element instead of a string."
|
|
418
418
|
);
|
|
419
|
-
return new DOMParser().parseFromString(
|
|
419
|
+
return new DOMParser().parseFromString(r, "text/html");
|
|
420
420
|
}
|
|
421
|
-
class I extends
|
|
421
|
+
class I extends Oe {
|
|
422
422
|
renderQueued = !1;
|
|
423
423
|
connectedCallback() {
|
|
424
424
|
this.scheduleRender();
|
|
@@ -442,66 +442,72 @@ class I extends Ar {
|
|
|
442
442
|
if (c == null || c === "") return null;
|
|
443
443
|
const u = Number(c);
|
|
444
444
|
return Number.isFinite(u) ? u : null;
|
|
445
|
-
}, e = t("x"),
|
|
446
|
-
this.style.position = "absolute", e != null && (this.style.left = `${e}mm`),
|
|
445
|
+
}, e = t("x"), n = t("y"), i = t("w"), o = t("h");
|
|
446
|
+
this.style.position = "absolute", e != null && (this.style.left = `${e}mm`), n != null && (this.style.top = `${n}mm`), i != null && (this.style.width = `${i}mm`), o != null && (this.style.height = `${o}mm`);
|
|
447
447
|
const s = t("rotation");
|
|
448
448
|
s != null && s !== 0 ? (this.style.transform = `rotate(${s}deg)`, this.style.transformOrigin = "center") : this.style.removeProperty("transform");
|
|
449
449
|
const a = t("z");
|
|
450
450
|
a != null && Number.isInteger(a) ? this.style.zIndex = String(a) : this.style.removeProperty("z-index");
|
|
451
451
|
}
|
|
452
452
|
}
|
|
453
|
-
const gt = "cartograph/2",
|
|
453
|
+
const gt = "cartograph/2", fi = ["default", "dark", "sepia", "blueprint", "minimal"], te = ["A0", "A1", "A2", "A3", "A4", "A5", "Letter", "Legal"], xr = /* @__PURE__ */ new Map([
|
|
454
454
|
["projection", "live frames render Web Mercator (EPSG:3857) only — Globe support is design-only; use a static frame for other projections"]
|
|
455
|
-
]),
|
|
455
|
+
]), j = ["id", "x", "y", "w", "h", "rotation", "z", "locked", "hidden"], T = {
|
|
456
456
|
"om-cartograph": ["cartograph-id", "format", "size", "width", "height", "orientation", "theme", "title", "attribution", "notes", "cvd", "bleed", "crop-marks", "safe-zone", "dpi", "flatten", "color-profile", "allow-url-actions", "keep-badge"],
|
|
457
|
-
"om-frame": [...
|
|
458
|
-
"om-legend": [...
|
|
457
|
+
"om-frame": [...j, "src", "mode", "center", "zoom", "bearing", "pitch", "dpi", "crs", "corners", "crs-def", "overview-of", "overview-stroke", "atlas-fit", "atlas-margin", "frame-stroke", "frame-bg"],
|
|
458
|
+
"om-legend": [...j, "for", "title", "columns", "derived"],
|
|
459
459
|
"om-legend-row": ["layer", "match", "label", "hide", "order", "color", "shape"],
|
|
460
460
|
// NOTE: the discriminator on furniture is `kind`, never `style` — `style` is
|
|
461
461
|
// the global HTML attribute the runtime itself writes for mm placement, so
|
|
462
462
|
// `style="double"` would be erased on the first render. `kind` also matches
|
|
463
463
|
// om-text/om-shape, so the whole vocabulary has ONE discriminator word.
|
|
464
|
-
"om-scalebar": [...
|
|
465
|
-
"om-north": [...
|
|
466
|
-
"om-graticule": [...
|
|
467
|
-
"om-text": [...
|
|
468
|
-
"om-shape": [...
|
|
469
|
-
"om-image": [...
|
|
464
|
+
"om-scalebar": [...j, "for", "units", "segments", "segment-length", "kind"],
|
|
465
|
+
"om-north": [...j, "for", "kind"],
|
|
466
|
+
"om-graticule": [...j, "for", "crs", "crs-def", "interval", "interval-x", "interval-y", "kind", "labels", "format"],
|
|
467
|
+
"om-text": [...j, "kind", "font-size", "weight", "align", "font", "color", "bg"],
|
|
468
|
+
"om-shape": [...j, "kind", "fill", "fill-opacity", "stroke", "stroke-width", "radius"],
|
|
469
|
+
"om-image": [...j, "src", "fit"],
|
|
470
|
+
// NOT placed: a source is a child of <om-frame> that says where the frame's
|
|
471
|
+
// picture may come from. Its corners/crs describe THAT source — a capture
|
|
472
|
+
// carries the georeference that was true when it was taken, which is the
|
|
473
|
+
// only way furniture can be right when the live map never loaded and its
|
|
474
|
+
// CRS is therefore unknowable.
|
|
475
|
+
"om-source": ["src", "corners", "crs", "crs-def"],
|
|
470
476
|
"om-atlas": ["id", "for", "layer", "filter", "sort", "filename", "page-name"]
|
|
471
|
-
}, pt = Object.keys(T),
|
|
472
|
-
function
|
|
473
|
-
return
|
|
477
|
+
}, pt = Object.keys(T), Et = "data-om-carto-vector", Er = ["metric", "imperial", "nautical"], Nr = 0.3048, Pr = 1609.344, Tr = 1852;
|
|
478
|
+
function Lr(r) {
|
|
479
|
+
return r != null && Er.includes(r) ? r : null;
|
|
474
480
|
}
|
|
475
|
-
function
|
|
476
|
-
if (!isFinite(
|
|
477
|
-
const t = Math.pow(10, Math.floor(Math.log10(
|
|
481
|
+
function Ue(r) {
|
|
482
|
+
if (!isFinite(r) || r <= 0) return 0;
|
|
483
|
+
const t = Math.pow(10, Math.floor(Math.log10(r))), e = r / t;
|
|
478
484
|
return (e >= 5 ? 5 : e >= 2 ? 2 : 1) * t;
|
|
479
485
|
}
|
|
480
|
-
const
|
|
486
|
+
const ee = {
|
|
481
487
|
// Finest first; the largest tier whose snapped length is ≥ 1 unit wins.
|
|
482
488
|
metric: [
|
|
483
489
|
{ metersPerUnit: 1, label: "m" },
|
|
484
490
|
{ metersPerUnit: 1e3, label: "km" }
|
|
485
491
|
],
|
|
486
492
|
imperial: [
|
|
487
|
-
{ metersPerUnit:
|
|
488
|
-
{ metersPerUnit:
|
|
493
|
+
{ metersPerUnit: Nr, label: "ft" },
|
|
494
|
+
{ metersPerUnit: Pr, label: "mi" }
|
|
489
495
|
],
|
|
490
|
-
nautical: [{ metersPerUnit:
|
|
496
|
+
nautical: [{ metersPerUnit: Tr, label: "nmi" }]
|
|
491
497
|
};
|
|
492
|
-
function
|
|
493
|
-
if (!Number.isFinite(
|
|
494
|
-
const o = Number.isInteger(e) && e > 0 ? e : 4, s =
|
|
498
|
+
function De({ groundMetersPerMm: r, maxWidthMm: t, segments: e = 4, units: n = "metric", segmentLengthMeters: i }) {
|
|
499
|
+
if (!Number.isFinite(r) || r <= 0 || !Number.isFinite(t) || t <= 0) return null;
|
|
500
|
+
const o = Number.isInteger(e) && e > 0 ? e : 4, s = ee[n] ?? ee.metric, a = t / o * r;
|
|
495
501
|
let l, c;
|
|
496
502
|
if (i != null && Number.isFinite(i) && i > 0)
|
|
497
|
-
l = i, c =
|
|
503
|
+
l = i, c = re(s, l);
|
|
498
504
|
else {
|
|
499
|
-
c =
|
|
500
|
-
const f =
|
|
505
|
+
c = re(s, a);
|
|
506
|
+
const f = Ue(a / c.metersPerUnit);
|
|
501
507
|
if (f <= 0) return null;
|
|
502
508
|
l = f * c.metersPerUnit;
|
|
503
509
|
}
|
|
504
|
-
const u = l /
|
|
510
|
+
const u = l / r;
|
|
505
511
|
if (!Number.isFinite(u) || u <= 0) return null;
|
|
506
512
|
const h = l / c.metersPerUnit, d = h < 1 ? 2 : h < 10 && !Number.isInteger(h) ? 1 : 0, m = Array.from({ length: o + 1 }, (f, g) => (g * h).toFixed(d));
|
|
507
513
|
return {
|
|
@@ -513,15 +519,15 @@ function Ie({ groundMetersPerMm: n, maxWidthMm: t, segments: e = 4, units: r = "
|
|
|
513
519
|
unitLabel: c.label,
|
|
514
520
|
// 1 mm on the page is groundMetersPerMm metres on the ground; the RF is
|
|
515
521
|
// that ratio in consistent units (mm : mm).
|
|
516
|
-
scaleDenominator:
|
|
522
|
+
scaleDenominator: r * 1e3
|
|
517
523
|
};
|
|
518
524
|
}
|
|
519
|
-
function
|
|
520
|
-
const
|
|
525
|
+
function Rr(r, t, e) {
|
|
526
|
+
const n = Math.min(2.6, Math.max(1.6, e * 0.34)), i = 0.2, o = n * 1.25, s = Math.max(0.6, Math.min(2.2, e - o - 0.4)), a = 0, l = r.segmentMm, c = [], u = [];
|
|
521
527
|
if (t === "single" || t === "double") {
|
|
522
528
|
const p = t === "double" ? 2 : 1, b = s / p;
|
|
523
529
|
for (let w = 0; w < p; w++)
|
|
524
|
-
for (let y = 0; y <
|
|
530
|
+
for (let y = 0; y < r.segments; y++)
|
|
525
531
|
c.push({
|
|
526
532
|
x: y * l,
|
|
527
533
|
y: a + w * b,
|
|
@@ -531,128 +537,128 @@ function Pr(n, t, e) {
|
|
|
531
537
|
filled: (y + w) % 2 === 0
|
|
532
538
|
});
|
|
533
539
|
} else {
|
|
534
|
-
u.push({ x1: 0, y1: a + s, x2:
|
|
535
|
-
const p = t === "ticks" ?
|
|
540
|
+
u.push({ x1: 0, y1: a + s, x2: r.totalMm, y2: a + s });
|
|
541
|
+
const p = t === "ticks" ? r.segments : 1;
|
|
536
542
|
for (let b = 0; b <= p; b++) {
|
|
537
|
-
const w = b / p *
|
|
543
|
+
const w = b / p * r.totalMm;
|
|
538
544
|
u.push({ x1: w, y1: a, x2: w, y2: a + s });
|
|
539
545
|
}
|
|
540
546
|
}
|
|
541
|
-
const h =
|
|
547
|
+
const h = r.labels.length - 1, d = r.labels.map((p, b) => ({
|
|
542
548
|
// The end label carries the unit so the bar reads "0 2 4 6 8 km".
|
|
543
|
-
text: b === h ? `${p} ${
|
|
549
|
+
text: b === h ? `${p} ${r.unitLabel}` : p,
|
|
544
550
|
// Keep the end label inside the drawn width rather than hanging off it.
|
|
545
|
-
x: b === h ?
|
|
546
|
-
y: a + s +
|
|
551
|
+
x: b === h ? r.totalMm : b * l,
|
|
552
|
+
y: a + s + n,
|
|
547
553
|
anchor: b === 0 ? "start" : b === h ? "end" : "middle",
|
|
548
554
|
index: b
|
|
549
|
-
})), m = (p) => p.length *
|
|
555
|
+
})), m = (p) => p.length * n * 0.62, f = [];
|
|
550
556
|
let g = -1 / 0;
|
|
551
557
|
for (const p of d) {
|
|
552
558
|
const b = m(p.text) / 2, w = p.anchor === "start" ? p.x : p.anchor === "end" ? p.x - b * 2 : p.x - b, y = w + m(p.text);
|
|
553
|
-
if (!(!(p.index === 0 || p.index === h) && w < g +
|
|
554
|
-
if (p.index === h && w < g +
|
|
555
|
-
for (; f.length > 1 && f[f.length - 1].x + m(f[f.length - 1].text) / 2 > w -
|
|
559
|
+
if (!(!(p.index === 0 || p.index === h) && w < g + n * 0.4)) {
|
|
560
|
+
if (p.index === h && w < g + n * 0.4)
|
|
561
|
+
for (; f.length > 1 && f[f.length - 1].x + m(f[f.length - 1].text) / 2 > w - n * 0.4; ) f.pop();
|
|
556
562
|
f.push({ text: p.text, x: p.x, y: p.y, anchor: p.anchor }), g = y;
|
|
557
563
|
}
|
|
558
564
|
}
|
|
559
|
-
return { bars: c, strokes: u, labels: f, fontMm:
|
|
565
|
+
return { bars: c, strokes: u, labels: f, fontMm: n, strokeMm: i, segmentMeters: r.segmentMeters, unitLabel: r.unitLabel, scaleDenominator: r.scaleDenominator };
|
|
560
566
|
}
|
|
561
|
-
function
|
|
562
|
-
let e =
|
|
563
|
-
for (const
|
|
564
|
-
t /
|
|
567
|
+
function re(r, t) {
|
|
568
|
+
let e = r[0];
|
|
569
|
+
for (const n of r)
|
|
570
|
+
t / n.metersPerUnit >= 1 && (e = n);
|
|
565
571
|
return e;
|
|
566
572
|
}
|
|
567
|
-
const
|
|
568
|
-
function
|
|
569
|
-
return !Number.isFinite(
|
|
573
|
+
const Fr = " ";
|
|
574
|
+
function Ir(r) {
|
|
575
|
+
return !Number.isFinite(r) || r <= 0 ? "" : Math.round(r).toString().replace(/\B(?=(\d{3})+(?!\d))/g, Fr);
|
|
570
576
|
}
|
|
571
|
-
const
|
|
572
|
-
function
|
|
573
|
-
if (
|
|
574
|
-
if (
|
|
575
|
-
const e =
|
|
576
|
-
return
|
|
577
|
+
const je = /\{\{\s*([\w.]+)\s*\}\}/g;
|
|
578
|
+
function _r(r, t) {
|
|
579
|
+
if (r.startsWith("atlas.")) return t.atlas?.[r.slice(6)];
|
|
580
|
+
if (r.startsWith("frame.")) {
|
|
581
|
+
const e = r.slice(6), n = e.lastIndexOf(".");
|
|
582
|
+
return n <= 0 ? void 0 : t.frames?.get(e.slice(0, n))?.[e.slice(n + 1)];
|
|
577
583
|
}
|
|
578
|
-
if ((
|
|
579
|
-
const
|
|
580
|
-
if (
|
|
584
|
+
if ((r === "scale" || r === "crs") && t.soleFrameId) {
|
|
585
|
+
const n = t.frames?.get(t.soleFrameId)?.[r];
|
|
586
|
+
if (n !== void 0) return n;
|
|
581
587
|
}
|
|
582
|
-
return t.page[
|
|
588
|
+
return t.page[r];
|
|
583
589
|
}
|
|
584
|
-
function
|
|
590
|
+
function ze(r, t) {
|
|
585
591
|
const e = [];
|
|
586
|
-
return { text:
|
|
587
|
-
const s =
|
|
592
|
+
return { text: r.replace(je, (i, o) => {
|
|
593
|
+
const s = _r(o, t);
|
|
588
594
|
return s === void 0 ? (e.push(o), i) : s;
|
|
589
595
|
}), unresolved: e };
|
|
590
596
|
}
|
|
591
|
-
function
|
|
592
|
-
return [...
|
|
597
|
+
function Or(r) {
|
|
598
|
+
return [...r.matchAll(je)].map((t) => t[1]);
|
|
593
599
|
}
|
|
594
|
-
const
|
|
595
|
-
function
|
|
596
|
-
const e = [],
|
|
597
|
-
if (!
|
|
598
|
-
const i =
|
|
599
|
-
|
|
600
|
+
const ne = /* @__PURE__ */ new WeakMap();
|
|
601
|
+
function Ur(r, t) {
|
|
602
|
+
const e = [], n = r.ownerDocument ?? (typeof document < "u" ? document : null);
|
|
603
|
+
if (!n) return e;
|
|
604
|
+
const i = n.createTreeWalker(
|
|
605
|
+
r,
|
|
600
606
|
4
|
|
601
607
|
/* NodeFilter.SHOW_TEXT */
|
|
602
608
|
), o = [];
|
|
603
609
|
for (let s = i.nextNode(); s; s = i.nextNode()) o.push(s);
|
|
604
610
|
for (const s of o) {
|
|
605
|
-
let a =
|
|
611
|
+
let a = ne.get(s);
|
|
606
612
|
if (a === void 0) {
|
|
607
613
|
if (a = s.data, !a.includes("{{")) continue;
|
|
608
|
-
|
|
614
|
+
ne.set(s, a);
|
|
609
615
|
}
|
|
610
|
-
const l =
|
|
616
|
+
const l = ze(a, t);
|
|
611
617
|
s.data !== l.text && (s.data = l.text), e.push(...l.unresolved);
|
|
612
618
|
}
|
|
613
619
|
return e;
|
|
614
620
|
}
|
|
615
|
-
function
|
|
616
|
-
return `${
|
|
621
|
+
function Dr(r = /* @__PURE__ */ new Date()) {
|
|
622
|
+
return `${r.getFullYear()}-${String(r.getMonth() + 1).padStart(2, "0")}-${String(r.getDate()).padStart(2, "0")}`;
|
|
617
623
|
}
|
|
618
|
-
const
|
|
619
|
-
function
|
|
620
|
-
return
|
|
624
|
+
const Nt = "data-om-carto-unlinked";
|
|
625
|
+
function Ge(r) {
|
|
626
|
+
return r.closest("om-cartograph");
|
|
621
627
|
}
|
|
622
|
-
function
|
|
623
|
-
const e =
|
|
628
|
+
function qe(r, t) {
|
|
629
|
+
const e = Ge(r);
|
|
624
630
|
if (!e || !t) return null;
|
|
625
|
-
for (const
|
|
626
|
-
if (
|
|
631
|
+
for (const n of e.querySelectorAll("om-frame"))
|
|
632
|
+
if (n.id === t) return n;
|
|
627
633
|
return null;
|
|
628
634
|
}
|
|
629
|
-
function
|
|
630
|
-
return [...
|
|
635
|
+
function We(r) {
|
|
636
|
+
return [...r.querySelectorAll("om-frame")];
|
|
631
637
|
}
|
|
632
|
-
function
|
|
633
|
-
const t =
|
|
638
|
+
function jr(r) {
|
|
639
|
+
const t = Ge(r);
|
|
634
640
|
if (!t) return null;
|
|
635
|
-
const e =
|
|
641
|
+
const e = We(t);
|
|
636
642
|
return e.length === 1 ? e[0] : null;
|
|
637
643
|
}
|
|
638
|
-
function O(
|
|
639
|
-
const t =
|
|
640
|
-
return t ?
|
|
644
|
+
function O(r) {
|
|
645
|
+
const t = r.getAttribute("for");
|
|
646
|
+
return t ? qe(r, t) : jr(r);
|
|
641
647
|
}
|
|
642
|
-
function q(
|
|
643
|
-
let e =
|
|
648
|
+
function q(r, t) {
|
|
649
|
+
let e = r.querySelector(`:scope > [${Nt}]`);
|
|
644
650
|
if (!e) {
|
|
645
|
-
for (const
|
|
646
|
-
|
|
647
|
-
e =
|
|
651
|
+
for (const n of [...r.children])
|
|
652
|
+
n.tagName.toLowerCase() !== "om-legend-row" && n.remove();
|
|
653
|
+
e = r.ownerDocument.createElement("div"), e.setAttribute(Nt, ""), e.style.cssText = "font:italic 2.6mm/1.3 system-ui,sans-serif;color:var(--om-carto-ink);opacity:.7;", r.appendChild(e);
|
|
648
654
|
}
|
|
649
655
|
e.textContent !== t && (e.textContent = t);
|
|
650
656
|
}
|
|
651
|
-
function
|
|
652
|
-
|
|
657
|
+
function zr(r) {
|
|
658
|
+
r.querySelector(`:scope > [${Nt}]`)?.remove();
|
|
653
659
|
}
|
|
654
|
-
const
|
|
655
|
-
class
|
|
660
|
+
const ie = "data-om-carto-page", se = "data-om-carto-marks", bt = "data-om-carto-credit", Be = "Built with OnlyMap by NIKA", Gr = `${Be} · free for non-commercial use`, nt = 2, oe = 1.2, yt = 2.4, ae = 1.5, wt = 1.2, le = 0.3, ce = 0.8, vt = "http://www.w3.org/2000/svg", qr = 6e4;
|
|
661
|
+
class Ve extends I {
|
|
656
662
|
static observedAttributes = [...T["om-cartograph"]];
|
|
657
663
|
frameListenerBound = !1;
|
|
658
664
|
/** Fields of the atlas page currently displayed, for {{atlas.<field>}}. */
|
|
@@ -661,7 +667,7 @@ class Ge extends I {
|
|
|
661
667
|
unsubscribeLicense = null;
|
|
662
668
|
/** The resolved page box, mm — furniture and export read this, never the attributes. */
|
|
663
669
|
get pageSize() {
|
|
664
|
-
return
|
|
670
|
+
return ht(this.getAttribute("size"), this.getAttribute("width"), this.getAttribute("height"), this.getAttribute("orientation"));
|
|
665
671
|
}
|
|
666
672
|
/** Bleed in mm (0 when unset) — extends the printed sheet past the trim. */
|
|
667
673
|
get bleedMm() {
|
|
@@ -691,20 +697,20 @@ class Ge extends I {
|
|
|
691
697
|
* runtime's job (issue #41 §9: the om-map carries the key).
|
|
692
698
|
*/
|
|
693
699
|
renderCredit() {
|
|
694
|
-
const t =
|
|
700
|
+
const t = Y();
|
|
695
701
|
t && !this.unsubscribeLicense && typeof t.subscribeLicense == "function" && (this.unsubscribeLicense = t.subscribeLicense(() => this.renderCredit()));
|
|
696
|
-
const e = this.creditMode(t, this.hasAttribute("keep-badge")),
|
|
697
|
-
if (e === "hidden" ||
|
|
702
|
+
const e = this.creditMode(t, this.hasAttribute("keep-badge")), n = [...this.querySelectorAll("om-text")].some((a) => /onlymap/i.test(a.textContent ?? "")), i = this.querySelector(`:scope > [${bt}]`);
|
|
703
|
+
if (e === "hidden" || n) {
|
|
698
704
|
i?.remove();
|
|
699
705
|
return;
|
|
700
706
|
}
|
|
701
|
-
const o = e === "voluntary" ?
|
|
707
|
+
const o = e === "voluntary" ? Be : Gr;
|
|
702
708
|
if (i) {
|
|
703
709
|
i.textContent !== o && (i.textContent = o), this.armCreditPainter(i);
|
|
704
710
|
return;
|
|
705
711
|
}
|
|
706
712
|
const s = this.ownerDocument.createElement("div");
|
|
707
|
-
s.setAttribute(bt, ""), s.setAttribute("z", "2147483644"), s.textContent = o, s.style.cssText = `position:absolute;left:${
|
|
713
|
+
s.setAttribute(bt, ""), s.setAttribute("z", "2147483644"), s.textContent = o, s.style.cssText = `position:absolute;left:${nt}mm;bottom:${oe}mm;z-index:2147483644;font:${yt}mm/${ae} system-ui,sans-serif;color:#374151;background:rgba(255,255,255,.72);padding:${le}mm ${wt}mm;border-radius:${ce}mm;pointer-events:none;`, this.armCreditPainter(s), this.appendChild(s);
|
|
708
714
|
}
|
|
709
715
|
/**
|
|
710
716
|
* Which credit this sheet carries, from the core's own predicate so the
|
|
@@ -715,16 +721,16 @@ class Ge extends I {
|
|
|
715
721
|
if (!t) return "obligation";
|
|
716
722
|
if (typeof t.badgeMode != "function")
|
|
717
723
|
return t.getEntitlements().hideBadge && !e ? "hidden" : "obligation";
|
|
718
|
-
const
|
|
719
|
-
return
|
|
724
|
+
const n = t.badgeMode({ keepBadge: e });
|
|
725
|
+
return n === "pending" ? "obligation" : n;
|
|
720
726
|
}
|
|
721
727
|
/** Give the runtime-owned DOM credit the same canvas paint contract as authored furniture. */
|
|
722
728
|
armCreditPainter(t) {
|
|
723
|
-
t.paintCartograph = (e,
|
|
724
|
-
const i = (u) => u *
|
|
729
|
+
t.paintCartograph = (e, n) => {
|
|
730
|
+
const i = (u) => u * n.pxPerMm, o = t.textContent ?? "", a = yt * ae + le * 2, l = this.pageSize.heightMm - oe - a;
|
|
725
731
|
e.save(), e.font = `${i(yt)}px system-ui, sans-serif`;
|
|
726
|
-
const c = e.measureText(o).width /
|
|
727
|
-
e.fillStyle = "rgba(255,255,255,.72)", e.beginPath(), typeof e.roundRect == "function" ? e.roundRect(i(
|
|
732
|
+
const c = e.measureText(o).width / n.pxPerMm + wt * 2;
|
|
733
|
+
e.fillStyle = "rgba(255,255,255,.72)", e.beginPath(), typeof e.roundRect == "function" ? e.roundRect(i(nt), i(l), i(c), i(a), i(ce)) : e.rect(i(nt), i(l), i(c), i(a)), e.fill(), e.fillStyle = "#374151", e.textAlign = "left", e.textBaseline = "middle", e.fillText(o, i(nt + wt), i(l + a / 2)), e.restore();
|
|
728
734
|
};
|
|
729
735
|
}
|
|
730
736
|
/**
|
|
@@ -738,14 +744,14 @@ class Ge extends I {
|
|
|
738
744
|
* synchronously and captures are asynchronous.
|
|
739
745
|
*/
|
|
740
746
|
async print(t = {}) {
|
|
741
|
-
const e = t.dpi ?? (Number(this.getAttribute("dpi")) || 300),
|
|
747
|
+
const e = t.dpi ?? (Number(this.getAttribute("dpi")) || 300), n = [...this.querySelectorAll("om-frame")];
|
|
742
748
|
let i = null;
|
|
743
|
-
if (this.hasAttribute("flatten") && (i = await this.buildFlattenedImage(e).catch(() => null), i && this.appendChild(i)), !i) for (const a of
|
|
749
|
+
if (this.hasAttribute("flatten") && (i = await this.buildFlattenedImage(e).catch(() => null), i && this.appendChild(i)), !i) for (const a of n) await a.enterPrintMode?.(e);
|
|
744
750
|
let o = !1;
|
|
745
751
|
const s = () => {
|
|
746
752
|
if (!o) {
|
|
747
753
|
o = !0, i && URL.revokeObjectURL(i.src), i?.remove(), i = null;
|
|
748
|
-
for (const a of
|
|
754
|
+
for (const a of n) a.exitPrintMode?.();
|
|
749
755
|
window.removeEventListener("afterprint", s);
|
|
750
756
|
}
|
|
751
757
|
};
|
|
@@ -753,13 +759,13 @@ class Ge extends I {
|
|
|
753
759
|
try {
|
|
754
760
|
window.print();
|
|
755
761
|
} finally {
|
|
756
|
-
o || setTimeout(s,
|
|
762
|
+
o || setTimeout(s, qr);
|
|
757
763
|
}
|
|
758
764
|
}
|
|
759
765
|
/** Render the whole page to one image, for `flatten`. */
|
|
760
766
|
async buildFlattenedImage(t) {
|
|
761
|
-
const { renderCartograph: e } = await Promise.resolve().then(() =>
|
|
762
|
-
i.src = URL.createObjectURL(
|
|
767
|
+
const { renderCartograph: e } = await Promise.resolve().then(() => Ar), { blob: n } = await e(this, { dpi: t }), i = this.ownerDocument.createElement("img");
|
|
768
|
+
i.src = URL.createObjectURL(n), i.setAttribute("data-om-carto-flattened", "");
|
|
763
769
|
const o = this.bleedMm;
|
|
764
770
|
return i.style.cssText = `position:absolute;left:${-o}mm;top:${-o}mm;width:calc(100% + ${o * 2}mm);height:calc(100% + ${o * 2}mm);z-index:2147483645;`, await i.decode().catch(() => {
|
|
765
771
|
}), i;
|
|
@@ -779,20 +785,20 @@ class Ge extends I {
|
|
|
779
785
|
}
|
|
780
786
|
/** Values every `{{token}}` on this page resolves against. */
|
|
781
787
|
tokenContext() {
|
|
782
|
-
const t = /* @__PURE__ */ new Map(), e =
|
|
788
|
+
const t = /* @__PURE__ */ new Map(), e = We(this);
|
|
783
789
|
for (const o of e) {
|
|
784
790
|
const s = o.georef, a = s?.groundMetersPerMm() ?? 0;
|
|
785
791
|
t.set(o.id, {
|
|
786
|
-
scale: a > 0 ?
|
|
792
|
+
scale: a > 0 ? Ir(a * 1e3) : void 0,
|
|
787
793
|
crs: s?.crs
|
|
788
794
|
});
|
|
789
795
|
}
|
|
790
|
-
const
|
|
796
|
+
const n = { page: {}, frames: t, soleFrameId: e.length === 1 ? e[0].id : null, atlas: this.atlasFields }, i = (o) => ze(this.getAttribute(o) ?? "", n).text;
|
|
791
797
|
return {
|
|
792
798
|
page: {
|
|
793
799
|
title: i("title"),
|
|
794
800
|
attribution: i("attribution"),
|
|
795
|
-
date:
|
|
801
|
+
date: Dr(),
|
|
796
802
|
notes: i("notes")
|
|
797
803
|
},
|
|
798
804
|
frames: t,
|
|
@@ -808,13 +814,13 @@ class Ge extends I {
|
|
|
808
814
|
t.resolveTokens?.();
|
|
809
815
|
}
|
|
810
816
|
renderNow() {
|
|
811
|
-
const { widthMm: t, heightMm: e } = this.pageSize,
|
|
812
|
-
this.style.display = "block", this.style.position = "relative", this.style.width = `${t}mm`, this.style.height = `${e}mm`, this.style.margin =
|
|
813
|
-
let i = this.querySelector(`style[${
|
|
814
|
-
i || (i = document.createElement("style"), i.setAttribute(
|
|
815
|
-
const o = t +
|
|
817
|
+
const { widthMm: t, heightMm: e } = this.pageSize, n = this.bleedMm;
|
|
818
|
+
this.style.display = "block", this.style.position = "relative", this.style.width = `${t}mm`, this.style.height = `${e}mm`, this.style.margin = n > 0 ? `${n}mm` : "", this.style.overflow = n > 0 ? "visible" : "hidden";
|
|
819
|
+
let i = this.querySelector(`style[${ie}]`);
|
|
820
|
+
i || (i = document.createElement("style"), i.setAttribute(ie, ""), this.prepend(i));
|
|
821
|
+
const o = t + n * 2, s = e + n * 2;
|
|
816
822
|
i.textContent = `@page { size: ${o}mm ${s}mm; margin: 0; }
|
|
817
|
-
@media print { html, body { margin: 0; padding: 0; } om-cartograph { break-after: page; } }`, this.renderPrintMarks(t, e,
|
|
823
|
+
@media print { html, body { margin: 0; padding: 0; } om-cartograph { break-after: page; } }`, this.renderPrintMarks(t, e, n), this.applyCvd(), this.refreshTokens(), this.renderCredit();
|
|
818
824
|
}
|
|
819
825
|
/**
|
|
820
826
|
* Crop marks and the safe-zone guide.
|
|
@@ -825,15 +831,15 @@ class Ge extends I {
|
|
|
825
831
|
* reach paper or an exported image — a guide printed on the deliverable is
|
|
826
832
|
* worse than no guide.
|
|
827
833
|
*/
|
|
828
|
-
renderPrintMarks(t, e,
|
|
829
|
-
const i = this.hasAttribute("crop-marks") &&
|
|
834
|
+
renderPrintMarks(t, e, n) {
|
|
835
|
+
const i = this.hasAttribute("crop-marks") && n > 0, o = Number(this.getAttribute("safe-zone")), s = Number.isFinite(o) && o > 0, a = this.querySelector(`:scope > [${se}]`);
|
|
830
836
|
if (!i && !s) {
|
|
831
837
|
a?.remove();
|
|
832
838
|
return;
|
|
833
839
|
}
|
|
834
840
|
const l = this.ownerDocument, c = a ?? l.createElementNS(vt, "svg");
|
|
835
|
-
if (c.setAttribute(
|
|
836
|
-
const u = Math.min(
|
|
841
|
+
if (c.setAttribute(se, ""), c.setAttribute("viewBox", `${-n} ${-n} ${t + n * 2} ${e + n * 2}`), c.setAttribute("width", `${t + n * 2}mm`), c.setAttribute("height", `${e + n * 2}mm`), c.style.cssText = `position:absolute;left:${-n}mm;top:${-n}mm;pointer-events:none;z-index:2147483646;`, c.replaceChildren(), i) {
|
|
842
|
+
const u = Math.min(n, 4), h = Math.min(n * 0.35, 1.5), d = [];
|
|
837
843
|
for (const m of [0, t])
|
|
838
844
|
for (const f of [0, e]) {
|
|
839
845
|
const g = m === 0 ? -1 : 1, p = f === 0 ? -1 : 1;
|
|
@@ -859,18 +865,18 @@ class Ge extends I {
|
|
|
859
865
|
* injected only when a page actually asks for one.
|
|
860
866
|
*/
|
|
861
867
|
applyCvd() {
|
|
862
|
-
const t =
|
|
868
|
+
const t = Dt(this.getAttribute("cvd"));
|
|
863
869
|
if (!t) {
|
|
864
870
|
this.style.removeProperty("filter");
|
|
865
871
|
return;
|
|
866
872
|
}
|
|
867
|
-
|
|
873
|
+
wr(this.ownerDocument), this.style.filter = `url(#${Le(t)})`;
|
|
868
874
|
}
|
|
869
875
|
}
|
|
870
|
-
|
|
871
|
-
function
|
|
872
|
-
const o =
|
|
873
|
-
for (const c of
|
|
876
|
+
k("om-cartograph", Ve);
|
|
877
|
+
function Wr({ text: r, maxWidth: t, fontSizePx: e, lineHeightPx: n, measure: i }) {
|
|
878
|
+
const o = n > 0 ? n : e * 1.2, s = [];
|
|
879
|
+
for (const c of r.split(/\r?\n/)) {
|
|
874
880
|
const u = c.split(/\s+/).filter((m) => m !== "");
|
|
875
881
|
if (u.length === 0) {
|
|
876
882
|
s.push({ text: "", baselineY: 0, width: 0 });
|
|
@@ -898,15 +904,15 @@ function jr({ text: n, maxWidth: t, fontSizePx: e, lineHeightPx: r, measure: i }
|
|
|
898
904
|
c.baselineY = a + u * o, c.width > l && (l = c.width);
|
|
899
905
|
}), { lines: s, lineHeight: o, maxWidth: l };
|
|
900
906
|
}
|
|
901
|
-
function
|
|
907
|
+
function gi(r) {
|
|
902
908
|
if (typeof document > "u") return null;
|
|
903
909
|
const e = document.createElement("canvas").getContext("2d");
|
|
904
|
-
return e ? (e.font =
|
|
910
|
+
return e ? (e.font = r, (n) => e.measureText(n).width) : null;
|
|
905
911
|
}
|
|
906
|
-
function
|
|
907
|
-
return
|
|
912
|
+
function Br(r, t, e) {
|
|
913
|
+
return r === "center" ? (t - e) / 2 : r === "end" || r === "right" ? t - e : 0;
|
|
908
914
|
}
|
|
909
|
-
class
|
|
915
|
+
class Ke extends I {
|
|
910
916
|
static observedAttributes = [...T["om-text"]];
|
|
911
917
|
renderNow() {
|
|
912
918
|
this.applyPlacement(), this.style.display = "block", this.style.boxSizing = "border-box", this.style.overflow = "hidden";
|
|
@@ -914,8 +920,8 @@ class qe extends I {
|
|
|
914
920
|
t != null && Number.isFinite(Number(t)) && Number(t) > 0 ? this.style.fontSize = `${Number(t)}pt` : this.style.removeProperty("font-size");
|
|
915
921
|
const e = this.getAttribute("weight");
|
|
916
922
|
e ? this.style.fontWeight = e : this.style.removeProperty("font-weight");
|
|
917
|
-
const
|
|
918
|
-
|
|
923
|
+
const n = this.getAttribute("align");
|
|
924
|
+
n === "start" || n === "center" || n === "end" ? this.style.textAlign = n : this.style.removeProperty("text-align");
|
|
919
925
|
const i = this.getAttribute("font");
|
|
920
926
|
i ? this.style.fontFamily = i : this.style.removeProperty("font-family");
|
|
921
927
|
const o = this.getAttribute("color");
|
|
@@ -926,18 +932,18 @@ class qe extends I {
|
|
|
926
932
|
/** Re-run token substitution from the authored templates. */
|
|
927
933
|
resolveTokens() {
|
|
928
934
|
const t = this.closest("om-cartograph");
|
|
929
|
-
t && typeof t.tokenContext == "function" &&
|
|
935
|
+
t && typeof t.tokenContext == "function" && Ur(this, t.tokenContext());
|
|
930
936
|
}
|
|
931
937
|
paintCartograph(t, e) {
|
|
932
|
-
const { w:
|
|
938
|
+
const { w: n, h: i } = C(this), o = n * e.pxPerMm, s = i * e.pxPerMm;
|
|
933
939
|
if (o <= 0 || s <= 0) return;
|
|
934
|
-
const a = typeof getComputedStyle == "function" ? getComputedStyle(this) : null, l =
|
|
940
|
+
const a = typeof getComputedStyle == "function" ? getComputedStyle(this) : null, l = R(a?.backgroundColor);
|
|
935
941
|
l && (t.fillStyle = l, t.fillRect(0, 0, o, s));
|
|
936
942
|
const c = (this.textContent ?? "").trim();
|
|
937
943
|
if (c === "") return;
|
|
938
|
-
const u =
|
|
939
|
-
t.save(), t.font = p, t.fillStyle =
|
|
940
|
-
const b =
|
|
944
|
+
const u = xt(a?.fontSize, 12), h = a?.lineHeight === "normal" ? u * 1.4 : xt(a?.lineHeight, u * 1.4), d = a?.fontFamily || "system-ui, sans-serif", m = a?.fontWeight || "400", f = u * e.scale, g = h * e.scale, p = `${m} ${f}px ${d}`;
|
|
945
|
+
t.save(), t.font = p, t.fillStyle = R(a?.color) ?? "#000", t.textBaseline = "alphabetic", t.textAlign = "left";
|
|
946
|
+
const b = Wr({
|
|
941
947
|
text: c,
|
|
942
948
|
maxWidth: o,
|
|
943
949
|
fontSizePx: f,
|
|
@@ -946,81 +952,81 @@ class qe extends I {
|
|
|
946
952
|
}), w = a?.textAlign || "start";
|
|
947
953
|
for (const y of b.lines) {
|
|
948
954
|
if (y.baselineY > s + g) break;
|
|
949
|
-
t.fillText(y.text,
|
|
955
|
+
t.fillText(y.text, Br(w, o, y.width), y.baselineY);
|
|
950
956
|
}
|
|
951
957
|
t.restore();
|
|
952
958
|
}
|
|
953
959
|
}
|
|
954
|
-
|
|
955
|
-
const
|
|
956
|
-
let
|
|
957
|
-
const
|
|
958
|
-
function
|
|
959
|
-
const
|
|
960
|
+
k("om-text", Ke);
|
|
961
|
+
const Vr = 63710087714e-4;
|
|
962
|
+
let Kr = Vr;
|
|
963
|
+
const it = Math.PI / 180;
|
|
964
|
+
function Hr(r, t, e = Kr) {
|
|
965
|
+
const n = (t[1] - r[1]) * it, i = (t[0] - r[0]) * it, o = r[1] * it, s = t[1] * it, a = Math.sin(n / 2) ** 2 + Math.cos(o) * Math.cos(s) * Math.sin(i / 2) ** 2;
|
|
960
966
|
return 2 * e * Math.asin(Math.min(1, Math.sqrt(a)));
|
|
961
967
|
}
|
|
962
|
-
const
|
|
963
|
-
function
|
|
964
|
-
const e = Math.max(-
|
|
965
|
-
return [
|
|
968
|
+
const tt = 6378137, ue = Math.PI / 180, he = 180 / Math.PI, me = 85.0511287798066, Pt = 2 * Math.PI * tt / 360;
|
|
969
|
+
function Gt([r, t]) {
|
|
970
|
+
const e = Math.max(-me, Math.min(me, t));
|
|
971
|
+
return [tt * r * ue, tt * Math.log(Math.tan(Math.PI / 4 + e * ue / 2))];
|
|
966
972
|
}
|
|
967
|
-
function dt([
|
|
968
|
-
return [
|
|
973
|
+
function dt([r, t]) {
|
|
974
|
+
return [r / tt * he, (2 * Math.atan(Math.exp(t / tt)) - Math.PI / 2) * he];
|
|
969
975
|
}
|
|
970
|
-
const
|
|
976
|
+
const Yr = {
|
|
971
977
|
code: "EPSG:3857",
|
|
972
978
|
units: "linear",
|
|
973
979
|
metresPerUnit: 1,
|
|
974
|
-
forward:
|
|
980
|
+
forward: Gt,
|
|
975
981
|
inverse: dt
|
|
976
|
-
},
|
|
982
|
+
}, Xr = {
|
|
977
983
|
code: "EPSG:4326",
|
|
978
984
|
units: "degree",
|
|
979
|
-
metresPerUnit:
|
|
980
|
-
forward: ([
|
|
981
|
-
inverse: ([
|
|
985
|
+
metresPerUnit: Pt,
|
|
986
|
+
forward: ([r, t]) => [r, t],
|
|
987
|
+
inverse: ([r, t]) => [r, t]
|
|
982
988
|
};
|
|
983
|
-
function
|
|
984
|
-
if (
|
|
985
|
-
const t =
|
|
989
|
+
function qt(r) {
|
|
990
|
+
if (r == null) return null;
|
|
991
|
+
const t = r.trim();
|
|
986
992
|
if (t === "") return null;
|
|
987
993
|
const e = /^(?:epsg:{1,2})?(\d{4,6})$/i.exec(t);
|
|
988
994
|
return e ? `EPSG:${e[1]}` : t.toUpperCase();
|
|
989
995
|
}
|
|
990
|
-
function
|
|
991
|
-
const t =
|
|
992
|
-
return t === "EPSG:3857" || t === "EPSG:900913" ?
|
|
996
|
+
function He(r) {
|
|
997
|
+
const t = qt(r) ?? "EPSG:3857";
|
|
998
|
+
return t === "EPSG:3857" || t === "EPSG:900913" ? Yr : t === "EPSG:4326" || t === "CRS:84" || t === "OGC:CRS84" ? Xr : null;
|
|
993
999
|
}
|
|
994
|
-
const
|
|
995
|
-
function
|
|
996
|
-
return !Number.isInteger(
|
|
1000
|
+
const Ye = /* @__PURE__ */ new Map();
|
|
1001
|
+
function Tt(r, t) {
|
|
1002
|
+
return !Number.isInteger(r) || r < 1 || r > 60 ? null : `+proj=utm +zone=${r}${t === "S" ? " +south" : ""} +datum=WGS84 +units=m +no_defs`;
|
|
997
1003
|
}
|
|
998
|
-
async function
|
|
999
|
-
const t =
|
|
1004
|
+
async function Jr(r) {
|
|
1005
|
+
const t = Ye.get(r);
|
|
1000
1006
|
if (typeof t == "string") return t;
|
|
1001
|
-
const e = Number(/^EPSG:(\d+)$/.exec(
|
|
1007
|
+
const e = Number(/^EPSG:(\d+)$/.exec(r)?.[1]);
|
|
1002
1008
|
if (!Number.isFinite(e)) return null;
|
|
1003
|
-
if (e >= 32601 && e <= 32660) return
|
|
1004
|
-
if (e >= 32701 && e <= 32760) return
|
|
1005
|
-
const { CRS_DEFS:
|
|
1006
|
-
return
|
|
1007
|
-
}
|
|
1008
|
-
function
|
|
1009
|
-
if (
|
|
1010
|
-
if (typeof
|
|
1011
|
-
const t = (
|
|
1012
|
-
return t.startsWith("deg") ? { units: "degree", metresPerUnit:
|
|
1013
|
-
}
|
|
1014
|
-
async function
|
|
1015
|
-
const e =
|
|
1016
|
-
if (
|
|
1009
|
+
if (e >= 32601 && e <= 32660) return Tt(e - 32600, "N");
|
|
1010
|
+
if (e >= 32701 && e <= 32760) return Tt(e - 32700, "S");
|
|
1011
|
+
const { CRS_DEFS: n } = await import("./crs-BzE_KP4M.js");
|
|
1012
|
+
return n[e]?.def ?? null;
|
|
1013
|
+
}
|
|
1014
|
+
function Zr(r) {
|
|
1015
|
+
if (r.projName === "longlat") return { units: "degree", metresPerUnit: Pt };
|
|
1016
|
+
if (typeof r.to_meter == "number" && r.to_meter > 0) return { units: "linear", metresPerUnit: r.to_meter };
|
|
1017
|
+
const t = (r.units ?? "m").toLowerCase();
|
|
1018
|
+
return t.startsWith("deg") ? { units: "degree", metresPerUnit: Pt } : t.includes("ft") || t.includes("foot") ? { units: "linear", metresPerUnit: 0.3048 } : { units: "linear", metresPerUnit: 1 };
|
|
1019
|
+
}
|
|
1020
|
+
async function Qr(r, t) {
|
|
1021
|
+
const e = qt(r) ?? "EPSG:3857", n = Ye.get(e);
|
|
1022
|
+
if (n && typeof n != "string") return n;
|
|
1017
1023
|
if (!t) {
|
|
1018
|
-
const u =
|
|
1024
|
+
const u = He(e);
|
|
1019
1025
|
if (u) return u;
|
|
1020
1026
|
}
|
|
1021
|
-
const i = t?.trim() || await
|
|
1027
|
+
const i = t?.trim() || await Jr(e);
|
|
1022
1028
|
if (!i) return null;
|
|
1023
|
-
const o = (await import("./index-CcLC9jE5.js")).default, a = o(i, "+proj=longlat +datum=WGS84 +no_defs"), { units: l, metresPerUnit: c } =
|
|
1029
|
+
const o = (await import("./index-CcLC9jE5.js")).default, a = o(i, "+proj=longlat +datum=WGS84 +no_defs"), { units: l, metresPerUnit: c } = Zr(new o.Proj(i));
|
|
1024
1030
|
return {
|
|
1025
1031
|
code: e,
|
|
1026
1032
|
units: l,
|
|
@@ -1029,88 +1035,88 @@ async function Xr(n, t) {
|
|
|
1029
1035
|
inverse: (u) => a.forward(u)
|
|
1030
1036
|
};
|
|
1031
1037
|
}
|
|
1032
|
-
const
|
|
1033
|
-
function
|
|
1034
|
-
const e = Math.max(-
|
|
1035
|
-
return [
|
|
1038
|
+
const de = Math.PI / 180, tn = 180 / Math.PI, en = { code: "EPSG:3857", forward: Gt, inverse: dt }, pi = Gt, bi = dt, fe = 6378137, ge = 89.9;
|
|
1039
|
+
function rn([r, t]) {
|
|
1040
|
+
const e = Math.max(-ge, Math.min(ge, t));
|
|
1041
|
+
return [fe * r * de, fe * Math.log(Math.tan(Math.PI / 4 + e * de / 2))];
|
|
1036
1042
|
}
|
|
1037
|
-
const
|
|
1038
|
-
function K(
|
|
1039
|
-
return
|
|
1043
|
+
const nn = { code: "EPSG:3857", forward: rn, inverse: dt }, Lt = qt;
|
|
1044
|
+
function K(r) {
|
|
1045
|
+
return He(r);
|
|
1040
1046
|
}
|
|
1041
|
-
async function
|
|
1042
|
-
return
|
|
1047
|
+
async function Rt(r, t) {
|
|
1048
|
+
return Qr(r, t);
|
|
1043
1049
|
}
|
|
1044
|
-
const
|
|
1045
|
-
function
|
|
1046
|
-
const e = t.length,
|
|
1050
|
+
const yi = Tt;
|
|
1051
|
+
function sn(r, t) {
|
|
1052
|
+
const e = t.length, n = r.map((i, o) => [...i, t[o]]);
|
|
1047
1053
|
for (let i = 0; i < e; i++) {
|
|
1048
1054
|
let o = i;
|
|
1049
|
-
for (let s = i + 1; s < e; s++) Math.abs(
|
|
1050
|
-
if (Math.abs(
|
|
1051
|
-
[
|
|
1055
|
+
for (let s = i + 1; s < e; s++) Math.abs(n[s][i]) > Math.abs(n[o][i]) && (o = s);
|
|
1056
|
+
if (Math.abs(n[o][i]) < 1e-12) return null;
|
|
1057
|
+
[n[i], n[o]] = [n[o], n[i]];
|
|
1052
1058
|
for (let s = 0; s < e; s++) {
|
|
1053
1059
|
if (s === i) continue;
|
|
1054
|
-
const a =
|
|
1060
|
+
const a = n[s][i] / n[i][i];
|
|
1055
1061
|
if (a !== 0)
|
|
1056
|
-
for (let l = i; l <= e; l++)
|
|
1062
|
+
for (let l = i; l <= e; l++) n[s][l] -= a * n[i][l];
|
|
1057
1063
|
}
|
|
1058
1064
|
}
|
|
1059
|
-
return
|
|
1065
|
+
return n.map((i, o) => i[e] / i[o]);
|
|
1060
1066
|
}
|
|
1061
|
-
function
|
|
1062
|
-
if (
|
|
1063
|
-
const e =
|
|
1067
|
+
function on(r, t) {
|
|
1068
|
+
if (r.length !== 4 || t.length !== 4) return null;
|
|
1069
|
+
const e = r.reduce((h, d) => h + d[0], 0) / 4, n = r.reduce((h, d) => h + d[1], 0) / 4, i = r.reduce((h, d) => h + Math.hypot(d[0] - e, d[1] - n), 0) / 4, o = i > 1e-12 ? Math.SQRT2 / i : 1, s = (h) => [(h[0] - e) * o, (h[1] - n) * o], a = [], l = [];
|
|
1064
1070
|
for (let h = 0; h < 4; h++) {
|
|
1065
|
-
const [d, m] = s(
|
|
1071
|
+
const [d, m] = s(r[h]), [f, g] = t[h];
|
|
1066
1072
|
a.push([d, m, 1, 0, 0, 0, -d * f, -m * f]), l.push(f), a.push([0, 0, 0, d, m, 1, -d * g, -m * g]), l.push(g);
|
|
1067
1073
|
}
|
|
1068
|
-
const c =
|
|
1074
|
+
const c = sn(a, l);
|
|
1069
1075
|
if (!c || c.some((h) => !Number.isFinite(h))) return null;
|
|
1070
|
-
const u = (h) => [h[0] / o + e, h[1] / o +
|
|
1076
|
+
const u = (h) => [h[0] / o + e, h[1] / o + n];
|
|
1071
1077
|
return { matrix: [c[0], c[1], c[2], c[3], c[4], c[5], c[6], c[7], 1], normalize: s, denormalize: u };
|
|
1072
1078
|
}
|
|
1073
|
-
function
|
|
1074
|
-
const
|
|
1075
|
-
return Math.abs(
|
|
1079
|
+
function pe(r, [t, e]) {
|
|
1080
|
+
const n = r[6] * t + r[7] * e + r[8];
|
|
1081
|
+
return Math.abs(n) < 1e-12 ? null : [(r[0] * t + r[1] * e + r[2]) / n, (r[3] * t + r[4] * e + r[5]) / n];
|
|
1076
1082
|
}
|
|
1077
|
-
function
|
|
1078
|
-
const [t, e,
|
|
1083
|
+
function an(r) {
|
|
1084
|
+
const [t, e, n, i, o, s, a, l, c] = r, u = t * (o * c - s * l) - e * (i * c - s * a) + n * (i * l - o * a);
|
|
1079
1085
|
return !Number.isFinite(u) || Math.abs(u) < 1e-15 ? null : [
|
|
1080
1086
|
(o * c - s * l) / u,
|
|
1081
|
-
(
|
|
1082
|
-
(e * s -
|
|
1087
|
+
(n * l - e * c) / u,
|
|
1088
|
+
(e * s - n * o) / u,
|
|
1083
1089
|
(s * a - i * c) / u,
|
|
1084
|
-
(t * c -
|
|
1085
|
-
(
|
|
1090
|
+
(t * c - n * a) / u,
|
|
1091
|
+
(n * i - t * s) / u,
|
|
1086
1092
|
(i * l - o * a) / u,
|
|
1087
1093
|
(e * a - t * l) / u,
|
|
1088
1094
|
(t * o - e * i) / u
|
|
1089
1095
|
];
|
|
1090
1096
|
}
|
|
1091
|
-
function
|
|
1092
|
-
let e =
|
|
1097
|
+
function ln(r, t) {
|
|
1098
|
+
let e = r;
|
|
1093
1099
|
for (; e - t > 180; ) e -= 360;
|
|
1094
1100
|
for (; t - e > 180; ) e += 360;
|
|
1095
1101
|
return e;
|
|
1096
1102
|
}
|
|
1097
|
-
const
|
|
1098
|
-
let t = ((
|
|
1103
|
+
const Xe = (r) => {
|
|
1104
|
+
let t = ((r + 180) % 360 + 360) % 360 - 180;
|
|
1099
1105
|
return t === -180 && (t = 180), t;
|
|
1100
1106
|
};
|
|
1101
|
-
function
|
|
1102
|
-
const o =
|
|
1107
|
+
function Q({ corners: r, widthMm: t, heightMm: e, crsForward: n, continuous: i = !1 }) {
|
|
1108
|
+
const o = n ?? (i ? nn : en), s = r[0][0], a = (b) => i ? b : ln(b, s), l = (b) => i ? b : Xe(b), c = r.map(([b, w]) => [a(b), w]), u = c.map((b) => o.forward(b)), h = [
|
|
1103
1109
|
[0, 0],
|
|
1104
1110
|
[t, 0],
|
|
1105
1111
|
[t, e],
|
|
1106
1112
|
[0, e]
|
|
1107
|
-
], d = t > 0 && e > 0 ?
|
|
1113
|
+
], d = t > 0 && e > 0 ? on(u, h) : null, m = d ? an(d.matrix) : null, f = !d || !m, g = (b, w = i ? 16 : 1) => {
|
|
1108
1114
|
let y = 0, M = p.unproject(0, b);
|
|
1109
1115
|
if (!M) return null;
|
|
1110
1116
|
for (let v = 1; v <= w; v++) {
|
|
1111
1117
|
const N = p.unproject(t * v / w, b);
|
|
1112
1118
|
if (!N) return null;
|
|
1113
|
-
y +=
|
|
1119
|
+
y += Hr(M, N), M = N;
|
|
1114
1120
|
}
|
|
1115
1121
|
return y;
|
|
1116
1122
|
}, p = {
|
|
@@ -1122,12 +1128,12 @@ function Z({ corners: n, widthMm: t, heightMm: e, crsForward: r, continuous: i =
|
|
|
1122
1128
|
continuous: i,
|
|
1123
1129
|
project(b) {
|
|
1124
1130
|
if (!d) return null;
|
|
1125
|
-
const w = o.forward([a(b[0]), b[1]]), y =
|
|
1131
|
+
const w = o.forward([a(b[0]), b[1]]), y = pe(d.matrix, d.normalize(w));
|
|
1126
1132
|
return y && Number.isFinite(y[0]) && Number.isFinite(y[1]) ? { xMm: y[0], yMm: y[1] } : null;
|
|
1127
1133
|
},
|
|
1128
1134
|
unproject(b, w) {
|
|
1129
1135
|
if (!d || !m) return null;
|
|
1130
|
-
const y =
|
|
1136
|
+
const y = pe(m, [b, w]);
|
|
1131
1137
|
if (!y) return null;
|
|
1132
1138
|
const M = o.inverse(d.denormalize(y));
|
|
1133
1139
|
return Number.isFinite(M[0]) && Number.isFinite(M[1]) ? [l(M[0]), M[1]] : null;
|
|
@@ -1141,83 +1147,83 @@ function Z({ corners: n, widthMm: t, heightMm: e, crsForward: r, continuous: i =
|
|
|
1141
1147
|
};
|
|
1142
1148
|
return p;
|
|
1143
1149
|
}
|
|
1144
|
-
function
|
|
1145
|
-
if (
|
|
1150
|
+
function H(r) {
|
|
1151
|
+
if (r == null || r.trim() === "") return null;
|
|
1146
1152
|
let t;
|
|
1147
1153
|
try {
|
|
1148
|
-
t = JSON.parse(
|
|
1154
|
+
t = JSON.parse(r);
|
|
1149
1155
|
} catch {
|
|
1150
|
-
const
|
|
1151
|
-
if (
|
|
1156
|
+
const n = r.trim().split(/[\s,]+/).map(Number);
|
|
1157
|
+
if (n.length !== 8 || n.some((i) => !Number.isFinite(i))) return null;
|
|
1152
1158
|
t = [
|
|
1153
|
-
[
|
|
1154
|
-
[
|
|
1155
|
-
[
|
|
1156
|
-
[
|
|
1159
|
+
[n[0], n[1]],
|
|
1160
|
+
[n[2], n[3]],
|
|
1161
|
+
[n[4], n[5]],
|
|
1162
|
+
[n[6], n[7]]
|
|
1157
1163
|
];
|
|
1158
1164
|
}
|
|
1159
1165
|
if (!Array.isArray(t)) return null;
|
|
1160
|
-
if (t.length === 8 && t.every((
|
|
1161
|
-
const
|
|
1162
|
-
return [
|
|
1163
|
-
[
|
|
1164
|
-
[
|
|
1165
|
-
[
|
|
1166
|
-
[
|
|
1166
|
+
if (t.length === 8 && t.every((n) => typeof n == "number" && Number.isFinite(n))) {
|
|
1167
|
+
const n = t;
|
|
1168
|
+
return [n[1], n[3], n[5], n[7]].some((i) => i < -90 || i > 90) ? null : [
|
|
1169
|
+
[n[0], n[1]],
|
|
1170
|
+
[n[2], n[3]],
|
|
1171
|
+
[n[4], n[5]],
|
|
1172
|
+
[n[6], n[7]]
|
|
1167
1173
|
];
|
|
1168
1174
|
}
|
|
1169
1175
|
if (t.length !== 4) return null;
|
|
1170
1176
|
const e = [];
|
|
1171
|
-
for (const
|
|
1172
|
-
if (!Array.isArray(
|
|
1173
|
-
const [i, o] =
|
|
1177
|
+
for (const n of t) {
|
|
1178
|
+
if (!Array.isArray(n) || n.length < 2) return null;
|
|
1179
|
+
const [i, o] = n;
|
|
1174
1180
|
if (typeof i != "number" || typeof o != "number" || !Number.isFinite(i) || !Number.isFinite(o) || o < -90 || o > 90) return null;
|
|
1175
1181
|
e.push([i, o]);
|
|
1176
1182
|
}
|
|
1177
1183
|
return e;
|
|
1178
1184
|
}
|
|
1179
|
-
function
|
|
1180
|
-
if (
|
|
1181
|
-
const t =
|
|
1185
|
+
function cn(r) {
|
|
1186
|
+
if (r.degenerate) return null;
|
|
1187
|
+
const t = r.unproject(r.widthMm / 2, r.heightMm / 2);
|
|
1182
1188
|
if (!t) return null;
|
|
1183
|
-
const
|
|
1189
|
+
const n = [t[0], Math.min(89.9, Math.max(-89.9, t[1] + 0.01))], i = r.project(t), o = r.project(n);
|
|
1184
1190
|
if (!i || !o) return null;
|
|
1185
1191
|
const s = o.xMm - i.xMm, a = o.yMm - i.yMm;
|
|
1186
|
-
return Math.abs(s) < 1e-12 && Math.abs(a) < 1e-12 ? null : (Math.atan2(s, -a) *
|
|
1192
|
+
return Math.abs(s) < 1e-12 && Math.abs(a) < 1e-12 ? null : (Math.atan2(s, -a) * tn % 360 + 360) % 360;
|
|
1187
1193
|
}
|
|
1188
|
-
function
|
|
1189
|
-
if (
|
|
1190
|
-
const { widthMm: t, heightMm: e } =
|
|
1194
|
+
function un(r) {
|
|
1195
|
+
if (r.degenerate) return null;
|
|
1196
|
+
const { widthMm: t, heightMm: e } = r, n = [];
|
|
1191
1197
|
for (const s of [0.02, 0.5, 0.98]) {
|
|
1192
|
-
const a =
|
|
1198
|
+
const a = r.rowGroundMeters(e * s);
|
|
1193
1199
|
if (a == null || !(a > 0)) return null;
|
|
1194
|
-
|
|
1200
|
+
n.push(a / t);
|
|
1195
1201
|
}
|
|
1196
|
-
const i = Math.min(...
|
|
1202
|
+
const i = Math.min(...n), o = Math.max(...n);
|
|
1197
1203
|
return i > 0 ? (o - i) / i : null;
|
|
1198
1204
|
}
|
|
1199
|
-
function
|
|
1205
|
+
function wi(r, t, e, n) {
|
|
1200
1206
|
return [
|
|
1201
|
-
[
|
|
1202
|
-
[e,
|
|
1207
|
+
[r, n],
|
|
1208
|
+
[e, n],
|
|
1203
1209
|
[e, t],
|
|
1204
|
-
[
|
|
1210
|
+
[r, t]
|
|
1205
1211
|
];
|
|
1206
1212
|
}
|
|
1207
|
-
const
|
|
1208
|
-
function
|
|
1209
|
-
const e = (
|
|
1210
|
-
const i =
|
|
1213
|
+
const hn = (r) => r.toLowerCase().startsWith("on");
|
|
1214
|
+
function mn(r, t) {
|
|
1215
|
+
const e = (n) => {
|
|
1216
|
+
const i = n.tagName.toLowerCase();
|
|
1211
1217
|
if (i === "script") {
|
|
1212
|
-
if ((
|
|
1218
|
+
if ((n.getAttribute("type") ?? "").toLowerCase() !== "application/json") return null;
|
|
1213
1219
|
const a = t.createElement("script");
|
|
1214
|
-
return a.setAttribute("type", "application/json"), a.textContent =
|
|
1220
|
+
return a.setAttribute("type", "application/json"), a.textContent = n.textContent, a;
|
|
1215
1221
|
}
|
|
1216
1222
|
if (i === "style" || i === "link" || i === "iframe" || i === "object" || i === "embed") return null;
|
|
1217
1223
|
const o = t.createElement(i);
|
|
1218
|
-
for (const s of
|
|
1219
|
-
|
|
1220
|
-
for (const s of
|
|
1224
|
+
for (const s of n.attributes)
|
|
1225
|
+
hn(s.name) || /^\s*javascript:/i.test(s.value) || o.setAttribute(s.name, s.value);
|
|
1226
|
+
for (const s of n.childNodes)
|
|
1221
1227
|
if (s.nodeType === 3) o.appendChild(t.createTextNode(s.textContent ?? ""));
|
|
1222
1228
|
else if (s.nodeType === 1) {
|
|
1223
1229
|
const a = e(s);
|
|
@@ -1225,22 +1231,22 @@ function cn(n, t) {
|
|
|
1225
1231
|
}
|
|
1226
1232
|
return o;
|
|
1227
1233
|
};
|
|
1228
|
-
return e(
|
|
1229
|
-
}
|
|
1230
|
-
async function
|
|
1231
|
-
const e = await fetch(
|
|
1232
|
-
if (!e.ok) throw new Error(`fetching ${
|
|
1233
|
-
const
|
|
1234
|
-
if (!o) throw new Error(`${
|
|
1235
|
-
const s =
|
|
1236
|
-
if (!s) throw new Error(`${
|
|
1234
|
+
return e(r);
|
|
1235
|
+
}
|
|
1236
|
+
async function dn(r, t = document) {
|
|
1237
|
+
const e = await fetch(r, { credentials: "same-origin" });
|
|
1238
|
+
if (!e.ok) throw new Error(`fetching ${r} failed with HTTP ${e.status}`);
|
|
1239
|
+
const n = await e.text(), o = new DOMParser().parseFromString(n, "text/html").querySelector("om-map");
|
|
1240
|
+
if (!o) throw new Error(`${r} contains no <om-map>`);
|
|
1241
|
+
const s = mn(o, t);
|
|
1242
|
+
if (!s) throw new Error(`${r} could not be adopted`);
|
|
1237
1243
|
return s;
|
|
1238
1244
|
}
|
|
1239
|
-
function
|
|
1240
|
-
const t =
|
|
1245
|
+
function ut(r) {
|
|
1246
|
+
const t = r.getAttribute("center"), e = r.getAttribute("zoom");
|
|
1241
1247
|
if (!t || e == null || e.trim() === "") return null;
|
|
1242
|
-
const
|
|
1243
|
-
if (!Number.isFinite(
|
|
1248
|
+
const n = Number(e);
|
|
1249
|
+
if (!Number.isFinite(n)) return null;
|
|
1244
1250
|
let i;
|
|
1245
1251
|
try {
|
|
1246
1252
|
i = JSON.parse(t);
|
|
@@ -1252,13 +1258,13 @@ function ct(n) {
|
|
|
1252
1258
|
const [o, s] = i;
|
|
1253
1259
|
return !Number.isFinite(o) || !Number.isFinite(s) ? null : {
|
|
1254
1260
|
center: [o, s],
|
|
1255
|
-
zoom:
|
|
1256
|
-
bearing: Number(
|
|
1257
|
-
pitch: Number(
|
|
1261
|
+
zoom: n,
|
|
1262
|
+
bearing: Number(r.getAttribute("bearing")) || 0,
|
|
1263
|
+
pitch: Number(r.getAttribute("pitch")) || 0
|
|
1258
1264
|
};
|
|
1259
1265
|
}
|
|
1260
|
-
function
|
|
1261
|
-
const o = (l) => Ft(
|
|
1266
|
+
function vi(r, t, e, n, i = 60) {
|
|
1267
|
+
const o = (l) => Ft(r, { ...t, pitch: l }, e, n) !== null;
|
|
1262
1268
|
if (o(i)) return i;
|
|
1263
1269
|
if (!o(0)) return 0;
|
|
1264
1270
|
let s = 0, a = i;
|
|
@@ -1268,11 +1274,11 @@ function hi(n, t, e, r, i = 60) {
|
|
|
1268
1274
|
}
|
|
1269
1275
|
return s;
|
|
1270
1276
|
}
|
|
1271
|
-
function Ft(
|
|
1272
|
-
if (!(e > 0) || !(
|
|
1273
|
-
const i = new
|
|
1277
|
+
function Ft(r, t, e, n) {
|
|
1278
|
+
if (!(e > 0) || !(n > 0)) return null;
|
|
1279
|
+
const i = new r.WebMercatorViewport({
|
|
1274
1280
|
width: e,
|
|
1275
|
-
height:
|
|
1281
|
+
height: n,
|
|
1276
1282
|
longitude: t.center[0],
|
|
1277
1283
|
latitude: t.center[1],
|
|
1278
1284
|
zoom: t.zoom,
|
|
@@ -1281,8 +1287,8 @@ function Ft(n, t, e, r) {
|
|
|
1281
1287
|
}), o = [
|
|
1282
1288
|
[0, 0],
|
|
1283
1289
|
[e, 0],
|
|
1284
|
-
[e,
|
|
1285
|
-
[0,
|
|
1290
|
+
[e, n],
|
|
1291
|
+
[0, n]
|
|
1286
1292
|
], s = [];
|
|
1287
1293
|
for (const a of o) {
|
|
1288
1294
|
const l = i.unproject(a);
|
|
@@ -1291,24 +1297,46 @@ function Ft(n, t, e, r) {
|
|
|
1291
1297
|
}
|
|
1292
1298
|
return s;
|
|
1293
1299
|
}
|
|
1294
|
-
async function
|
|
1295
|
-
const
|
|
1296
|
-
if (
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
return { core: t, map: i };
|
|
1300
|
+
async function fn(r, t) {
|
|
1301
|
+
const e = await Pe();
|
|
1302
|
+
if (t && typeof t != "string") return { core: e, map: t };
|
|
1303
|
+
if (!t) throw new Error("a live frame needs src= or an inline <om-map> child");
|
|
1304
|
+
const n = await dn(t, r.ownerDocument);
|
|
1305
|
+
return { core: e, map: n };
|
|
1301
1306
|
}
|
|
1302
|
-
function Mt(
|
|
1303
|
-
|
|
1307
|
+
function Mt(r, t) {
|
|
1308
|
+
r.setAttribute("center", JSON.stringify(t.center)), r.setAttribute("zoom", String(t.zoom)), r.setAttribute("bearing", String(t.bearing)), r.setAttribute("pitch", String(t.pitch)), gn(r, t);
|
|
1304
1309
|
}
|
|
1305
|
-
function
|
|
1306
|
-
const e =
|
|
1310
|
+
function gn(r, t) {
|
|
1311
|
+
const e = r;
|
|
1307
1312
|
typeof e.setViewInternal == "function" ? e.setViewInternal({ longitude: t.center[0], latitude: t.center[1], zoom: t.zoom, pitch: t.pitch, bearing: t.bearing }) : typeof e.flyTo == "function" && e.flyTo(t.center, t.zoom, { duration: 0 });
|
|
1308
1313
|
}
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1314
|
+
const pn = [".png", ".jpg", ".jpeg", ".webp", ".avif", ".gif", ".svg"], bn = [".html", ".htm"];
|
|
1315
|
+
function It(r) {
|
|
1316
|
+
const t = r.trim().split(/[?#]/, 1)[0]?.toLowerCase() ?? "";
|
|
1317
|
+
return bn.some((e) => t.endsWith(e)) ? "map" : pn.some((e) => t.endsWith(e)) ? "raster" : null;
|
|
1318
|
+
}
|
|
1319
|
+
function yn(r, t) {
|
|
1320
|
+
const e = [], n = [...r.children].find(
|
|
1321
|
+
(s) => s.tagName.toLowerCase() === "om-map" && s !== t
|
|
1322
|
+
);
|
|
1323
|
+
n && e.push({ kind: "inline", key: "inline", el: r, map: n });
|
|
1324
|
+
const i = r.getAttribute("src")?.trim();
|
|
1325
|
+
i && e.push({ kind: It(i) ?? "map", key: `src:${i}`, el: r, src: i });
|
|
1326
|
+
let o = 0;
|
|
1327
|
+
for (const s of r.children) {
|
|
1328
|
+
if (s.tagName.toLowerCase() !== "om-source") continue;
|
|
1329
|
+
const a = s.getAttribute("src")?.trim();
|
|
1330
|
+
a && e.push({ kind: It(a) ?? "map", key: `source:${o++}:${a}`, el: s, src: a });
|
|
1331
|
+
}
|
|
1332
|
+
return e;
|
|
1333
|
+
}
|
|
1334
|
+
function wn(r) {
|
|
1335
|
+
return r.map((t) => t.key).join("|");
|
|
1336
|
+
}
|
|
1337
|
+
async function vn(r, t, e) {
|
|
1338
|
+
const n = Math.max(1, Math.round(t.w * e)), i = Math.max(1, Math.round(t.h * e)), o = r.cloneNode(!0);
|
|
1339
|
+
o.removeAttribute("style"), o.setAttribute("width", String(n)), o.setAttribute("height", String(i)), o.setAttribute("preserveAspectRatio", "none");
|
|
1312
1340
|
const s = new XMLSerializer().serializeToString(o), a = new Image();
|
|
1313
1341
|
a.decoding = "sync", a.src = `data:image/svg+xml;charset=utf-8,${encodeURIComponent(s)}`;
|
|
1314
1342
|
try {
|
|
@@ -1318,8 +1346,8 @@ async function dn(n, t, e) {
|
|
|
1318
1346
|
}
|
|
1319
1347
|
return a;
|
|
1320
1348
|
}
|
|
1321
|
-
const At = "data-om-carto-placeholder", St = "data-om-carto-overview",
|
|
1322
|
-
class
|
|
1349
|
+
const At = "data-om-carto-placeholder", be = "data-om-carto-source", St = "data-om-carto-capture", Ct = "data-om-carto-overview", ye = "http://www.w3.org/2000/svg", we = 24, ve = 0.25;
|
|
1350
|
+
class Je extends I {
|
|
1323
1351
|
static observedAttributes = [...T["om-frame"]];
|
|
1324
1352
|
/** Resolved non-builtin CRS planes, so a re-render does not re-await proj4. */
|
|
1325
1353
|
resolvedForward = null;
|
|
@@ -1357,6 +1385,12 @@ class Ke extends I {
|
|
|
1357
1385
|
liveMapOwned = !1;
|
|
1358
1386
|
/** A capture standing in for the live map during export/print. */
|
|
1359
1387
|
captureImage = null;
|
|
1388
|
+
/** Ordered-source state (docs/design/frame-sources.md). */
|
|
1389
|
+
sourceCursor = 0;
|
|
1390
|
+
/** The list this cursor indexes — an edit to it restarts from the top. */
|
|
1391
|
+
knownSourceList = null;
|
|
1392
|
+
/** The source the frame is currently SHOWING, once one has rendered. */
|
|
1393
|
+
settledSource = null;
|
|
1360
1394
|
/** The authored camera last driven into the map, so a re-render can tell an edit from a repaint. */
|
|
1361
1395
|
appliedCameraKey = null;
|
|
1362
1396
|
printing = !1;
|
|
@@ -1367,6 +1401,22 @@ class Ke extends I {
|
|
|
1367
1401
|
get mapElement() {
|
|
1368
1402
|
return this.liveMap;
|
|
1369
1403
|
}
|
|
1404
|
+
/**
|
|
1405
|
+
* Where `corners`/`crs` are read from.
|
|
1406
|
+
*
|
|
1407
|
+
* A georeference describes a SOURCE, not a frame: a capture carries the one
|
|
1408
|
+
* that was true when it was taken, which is the only georeference available
|
|
1409
|
+
* when the live map never loaded and its CRS is therefore unknowable. For
|
|
1410
|
+
* `mode="static"` and the `src=` shorthand that element is the frame, so
|
|
1411
|
+
* every existing document reads exactly as before.
|
|
1412
|
+
*/
|
|
1413
|
+
get georefHost() {
|
|
1414
|
+
return this.settledSource?.kind === "raster" ? this.settledSource.el : this;
|
|
1415
|
+
}
|
|
1416
|
+
/** Is the frame currently showing a capture rather than a live map? */
|
|
1417
|
+
get showingRaster() {
|
|
1418
|
+
return this.settledSource?.kind === "raster";
|
|
1419
|
+
}
|
|
1370
1420
|
/**
|
|
1371
1421
|
* The frame's georeference, or null when it has none yet (malformed corners,
|
|
1372
1422
|
* a CRS still resolving, a live map not yet mounted, a view too pitched to
|
|
@@ -1376,20 +1426,20 @@ class Ke extends I {
|
|
|
1376
1426
|
get georef() {
|
|
1377
1427
|
const { w: t, h: e } = C(this);
|
|
1378
1428
|
if (t <= 0 || e <= 0) return null;
|
|
1379
|
-
if (this.mode === "live") {
|
|
1429
|
+
if (this.mode === "live" && !this.showingRaster) {
|
|
1380
1430
|
if (!this.liveCorners) return null;
|
|
1381
|
-
const
|
|
1382
|
-
if (
|
|
1383
|
-
const
|
|
1384
|
-
return
|
|
1431
|
+
const l = this.liveMap?.projectedCrs?.() ?? null;
|
|
1432
|
+
if (l) {
|
|
1433
|
+
const c = this.resolvedForwardKey === `${l}|` ? this.resolvedForward : K(l);
|
|
1434
|
+
return c ? Q({ corners: this.liveCorners, widthMm: t, heightMm: e, crsForward: c }) : (this.ensureLiveCrsForward(l), null);
|
|
1385
1435
|
}
|
|
1386
|
-
return
|
|
1436
|
+
return Q({ corners: this.liveCorners, widthMm: t, heightMm: e, continuous: !0 });
|
|
1387
1437
|
}
|
|
1388
|
-
const
|
|
1389
|
-
if (!
|
|
1390
|
-
const
|
|
1391
|
-
let
|
|
1392
|
-
return !
|
|
1438
|
+
const n = this.georefHost, i = H(n.getAttribute("corners"));
|
|
1439
|
+
if (!i) return null;
|
|
1440
|
+
const o = Lt(n.getAttribute("crs")) ?? "EPSG:3857", s = n.getAttribute("crs-def");
|
|
1441
|
+
let a = s ? null : K(o);
|
|
1442
|
+
return !a && this.resolvedForwardKey === `${o}|${s ?? ""}` && (a = this.resolvedForward), a ? Q({ corners: i, widthMm: t, heightMm: e, crsForward: a }) : null;
|
|
1393
1443
|
}
|
|
1394
1444
|
/**
|
|
1395
1445
|
* Resolve a live map's CRS through the core's lazy proj4, into the same
|
|
@@ -1401,9 +1451,9 @@ class Ke extends I {
|
|
|
1401
1451
|
const e = `${t}|`;
|
|
1402
1452
|
if (this.resolvedForwardKey === e || this.pendingLiveCrs === e) return;
|
|
1403
1453
|
this.pendingLiveCrs = e;
|
|
1404
|
-
const
|
|
1405
|
-
|
|
1406
|
-
if (
|
|
1454
|
+
const n = ++this.resolveToken;
|
|
1455
|
+
Rt(t, null).then((i) => {
|
|
1456
|
+
if (n === this.resolveToken) {
|
|
1407
1457
|
if (this.pendingLiveCrs = null, !i) {
|
|
1408
1458
|
this.showPlaceholder("unknown-crs", `The map in this frame is projected to "${t}", which could not be resolved.`);
|
|
1409
1459
|
return;
|
|
@@ -1411,7 +1461,7 @@ class Ke extends I {
|
|
|
1411
1461
|
this.resolvedForward = i, this.resolvedForwardKey = e, this.scheduleRender();
|
|
1412
1462
|
}
|
|
1413
1463
|
}).catch(() => {
|
|
1414
|
-
|
|
1464
|
+
n === this.resolveToken && (this.pendingLiveCrs = null, this.showPlaceholder("unknown-crs", `Could not resolve the projection "${t}" the map in this frame declares.`));
|
|
1415
1465
|
});
|
|
1416
1466
|
}
|
|
1417
1467
|
/** The raster a static frame draws — its first <img> child, if any. */
|
|
@@ -1428,7 +1478,7 @@ class Ke extends I {
|
|
|
1428
1478
|
* showing its own overview polygon instead of the map.
|
|
1429
1479
|
*/
|
|
1430
1480
|
get vector() {
|
|
1431
|
-
return this.querySelector(`:scope > svg[${
|
|
1481
|
+
return this.querySelector(`:scope > svg[${Et}]`);
|
|
1432
1482
|
}
|
|
1433
1483
|
/** What a static frame actually shows — vector first, because a frozen sheet that has both was frozen twice and the newer one is the vector. */
|
|
1434
1484
|
get staticSource() {
|
|
@@ -1449,7 +1499,7 @@ class Ke extends I {
|
|
|
1449
1499
|
renderNow() {
|
|
1450
1500
|
this.applyPlacement(), this.style.display = "block", this.style.overflow = "hidden", this.style.boxSizing = "border-box";
|
|
1451
1501
|
const t = this.getAttribute("frame-stroke");
|
|
1452
|
-
this.style.border = "0", this.style.boxShadow = `inset 0 0 0 ${
|
|
1502
|
+
this.style.border = "0", this.style.boxShadow = `inset 0 0 0 ${ve}mm ${t || "var(--om-carto-frame-stroke)"}`;
|
|
1453
1503
|
const e = this.getAttribute("frame-bg");
|
|
1454
1504
|
this.style.background = e || "var(--om-carto-frame-bg)", this.mode === "static" ? (this.suspendLiveMode(), this.renderStatic()) : this.renderLive(), this.renderOverview();
|
|
1455
1505
|
}
|
|
@@ -1464,23 +1514,23 @@ class Ke extends I {
|
|
|
1464
1514
|
}
|
|
1465
1515
|
const e = t.style;
|
|
1466
1516
|
e.position = "absolute", e.inset = "0", e.width = "100%", e.height = "100%", e.display = "block", t instanceof SVGSVGElement ? t.setAttribute("preserveAspectRatio", "none") : e.objectFit = "fill";
|
|
1467
|
-
const
|
|
1468
|
-
if ((i != null || K(
|
|
1517
|
+
const n = Lt(this.getAttribute("crs")) ?? "EPSG:3857", i = this.getAttribute("crs-def"), o = `${n}|${i ?? ""}`;
|
|
1518
|
+
if ((i != null || K(n) == null) && this.resolvedForwardKey !== o) {
|
|
1469
1519
|
const a = ++this.resolveToken;
|
|
1470
|
-
this.resolvedForward = null, this.resolvedForwardKey = null,
|
|
1520
|
+
this.resolvedForward = null, this.resolvedForwardKey = null, Rt(n, i).then((l) => {
|
|
1471
1521
|
if (a === this.resolveToken) {
|
|
1472
1522
|
if (!l) {
|
|
1473
|
-
this.showPlaceholder("unknown-crs", `Unknown CRS "${
|
|
1523
|
+
this.showPlaceholder("unknown-crs", `Unknown CRS "${n}" — supply crs-def="+proj=…".`);
|
|
1474
1524
|
return;
|
|
1475
1525
|
}
|
|
1476
1526
|
this.resolvedForward = l, this.resolvedForwardKey = o, this.scheduleRender();
|
|
1477
1527
|
}
|
|
1478
1528
|
}).catch(() => {
|
|
1479
|
-
a === this.resolveToken && this.showPlaceholder("unknown-crs", `Could not resolve CRS "${
|
|
1529
|
+
a === this.resolveToken && this.showPlaceholder("unknown-crs", `Could not resolve CRS "${n}".`);
|
|
1480
1530
|
});
|
|
1481
1531
|
return;
|
|
1482
1532
|
}
|
|
1483
|
-
if (!
|
|
1533
|
+
if (!H(this.getAttribute("corners"))) {
|
|
1484
1534
|
this.showPlaceholder("bad-corners", 'Static frame needs corners="[[lng,lat] × 4]" (tl, tr, br, bl).');
|
|
1485
1535
|
return;
|
|
1486
1536
|
}
|
|
@@ -1492,32 +1542,96 @@ class Ke extends I {
|
|
|
1492
1542
|
renderLive() {
|
|
1493
1543
|
const t = this.staticSource;
|
|
1494
1544
|
t && (t.style.display = "none");
|
|
1495
|
-
const e =
|
|
1545
|
+
const e = ut(this);
|
|
1496
1546
|
if (!e) {
|
|
1497
1547
|
this.showPlaceholder("no-camera", 'Live frame needs its own camera — center="[lng, lat]" and zoom=.');
|
|
1498
1548
|
return;
|
|
1499
1549
|
}
|
|
1500
|
-
const
|
|
1501
|
-
this.appliedCameraKey =
|
|
1502
|
-
const o = this.
|
|
1503
|
-
if (
|
|
1504
|
-
|
|
1550
|
+
const n = JSON.stringify(e), i = n !== this.appliedCameraKey;
|
|
1551
|
+
this.appliedCameraKey = n, this.updateLiveCorners(i ? e : this.liveCamera() ?? e);
|
|
1552
|
+
const o = this.sources();
|
|
1553
|
+
if (o.length === 0) {
|
|
1554
|
+
this.showPlaceholder("no-source", "Live frame needs src=, an <om-source> child, or an inline <om-map>.");
|
|
1555
|
+
return;
|
|
1556
|
+
}
|
|
1557
|
+
const s = wn(o);
|
|
1558
|
+
s !== this.knownSourceList && (this.knownSourceList = s, this.sourceCursor = 0, this.settledSource = null, this.removeAttribute(be));
|
|
1559
|
+
const a = Math.min(this.sourceCursor, o.length - 1), l = o[a];
|
|
1560
|
+
if (l.kind === "raster") {
|
|
1561
|
+
this.suspendLiveMode(), this.renderCaptureSource(l, a);
|
|
1562
|
+
return;
|
|
1563
|
+
}
|
|
1564
|
+
if (this.hideCaptureImage(), this.liveMap)
|
|
1565
|
+
if (this.mountedSource !== l.key)
|
|
1505
1566
|
this.releaseLiveMap();
|
|
1506
1567
|
else {
|
|
1507
1568
|
Mt(this.liveMap, e), this.sizeLiveMap();
|
|
1508
1569
|
return;
|
|
1509
1570
|
}
|
|
1510
1571
|
if (this.mounting) {
|
|
1511
|
-
if (this.mountingSource ===
|
|
1572
|
+
if (this.mountingSource === l.key) return;
|
|
1512
1573
|
this.abandonMount();
|
|
1513
1574
|
}
|
|
1514
|
-
this.mountLive(o);
|
|
1575
|
+
this.mountLive(l, a, o);
|
|
1515
1576
|
}
|
|
1516
|
-
/**
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1577
|
+
/**
|
|
1578
|
+
* Draw a CAPTURE source — a georeferenced picture, placed exactly like a
|
|
1579
|
+
* static frame's raster because it is the same thing arrived at a different
|
|
1580
|
+
* way. The <img> is created here and reused, so falling through to a capture
|
|
1581
|
+
* needs nothing in the document that the author did not write.
|
|
1582
|
+
*/
|
|
1583
|
+
renderCaptureSource(t, e) {
|
|
1584
|
+
const n = t.src ?? "";
|
|
1585
|
+
let i = this.querySelector(`:scope > img[${St}]`);
|
|
1586
|
+
if (i || (i = document.createElement("img"), i.setAttribute(St, ""), i.alt = "", this.appendChild(i)), i.getAttribute("src") !== n && i.setAttribute("src", n), i.style.cssText = "position:absolute;inset:0;width:100%;height:100%;display:block;object-fit:fill;", this.captureImage = i, !H(this.georefHostFor(t).getAttribute("corners"))) {
|
|
1587
|
+
this.showPlaceholder("bad-corners", 'A capture <om-source> needs corners="[[lng,lat] × 4]" (tl, tr, br, bl).');
|
|
1588
|
+
return;
|
|
1589
|
+
}
|
|
1590
|
+
this.clearPlaceholder(), this.settleSource(t, e), this.signalStaticReady(i);
|
|
1591
|
+
}
|
|
1592
|
+
/** `georefHost` for a source not yet settled — the settle happens after the check. */
|
|
1593
|
+
georefHostFor(t) {
|
|
1594
|
+
return t.kind === "raster" ? t.el : this;
|
|
1595
|
+
}
|
|
1596
|
+
/** A capture left over from an earlier source must not sit under a live map. */
|
|
1597
|
+
hideCaptureImage() {
|
|
1598
|
+
const t = this.querySelector(`:scope > img[${St}]`);
|
|
1599
|
+
t && (t.style.display = "none");
|
|
1600
|
+
}
|
|
1601
|
+
/**
|
|
1602
|
+
* This frame's sources, in the order they are tried. The map the frame
|
|
1603
|
+
* FETCHED is excluded: it is a child by then, and would otherwise read as an
|
|
1604
|
+
* inline source on the next render.
|
|
1605
|
+
*/
|
|
1606
|
+
sources() {
|
|
1607
|
+
return yn(this, this.liveMapOwned ? this.liveMap : null);
|
|
1608
|
+
}
|
|
1609
|
+
/**
|
|
1610
|
+
* Move to the next source, or report that there is none.
|
|
1611
|
+
*
|
|
1612
|
+
* Called when a source has demonstrably failed — it threw, or it settled
|
|
1613
|
+
* having drawn nothing. The map that drew nothing is released first: leaving
|
|
1614
|
+
* it mounted under a capture would keep a blank canvas over the picture.
|
|
1615
|
+
*/
|
|
1616
|
+
advanceSource(t) {
|
|
1617
|
+
return this.sourceCursor + 1 >= t.length ? !1 : (this.sourceCursor++, this.abandonMount(), this.releaseLiveMap(), this.scheduleRender(), !0);
|
|
1618
|
+
}
|
|
1619
|
+
/**
|
|
1620
|
+
* Record which source the frame settled on, and say so.
|
|
1621
|
+
*
|
|
1622
|
+
* A capture shown silently is its own trap: an editor should be able to
|
|
1623
|
+
* report "showing a capture", and the argument for trying sources in order
|
|
1624
|
+
* at all depends on the choice being visible rather than guessed at.
|
|
1625
|
+
*
|
|
1626
|
+
* `om-frame-view` fires too, because settling on a different source changes
|
|
1627
|
+
* the frame's georeference — furniture left on the previous source's georef
|
|
1628
|
+
* is the same silently-wrong output ordered sources exist to remove.
|
|
1629
|
+
*/
|
|
1630
|
+
settleSource(t, e) {
|
|
1631
|
+
if (this.settledSource?.key === t.key) return;
|
|
1632
|
+
this.settledSource = t, this.sourceCursor = e, this.setAttribute(be, String(e));
|
|
1633
|
+
const n = { id: this.id, index: e, kind: t.kind, src: t.src ?? null };
|
|
1634
|
+
this.dispatchEvent(new CustomEvent("om-frame-source", { bubbles: !0, detail: n })), this.dispatchEvent(new CustomEvent("om-frame-view", { bubbles: !0, detail: { id: this.id } }));
|
|
1521
1635
|
}
|
|
1522
1636
|
/** Leave live mode without deleting an authored inline map. */
|
|
1523
1637
|
suspendLiveMode() {
|
|
@@ -1557,33 +1671,45 @@ class Ke extends I {
|
|
|
1557
1671
|
const e = `${Number(t.toFixed(6))}m`;
|
|
1558
1672
|
this.liveMap.getAttribute("reference-scale") !== e && this.liveMap.setAttribute("reference-scale", e);
|
|
1559
1673
|
}
|
|
1560
|
-
updateLiveCorners(t =
|
|
1674
|
+
updateLiveCorners(t = ut(this)) {
|
|
1561
1675
|
if (!t) return;
|
|
1562
|
-
const e =
|
|
1676
|
+
const e = Y();
|
|
1563
1677
|
if (!e) return;
|
|
1564
|
-
const { w:
|
|
1678
|
+
const { w: n, h: i } = C(this), s = this.liveMap?.groundCorners?.(n * D, i * D) ?? Ft(e, t, n * D, i * D), a = JSON.stringify(s) !== JSON.stringify(this.liveCorners);
|
|
1565
1679
|
this.liveCorners = s, a && this.liveMap && this.dispatchEvent(new CustomEvent("om-frame-view", { bubbles: !0, detail: { id: this.id } })), this.applyReferenceScale(), s ? this.lastError === "degenerate-view" && this.clearPlaceholder() : this.showPlaceholder("degenerate-view", "This frame's box cannot be georeferenced — give it a positive width and height.");
|
|
1566
1680
|
}
|
|
1567
|
-
async mountLive(t) {
|
|
1568
|
-
const
|
|
1569
|
-
this.mounting = !0, this.mountingSource = t;
|
|
1681
|
+
async mountLive(t, e, n) {
|
|
1682
|
+
const i = ++this.mountToken;
|
|
1683
|
+
this.mounting = !0, this.mountingSource = t.key;
|
|
1684
|
+
let o = !1;
|
|
1570
1685
|
try {
|
|
1571
|
-
const { core:
|
|
1572
|
-
if (
|
|
1573
|
-
const
|
|
1574
|
-
if (!
|
|
1575
|
-
this.appliedCameraKey = JSON.stringify(
|
|
1576
|
-
const
|
|
1577
|
-
|
|
1578
|
-
const { w:
|
|
1579
|
-
if (this.liveCorners = Ft(
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1686
|
+
const { core: s, map: a } = await fn(this, t.map ?? t.src);
|
|
1687
|
+
if (i !== this.mountToken || !this.isConnected || this.mode !== "live") return;
|
|
1688
|
+
const l = ut(this);
|
|
1689
|
+
if (!l) return;
|
|
1690
|
+
this.appliedCameraKey = JSON.stringify(l), Mt(a, l);
|
|
1691
|
+
const c = a;
|
|
1692
|
+
c.style.position = "absolute", c.style.inset = "0", c.style.display = "block", this.liveMapOwned = a.parentElement !== this, this.liveMapOwned && this.appendChild(a), a.setAttribute("data-om-carto-frame", ""), this.liveMap = c, c.addEventListener("om-view-changed", this.onLiveViewSettled), this.mountedSource = t.key, this.sizeLiveMap(), this.clearPlaceholder();
|
|
1693
|
+
const { w: u, h } = C(this);
|
|
1694
|
+
if (this.liveCorners = Ft(s, l, u * D, h * D), this.applyReferenceScale(), await c.ready, i !== this.mountToken || (Mt(a, l), await c.whenSettled?.({ timeout: 2e4 }), i !== this.mountToken)) return;
|
|
1695
|
+
if (c.hasDrawableContent?.() === !1) {
|
|
1696
|
+
if (this.advanceSource(n)) return;
|
|
1697
|
+
console.warn(
|
|
1698
|
+
`[onlymapjs] <om-frame id="${this.id}"> source ${e} (${t.src ?? "inline"}) drew nothing, and it is the last source.`
|
|
1699
|
+
);
|
|
1700
|
+
}
|
|
1701
|
+
o = !0, this.settleSource(t, e), this.signalReady();
|
|
1702
|
+
} catch (s) {
|
|
1703
|
+
if (i !== this.mountToken) return;
|
|
1704
|
+
const a = s.message ?? String(s);
|
|
1705
|
+
if (o) {
|
|
1706
|
+
console.error(`[onlymapjs] <om-frame id="${this.id}"> rendered, then failed while reporting it: ${a}`);
|
|
1707
|
+
return;
|
|
1708
|
+
}
|
|
1709
|
+
if (this.advanceSource(n)) return;
|
|
1710
|
+
this.showPlaceholder(a.includes("src=") || a.includes("no <om-map>") ? "no-source" : "load-failed", `Live frame could not load: ${a}`);
|
|
1585
1711
|
} finally {
|
|
1586
|
-
|
|
1712
|
+
i === this.mountToken && (this.mounting = !1, this.mountingSource = null);
|
|
1587
1713
|
}
|
|
1588
1714
|
}
|
|
1589
1715
|
sizeLiveMap() {
|
|
@@ -1608,13 +1734,13 @@ class Ke extends I {
|
|
|
1608
1734
|
* segments would visibly cut the corners on a wide-extent inset.
|
|
1609
1735
|
*/
|
|
1610
1736
|
renderOverview() {
|
|
1611
|
-
const t = this.getAttribute("overview-of"), e = this.querySelector(`:scope > [${
|
|
1737
|
+
const t = this.getAttribute("overview-of"), e = this.querySelector(`:scope > [${Ct}]`);
|
|
1612
1738
|
if (!t) {
|
|
1613
1739
|
e?.remove();
|
|
1614
1740
|
return;
|
|
1615
1741
|
}
|
|
1616
|
-
const
|
|
1617
|
-
if (!
|
|
1742
|
+
const n = qe(this, t), i = this.georef, o = n?.georef;
|
|
1743
|
+
if (!n || !i || !o) {
|
|
1618
1744
|
e?.remove();
|
|
1619
1745
|
return;
|
|
1620
1746
|
}
|
|
@@ -1625,17 +1751,17 @@ class Ke extends I {
|
|
|
1625
1751
|
[d, c]
|
|
1626
1752
|
];
|
|
1627
1753
|
for (const [b, w] of m)
|
|
1628
|
-
for (let y = 0; y <
|
|
1629
|
-
const M = y /
|
|
1754
|
+
for (let y = 0; y < we; y++) {
|
|
1755
|
+
const M = y / we, v = [b[0] + (w[0] - b[0]) * M, b[1] + (w[1] - b[1]) * M], N = i.project(v);
|
|
1630
1756
|
N && l.push(`${N.xMm.toFixed(3)},${N.yMm.toFixed(3)}`);
|
|
1631
1757
|
}
|
|
1632
1758
|
if (l.length < 3) {
|
|
1633
1759
|
e?.remove();
|
|
1634
1760
|
return;
|
|
1635
1761
|
}
|
|
1636
|
-
const f = this.ownerDocument, g = e ?? f.createElementNS(
|
|
1637
|
-
g.setAttribute(
|
|
1638
|
-
const p = f.createElementNS(
|
|
1762
|
+
const f = this.ownerDocument, g = e ?? f.createElementNS(ye, "svg");
|
|
1763
|
+
g.setAttribute(Ct, ""), g.setAttribute("width", `${s}mm`), g.setAttribute("height", `${a}mm`), g.setAttribute("viewBox", `0 0 ${s} ${a}`), g.style.cssText = "position:absolute;inset:0;pointer-events:none;", g.replaceChildren();
|
|
1764
|
+
const p = f.createElementNS(ye, "polygon");
|
|
1639
1765
|
p.setAttribute("points", l.join(" ")), p.setAttribute("fill", "none"), p.setAttribute("stroke", this.getAttribute("overview-stroke") || "#e63946"), p.setAttribute("stroke-width", "0.4"), g.appendChild(p), e || this.appendChild(g);
|
|
1640
1766
|
}
|
|
1641
1767
|
// -------------------------------------------------------------------------
|
|
@@ -1659,8 +1785,8 @@ class Ke extends I {
|
|
|
1659
1785
|
* the worst outcome — it looks like a design choice.
|
|
1660
1786
|
*/
|
|
1661
1787
|
showPlaceholder(t, e) {
|
|
1662
|
-
let
|
|
1663
|
-
|
|
1788
|
+
let n = this.querySelector(`:scope > [${At}]`);
|
|
1789
|
+
n || (n = document.createElement("div"), n.setAttribute(At, ""), n.style.cssText = "position:absolute;inset:0;display:grid;place-content:center;padding:4mm;text-align:center;font:italic 3mm/1.4 system-ui,sans-serif;color:var(--om-carto-ink);opacity:.75;", this.appendChild(n)), n.textContent !== e && (n.textContent = e), this.lastError !== t && (this.lastError = t, this.settleReady(), this.dispatchEvent(new CustomEvent("om-frame-error", { bubbles: !0, detail: { id: this.id, reason: t, message: e } })));
|
|
1664
1790
|
}
|
|
1665
1791
|
clearPlaceholder() {
|
|
1666
1792
|
this.querySelector(`:scope > [${At}]`)?.remove(), this.lastError = null;
|
|
@@ -1675,9 +1801,9 @@ class Ke extends I {
|
|
|
1675
1801
|
*/
|
|
1676
1802
|
async captureAt(t) {
|
|
1677
1803
|
if (this.mode !== "live" || !this.liveMap) return null;
|
|
1678
|
-
const e = await this.liveMap.snapshot({ scale: t }),
|
|
1679
|
-
return
|
|
1680
|
-
}),
|
|
1804
|
+
const e = await this.liveMap.snapshot({ scale: t }), n = new Image();
|
|
1805
|
+
return n.decoding = "sync", n.src = e, await n.decode().catch(() => {
|
|
1806
|
+
}), n;
|
|
1681
1807
|
}
|
|
1682
1808
|
/**
|
|
1683
1809
|
* Freeze this live frame into a static one (docs/design/carto-substrate.md §7).
|
|
@@ -1702,20 +1828,20 @@ class Ke extends I {
|
|
|
1702
1828
|
*/
|
|
1703
1829
|
async freeze(t = {}) {
|
|
1704
1830
|
if (this.mode !== "live" || !this.liveMap) return !1;
|
|
1705
|
-
const
|
|
1706
|
-
if (!
|
|
1831
|
+
const n = this.georef?.corners;
|
|
1832
|
+
if (!n) return !1;
|
|
1707
1833
|
const i = t.format ?? "svg", o = this.liveMap.projectedCrs?.() ?? null;
|
|
1708
1834
|
if (i === "svg") {
|
|
1709
1835
|
const s = await this.liveMap.snapshot({ format: "svg", effectDpi: t.effectDpi }), l = new DOMParser().parseFromString(s, "image/svg+xml").documentElement;
|
|
1710
1836
|
if (l.nodeName !== "svg") return !1;
|
|
1711
1837
|
const c = document.importNode(l, !0);
|
|
1712
|
-
c.setAttribute(
|
|
1838
|
+
c.setAttribute(Et, ""), this.vector?.remove(), this.raster?.remove(), this.appendChild(c);
|
|
1713
1839
|
} else {
|
|
1714
1840
|
const s = await this.captureAt(t.scale ?? 3.125);
|
|
1715
1841
|
if (!s) return !1;
|
|
1716
1842
|
this.vector?.remove(), this.raster?.remove(), this.appendChild(s);
|
|
1717
1843
|
}
|
|
1718
|
-
return this.setAttribute("corners", JSON.stringify(
|
|
1844
|
+
return this.setAttribute("corners", JSON.stringify(n.map(([s, a]) => [Number(s.toFixed(8)), Number(a.toFixed(8))]))), o && o !== "EPSG:3857" ? this.setAttribute("crs", o) : this.removeAttribute("crs"), this.setAttribute("mode", "static"), this.scheduleRender(), !0;
|
|
1719
1845
|
}
|
|
1720
1846
|
/**
|
|
1721
1847
|
* Point this frame's camera at a lon/lat box — the atlas's per-page refit.
|
|
@@ -1725,12 +1851,12 @@ class Ke extends I {
|
|
|
1725
1851
|
* follows from the same source as any authored camera.
|
|
1726
1852
|
*/
|
|
1727
1853
|
fitBounds(t) {
|
|
1728
|
-
const [e,
|
|
1854
|
+
const [e, n, i, o] = t, { w: s, h: a } = C(this);
|
|
1729
1855
|
if (s <= 0 || a <= 0) return;
|
|
1730
|
-
const l =
|
|
1856
|
+
const l = Y();
|
|
1731
1857
|
if (!l) return;
|
|
1732
1858
|
const c = new l.WebMercatorViewport({ width: s * D, height: a * D, longitude: 0, latitude: 0, zoom: 0 }).fitBounds([
|
|
1733
|
-
[e,
|
|
1859
|
+
[e, n],
|
|
1734
1860
|
[i, o]
|
|
1735
1861
|
]);
|
|
1736
1862
|
[c.longitude, c.latitude, c.zoom].every(Number.isFinite) && (this.setAttribute("center", JSON.stringify([Number(c.longitude.toFixed(8)), Number(c.latitude.toFixed(8))])), this.setAttribute("zoom", String(Number(c.zoom.toFixed(4)))), this.updateLiveCorners());
|
|
@@ -1752,7 +1878,7 @@ class Ke extends I {
|
|
|
1752
1878
|
return;
|
|
1753
1879
|
}
|
|
1754
1880
|
const e = this.vector;
|
|
1755
|
-
e && (this.captureImage = await
|
|
1881
|
+
e && (this.captureImage = await vn(e, C(this), t.pxPerMm));
|
|
1756
1882
|
}
|
|
1757
1883
|
/** Export hook: forget the capture, so a failed pre-pass never reuses it. */
|
|
1758
1884
|
discardCartograph() {
|
|
@@ -1773,51 +1899,51 @@ class Ke extends I {
|
|
|
1773
1899
|
this.printing = !1, this.querySelector(":scope > img[data-om-carto-print]")?.remove(), this.liveMap && (this.liveMap.hidden = !1);
|
|
1774
1900
|
}
|
|
1775
1901
|
paintCartograph(t, e) {
|
|
1776
|
-
const { w:
|
|
1902
|
+
const { w: n, h: i } = C(this), o = n * e.pxPerMm, s = i * e.pxPerMm;
|
|
1777
1903
|
if (o <= 0 || s <= 0) return;
|
|
1778
|
-
const a = typeof getComputedStyle == "function" ? getComputedStyle(this) : null, l =
|
|
1904
|
+
const a = typeof getComputedStyle == "function" ? getComputedStyle(this) : null, l = R(a?.backgroundColor);
|
|
1779
1905
|
l && (t.fillStyle = l, t.fillRect(0, 0, o, s));
|
|
1780
1906
|
const c = this.mode === "static" ? this.vector ? this.captureImage : this.raster : this.captureImage;
|
|
1781
1907
|
c && c.complete && c.naturalWidth > 0 && t.drawImage(c, 0, 0, o, s), this.paintOverview(t, e);
|
|
1782
|
-
const u = this.getAttribute("frame-stroke") ||
|
|
1908
|
+
const u = this.getAttribute("frame-stroke") || R(a?.getPropertyValue("--om-carto-frame-stroke")?.trim()) || "#333333", h = ve * e.pxPerMm;
|
|
1783
1909
|
h > 0 && (t.strokeStyle = u, t.lineWidth = h, t.strokeRect(h / 2, h / 2, o - h, s - h));
|
|
1784
1910
|
}
|
|
1785
1911
|
paintOverview(t, e) {
|
|
1786
|
-
const
|
|
1787
|
-
i && (t.save(), t.strokeStyle =
|
|
1912
|
+
const n = this.querySelector(`:scope > [${Ct}] polygon`), i = n?.getAttribute("points");
|
|
1913
|
+
i && (t.save(), t.strokeStyle = n.getAttribute("stroke") || "#e63946", t.lineWidth = Number(n.getAttribute("stroke-width") || 0.4) * e.pxPerMm, t.beginPath(), i.split(/\s+/).forEach((o, s) => {
|
|
1788
1914
|
const [a, l] = o.split(",").map(Number);
|
|
1789
1915
|
!Number.isFinite(a) || !Number.isFinite(l) || (s === 0 ? t.moveTo(a * e.pxPerMm, l * e.pxPerMm) : t.lineTo(a * e.pxPerMm, l * e.pxPerMm));
|
|
1790
1916
|
}), t.closePath(), t.stroke(), t.restore());
|
|
1791
1917
|
}
|
|
1792
1918
|
}
|
|
1793
|
-
|
|
1794
|
-
const
|
|
1795
|
-
class
|
|
1919
|
+
k("om-frame", Je);
|
|
1920
|
+
const st = "http://www.w3.org/2000/svg", Mn = ["single", "double", "line", "ticks"];
|
|
1921
|
+
class Ze extends I {
|
|
1796
1922
|
static observedAttributes = [...T["om-scalebar"]];
|
|
1797
1923
|
/** The geometry currently drawn — reused by the canvas exporter. */
|
|
1798
1924
|
get drawing() {
|
|
1799
1925
|
const e = O(this)?.georef;
|
|
1800
1926
|
if (!e) return null;
|
|
1801
|
-
const { w:
|
|
1927
|
+
const { w: n, h: i } = C(this), o = De({
|
|
1802
1928
|
groundMetersPerMm: e.groundMetersPerMm(),
|
|
1803
|
-
maxWidthMm:
|
|
1929
|
+
maxWidthMm: n,
|
|
1804
1930
|
segments: Number(this.getAttribute("segments")) || void 0,
|
|
1805
1931
|
units: this.unitSystem,
|
|
1806
1932
|
segmentLengthMeters: this.getAttribute("segment-length") ? Number(this.getAttribute("segment-length")) : null
|
|
1807
1933
|
});
|
|
1808
|
-
return o ?
|
|
1934
|
+
return o ? Rr(o, this.barStyle, i) : null;
|
|
1809
1935
|
}
|
|
1810
1936
|
get barStyle() {
|
|
1811
1937
|
const t = this.getAttribute("kind");
|
|
1812
|
-
return
|
|
1938
|
+
return Mn.includes(t) ? t : "single";
|
|
1813
1939
|
}
|
|
1814
1940
|
get unitSystem() {
|
|
1815
|
-
return
|
|
1941
|
+
return Lr(this.getAttribute("units")) ?? "metric";
|
|
1816
1942
|
}
|
|
1817
1943
|
renderNow() {
|
|
1818
1944
|
if (this.applyPlacement(), this.style.display = "block", !O(this)) {
|
|
1819
|
-
const
|
|
1820
|
-
q(this,
|
|
1945
|
+
const n = this.getAttribute("for");
|
|
1946
|
+
q(this, n ? `Scale bar references no frame with id "${n}".` : "Scale bar has no frame to measure (set for=).");
|
|
1821
1947
|
return;
|
|
1822
1948
|
}
|
|
1823
1949
|
const e = this.drawing;
|
|
@@ -1828,48 +1954,48 @@ class He extends I {
|
|
|
1828
1954
|
this.renderSvg(e);
|
|
1829
1955
|
}
|
|
1830
1956
|
renderSvg(t) {
|
|
1831
|
-
const { w: e, h:
|
|
1832
|
-
o.setAttribute("width", `${e}mm`), o.setAttribute("height", `${
|
|
1957
|
+
const { w: e, h: n } = C(this), i = this.ownerDocument, o = i.createElementNS(st, "svg");
|
|
1958
|
+
o.setAttribute("width", `${e}mm`), o.setAttribute("height", `${n}mm`), o.setAttribute("viewBox", `0 0 ${e} ${n}`), o.setAttribute("part", "scalebar"), o.style.display = "block", o.style.overflow = "visible";
|
|
1833
1959
|
const s = "var(--om-carto-scalebar-ink)";
|
|
1834
1960
|
for (const a of t.bars) {
|
|
1835
|
-
const l = i.createElementNS(
|
|
1961
|
+
const l = i.createElementNS(st, "rect");
|
|
1836
1962
|
l.setAttribute("x", String(a.x)), l.setAttribute("y", String(a.y)), l.setAttribute("width", String(a.w)), l.setAttribute("height", String(a.h)), l.setAttribute("fill", a.filled ? s : "none"), l.setAttribute("stroke", s), l.setAttribute("stroke-width", String(t.strokeMm)), o.appendChild(l);
|
|
1837
1963
|
}
|
|
1838
1964
|
for (const a of t.strokes) {
|
|
1839
|
-
const l = i.createElementNS(
|
|
1965
|
+
const l = i.createElementNS(st, "line");
|
|
1840
1966
|
l.setAttribute("x1", String(a.x1)), l.setAttribute("y1", String(a.y1)), l.setAttribute("x2", String(a.x2)), l.setAttribute("y2", String(a.y2)), l.setAttribute("stroke", s), l.setAttribute("stroke-width", String(t.strokeMm)), o.appendChild(l);
|
|
1841
1967
|
}
|
|
1842
1968
|
for (const a of t.labels) {
|
|
1843
|
-
const l = i.createElementNS(
|
|
1969
|
+
const l = i.createElementNS(st, "text");
|
|
1844
1970
|
l.setAttribute("x", String(a.x)), l.setAttribute("y", String(a.y)), l.setAttribute("font-size", String(t.fontMm)), l.setAttribute("fill", s), l.setAttribute("text-anchor", a.anchor), l.setAttribute("font-family", "var(--om-carto-font)"), l.textContent = a.text, o.appendChild(l);
|
|
1845
1971
|
}
|
|
1846
1972
|
this.replaceChildren(o);
|
|
1847
1973
|
}
|
|
1848
1974
|
paintCartograph(t, e) {
|
|
1849
|
-
const
|
|
1850
|
-
if (!
|
|
1851
|
-
const i = typeof getComputedStyle == "function" ? getComputedStyle(this) : null, o =
|
|
1852
|
-
t.strokeStyle = o, t.fillStyle = o, t.lineWidth = s(
|
|
1853
|
-
for (const l of
|
|
1975
|
+
const n = this.drawing;
|
|
1976
|
+
if (!n) return;
|
|
1977
|
+
const i = typeof getComputedStyle == "function" ? getComputedStyle(this) : null, o = R(i?.color) ?? "#000", s = (l) => l * e.pxPerMm;
|
|
1978
|
+
t.strokeStyle = o, t.fillStyle = o, t.lineWidth = s(n.strokeMm);
|
|
1979
|
+
for (const l of n.bars)
|
|
1854
1980
|
l.filled && t.fillRect(s(l.x), s(l.y), s(l.w), s(l.h)), t.strokeRect(s(l.x), s(l.y), s(l.w), s(l.h));
|
|
1855
1981
|
t.beginPath();
|
|
1856
|
-
for (const l of
|
|
1982
|
+
for (const l of n.strokes)
|
|
1857
1983
|
t.moveTo(s(l.x1), s(l.y1)), t.lineTo(s(l.x2), s(l.y2));
|
|
1858
1984
|
t.stroke();
|
|
1859
1985
|
const a = i?.fontFamily || "system-ui, sans-serif";
|
|
1860
|
-
t.font = `${s(
|
|
1861
|
-
for (const l of
|
|
1986
|
+
t.font = `${s(n.fontMm)}px ${a}`, t.textBaseline = "alphabetic";
|
|
1987
|
+
for (const l of n.labels)
|
|
1862
1988
|
t.textAlign = l.anchor === "middle" ? "center" : l.anchor === "end" ? "right" : "left", t.fillText(l.text, s(l.x), s(l.y));
|
|
1863
1989
|
}
|
|
1864
1990
|
}
|
|
1865
|
-
|
|
1866
|
-
const
|
|
1867
|
-
class
|
|
1991
|
+
k("om-scalebar", Ze);
|
|
1992
|
+
const Z = "http://www.w3.org/2000/svg";
|
|
1993
|
+
class Qe extends I {
|
|
1868
1994
|
static observedAttributes = [...T["om-north"]];
|
|
1869
1995
|
/** Degrees clockwise from the page's "up", or null when unknowable. */
|
|
1870
1996
|
get bearing() {
|
|
1871
1997
|
const t = O(this)?.georef;
|
|
1872
|
-
return t ?
|
|
1998
|
+
return t ? cn(t) : null;
|
|
1873
1999
|
}
|
|
1874
2000
|
get indicatorKind() {
|
|
1875
2001
|
return this.getAttribute("kind") === "rose" ? "rose" : "arrow";
|
|
@@ -1885,38 +2011,38 @@ class Ye extends I {
|
|
|
1885
2011
|
q(this, "North indicator cannot derive a direction from this frame yet.");
|
|
1886
2012
|
return;
|
|
1887
2013
|
}
|
|
1888
|
-
const { w:
|
|
1889
|
-
s.setAttribute("width", `${
|
|
1890
|
-
const a = o.createElementNS(
|
|
1891
|
-
a.setAttribute("transform", `rotate(${e.toFixed(3)} ${
|
|
1892
|
-
for (const l of this.buildGeometry(o,
|
|
2014
|
+
const { w: n, h: i } = C(this), o = this.ownerDocument, s = o.createElementNS(Z, "svg");
|
|
2015
|
+
s.setAttribute("width", `${n}mm`), s.setAttribute("height", `${i}mm`), s.setAttribute("viewBox", `0 0 ${n} ${i}`), s.style.display = "block";
|
|
2016
|
+
const a = o.createElementNS(Z, "g");
|
|
2017
|
+
a.setAttribute("transform", `rotate(${e.toFixed(3)} ${n / 2} ${i / 2})`);
|
|
2018
|
+
for (const l of this.buildGeometry(o, n, i)) a.appendChild(l);
|
|
1893
2019
|
s.appendChild(a), this.replaceChildren(s);
|
|
1894
2020
|
}
|
|
1895
|
-
buildGeometry(t, e,
|
|
1896
|
-
const i = "var(--om-carto-compass-ink)", o = [], s = e / 2, a = Math.min(3,
|
|
2021
|
+
buildGeometry(t, e, n) {
|
|
2022
|
+
const i = "var(--om-carto-compass-ink)", o = [], s = e / 2, a = Math.min(3, n * 0.24), l = n - a * 1.2;
|
|
1897
2023
|
if (this.indicatorKind === "rose") {
|
|
1898
|
-
const f = Math.min(e, l) / 2, g = t.createElementNS(
|
|
2024
|
+
const f = Math.min(e, l) / 2, g = t.createElementNS(Z, "circle");
|
|
1899
2025
|
g.setAttribute("cx", String(s)), g.setAttribute("cy", String(l / 2)), g.setAttribute("r", String(f)), g.setAttribute("fill", "none"), g.setAttribute("stroke", i), g.setAttribute("stroke-width", "0.2"), o.push(g);
|
|
1900
2026
|
}
|
|
1901
|
-
const c = 0, u = l, h = Math.min(e * 0.3, 4), d = t.createElementNS(
|
|
2027
|
+
const c = 0, u = l, h = Math.min(e * 0.3, 4), d = t.createElementNS(Z, "path");
|
|
1902
2028
|
d.setAttribute("d", `M ${s} ${c} L ${s + h} ${u} L ${s} ${u - h * 0.55} L ${s - h} ${u} Z`), d.setAttribute("fill", i), o.push(d);
|
|
1903
|
-
const m = t.createElementNS(
|
|
1904
|
-
return m.setAttribute("x", String(s)), m.setAttribute("y", String(
|
|
2029
|
+
const m = t.createElementNS(Z, "text");
|
|
2030
|
+
return m.setAttribute("x", String(s)), m.setAttribute("y", String(n)), m.setAttribute("font-size", String(a)), m.setAttribute("text-anchor", "middle"), m.setAttribute("fill", i), m.setAttribute("font-family", "var(--om-carto-font)"), m.textContent = "N", o.push(m), o;
|
|
1905
2031
|
}
|
|
1906
2032
|
paintCartograph(t, e) {
|
|
1907
|
-
const
|
|
1908
|
-
if (
|
|
1909
|
-
const { w: i, h: o } = C(this), s = typeof getComputedStyle == "function" ? getComputedStyle(this) : null, a =
|
|
1910
|
-
t.save(), t.translate(l(h), l(o / 2)), t.rotate(
|
|
2033
|
+
const n = this.bearing;
|
|
2034
|
+
if (n == null) return;
|
|
2035
|
+
const { w: i, h: o } = C(this), s = typeof getComputedStyle == "function" ? getComputedStyle(this) : null, a = R(s?.color) ?? "#000", l = (m) => m * e.pxPerMm, c = Math.min(3, o * 0.24), u = o - c * 1.2, h = i / 2, d = Math.min(i * 0.3, 4);
|
|
2036
|
+
t.save(), t.translate(l(h), l(o / 2)), t.rotate(n * Math.PI / 180), t.translate(-l(h), -l(o / 2)), t.fillStyle = a, t.strokeStyle = a, this.indicatorKind === "rose" && (t.lineWidth = l(0.2), t.beginPath(), t.arc(l(h), l(u / 2), l(Math.min(i, u) / 2), 0, Math.PI * 2), t.stroke()), t.beginPath(), t.moveTo(l(h), 0), t.lineTo(l(h + d), l(u)), t.lineTo(l(h), l(u - d * 0.55)), t.lineTo(l(h - d), l(u)), t.closePath(), t.fill(), t.font = `${l(c)}px ${s?.fontFamily || "system-ui, sans-serif"}`, t.textAlign = "center", t.textBaseline = "alphabetic", t.fillText("N", l(h), l(o)), t.restore();
|
|
1911
2037
|
}
|
|
1912
2038
|
}
|
|
1913
|
-
|
|
1914
|
-
const
|
|
1915
|
-
class
|
|
2039
|
+
k("om-north", Qe);
|
|
2040
|
+
const ot = "http://www.w3.org/2000/svg", An = ["rect", "ellipse", "line", "arrow"];
|
|
2041
|
+
class tr extends I {
|
|
1916
2042
|
static observedAttributes = [...T["om-shape"]];
|
|
1917
2043
|
get kind() {
|
|
1918
2044
|
const t = this.getAttribute("kind");
|
|
1919
|
-
return
|
|
2045
|
+
return An.includes(t) ? t : "rect";
|
|
1920
2046
|
}
|
|
1921
2047
|
get fill() {
|
|
1922
2048
|
return this.getAttribute("fill") || "var(--om-carto-shape-fill)";
|
|
@@ -1942,44 +2068,44 @@ class Xe extends I {
|
|
|
1942
2068
|
}
|
|
1943
2069
|
renderNow() {
|
|
1944
2070
|
this.applyPlacement(), this.style.display = "block";
|
|
1945
|
-
const { w: t, h: e } = C(this),
|
|
2071
|
+
const { w: t, h: e } = C(this), n = this.ownerDocument, i = n.createElementNS(ot, "svg");
|
|
1946
2072
|
i.setAttribute("width", `${t}mm`), i.setAttribute("height", `${e}mm`), i.setAttribute("viewBox", `0 0 ${t} ${e}`), i.style.display = "block", i.style.overflow = "visible";
|
|
1947
2073
|
const o = this.strokeWidthMm / 2, s = this.kind;
|
|
1948
2074
|
let a;
|
|
1949
|
-
s === "ellipse" ? (a =
|
|
2075
|
+
s === "ellipse" ? (a = n.createElementNS(ot, "ellipse"), a.setAttribute("cx", String(t / 2)), a.setAttribute("cy", String(e / 2)), a.setAttribute("rx", String(Math.max(0, t / 2 - o))), a.setAttribute("ry", String(Math.max(0, e / 2 - o)))) : s === "line" || s === "arrow" ? (a = n.createElementNS(ot, "path"), a.setAttribute("d", s === "arrow" ? this.arrowPath(t, e) : `M 0 0 L ${t} ${e}`)) : (a = n.createElementNS(ot, "rect"), a.setAttribute("x", String(o)), a.setAttribute("y", String(o)), a.setAttribute("width", String(Math.max(0, t - this.strokeWidthMm))), a.setAttribute("height", String(Math.max(0, e - this.strokeWidthMm))), this.radiusMm > 0 && a.setAttribute("rx", String(this.radiusMm)));
|
|
1950
2076
|
const l = s === "rect" || s === "ellipse" || s === "arrow";
|
|
1951
2077
|
a.setAttribute("fill", l ? this.fill : "none"), l && a.setAttribute("fill-opacity", String(this.fillOpacity)), a.setAttribute("stroke", this.stroke), a.setAttribute("stroke-width", String(this.strokeWidthMm)), i.appendChild(a), this.replaceChildren(i);
|
|
1952
2078
|
}
|
|
1953
2079
|
/** A line from the box's top-left to its bottom-right, with a solid head. */
|
|
1954
2080
|
arrowPath(t, e) {
|
|
1955
|
-
const
|
|
2081
|
+
const n = Math.min(t, e) * 0.28, i = Math.atan2(e, t), o = t, s = e, a = { x: o - n * Math.cos(i - 0.4), y: s - n * Math.sin(i - 0.4) }, l = { x: o - n * Math.cos(i + 0.4), y: s - n * Math.sin(i + 0.4) };
|
|
1956
2082
|
return `M 0 0 L ${o} ${s} M ${o} ${s} L ${a.x} ${a.y} L ${l.x} ${l.y} Z`;
|
|
1957
2083
|
}
|
|
1958
2084
|
paintCartograph(t, e) {
|
|
1959
|
-
const { w:
|
|
1960
|
-
if (
|
|
2085
|
+
const { w: n, h: i } = C(this);
|
|
2086
|
+
if (n <= 0 || i <= 0) return;
|
|
1961
2087
|
const o = typeof getComputedStyle == "function" ? getComputedStyle(this) : null, s = (d) => d * e.pxPerMm, a = this.getAttribute("fill") || o?.getPropertyValue("--om-carto-shape-fill")?.trim() || "#cccccc", l = this.getAttribute("stroke") || o?.getPropertyValue("--om-carto-shape-stroke")?.trim() || "#333333", c = s(this.strokeWidthMm), u = c / 2, h = this.kind;
|
|
1962
2088
|
if (t.save(), t.globalAlpha = this.fillOpacity, t.fillStyle = a, t.strokeStyle = l, t.lineWidth = c, h === "ellipse")
|
|
1963
|
-
t.beginPath(), t.ellipse(s(
|
|
2089
|
+
t.beginPath(), t.ellipse(s(n / 2), s(i / 2), Math.max(0, s(n / 2) - u), Math.max(0, s(i / 2) - u), 0, 0, Math.PI * 2), t.fill(), t.globalAlpha = 1, c > 0 && t.stroke();
|
|
1964
2090
|
else if (h === "line" || h === "arrow") {
|
|
1965
|
-
if (t.globalAlpha = 1, t.beginPath(), t.moveTo(0, 0), t.lineTo(s(
|
|
1966
|
-
const d = Math.min(s(
|
|
1967
|
-
t.beginPath(), t.moveTo(s(
|
|
2091
|
+
if (t.globalAlpha = 1, t.beginPath(), t.moveTo(0, 0), t.lineTo(s(n), s(i)), c > 0 && t.stroke(), h === "arrow") {
|
|
2092
|
+
const d = Math.min(s(n), s(i)) * 0.28, m = Math.atan2(s(i), s(n));
|
|
2093
|
+
t.beginPath(), t.moveTo(s(n), s(i)), t.lineTo(s(n) - d * Math.cos(m - 0.4), s(i) - d * Math.sin(m - 0.4)), t.lineTo(s(n) - d * Math.cos(m + 0.4), s(i) - d * Math.sin(m + 0.4)), t.closePath(), t.fillStyle = l, t.fill();
|
|
1968
2094
|
}
|
|
1969
2095
|
} else {
|
|
1970
2096
|
const d = s(this.radiusMm);
|
|
1971
|
-
t.beginPath(), d > 0 && typeof t.roundRect == "function" ? t.roundRect(u, u, s(
|
|
2097
|
+
t.beginPath(), d > 0 && typeof t.roundRect == "function" ? t.roundRect(u, u, s(n) - c, s(i) - c, d) : t.rect(u, u, s(n) - c, s(i) - c), t.fill(), t.globalAlpha = 1, c > 0 && t.stroke();
|
|
1972
2098
|
}
|
|
1973
2099
|
t.restore();
|
|
1974
2100
|
}
|
|
1975
2101
|
}
|
|
1976
|
-
|
|
1977
|
-
const
|
|
1978
|
-
class
|
|
2102
|
+
k("om-shape", tr);
|
|
2103
|
+
const Me = "data-om-carto-owned", Sn = ["contain", "cover", "fill"];
|
|
2104
|
+
class er extends I {
|
|
1979
2105
|
static observedAttributes = [...T["om-image"]];
|
|
1980
2106
|
get fit() {
|
|
1981
2107
|
const t = this.getAttribute("fit");
|
|
1982
|
-
return
|
|
2108
|
+
return Sn.includes(t ?? "") ? t : "contain";
|
|
1983
2109
|
}
|
|
1984
2110
|
get image() {
|
|
1985
2111
|
return this.querySelector(":scope > img");
|
|
@@ -1988,88 +2114,88 @@ class Je extends I {
|
|
|
1988
2114
|
this.applyPlacement(), this.style.display = "block", this.style.overflow = "hidden";
|
|
1989
2115
|
const t = this.getAttribute("src");
|
|
1990
2116
|
let e = this.image;
|
|
1991
|
-
!e && t && (e = this.ownerDocument.createElement("img"), e.setAttribute(
|
|
2117
|
+
!e && t && (e = this.ownerDocument.createElement("img"), e.setAttribute(Me, ""), e.alt = "", e.crossOrigin = "anonymous", this.appendChild(e)), e && (t && e.hasAttribute(Me) && e.getAttribute("src") !== t && e.setAttribute("src", t), e.style.width = "100%", e.style.height = "100%", e.style.objectFit = this.fit, e.style.display = "block");
|
|
1992
2118
|
}
|
|
1993
2119
|
paintCartograph(t, e) {
|
|
1994
|
-
const
|
|
1995
|
-
if (!
|
|
2120
|
+
const n = this.image;
|
|
2121
|
+
if (!n || !n.complete || n.naturalWidth === 0) return;
|
|
1996
2122
|
const { w: i, h: o } = C(this), s = i * e.pxPerMm, a = o * e.pxPerMm;
|
|
1997
2123
|
if (s <= 0 || a <= 0) return;
|
|
1998
2124
|
const l = this.fit;
|
|
1999
2125
|
if (l === "fill") {
|
|
2000
|
-
t.drawImage(
|
|
2126
|
+
t.drawImage(n, 0, 0, s, a);
|
|
2001
2127
|
return;
|
|
2002
2128
|
}
|
|
2003
|
-
const c =
|
|
2004
|
-
l === "cover" && (t.save(), t.beginPath(), t.rect(0, 0, s, a), t.clip()), t.drawImage(
|
|
2129
|
+
const c = n.naturalWidth / n.naturalHeight, u = s / a, h = l === "contain" ? c > u : c < u, d = h ? s : a * c, m = h ? s / c : a;
|
|
2130
|
+
l === "cover" && (t.save(), t.beginPath(), t.rect(0, 0, s, a), t.clip()), t.drawImage(n, (s - d) / 2, (a - m) / 2, d, m), l === "cover" && t.restore();
|
|
2005
2131
|
}
|
|
2006
2132
|
}
|
|
2007
|
-
|
|
2008
|
-
const
|
|
2009
|
-
function
|
|
2010
|
-
const t =
|
|
2011
|
-
if (
|
|
2012
|
-
if (
|
|
2013
|
-
if (
|
|
2133
|
+
k("om-image", er);
|
|
2134
|
+
const Cn = /* @__PURE__ */ new Set(["PathLayer", "LineLayer", "ArcLayer", "TripsLayer", "GreatCircleLayer", "PathStyleLayer"]), kn = /* @__PURE__ */ new Set(["ScatterplotLayer", "IconLayer", "TextLayer", "PointCloudLayer", "HeatmapLayer", "ScreenGridLayer"]), $n = /* @__PURE__ */ new Set(["COGLayer", "ZarrLayer", "BitmapLayer", "TerrainLayer", "ImageOverlay"]);
|
|
2135
|
+
function xn(r) {
|
|
2136
|
+
const t = r.type ?? "";
|
|
2137
|
+
if ($n.has(t)) return "ramp";
|
|
2138
|
+
if (Cn.has(t)) return "line";
|
|
2139
|
+
if (kn.has(t)) return "point";
|
|
2014
2140
|
if (t === "GeoJsonLayer") {
|
|
2015
|
-
const e =
|
|
2016
|
-
if (
|
|
2017
|
-
if (i && !
|
|
2141
|
+
const e = r.props ?? {}, n = e.getFillColor !== void 0, i = e.getLineColor !== void 0;
|
|
2142
|
+
if (n && !i) return "polygon";
|
|
2143
|
+
if (i && !n || e.filled === !1 && e.stroked !== !1) return "line";
|
|
2018
2144
|
}
|
|
2019
2145
|
return "polygon";
|
|
2020
2146
|
}
|
|
2021
|
-
function
|
|
2022
|
-
const t =
|
|
2023
|
-
return
|
|
2147
|
+
function En(r) {
|
|
2148
|
+
const t = r.meta?.legend;
|
|
2149
|
+
return r.meta?.color ?? (t?.kind === "ramp" ? t.colors[0] : t?.entries[0]?.color) ?? "#999";
|
|
2024
2150
|
}
|
|
2025
|
-
const
|
|
2026
|
-
function
|
|
2151
|
+
const kt = 12;
|
|
2152
|
+
function Nn(r, t = []) {
|
|
2027
2153
|
const e = [];
|
|
2028
|
-
for (const
|
|
2029
|
-
if (
|
|
2030
|
-
const i = t.filter((a) => a.layer ===
|
|
2154
|
+
for (const n of r) {
|
|
2155
|
+
if (n.props?.visible === !1) continue;
|
|
2156
|
+
const i = t.filter((a) => a.layer === n.id), o = i.find((a) => a.match == null);
|
|
2031
2157
|
if (o?.hide) continue;
|
|
2032
|
-
const s =
|
|
2158
|
+
const s = Pn(n.meta?.legend);
|
|
2033
2159
|
e.push({
|
|
2034
|
-
layerId:
|
|
2035
|
-
label: o?.label ??
|
|
2036
|
-
color: o?.color ??
|
|
2037
|
-
shape: o?.shape ??
|
|
2038
|
-
legend:
|
|
2160
|
+
layerId: n.id,
|
|
2161
|
+
label: o?.label ?? n.meta?.label ?? n.id,
|
|
2162
|
+
color: o?.color ?? En(n),
|
|
2163
|
+
shape: o?.shape ?? xn(n),
|
|
2164
|
+
legend: Tn(s, i),
|
|
2039
2165
|
order: o?.order
|
|
2040
2166
|
});
|
|
2041
2167
|
}
|
|
2042
|
-
return e.map((
|
|
2043
|
-
const o =
|
|
2044
|
-
return o - s ||
|
|
2045
|
-
}).map((
|
|
2168
|
+
return e.map((n, i) => ({ row: n, index: i })).sort((n, i) => {
|
|
2169
|
+
const o = n.row.order ?? Number.POSITIVE_INFINITY, s = i.row.order ?? Number.POSITIVE_INFINITY;
|
|
2170
|
+
return o - s || n.index - i.index;
|
|
2171
|
+
}).map((n) => n.row);
|
|
2046
2172
|
}
|
|
2047
|
-
function
|
|
2048
|
-
if (!
|
|
2049
|
-
const t =
|
|
2173
|
+
function Pn(r) {
|
|
2174
|
+
if (!r || r.kind !== "categories" || r.entries.length <= kt) return r;
|
|
2175
|
+
const t = r.entries.slice(0, kt), e = r.entries.length - kt;
|
|
2050
2176
|
return {
|
|
2051
|
-
...
|
|
2052
|
-
entries: [...t, { color:
|
|
2177
|
+
...r,
|
|
2178
|
+
entries: [...t, { color: r.defaultColor ?? "#999", label: `+${e} more` }]
|
|
2053
2179
|
};
|
|
2054
2180
|
}
|
|
2055
|
-
function
|
|
2181
|
+
function Tn(r, t) {
|
|
2056
2182
|
const e = t.filter((i) => i.match != null);
|
|
2057
|
-
if (!
|
|
2058
|
-
const
|
|
2059
|
-
for (const i of
|
|
2183
|
+
if (!r || r.kind === "ramp" || e.length === 0) return r;
|
|
2184
|
+
const n = [];
|
|
2185
|
+
for (const i of r.entries) {
|
|
2060
2186
|
const o = e.find((s) => s.match === i.label);
|
|
2061
|
-
o?.hide ||
|
|
2187
|
+
o?.hide || n.push({ color: o?.color ?? i.color, label: o?.label ?? i.label });
|
|
2062
2188
|
}
|
|
2063
|
-
return { ...
|
|
2189
|
+
return { ...r, entries: n };
|
|
2064
2190
|
}
|
|
2065
|
-
function
|
|
2191
|
+
function Ln(r) {
|
|
2066
2192
|
const t = [];
|
|
2067
|
-
for (const e of
|
|
2068
|
-
const
|
|
2069
|
-
if (!
|
|
2193
|
+
for (const e of r.querySelectorAll(":scope > om-legend-row")) {
|
|
2194
|
+
const n = e.getAttribute("layer");
|
|
2195
|
+
if (!n) continue;
|
|
2070
2196
|
const i = e.getAttribute("order"), o = i == null || i.trim() === "" ? void 0 : Number(i);
|
|
2071
2197
|
t.push({
|
|
2072
|
-
layer:
|
|
2198
|
+
layer: n,
|
|
2073
2199
|
match: e.getAttribute("match") ?? void 0,
|
|
2074
2200
|
label: e.getAttribute("label") ?? void 0,
|
|
2075
2201
|
hide: e.hasAttribute("hide"),
|
|
@@ -2080,11 +2206,11 @@ function xn(n) {
|
|
|
2080
2206
|
}
|
|
2081
2207
|
return t;
|
|
2082
2208
|
}
|
|
2083
|
-
function
|
|
2209
|
+
function rr(r) {
|
|
2084
2210
|
const t = [];
|
|
2085
|
-
for (const e of
|
|
2211
|
+
for (const e of r.querySelectorAll(":scope > om-legend-row")) {
|
|
2086
2212
|
if (e.hasAttribute("hide")) continue;
|
|
2087
|
-
const
|
|
2213
|
+
const n = e.getAttribute("order"), i = n == null || n.trim() === "" ? void 0 : Number(n);
|
|
2088
2214
|
t.push({
|
|
2089
2215
|
layerId: e.getAttribute("layer") ?? "",
|
|
2090
2216
|
label: e.getAttribute("label") ?? e.getAttribute("layer") ?? "",
|
|
@@ -2093,19 +2219,19 @@ function Ze(n) {
|
|
|
2093
2219
|
order: i != null && Number.isFinite(i) ? i : void 0
|
|
2094
2220
|
});
|
|
2095
2221
|
}
|
|
2096
|
-
return t.sort((e,
|
|
2222
|
+
return t.sort((e, n) => (e.order ?? Number.POSITIVE_INFINITY) - (n.order ?? Number.POSITIVE_INFINITY));
|
|
2097
2223
|
}
|
|
2098
|
-
const
|
|
2099
|
-
class
|
|
2224
|
+
const Ae = "data-om-carto-legend-rows";
|
|
2225
|
+
class nr extends I {
|
|
2100
2226
|
static observedAttributes = [...T["om-legend"]];
|
|
2101
2227
|
get derived() {
|
|
2102
2228
|
return this.getAttribute("derived") !== "false";
|
|
2103
2229
|
}
|
|
2104
2230
|
/** The rows this legend currently shows — recomputed on demand, never stored. */
|
|
2105
2231
|
get rows() {
|
|
2106
|
-
if (!this.derived) return
|
|
2107
|
-
const
|
|
2108
|
-
return
|
|
2232
|
+
if (!this.derived) return rr(this);
|
|
2233
|
+
const n = O(this)?.mapElement?.getLayers?.();
|
|
2234
|
+
return n ? Nn(n, Ln(this)) : [];
|
|
2109
2235
|
}
|
|
2110
2236
|
renderNow() {
|
|
2111
2237
|
if (this.applyPlacement(), this.style.display = "block", this.style.boxSizing = "border-box", this.style.overflow = "hidden", this.derived && !O(this)) {
|
|
@@ -2122,63 +2248,63 @@ class Qe extends I {
|
|
|
2122
2248
|
}
|
|
2123
2249
|
renderRows(t) {
|
|
2124
2250
|
const e = this.ownerDocument;
|
|
2125
|
-
this.querySelector(`:scope > [${
|
|
2126
|
-
const
|
|
2127
|
-
|
|
2251
|
+
this.querySelector(`:scope > [${Ae}]`)?.remove(), zr(this);
|
|
2252
|
+
const n = e.createElement("div");
|
|
2253
|
+
n.setAttribute(Ae, ""), n.style.cssText = "padding:2mm;font-size:2.6mm;line-height:1.35;";
|
|
2128
2254
|
const i = this.getAttribute("title");
|
|
2129
2255
|
if (i) {
|
|
2130
2256
|
const s = e.createElement("div");
|
|
2131
|
-
s.textContent = i, s.style.cssText = "font-weight:600;margin-bottom:1.2mm;color:var(--om-carto-legend-title-ink);",
|
|
2257
|
+
s.textContent = i, s.style.cssText = "font-weight:600;margin-bottom:1.2mm;color:var(--om-carto-legend-title-ink);", n.appendChild(s);
|
|
2132
2258
|
}
|
|
2133
2259
|
const o = Number(this.getAttribute("columns"));
|
|
2134
|
-
Number.isFinite(o) && o > 1 && (
|
|
2260
|
+
Number.isFinite(o) && o > 1 && (n.style.columnCount = String(Math.floor(o)), n.style.columnGap = "3mm");
|
|
2135
2261
|
for (const s of t)
|
|
2136
|
-
|
|
2137
|
-
this.appendChild(
|
|
2262
|
+
n.appendChild(this.buildRow(e, s)), s.legend && n.appendChild(this.buildSymbology(e, s));
|
|
2263
|
+
this.appendChild(n);
|
|
2138
2264
|
}
|
|
2139
2265
|
buildRow(t, e) {
|
|
2140
|
-
const
|
|
2141
|
-
|
|
2266
|
+
const n = t.createElement("div");
|
|
2267
|
+
n.style.cssText = "display:flex;align-items:center;gap:1.5mm;margin:0.6mm 0;break-inside:avoid;", n.appendChild(this.buildSwatch(t, e.color, e.shape));
|
|
2142
2268
|
const i = t.createElement("span");
|
|
2143
|
-
return i.textContent = e.label,
|
|
2269
|
+
return i.textContent = e.label, n.appendChild(i), n;
|
|
2144
2270
|
}
|
|
2145
2271
|
/** The swatch geometry carries meaning: an area, a line and a point read differently. */
|
|
2146
|
-
buildSwatch(t, e,
|
|
2272
|
+
buildSwatch(t, e, n) {
|
|
2147
2273
|
const i = t.createElement("span"), o = "display:inline-block;flex:none;width:3.2mm;height:3.2mm;";
|
|
2148
|
-
return
|
|
2274
|
+
return n === "line" ? i.style.cssText = `${o}height:0.9mm;background:${e};` : n === "point" ? i.style.cssText = `${o}border-radius:50%;background:${e};` : n === "ramp" ? i.style.cssText = `${o}width:6mm;background:linear-gradient(to right, ${e}, transparent);` : i.style.cssText = `${o}background:${e};border:0.15mm solid rgba(0,0,0,.35);`, i;
|
|
2149
2275
|
}
|
|
2150
2276
|
buildSymbology(t, e) {
|
|
2151
|
-
const
|
|
2152
|
-
|
|
2277
|
+
const n = t.createElement("div");
|
|
2278
|
+
n.style.cssText = "margin:0.4mm 0 1.6mm 4.7mm;break-inside:avoid;";
|
|
2153
2279
|
const i = e.legend, o = t.createElement("div");
|
|
2154
|
-
if (o.textContent = i.field, o.style.cssText = "font-size:2.1mm;opacity:.7;margin-bottom:0.5mm;",
|
|
2280
|
+
if (o.textContent = i.field, o.style.cssText = "font-size:2.1mm;opacity:.7;margin-bottom:0.5mm;", n.appendChild(o), i.kind === "ramp") {
|
|
2155
2281
|
const s = t.createElement("div");
|
|
2156
|
-
s.style.cssText = `height:2.4mm;background:linear-gradient(to right, ${i.colors.join(", ")});border:0.15mm solid rgba(0,0,0,.25);`,
|
|
2282
|
+
s.style.cssText = `height:2.4mm;background:linear-gradient(to right, ${i.colors.join(", ")});border:0.15mm solid rgba(0,0,0,.25);`, n.appendChild(s);
|
|
2157
2283
|
const a = t.createElement("div");
|
|
2158
|
-
return a.style.cssText = "display:flex;justify-content:space-between;font-size:2.1mm;opacity:.75;", a.append(
|
|
2284
|
+
return a.style.cssText = "display:flex;justify-content:space-between;font-size:2.1mm;opacity:.75;", a.append(at(t, i.domain[0].toLocaleString("en-US")), at(t, i.domain[1].toLocaleString("en-US"))), n.appendChild(a), n;
|
|
2159
2285
|
}
|
|
2160
2286
|
for (const s of i.entries) {
|
|
2161
2287
|
const a = t.createElement("div");
|
|
2162
|
-
a.style.cssText = "display:flex;align-items:center;gap:1.2mm;margin:0.3mm 0;font-size:2.3mm;", a.appendChild(this.buildSwatch(t, s.color, "polygon")), a.appendChild(
|
|
2288
|
+
a.style.cssText = "display:flex;align-items:center;gap:1.2mm;margin:0.3mm 0;font-size:2.3mm;", a.appendChild(this.buildSwatch(t, s.color, "polygon")), a.appendChild(at(t, s.label)), n.appendChild(a);
|
|
2163
2289
|
}
|
|
2164
2290
|
if (i.kind === "categories" && i.defaultColor) {
|
|
2165
2291
|
const s = t.createElement("div");
|
|
2166
|
-
s.style.cssText = "display:flex;align-items:center;gap:1.2mm;margin:0.3mm 0;font-size:2.3mm;", s.appendChild(this.buildSwatch(t, i.defaultColor, "polygon")), s.appendChild(
|
|
2292
|
+
s.style.cssText = "display:flex;align-items:center;gap:1.2mm;margin:0.3mm 0;font-size:2.3mm;", s.appendChild(this.buildSwatch(t, i.defaultColor, "polygon")), s.appendChild(at(t, "other")), n.appendChild(s);
|
|
2167
2293
|
}
|
|
2168
|
-
return
|
|
2294
|
+
return n;
|
|
2169
2295
|
}
|
|
2170
2296
|
paintCartograph(t, e) {
|
|
2171
|
-
const { w:
|
|
2297
|
+
const { w: n, h: i } = C(this), o = n * e.pxPerMm, s = i * e.pxPerMm;
|
|
2172
2298
|
if (o <= 0 || s <= 0) return;
|
|
2173
|
-
const a = typeof getComputedStyle == "function" ? getComputedStyle(this) : null, l =
|
|
2299
|
+
const a = typeof getComputedStyle == "function" ? getComputedStyle(this) : null, l = R(a?.backgroundColor);
|
|
2174
2300
|
l && (t.fillStyle = l, t.fillRect(0, 0, o, s));
|
|
2175
|
-
const c =
|
|
2301
|
+
const c = R(a?.borderTopColor), u = xt(a?.borderTopWidth) * e.scale;
|
|
2176
2302
|
c && u > 0 && (t.strokeStyle = c, t.lineWidth = u, t.strokeRect(u / 2, u / 2, o - u, s - u));
|
|
2177
|
-
const h =
|
|
2303
|
+
const h = R(a?.color) ?? "#111", d = a?.fontFamily || "system-ui, sans-serif", m = (P) => P * e.pxPerMm;
|
|
2178
2304
|
let f = m(2);
|
|
2179
2305
|
const g = this.getAttribute("title");
|
|
2180
2306
|
g && (t.fillStyle = h, t.font = `600 ${m(2.6)}px ${d}`, t.textBaseline = "top", t.fillText(g, m(2), f), f += m(4));
|
|
2181
|
-
const p = this.rows, b = Number(this.getAttribute("columns")), w = Math.min(p.length || 1, Number.isFinite(b) && b > 1 ? Math.floor(b) : 1), y = Math.max(1, Math.ceil(p.length / w)), M = 3, v = Math.max(1, (
|
|
2307
|
+
const p = this.rows, b = Number(this.getAttribute("columns")), w = Math.min(p.length || 1, Number.isFinite(b) && b > 1 ? Math.floor(b) : 1), y = Math.max(1, Math.ceil(p.length / w)), M = 3, v = Math.max(1, (n - 4 - M * (w - 1)) / w), N = f;
|
|
2182
2308
|
let _ = -1, $ = 2;
|
|
2183
2309
|
t.font = `${m(2.6)}px ${d}`;
|
|
2184
2310
|
for (const [P, L] of p.entries()) {
|
|
@@ -2186,14 +2312,14 @@ class Qe extends I {
|
|
|
2186
2312
|
if (A !== _ && (_ = A, $ = 2 + _ * (v + M), f = _ === 0 ? N : m(2)), f > s || (t.fillStyle = L.color, L.shape === "line" ? t.fillRect(m($), f + m(1.2), m(3.2), m(0.9)) : L.shape === "point" ? (t.beginPath(), t.arc(m($ + 1.6), f + m(1.6), m(1.6), 0, Math.PI * 2), t.fill()) : t.fillRect(m($), f, m(3.2), m(3.2)), t.fillStyle = h, t.textBaseline = "top", t.fillText(L.label, m($ + 4.7), f + m(0.3)), f += m(4.2), !L.legend)) continue;
|
|
2187
2313
|
const S = L.legend;
|
|
2188
2314
|
if (t.save(), t.font = `${m(2.1)}px ${d}`, t.globalAlpha = 0.7, t.fillText(S.field, m($ + 2.7), f), t.globalAlpha = 1, f += m(2.8), S.kind === "ramp") {
|
|
2189
|
-
const
|
|
2190
|
-
S.colors.forEach((
|
|
2191
|
-
const
|
|
2192
|
-
t.textAlign = "right", t.fillText(
|
|
2315
|
+
const x = Math.min(24, Math.max(1, v - 2.7)), E = $ + 2.7, U = t.createLinearGradient(m(E), 0, m(E + x), 0);
|
|
2316
|
+
S.colors.forEach((X, lr) => U.addColorStop(S.colors.length === 1 ? 0 : lr / (S.colors.length - 1), X)), t.fillStyle = U, t.fillRect(m(E), f, m(x), m(2.4)), f += m(3.4), t.fillStyle = h, t.font = `${m(2.1)}px ${d}`, t.fillText(S.domain[0].toLocaleString("en-US"), m(E), f);
|
|
2317
|
+
const et = S.domain[1].toLocaleString("en-US");
|
|
2318
|
+
t.textAlign = "right", t.fillText(et, m(E + x), f), t.textAlign = "left", f += m(3.2);
|
|
2193
2319
|
} else {
|
|
2194
|
-
const
|
|
2195
|
-
S.kind === "categories" && S.defaultColor &&
|
|
2196
|
-
for (const E of
|
|
2320
|
+
const x = [...S.entries];
|
|
2321
|
+
S.kind === "categories" && S.defaultColor && x.push({ color: S.defaultColor, label: "other" }), t.font = `${m(2.3)}px ${d}`;
|
|
2322
|
+
for (const E of x) {
|
|
2197
2323
|
if (f > s) break;
|
|
2198
2324
|
t.fillStyle = E.color, t.fillRect(m($ + 2.7), f, m(2.6), m(2.6)), t.fillStyle = h, t.fillText(E.label, m($ + 6.3), f + m(0.2)), f += m(3.2);
|
|
2199
2325
|
}
|
|
@@ -2203,88 +2329,88 @@ class Qe extends I {
|
|
|
2203
2329
|
}
|
|
2204
2330
|
}
|
|
2205
2331
|
}
|
|
2206
|
-
const
|
|
2207
|
-
const e =
|
|
2332
|
+
const at = (r, t) => {
|
|
2333
|
+
const e = r.createElement("span");
|
|
2208
2334
|
return e.textContent = t, e;
|
|
2209
2335
|
};
|
|
2210
|
-
|
|
2211
|
-
const
|
|
2212
|
-
toLngLat: (
|
|
2213
|
-
fromLngLat: (
|
|
2336
|
+
k("om-legend", nr);
|
|
2337
|
+
const Se = 48, _t = {
|
|
2338
|
+
toLngLat: (r, t) => [r, t],
|
|
2339
|
+
fromLngLat: (r) => [r[0], r[1]]
|
|
2214
2340
|
};
|
|
2215
|
-
function
|
|
2216
|
-
return !Number.isFinite(
|
|
2341
|
+
function Ce(r, t = 5) {
|
|
2342
|
+
return !Number.isFinite(r) || r <= 0 ? 0 : Ue(r / Math.max(1, t));
|
|
2217
2343
|
}
|
|
2218
|
-
function
|
|
2219
|
-
if (
|
|
2220
|
-
const a =
|
|
2344
|
+
function Rn({ georef: r, plane: t = _t, interval: e, intervalX: n, intervalY: i, labels: o = "outside", format: s }) {
|
|
2345
|
+
if (r.degenerate) return null;
|
|
2346
|
+
const a = r.corners.map((y) => t.fromLngLat(y)), l = a.map((y) => y[0]), c = a.map((y) => y[1]);
|
|
2221
2347
|
if (l.some((y) => !Number.isFinite(y)) || c.some((y) => !Number.isFinite(y))) return null;
|
|
2222
|
-
const u = Math.min(...l), h = Math.max(...l), d = Math.min(...c), m = Math.max(...c), f =
|
|
2348
|
+
const u = Math.min(...l), h = Math.max(...l), d = Math.min(...c), m = Math.max(...c), f = ke(n ?? e, Ce(h - u)), g = ke(i ?? e, Ce(m - d));
|
|
2223
2349
|
if (f <= 0 || g <= 0 || (h - u) / f > 500 || (m - d) / g > 500) return null;
|
|
2224
|
-
const p = [], b = [], w = s ??
|
|
2350
|
+
const p = [], b = [], w = s ?? In;
|
|
2225
2351
|
for (let y = Math.ceil(u / f) * f; y <= h + 1e-9; y += f) {
|
|
2226
|
-
const M =
|
|
2352
|
+
const M = $e(r, t, y, d, m, "x");
|
|
2227
2353
|
if (M) {
|
|
2228
2354
|
p.push(M);
|
|
2229
|
-
const v = t ===
|
|
2230
|
-
o !== "none" &&
|
|
2355
|
+
const v = t === _t ? Xe(y) : y;
|
|
2356
|
+
o !== "none" && Ee(b, M, r, w(v, "x"), "x", o);
|
|
2231
2357
|
}
|
|
2232
2358
|
}
|
|
2233
2359
|
for (let y = Math.ceil(d / g) * g; y <= m + 1e-9; y += g) {
|
|
2234
|
-
const M =
|
|
2235
|
-
M && (p.push(M), o !== "none" &&
|
|
2360
|
+
const M = $e(r, t, y, u, h, "y");
|
|
2361
|
+
M && (p.push(M), o !== "none" && Ee(b, M, r, w(y, "y"), "y", o));
|
|
2236
2362
|
}
|
|
2237
2363
|
return { lines: p, labels: b, intervalX: f, intervalY: g };
|
|
2238
2364
|
}
|
|
2239
|
-
const
|
|
2240
|
-
function
|
|
2365
|
+
const ke = (r, t) => r != null && Number.isFinite(r) && r > 0 ? r : t;
|
|
2366
|
+
function $e(r, t, e, n, i, o) {
|
|
2241
2367
|
const s = [];
|
|
2242
|
-
for (let l = 0; l <=
|
|
2243
|
-
const c =
|
|
2368
|
+
for (let l = 0; l <= Se; l++) {
|
|
2369
|
+
const c = n + (i - n) * l / Se, u = o === "x" ? t.toLngLat(e, c) : t.toLngLat(c, e);
|
|
2244
2370
|
if (!Number.isFinite(u[0]) || !Number.isFinite(u[1])) continue;
|
|
2245
|
-
const h =
|
|
2371
|
+
const h = r.project(u);
|
|
2246
2372
|
h && s.push(h);
|
|
2247
2373
|
}
|
|
2248
|
-
const a =
|
|
2374
|
+
const a = Fn(s, r.widthMm, r.heightMm);
|
|
2249
2375
|
return a.length >= 2 ? { points: a, value: e, axis: o } : null;
|
|
2250
2376
|
}
|
|
2251
|
-
function
|
|
2252
|
-
const
|
|
2377
|
+
function Fn(r, t, e) {
|
|
2378
|
+
const n = (a) => a.xMm >= -0.01 && a.xMm <= t + 0.01 && a.yMm >= -0.01 && a.yMm <= e + 0.01, i = r.findIndex(n);
|
|
2253
2379
|
if (i === -1) return [];
|
|
2254
|
-
let o =
|
|
2255
|
-
for (; o > i && !r
|
|
2256
|
-
return
|
|
2380
|
+
let o = r.length - 1;
|
|
2381
|
+
for (; o > i && !n(r[o]); ) o--;
|
|
2382
|
+
return r.slice(Math.max(0, i - 1), Math.min(r.length, o + 2)).map((a) => ({ xMm: xe(a.xMm, 0, t), yMm: xe(a.yMm, 0, e) }));
|
|
2257
2383
|
}
|
|
2258
|
-
const
|
|
2259
|
-
function
|
|
2384
|
+
const xe = (r, t, e) => Math.min(e, Math.max(t, r));
|
|
2385
|
+
function Ee(r, t, e, n, i, o) {
|
|
2260
2386
|
if (i === "x") {
|
|
2261
2387
|
const s = t.points.reduce((a, l) => l.yMm > a.yMm ? l : a);
|
|
2262
2388
|
if (Math.abs(s.yMm - e.heightMm) > 0.5) return;
|
|
2263
|
-
|
|
2389
|
+
r.push({ text: n, xMm: s.xMm, yMm: e.heightMm + (o === "outside" ? 3 : -1), edge: "bottom", axis: i });
|
|
2264
2390
|
} else {
|
|
2265
2391
|
const s = t.points.reduce((a, l) => l.xMm < a.xMm ? l : a);
|
|
2266
2392
|
if (Math.abs(s.xMm) > 0.5) return;
|
|
2267
|
-
|
|
2393
|
+
r.push({ text: n, xMm: o === "outside" ? -1.2 : 1.2, yMm: s.yMm, edge: "left", axis: i });
|
|
2268
2394
|
}
|
|
2269
2395
|
}
|
|
2270
|
-
function
|
|
2271
|
-
if (Math.abs(
|
|
2272
|
-
const e = Math.abs(
|
|
2273
|
-
return `${Number(
|
|
2396
|
+
function In(r, t) {
|
|
2397
|
+
if (Math.abs(r) >= 1e3) return Math.round(r).toLocaleString("en-US");
|
|
2398
|
+
const e = Math.abs(r) < 1 ? 3 : Math.abs(r) < 10 ? 2 : 1;
|
|
2399
|
+
return `${Number(r.toFixed(e))}°`;
|
|
2274
2400
|
}
|
|
2275
|
-
function
|
|
2276
|
-
const e = t === "x" ?
|
|
2401
|
+
function _n(r, t) {
|
|
2402
|
+
const e = t === "x" ? r < 0 ? "W" : "E" : r < 0 ? "S" : "N", n = Math.abs(r), i = Math.floor(n), o = (n - i) * 60, s = Math.floor(o), a = Math.round((o - s) * 60), l = a === 60 ? s + 1 : s, c = l === 60 ? i + 1 : i, u = l === 60 ? 0 : l, h = a === 60 ? 0 : a;
|
|
2277
2403
|
return `${c}°${String(u).padStart(2, "0")}′${String(h).padStart(2, "0")}″${e}`;
|
|
2278
2404
|
}
|
|
2279
|
-
const
|
|
2280
|
-
class
|
|
2405
|
+
const lt = "http://www.w3.org/2000/svg", On = ["solid", "cross", "markers"], z = 1.4;
|
|
2406
|
+
class ir extends I {
|
|
2281
2407
|
static observedAttributes = [...T["om-graticule"]];
|
|
2282
2408
|
resolvedPlane = null;
|
|
2283
2409
|
resolvedPlaneKey = null;
|
|
2284
2410
|
resolveToken = 0;
|
|
2285
2411
|
get kind() {
|
|
2286
2412
|
const t = this.getAttribute("kind");
|
|
2287
|
-
return
|
|
2413
|
+
return On.includes(t) ? t : "solid";
|
|
2288
2414
|
}
|
|
2289
2415
|
get labelPlacement() {
|
|
2290
2416
|
const t = this.getAttribute("labels");
|
|
@@ -2296,18 +2422,18 @@ class tr extends I {
|
|
|
2296
2422
|
if (!t) return null;
|
|
2297
2423
|
const e = this.gridPlane();
|
|
2298
2424
|
if (!e) return null;
|
|
2299
|
-
const
|
|
2425
|
+
const n = (i) => {
|
|
2300
2426
|
const o = Number(this.getAttribute(i));
|
|
2301
2427
|
return Number.isFinite(o) && o > 0 ? o : null;
|
|
2302
2428
|
};
|
|
2303
|
-
return
|
|
2429
|
+
return Rn({
|
|
2304
2430
|
georef: t,
|
|
2305
2431
|
plane: e,
|
|
2306
|
-
interval:
|
|
2307
|
-
intervalX:
|
|
2308
|
-
intervalY:
|
|
2432
|
+
interval: n("interval"),
|
|
2433
|
+
intervalX: n("interval-x"),
|
|
2434
|
+
intervalY: n("interval-y"),
|
|
2309
2435
|
labels: this.labelPlacement,
|
|
2310
|
-
format: this.getAttribute("format") === "dms" ?
|
|
2436
|
+
format: this.getAttribute("format") === "dms" ? _n : void 0
|
|
2311
2437
|
});
|
|
2312
2438
|
}
|
|
2313
2439
|
/**
|
|
@@ -2316,25 +2442,25 @@ class tr extends I {
|
|
|
2316
2442
|
* a re-render when it lands.
|
|
2317
2443
|
*/
|
|
2318
2444
|
gridPlane() {
|
|
2319
|
-
const t =
|
|
2320
|
-
if (!t || t === "EPSG:4326" || t === "CRS:84" || t === "OGC:CRS84") return
|
|
2445
|
+
const t = Lt(this.getAttribute("crs"));
|
|
2446
|
+
if (!t || t === "EPSG:4326" || t === "CRS:84" || t === "OGC:CRS84") return _t;
|
|
2321
2447
|
const e = `${t}|${this.getAttribute("crs-def") ?? ""}`;
|
|
2322
2448
|
if (this.resolvedPlaneKey === e) return this.resolvedPlane;
|
|
2323
|
-
const
|
|
2324
|
-
if (
|
|
2325
|
-
const o = { toLngLat: (s, a) =>
|
|
2449
|
+
const n = K(t);
|
|
2450
|
+
if (n) {
|
|
2451
|
+
const o = { toLngLat: (s, a) => n.inverse([s, a]), fromLngLat: (s) => n.forward(s) };
|
|
2326
2452
|
return this.resolvedPlane = o, this.resolvedPlaneKey = e, o;
|
|
2327
2453
|
}
|
|
2328
2454
|
const i = ++this.resolveToken;
|
|
2329
|
-
return
|
|
2455
|
+
return Rt(t, this.getAttribute("crs-def")).then((o) => {
|
|
2330
2456
|
i !== this.resolveToken || !o || (this.resolvedPlane = { toLngLat: (s, a) => o.inverse([s, a]), fromLngLat: (s) => o.forward(s) }, this.resolvedPlaneKey = e, this.scheduleRender());
|
|
2331
2457
|
}).catch(() => {
|
|
2332
2458
|
}), null;
|
|
2333
2459
|
}
|
|
2334
2460
|
renderNow() {
|
|
2335
2461
|
if (this.applyPlacement(), this.style.display = "block", this.style.pointerEvents = "none", !O(this)) {
|
|
2336
|
-
const
|
|
2337
|
-
q(this,
|
|
2462
|
+
const n = this.getAttribute("for");
|
|
2463
|
+
q(this, n ? `Graticule references no frame with id "${n}".` : "Graticule has no frame to cover (set for=).");
|
|
2338
2464
|
return;
|
|
2339
2465
|
}
|
|
2340
2466
|
const e = this.graticule;
|
|
@@ -2345,148 +2471,148 @@ class tr extends I {
|
|
|
2345
2471
|
this.renderSvg(e);
|
|
2346
2472
|
}
|
|
2347
2473
|
renderSvg(t) {
|
|
2348
|
-
const { w: e, h:
|
|
2349
|
-
o.setAttribute("width", `${e}mm`), o.setAttribute("height", `${
|
|
2474
|
+
const { w: e, h: n } = C(this), i = this.ownerDocument, o = i.createElementNS(lt, "svg");
|
|
2475
|
+
o.setAttribute("width", `${e}mm`), o.setAttribute("height", `${n}mm`), o.setAttribute("viewBox", `0 0 ${e} ${n}`), o.style.cssText = "display:block;overflow:visible;";
|
|
2350
2476
|
const s = "var(--om-carto-graticule-ink)", a = this.kind;
|
|
2351
2477
|
for (const l of t.lines)
|
|
2352
2478
|
if (a === "solid") {
|
|
2353
|
-
const c = i.createElementNS(
|
|
2479
|
+
const c = i.createElementNS(lt, "polyline");
|
|
2354
2480
|
c.setAttribute("points", l.points.map((u) => `${u.xMm.toFixed(3)},${u.yMm.toFixed(3)}`).join(" ")), c.setAttribute("fill", "none"), c.setAttribute("stroke", s), c.setAttribute("stroke-width", "0.15"), o.appendChild(c);
|
|
2355
2481
|
} else
|
|
2356
2482
|
for (const c of this.tickPoints(l, a, t)) {
|
|
2357
|
-
const u = i.createElementNS(
|
|
2358
|
-
u.setAttribute("d", `M ${c.xMm -
|
|
2483
|
+
const u = i.createElementNS(lt, "path");
|
|
2484
|
+
u.setAttribute("d", `M ${c.xMm - z} ${c.yMm} H ${c.xMm + z} M ${c.xMm} ${c.yMm - z} V ${c.yMm + z}`), u.setAttribute("stroke", s), u.setAttribute("stroke-width", "0.15"), o.appendChild(u);
|
|
2359
2485
|
}
|
|
2360
2486
|
for (const l of t.labels) {
|
|
2361
|
-
const c = i.createElementNS(
|
|
2487
|
+
const c = i.createElementNS(lt, "text");
|
|
2362
2488
|
c.setAttribute("x", String(l.xMm)), c.setAttribute("y", String(l.yMm)), c.setAttribute("font-size", "2.2"), c.setAttribute("fill", s), c.setAttribute("font-family", "var(--om-carto-font)"), c.setAttribute("text-anchor", l.edge === "left" ? "end" : "middle"), c.textContent = l.text, o.appendChild(c);
|
|
2363
2489
|
}
|
|
2364
2490
|
this.replaceChildren(o);
|
|
2365
2491
|
}
|
|
2366
2492
|
/** Intersections of this line with the perpendicular family. */
|
|
2367
|
-
tickPoints(t, e,
|
|
2493
|
+
tickPoints(t, e, n) {
|
|
2368
2494
|
if (e === "markers") return [t.points[0], t.points[t.points.length - 1]];
|
|
2369
|
-
const i =
|
|
2495
|
+
const i = n.lines.filter((s) => s.axis !== t.axis), o = [];
|
|
2370
2496
|
for (const s of i) {
|
|
2371
|
-
const a =
|
|
2497
|
+
const a = Un(t.points, s.points);
|
|
2372
2498
|
a && o.push(a);
|
|
2373
2499
|
}
|
|
2374
2500
|
return o;
|
|
2375
2501
|
}
|
|
2376
2502
|
paintCartograph(t, e) {
|
|
2377
|
-
const
|
|
2378
|
-
if (!
|
|
2379
|
-
const i = typeof getComputedStyle == "function" ? getComputedStyle(this) : null, o =
|
|
2503
|
+
const n = this.graticule;
|
|
2504
|
+
if (!n) return;
|
|
2505
|
+
const i = typeof getComputedStyle == "function" ? getComputedStyle(this) : null, o = R(i?.color) ?? "#ffffff", s = (l) => l * e.pxPerMm, a = this.kind;
|
|
2380
2506
|
t.save(), t.strokeStyle = o, t.fillStyle = o, t.lineWidth = s(0.15);
|
|
2381
|
-
for (const l of
|
|
2507
|
+
for (const l of n.lines)
|
|
2382
2508
|
if (a === "solid")
|
|
2383
2509
|
t.beginPath(), l.points.forEach((c, u) => u === 0 ? t.moveTo(s(c.xMm), s(c.yMm)) : t.lineTo(s(c.xMm), s(c.yMm))), t.stroke();
|
|
2384
2510
|
else
|
|
2385
|
-
for (const c of this.tickPoints(l, a,
|
|
2386
|
-
t.beginPath(), t.moveTo(s(c.xMm -
|
|
2511
|
+
for (const c of this.tickPoints(l, a, n))
|
|
2512
|
+
t.beginPath(), t.moveTo(s(c.xMm - z), s(c.yMm)), t.lineTo(s(c.xMm + z), s(c.yMm)), t.moveTo(s(c.xMm), s(c.yMm - z)), t.lineTo(s(c.xMm), s(c.yMm + z)), t.stroke();
|
|
2387
2513
|
t.font = `${s(2.2)}px ${i?.fontFamily || "system-ui, sans-serif"}`, t.textBaseline = "alphabetic";
|
|
2388
|
-
for (const l of
|
|
2514
|
+
for (const l of n.labels)
|
|
2389
2515
|
t.textAlign = l.edge === "left" ? "right" : "center", t.fillText(l.text, s(l.xMm), s(l.yMm));
|
|
2390
2516
|
t.restore();
|
|
2391
2517
|
}
|
|
2392
2518
|
}
|
|
2393
|
-
function
|
|
2394
|
-
let e = null,
|
|
2395
|
-
for (const i of
|
|
2519
|
+
function Un(r, t) {
|
|
2520
|
+
let e = null, n = Number.POSITIVE_INFINITY;
|
|
2521
|
+
for (const i of r)
|
|
2396
2522
|
for (const o of t) {
|
|
2397
2523
|
const s = (i.xMm - o.xMm) ** 2 + (i.yMm - o.yMm) ** 2;
|
|
2398
|
-
s <
|
|
2524
|
+
s < n && (n = s, e = i);
|
|
2399
2525
|
}
|
|
2400
|
-
return
|
|
2526
|
+
return n <= 1 ? e : null;
|
|
2401
2527
|
}
|
|
2402
|
-
|
|
2403
|
-
function
|
|
2404
|
-
if (
|
|
2405
|
-
const e =
|
|
2406
|
-
return e && t in e ? e[t] :
|
|
2528
|
+
k("om-graticule", ir);
|
|
2529
|
+
function Dn(r, t) {
|
|
2530
|
+
if (r == null || typeof r != "object") return;
|
|
2531
|
+
const e = r.properties;
|
|
2532
|
+
return e && t in e ? e[t] : r[t];
|
|
2407
2533
|
}
|
|
2408
|
-
function
|
|
2409
|
-
if (Array.isArray(
|
|
2410
|
-
if (typeof
|
|
2411
|
-
t.push([
|
|
2534
|
+
function Ot(r, t) {
|
|
2535
|
+
if (Array.isArray(r)) {
|
|
2536
|
+
if (typeof r[0] == "number") {
|
|
2537
|
+
t.push([r[0], r[1]]);
|
|
2412
2538
|
return;
|
|
2413
2539
|
}
|
|
2414
|
-
for (const e of
|
|
2540
|
+
for (const e of r) Ot(e, t);
|
|
2415
2541
|
}
|
|
2416
2542
|
}
|
|
2417
|
-
function
|
|
2418
|
-
return
|
|
2543
|
+
function jn(r) {
|
|
2544
|
+
return r ? r.tileData != null ? "tiled" : r.asset != null ? "asset" : null : "empty";
|
|
2419
2545
|
}
|
|
2420
|
-
function
|
|
2421
|
-
return
|
|
2546
|
+
function F(r, t) {
|
|
2547
|
+
return Dn(r, t);
|
|
2422
2548
|
}
|
|
2423
|
-
function
|
|
2549
|
+
function Ut(r) {
|
|
2424
2550
|
const t = {}, e = (i) => {
|
|
2425
2551
|
for (const [o, s] of Object.entries(i))
|
|
2426
2552
|
s == null || typeof s == "object" || (t[o] = String(s));
|
|
2427
2553
|
};
|
|
2428
|
-
e(
|
|
2429
|
-
const
|
|
2430
|
-
return
|
|
2431
|
-
}
|
|
2432
|
-
function
|
|
2433
|
-
let t = 1 / 0, e = 1 / 0,
|
|
2434
|
-
const o = [], s =
|
|
2435
|
-
if (s?.coordinates != null)
|
|
2436
|
-
else if (Array.isArray(
|
|
2554
|
+
e(r);
|
|
2555
|
+
const n = r.properties;
|
|
2556
|
+
return n && typeof n == "object" && e(n), t;
|
|
2557
|
+
}
|
|
2558
|
+
function zn(r) {
|
|
2559
|
+
let t = 1 / 0, e = 1 / 0, n = -1 / 0, i = -1 / 0;
|
|
2560
|
+
const o = [], s = r.geometry;
|
|
2561
|
+
if (s?.coordinates != null) Ot(s.coordinates, o);
|
|
2562
|
+
else if (Array.isArray(r.coordinates)) Ot(r.coordinates, o);
|
|
2437
2563
|
else {
|
|
2438
|
-
const a = Number(
|
|
2564
|
+
const a = Number(F(r, "lng") ?? F(r, "longitude") ?? F(r, "lon") ?? F(r, "x")), l = Number(F(r, "lat") ?? F(r, "latitude") ?? F(r, "y"));
|
|
2439
2565
|
Number.isFinite(a) && Number.isFinite(l) && o.push([a, l]);
|
|
2440
2566
|
}
|
|
2441
2567
|
for (const [a, l] of o)
|
|
2442
|
-
!Number.isFinite(a) || !Number.isFinite(l) || (t = Math.min(t, a),
|
|
2443
|
-
return !Number.isFinite(t) || !Number.isFinite(e) ? null : [t, e,
|
|
2444
|
-
}
|
|
2445
|
-
function
|
|
2446
|
-
const [e,
|
|
2447
|
-
return [e - l,
|
|
2448
|
-
}
|
|
2449
|
-
const
|
|
2450
|
-
function
|
|
2451
|
-
let
|
|
2452
|
-
const i =
|
|
2453
|
-
return i.length > 0 && (
|
|
2568
|
+
!Number.isFinite(a) || !Number.isFinite(l) || (t = Math.min(t, a), n = Math.max(n, a), e = Math.min(e, l), i = Math.max(i, l));
|
|
2569
|
+
return !Number.isFinite(t) || !Number.isFinite(e) ? null : [t, e, n, i];
|
|
2570
|
+
}
|
|
2571
|
+
function Gn(r, t) {
|
|
2572
|
+
const [e, n, i, o] = r, s = Math.max(i - e, 1e-4), a = Math.max(o - n, 1e-4), l = s * t, c = a * t;
|
|
2573
|
+
return [e - l, n - c, i + l, o + c];
|
|
2574
|
+
}
|
|
2575
|
+
const Mi = ([r, t, e, n]) => Math.max(0, e - r) * Math.max(0, n - t);
|
|
2576
|
+
function qn({ features: r, filter: t, sort: e }) {
|
|
2577
|
+
let n = t ? r.filter((o) => Wn(t, o)) : [...r];
|
|
2578
|
+
const i = Bn(e);
|
|
2579
|
+
return i.length > 0 && (n = [...n].sort((o, s) => {
|
|
2454
2580
|
for (const { field: a, descending: l } of i) {
|
|
2455
|
-
const c =
|
|
2581
|
+
const c = F(o, a), u = F(s, a);
|
|
2456
2582
|
if (c == null && u == null) continue;
|
|
2457
2583
|
if (c == null) return 1;
|
|
2458
2584
|
if (u == null) return -1;
|
|
2459
|
-
const h =
|
|
2585
|
+
const h = Vn(c, u);
|
|
2460
2586
|
if (h !== 0) return l ? -h : h;
|
|
2461
2587
|
}
|
|
2462
2588
|
return 0;
|
|
2463
|
-
})),
|
|
2589
|
+
})), n;
|
|
2464
2590
|
}
|
|
2465
|
-
function
|
|
2591
|
+
function Wn(r, t) {
|
|
2466
2592
|
try {
|
|
2467
|
-
return !!
|
|
2593
|
+
return !!r(t);
|
|
2468
2594
|
} catch {
|
|
2469
2595
|
return !1;
|
|
2470
2596
|
}
|
|
2471
2597
|
}
|
|
2472
|
-
function
|
|
2473
|
-
return
|
|
2598
|
+
function Bn(r) {
|
|
2599
|
+
return r ? r.split(",").map((t) => t.trim()).filter(Boolean).map((t) => t.startsWith("-") ? { field: t.slice(1), descending: !0 } : { field: t, descending: !1 }) : [];
|
|
2474
2600
|
}
|
|
2475
|
-
function
|
|
2476
|
-
return typeof
|
|
2601
|
+
function Vn(r, t) {
|
|
2602
|
+
return typeof r == "number" && typeof t == "number" ? r - t : String(r).localeCompare(String(t), void 0, { numeric: !0, sensitivity: "base" });
|
|
2477
2603
|
}
|
|
2478
|
-
function
|
|
2479
|
-
const t =
|
|
2604
|
+
function Kn(r) {
|
|
2605
|
+
const t = r.replace(/[\x00-\x1f<>:"/\\|?*]+/g, "-").replace(/\s+/g, "-").replace(/-+/g, "-").replace(/^[-.]+|[-.]+$/g, "").slice(0, 100);
|
|
2480
2606
|
return t === "" ? "page" : t;
|
|
2481
2607
|
}
|
|
2482
|
-
function
|
|
2483
|
-
const
|
|
2608
|
+
function Hn(r, t, e) {
|
|
2609
|
+
const n = /* @__PURE__ */ new Map();
|
|
2484
2610
|
return t.map((i, o) => {
|
|
2485
|
-
const s =
|
|
2486
|
-
return
|
|
2611
|
+
const s = Ut(i), a = (r ?? "page-{{atlas.index}}").replace(/\{\{\s*atlas\.([\w]+)\s*\}\}/g, (u, h) => h === "index" ? String(o + 1) : h === "count" ? String(t.length) : s[h] ?? u), l = Kn(a), c = n.get(l) ?? 0;
|
|
2612
|
+
return n.set(l, c + 1), `${c === 0 ? l : `${l}-${c + 1}`}.${e}`;
|
|
2487
2613
|
});
|
|
2488
2614
|
}
|
|
2489
|
-
class
|
|
2615
|
+
class sr extends I {
|
|
2490
2616
|
static observedAttributes = [...T["om-atlas"]];
|
|
2491
2617
|
/**
|
|
2492
2618
|
* Pages are SNAPSHOTTED when iteration first starts. A streaming or polling
|
|
@@ -2515,17 +2641,17 @@ class er extends I {
|
|
|
2515
2641
|
}
|
|
2516
2642
|
/** Export filenames, one per page, already de-duplicated. */
|
|
2517
2643
|
filenames(t = "png") {
|
|
2518
|
-
return
|
|
2644
|
+
return Hn(this.getAttribute("filename"), this.ensurePages(), t);
|
|
2519
2645
|
}
|
|
2520
2646
|
/** Human page labels, for an editor's stepper and PDF bookmarks. */
|
|
2521
2647
|
pageName(t) {
|
|
2522
2648
|
const e = this.ensurePages()[t];
|
|
2523
2649
|
if (!e) return `Page ${t + 1}`;
|
|
2524
|
-
const
|
|
2650
|
+
const n = Ut(e), i = this.getAttribute("page-name");
|
|
2525
2651
|
return i ? i.replace(
|
|
2526
2652
|
/\{\{\s*atlas\.([\w]+)\s*\}\}/g,
|
|
2527
|
-
(o, s) => s === "index" ? String(t + 1) : s === "count" ? String(this.count) :
|
|
2528
|
-
) :
|
|
2653
|
+
(o, s) => s === "index" ? String(t + 1) : s === "count" ? String(this.count) : n[s] ?? o
|
|
2654
|
+
) : n.name ?? n.title ?? `Page ${t + 1}`;
|
|
2529
2655
|
}
|
|
2530
2656
|
/**
|
|
2531
2657
|
* Recompute the page list from the layer as it stands now, and apply the
|
|
@@ -2539,11 +2665,11 @@ class er extends I {
|
|
|
2539
2665
|
}
|
|
2540
2666
|
ensurePages() {
|
|
2541
2667
|
if (this.pages) return this.pages;
|
|
2542
|
-
const e = this.frame?.mapElement?.getLayers?.(),
|
|
2668
|
+
const e = this.frame?.mapElement?.getLayers?.(), n = this.getAttribute("layer"), i = e?.find((a) => a.id === n), o = e ? jn(i) : null;
|
|
2543
2669
|
if (!e || o)
|
|
2544
2670
|
return this.rejection = e ? o : null, this.pages = [];
|
|
2545
2671
|
const s = this.materialize(i);
|
|
2546
|
-
return this.pages =
|
|
2672
|
+
return this.pages = qn({ features: s, filter: this.compileFilter(), sort: this.getAttribute("sort") }), this.currentIndex = Math.min(this.currentIndex, Math.max(0, this.pages.length - 1)), this.pages;
|
|
2547
2673
|
}
|
|
2548
2674
|
/**
|
|
2549
2675
|
* Rows from the layer, with the layer's OWN declarative filters applied —
|
|
@@ -2551,13 +2677,13 @@ class er extends I {
|
|
|
2551
2677
|
* sheets for features the map itself is hiding.
|
|
2552
2678
|
*/
|
|
2553
2679
|
materialize(t) {
|
|
2554
|
-
const e =
|
|
2555
|
-
if (!
|
|
2556
|
-
const i = e?.asRows ? e.asRows(
|
|
2680
|
+
const e = Y(), n = t.data;
|
|
2681
|
+
if (!n) return [];
|
|
2682
|
+
const i = e?.asRows ? e.asRows(n) : Array.isArray(n) ? n : [], o = [t.filter, t.categoryFilter].filter(Boolean);
|
|
2557
2683
|
return o.length === 0 ? i : i.filter(
|
|
2558
2684
|
(s) => o.every((a) => {
|
|
2559
2685
|
if (!a.field) return !0;
|
|
2560
|
-
const l =
|
|
2686
|
+
const l = F(s, a.field);
|
|
2561
2687
|
if (a.range) {
|
|
2562
2688
|
const c = Number(l);
|
|
2563
2689
|
return Number.isFinite(c) && c >= a.range[0] && c <= a.range[1];
|
|
@@ -2570,13 +2696,13 @@ class er extends I {
|
|
|
2570
2696
|
compileFilter() {
|
|
2571
2697
|
const t = this.getAttribute("filter");
|
|
2572
2698
|
if (!t) return;
|
|
2573
|
-
const e =
|
|
2699
|
+
const e = Y();
|
|
2574
2700
|
if (e?.compileExpression)
|
|
2575
2701
|
try {
|
|
2576
|
-
const
|
|
2577
|
-
return (i) => !!
|
|
2578
|
-
} catch (
|
|
2579
|
-
console.warn(`[onlymapjs/cartograph] <om-atlas filter="${t}"> did not compile: ${
|
|
2702
|
+
const n = e.compileExpression(t, { shape: "geojson", paramName: "d" });
|
|
2703
|
+
return (i) => !!n.fn(i);
|
|
2704
|
+
} catch (n) {
|
|
2705
|
+
console.warn(`[onlymapjs/cartograph] <om-atlas filter="${t}"> did not compile: ${n.message}`);
|
|
2580
2706
|
return;
|
|
2581
2707
|
}
|
|
2582
2708
|
}
|
|
@@ -2592,14 +2718,14 @@ class er extends I {
|
|
|
2592
2718
|
const t = this.current;
|
|
2593
2719
|
if (!t) return;
|
|
2594
2720
|
const e = this.closest("om-cartograph");
|
|
2595
|
-
for (const
|
|
2596
|
-
if (
|
|
2597
|
-
const i =
|
|
2721
|
+
for (const n of e?.querySelectorAll("om-frame") ?? []) {
|
|
2722
|
+
if (n.getAttribute("atlas-fit") !== "feature") continue;
|
|
2723
|
+
const i = zn(t);
|
|
2598
2724
|
if (!i) continue;
|
|
2599
|
-
const o = Number(
|
|
2600
|
-
|
|
2725
|
+
const o = Number(n.getAttribute("atlas-margin")), s = Gn(i, Number.isFinite(o) && o > 0 ? o : 0.15);
|
|
2726
|
+
n.fitBounds?.(s);
|
|
2601
2727
|
}
|
|
2602
|
-
e?.setAtlasFields({ ...
|
|
2728
|
+
e?.setAtlasFields({ ...Ut(t), index: String(this.currentIndex + 1), count: String(this.count) }), e?.refreshFurniture(), this.dispatchEvent(
|
|
2603
2729
|
new CustomEvent("om-atlas-page", {
|
|
2604
2730
|
bubbles: !0,
|
|
2605
2731
|
detail: { index: this.currentIndex, count: this.count, name: this.pageName(this.currentIndex), feature: t }
|
|
@@ -2610,72 +2736,86 @@ class er extends I {
|
|
|
2610
2736
|
this.style.display = "none", this.refresh();
|
|
2611
2737
|
}
|
|
2612
2738
|
}
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2739
|
+
k("om-atlas", sr);
|
|
2740
|
+
class Yn extends Oe {
|
|
2741
|
+
static observedAttributes = [...T["om-source"]];
|
|
2742
|
+
connectedCallback() {
|
|
2743
|
+
this.style.display = "none";
|
|
2744
|
+
}
|
|
2745
|
+
/**
|
|
2746
|
+
* An edit re-resolves the OWNING frame: which source wins is a property of
|
|
2747
|
+
* the list, so the decision cannot be made here. `om-frame` observes its
|
|
2748
|
+
* own subtree for this.
|
|
2749
|
+
*/
|
|
2750
|
+
attributeChangedCallback() {
|
|
2751
|
+
this.closest("om-frame")?.scheduleRender?.();
|
|
2752
|
+
}
|
|
2618
2753
|
}
|
|
2619
|
-
|
|
2620
|
-
|
|
2754
|
+
const Xn = /* @__PURE__ */ new Set(["class", "style", "id", "hidden", "title", "lang", "dir", "slot", "part", "role", "tabindex"]), Jn = /* @__PURE__ */ new Set(["style", "script", "img", "template", "om-map"]), Zn = ["data-om-carto-credit", "data-om-carto-marks", "data-om-carto-flattened"], Qn = /* @__PURE__ */ new Set(["om-text", "om-legend", "om-scalebar", "om-north", "om-shape", "om-image"]), ti = /* @__PURE__ */ new Set(["om-frame", "om-legend", "om-scalebar", "om-north", "om-graticule", "om-text", "om-shape", "om-image"]), ei = 0.02, ri = (r) => Math.max(0, Number(r.getAttribute("bleed")) || 0);
|
|
2755
|
+
function or(r) {
|
|
2756
|
+
const t = r.tagName.toLowerCase();
|
|
2757
|
+
return r.id ? `${t}#${r.id}` : t;
|
|
2758
|
+
}
|
|
2759
|
+
function V(r, t) {
|
|
2760
|
+
const e = r.getAttribute(t);
|
|
2621
2761
|
if (e == null || e.trim() === "") return null;
|
|
2622
|
-
const
|
|
2623
|
-
return Number.isFinite(
|
|
2762
|
+
const n = Number(e);
|
|
2763
|
+
return Number.isFinite(n) ? n : null;
|
|
2624
2764
|
}
|
|
2625
|
-
function
|
|
2626
|
-
return
|
|
2765
|
+
function ni(r, t) {
|
|
2766
|
+
return r.x < t.x + t.w && t.x < r.x + r.w && r.y < t.y + t.h && t.y < r.y + r.h;
|
|
2627
2767
|
}
|
|
2628
|
-
function
|
|
2629
|
-
const e =
|
|
2768
|
+
function ii(r, t) {
|
|
2769
|
+
const e = r.getAttribute("style");
|
|
2630
2770
|
if (!e) return null;
|
|
2631
|
-
const
|
|
2632
|
-
return
|
|
2771
|
+
const n = new RegExp(`(?:^|;)\\s*${t}\\s*:\\s*(-?[\\d.]+)mm`, "i").exec(e);
|
|
2772
|
+
return n ? Number(n[1]) : null;
|
|
2633
2773
|
}
|
|
2634
|
-
function
|
|
2774
|
+
function ar(r) {
|
|
2635
2775
|
const t = [], e = (s, a, l, c, u) => {
|
|
2636
|
-
t.push({ severity: s, element:
|
|
2637
|
-
},
|
|
2638
|
-
if (
|
|
2776
|
+
t.push({ severity: s, element: or(a), ...u ? { attribute: u } : {}, message: l, fix: c });
|
|
2777
|
+
}, n = [...r.querySelectorAll("om-cartograph")];
|
|
2778
|
+
if (n.length === 0 && r.tagName?.toLowerCase() === "om-cartograph" && n.push(r), n.length === 0)
|
|
2639
2779
|
return { valid: !0, errors: [], warnings: [] };
|
|
2640
|
-
for (const s of
|
|
2780
|
+
for (const s of n) si(s, e);
|
|
2641
2781
|
const i = t.filter((s) => s.severity === "error"), o = t.filter((s) => s.severity === "warning");
|
|
2642
2782
|
return { valid: i.length === 0, errors: i, warnings: o };
|
|
2643
2783
|
}
|
|
2644
|
-
function
|
|
2645
|
-
const e =
|
|
2646
|
-
e && !
|
|
2784
|
+
function si(r, t) {
|
|
2785
|
+
const e = r.getAttribute("size"), n = V(r, "width") != null && V(r, "height") != null;
|
|
2786
|
+
e && !te.includes(e) && !n && t(
|
|
2647
2787
|
"error",
|
|
2648
|
-
|
|
2788
|
+
r,
|
|
2649
2789
|
`Unknown page size "${e}" and no width/height to fall back on.`,
|
|
2650
|
-
`Use one of ${
|
|
2790
|
+
`Use one of ${te.join(", ")}, or give width= and height= in millimetres.`,
|
|
2651
2791
|
"size"
|
|
2652
2792
|
);
|
|
2653
|
-
const i =
|
|
2654
|
-
i && i.trim().toLowerCase() !== "none" && !
|
|
2655
|
-
const o = V(
|
|
2793
|
+
const i = r.getAttribute("cvd");
|
|
2794
|
+
i && i.trim().toLowerCase() !== "none" && !Dt(i) && t("warning", r, `Unknown cvd="${i}" — no simulation applied.`, `Use one of ${fr.join(", ")}.`, "cvd"), r.hasAttribute("crop-marks") && ri(r) <= 0 && t("warning", r, "crop-marks needs bleed to draw into — trim marks sit outside the page box.", 'Add bleed="3" (mm), or drop crop-marks.', "crop-marks");
|
|
2795
|
+
const o = V(r, "safe-zone");
|
|
2656
2796
|
if (o != null && o > 0) {
|
|
2657
|
-
const m =
|
|
2658
|
-
o * 2 >= Math.min(m.widthMm, m.heightMm) && t("warning",
|
|
2797
|
+
const m = ht(r.getAttribute("size"), r.getAttribute("width"), r.getAttribute("height"), r.getAttribute("orientation"));
|
|
2798
|
+
o * 2 >= Math.min(m.widthMm, m.heightMm) && t("warning", r, `safe-zone=${o}mm leaves no usable area on a ${m.widthMm} × ${m.heightMm} mm page.`, "Use a smaller inset — 5–10mm is typical.", "safe-zone");
|
|
2659
2799
|
}
|
|
2660
|
-
const s =
|
|
2661
|
-
s == null ? t("warning",
|
|
2662
|
-
const { widthMm: a, heightMm: l } =
|
|
2800
|
+
const s = r.getAttribute("format");
|
|
2801
|
+
s == null ? t("warning", r, "No format= on the cartograph root.", `Add format="${gt}" so future runtimes can migrate this document.`, "format") : s !== gt && t("warning", r, `Unrecognised document format "${s}".`, `This build understands "${gt}".`, "format");
|
|
2802
|
+
const { widthMm: a, heightMm: l } = ht(e, r.getAttribute("width"), r.getAttribute("height"), r.getAttribute("orientation")), c = Math.max(0, V(r, "bleed") ?? 0), u = /* @__PURE__ */ new Set(), h = [...r.querySelectorAll("om-frame")];
|
|
2663
2803
|
for (const m of h)
|
|
2664
2804
|
m.id ? u.add(m.id) : t("error", m, "Frame has no id.", "Give every frame an id so furniture can reference it with for=.", "id");
|
|
2665
|
-
for (const m of
|
|
2666
|
-
if (
|
|
2805
|
+
for (const m of r.children) {
|
|
2806
|
+
if (Zn.some((g) => m.hasAttribute(g))) continue;
|
|
2667
2807
|
const f = m.tagName.toLowerCase();
|
|
2668
|
-
!pt.includes(f) && !
|
|
2808
|
+
!pt.includes(f) && !Jn.has(f) && t("error", m, `<${f}> is not a cartograph element.`, `Use one of ${pt.join(", ")}, or move this content inside an <om-text>.`);
|
|
2669
2809
|
}
|
|
2670
2810
|
const d = [];
|
|
2671
|
-
for (const m of [
|
|
2811
|
+
for (const m of [r, ...r.querySelectorAll("*")]) {
|
|
2672
2812
|
const f = m.tagName.toLowerCase();
|
|
2673
2813
|
if (pt.includes(f) && !m.closest("om-map")) {
|
|
2674
|
-
if (
|
|
2814
|
+
if (oi(m, f, t), ti.has(f)) {
|
|
2675
2815
|
const g = C(m);
|
|
2676
|
-
|
|
2816
|
+
ai(m, g, a, l, c, t), Qn.has(f) && !m.hasAttribute("hidden") && d.push({ el: m, box: g });
|
|
2677
2817
|
}
|
|
2678
|
-
f === "om-frame" &&
|
|
2818
|
+
f === "om-frame" && li(m, t), f === "om-source" && ci(m, t), f === "om-legend" && ui(m, h, t), f === "om-atlas" && hi(m, h, t), f === "om-scalebar" && mi(m, h, t), f === "om-text" && di(m, h, t);
|
|
2679
2819
|
for (const g of ["for", "overview-of"]) {
|
|
2680
2820
|
const p = m.getAttribute(g);
|
|
2681
2821
|
p && !u.has(p) && t("error", m, `${g}="${p}" references no frame on this page.`, `Point it at one of: ${[...u].join(", ") || "(no frames)"}.`, g);
|
|
@@ -2685,37 +2825,37 @@ function Jn(n, t) {
|
|
|
2685
2825
|
for (let m = 0; m < d.length; m++)
|
|
2686
2826
|
for (let f = m + 1; f < d.length; f++) {
|
|
2687
2827
|
const g = d[m], p = d[f];
|
|
2688
|
-
g.box.w <= 0 || g.box.h <= 0 || p.box.w <= 0 || p.box.h <= 0 ||
|
|
2828
|
+
g.box.w <= 0 || g.box.h <= 0 || p.box.w <= 0 || p.box.h <= 0 || ni(g.box, p.box) && t(
|
|
2689
2829
|
"warning",
|
|
2690
2830
|
g.el,
|
|
2691
|
-
`Overlaps ${
|
|
2831
|
+
`Overlaps ${or(p.el)} on the page.`,
|
|
2692
2832
|
"Move one of them — furniture overlapping furniture usually means a stale layout (frames may sit under anything)."
|
|
2693
2833
|
);
|
|
2694
2834
|
}
|
|
2695
2835
|
}
|
|
2696
|
-
function
|
|
2697
|
-
const
|
|
2698
|
-
for (const i of
|
|
2836
|
+
function oi(r, t, e) {
|
|
2837
|
+
const n = new Set(T[t] ?? []);
|
|
2838
|
+
for (const i of r.attributes) {
|
|
2699
2839
|
const o = i.name.toLowerCase();
|
|
2700
|
-
if (
|
|
2701
|
-
const s =
|
|
2840
|
+
if (n.has(o) || Xn.has(o) || o.startsWith("data-") || o.startsWith("aria-")) continue;
|
|
2841
|
+
const s = xr.get(o);
|
|
2702
2842
|
if (s) {
|
|
2703
|
-
e("warning",
|
|
2843
|
+
e("warning", r, `Attribute "${o}" has no effect: ${s}`, "Remove it, or use the documented alternative.", o);
|
|
2704
2844
|
continue;
|
|
2705
2845
|
}
|
|
2706
|
-
e("warning",
|
|
2846
|
+
e("warning", r, `Unknown attribute "${o}" on <${t}> — likely a typo.`, `Valid attributes: ${[...n].join(", ")}.`, o);
|
|
2707
2847
|
}
|
|
2708
2848
|
}
|
|
2709
|
-
function
|
|
2849
|
+
function ai(r, t, e, n, i, o) {
|
|
2710
2850
|
if (t.w <= 0 || t.h <= 0) {
|
|
2711
|
-
o("error",
|
|
2851
|
+
o("error", r, `Element has no size (w=${t.w}, h=${t.h}).`, "Give w= and h= in millimetres — both greater than zero.", t.w <= 0 ? "w" : "h");
|
|
2712
2852
|
return;
|
|
2713
2853
|
}
|
|
2714
|
-
const s = -i, a = e + i, l =
|
|
2854
|
+
const s = -i, a = e + i, l = n + i;
|
|
2715
2855
|
(t.x < s || t.y < s || t.x + t.w > a + 1e-6 || t.y + t.h > l + 1e-6) && o(
|
|
2716
2856
|
"error",
|
|
2717
|
-
|
|
2718
|
-
`Element box (${t.x}, ${t.y}, ${t.w} × ${t.h} mm) falls outside the ${e} × ${
|
|
2857
|
+
r,
|
|
2858
|
+
`Element box (${t.x}, ${t.y}, ${t.w} × ${t.h} mm) falls outside the ${e} × ${n} mm page${i ? ` (+${i}mm bleed)` : ""}.`,
|
|
2719
2859
|
"Move or resize it so the whole box sits on the sheet."
|
|
2720
2860
|
);
|
|
2721
2861
|
const c = [
|
|
@@ -2725,102 +2865,160 @@ function Qn(n, t, e, r, i, o) {
|
|
|
2725
2865
|
["height", t.h]
|
|
2726
2866
|
];
|
|
2727
2867
|
for (const [u, h] of c) {
|
|
2728
|
-
const d =
|
|
2868
|
+
const d = ii(r, u);
|
|
2729
2869
|
d != null && Math.abs(d - h) > 0.01 && o(
|
|
2730
2870
|
"error",
|
|
2731
|
-
|
|
2871
|
+
r,
|
|
2732
2872
|
`Inline style ${u}:${d}mm disagrees with the placement attribute (${h}mm).`,
|
|
2733
2873
|
"The attributes are authoritative — make the inline style match, or drop it and let the runtime write it.",
|
|
2734
2874
|
"style"
|
|
2735
2875
|
);
|
|
2736
2876
|
}
|
|
2737
2877
|
}
|
|
2738
|
-
function
|
|
2739
|
-
if ((
|
|
2740
|
-
const
|
|
2878
|
+
function li(r, t) {
|
|
2879
|
+
if ((r.getAttribute("mode") === "static" ? "static" : "live") === "static") {
|
|
2880
|
+
const n = r.getAttribute("corners"), i = H(n);
|
|
2741
2881
|
i || t(
|
|
2742
2882
|
"error",
|
|
2743
|
-
|
|
2744
|
-
|
|
2883
|
+
r,
|
|
2884
|
+
n == null ? "Static frame has no corners=." : `Static frame has malformed corners= ("${n}").`,
|
|
2745
2885
|
'Give four lon/lat pairs in tl, tr, br, bl order — corners="[[lng,lat],[lng,lat],[lng,lat],[lng,lat]]".',
|
|
2746
2886
|
"corners"
|
|
2747
|
-
), !
|
|
2887
|
+
), !r.querySelector(":scope > img") && !r.querySelector(`:scope > svg[${Et}]`) && t(
|
|
2748
2888
|
"error",
|
|
2749
|
-
|
|
2889
|
+
r,
|
|
2750
2890
|
"Static frame has no <img> or inline <svg> child to place.",
|
|
2751
2891
|
'Add the georeferenced picture as a child — an <img> raster, or the inline <svg> that snapshot({format: "svg"}) produces.'
|
|
2752
2892
|
);
|
|
2753
|
-
const o = C(
|
|
2893
|
+
const o = C(r), s = K(r.getAttribute("crs"));
|
|
2754
2894
|
if (i && s && o.w > 0 && o.h > 0) {
|
|
2755
|
-
const a =
|
|
2895
|
+
const a = Q({ corners: i, widthMm: o.w, heightMm: o.h, crsForward: s });
|
|
2756
2896
|
if (a.degenerate)
|
|
2757
|
-
t("error",
|
|
2897
|
+
t("error", r, "Frame corners are degenerate (collinear or coincident) — nothing can be placed on this frame.", "Check the corner order: tl, tr, br, bl.", "corners");
|
|
2758
2898
|
else {
|
|
2759
|
-
const l =
|
|
2760
|
-
l != null && l >
|
|
2899
|
+
const l = un(a);
|
|
2900
|
+
l != null && l > ei && t(
|
|
2761
2901
|
"warning",
|
|
2762
|
-
|
|
2902
|
+
r,
|
|
2763
2903
|
`Ground scale varies ${(l * 100).toFixed(1)}% across this frame, so a single scale bar is only true near its anchor.`,
|
|
2764
2904
|
"Shrink the frame's latitude span, or drop the scale bar in favour of a stated representative fraction."
|
|
2765
2905
|
);
|
|
2766
2906
|
}
|
|
2767
2907
|
}
|
|
2768
2908
|
} else {
|
|
2769
|
-
|
|
2909
|
+
ut(r) || t(
|
|
2770
2910
|
"error",
|
|
2771
|
-
|
|
2911
|
+
r,
|
|
2772
2912
|
"Live frame has no valid camera.",
|
|
2773
2913
|
'Give it center="[lng,lat]" and an explicit numeric zoom= (zoom 0 is valid).',
|
|
2774
|
-
|
|
2775
|
-
), !
|
|
2776
|
-
|
|
2777
|
-
|
|
2914
|
+
r.hasAttribute("center") ? "zoom" : "center"
|
|
2915
|
+
), !r.getAttribute("src") && !r.querySelector(":scope > om-map, :scope > om-source[src]") && t(
|
|
2916
|
+
"error",
|
|
2917
|
+
r,
|
|
2918
|
+
"Live frame has no map source.",
|
|
2919
|
+
"Give it src=, add an <om-source src=> child, or add an inline <om-map> child.",
|
|
2920
|
+
"src"
|
|
2921
|
+
);
|
|
2922
|
+
for (const n of ["crs", "corners"])
|
|
2923
|
+
r.hasAttribute(n) && t(
|
|
2778
2924
|
"warning",
|
|
2779
|
-
|
|
2780
|
-
`${
|
|
2781
|
-
|
|
2782
|
-
|
|
2925
|
+
r,
|
|
2926
|
+
`${n}= is ignored on a live frame — a live frame takes its projection from the <om-map> it mounts and its corners from that map's camera.`,
|
|
2927
|
+
n === "crs" ? `Put crs= on the frame's <om-map> instead, on an <om-source> if it describes a capture, or set mode="static" for a georeferenced picture placed by corners.` : 'Remove it, put it on the <om-source> whose capture it describes, or set mode="static" if this frame is a georeferenced picture.',
|
|
2928
|
+
n
|
|
2783
2929
|
);
|
|
2784
2930
|
}
|
|
2785
2931
|
}
|
|
2786
|
-
function
|
|
2787
|
-
const e =
|
|
2788
|
-
|
|
2932
|
+
function ci(r, t) {
|
|
2933
|
+
const e = r.parentElement;
|
|
2934
|
+
if (e?.tagName.toLowerCase() !== "om-frame") {
|
|
2935
|
+
t(
|
|
2936
|
+
"error",
|
|
2937
|
+
r,
|
|
2938
|
+
"<om-source> is only meaningful as a direct child of <om-frame>.",
|
|
2939
|
+
"Move it inside the frame whose picture it describes."
|
|
2940
|
+
);
|
|
2941
|
+
return;
|
|
2942
|
+
}
|
|
2943
|
+
const n = r.getAttribute("src")?.trim();
|
|
2944
|
+
if (!n) {
|
|
2945
|
+
t("error", r, "<om-source> has no src=.", "Give it a map document (.html) or a capture image.", "src");
|
|
2946
|
+
return;
|
|
2947
|
+
}
|
|
2948
|
+
const i = It(n);
|
|
2949
|
+
if (!i) {
|
|
2950
|
+
t(
|
|
2951
|
+
"error",
|
|
2952
|
+
r,
|
|
2953
|
+
`<om-source src="${n}"> has an extension this does not recognise, so its kind is unknown.`,
|
|
2954
|
+
"Use a map document (.html, .htm) or a capture image (.png, .jpg, .jpeg, .webp, .avif, .gif, .svg).",
|
|
2955
|
+
"src"
|
|
2956
|
+
);
|
|
2957
|
+
return;
|
|
2958
|
+
}
|
|
2959
|
+
if (i === "raster") {
|
|
2960
|
+
const o = r.getAttribute("corners");
|
|
2961
|
+
H(o) || t(
|
|
2962
|
+
"error",
|
|
2963
|
+
r,
|
|
2964
|
+
o == null ? "A capture <om-source> has no corners=, so nothing on the sheet could be placed against it." : `A capture <om-source> has malformed corners= ("${o}").`,
|
|
2965
|
+
'Give four lon/lat pairs in tl, tr, br, bl order — corners="[[lng,lat],[lng,lat],[lng,lat],[lng,lat]]". These are the coordinates that were true when the capture was taken.',
|
|
2966
|
+
"corners"
|
|
2967
|
+
);
|
|
2968
|
+
} else
|
|
2969
|
+
for (const o of ["corners", "crs", "crs-def"])
|
|
2970
|
+
r.hasAttribute(o) && t(
|
|
2971
|
+
"warning",
|
|
2972
|
+
r,
|
|
2973
|
+
`${o}= is ignored on a map-document <om-source> — a map carries its own projection and its corners come from the frame's camera.`,
|
|
2974
|
+
"Remove it. It belongs on a capture <om-source>, whose georeference is otherwise unknowable.",
|
|
2975
|
+
o
|
|
2976
|
+
);
|
|
2977
|
+
e.getAttribute("mode") === "static" && t(
|
|
2978
|
+
"warning",
|
|
2979
|
+
r,
|
|
2980
|
+
'<om-source> is ignored on a frame with mode="static" — a static frame draws its own <img> or inline <svg> child.',
|
|
2981
|
+
'Remove mode="static" to let the frame resolve its sources, or drop the <om-source>.'
|
|
2982
|
+
);
|
|
2983
|
+
}
|
|
2984
|
+
function Wt(r, t) {
|
|
2985
|
+
const e = r.getAttribute("for");
|
|
2986
|
+
return e ? t.find((n) => n.id === e) : t.length === 1 ? t[0] : void 0;
|
|
2789
2987
|
}
|
|
2790
|
-
function
|
|
2791
|
-
const
|
|
2792
|
-
|
|
2988
|
+
function ui(r, t, e) {
|
|
2989
|
+
const n = r.getAttribute("derived") !== "false", i = Wt(r, t);
|
|
2990
|
+
n && i?.getAttribute("mode") === "static" && e(
|
|
2793
2991
|
"warning",
|
|
2794
|
-
|
|
2992
|
+
r,
|
|
2795
2993
|
"This legend derives from a static frame, which has no layers to derive from.",
|
|
2796
2994
|
'Write the rows as <om-legend-row color= label= shape=> children and set derived="false".',
|
|
2797
2995
|
"derived"
|
|
2798
2996
|
);
|
|
2799
|
-
const o =
|
|
2997
|
+
const o = rr(r);
|
|
2800
2998
|
if (o.length < 2) return;
|
|
2801
|
-
const s =
|
|
2999
|
+
const s = br(o.map((a) => ({ label: a.label, color: a.color, layer: a.layerId })));
|
|
2802
3000
|
if (s.collapses.length > 0 && s.worstType) {
|
|
2803
3001
|
const a = s.collapses.filter((c) => c.type === s.worstType), l = a.slice(0, 3).map((c) => `"${c.a.label}"/"${c.b.label}"`).join(", ");
|
|
2804
3002
|
e(
|
|
2805
3003
|
"warning",
|
|
2806
|
-
|
|
3004
|
+
r,
|
|
2807
3005
|
`Under ${s.worstType}, ${a.length === 1 ? "one legend pair becomes" : `${a.length} legend pairs become`} indistinguishable: ${l}.`,
|
|
2808
3006
|
"Pick colours that differ in lightness as well as hue, or add a pattern or label to separate them."
|
|
2809
3007
|
);
|
|
2810
3008
|
}
|
|
2811
3009
|
}
|
|
2812
|
-
function
|
|
2813
|
-
const
|
|
2814
|
-
|
|
2815
|
-
const i =
|
|
3010
|
+
function hi(r, t, e) {
|
|
3011
|
+
const n = r.getAttribute("layer");
|
|
3012
|
+
n || e("error", r, "Atlas has no layer= to iterate.", 'Name a layer inside the frame, e.g. layer="parcels".', "layer");
|
|
3013
|
+
const i = r.getAttribute("for"), o = Wt(r, t);
|
|
2816
3014
|
if (!o) {
|
|
2817
|
-
!i && t.length !== 1 && e("error",
|
|
3015
|
+
!i && t.length !== 1 && e("error", r, `Atlas does not say which frame drives it, and the page has ${t.length} frames.`, 'Add for="<frame id>".', "for");
|
|
2818
3016
|
return;
|
|
2819
3017
|
}
|
|
2820
3018
|
if (o.getAttribute("mode") === "static") {
|
|
2821
3019
|
e(
|
|
2822
3020
|
"error",
|
|
2823
|
-
|
|
3021
|
+
r,
|
|
2824
3022
|
"An atlas cannot iterate a static frame — a raster has no features.",
|
|
2825
3023
|
"Point the atlas at a live frame whose map carries the layer.",
|
|
2826
3024
|
"for"
|
|
@@ -2828,71 +3026,71 @@ function ri(n, t, e) {
|
|
|
2828
3026
|
return;
|
|
2829
3027
|
}
|
|
2830
3028
|
const s = o.querySelector(":scope > om-map");
|
|
2831
|
-
if (s &&
|
|
2832
|
-
const a = [...s.querySelectorAll("om-layer")].find((c) => c.id ===
|
|
3029
|
+
if (s && n) {
|
|
3030
|
+
const a = [...s.querySelectorAll("om-layer")].find((c) => c.id === n);
|
|
2833
3031
|
if (!a) {
|
|
2834
|
-
e("error",
|
|
3032
|
+
e("error", r, `Atlas layer "${n}" is not in frame #${o.id}'s map.`, "Check the layer id, or point the atlas at the frame that has it.", "layer");
|
|
2835
3033
|
return;
|
|
2836
3034
|
}
|
|
2837
3035
|
const l = a.getAttribute("data") ?? "";
|
|
2838
3036
|
/\{z\}|\{x\}|\{y\}/.test(l) && e(
|
|
2839
3037
|
"error",
|
|
2840
|
-
|
|
2841
|
-
`Atlas layer "${
|
|
3038
|
+
r,
|
|
3039
|
+
`Atlas layer "${n}" is tiled, so its features live on a server rather than in this document.`,
|
|
2842
3040
|
"Iterate a layer whose data is loaded locally (GeoJSON, CSV, inline JSON).",
|
|
2843
3041
|
"layer"
|
|
2844
3042
|
);
|
|
2845
3043
|
}
|
|
2846
3044
|
}
|
|
2847
|
-
function
|
|
2848
|
-
const
|
|
2849
|
-
if (
|
|
2850
|
-
const i =
|
|
3045
|
+
function mi(r, t, e) {
|
|
3046
|
+
const n = V(r, "segment-length");
|
|
3047
|
+
if (n == null) return;
|
|
3048
|
+
const i = Wt(r, t);
|
|
2851
3049
|
if (!i) return;
|
|
2852
|
-
const o =
|
|
3050
|
+
const o = H(i.getAttribute("corners")), s = K(i.getAttribute("crs")), a = C(i);
|
|
2853
3051
|
if (!o || !s || a.w <= 0 || a.h <= 0) return;
|
|
2854
|
-
const l =
|
|
3052
|
+
const l = Q({ corners: o, widthMm: a.w, heightMm: a.h, crsForward: s }), c = C(r), u = De({
|
|
2855
3053
|
groundMetersPerMm: l.groundMetersPerMm(),
|
|
2856
3054
|
maxWidthMm: c.w,
|
|
2857
|
-
segments: V(
|
|
2858
|
-
segmentLengthMeters:
|
|
3055
|
+
segments: V(r, "segments") ?? void 0,
|
|
3056
|
+
segmentLengthMeters: n
|
|
2859
3057
|
});
|
|
2860
3058
|
u && u.totalMm > c.w + 1e-6 && e(
|
|
2861
3059
|
"warning",
|
|
2862
|
-
|
|
2863
|
-
`segment-length=${
|
|
3060
|
+
r,
|
|
3061
|
+
`segment-length=${n}m makes the bar ${u.totalMm.toFixed(1)}mm wide, wider than its ${c.w}mm box.`,
|
|
2864
3062
|
"Widen the bar's box, use fewer segments, or drop segment-length and let it snap to a 1-2-5 length that fits.",
|
|
2865
3063
|
"segment-length"
|
|
2866
3064
|
);
|
|
2867
3065
|
}
|
|
2868
|
-
function
|
|
2869
|
-
const
|
|
2870
|
-
for (const s of
|
|
3066
|
+
function di(r, t, e) {
|
|
3067
|
+
const n = r.textContent ?? "", i = /* @__PURE__ */ new Set(["title", "attribution", "date", "notes", "scale", "crs"]), o = new Set(t.map((s) => s.id).filter(Boolean));
|
|
3068
|
+
for (const s of Or(n))
|
|
2871
3069
|
if (!s.startsWith("atlas.")) {
|
|
2872
3070
|
if (s.startsWith("frame.")) {
|
|
2873
3071
|
const a = s.slice(6), l = a.lastIndexOf("."), c = l > 0 ? a.slice(0, l) : "", u = l > 0 ? a.slice(l + 1) : "";
|
|
2874
|
-
o.has(c) ? u !== "scale" && u !== "crs" && e("warning",
|
|
3072
|
+
o.has(c) ? u !== "scale" && u !== "crs" && e("warning", r, `{{${s}}} — frames provide scale and crs.`, `Use {{frame.${c}.scale}} or {{frame.${c}.crs}}.`) : e("warning", r, `{{${s}}} references no frame with id "${c}".`, `Frames on this page: ${[...o].join(", ") || "(none)"}.`);
|
|
2875
3073
|
continue;
|
|
2876
3074
|
}
|
|
2877
3075
|
if ((s === "scale" || s === "crs") && t.length !== 1) {
|
|
2878
3076
|
e(
|
|
2879
3077
|
"warning",
|
|
2880
|
-
|
|
3078
|
+
r,
|
|
2881
3079
|
`{{${s}}} is ambiguous with ${t.length} frames on the page.`,
|
|
2882
3080
|
`Name the frame: {{frame.<id>.${s}}}.`
|
|
2883
3081
|
);
|
|
2884
3082
|
continue;
|
|
2885
3083
|
}
|
|
2886
|
-
i.has(s) || e("warning",
|
|
3084
|
+
i.has(s) || e("warning", r, `Unknown token {{${s}}} — it will render literally.`, `Known tokens: ${[...i].join(", ")}, frame.<id>.scale, frame.<id>.crs, atlas.<field>.`);
|
|
2887
3085
|
}
|
|
2888
3086
|
}
|
|
2889
|
-
function
|
|
2890
|
-
return
|
|
3087
|
+
function Ai(r) {
|
|
3088
|
+
return ar($r(r));
|
|
2891
3089
|
}
|
|
2892
|
-
async function
|
|
2893
|
-
const t =
|
|
3090
|
+
async function Si(r) {
|
|
3091
|
+
const t = ar(r), e = [...r.querySelectorAll("om-frame")].filter((a) => a.querySelector(":scope > om-map"));
|
|
2894
3092
|
if (e.length === 0) return t;
|
|
2895
|
-
const { loadCore:
|
|
3093
|
+
const { loadCore: n } = await Promise.resolve().then(() => ur), i = await n(), o = [...t.errors], s = [...t.warnings];
|
|
2896
3094
|
for (const a of e) {
|
|
2897
3095
|
const l = a.id ? `om-frame#${a.id}` : "om-frame", c = i.validateManifest(a);
|
|
2898
3096
|
for (const u of c.errors) o.push({ ...u, element: `${l} > ${u.element}` });
|
|
@@ -2900,113 +3098,113 @@ async function fi(n) {
|
|
|
2900
3098
|
}
|
|
2901
3099
|
return { valid: o.length === 0, errors: o, warnings: s };
|
|
2902
3100
|
}
|
|
2903
|
-
function
|
|
2904
|
-
|
|
3101
|
+
function Ci() {
|
|
3102
|
+
k("om-cartograph", Ve), k("om-text", Ke), k("om-frame", Je), k("om-scalebar", Ze), k("om-north", Qe), k("om-shape", tr), k("om-image", er), k("om-legend", nr), k("om-graticule", ir), k("om-atlas", sr), k("om-source", Yn);
|
|
2905
3103
|
}
|
|
2906
|
-
|
|
2907
|
-
|
|
3104
|
+
Ne(() => import("@nika-js/onlymap"));
|
|
3105
|
+
kr();
|
|
2908
3106
|
export {
|
|
2909
3107
|
T as CARTOGRAPH_ELEMENT_ATTRS,
|
|
2910
3108
|
gt as CARTOGRAPH_FORMAT,
|
|
2911
3109
|
pt as CARTOGRAPH_TAG_NAMES,
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
3110
|
+
fi as CARTOGRAPH_THEMES,
|
|
3111
|
+
pr as COLLAPSE_THRESHOLD,
|
|
3112
|
+
jt as CVD_MATRICES,
|
|
2915
3113
|
mt as CVD_TYPES,
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
|
|
3114
|
+
fr as CVD_VALUES,
|
|
3115
|
+
_t as GEOGRAPHIC_PLANE,
|
|
3116
|
+
xr as INERT_RESERVED_CARTOGRAPH_ATTRS,
|
|
3117
|
+
Fe as MAX_CANVAS_AREA,
|
|
3118
|
+
Re as MAX_CANVAS_DIMENSION,
|
|
3119
|
+
kt as MAX_CATEGORY_ENTRIES,
|
|
3120
|
+
sr as OmAtlasElement,
|
|
3121
|
+
Ve as OmCartographElement,
|
|
3122
|
+
Je as OmFrameElement,
|
|
3123
|
+
ir as OmGraticuleElement,
|
|
3124
|
+
er as OmImageElement,
|
|
3125
|
+
nr as OmLegendElement,
|
|
3126
|
+
Qe as OmNorthElement,
|
|
3127
|
+
Ze as OmScalebarElement,
|
|
3128
|
+
tr as OmShapeElement,
|
|
3129
|
+
Ke as OmTextElement,
|
|
3130
|
+
Vt as PAGE_PRESETS,
|
|
3131
|
+
te as PAGE_SIZE_NAMES,
|
|
3132
|
+
j as PLACED_ATTR_NAMES,
|
|
2935
3133
|
D as PX_PER_MM,
|
|
2936
|
-
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
3134
|
+
Fr as SCALE_GROUP_SEPARATOR,
|
|
3135
|
+
Sr as URL_ACTION_TIMEOUT_MS,
|
|
3136
|
+
Br as alignOffset,
|
|
3137
|
+
We as allFrames,
|
|
3138
|
+
yr as applyCvdToCanvas,
|
|
3139
|
+
Ur as applyTokens,
|
|
3140
|
+
Cr as applyUrlActions,
|
|
3141
|
+
Ut as atlasFields,
|
|
3142
|
+
Mi as boundsArea,
|
|
2945
3143
|
C as boxMm,
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
|
|
3144
|
+
Rn as buildGraticule,
|
|
3145
|
+
qn as buildPages,
|
|
3146
|
+
De as buildScalebar,
|
|
3147
|
+
Rr as buildScalebarDrawing,
|
|
2950
3148
|
K as builtinCrsForward,
|
|
2951
|
-
|
|
2952
|
-
|
|
2953
|
-
|
|
3149
|
+
gi as canvasMeasurer,
|
|
3150
|
+
zr as clearUnlinked,
|
|
3151
|
+
wi as cornersFromBounds,
|
|
2954
3152
|
Ft as cornersFromCamera,
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
3153
|
+
Q as createFrameGeoref,
|
|
3154
|
+
dr as createZip,
|
|
3155
|
+
Ci as defineCartographElements,
|
|
3156
|
+
Xt as deltaE00,
|
|
3157
|
+
Nn as deriveLegendRows,
|
|
3158
|
+
wr as ensureCvdFilters,
|
|
3159
|
+
zn as featureBounds,
|
|
3160
|
+
F as fieldOf,
|
|
3161
|
+
qe as findFrame,
|
|
3162
|
+
_n as formatDms,
|
|
3163
|
+
Ir as formatScaleDenominator,
|
|
3164
|
+
kr as installUrlActions,
|
|
3165
|
+
cr as isCoreLoaded,
|
|
3166
|
+
Dr as isoDate,
|
|
3167
|
+
Wr as layoutText,
|
|
3168
|
+
br as lintLegendColours,
|
|
3169
|
+
Pe as loadCore,
|
|
3170
|
+
vi as maxGeoreferenceablePitch,
|
|
3171
|
+
pi as mercatorForward,
|
|
3172
|
+
bi as mercatorInverse,
|
|
3173
|
+
Ce as niceInterval,
|
|
3174
|
+
Ue as niceNumberBelow,
|
|
3175
|
+
Lt as normalizeCrs,
|
|
3176
|
+
cn as northBearingDegrees,
|
|
3177
|
+
Ge as ownerCartograph,
|
|
3178
|
+
Gn as padBounds,
|
|
3179
|
+
Bt as paintEnvForDpi,
|
|
3180
|
+
gr as parseColor,
|
|
3181
|
+
H as parseCorners,
|
|
3182
|
+
Bn as parseSort,
|
|
3183
|
+
Y as peekCore,
|
|
3184
|
+
ut as readCamera,
|
|
3185
|
+
rr as readLiteralRows,
|
|
3186
|
+
Ln as readOverrides,
|
|
2989
3187
|
O as referencedFrame,
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
|
|
3188
|
+
jn as rejectionFor,
|
|
3189
|
+
zt as renderCartograph,
|
|
3190
|
+
Ie as renderCartographAtlas,
|
|
3191
|
+
Rt as resolveCrsForward,
|
|
3192
|
+
Dt as resolveCvdType,
|
|
3193
|
+
Hn as resolveFilenames,
|
|
3194
|
+
ht as resolvePageSize,
|
|
3195
|
+
_r as resolveToken,
|
|
3196
|
+
ze as resolveTokens,
|
|
3197
|
+
En as rowColorFor,
|
|
3198
|
+
mn as sanitizeAdoptedMap,
|
|
3199
|
+
Kn as sanitizeFilename,
|
|
3200
|
+
un as scaleVariation,
|
|
3201
|
+
Ne as setCoreLoader,
|
|
3202
|
+
Ht as simulate,
|
|
3203
|
+
xn as swatchShapeFor,
|
|
3204
|
+
Or as tokensIn,
|
|
3205
|
+
yi as utmDef,
|
|
3206
|
+
ar as validateCartograph,
|
|
3207
|
+
Si as validateCartographDeep,
|
|
3208
|
+
Ai as validateCartographString,
|
|
3209
|
+
Qt as whenPageReady
|
|
3012
3210
|
};
|