@nika-js/onlymap 0.8.2 → 0.8.4
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 +18 -0
- package/LICENSE.md +2 -0
- package/README.md +8 -0
- package/dist/{LercDecode.es-BSylOuVc.js → LercDecode.es-BKustV-1.js} +1 -1
- package/dist/{basemap-CMaYhtEE.js → basemap-B0SwrOqQ.js} +784 -780
- package/dist/basemap.d.ts +2 -0
- package/dist/cartograph/elements/om-cartograph.d.ts +6 -0
- package/dist/cartograph/elements/om-frame.d.ts +12 -9
- package/dist/cartograph/georef.d.ts +11 -1
- package/dist/cartograph/graticule.d.ts +1 -1
- package/dist/cartograph/live-frame.d.ts +17 -18
- package/dist/cartograph.js +758 -724
- package/dist/cartograph.standalone.js +1556 -1522
- package/dist/elements/om-map.d.ts +13 -0
- package/dist/{geoparquet-DZjsJtQQ.js → geoparquet-C5E6N6G0.js} +1 -1
- package/dist/{index-tSk19VJe.js → index-BLIjrGOE.js} +1 -1
- package/dist/{index-BQkmbcQr.js → index-BnQDfKfE.js} +1 -1
- package/dist/{index-DRFEoCuu.js → index-CaM1C93G.js} +1 -1
- package/dist/{index-Cw9SL11B.js → index-D5Fqn_eZ.js} +8921 -8870
- package/dist/{index-Dl0UKZF-.js → index-xUVMTGZG.js} +2 -2
- package/dist/index.d.ts +5 -3
- package/dist/{lerc-Dphd_hZG.js → lerc-TxsFLMlC.js} +2 -2
- package/dist/license.d.ts +46 -1
- package/dist/onlymap.standalone.js +15136 -15081
- package/dist/onlymapjs.js +78 -76
- package/dist/{raster-Bb9CjpGL.js → raster-B_wekCHv.js} +3 -3
- package/dist/{raster-pipeline-D_Hw3Wax.js → raster-pipeline-Dn2fkLYx.js} +1 -1
- package/dist/runtime-core.d.ts +11 -0
- package/dist/version.d.ts +1 -1
- package/dist/{zarr-DJA83o9G.js → zarr-Dan2ab-l.js} +2 -2
- package/docs/cartograph.md +8 -0
- package/llms.txt +2 -2
- package/onlymapjs.html-data.json +12 -0
- package/package.json +3 -3
- package/skills/onlymapjs/SKILL.md +1 -1
- package/skills/onlymapjs/references/syntax.md +4 -4
package/dist/cartograph.js
CHANGED
|
@@ -3,14 +3,14 @@ function ye(r) {
|
|
|
3
3
|
kt = r;
|
|
4
4
|
}
|
|
5
5
|
function Ze() {
|
|
6
|
-
return
|
|
6
|
+
return B !== null;
|
|
7
7
|
}
|
|
8
|
-
let
|
|
9
|
-
function
|
|
10
|
-
return
|
|
8
|
+
let B = null;
|
|
9
|
+
function H() {
|
|
10
|
+
return B;
|
|
11
11
|
}
|
|
12
12
|
function we() {
|
|
13
|
-
return
|
|
13
|
+
return B ? Promise.resolve(B) : Z || (kt ? (Z = Promise.resolve(kt()).then((r) => (B = r, B)).catch((r) => {
|
|
14
14
|
throw Z = null, r;
|
|
15
15
|
}), Z) : Promise.reject(
|
|
16
16
|
new Error(
|
|
@@ -18,33 +18,33 @@ function we() {
|
|
|
18
18
|
)
|
|
19
19
|
));
|
|
20
20
|
}
|
|
21
|
-
const
|
|
21
|
+
const Qe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
22
22
|
__proto__: null,
|
|
23
23
|
isCoreLoaded: Ze,
|
|
24
24
|
loadCore: we,
|
|
25
|
-
peekCore:
|
|
25
|
+
peekCore: H,
|
|
26
26
|
setCoreLoader: ye
|
|
27
27
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
28
|
-
function
|
|
28
|
+
function Ut(r) {
|
|
29
29
|
return { scale: r / 96, pxPerMm: r / 25.4 };
|
|
30
30
|
}
|
|
31
|
-
function
|
|
31
|
+
function gt(r) {
|
|
32
32
|
return typeof r?.paintCartograph == "function";
|
|
33
33
|
}
|
|
34
|
-
const
|
|
34
|
+
const q = (r, t) => {
|
|
35
35
|
const e = r.getAttribute(t);
|
|
36
36
|
if (e == null || e.trim() === "") return null;
|
|
37
37
|
const n = Number(e);
|
|
38
38
|
return Number.isFinite(n) ? n : null;
|
|
39
39
|
};
|
|
40
|
-
function
|
|
40
|
+
function C(r) {
|
|
41
41
|
return {
|
|
42
|
-
x:
|
|
43
|
-
y:
|
|
44
|
-
w:
|
|
45
|
-
h:
|
|
46
|
-
rotation:
|
|
47
|
-
z:
|
|
42
|
+
x: q(r, "x") ?? 0,
|
|
43
|
+
y: q(r, "y") ?? 0,
|
|
44
|
+
w: q(r, "w") ?? 0,
|
|
45
|
+
h: q(r, "h") ?? 0,
|
|
46
|
+
rotation: q(r, "rotation") ?? 0,
|
|
47
|
+
z: q(r, "z")
|
|
48
48
|
};
|
|
49
49
|
}
|
|
50
50
|
function $t(r, t = 0) {
|
|
@@ -52,12 +52,12 @@ function $t(r, t = 0) {
|
|
|
52
52
|
const e = Number.parseFloat(r);
|
|
53
53
|
return Number.isFinite(e) ? e : t;
|
|
54
54
|
}
|
|
55
|
-
function
|
|
55
|
+
function F(r) {
|
|
56
56
|
if (!r) return null;
|
|
57
57
|
const t = r.trim().toLowerCase();
|
|
58
58
|
return t === "transparent" || t === "rgba(0, 0, 0, 0)" || t === "none" ? null : r;
|
|
59
59
|
}
|
|
60
|
-
const
|
|
60
|
+
const W = 96 / 25.4, zt = {
|
|
61
61
|
A0: { widthMm: 841, heightMm: 1189 },
|
|
62
62
|
A1: { widthMm: 594, heightMm: 841 },
|
|
63
63
|
A2: { widthMm: 420, heightMm: 594 },
|
|
@@ -66,15 +66,15 @@ const z = 96 / 25.4, Ut = {
|
|
|
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
|
+
}, Dt = "A4";
|
|
70
|
+
function ut(r, t, e, n) {
|
|
71
71
|
const i = t != null ? Number(t) : NaN, s = e != null ? Number(e) : NaN;
|
|
72
72
|
if (Number.isFinite(i) && i > 0 && Number.isFinite(s) && s > 0) return { widthMm: i, heightMm: s };
|
|
73
|
-
const o =
|
|
73
|
+
const o = zt[r ?? Dt] ?? zt[Dt];
|
|
74
74
|
return n === "landscape" ? { widthMm: o.heightMm, heightMm: o.widthMm } : { ...o };
|
|
75
75
|
}
|
|
76
76
|
let et = null;
|
|
77
|
-
function
|
|
77
|
+
function tr(r) {
|
|
78
78
|
if (!et) {
|
|
79
79
|
et = new Uint32Array(256);
|
|
80
80
|
for (let e = 0; e < 256; e++) {
|
|
@@ -87,51 +87,51 @@ function Qe(r) {
|
|
|
87
87
|
for (let e = 0; e < r.length; e++) t = et[(t ^ r[e]) & 255] ^ t >>> 8;
|
|
88
88
|
return (t ^ 4294967295) >>> 0;
|
|
89
89
|
}
|
|
90
|
-
function
|
|
90
|
+
function er(r) {
|
|
91
91
|
const t = Math.max(1980, r.getFullYear());
|
|
92
92
|
return {
|
|
93
93
|
time: r.getHours() << 11 | r.getMinutes() << 5 | Math.floor(r.getSeconds() / 2),
|
|
94
94
|
date: t - 1980 << 9 | r.getMonth() + 1 << 5 | r.getDate()
|
|
95
95
|
};
|
|
96
96
|
}
|
|
97
|
-
async function
|
|
98
|
-
const e = new TextEncoder(), { time: n, date: i } =
|
|
97
|
+
async function rr(r, t = /* @__PURE__ */ new Date()) {
|
|
98
|
+
const e = new TextEncoder(), { time: n, date: i } = er(t), s = [], o = [];
|
|
99
99
|
let a = 0;
|
|
100
100
|
for (const u of r) {
|
|
101
|
-
const
|
|
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,
|
|
101
|
+
const h = u.data instanceof Blob ? new Uint8Array(await u.data.arrayBuffer()) : u.data, d = e.encode(u.name), m = tr(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), s.push(new Uint8Array(f.buffer), d, h), o.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 o) {
|
|
106
|
-
const
|
|
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,
|
|
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, 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), s.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, o.length, !0), c.setUint16(10, o.length, !0), c.setUint32(12, a - l, !0), c.setUint32(16, l, !0), c.setUint16(20, 0, !0), s.push(new Uint8Array(c.buffer)), new Blob(s, { type: "application/zip" });
|
|
111
111
|
}
|
|
112
|
-
const
|
|
112
|
+
const ft = ["protanopia", "deuteranopia", "tritanopia", "achromatopsia"], ve = {
|
|
113
113
|
protan: "protanopia",
|
|
114
114
|
deutan: "deuteranopia",
|
|
115
115
|
tritan: "tritanopia",
|
|
116
116
|
achroma: "achromatopsia"
|
|
117
117
|
};
|
|
118
|
-
function
|
|
118
|
+
function It(r) {
|
|
119
119
|
const t = r?.trim().toLowerCase();
|
|
120
|
-
return !t || t === "none" ? null :
|
|
120
|
+
return !t || t === "none" ? null : ft.includes(t) ? t : ve[t] ?? null;
|
|
121
121
|
}
|
|
122
|
-
const
|
|
122
|
+
const nr = ["none", ...ft, ...Object.keys(ve)], Rt = {
|
|
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
|
-
},
|
|
127
|
+
}, j = (r) => {
|
|
128
128
|
const t = r / 255;
|
|
129
129
|
return t <= 0.04045 ? t / 12.92 : ((t + 0.055) / 1.055) ** 2.4;
|
|
130
130
|
}, lt = (r) => {
|
|
131
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
|
|
134
|
+
function ir(r) {
|
|
135
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], s = (o) => parseInt(o.length === 1 ? o + o : o, 16);
|
|
@@ -141,47 +141,47 @@ function nr(r) {
|
|
|
141
141
|
return n ? { r: Number(n[1]), g: Number(n[2]), b: Number(n[3]) } : null;
|
|
142
142
|
}
|
|
143
143
|
function jt(r, t) {
|
|
144
|
-
const e =
|
|
144
|
+
const e = Rt[t], [n, i, s] = [j(r.r), j(r.g), j(r.b)];
|
|
145
145
|
return {
|
|
146
146
|
r: lt(e[0] * n + e[1] * i + e[2] * s),
|
|
147
147
|
g: lt(e[3] * n + e[4] * i + e[5] * s),
|
|
148
148
|
b: lt(e[6] * n + e[7] * i + e[8] * s)
|
|
149
149
|
};
|
|
150
150
|
}
|
|
151
|
-
function
|
|
152
|
-
const [n, i, s] = [
|
|
153
|
-
return [116 *
|
|
151
|
+
function Gt({ r, g: t, b: e }) {
|
|
152
|
+
const [n, i, s] = [j(r), j(t), j(e)], o = (n * 0.4124564 + i * 0.3575761 + s * 0.1804375) / 0.95047, a = n * 0.2126729 + i * 0.7151522 + s * 0.072175, l = (n * 0.0193339 + i * 0.119192 + s * 0.9503041) / 1.08883, c = (m) => m > 216 / 24389 ? Math.cbrt(m) : 841 / 108 * m + 4 / 29, [u, h, d] = [c(o), c(a), c(l)];
|
|
153
|
+
return [116 * h - 16, 500 * (u - h), 200 * (h - d)];
|
|
154
154
|
}
|
|
155
|
-
function
|
|
156
|
-
const [e, n, i] =
|
|
155
|
+
function qt(r, t) {
|
|
156
|
+
const [e, n, i] = Gt(r), [s, o, a] = Gt(t), l = Math.PI / 180, c = 180 / Math.PI, u = (Math.hypot(n, i) + Math.hypot(o, a)) / 2, h = 0.5 * (1 - Math.sqrt(u ** 7 / (u ** 7 + 25 ** 7))), [d, m] = [n * (1 + h), o * (1 + h)], [f, g] = [Math.hypot(d, i), Math.hypot(m, a)], p = (U, tt) => {
|
|
157
157
|
if (U === 0 && tt === 0) return 0;
|
|
158
|
-
const
|
|
159
|
-
return
|
|
160
|
-
}, [b, w] = [
|
|
158
|
+
const J = Math.atan2(tt, U) * c;
|
|
159
|
+
return J >= 0 ? J : J + 360;
|
|
160
|
+
}, [b, w] = [p(d, i), p(m, a)], y = s - e, M = g - f;
|
|
161
161
|
let v = 0;
|
|
162
|
-
f *
|
|
163
|
-
const
|
|
164
|
-
let
|
|
165
|
-
f *
|
|
166
|
-
const
|
|
167
|
-
return Math.sqrt((y /
|
|
168
|
-
}
|
|
169
|
-
const
|
|
170
|
-
function
|
|
162
|
+
f * g !== 0 && (v = w - b, v > 180 ? v -= 360 : v < -180 && (v += 360));
|
|
163
|
+
const N = 2 * Math.sqrt(f * g) * Math.sin(v * l / 2), O = (e + s) / 2, k = (f + g) / 2;
|
|
164
|
+
let P = b + w;
|
|
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 * (O - 50) ** 2 / Math.sqrt(20 + (O - 50) ** 2), S = 1 + 0.045 * k, $ = 1 + 0.015 * k * L, E = -2 * Math.sqrt(k ** 7 / (k ** 7 + 25 ** 7)) * Math.sin(60 * Math.exp(-(((P - 275) / 25) ** 2)) * l);
|
|
167
|
+
return Math.sqrt((y / A) ** 2 + (M / S) ** 2 + (N / $) ** 2 + E * (M / S) * (N / $));
|
|
168
|
+
}
|
|
169
|
+
const or = 10;
|
|
170
|
+
function sr(r, t = or) {
|
|
171
171
|
const e = /* @__PURE__ */ new Map();
|
|
172
172
|
for (const a of r) {
|
|
173
|
-
const l =
|
|
173
|
+
const l = ir(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
178
|
const n = [], i = /* @__PURE__ */ new Map();
|
|
179
|
-
for (const a of
|
|
179
|
+
for (const a of ft)
|
|
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 =
|
|
183
|
+
if (qt(l[c].rgb, l[u].rgb) < t) continue;
|
|
184
|
+
const d = qt(jt(l[c].rgb, a), jt(l[u].rgb, a));
|
|
185
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 s = null, o = 0;
|
|
@@ -189,7 +189,7 @@ function or(r, t = ir) {
|
|
|
189
189
|
l > o && (o = l, s = a);
|
|
190
190
|
return { collapses: n, worstType: s };
|
|
191
191
|
}
|
|
192
|
-
function
|
|
192
|
+
function ar(r, t, e, n) {
|
|
193
193
|
if (t <= 0 || e <= 0) return !0;
|
|
194
194
|
let i;
|
|
195
195
|
try {
|
|
@@ -198,36 +198,36 @@ function sr(r, t, e, n) {
|
|
|
198
198
|
return !1;
|
|
199
199
|
}
|
|
200
200
|
const s = new Float64Array(256);
|
|
201
|
-
for (let
|
|
201
|
+
for (let h = 0; h < 256; h++) s[h] = j(h);
|
|
202
202
|
const o = 1024, a = new Float64Array(o + 1);
|
|
203
|
-
for (let
|
|
204
|
-
const l = (
|
|
205
|
-
const d = Math.min(1, Math.max(0,
|
|
206
|
-
return
|
|
207
|
-
}, c =
|
|
208
|
-
for (let
|
|
209
|
-
const d = s[u[
|
|
210
|
-
u[
|
|
203
|
+
for (let h = 0; h <= o; h++) a[h] = lt(h / o);
|
|
204
|
+
const l = (h) => {
|
|
205
|
+
const d = Math.min(1, Math.max(0, h)) * o, m = Math.floor(d);
|
|
206
|
+
return m >= o ? a[o] : a[m] + (a[m + 1] - a[m]) * (d - m);
|
|
207
|
+
}, c = Rt[n], u = i.data;
|
|
208
|
+
for (let h = 0; h < u.length; h += 4) {
|
|
209
|
+
const d = s[u[h]], m = s[u[h + 1]], f = s[u[h + 2]];
|
|
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
212
|
return r.putImageData(i, 0, 0), !0;
|
|
213
213
|
}
|
|
214
214
|
const Me = (r) => `om-carto-cvd-${r}`;
|
|
215
|
-
function
|
|
215
|
+
function lr(r) {
|
|
216
216
|
if (r.getElementById("om-carto-cvd-filters")) return;
|
|
217
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
|
-
for (const e of
|
|
219
|
+
for (const e of ft) {
|
|
220
220
|
const n = r.createElementNS("http://www.w3.org/2000/svg", "filter");
|
|
221
221
|
n.id = Me(e), n.setAttribute("color-interpolation-filters", "linearRGB");
|
|
222
222
|
const i = r.createElementNS("http://www.w3.org/2000/svg", "feColorMatrix");
|
|
223
223
|
i.setAttribute("type", "matrix");
|
|
224
|
-
const s =
|
|
224
|
+
const s = Rt[e];
|
|
225
225
|
i.setAttribute("values", [s[0], s[1], s[2], 0, 0, s[3], s[4], s[5], 0, 0, s[6], s[7], s[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
229
|
const Ae = 16384, Se = 134217728;
|
|
230
|
-
async function
|
|
230
|
+
async function cr(r) {
|
|
231
231
|
const t = [], e = [...r.querySelectorAll("img")];
|
|
232
232
|
return await Promise.all(
|
|
233
233
|
e.map(async (n) => {
|
|
@@ -240,66 +240,66 @@ async function lr(r) {
|
|
|
240
240
|
})
|
|
241
241
|
), t;
|
|
242
242
|
}
|
|
243
|
-
function
|
|
243
|
+
function ur(r) {
|
|
244
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
|
-
).map((t, e) => ({ el: t, index: e, z:
|
|
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
|
|
248
|
+
async function Ot(r, t = {}) {
|
|
249
249
|
const e = r ?? document.querySelector("om-cartograph");
|
|
250
250
|
if (!e) throw new Error("[onlymapjs/cartograph] renderCartograph: no <om-cartograph> to render.");
|
|
251
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: s, heightMm: o } =
|
|
253
|
+
const { widthMm: s, heightMm: o } = ut(
|
|
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 = s + a * 2, c = o + a * 2, u = t.maxDimension ?? Ae,
|
|
258
|
+
), a = Math.max(0, Number(e.getAttribute("bleed")) || 0), l = s + a * 2, c = o + a * 2, u = t.maxDimension ?? Ae, h = t.maxArea ?? Se;
|
|
259
259
|
let d = i;
|
|
260
|
-
const
|
|
261
|
-
d >
|
|
262
|
-
const
|
|
263
|
-
for (const
|
|
264
|
-
if (!(!
|
|
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), 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 cr(e)), typeof document < "u" && document.fonts?.ready && await document.fonts.ready;
|
|
262
|
+
const p = Ut(d), b = Math.max(1, Math.round(l * p.pxPerMm)), w = Math.max(1, Math.round(c * p.pxPerMm)), y = ur(e);
|
|
263
|
+
for (const A of y)
|
|
264
|
+
if (!(!gt(A) || !A.prepareCartograph))
|
|
265
265
|
try {
|
|
266
|
-
await
|
|
267
|
-
} catch (
|
|
268
|
-
|
|
266
|
+
await A.prepareCartograph(Ut(d));
|
|
267
|
+
} catch (S) {
|
|
268
|
+
A.discardCartograph?.(), n.push(`${A.tagName.toLowerCase()}${A.id ? `#${A.id}` : ""} could not be captured: ${S.message}`);
|
|
269
269
|
}
|
|
270
|
-
const
|
|
271
|
-
|
|
272
|
-
const v =
|
|
270
|
+
const M = document.createElement("canvas");
|
|
271
|
+
M.width = b, M.height = w;
|
|
272
|
+
const v = M.getContext("2d");
|
|
273
273
|
if (!v) throw new Error("[onlymapjs/cartograph] renderCartograph: could not get a 2D canvas context.");
|
|
274
|
-
const
|
|
275
|
-
v.fillStyle =
|
|
276
|
-
for (const
|
|
277
|
-
if (!
|
|
278
|
-
const
|
|
279
|
-
if (v.save(), v.translate((
|
|
280
|
-
const $ =
|
|
281
|
-
v.translate($, E), v.rotate(
|
|
274
|
+
const N = typeof getComputedStyle == "function" ? getComputedStyle(e) : null;
|
|
275
|
+
v.fillStyle = F(N?.backgroundColor) ?? "#ffffff", v.fillRect(0, 0, b, w);
|
|
276
|
+
for (const A of y) {
|
|
277
|
+
if (!gt(A)) continue;
|
|
278
|
+
const S = C(A);
|
|
279
|
+
if (v.save(), v.translate((S.x + a) * p.pxPerMm, (S.y + a) * p.pxPerMm), S.rotation) {
|
|
280
|
+
const $ = S.w / 2 * p.pxPerMm, E = S.h / 2 * p.pxPerMm;
|
|
281
|
+
v.translate($, E), v.rotate(S.rotation * Math.PI / 180), v.translate(-$, -E);
|
|
282
282
|
}
|
|
283
283
|
try {
|
|
284
|
-
|
|
284
|
+
A.paintCartograph(v, p);
|
|
285
285
|
} catch ($) {
|
|
286
|
-
n.push(`${
|
|
286
|
+
n.push(`${A.tagName.toLowerCase()}${A.id ? `#${A.id}` : ""} failed to render: ${$.message}`);
|
|
287
287
|
}
|
|
288
288
|
v.restore();
|
|
289
289
|
}
|
|
290
|
-
const
|
|
291
|
-
for (const
|
|
292
|
-
const
|
|
293
|
-
[
|
|
290
|
+
const O = e.querySelector(":scope > [data-om-carto-marks]");
|
|
291
|
+
for (const A of O?.querySelectorAll("line") ?? []) {
|
|
292
|
+
const S = Number(A.getAttribute("x1")), $ = Number(A.getAttribute("y1")), E = Number(A.getAttribute("x2")), U = Number(A.getAttribute("y2"));
|
|
293
|
+
[S, $, 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, ($ + a) * p.pxPerMm), v.lineTo((E + a) * p.pxPerMm, (U + a) * p.pxPerMm), v.stroke(), v.restore());
|
|
294
294
|
}
|
|
295
|
-
const k =
|
|
296
|
-
k && !
|
|
297
|
-
for (const
|
|
298
|
-
const
|
|
299
|
-
|
|
300
|
-
const
|
|
301
|
-
if (!
|
|
302
|
-
return { blob:
|
|
295
|
+
const k = It(t.cvd === "page" ? e.getAttribute("cvd") : t.cvd);
|
|
296
|
+
k && !ar(v, b, w, k) && n.push("Colour-vision simulation was skipped: a cross-origin image on the page makes the export canvas unreadable.");
|
|
297
|
+
for (const A of y) gt(A) && A.discardCartograph?.();
|
|
298
|
+
const P = t.format === "jpeg" ? "image/jpeg" : "image/png";
|
|
299
|
+
P === "image/jpeg" && e.querySelector("om-text") && n.push("JPEG compresses text edges — prefer PNG for a page carrying labels.");
|
|
300
|
+
const L = await new Promise((A) => M.toBlob(A, P, t.quality));
|
|
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: n };
|
|
303
303
|
}
|
|
304
304
|
async function Ce(r, t = {}) {
|
|
305
305
|
const e = r ?? document.querySelector("om-cartograph");
|
|
@@ -313,46 +313,46 @@ async function Ce(r, t = {}) {
|
|
|
313
313
|
const s = t.format === "jpeg" ? "jpg" : "png", o = n.filenames(s), a = [], l = n.index;
|
|
314
314
|
try {
|
|
315
315
|
if (t.page != null) {
|
|
316
|
-
const
|
|
317
|
-
if (!Number.isInteger(
|
|
316
|
+
const h = Math.trunc(t.page);
|
|
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
|
-
n.seek(
|
|
320
|
-
const d = await
|
|
321
|
-
return { blob: d.blob, filenames: [o[
|
|
319
|
+
n.seek(h);
|
|
320
|
+
const d = await Wt(e, t, a);
|
|
321
|
+
return { blob: d.blob, filenames: [o[h]], pages: 1, dpi: d.dpi, warnings: a };
|
|
322
322
|
}
|
|
323
323
|
const c = [];
|
|
324
324
|
let u = t.dpi ?? 300;
|
|
325
|
-
for (let
|
|
326
|
-
n.seek(
|
|
327
|
-
const d = await
|
|
328
|
-
u = d.dpi, c.push({ name: o[
|
|
325
|
+
for (let h = 0; h < i; h++) {
|
|
326
|
+
n.seek(h);
|
|
327
|
+
const d = await Wt(e, t, a);
|
|
328
|
+
u = d.dpi, c.push({ name: o[h], data: d.blob }), t.onPage?.(h + 1, i);
|
|
329
329
|
}
|
|
330
|
-
return { blob: await
|
|
330
|
+
return { blob: await rr(c), filenames: o, pages: i, dpi: u, warnings: a };
|
|
331
331
|
} finally {
|
|
332
332
|
n.seek(l);
|
|
333
333
|
}
|
|
334
334
|
}
|
|
335
|
-
async function
|
|
335
|
+
async function Wt(r, t, e) {
|
|
336
336
|
for (const i of r.querySelectorAll("om-frame"))
|
|
337
337
|
await i.mapElement?.whenSettled?.({ timeout: 2e4 });
|
|
338
|
-
const n = await
|
|
338
|
+
const n = await Ot(r, t);
|
|
339
339
|
return e.push(...n.warnings), n;
|
|
340
340
|
}
|
|
341
|
-
const
|
|
341
|
+
const hr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
342
342
|
__proto__: null,
|
|
343
343
|
MAX_CANVAS_AREA: Se,
|
|
344
344
|
MAX_CANVAS_DIMENSION: Ae,
|
|
345
|
-
renderCartograph:
|
|
345
|
+
renderCartograph: Ot,
|
|
346
346
|
renderCartographAtlas: Ce
|
|
347
347
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
348
|
-
function
|
|
348
|
+
function Bt(r, t, e = {}) {
|
|
349
349
|
const n = URL.createObjectURL(r), i = document.createElement("a");
|
|
350
350
|
i.href = n, i.download = t, document.body.appendChild(i), i.click(), i.remove();
|
|
351
351
|
const s = e.revokeAfterMs ?? 0;
|
|
352
352
|
s > 0 ? setTimeout(() => URL.revokeObjectURL(n), s) : URL.revokeObjectURL(n);
|
|
353
353
|
}
|
|
354
|
-
const
|
|
355
|
-
async function
|
|
354
|
+
const mr = 3e4;
|
|
355
|
+
async function Vt(r, t = mr) {
|
|
356
356
|
let e = !1;
|
|
357
357
|
const n = new Promise(
|
|
358
358
|
(s) => setTimeout(() => {
|
|
@@ -372,7 +372,7 @@ async function Bt(r, t = hr) {
|
|
|
372
372
|
})();
|
|
373
373
|
return await Promise.race([i, n]), { timedOut: e };
|
|
374
374
|
}
|
|
375
|
-
async function
|
|
375
|
+
async function dr(r, t = {}) {
|
|
376
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;
|
|
@@ -380,33 +380,33 @@ async function mr(r, t = {}) {
|
|
|
380
380
|
i && r.setAttribute("cvd", i);
|
|
381
381
|
const s = n.get("export");
|
|
382
382
|
if (s) {
|
|
383
|
-
await
|
|
383
|
+
await Vt(r, t.timeoutMs);
|
|
384
384
|
const o = s === "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
|
|
387
|
-
if (!
|
|
386
|
+
const h = r.querySelector("om-atlas");
|
|
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
|
-
|
|
391
|
-
const
|
|
392
|
-
for (const f of
|
|
393
|
-
return
|
|
390
|
+
h.refresh?.();
|
|
391
|
+
const m = await Ce(r, { dpi: a, format: o, page: d - 1 });
|
|
392
|
+
for (const f of m.warnings) console.warn(`[onlymapjs/cartograph] ${f}`);
|
|
393
|
+
return Bt(m.blob, m.filenames[0] ?? `${l}.${o === "jpeg" ? "jpg" : "png"}`, { revokeAfterMs: 1e4 }), "export";
|
|
394
394
|
}
|
|
395
|
-
const u = await
|
|
396
|
-
for (const
|
|
397
|
-
return
|
|
395
|
+
const u = await Ot(r, { dpi: a, format: o });
|
|
396
|
+
for (const h of u.warnings) console.warn(`[onlymapjs/cartograph] ${h}`);
|
|
397
|
+
return Bt(u.blob, `${l}.${o === "jpeg" ? "jpg" : "png"}`, { revokeAfterMs: 1e4 }), "export";
|
|
398
398
|
}
|
|
399
|
-
return n.get("print") === "1" ? (await
|
|
399
|
+
return n.get("print") === "1" ? (await Vt(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 fr() {
|
|
402
402
|
if (typeof document > "u") return;
|
|
403
403
|
const r = () => {
|
|
404
404
|
for (const t of document.querySelectorAll("om-cartograph[allow-url-actions]"))
|
|
405
|
-
|
|
405
|
+
dr(t).catch((e) => console.warn(`[onlymapjs/cartograph] URL action failed: ${e.message}`));
|
|
406
406
|
};
|
|
407
407
|
document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", r, { once: !0 }) : r();
|
|
408
408
|
}
|
|
409
|
-
const xe = typeof window < "u" && typeof document < "u" && typeof customElements < "u",
|
|
409
|
+
const xe = typeof window < "u" && typeof document < "u" && typeof customElements < "u", gr = xe ? HTMLElement : class {
|
|
410
410
|
};
|
|
411
411
|
function x(r, t) {
|
|
412
412
|
xe && (customElements.get(r) || customElements.define(r, t));
|
|
@@ -418,7 +418,7 @@ function pr(r) {
|
|
|
418
418
|
);
|
|
419
419
|
return new DOMParser().parseFromString(r, "text/html");
|
|
420
420
|
}
|
|
421
|
-
class R extends
|
|
421
|
+
class R extends gr {
|
|
422
422
|
renderQueued = !1;
|
|
423
423
|
connectedCallback() {
|
|
424
424
|
this.scheduleRender();
|
|
@@ -450,48 +450,48 @@ class R extends fr {
|
|
|
450
450
|
a != null && Number.isInteger(a) ? this.style.zIndex = String(a) : this.style.removeProperty("z-index");
|
|
451
451
|
}
|
|
452
452
|
}
|
|
453
|
-
const pt = "cartograph/2",
|
|
453
|
+
const pt = "cartograph/2", Hn = ["default", "dark", "sepia", "blueprint", "minimal"], Ht = ["A0", "A1", "A2", "A3", "A4", "A5", "Letter", "Legal"], br = /* @__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
|
-
]),
|
|
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"],
|
|
457
|
-
"om-frame": [...
|
|
458
|
-
"om-legend": [...
|
|
455
|
+
]), z = ["id", "x", "y", "w", "h", "rotation", "z", "locked", "hidden"], T = {
|
|
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": [...z, "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": [...z, "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": [...z, "for", "units", "segments", "segment-length", "kind"],
|
|
465
|
+
"om-north": [...z, "for", "kind"],
|
|
466
|
+
"om-graticule": [...z, "for", "crs", "crs-def", "interval", "interval-x", "interval-y", "kind", "labels", "format"],
|
|
467
|
+
"om-text": [...z, "kind", "font-size", "weight", "align", "font", "color", "bg"],
|
|
468
|
+
"om-shape": [...z, "kind", "fill", "fill-opacity", "stroke", "stroke-width", "radius"],
|
|
469
|
+
"om-image": [...z, "src", "fit"],
|
|
470
470
|
"om-atlas": ["id", "for", "layer", "filter", "sort", "filename", "page-name"]
|
|
471
|
-
},
|
|
472
|
-
function
|
|
473
|
-
return r != null &&
|
|
471
|
+
}, bt = Object.keys(T), yr = ["metric", "imperial", "nautical"], wr = 0.3048, vr = 1609.344, Mr = 1852;
|
|
472
|
+
function Ar(r) {
|
|
473
|
+
return r != null && yr.includes(r) ? r : null;
|
|
474
474
|
}
|
|
475
475
|
function ke(r) {
|
|
476
476
|
if (!isFinite(r) || r <= 0) return 0;
|
|
477
477
|
const t = Math.pow(10, Math.floor(Math.log10(r))), e = r / t;
|
|
478
478
|
return (e >= 5 ? 5 : e >= 2 ? 2 : 1) * t;
|
|
479
479
|
}
|
|
480
|
-
const
|
|
480
|
+
const Kt = {
|
|
481
481
|
// Finest first; the largest tier whose snapped length is ≥ 1 unit wins.
|
|
482
482
|
metric: [
|
|
483
483
|
{ metersPerUnit: 1, label: "m" },
|
|
484
484
|
{ metersPerUnit: 1e3, label: "km" }
|
|
485
485
|
],
|
|
486
486
|
imperial: [
|
|
487
|
-
{ metersPerUnit:
|
|
488
|
-
{ metersPerUnit:
|
|
487
|
+
{ metersPerUnit: wr, label: "ft" },
|
|
488
|
+
{ metersPerUnit: vr, label: "mi" }
|
|
489
489
|
],
|
|
490
|
-
nautical: [{ metersPerUnit:
|
|
490
|
+
nautical: [{ metersPerUnit: Mr, label: "nmi" }]
|
|
491
491
|
};
|
|
492
492
|
function $e({ groundMetersPerMm: r, maxWidthMm: t, segments: e = 4, units: n = "metric", segmentLengthMeters: i }) {
|
|
493
493
|
if (!Number.isFinite(r) || r <= 0 || !Number.isFinite(t) || t <= 0) return null;
|
|
494
|
-
const s = Number.isInteger(e) && e > 0 ? e : 4, o =
|
|
494
|
+
const s = Number.isInteger(e) && e > 0 ? e : 4, o = Kt[n] ?? Kt.metric, a = t / s * r;
|
|
495
495
|
let l, c;
|
|
496
496
|
if (i != null && Number.isFinite(i) && i > 0)
|
|
497
497
|
l = i, c = Yt(o, l);
|
|
@@ -503,24 +503,24 @@ function $e({ groundMetersPerMm: r, maxWidthMm: t, segments: e = 4, units: n = "
|
|
|
503
503
|
}
|
|
504
504
|
const u = l / r;
|
|
505
505
|
if (!Number.isFinite(u) || u <= 0) return null;
|
|
506
|
-
const
|
|
506
|
+
const h = l / c.metersPerUnit, d = h < 1 ? 2 : h < 10 && !Number.isInteger(h) ? 1 : 0, m = Array.from({ length: s + 1 }, (f, g) => (g * h).toFixed(d));
|
|
507
507
|
return {
|
|
508
508
|
segmentMeters: l,
|
|
509
509
|
segmentMm: u,
|
|
510
510
|
segments: s,
|
|
511
511
|
totalMm: u * s,
|
|
512
|
-
labels:
|
|
512
|
+
labels: m,
|
|
513
513
|
unitLabel: c.label,
|
|
514
514
|
// 1 mm on the page is groundMetersPerMm metres on the ground; the RF is
|
|
515
515
|
// that ratio in consistent units (mm : mm).
|
|
516
516
|
scaleDenominator: r * 1e3
|
|
517
517
|
};
|
|
518
518
|
}
|
|
519
|
-
function
|
|
519
|
+
function Sr(r, t, e) {
|
|
520
520
|
const n = Math.min(2.6, Math.max(1.6, e * 0.34)), i = 0.2, s = n * 1.25, o = Math.max(0.6, Math.min(2.2, e - s - 0.4)), a = 0, l = r.segmentMm, c = [], u = [];
|
|
521
521
|
if (t === "single" || t === "double") {
|
|
522
|
-
const
|
|
523
|
-
for (let w = 0; w <
|
|
522
|
+
const p = t === "double" ? 2 : 1, b = o / p;
|
|
523
|
+
for (let w = 0; w < p; w++)
|
|
524
524
|
for (let y = 0; y < r.segments; y++)
|
|
525
525
|
c.push({
|
|
526
526
|
x: y * l,
|
|
@@ -532,28 +532,28 @@ function Ar(r, t, e) {
|
|
|
532
532
|
});
|
|
533
533
|
} else {
|
|
534
534
|
u.push({ x1: 0, y1: a + o, x2: r.totalMm, y2: a + o });
|
|
535
|
-
const
|
|
536
|
-
for (let b = 0; b <=
|
|
537
|
-
const w = b /
|
|
535
|
+
const p = t === "ticks" ? r.segments : 1;
|
|
536
|
+
for (let b = 0; b <= p; b++) {
|
|
537
|
+
const w = b / p * r.totalMm;
|
|
538
538
|
u.push({ x1: w, y1: a, x2: w, y2: a + o });
|
|
539
539
|
}
|
|
540
540
|
}
|
|
541
|
-
const
|
|
541
|
+
const h = r.labels.length - 1, d = r.labels.map((p, b) => ({
|
|
542
542
|
// The end label carries the unit so the bar reads "0 2 4 6 8 km".
|
|
543
|
-
text: b ===
|
|
543
|
+
text: b === h ? `${p} ${r.unitLabel}` : p,
|
|
544
544
|
// Keep the end label inside the drawn width rather than hanging off it.
|
|
545
|
-
x: b ===
|
|
545
|
+
x: b === h ? r.totalMm : b * l,
|
|
546
546
|
y: a + o + n,
|
|
547
|
-
anchor: b === 0 ? "start" : b ===
|
|
547
|
+
anchor: b === 0 ? "start" : b === h ? "end" : "middle",
|
|
548
548
|
index: b
|
|
549
|
-
})),
|
|
550
|
-
let
|
|
551
|
-
for (const
|
|
552
|
-
const b =
|
|
553
|
-
if (!(!(
|
|
554
|
-
if (
|
|
555
|
-
for (; f.length > 1 && f[f.length - 1].x +
|
|
556
|
-
f.push({ text:
|
|
549
|
+
})), m = (p) => p.length * n * 0.62, f = [];
|
|
550
|
+
let g = -1 / 0;
|
|
551
|
+
for (const p of d) {
|
|
552
|
+
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 + n * 0.4)) {
|
|
554
|
+
if (p.index === h && w < g + n * 0.4)
|
|
555
|
+
for (; f.length > 1 && f[f.length - 1].x + m(f[f.length - 1].text) / 2 > w - n * 0.4; ) f.pop();
|
|
556
|
+
f.push({ text: p.text, x: p.x, y: p.y, anchor: p.anchor }), g = y;
|
|
557
557
|
}
|
|
558
558
|
}
|
|
559
559
|
return { bars: c, strokes: u, labels: f, fontMm: n, strokeMm: i, segmentMeters: r.segmentMeters, unitLabel: r.unitLabel, scaleDenominator: r.scaleDenominator };
|
|
@@ -564,12 +564,12 @@ function Yt(r, t) {
|
|
|
564
564
|
t / n.metersPerUnit >= 1 && (e = n);
|
|
565
565
|
return e;
|
|
566
566
|
}
|
|
567
|
-
const
|
|
568
|
-
function
|
|
569
|
-
return !Number.isFinite(r) || r <= 0 ? "" : Math.round(r).toString().replace(/\B(?=(\d{3})+(?!\d))/g,
|
|
567
|
+
const Cr = " ";
|
|
568
|
+
function xr(r) {
|
|
569
|
+
return !Number.isFinite(r) || r <= 0 ? "" : Math.round(r).toString().replace(/\B(?=(\d{3})+(?!\d))/g, Cr);
|
|
570
570
|
}
|
|
571
571
|
const Ee = /\{\{\s*([\w.]+)\s*\}\}/g;
|
|
572
|
-
function
|
|
572
|
+
function kr(r, t) {
|
|
573
573
|
if (r.startsWith("atlas.")) return t.atlas?.[r.slice(6)];
|
|
574
574
|
if (r.startsWith("frame.")) {
|
|
575
575
|
const e = r.slice(6), n = e.lastIndexOf(".");
|
|
@@ -584,15 +584,15 @@ function xr(r, t) {
|
|
|
584
584
|
function Ne(r, t) {
|
|
585
585
|
const e = [];
|
|
586
586
|
return { text: r.replace(Ee, (i, s) => {
|
|
587
|
-
const o =
|
|
587
|
+
const o = kr(s, t);
|
|
588
588
|
return o === void 0 ? (e.push(s), i) : o;
|
|
589
589
|
}), unresolved: e };
|
|
590
590
|
}
|
|
591
|
-
function
|
|
591
|
+
function $r(r) {
|
|
592
592
|
return [...r.matchAll(Ee)].map((t) => t[1]);
|
|
593
593
|
}
|
|
594
|
-
const
|
|
595
|
-
function
|
|
594
|
+
const Xt = /* @__PURE__ */ new WeakMap();
|
|
595
|
+
function Er(r, t) {
|
|
596
596
|
const e = [], n = r.ownerDocument ?? (typeof document < "u" ? document : null);
|
|
597
597
|
if (!n) return e;
|
|
598
598
|
const i = n.createTreeWalker(
|
|
@@ -602,17 +602,17 @@ function $r(r, t) {
|
|
|
602
602
|
), s = [];
|
|
603
603
|
for (let o = i.nextNode(); o; o = i.nextNode()) s.push(o);
|
|
604
604
|
for (const o of s) {
|
|
605
|
-
let a =
|
|
605
|
+
let a = Xt.get(o);
|
|
606
606
|
if (a === void 0) {
|
|
607
607
|
if (a = o.data, !a.includes("{{")) continue;
|
|
608
|
-
|
|
608
|
+
Xt.set(o, a);
|
|
609
609
|
}
|
|
610
610
|
const l = Ne(a, t);
|
|
611
611
|
o.data !== l.text && (o.data = l.text), e.push(...l.unresolved);
|
|
612
612
|
}
|
|
613
613
|
return e;
|
|
614
614
|
}
|
|
615
|
-
function
|
|
615
|
+
function Nr(r = /* @__PURE__ */ new Date()) {
|
|
616
616
|
return `${r.getFullYear()}-${String(r.getMonth() + 1).padStart(2, "0")}-${String(r.getDate()).padStart(2, "0")}`;
|
|
617
617
|
}
|
|
618
618
|
const Et = "data-om-carto-unlinked";
|
|
@@ -629,17 +629,17 @@ function Te(r, t) {
|
|
|
629
629
|
function Le(r) {
|
|
630
630
|
return [...r.querySelectorAll("om-frame")];
|
|
631
631
|
}
|
|
632
|
-
function
|
|
632
|
+
function Pr(r) {
|
|
633
633
|
const t = Pe(r);
|
|
634
634
|
if (!t) return null;
|
|
635
635
|
const e = Le(t);
|
|
636
636
|
return e.length === 1 ? e[0] : null;
|
|
637
637
|
}
|
|
638
|
-
function
|
|
638
|
+
function _(r) {
|
|
639
639
|
const t = r.getAttribute("for");
|
|
640
|
-
return t ? Te(r, t) :
|
|
640
|
+
return t ? Te(r, t) : Pr(r);
|
|
641
641
|
}
|
|
642
|
-
function
|
|
642
|
+
function G(r, t) {
|
|
643
643
|
let e = r.querySelector(`:scope > [${Et}]`);
|
|
644
644
|
if (!e) {
|
|
645
645
|
for (const n of [...r.children])
|
|
@@ -648,12 +648,12 @@ function W(r, t) {
|
|
|
648
648
|
}
|
|
649
649
|
e.textContent !== t && (e.textContent = t);
|
|
650
650
|
}
|
|
651
|
-
function
|
|
651
|
+
function Tr(r) {
|
|
652
652
|
r.querySelector(`:scope > [${Et}]`)?.remove();
|
|
653
653
|
}
|
|
654
|
-
const
|
|
655
|
-
class
|
|
656
|
-
static observedAttributes = [...
|
|
654
|
+
const Jt = "data-om-carto-page", Zt = "data-om-carto-marks", yt = "data-om-carto-credit", Fe = "Built with OnlyMap by NIKA", Lr = `${Fe} · free for non-commercial use`, rt = 2, Qt = 1.2, wt = 2.4, te = 1.5, vt = 1.2, ee = 0.3, re = 0.8, Mt = "http://www.w3.org/2000/svg", Fr = 6e4;
|
|
655
|
+
class Ie extends R {
|
|
656
|
+
static observedAttributes = [...T["om-cartograph"]];
|
|
657
657
|
frameListenerBound = !1;
|
|
658
658
|
/** Fields of the atlas page currently displayed, for {{atlas.<field>}}. */
|
|
659
659
|
atlasFields;
|
|
@@ -661,7 +661,7 @@ class Fe extends R {
|
|
|
661
661
|
unsubscribeLicense = null;
|
|
662
662
|
/** The resolved page box, mm — furniture and export read this, never the attributes. */
|
|
663
663
|
get pageSize() {
|
|
664
|
-
return
|
|
664
|
+
return ut(this.getAttribute("size"), this.getAttribute("width"), this.getAttribute("height"), this.getAttribute("orientation"));
|
|
665
665
|
}
|
|
666
666
|
/** Bleed in mm (0 when unset) — extends the printed sheet past the trim. */
|
|
667
667
|
get bleedMm() {
|
|
@@ -671,8 +671,10 @@ class Fe extends R {
|
|
|
671
671
|
connectedCallback() {
|
|
672
672
|
super.connectedCallback(), this.frameListenerBound || (this.frameListenerBound = !0, this.addEventListener("om-frame-ready", () => {
|
|
673
673
|
this.atlas?.refresh(), this.refreshTokens(), this.refreshFurniture(), this.renderCredit();
|
|
674
|
+
}), this.addEventListener("om-frame-view", () => {
|
|
675
|
+
this.refreshTokens(), this.refreshFurniture();
|
|
674
676
|
})), !this.creditObserver && typeof MutationObserver < "u" && (this.creditObserver = new MutationObserver(() => {
|
|
675
|
-
this.querySelector(`:scope > [${
|
|
677
|
+
this.querySelector(`:scope > [${yt}]`) || this.renderCredit();
|
|
676
678
|
}), this.creditObserver.observe(this, { childList: !0 }));
|
|
677
679
|
}
|
|
678
680
|
disconnectedCallback() {
|
|
@@ -689,27 +691,40 @@ class Fe extends R {
|
|
|
689
691
|
* runtime's job (issue #41 §9: the om-map carries the key).
|
|
690
692
|
*/
|
|
691
693
|
renderCredit() {
|
|
692
|
-
const t =
|
|
694
|
+
const t = H();
|
|
693
695
|
t && !this.unsubscribeLicense && typeof t.subscribeLicense == "function" && (this.unsubscribeLicense = t.subscribeLicense(() => this.renderCredit()));
|
|
694
|
-
const e = t
|
|
695
|
-
if (e || n) {
|
|
696
|
+
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 > [${yt}]`);
|
|
697
|
+
if (e === "hidden" || n) {
|
|
696
698
|
i?.remove();
|
|
697
699
|
return;
|
|
698
700
|
}
|
|
701
|
+
const s = e === "voluntary" ? Fe : Lr;
|
|
699
702
|
if (i) {
|
|
700
|
-
this.armCreditPainter(i);
|
|
703
|
+
i.textContent !== s && (i.textContent = s), this.armCreditPainter(i);
|
|
701
704
|
return;
|
|
702
705
|
}
|
|
703
|
-
const
|
|
704
|
-
|
|
706
|
+
const o = this.ownerDocument.createElement("div");
|
|
707
|
+
o.setAttribute(yt, ""), o.setAttribute("z", "2147483644"), o.textContent = s, o.style.cssText = `position:absolute;left:${rt}mm;bottom:${Qt}mm;z-index:2147483644;font:${wt}mm/${te} system-ui,sans-serif;color:#374151;background:rgba(255,255,255,.72);padding:${ee}mm ${vt}mm;border-radius:${re}mm;pointer-events:none;`, this.armCreditPainter(o), this.appendChild(o);
|
|
708
|
+
}
|
|
709
|
+
/**
|
|
710
|
+
* Which credit this sheet carries, from the core's own predicate so the
|
|
711
|
+
* license decision is never re-implemented here — only the print wording
|
|
712
|
+
* is local.
|
|
713
|
+
*/
|
|
714
|
+
creditMode(t, e) {
|
|
715
|
+
if (!t) return "obligation";
|
|
716
|
+
if (typeof t.badgeMode != "function")
|
|
717
|
+
return t.getEntitlements().hideBadge && !e ? "hidden" : "obligation";
|
|
718
|
+
const n = t.badgeMode({ keepBadge: e });
|
|
719
|
+
return n === "pending" ? "obligation" : n;
|
|
705
720
|
}
|
|
706
721
|
/** Give the runtime-owned DOM credit the same canvas paint contract as authored furniture. */
|
|
707
722
|
armCreditPainter(t) {
|
|
708
723
|
t.paintCartograph = (e, n) => {
|
|
709
|
-
const i = (
|
|
724
|
+
const i = (u) => u * n.pxPerMm, s = t.textContent ?? "", a = wt * te + ee * 2, l = this.pageSize.heightMm - Qt - a;
|
|
710
725
|
e.save(), e.font = `${i(wt)}px system-ui, sans-serif`;
|
|
711
|
-
const
|
|
712
|
-
e.fillStyle = "rgba(255,255,255,.72)", e.beginPath(), typeof e.roundRect == "function" ? e.roundRect(i(rt), i(
|
|
726
|
+
const c = e.measureText(s).width / n.pxPerMm + vt * 2;
|
|
727
|
+
e.fillStyle = "rgba(255,255,255,.72)", e.beginPath(), typeof e.roundRect == "function" ? e.roundRect(i(rt), i(l), i(c), i(a), i(re)) : e.rect(i(rt), i(l), i(c), i(a)), e.fill(), e.fillStyle = "#374151", e.textAlign = "left", e.textBaseline = "middle", e.fillText(s, i(rt + vt), i(l + a / 2)), e.restore();
|
|
713
728
|
};
|
|
714
729
|
}
|
|
715
730
|
/**
|
|
@@ -738,12 +753,12 @@ class Fe extends R {
|
|
|
738
753
|
try {
|
|
739
754
|
window.print();
|
|
740
755
|
} finally {
|
|
741
|
-
s || setTimeout(o,
|
|
756
|
+
s || setTimeout(o, Fr);
|
|
742
757
|
}
|
|
743
758
|
}
|
|
744
759
|
/** Render the whole page to one image, for `flatten`. */
|
|
745
760
|
async buildFlattenedImage(t) {
|
|
746
|
-
const { renderCartograph: e } = await Promise.resolve().then(() =>
|
|
761
|
+
const { renderCartograph: e } = await Promise.resolve().then(() => hr), { blob: n } = await e(this, { dpi: t }), i = this.ownerDocument.createElement("img");
|
|
747
762
|
i.src = URL.createObjectURL(n), i.setAttribute("data-om-carto-flattened", "");
|
|
748
763
|
const s = this.bleedMm;
|
|
749
764
|
return i.style.cssText = `position:absolute;left:${-s}mm;top:${-s}mm;width:calc(100% + ${s * 2}mm);height:calc(100% + ${s * 2}mm);z-index:2147483645;`, await i.decode().catch(() => {
|
|
@@ -768,7 +783,7 @@ class Fe extends R {
|
|
|
768
783
|
for (const s of e) {
|
|
769
784
|
const o = s.georef, a = o?.groundMetersPerMm() ?? 0;
|
|
770
785
|
t.set(s.id, {
|
|
771
|
-
scale: a > 0 ?
|
|
786
|
+
scale: a > 0 ? xr(a * 1e3) : void 0,
|
|
772
787
|
crs: o?.crs
|
|
773
788
|
});
|
|
774
789
|
}
|
|
@@ -777,7 +792,7 @@ class Fe extends R {
|
|
|
777
792
|
page: {
|
|
778
793
|
title: i("title"),
|
|
779
794
|
attribution: i("attribution"),
|
|
780
|
-
date:
|
|
795
|
+
date: Nr(),
|
|
781
796
|
notes: i("notes")
|
|
782
797
|
},
|
|
783
798
|
frames: t,
|
|
@@ -795,8 +810,8 @@ class Fe extends R {
|
|
|
795
810
|
renderNow() {
|
|
796
811
|
const { widthMm: t, heightMm: e } = this.pageSize, n = this.bleedMm;
|
|
797
812
|
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";
|
|
798
|
-
let i = this.querySelector(`style[${
|
|
799
|
-
i || (i = document.createElement("style"), i.setAttribute(
|
|
813
|
+
let i = this.querySelector(`style[${Jt}]`);
|
|
814
|
+
i || (i = document.createElement("style"), i.setAttribute(Jt, ""), this.prepend(i));
|
|
800
815
|
const s = t + n * 2, o = e + n * 2;
|
|
801
816
|
i.textContent = `@page { size: ${s}mm ${o}mm; margin: 0; }
|
|
802
817
|
@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,15 +833,15 @@ class Fe extends R {
|
|
|
818
833
|
}
|
|
819
834
|
const l = this.ownerDocument, c = a ?? l.createElementNS(Mt, "svg");
|
|
820
835
|
if (c.setAttribute(Zt, ""), 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) {
|
|
821
|
-
const u = Math.min(n, 4),
|
|
822
|
-
for (const
|
|
836
|
+
const u = Math.min(n, 4), h = Math.min(n * 0.35, 1.5), d = [];
|
|
837
|
+
for (const m of [0, t])
|
|
823
838
|
for (const f of [0, e]) {
|
|
824
|
-
const
|
|
825
|
-
d.push([
|
|
839
|
+
const g = m === 0 ? -1 : 1, p = f === 0 ? -1 : 1;
|
|
840
|
+
d.push([m + g * h, f, m + g * (h + u), f]), d.push([m, f + p * h, m, f + p * (h + u)]);
|
|
826
841
|
}
|
|
827
|
-
for (const [
|
|
842
|
+
for (const [m, f, g, p] of d) {
|
|
828
843
|
const b = l.createElementNS(Mt, "line");
|
|
829
|
-
b.setAttribute("x1", String(
|
|
844
|
+
b.setAttribute("x1", String(m)), b.setAttribute("y1", String(f)), b.setAttribute("x2", String(g)), b.setAttribute("y2", String(p)), b.setAttribute("stroke", "#000"), b.setAttribute("stroke-width", "0.15"), c.appendChild(b);
|
|
830
845
|
}
|
|
831
846
|
}
|
|
832
847
|
if (o) {
|
|
@@ -844,36 +859,36 @@ class Fe extends R {
|
|
|
844
859
|
* injected only when a page actually asks for one.
|
|
845
860
|
*/
|
|
846
861
|
applyCvd() {
|
|
847
|
-
const t =
|
|
862
|
+
const t = It(this.getAttribute("cvd"));
|
|
848
863
|
if (!t) {
|
|
849
864
|
this.style.removeProperty("filter");
|
|
850
865
|
return;
|
|
851
866
|
}
|
|
852
|
-
|
|
867
|
+
lr(this.ownerDocument), this.style.filter = `url(#${Me(t)})`;
|
|
853
868
|
}
|
|
854
869
|
}
|
|
855
|
-
x("om-cartograph",
|
|
856
|
-
function
|
|
870
|
+
x("om-cartograph", Ie);
|
|
871
|
+
function Ir({ text: r, maxWidth: t, fontSizePx: e, lineHeightPx: n, measure: i }) {
|
|
857
872
|
const s = n > 0 ? n : e * 1.2, o = [];
|
|
858
873
|
for (const c of r.split(/\r?\n/)) {
|
|
859
|
-
const u = c.split(/\s+/).filter((
|
|
874
|
+
const u = c.split(/\s+/).filter((m) => m !== "");
|
|
860
875
|
if (u.length === 0) {
|
|
861
876
|
o.push({ text: "", baselineY: 0, width: 0 });
|
|
862
877
|
continue;
|
|
863
878
|
}
|
|
864
|
-
const
|
|
865
|
-
let f =
|
|
879
|
+
const h = (m) => {
|
|
880
|
+
let f = m;
|
|
866
881
|
for (; i(f) > t && f.length > 1; ) {
|
|
867
|
-
let
|
|
868
|
-
for (;
|
|
869
|
-
o.push({ text: f.slice(0,
|
|
882
|
+
let g = f.length - 1;
|
|
883
|
+
for (; g > 1 && i(f.slice(0, g)) > t; ) g--;
|
|
884
|
+
o.push({ text: f.slice(0, g), baselineY: 0, width: i(f.slice(0, g)) }), f = f.slice(g);
|
|
870
885
|
}
|
|
871
886
|
return f;
|
|
872
887
|
};
|
|
873
888
|
let d = "";
|
|
874
|
-
for (const
|
|
875
|
-
const f = d === "" ?
|
|
876
|
-
d === "" ? d = m
|
|
889
|
+
for (const m of u) {
|
|
890
|
+
const f = d === "" ? m : `${d} ${m}`;
|
|
891
|
+
d === "" ? d = h(m) : i(f) > t ? (o.push({ text: d, baselineY: 0, width: i(d) }), d = h(m)) : d = f;
|
|
877
892
|
}
|
|
878
893
|
o.push({ text: d, baselineY: 0, width: i(d) });
|
|
879
894
|
}
|
|
@@ -883,16 +898,16 @@ function Lr({ text: r, maxWidth: t, fontSizePx: e, lineHeightPx: n, measure: i }
|
|
|
883
898
|
c.baselineY = a + u * s, c.width > l && (l = c.width);
|
|
884
899
|
}), { lines: o, lineHeight: s, maxWidth: l };
|
|
885
900
|
}
|
|
886
|
-
function
|
|
901
|
+
function Kn(r) {
|
|
887
902
|
if (typeof document > "u") return null;
|
|
888
903
|
const e = document.createElement("canvas").getContext("2d");
|
|
889
904
|
return e ? (e.font = r, (n) => e.measureText(n).width) : null;
|
|
890
905
|
}
|
|
891
|
-
function
|
|
906
|
+
function Rr(r, t, e) {
|
|
892
907
|
return r === "center" ? (t - e) / 2 : r === "end" || r === "right" ? t - e : 0;
|
|
893
908
|
}
|
|
894
|
-
class
|
|
895
|
-
static observedAttributes = [...
|
|
909
|
+
class Re extends R {
|
|
910
|
+
static observedAttributes = [...T["om-text"]];
|
|
896
911
|
renderNow() {
|
|
897
912
|
this.applyPlacement(), this.style.display = "block", this.style.boxSizing = "border-box", this.style.overflow = "hidden";
|
|
898
913
|
const t = this.getAttribute("font-size");
|
|
@@ -911,48 +926,54 @@ class Ie extends R {
|
|
|
911
926
|
/** Re-run token substitution from the authored templates. */
|
|
912
927
|
resolveTokens() {
|
|
913
928
|
const t = this.closest("om-cartograph");
|
|
914
|
-
t && typeof t.tokenContext == "function" &&
|
|
929
|
+
t && typeof t.tokenContext == "function" && Er(this, t.tokenContext());
|
|
915
930
|
}
|
|
916
931
|
paintCartograph(t, e) {
|
|
917
|
-
const { w: n, h: i } =
|
|
932
|
+
const { w: n, h: i } = C(this), s = n * e.pxPerMm, o = i * e.pxPerMm;
|
|
918
933
|
if (s <= 0 || o <= 0) return;
|
|
919
|
-
const a = typeof getComputedStyle == "function" ? getComputedStyle(this) : null, l =
|
|
934
|
+
const a = typeof getComputedStyle == "function" ? getComputedStyle(this) : null, l = F(a?.backgroundColor);
|
|
920
935
|
l && (t.fillStyle = l, t.fillRect(0, 0, s, o));
|
|
921
936
|
const c = (this.textContent ?? "").trim();
|
|
922
937
|
if (c === "") return;
|
|
923
|
-
const u = $t(a?.fontSize, 12),
|
|
924
|
-
t.save(), t.font =
|
|
925
|
-
const b =
|
|
938
|
+
const u = $t(a?.fontSize, 12), h = a?.lineHeight === "normal" ? u * 1.4 : $t(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}`;
|
|
939
|
+
t.save(), t.font = p, t.fillStyle = F(a?.color) ?? "#000", t.textBaseline = "alphabetic", t.textAlign = "left";
|
|
940
|
+
const b = Ir({
|
|
926
941
|
text: c,
|
|
927
942
|
maxWidth: s,
|
|
928
943
|
fontSizePx: f,
|
|
929
|
-
lineHeightPx:
|
|
944
|
+
lineHeightPx: g,
|
|
930
945
|
measure: (y) => t.measureText(y).width
|
|
931
946
|
}), w = a?.textAlign || "start";
|
|
932
947
|
for (const y of b.lines) {
|
|
933
|
-
if (y.baselineY > o +
|
|
934
|
-
t.fillText(y.text,
|
|
948
|
+
if (y.baselineY > o + g) break;
|
|
949
|
+
t.fillText(y.text, Rr(w, s, y.width), y.baselineY);
|
|
935
950
|
}
|
|
936
951
|
t.restore();
|
|
937
952
|
}
|
|
938
953
|
}
|
|
939
|
-
x("om-text",
|
|
940
|
-
const
|
|
941
|
-
let
|
|
954
|
+
x("om-text", Re);
|
|
955
|
+
const Or = 63710087714e-4;
|
|
956
|
+
let _r = Or;
|
|
942
957
|
const nt = Math.PI / 180;
|
|
943
|
-
function
|
|
958
|
+
function Ur(r, t, e = _r) {
|
|
944
959
|
const n = (t[1] - r[1]) * nt, i = (t[0] - r[0]) * nt, s = r[1] * nt, o = t[1] * nt, a = Math.sin(n / 2) ** 2 + Math.cos(s) * Math.cos(o) * Math.sin(i / 2) ** 2;
|
|
945
960
|
return 2 * e * Math.asin(Math.min(1, Math.sqrt(a)));
|
|
946
961
|
}
|
|
947
|
-
const
|
|
948
|
-
function
|
|
962
|
+
const K = 6378137, ht = Math.PI / 180, Nt = 180 / Math.PI, ne = 85.0511287798066;
|
|
963
|
+
function zr([r, t]) {
|
|
949
964
|
const e = Math.max(-ne, Math.min(ne, t));
|
|
950
|
-
return [
|
|
965
|
+
return [K * r * ht, K * Math.log(Math.tan(Math.PI / 4 + e * ht / 2))];
|
|
966
|
+
}
|
|
967
|
+
const ie = 89.9;
|
|
968
|
+
function Dr([r, t]) {
|
|
969
|
+
const e = Math.max(-ie, Math.min(ie, t));
|
|
970
|
+
return [K * r * ht, K * Math.log(Math.tan(Math.PI / 4 + e * ht / 2))];
|
|
951
971
|
}
|
|
952
|
-
|
|
953
|
-
|
|
972
|
+
const jr = { code: "EPSG:3857", forward: Dr, inverse: Oe };
|
|
973
|
+
function Oe([r, t]) {
|
|
974
|
+
return [r / K * Nt, (2 * Math.atan(Math.exp(t / K)) - Math.PI / 2) * Nt];
|
|
954
975
|
}
|
|
955
|
-
const _e = { code: "EPSG:3857", forward:
|
|
976
|
+
const _e = { code: "EPSG:3857", forward: zr, inverse: Oe }, Gr = { code: "EPSG:4326", forward: ([r, t]) => [r, t], inverse: ([r, t]) => [r, t] };
|
|
956
977
|
function Y(r) {
|
|
957
978
|
if (r == null) return null;
|
|
958
979
|
const t = r.trim();
|
|
@@ -960,14 +981,14 @@ function Y(r) {
|
|
|
960
981
|
const e = /^(?:epsg:{1,2})?(\d{4,6})$/i.exec(t);
|
|
961
982
|
return e ? `EPSG:${e[1]}` : t.toUpperCase();
|
|
962
983
|
}
|
|
963
|
-
function
|
|
984
|
+
function X(r) {
|
|
964
985
|
const t = Y(r) ?? "EPSG:3857";
|
|
965
|
-
return t === "EPSG:3857" || t === "EPSG:900913" ? _e : t === "EPSG:4326" || t === "CRS:84" || t === "OGC:CRS84" ?
|
|
986
|
+
return t === "EPSG:3857" || t === "EPSG:900913" ? _e : t === "EPSG:4326" || t === "CRS:84" || t === "OGC:CRS84" ? Gr : null;
|
|
966
987
|
}
|
|
967
|
-
async function
|
|
968
|
-
const e =
|
|
988
|
+
async function Ue(r, t) {
|
|
989
|
+
const e = X(r);
|
|
969
990
|
if (e && !t) return e;
|
|
970
|
-
const n = Y(r) ?? "EPSG:3857", i = t?.trim() || await
|
|
991
|
+
const n = Y(r) ?? "EPSG:3857", i = t?.trim() || await qr(n);
|
|
971
992
|
if (!i) return null;
|
|
972
993
|
const s = (await import("./index-CcLC9jE5.js")).default, a = s(i, "+proj=longlat +datum=WGS84 +no_defs");
|
|
973
994
|
return {
|
|
@@ -976,18 +997,18 @@ async function Oe(r, t) {
|
|
|
976
997
|
inverse: (l) => a.forward(l)
|
|
977
998
|
};
|
|
978
999
|
}
|
|
979
|
-
function
|
|
1000
|
+
function oe(r, t) {
|
|
980
1001
|
return !Number.isInteger(r) || r < 1 || r > 60 ? null : `+proj=utm +zone=${r}${t === "S" ? " +south" : ""} +datum=WGS84 +units=m +no_defs`;
|
|
981
1002
|
}
|
|
982
|
-
async function
|
|
1003
|
+
async function qr(r) {
|
|
983
1004
|
const t = Number(/^EPSG:(\d+)$/.exec(r)?.[1]);
|
|
984
1005
|
if (!Number.isFinite(t)) return null;
|
|
985
|
-
if (t >= 32601 && t <= 32660) return
|
|
986
|
-
if (t >= 32701 && t <= 32760) return
|
|
1006
|
+
if (t >= 32601 && t <= 32660) return oe(t - 32600, "N");
|
|
1007
|
+
if (t >= 32701 && t <= 32760) return oe(t - 32700, "S");
|
|
987
1008
|
const { CRS_DEFS: e } = await import("./crs-DsDQ4Q4i.js");
|
|
988
1009
|
return e[t]?.def ?? null;
|
|
989
1010
|
}
|
|
990
|
-
function
|
|
1011
|
+
function Wr(r, t) {
|
|
991
1012
|
const e = t.length, n = r.map((i, s) => [...i, t[s]]);
|
|
992
1013
|
for (let i = 0; i < e; i++) {
|
|
993
1014
|
let s = i;
|
|
@@ -1003,23 +1024,23 @@ function jr(r, t) {
|
|
|
1003
1024
|
}
|
|
1004
1025
|
return n.map((i, s) => i[e] / i[s]);
|
|
1005
1026
|
}
|
|
1006
|
-
function
|
|
1027
|
+
function Br(r, t) {
|
|
1007
1028
|
if (r.length !== 4 || t.length !== 4) return null;
|
|
1008
|
-
const e = r.reduce((
|
|
1009
|
-
for (let
|
|
1010
|
-
const [d,
|
|
1011
|
-
a.push([d,
|
|
1012
|
-
}
|
|
1013
|
-
const c =
|
|
1014
|
-
if (!c || c.some((
|
|
1015
|
-
const u = (
|
|
1029
|
+
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, s = i > 1e-12 ? Math.SQRT2 / i : 1, o = (h) => [(h[0] - e) * s, (h[1] - n) * s], a = [], l = [];
|
|
1030
|
+
for (let h = 0; h < 4; h++) {
|
|
1031
|
+
const [d, m] = o(r[h]), [f, g] = t[h];
|
|
1032
|
+
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);
|
|
1033
|
+
}
|
|
1034
|
+
const c = Wr(a, l);
|
|
1035
|
+
if (!c || c.some((h) => !Number.isFinite(h))) return null;
|
|
1036
|
+
const u = (h) => [h[0] / s + e, h[1] / s + n];
|
|
1016
1037
|
return { matrix: [c[0], c[1], c[2], c[3], c[4], c[5], c[6], c[7], 1], normalize: o, denormalize: u };
|
|
1017
1038
|
}
|
|
1018
|
-
function
|
|
1039
|
+
function se(r, [t, e]) {
|
|
1019
1040
|
const n = r[6] * t + r[7] * e + r[8];
|
|
1020
1041
|
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];
|
|
1021
1042
|
}
|
|
1022
|
-
function
|
|
1043
|
+
function Vr(r) {
|
|
1023
1044
|
const [t, e, n, i, s, o, a, l, c] = r, u = t * (s * c - o * l) - e * (i * c - o * a) + n * (i * l - s * a);
|
|
1024
1045
|
return !Number.isFinite(u) || Math.abs(u) < 1e-15 ? null : [
|
|
1025
1046
|
(s * c - o * l) / u,
|
|
@@ -1033,49 +1054,60 @@ function Gr(r) {
|
|
|
1033
1054
|
(t * s - e * i) / u
|
|
1034
1055
|
];
|
|
1035
1056
|
}
|
|
1036
|
-
function
|
|
1057
|
+
function Hr(r, t) {
|
|
1037
1058
|
let e = r;
|
|
1038
1059
|
for (; e - t > 180; ) e -= 360;
|
|
1039
1060
|
for (; t - e > 180; ) e += 360;
|
|
1040
1061
|
return e;
|
|
1041
1062
|
}
|
|
1042
|
-
const
|
|
1063
|
+
const ze = (r) => {
|
|
1043
1064
|
let t = ((r + 180) % 360 + 360) % 360 - 180;
|
|
1044
1065
|
return t === -180 && (t = 180), t;
|
|
1045
1066
|
};
|
|
1046
|
-
function
|
|
1047
|
-
const
|
|
1067
|
+
function mt({ corners: r, widthMm: t, heightMm: e, crsForward: n, continuous: i = !1 }) {
|
|
1068
|
+
const s = n ?? (i ? jr : _e), o = r[0][0], a = (b) => i ? b : Hr(b, o), l = (b) => i ? b : ze(b), c = r.map(([b, w]) => [a(b), w]), u = c.map((b) => s.forward(b)), h = [
|
|
1048
1069
|
[0, 0],
|
|
1049
1070
|
[t, 0],
|
|
1050
1071
|
[t, e],
|
|
1051
1072
|
[0, e]
|
|
1052
|
-
],
|
|
1053
|
-
|
|
1054
|
-
|
|
1073
|
+
], d = t > 0 && e > 0 ? Br(u, h) : null, m = d ? Vr(d.matrix) : null, f = !d || !m, g = (b, w = i ? 16 : 1) => {
|
|
1074
|
+
let y = 0, M = p.unproject(0, b);
|
|
1075
|
+
if (!M) return null;
|
|
1076
|
+
for (let v = 1; v <= w; v++) {
|
|
1077
|
+
const N = p.unproject(t * v / w, b);
|
|
1078
|
+
if (!N) return null;
|
|
1079
|
+
y += Ur(M, N), M = N;
|
|
1080
|
+
}
|
|
1081
|
+
return y;
|
|
1082
|
+
}, p = {
|
|
1083
|
+
crs: s.code,
|
|
1084
|
+
corners: c,
|
|
1055
1085
|
widthMm: t,
|
|
1056
1086
|
heightMm: e,
|
|
1057
|
-
degenerate:
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1087
|
+
degenerate: f,
|
|
1088
|
+
continuous: i,
|
|
1089
|
+
project(b) {
|
|
1090
|
+
if (!d) return null;
|
|
1091
|
+
const w = s.forward([a(b[0]), b[1]]), y = se(d.matrix, d.normalize(w));
|
|
1092
|
+
return y && Number.isFinite(y[0]) && Number.isFinite(y[1]) ? { xMm: y[0], yMm: y[1] } : null;
|
|
1062
1093
|
},
|
|
1063
|
-
unproject(
|
|
1064
|
-
if (!
|
|
1065
|
-
const
|
|
1066
|
-
if (!
|
|
1067
|
-
const
|
|
1068
|
-
return Number.isFinite(
|
|
1094
|
+
unproject(b, w) {
|
|
1095
|
+
if (!d || !m) return null;
|
|
1096
|
+
const y = se(m, [b, w]);
|
|
1097
|
+
if (!y) return null;
|
|
1098
|
+
const M = s.inverse(d.denormalize(y));
|
|
1099
|
+
return Number.isFinite(M[0]) && Number.isFinite(M[1]) ? [l(M[0]), M[1]] : null;
|
|
1069
1100
|
},
|
|
1070
1101
|
groundMetersPerMm() {
|
|
1071
|
-
if (
|
|
1072
|
-
const
|
|
1073
|
-
return
|
|
1074
|
-
}
|
|
1102
|
+
if (f || t <= 0) return 0;
|
|
1103
|
+
const b = g(e / 2);
|
|
1104
|
+
return b == null ? 0 : b / t;
|
|
1105
|
+
},
|
|
1106
|
+
rowGroundMeters: g
|
|
1075
1107
|
};
|
|
1076
|
-
return
|
|
1108
|
+
return p;
|
|
1077
1109
|
}
|
|
1078
|
-
function
|
|
1110
|
+
function dt(r) {
|
|
1079
1111
|
if (r == null || r.trim() === "") return null;
|
|
1080
1112
|
let t;
|
|
1081
1113
|
try {
|
|
@@ -1110,7 +1142,7 @@ function mt(r) {
|
|
|
1110
1142
|
}
|
|
1111
1143
|
return e;
|
|
1112
1144
|
}
|
|
1113
|
-
function
|
|
1145
|
+
function Kr(r) {
|
|
1114
1146
|
if (r.degenerate) return null;
|
|
1115
1147
|
const t = r.unproject(r.widthMm / 2, r.heightMm / 2);
|
|
1116
1148
|
if (!t) return null;
|
|
@@ -1119,18 +1151,18 @@ function Wr(r) {
|
|
|
1119
1151
|
const o = s.xMm - i.xMm, a = s.yMm - i.yMm;
|
|
1120
1152
|
return Math.abs(o) < 1e-12 && Math.abs(a) < 1e-12 ? null : (Math.atan2(o, -a) * Nt % 360 + 360) % 360;
|
|
1121
1153
|
}
|
|
1122
|
-
function
|
|
1154
|
+
function Yr(r) {
|
|
1123
1155
|
if (r.degenerate) return null;
|
|
1124
1156
|
const { widthMm: t, heightMm: e } = r, n = [];
|
|
1125
1157
|
for (const o of [0.02, 0.5, 0.98]) {
|
|
1126
|
-
const a = r.
|
|
1127
|
-
if (
|
|
1128
|
-
n.push(
|
|
1158
|
+
const a = r.rowGroundMeters(e * o);
|
|
1159
|
+
if (a == null || !(a > 0)) return null;
|
|
1160
|
+
n.push(a / t);
|
|
1129
1161
|
}
|
|
1130
1162
|
const i = Math.min(...n), s = Math.max(...n);
|
|
1131
1163
|
return i > 0 ? (s - i) / i : null;
|
|
1132
1164
|
}
|
|
1133
|
-
function
|
|
1165
|
+
function Yn(r, t, e, n) {
|
|
1134
1166
|
return [
|
|
1135
1167
|
[r, n],
|
|
1136
1168
|
[e, n],
|
|
@@ -1138,8 +1170,8 @@ function Vn(r, t, e, n) {
|
|
|
1138
1170
|
[r, t]
|
|
1139
1171
|
];
|
|
1140
1172
|
}
|
|
1141
|
-
const
|
|
1142
|
-
function
|
|
1173
|
+
const Xr = (r) => r.toLowerCase().startsWith("on");
|
|
1174
|
+
function Jr(r, t) {
|
|
1143
1175
|
const e = (n) => {
|
|
1144
1176
|
const i = n.tagName.toLowerCase();
|
|
1145
1177
|
if (i === "script") {
|
|
@@ -1150,7 +1182,7 @@ function Hr(r, t) {
|
|
|
1150
1182
|
if (i === "style" || i === "link" || i === "iframe" || i === "object" || i === "embed") return null;
|
|
1151
1183
|
const s = t.createElement(i);
|
|
1152
1184
|
for (const o of n.attributes)
|
|
1153
|
-
|
|
1185
|
+
Xr(o.name) || /^\s*javascript:/i.test(o.value) || s.setAttribute(o.name, o.value);
|
|
1154
1186
|
for (const o of n.childNodes)
|
|
1155
1187
|
if (o.nodeType === 3) s.appendChild(t.createTextNode(o.textContent ?? ""));
|
|
1156
1188
|
else if (o.nodeType === 1) {
|
|
@@ -1161,16 +1193,16 @@ function Hr(r, t) {
|
|
|
1161
1193
|
};
|
|
1162
1194
|
return e(r);
|
|
1163
1195
|
}
|
|
1164
|
-
async function
|
|
1196
|
+
async function Zr(r, t = document) {
|
|
1165
1197
|
const e = await fetch(r, { credentials: "same-origin" });
|
|
1166
1198
|
if (!e.ok) throw new Error(`fetching ${r} failed with HTTP ${e.status}`);
|
|
1167
1199
|
const n = await e.text(), s = new DOMParser().parseFromString(n, "text/html").querySelector("om-map");
|
|
1168
1200
|
if (!s) throw new Error(`${r} contains no <om-map>`);
|
|
1169
|
-
const o =
|
|
1201
|
+
const o = Jr(s, t);
|
|
1170
1202
|
if (!o) throw new Error(`${r} could not be adopted`);
|
|
1171
1203
|
return o;
|
|
1172
1204
|
}
|
|
1173
|
-
function
|
|
1205
|
+
function ct(r) {
|
|
1174
1206
|
const t = r.getAttribute("center"), e = r.getAttribute("zoom");
|
|
1175
1207
|
if (!t || e == null || e.trim() === "") return null;
|
|
1176
1208
|
const n = Number(e);
|
|
@@ -1191,7 +1223,7 @@ function Q(r) {
|
|
|
1191
1223
|
pitch: Number(r.getAttribute("pitch")) || 0
|
|
1192
1224
|
};
|
|
1193
1225
|
}
|
|
1194
|
-
function
|
|
1226
|
+
function Xn(r, t, e, n, i = 60) {
|
|
1195
1227
|
const s = (l) => Pt(r, { ...t, pitch: l }, e, n) !== null;
|
|
1196
1228
|
if (s(i)) return i;
|
|
1197
1229
|
if (!s(0)) return 0;
|
|
@@ -1220,29 +1252,29 @@ function Pt(r, t, e, n) {
|
|
|
1220
1252
|
], o = [];
|
|
1221
1253
|
for (const a of s) {
|
|
1222
1254
|
const l = i.unproject(a);
|
|
1223
|
-
if (!l || !Number.isFinite(l[0]) || !Number.isFinite(l[1])
|
|
1255
|
+
if (!l || !Number.isFinite(l[0]) || !Number.isFinite(l[1])) return null;
|
|
1224
1256
|
o.push([l[0], l[1]]);
|
|
1225
1257
|
}
|
|
1226
1258
|
return o;
|
|
1227
1259
|
}
|
|
1228
|
-
async function
|
|
1260
|
+
async function Qr(r) {
|
|
1229
1261
|
const t = await we(), e = r.querySelector(":scope > om-map");
|
|
1230
1262
|
if (e) return { core: t, map: e };
|
|
1231
1263
|
const n = r.getAttribute("src");
|
|
1232
1264
|
if (!n) throw new Error("a live frame needs src= or an inline <om-map> child");
|
|
1233
|
-
const i = await
|
|
1265
|
+
const i = await Zr(n, r.ownerDocument);
|
|
1234
1266
|
return { core: t, map: i };
|
|
1235
1267
|
}
|
|
1236
1268
|
function At(r, t) {
|
|
1237
|
-
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)),
|
|
1269
|
+
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)), tn(r, t);
|
|
1238
1270
|
}
|
|
1239
|
-
function
|
|
1271
|
+
function tn(r, t) {
|
|
1240
1272
|
const e = r;
|
|
1241
1273
|
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 });
|
|
1242
1274
|
}
|
|
1243
1275
|
const St = "data-om-carto-placeholder", Ct = "data-om-carto-overview", ae = "http://www.w3.org/2000/svg", le = 24, ce = 0.25;
|
|
1244
|
-
class
|
|
1245
|
-
static observedAttributes = [...
|
|
1276
|
+
class De extends R {
|
|
1277
|
+
static observedAttributes = [...T["om-frame"]];
|
|
1246
1278
|
/** Resolved non-builtin CRS planes, so a re-render does not re-await proj4. */
|
|
1247
1279
|
resolvedForward = null;
|
|
1248
1280
|
resolvedForwardKey = null;
|
|
@@ -1277,6 +1309,8 @@ class Ue extends R {
|
|
|
1277
1309
|
liveMapOwned = !1;
|
|
1278
1310
|
/** A capture standing in for the live map during export/print. */
|
|
1279
1311
|
captureImage = null;
|
|
1312
|
+
/** The authored camera last driven into the map, so a re-render can tell an edit from a repaint. */
|
|
1313
|
+
appliedCameraKey = null;
|
|
1280
1314
|
printing = !1;
|
|
1281
1315
|
get mode() {
|
|
1282
1316
|
return this.getAttribute("mode") === "static" ? "static" : "live";
|
|
@@ -1292,15 +1326,15 @@ class Ue extends R {
|
|
|
1292
1326
|
* than caching it correctly.
|
|
1293
1327
|
*/
|
|
1294
1328
|
get georef() {
|
|
1295
|
-
const { w: t, h: e } =
|
|
1329
|
+
const { w: t, h: e } = C(this);
|
|
1296
1330
|
if (t <= 0 || e <= 0) return null;
|
|
1297
1331
|
if (this.mode === "live")
|
|
1298
|
-
return this.liveCorners ?
|
|
1299
|
-
const n =
|
|
1332
|
+
return this.liveCorners ? mt({ corners: this.liveCorners, widthMm: t, heightMm: e, continuous: !0 }) : null;
|
|
1333
|
+
const n = dt(this.getAttribute("corners"));
|
|
1300
1334
|
if (!n) return null;
|
|
1301
1335
|
const i = Y(this.getAttribute("crs")) ?? "EPSG:3857", s = this.getAttribute("crs-def");
|
|
1302
|
-
let o = s ? null :
|
|
1303
|
-
return !o && this.resolvedForwardKey === `${i}|${s ?? ""}` && (o = this.resolvedForward), o ?
|
|
1336
|
+
let o = s ? null : X(i);
|
|
1337
|
+
return !o && this.resolvedForwardKey === `${i}|${s ?? ""}` && (o = this.resolvedForward), o ? mt({ corners: n, widthMm: t, heightMm: e, crsForward: o }) : null;
|
|
1304
1338
|
}
|
|
1305
1339
|
/** The raster a static frame draws — its first <img> child, if any. */
|
|
1306
1340
|
get raster() {
|
|
@@ -1336,9 +1370,9 @@ class Ue extends R {
|
|
|
1336
1370
|
}
|
|
1337
1371
|
t.style.position = "absolute", t.style.inset = "0", t.style.width = "100%", t.style.height = "100%", t.style.objectFit = "fill", t.style.display = "block";
|
|
1338
1372
|
const e = Y(this.getAttribute("crs")) ?? "EPSG:3857", n = this.getAttribute("crs-def"), i = `${e}|${n ?? ""}`;
|
|
1339
|
-
if ((n != null ||
|
|
1373
|
+
if ((n != null || X(e) == null) && this.resolvedForwardKey !== i) {
|
|
1340
1374
|
const o = ++this.resolveToken;
|
|
1341
|
-
this.resolvedForward = null, this.resolvedForwardKey = null,
|
|
1375
|
+
this.resolvedForward = null, this.resolvedForwardKey = null, Ue(e, n).then((a) => {
|
|
1342
1376
|
if (o === this.resolveToken) {
|
|
1343
1377
|
if (!a) {
|
|
1344
1378
|
this.showPlaceholder("unknown-crs", `Unknown CRS "${e}" — supply crs-def="+proj=…".`);
|
|
@@ -1351,7 +1385,7 @@ class Ue extends R {
|
|
|
1351
1385
|
});
|
|
1352
1386
|
return;
|
|
1353
1387
|
}
|
|
1354
|
-
if (!
|
|
1388
|
+
if (!dt(this.getAttribute("corners"))) {
|
|
1355
1389
|
this.showPlaceholder("bad-corners", 'Static frame needs corners="[[lng,lat] × 4]" (tl, tr, br, bl).');
|
|
1356
1390
|
return;
|
|
1357
1391
|
}
|
|
@@ -1363,25 +1397,26 @@ class Ue extends R {
|
|
|
1363
1397
|
renderLive() {
|
|
1364
1398
|
const t = this.raster;
|
|
1365
1399
|
t && (t.style.display = "none");
|
|
1366
|
-
const e =
|
|
1400
|
+
const e = ct(this);
|
|
1367
1401
|
if (!e) {
|
|
1368
1402
|
this.showPlaceholder("no-camera", 'Live frame needs its own camera — center="[lng, lat]" and zoom=.');
|
|
1369
1403
|
return;
|
|
1370
1404
|
}
|
|
1371
|
-
|
|
1372
|
-
|
|
1405
|
+
const n = JSON.stringify(e), i = n !== this.appliedCameraKey;
|
|
1406
|
+
this.appliedCameraKey = n, this.updateLiveCorners(i ? e : this.liveCamera() ?? e);
|
|
1407
|
+
const s = this.liveSource();
|
|
1373
1408
|
if (this.liveMap)
|
|
1374
|
-
if (this.mountedSource !==
|
|
1409
|
+
if (this.mountedSource !== s)
|
|
1375
1410
|
this.releaseLiveMap();
|
|
1376
1411
|
else {
|
|
1377
1412
|
At(this.liveMap, e), this.sizeLiveMap();
|
|
1378
1413
|
return;
|
|
1379
1414
|
}
|
|
1380
1415
|
if (this.mounting) {
|
|
1381
|
-
if (this.mountingSource ===
|
|
1416
|
+
if (this.mountingSource === s) return;
|
|
1382
1417
|
this.abandonMount();
|
|
1383
1418
|
}
|
|
1384
|
-
this.mountLive(
|
|
1419
|
+
this.mountLive(s);
|
|
1385
1420
|
}
|
|
1386
1421
|
/** Inline maps are identified by node identity; fetched maps by their src=. */
|
|
1387
1422
|
liveSource() {
|
|
@@ -1394,31 +1429,44 @@ class Ue extends R {
|
|
|
1394
1429
|
this.mounting && this.abandonMount(), this.captureImage = null, this.liveMap && (this.liveMapOwned ? this.releaseLiveMap() : this.liveMap.hidden = !0);
|
|
1395
1430
|
}
|
|
1396
1431
|
releaseLiveMap() {
|
|
1397
|
-
this.liveMap?.removeEventListener("om-view-changed", this.
|
|
1432
|
+
this.liveMap?.removeEventListener("om-view-changed", this.onLiveViewSettled), this.liveMapOwned ? this.liveMap?.remove() : this.liveMap && (this.liveMap.hidden = !0), this.liveMap = null, this.liveMapOwned = !1, this.mountedSource = null, this.liveCorners = null, this.captureImage = null;
|
|
1398
1433
|
}
|
|
1399
|
-
|
|
1434
|
+
/** The mounted map's own camera, or null before it can report one. */
|
|
1435
|
+
liveCamera() {
|
|
1436
|
+
const t = this.liveMap?.getViewStateInternal?.();
|
|
1437
|
+
return t ? { center: [t.longitude, t.latitude], zoom: t.zoom, bearing: t.bearing, pitch: t.pitch } : null;
|
|
1438
|
+
}
|
|
1439
|
+
/**
|
|
1440
|
+
* The map settled somewhere new. Re-derive the georeference from where it
|
|
1441
|
+
* actually is, and tell the page — its north arrow, scale bar, graticule,
|
|
1442
|
+
* locator inset and {{scale}} tokens all describe THIS view now. A frozen
|
|
1443
|
+
* frame captures these corners too, so a freeze after a rotate places the
|
|
1444
|
+
* raster by the view that was captured, not the one that was authored.
|
|
1445
|
+
*/
|
|
1446
|
+
onLiveViewSettled = () => {
|
|
1447
|
+
const t = this.liveCamera();
|
|
1448
|
+
t && this.updateLiveCorners(t);
|
|
1449
|
+
};
|
|
1450
|
+
updateLiveCorners(t = ct(this)) {
|
|
1400
1451
|
if (!t) return;
|
|
1401
|
-
const e =
|
|
1452
|
+
const e = H();
|
|
1402
1453
|
if (!e) return;
|
|
1403
|
-
const { w: n, h: i } =
|
|
1404
|
-
this.liveCorners = s, s ? this.lastError === "degenerate-view" && this.clearPlaceholder() : this.showPlaceholder(
|
|
1405
|
-
"degenerate-view",
|
|
1406
|
-
"This camera cannot be georeferenced — the frame's top edge reaches the horizon. Reduce pitch below ~60°."
|
|
1407
|
-
);
|
|
1454
|
+
const { w: n, h: i } = C(this), s = Pt(e, t, n * W, i * W), o = JSON.stringify(s) !== JSON.stringify(this.liveCorners);
|
|
1455
|
+
this.liveCorners = s, o && this.liveMap && this.dispatchEvent(new CustomEvent("om-frame-view", { bubbles: !0, detail: { id: this.id } })), 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.");
|
|
1408
1456
|
}
|
|
1409
1457
|
async mountLive(t) {
|
|
1410
1458
|
const e = ++this.mountToken;
|
|
1411
1459
|
this.mounting = !0, this.mountingSource = t;
|
|
1412
1460
|
try {
|
|
1413
|
-
const { core: n, map: i } = await
|
|
1461
|
+
const { core: n, map: i } = await Qr(this);
|
|
1414
1462
|
if (e !== this.mountToken || !this.isConnected || this.mode !== "live" || this.liveSource() !== t) return;
|
|
1415
|
-
const s =
|
|
1463
|
+
const s = ct(this);
|
|
1416
1464
|
if (!s) return;
|
|
1417
|
-
At(i, s);
|
|
1465
|
+
this.appliedCameraKey = JSON.stringify(s), At(i, s);
|
|
1418
1466
|
const o = i;
|
|
1419
|
-
o.style.position = "absolute", o.style.inset = "0", o.style.display = "block", this.liveMapOwned = i.parentElement !== this, this.liveMapOwned && this.appendChild(i), i.setAttribute("data-om-carto-frame", ""), this.liveMap = o, o.addEventListener("om-view-changed", this.
|
|
1420
|
-
const { w: a, h: l } =
|
|
1421
|
-
if (this.liveCorners = Pt(n, s, a *
|
|
1467
|
+
o.style.position = "absolute", o.style.inset = "0", o.style.display = "block", this.liveMapOwned = i.parentElement !== this, this.liveMapOwned && this.appendChild(i), i.setAttribute("data-om-carto-frame", ""), this.liveMap = o, o.addEventListener("om-view-changed", this.onLiveViewSettled), this.mountedSource = t, this.sizeLiveMap(), this.clearPlaceholder();
|
|
1468
|
+
const { w: a, h: l } = C(this);
|
|
1469
|
+
if (this.liveCorners = Pt(n, s, a * W, l * W), await o.ready, e !== this.mountToken || (At(i, s), await o.whenSettled?.({ timeout: 2e4 }), e !== this.mountToken)) return;
|
|
1422
1470
|
this.signalReady();
|
|
1423
1471
|
} catch (n) {
|
|
1424
1472
|
if (e !== this.mountToken) return;
|
|
@@ -1429,7 +1477,7 @@ class Ue extends R {
|
|
|
1429
1477
|
}
|
|
1430
1478
|
}
|
|
1431
1479
|
sizeLiveMap() {
|
|
1432
|
-
this.liveMap && (this.liveMap.style.width = "100%", this.liveMap.style.height = "100%", this.liveMap.hidden = this.printing
|
|
1480
|
+
this.liveMap && (this.liveMap.style.width = "100%", this.liveMap.style.height = "100%", this.liveMap.hidden = this.printing);
|
|
1433
1481
|
}
|
|
1434
1482
|
/**
|
|
1435
1483
|
* Stop the adopted map tilting past what this frame can georeference.
|
|
@@ -1440,24 +1488,6 @@ class Ue extends R {
|
|
|
1440
1488
|
* is the frame's own, recomputed whenever its box changes, because it
|
|
1441
1489
|
* depends on the box's aspect and the current zoom.
|
|
1442
1490
|
*/
|
|
1443
|
-
capMapPitch() {
|
|
1444
|
-
const t = G();
|
|
1445
|
-
if (!t || !this.liveMap) return;
|
|
1446
|
-
const e = this.liveMap.getViewStateInternal?.(), n = e ? { center: [e.longitude, e.latitude], zoom: e.zoom, bearing: e.bearing, pitch: e.pitch } : Q(this);
|
|
1447
|
-
if (!n) return;
|
|
1448
|
-
const { w: i, h: s } = S(this), o = Kr(t, n, i * z, s * z), a = o >= 60 ? null : String(o);
|
|
1449
|
-
a !== this.liveMap.getAttribute("max-pitch") && (a === null ? this.liveMap.removeAttribute("max-pitch") : this.liveMap.setAttribute("max-pitch", a));
|
|
1450
|
-
}
|
|
1451
|
-
/**
|
|
1452
|
-
* The ceiling follows the camera, so a zoom changes it.
|
|
1453
|
-
*
|
|
1454
|
-
* Bound once so add/remove pair up. Cheap enough to run on every reported
|
|
1455
|
-
* view: a probe is four unprojections and the attribute is only written when
|
|
1456
|
-
* the whole-degree answer actually moves.
|
|
1457
|
-
*/
|
|
1458
|
-
onLiveViewChanged = () => {
|
|
1459
|
-
this.capMapPitch();
|
|
1460
|
-
};
|
|
1461
1491
|
// -------------------------------------------------------------------------
|
|
1462
1492
|
// Locator inset (overview-of)
|
|
1463
1493
|
// -------------------------------------------------------------------------
|
|
@@ -1478,25 +1508,25 @@ class Ue extends R {
|
|
|
1478
1508
|
e?.remove();
|
|
1479
1509
|
return;
|
|
1480
1510
|
}
|
|
1481
|
-
const { w: o, h: a } =
|
|
1511
|
+
const { w: o, h: a } = C(this), l = [], [c, u, h, d] = s.corners, m = [
|
|
1482
1512
|
[c, u],
|
|
1483
|
-
[u,
|
|
1484
|
-
[
|
|
1513
|
+
[u, h],
|
|
1514
|
+
[h, d],
|
|
1485
1515
|
[d, c]
|
|
1486
1516
|
];
|
|
1487
|
-
for (const [b, w] of
|
|
1517
|
+
for (const [b, w] of m)
|
|
1488
1518
|
for (let y = 0; y < le; y++) {
|
|
1489
|
-
const
|
|
1490
|
-
|
|
1519
|
+
const M = y / le, v = [b[0] + (w[0] - b[0]) * M, b[1] + (w[1] - b[1]) * M], N = i.project(v);
|
|
1520
|
+
N && l.push(`${N.xMm.toFixed(3)},${N.yMm.toFixed(3)}`);
|
|
1491
1521
|
}
|
|
1492
1522
|
if (l.length < 3) {
|
|
1493
1523
|
e?.remove();
|
|
1494
1524
|
return;
|
|
1495
1525
|
}
|
|
1496
|
-
const f = this.ownerDocument,
|
|
1497
|
-
|
|
1498
|
-
const
|
|
1499
|
-
|
|
1526
|
+
const f = this.ownerDocument, g = e ?? f.createElementNS(ae, "svg");
|
|
1527
|
+
g.setAttribute(Ct, ""), g.setAttribute("width", `${o}mm`), g.setAttribute("height", `${a}mm`), g.setAttribute("viewBox", `0 0 ${o} ${a}`), g.style.cssText = "position:absolute;inset:0;pointer-events:none;", g.replaceChildren();
|
|
1528
|
+
const p = f.createElementNS(ae, "polygon");
|
|
1529
|
+
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);
|
|
1500
1530
|
}
|
|
1501
1531
|
// -------------------------------------------------------------------------
|
|
1502
1532
|
// Readiness and errors
|
|
@@ -1544,11 +1574,11 @@ class Ue extends R {
|
|
|
1544
1574
|
* follows from the same source as any authored camera.
|
|
1545
1575
|
*/
|
|
1546
1576
|
fitBounds(t) {
|
|
1547
|
-
const [e, n, i, s] = t, { w: o, h: a } =
|
|
1577
|
+
const [e, n, i, s] = t, { w: o, h: a } = C(this);
|
|
1548
1578
|
if (o <= 0 || a <= 0) return;
|
|
1549
|
-
const l =
|
|
1579
|
+
const l = H();
|
|
1550
1580
|
if (!l) return;
|
|
1551
|
-
const c = new l.WebMercatorViewport({ width: o *
|
|
1581
|
+
const c = new l.WebMercatorViewport({ width: o * W, height: a * W, longitude: 0, latitude: 0, zoom: 0 }).fitBounds([
|
|
1552
1582
|
[e, n],
|
|
1553
1583
|
[i, s]
|
|
1554
1584
|
]);
|
|
@@ -1577,14 +1607,14 @@ class Ue extends R {
|
|
|
1577
1607
|
this.printing = !1, this.querySelector(":scope > img[data-om-carto-print]")?.remove(), this.liveMap && (this.liveMap.hidden = !1);
|
|
1578
1608
|
}
|
|
1579
1609
|
paintCartograph(t, e) {
|
|
1580
|
-
const { w: n, h: i } =
|
|
1610
|
+
const { w: n, h: i } = C(this), s = n * e.pxPerMm, o = i * e.pxPerMm;
|
|
1581
1611
|
if (s <= 0 || o <= 0) return;
|
|
1582
|
-
const a = typeof getComputedStyle == "function" ? getComputedStyle(this) : null, l =
|
|
1612
|
+
const a = typeof getComputedStyle == "function" ? getComputedStyle(this) : null, l = F(a?.backgroundColor);
|
|
1583
1613
|
l && (t.fillStyle = l, t.fillRect(0, 0, s, o));
|
|
1584
1614
|
const c = this.mode === "static" ? this.raster : this.captureImage;
|
|
1585
1615
|
c && c.complete && c.naturalWidth > 0 && t.drawImage(c, 0, 0, s, o), this.paintOverview(t, e);
|
|
1586
|
-
const u = this.getAttribute("frame-stroke") ||
|
|
1587
|
-
|
|
1616
|
+
const u = this.getAttribute("frame-stroke") || F(a?.getPropertyValue("--om-carto-frame-stroke")?.trim()) || "#333333", h = ce * e.pxPerMm;
|
|
1617
|
+
h > 0 && (t.strokeStyle = u, t.lineWidth = h, t.strokeRect(h / 2, h / 2, s - h, o - h));
|
|
1588
1618
|
}
|
|
1589
1619
|
paintOverview(t, e) {
|
|
1590
1620
|
const n = this.querySelector(`:scope > [${Ct}] polygon`), i = n?.getAttribute("points");
|
|
@@ -1594,45 +1624,45 @@ class Ue extends R {
|
|
|
1594
1624
|
}), t.closePath(), t.stroke(), t.restore());
|
|
1595
1625
|
}
|
|
1596
1626
|
}
|
|
1597
|
-
x("om-frame",
|
|
1598
|
-
const it = "http://www.w3.org/2000/svg",
|
|
1599
|
-
class
|
|
1600
|
-
static observedAttributes = [...
|
|
1627
|
+
x("om-frame", De);
|
|
1628
|
+
const it = "http://www.w3.org/2000/svg", en = ["single", "double", "line", "ticks"];
|
|
1629
|
+
class je extends R {
|
|
1630
|
+
static observedAttributes = [...T["om-scalebar"]];
|
|
1601
1631
|
/** The geometry currently drawn — reused by the canvas exporter. */
|
|
1602
1632
|
get drawing() {
|
|
1603
|
-
const e =
|
|
1633
|
+
const e = _(this)?.georef;
|
|
1604
1634
|
if (!e) return null;
|
|
1605
|
-
const { w: n, h: i } =
|
|
1635
|
+
const { w: n, h: i } = C(this), s = $e({
|
|
1606
1636
|
groundMetersPerMm: e.groundMetersPerMm(),
|
|
1607
1637
|
maxWidthMm: n,
|
|
1608
1638
|
segments: Number(this.getAttribute("segments")) || void 0,
|
|
1609
1639
|
units: this.unitSystem,
|
|
1610
1640
|
segmentLengthMeters: this.getAttribute("segment-length") ? Number(this.getAttribute("segment-length")) : null
|
|
1611
1641
|
});
|
|
1612
|
-
return s ?
|
|
1642
|
+
return s ? Sr(s, this.barStyle, i) : null;
|
|
1613
1643
|
}
|
|
1614
1644
|
get barStyle() {
|
|
1615
1645
|
const t = this.getAttribute("kind");
|
|
1616
|
-
return
|
|
1646
|
+
return en.includes(t) ? t : "single";
|
|
1617
1647
|
}
|
|
1618
1648
|
get unitSystem() {
|
|
1619
|
-
return
|
|
1649
|
+
return Ar(this.getAttribute("units")) ?? "metric";
|
|
1620
1650
|
}
|
|
1621
1651
|
renderNow() {
|
|
1622
|
-
if (this.applyPlacement(), this.style.display = "block", !
|
|
1652
|
+
if (this.applyPlacement(), this.style.display = "block", !_(this)) {
|
|
1623
1653
|
const n = this.getAttribute("for");
|
|
1624
|
-
|
|
1654
|
+
G(this, n ? `Scale bar references no frame with id "${n}".` : "Scale bar has no frame to measure (set for=).");
|
|
1625
1655
|
return;
|
|
1626
1656
|
}
|
|
1627
1657
|
const e = this.drawing;
|
|
1628
1658
|
if (!e) {
|
|
1629
|
-
|
|
1659
|
+
G(this, "Scale bar cannot derive a scale from this frame yet.");
|
|
1630
1660
|
return;
|
|
1631
1661
|
}
|
|
1632
1662
|
this.renderSvg(e);
|
|
1633
1663
|
}
|
|
1634
1664
|
renderSvg(t) {
|
|
1635
|
-
const { w: e, h: n } =
|
|
1665
|
+
const { w: e, h: n } = C(this), i = this.ownerDocument, s = i.createElementNS(it, "svg");
|
|
1636
1666
|
s.setAttribute("width", `${e}mm`), s.setAttribute("height", `${n}mm`), s.setAttribute("viewBox", `0 0 ${e} ${n}`), s.setAttribute("part", "scalebar"), s.style.display = "block", s.style.overflow = "visible";
|
|
1637
1667
|
const o = "var(--om-carto-scalebar-ink)";
|
|
1638
1668
|
for (const a of t.bars) {
|
|
@@ -1652,7 +1682,7 @@ class ze extends R {
|
|
|
1652
1682
|
paintCartograph(t, e) {
|
|
1653
1683
|
const n = this.drawing;
|
|
1654
1684
|
if (!n) return;
|
|
1655
|
-
const i = typeof getComputedStyle == "function" ? getComputedStyle(this) : null, s =
|
|
1685
|
+
const i = typeof getComputedStyle == "function" ? getComputedStyle(this) : null, s = F(i?.color) ?? "#000", o = (l) => l * e.pxPerMm;
|
|
1656
1686
|
t.strokeStyle = s, t.fillStyle = s, t.lineWidth = o(n.strokeMm);
|
|
1657
1687
|
for (const l of n.bars)
|
|
1658
1688
|
l.filled && t.fillRect(o(l.x), o(l.y), o(l.w), o(l.h)), t.strokeRect(o(l.x), o(l.y), o(l.w), o(l.h));
|
|
@@ -1666,32 +1696,32 @@ class ze extends R {
|
|
|
1666
1696
|
t.textAlign = l.anchor === "middle" ? "center" : l.anchor === "end" ? "right" : "left", t.fillText(l.text, o(l.x), o(l.y));
|
|
1667
1697
|
}
|
|
1668
1698
|
}
|
|
1669
|
-
x("om-scalebar",
|
|
1670
|
-
const
|
|
1671
|
-
class
|
|
1672
|
-
static observedAttributes = [...
|
|
1699
|
+
x("om-scalebar", je);
|
|
1700
|
+
const Q = "http://www.w3.org/2000/svg";
|
|
1701
|
+
class Ge extends R {
|
|
1702
|
+
static observedAttributes = [...T["om-north"]];
|
|
1673
1703
|
/** Degrees clockwise from the page's "up", or null when unknowable. */
|
|
1674
1704
|
get bearing() {
|
|
1675
|
-
const t =
|
|
1676
|
-
return t ?
|
|
1705
|
+
const t = _(this)?.georef;
|
|
1706
|
+
return t ? Kr(t) : null;
|
|
1677
1707
|
}
|
|
1678
1708
|
get indicatorKind() {
|
|
1679
1709
|
return this.getAttribute("kind") === "rose" ? "rose" : "arrow";
|
|
1680
1710
|
}
|
|
1681
1711
|
renderNow() {
|
|
1682
|
-
if (this.applyPlacement(), this.style.display = "block", !
|
|
1712
|
+
if (this.applyPlacement(), this.style.display = "block", !_(this)) {
|
|
1683
1713
|
const l = this.getAttribute("for");
|
|
1684
|
-
|
|
1714
|
+
G(this, l ? `North indicator references no frame with id "${l}".` : "North indicator has no frame (set for=).");
|
|
1685
1715
|
return;
|
|
1686
1716
|
}
|
|
1687
1717
|
const e = this.bearing;
|
|
1688
1718
|
if (e == null) {
|
|
1689
|
-
|
|
1719
|
+
G(this, "North indicator cannot derive a direction from this frame yet.");
|
|
1690
1720
|
return;
|
|
1691
1721
|
}
|
|
1692
|
-
const { w: n, h: i } =
|
|
1722
|
+
const { w: n, h: i } = C(this), s = this.ownerDocument, o = s.createElementNS(Q, "svg");
|
|
1693
1723
|
o.setAttribute("width", `${n}mm`), o.setAttribute("height", `${i}mm`), o.setAttribute("viewBox", `0 0 ${n} ${i}`), o.style.display = "block";
|
|
1694
|
-
const a = s.createElementNS(
|
|
1724
|
+
const a = s.createElementNS(Q, "g");
|
|
1695
1725
|
a.setAttribute("transform", `rotate(${e.toFixed(3)} ${n / 2} ${i / 2})`);
|
|
1696
1726
|
for (const l of this.buildGeometry(s, n, i)) a.appendChild(l);
|
|
1697
1727
|
o.appendChild(a), this.replaceChildren(o);
|
|
@@ -1699,28 +1729,28 @@ class je extends R {
|
|
|
1699
1729
|
buildGeometry(t, e, n) {
|
|
1700
1730
|
const i = "var(--om-carto-compass-ink)", s = [], o = e / 2, a = Math.min(3, n * 0.24), l = n - a * 1.2;
|
|
1701
1731
|
if (this.indicatorKind === "rose") {
|
|
1702
|
-
const f = Math.min(e, l) / 2,
|
|
1703
|
-
|
|
1732
|
+
const f = Math.min(e, l) / 2, g = t.createElementNS(Q, "circle");
|
|
1733
|
+
g.setAttribute("cx", String(o)), 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"), s.push(g);
|
|
1704
1734
|
}
|
|
1705
|
-
const c = 0, u = l,
|
|
1706
|
-
d.setAttribute("d", `M ${o} ${c} L ${o +
|
|
1707
|
-
const
|
|
1708
|
-
return
|
|
1735
|
+
const c = 0, u = l, h = Math.min(e * 0.3, 4), d = t.createElementNS(Q, "path");
|
|
1736
|
+
d.setAttribute("d", `M ${o} ${c} L ${o + h} ${u} L ${o} ${u - h * 0.55} L ${o - h} ${u} Z`), d.setAttribute("fill", i), s.push(d);
|
|
1737
|
+
const m = t.createElementNS(Q, "text");
|
|
1738
|
+
return m.setAttribute("x", String(o)), 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", s.push(m), s;
|
|
1709
1739
|
}
|
|
1710
1740
|
paintCartograph(t, e) {
|
|
1711
1741
|
const n = this.bearing;
|
|
1712
1742
|
if (n == null) return;
|
|
1713
|
-
const { w: i, h: s } =
|
|
1714
|
-
t.save(), t.translate(l(
|
|
1743
|
+
const { w: i, h: s } = C(this), o = typeof getComputedStyle == "function" ? getComputedStyle(this) : null, a = F(o?.color) ?? "#000", l = (m) => m * e.pxPerMm, c = Math.min(3, s * 0.24), u = s - c * 1.2, h = i / 2, d = Math.min(i * 0.3, 4);
|
|
1744
|
+
t.save(), t.translate(l(h), l(s / 2)), t.rotate(n * Math.PI / 180), t.translate(-l(h), -l(s / 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 ${o?.fontFamily || "system-ui, sans-serif"}`, t.textAlign = "center", t.textBaseline = "alphabetic", t.fillText("N", l(h), l(s)), t.restore();
|
|
1715
1745
|
}
|
|
1716
1746
|
}
|
|
1717
|
-
x("om-north",
|
|
1718
|
-
const ot = "http://www.w3.org/2000/svg",
|
|
1719
|
-
class
|
|
1720
|
-
static observedAttributes = [...
|
|
1747
|
+
x("om-north", Ge);
|
|
1748
|
+
const ot = "http://www.w3.org/2000/svg", rn = ["rect", "ellipse", "line", "arrow"];
|
|
1749
|
+
class qe extends R {
|
|
1750
|
+
static observedAttributes = [...T["om-shape"]];
|
|
1721
1751
|
get kind() {
|
|
1722
1752
|
const t = this.getAttribute("kind");
|
|
1723
|
-
return
|
|
1753
|
+
return rn.includes(t) ? t : "rect";
|
|
1724
1754
|
}
|
|
1725
1755
|
get fill() {
|
|
1726
1756
|
return this.getAttribute("fill") || "var(--om-carto-shape-fill)";
|
|
@@ -1746,7 +1776,7 @@ class De extends R {
|
|
|
1746
1776
|
}
|
|
1747
1777
|
renderNow() {
|
|
1748
1778
|
this.applyPlacement(), this.style.display = "block";
|
|
1749
|
-
const { w: t, h: e } =
|
|
1779
|
+
const { w: t, h: e } = C(this), n = this.ownerDocument, i = n.createElementNS(ot, "svg");
|
|
1750
1780
|
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";
|
|
1751
1781
|
const s = this.strokeWidthMm / 2, o = this.kind;
|
|
1752
1782
|
let a;
|
|
@@ -1760,15 +1790,15 @@ class De extends R {
|
|
|
1760
1790
|
return `M 0 0 L ${s} ${o} M ${s} ${o} L ${a.x} ${a.y} L ${l.x} ${l.y} Z`;
|
|
1761
1791
|
}
|
|
1762
1792
|
paintCartograph(t, e) {
|
|
1763
|
-
const { w: n, h: i } =
|
|
1793
|
+
const { w: n, h: i } = C(this);
|
|
1764
1794
|
if (n <= 0 || i <= 0) return;
|
|
1765
|
-
const s = typeof getComputedStyle == "function" ? getComputedStyle(this) : null, o = (d) => d * e.pxPerMm, a = this.getAttribute("fill") || s?.getPropertyValue("--om-carto-shape-fill")?.trim() || "#cccccc", l = this.getAttribute("stroke") || s?.getPropertyValue("--om-carto-shape-stroke")?.trim() || "#333333", c = o(this.strokeWidthMm), u = c / 2,
|
|
1766
|
-
if (t.save(), t.globalAlpha = this.fillOpacity, t.fillStyle = a, t.strokeStyle = l, t.lineWidth = c,
|
|
1795
|
+
const s = typeof getComputedStyle == "function" ? getComputedStyle(this) : null, o = (d) => d * e.pxPerMm, a = this.getAttribute("fill") || s?.getPropertyValue("--om-carto-shape-fill")?.trim() || "#cccccc", l = this.getAttribute("stroke") || s?.getPropertyValue("--om-carto-shape-stroke")?.trim() || "#333333", c = o(this.strokeWidthMm), u = c / 2, h = this.kind;
|
|
1796
|
+
if (t.save(), t.globalAlpha = this.fillOpacity, t.fillStyle = a, t.strokeStyle = l, t.lineWidth = c, h === "ellipse")
|
|
1767
1797
|
t.beginPath(), t.ellipse(o(n / 2), o(i / 2), Math.max(0, o(n / 2) - u), Math.max(0, o(i / 2) - u), 0, 0, Math.PI * 2), t.fill(), t.globalAlpha = 1, c > 0 && t.stroke();
|
|
1768
|
-
else if (
|
|
1769
|
-
if (t.globalAlpha = 1, t.beginPath(), t.moveTo(0, 0), t.lineTo(o(n), o(i)), c > 0 && t.stroke(),
|
|
1770
|
-
const d = Math.min(o(n), o(i)) * 0.28,
|
|
1771
|
-
t.beginPath(), t.moveTo(o(n), o(i)), t.lineTo(o(n) - d * Math.cos(
|
|
1798
|
+
else if (h === "line" || h === "arrow") {
|
|
1799
|
+
if (t.globalAlpha = 1, t.beginPath(), t.moveTo(0, 0), t.lineTo(o(n), o(i)), c > 0 && t.stroke(), h === "arrow") {
|
|
1800
|
+
const d = Math.min(o(n), o(i)) * 0.28, m = Math.atan2(o(i), o(n));
|
|
1801
|
+
t.beginPath(), t.moveTo(o(n), o(i)), t.lineTo(o(n) - d * Math.cos(m - 0.4), o(i) - d * Math.sin(m - 0.4)), t.lineTo(o(n) - d * Math.cos(m + 0.4), o(i) - d * Math.sin(m + 0.4)), t.closePath(), t.fillStyle = l, t.fill();
|
|
1772
1802
|
}
|
|
1773
1803
|
} else {
|
|
1774
1804
|
const d = o(this.radiusMm);
|
|
@@ -1777,13 +1807,13 @@ class De extends R {
|
|
|
1777
1807
|
t.restore();
|
|
1778
1808
|
}
|
|
1779
1809
|
}
|
|
1780
|
-
x("om-shape",
|
|
1781
|
-
const ue = "data-om-carto-owned",
|
|
1782
|
-
class
|
|
1783
|
-
static observedAttributes = [...
|
|
1810
|
+
x("om-shape", qe);
|
|
1811
|
+
const ue = "data-om-carto-owned", nn = ["contain", "cover", "fill"];
|
|
1812
|
+
class We extends R {
|
|
1813
|
+
static observedAttributes = [...T["om-image"]];
|
|
1784
1814
|
get fit() {
|
|
1785
1815
|
const t = this.getAttribute("fit");
|
|
1786
|
-
return
|
|
1816
|
+
return nn.includes(t ?? "") ? t : "contain";
|
|
1787
1817
|
}
|
|
1788
1818
|
get image() {
|
|
1789
1819
|
return this.querySelector(":scope > img");
|
|
@@ -1797,24 +1827,24 @@ class Ge extends R {
|
|
|
1797
1827
|
paintCartograph(t, e) {
|
|
1798
1828
|
const n = this.image;
|
|
1799
1829
|
if (!n || !n.complete || n.naturalWidth === 0) return;
|
|
1800
|
-
const { w: i, h: s } =
|
|
1830
|
+
const { w: i, h: s } = C(this), o = i * e.pxPerMm, a = s * e.pxPerMm;
|
|
1801
1831
|
if (o <= 0 || a <= 0) return;
|
|
1802
1832
|
const l = this.fit;
|
|
1803
1833
|
if (l === "fill") {
|
|
1804
1834
|
t.drawImage(n, 0, 0, o, a);
|
|
1805
1835
|
return;
|
|
1806
1836
|
}
|
|
1807
|
-
const c = n.naturalWidth / n.naturalHeight, u = o / a,
|
|
1808
|
-
l === "cover" && (t.save(), t.beginPath(), t.rect(0, 0, o, a), t.clip()), t.drawImage(n, (o - d) / 2, (a -
|
|
1837
|
+
const c = n.naturalWidth / n.naturalHeight, u = o / a, h = l === "contain" ? c > u : c < u, d = h ? o : a * c, m = h ? o / c : a;
|
|
1838
|
+
l === "cover" && (t.save(), t.beginPath(), t.rect(0, 0, o, a), t.clip()), t.drawImage(n, (o - d) / 2, (a - m) / 2, d, m), l === "cover" && t.restore();
|
|
1809
1839
|
}
|
|
1810
1840
|
}
|
|
1811
|
-
x("om-image",
|
|
1812
|
-
const
|
|
1813
|
-
function
|
|
1841
|
+
x("om-image", We);
|
|
1842
|
+
const on = /* @__PURE__ */ new Set(["PathLayer", "LineLayer", "ArcLayer", "TripsLayer", "GreatCircleLayer", "PathStyleLayer"]), sn = /* @__PURE__ */ new Set(["ScatterplotLayer", "IconLayer", "TextLayer", "PointCloudLayer", "HeatmapLayer", "ScreenGridLayer"]), an = /* @__PURE__ */ new Set(["COGLayer", "ZarrLayer", "BitmapLayer", "TerrainLayer", "ImageOverlay"]);
|
|
1843
|
+
function ln(r) {
|
|
1814
1844
|
const t = r.type ?? "";
|
|
1815
|
-
if (
|
|
1816
|
-
if (
|
|
1817
|
-
if (
|
|
1845
|
+
if (an.has(t)) return "ramp";
|
|
1846
|
+
if (on.has(t)) return "line";
|
|
1847
|
+
if (sn.has(t)) return "point";
|
|
1818
1848
|
if (t === "GeoJsonLayer") {
|
|
1819
1849
|
const e = r.props ?? {}, n = e.getFillColor !== void 0, i = e.getLineColor !== void 0;
|
|
1820
1850
|
if (n && !i) return "polygon";
|
|
@@ -1822,24 +1852,24 @@ function on(r) {
|
|
|
1822
1852
|
}
|
|
1823
1853
|
return "polygon";
|
|
1824
1854
|
}
|
|
1825
|
-
function
|
|
1855
|
+
function cn(r) {
|
|
1826
1856
|
const t = r.meta?.legend;
|
|
1827
1857
|
return r.meta?.color ?? (t?.kind === "ramp" ? t.colors[0] : t?.entries[0]?.color) ?? "#999";
|
|
1828
1858
|
}
|
|
1829
1859
|
const xt = 12;
|
|
1830
|
-
function
|
|
1860
|
+
function un(r, t = []) {
|
|
1831
1861
|
const e = [];
|
|
1832
1862
|
for (const n of r) {
|
|
1833
1863
|
if (n.props?.visible === !1) continue;
|
|
1834
1864
|
const i = t.filter((a) => a.layer === n.id), s = i.find((a) => a.match == null);
|
|
1835
1865
|
if (s?.hide) continue;
|
|
1836
|
-
const o =
|
|
1866
|
+
const o = hn(n.meta?.legend);
|
|
1837
1867
|
e.push({
|
|
1838
1868
|
layerId: n.id,
|
|
1839
1869
|
label: s?.label ?? n.meta?.label ?? n.id,
|
|
1840
|
-
color: s?.color ??
|
|
1841
|
-
shape: s?.shape ??
|
|
1842
|
-
legend:
|
|
1870
|
+
color: s?.color ?? cn(n),
|
|
1871
|
+
shape: s?.shape ?? ln(n),
|
|
1872
|
+
legend: mn(o, i),
|
|
1843
1873
|
order: s?.order
|
|
1844
1874
|
});
|
|
1845
1875
|
}
|
|
@@ -1848,7 +1878,7 @@ function an(r, t = []) {
|
|
|
1848
1878
|
return s - o || n.index - i.index;
|
|
1849
1879
|
}).map((n) => n.row);
|
|
1850
1880
|
}
|
|
1851
|
-
function
|
|
1881
|
+
function hn(r) {
|
|
1852
1882
|
if (!r || r.kind !== "categories" || r.entries.length <= xt) return r;
|
|
1853
1883
|
const t = r.entries.slice(0, xt), e = r.entries.length - xt;
|
|
1854
1884
|
return {
|
|
@@ -1856,7 +1886,7 @@ function ln(r) {
|
|
|
1856
1886
|
entries: [...t, { color: r.defaultColor ?? "#999", label: `+${e} more` }]
|
|
1857
1887
|
};
|
|
1858
1888
|
}
|
|
1859
|
-
function
|
|
1889
|
+
function mn(r, t) {
|
|
1860
1890
|
const e = t.filter((i) => i.match != null);
|
|
1861
1891
|
if (!r || r.kind === "ramp" || e.length === 0) return r;
|
|
1862
1892
|
const n = [];
|
|
@@ -1866,7 +1896,7 @@ function cn(r, t) {
|
|
|
1866
1896
|
}
|
|
1867
1897
|
return { ...r, entries: n };
|
|
1868
1898
|
}
|
|
1869
|
-
function
|
|
1899
|
+
function dn(r) {
|
|
1870
1900
|
const t = [];
|
|
1871
1901
|
for (const e of r.querySelectorAll(":scope > om-legend-row")) {
|
|
1872
1902
|
const n = e.getAttribute("layer");
|
|
@@ -1884,7 +1914,7 @@ function un(r) {
|
|
|
1884
1914
|
}
|
|
1885
1915
|
return t;
|
|
1886
1916
|
}
|
|
1887
|
-
function
|
|
1917
|
+
function Be(r) {
|
|
1888
1918
|
const t = [];
|
|
1889
1919
|
for (const e of r.querySelectorAll(":scope > om-legend-row")) {
|
|
1890
1920
|
if (e.hasAttribute("hide")) continue;
|
|
@@ -1900,33 +1930,33 @@ function qe(r) {
|
|
|
1900
1930
|
return t.sort((e, n) => (e.order ?? Number.POSITIVE_INFINITY) - (n.order ?? Number.POSITIVE_INFINITY));
|
|
1901
1931
|
}
|
|
1902
1932
|
const he = "data-om-carto-legend-rows";
|
|
1903
|
-
class
|
|
1904
|
-
static observedAttributes = [...
|
|
1933
|
+
class Ve extends R {
|
|
1934
|
+
static observedAttributes = [...T["om-legend"]];
|
|
1905
1935
|
get derived() {
|
|
1906
1936
|
return this.getAttribute("derived") !== "false";
|
|
1907
1937
|
}
|
|
1908
1938
|
/** The rows this legend currently shows — recomputed on demand, never stored. */
|
|
1909
1939
|
get rows() {
|
|
1910
|
-
if (!this.derived) return
|
|
1911
|
-
const n =
|
|
1912
|
-
return n ?
|
|
1940
|
+
if (!this.derived) return Be(this);
|
|
1941
|
+
const n = _(this)?.mapElement?.getLayers?.();
|
|
1942
|
+
return n ? un(n, dn(this)) : [];
|
|
1913
1943
|
}
|
|
1914
1944
|
renderNow() {
|
|
1915
|
-
if (this.applyPlacement(), this.style.display = "block", this.style.boxSizing = "border-box", this.style.overflow = "hidden", this.derived && !
|
|
1945
|
+
if (this.applyPlacement(), this.style.display = "block", this.style.boxSizing = "border-box", this.style.overflow = "hidden", this.derived && !_(this)) {
|
|
1916
1946
|
const e = this.getAttribute("for");
|
|
1917
|
-
|
|
1947
|
+
G(this, e ? `Legend references no frame with id "${e}".` : "Legend has no frame to derive from (set for=).");
|
|
1918
1948
|
return;
|
|
1919
1949
|
}
|
|
1920
1950
|
const t = this.rows;
|
|
1921
1951
|
if (t.length === 0 && this.derived) {
|
|
1922
|
-
|
|
1952
|
+
G(this, "Legend is waiting for its frame's layers.");
|
|
1923
1953
|
return;
|
|
1924
1954
|
}
|
|
1925
1955
|
this.renderRows(t);
|
|
1926
1956
|
}
|
|
1927
1957
|
renderRows(t) {
|
|
1928
1958
|
const e = this.ownerDocument;
|
|
1929
|
-
this.querySelector(`:scope > [${he}]`)?.remove(),
|
|
1959
|
+
this.querySelector(`:scope > [${he}]`)?.remove(), Tr(this);
|
|
1930
1960
|
const n = e.createElement("div");
|
|
1931
1961
|
n.setAttribute(he, ""), n.style.cssText = "padding:2mm;font-size:2.6mm;line-height:1.35;";
|
|
1932
1962
|
const i = this.getAttribute("title");
|
|
@@ -1972,38 +2002,38 @@ class We extends R {
|
|
|
1972
2002
|
return n;
|
|
1973
2003
|
}
|
|
1974
2004
|
paintCartograph(t, e) {
|
|
1975
|
-
const { w: n, h: i } =
|
|
2005
|
+
const { w: n, h: i } = C(this), s = n * e.pxPerMm, o = i * e.pxPerMm;
|
|
1976
2006
|
if (s <= 0 || o <= 0) return;
|
|
1977
|
-
const a = typeof getComputedStyle == "function" ? getComputedStyle(this) : null, l =
|
|
2007
|
+
const a = typeof getComputedStyle == "function" ? getComputedStyle(this) : null, l = F(a?.backgroundColor);
|
|
1978
2008
|
l && (t.fillStyle = l, t.fillRect(0, 0, s, o));
|
|
1979
|
-
const c =
|
|
2009
|
+
const c = F(a?.borderTopColor), u = $t(a?.borderTopWidth) * e.scale;
|
|
1980
2010
|
c && u > 0 && (t.strokeStyle = c, t.lineWidth = u, t.strokeRect(u / 2, u / 2, s - u, o - u));
|
|
1981
|
-
const
|
|
1982
|
-
let f =
|
|
1983
|
-
const
|
|
1984
|
-
|
|
1985
|
-
const
|
|
1986
|
-
let
|
|
1987
|
-
t.font = `${
|
|
1988
|
-
for (const [
|
|
1989
|
-
const
|
|
1990
|
-
if (
|
|
1991
|
-
const
|
|
1992
|
-
if (t.save(), t.font = `${
|
|
1993
|
-
const $ = Math.min(24, Math.max(1, v - 2.7)), E = k + 2.7, U = t.createLinearGradient(
|
|
1994
|
-
|
|
1995
|
-
const tt =
|
|
1996
|
-
t.textAlign = "right", t.fillText(tt,
|
|
2011
|
+
const h = F(a?.color) ?? "#111", d = a?.fontFamily || "system-ui, sans-serif", m = (P) => P * e.pxPerMm;
|
|
2012
|
+
let f = m(2);
|
|
2013
|
+
const g = this.getAttribute("title");
|
|
2014
|
+
g && (t.fillStyle = h, t.font = `600 ${m(2.6)}px ${d}`, t.textBaseline = "top", t.fillText(g, m(2), f), f += m(4));
|
|
2015
|
+
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;
|
|
2016
|
+
let O = -1, k = 2;
|
|
2017
|
+
t.font = `${m(2.6)}px ${d}`;
|
|
2018
|
+
for (const [P, L] of p.entries()) {
|
|
2019
|
+
const A = Math.min(w - 1, Math.floor(P / y));
|
|
2020
|
+
if (A !== O && (O = A, k = 2 + O * (v + M), f = O === 0 ? N : m(2)), f > o || (t.fillStyle = L.color, L.shape === "line" ? t.fillRect(m(k), f + m(1.2), m(3.2), m(0.9)) : L.shape === "point" ? (t.beginPath(), t.arc(m(k + 1.6), f + m(1.6), m(1.6), 0, Math.PI * 2), t.fill()) : t.fillRect(m(k), f, m(3.2), m(3.2)), t.fillStyle = h, t.textBaseline = "top", t.fillText(L.label, m(k + 4.7), f + m(0.3)), f += m(4.2), !L.legend)) continue;
|
|
2021
|
+
const S = L.legend;
|
|
2022
|
+
if (t.save(), t.font = `${m(2.1)}px ${d}`, t.globalAlpha = 0.7, t.fillText(S.field, m(k + 2.7), f), t.globalAlpha = 1, f += m(2.8), S.kind === "ramp") {
|
|
2023
|
+
const $ = Math.min(24, Math.max(1, v - 2.7)), E = k + 2.7, U = t.createLinearGradient(m(E), 0, m(E + $), 0);
|
|
2024
|
+
S.colors.forEach((J, Je) => U.addColorStop(S.colors.length === 1 ? 0 : Je / (S.colors.length - 1), J)), t.fillStyle = U, t.fillRect(m(E), f, m($), 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);
|
|
2025
|
+
const tt = S.domain[1].toLocaleString("en-US");
|
|
2026
|
+
t.textAlign = "right", t.fillText(tt, m(E + $), f), t.textAlign = "left", f += m(3.2);
|
|
1997
2027
|
} else {
|
|
1998
|
-
const $ = [...
|
|
1999
|
-
|
|
2028
|
+
const $ = [...S.entries];
|
|
2029
|
+
S.kind === "categories" && S.defaultColor && $.push({ color: S.defaultColor, label: "other" }), t.font = `${m(2.3)}px ${d}`;
|
|
2000
2030
|
for (const E of $) {
|
|
2001
2031
|
if (f > o) break;
|
|
2002
|
-
t.fillStyle = E.color, t.fillRect(
|
|
2032
|
+
t.fillStyle = E.color, t.fillRect(m(k + 2.7), f, m(2.6), m(2.6)), t.fillStyle = h, t.fillText(E.label, m(k + 6.3), f + m(0.2)), f += m(3.2);
|
|
2003
2033
|
}
|
|
2004
|
-
f +=
|
|
2034
|
+
f += m(1);
|
|
2005
2035
|
}
|
|
2006
|
-
t.restore(), t.font = `${
|
|
2036
|
+
t.restore(), t.font = `${m(2.6)}px ${d}`;
|
|
2007
2037
|
}
|
|
2008
2038
|
}
|
|
2009
2039
|
}
|
|
@@ -2011,51 +2041,55 @@ const st = (r, t) => {
|
|
|
2011
2041
|
const e = r.createElement("span");
|
|
2012
2042
|
return e.textContent = t, e;
|
|
2013
2043
|
};
|
|
2014
|
-
x("om-legend",
|
|
2015
|
-
const me = 48,
|
|
2044
|
+
x("om-legend", Ve);
|
|
2045
|
+
const me = 48, Tt = {
|
|
2016
2046
|
toLngLat: (r, t) => [r, t],
|
|
2017
2047
|
fromLngLat: (r) => [r[0], r[1]]
|
|
2018
2048
|
};
|
|
2019
2049
|
function de(r, t = 5) {
|
|
2020
2050
|
return !Number.isFinite(r) || r <= 0 ? 0 : ke(r / Math.max(1, t));
|
|
2021
2051
|
}
|
|
2022
|
-
function
|
|
2052
|
+
function fn({ georef: r, plane: t = Tt, interval: e, intervalX: n, intervalY: i, labels: s = "outside", format: o }) {
|
|
2023
2053
|
if (r.degenerate) return null;
|
|
2024
2054
|
const a = r.corners.map((y) => t.fromLngLat(y)), l = a.map((y) => y[0]), c = a.map((y) => y[1]);
|
|
2025
2055
|
if (l.some((y) => !Number.isFinite(y)) || c.some((y) => !Number.isFinite(y))) return null;
|
|
2026
|
-
const u = Math.min(...l),
|
|
2027
|
-
if (f <= 0 ||
|
|
2028
|
-
const
|
|
2029
|
-
for (let y = Math.ceil(u / f) * f; y <=
|
|
2030
|
-
const
|
|
2031
|
-
|
|
2056
|
+
const u = Math.min(...l), h = Math.max(...l), d = Math.min(...c), m = Math.max(...c), f = fe(n ?? e, de(h - u)), g = fe(i ?? e, de(m - d));
|
|
2057
|
+
if (f <= 0 || g <= 0 || (h - u) / f > 500 || (m - d) / g > 500) return null;
|
|
2058
|
+
const p = [], b = [], w = o ?? pn;
|
|
2059
|
+
for (let y = Math.ceil(u / f) * f; y <= h + 1e-9; y += f) {
|
|
2060
|
+
const M = ge(r, t, y, d, m, "x");
|
|
2061
|
+
if (M) {
|
|
2062
|
+
p.push(M);
|
|
2063
|
+
const v = t === Tt ? ze(y) : y;
|
|
2064
|
+
s !== "none" && be(b, M, r, w(v, "x"), "x", s);
|
|
2065
|
+
}
|
|
2032
2066
|
}
|
|
2033
|
-
for (let y = Math.ceil(d /
|
|
2034
|
-
const
|
|
2035
|
-
|
|
2067
|
+
for (let y = Math.ceil(d / g) * g; y <= m + 1e-9; y += g) {
|
|
2068
|
+
const M = ge(r, t, y, u, h, "y");
|
|
2069
|
+
M && (p.push(M), s !== "none" && be(b, M, r, w(y, "y"), "y", s));
|
|
2036
2070
|
}
|
|
2037
|
-
return { lines:
|
|
2071
|
+
return { lines: p, labels: b, intervalX: f, intervalY: g };
|
|
2038
2072
|
}
|
|
2039
2073
|
const fe = (r, t) => r != null && Number.isFinite(r) && r > 0 ? r : t;
|
|
2040
|
-
function
|
|
2074
|
+
function ge(r, t, e, n, i, s) {
|
|
2041
2075
|
const o = [];
|
|
2042
2076
|
for (let l = 0; l <= me; l++) {
|
|
2043
2077
|
const c = n + (i - n) * l / me, u = s === "x" ? t.toLngLat(e, c) : t.toLngLat(c, e);
|
|
2044
2078
|
if (!Number.isFinite(u[0]) || !Number.isFinite(u[1])) continue;
|
|
2045
|
-
const
|
|
2046
|
-
|
|
2079
|
+
const h = r.project(u);
|
|
2080
|
+
h && o.push(h);
|
|
2047
2081
|
}
|
|
2048
|
-
const a =
|
|
2082
|
+
const a = gn(o, r.widthMm, r.heightMm);
|
|
2049
2083
|
return a.length >= 2 ? { points: a, value: e, axis: s } : null;
|
|
2050
2084
|
}
|
|
2051
|
-
function
|
|
2085
|
+
function gn(r, t, e) {
|
|
2052
2086
|
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);
|
|
2053
2087
|
if (i === -1) return [];
|
|
2054
2088
|
let s = r.length - 1;
|
|
2055
2089
|
for (; s > i && !n(r[s]); ) s--;
|
|
2056
|
-
return r.slice(Math.max(0, i - 1), Math.min(r.length, s + 2)).map((a) => ({ xMm:
|
|
2090
|
+
return r.slice(Math.max(0, i - 1), Math.min(r.length, s + 2)).map((a) => ({ xMm: pe(a.xMm, 0, t), yMm: pe(a.yMm, 0, e) }));
|
|
2057
2091
|
}
|
|
2058
|
-
const
|
|
2092
|
+
const pe = (r, t, e) => Math.min(e, Math.max(t, r));
|
|
2059
2093
|
function be(r, t, e, n, i, s) {
|
|
2060
2094
|
if (i === "x") {
|
|
2061
2095
|
const o = t.points.reduce((a, l) => l.yMm > a.yMm ? l : a);
|
|
@@ -2067,24 +2101,24 @@ function be(r, t, e, n, i, s) {
|
|
|
2067
2101
|
r.push({ text: n, xMm: s === "outside" ? -1.2 : 1.2, yMm: o.yMm, edge: "left", axis: i });
|
|
2068
2102
|
}
|
|
2069
2103
|
}
|
|
2070
|
-
function
|
|
2104
|
+
function pn(r, t) {
|
|
2071
2105
|
if (Math.abs(r) >= 1e3) return Math.round(r).toLocaleString("en-US");
|
|
2072
2106
|
const e = Math.abs(r) < 1 ? 3 : Math.abs(r) < 10 ? 2 : 1;
|
|
2073
2107
|
return `${Number(r.toFixed(e))}°`;
|
|
2074
2108
|
}
|
|
2075
|
-
function
|
|
2076
|
-
const e = t === "x" ? r < 0 ? "W" : "E" : r < 0 ? "S" : "N", n = Math.abs(r), i = Math.floor(n), s = (n - i) * 60, o = Math.floor(s), a = Math.round((s - o) * 60), l = a === 60 ? o + 1 : o, c = l === 60 ? i + 1 : i, u = l === 60 ? 0 : l,
|
|
2077
|
-
return `${c}°${String(u).padStart(2, "0")}′${String(
|
|
2109
|
+
function bn(r, t) {
|
|
2110
|
+
const e = t === "x" ? r < 0 ? "W" : "E" : r < 0 ? "S" : "N", n = Math.abs(r), i = Math.floor(n), s = (n - i) * 60, o = Math.floor(s), a = Math.round((s - o) * 60), l = a === 60 ? o + 1 : o, c = l === 60 ? i + 1 : i, u = l === 60 ? 0 : l, h = a === 60 ? 0 : a;
|
|
2111
|
+
return `${c}°${String(u).padStart(2, "0")}′${String(h).padStart(2, "0")}″${e}`;
|
|
2078
2112
|
}
|
|
2079
|
-
const at = "http://www.w3.org/2000/svg",
|
|
2080
|
-
class
|
|
2081
|
-
static observedAttributes = [...
|
|
2113
|
+
const at = "http://www.w3.org/2000/svg", yn = ["solid", "cross", "markers"], D = 1.4;
|
|
2114
|
+
class He extends R {
|
|
2115
|
+
static observedAttributes = [...T["om-graticule"]];
|
|
2082
2116
|
resolvedPlane = null;
|
|
2083
2117
|
resolvedPlaneKey = null;
|
|
2084
2118
|
resolveToken = 0;
|
|
2085
2119
|
get kind() {
|
|
2086
2120
|
const t = this.getAttribute("kind");
|
|
2087
|
-
return
|
|
2121
|
+
return yn.includes(t) ? t : "solid";
|
|
2088
2122
|
}
|
|
2089
2123
|
get labelPlacement() {
|
|
2090
2124
|
const t = this.getAttribute("labels");
|
|
@@ -2092,7 +2126,7 @@ class Ve extends R {
|
|
|
2092
2126
|
}
|
|
2093
2127
|
/** The grid this element currently draws, or null when it cannot yet. */
|
|
2094
2128
|
get graticule() {
|
|
2095
|
-
const t =
|
|
2129
|
+
const t = _(this)?.georef;
|
|
2096
2130
|
if (!t) return null;
|
|
2097
2131
|
const e = this.gridPlane();
|
|
2098
2132
|
if (!e) return null;
|
|
@@ -2100,14 +2134,14 @@ class Ve extends R {
|
|
|
2100
2134
|
const s = Number(this.getAttribute(i));
|
|
2101
2135
|
return Number.isFinite(s) && s > 0 ? s : null;
|
|
2102
2136
|
};
|
|
2103
|
-
return
|
|
2137
|
+
return fn({
|
|
2104
2138
|
georef: t,
|
|
2105
2139
|
plane: e,
|
|
2106
2140
|
interval: n("interval"),
|
|
2107
2141
|
intervalX: n("interval-x"),
|
|
2108
2142
|
intervalY: n("interval-y"),
|
|
2109
2143
|
labels: this.labelPlacement,
|
|
2110
|
-
format: this.getAttribute("format") === "dms" ?
|
|
2144
|
+
format: this.getAttribute("format") === "dms" ? bn : void 0
|
|
2111
2145
|
});
|
|
2112
2146
|
}
|
|
2113
2147
|
/**
|
|
@@ -2117,24 +2151,24 @@ class Ve extends R {
|
|
|
2117
2151
|
*/
|
|
2118
2152
|
gridPlane() {
|
|
2119
2153
|
const t = Y(this.getAttribute("crs"));
|
|
2120
|
-
if (!t || t === "EPSG:4326" || t === "CRS:84" || t === "OGC:CRS84") return
|
|
2154
|
+
if (!t || t === "EPSG:4326" || t === "CRS:84" || t === "OGC:CRS84") return Tt;
|
|
2121
2155
|
const e = `${t}|${this.getAttribute("crs-def") ?? ""}`;
|
|
2122
2156
|
if (this.resolvedPlaneKey === e) return this.resolvedPlane;
|
|
2123
|
-
const n =
|
|
2157
|
+
const n = X(t);
|
|
2124
2158
|
if (n) {
|
|
2125
2159
|
const s = { toLngLat: (o, a) => n.inverse([o, a]), fromLngLat: (o) => n.forward(o) };
|
|
2126
2160
|
return this.resolvedPlane = s, this.resolvedPlaneKey = e, s;
|
|
2127
2161
|
}
|
|
2128
2162
|
const i = ++this.resolveToken;
|
|
2129
|
-
return
|
|
2163
|
+
return Ue(t, this.getAttribute("crs-def")).then((s) => {
|
|
2130
2164
|
i !== this.resolveToken || !s || (this.resolvedPlane = { toLngLat: (o, a) => s.inverse([o, a]), fromLngLat: (o) => s.forward(o) }, this.resolvedPlaneKey = e, this.scheduleRender());
|
|
2131
2165
|
}).catch(() => {
|
|
2132
2166
|
}), null;
|
|
2133
2167
|
}
|
|
2134
2168
|
renderNow() {
|
|
2135
|
-
if (this.applyPlacement(), this.style.display = "block", this.style.pointerEvents = "none", !
|
|
2169
|
+
if (this.applyPlacement(), this.style.display = "block", this.style.pointerEvents = "none", !_(this)) {
|
|
2136
2170
|
const n = this.getAttribute("for");
|
|
2137
|
-
|
|
2171
|
+
G(this, n ? `Graticule references no frame with id "${n}".` : "Graticule has no frame to cover (set for=).");
|
|
2138
2172
|
return;
|
|
2139
2173
|
}
|
|
2140
2174
|
const e = this.graticule;
|
|
@@ -2145,7 +2179,7 @@ class Ve extends R {
|
|
|
2145
2179
|
this.renderSvg(e);
|
|
2146
2180
|
}
|
|
2147
2181
|
renderSvg(t) {
|
|
2148
|
-
const { w: e, h: n } =
|
|
2182
|
+
const { w: e, h: n } = C(this), i = this.ownerDocument, s = i.createElementNS(at, "svg");
|
|
2149
2183
|
s.setAttribute("width", `${e}mm`), s.setAttribute("height", `${n}mm`), s.setAttribute("viewBox", `0 0 ${e} ${n}`), s.style.cssText = "display:block;overflow:visible;";
|
|
2150
2184
|
const o = "var(--om-carto-graticule-ink)", a = this.kind;
|
|
2151
2185
|
for (const l of t.lines)
|
|
@@ -2168,7 +2202,7 @@ class Ve extends R {
|
|
|
2168
2202
|
if (e === "markers") return [t.points[0], t.points[t.points.length - 1]];
|
|
2169
2203
|
const i = n.lines.filter((o) => o.axis !== t.axis), s = [];
|
|
2170
2204
|
for (const o of i) {
|
|
2171
|
-
const a =
|
|
2205
|
+
const a = wn(t.points, o.points);
|
|
2172
2206
|
a && s.push(a);
|
|
2173
2207
|
}
|
|
2174
2208
|
return s;
|
|
@@ -2176,7 +2210,7 @@ class Ve extends R {
|
|
|
2176
2210
|
paintCartograph(t, e) {
|
|
2177
2211
|
const n = this.graticule;
|
|
2178
2212
|
if (!n) return;
|
|
2179
|
-
const i = typeof getComputedStyle == "function" ? getComputedStyle(this) : null, s =
|
|
2213
|
+
const i = typeof getComputedStyle == "function" ? getComputedStyle(this) : null, s = F(i?.color) ?? "#ffffff", o = (l) => l * e.pxPerMm, a = this.kind;
|
|
2180
2214
|
t.save(), t.strokeStyle = s, t.fillStyle = s, t.lineWidth = o(0.15);
|
|
2181
2215
|
for (const l of n.lines)
|
|
2182
2216
|
if (a === "solid")
|
|
@@ -2190,7 +2224,7 @@ class Ve extends R {
|
|
|
2190
2224
|
t.restore();
|
|
2191
2225
|
}
|
|
2192
2226
|
}
|
|
2193
|
-
function
|
|
2227
|
+
function wn(r, t) {
|
|
2194
2228
|
let e = null, n = Number.POSITIVE_INFINITY;
|
|
2195
2229
|
for (const i of r)
|
|
2196
2230
|
for (const s of t) {
|
|
@@ -2199,28 +2233,28 @@ function gn(r, t) {
|
|
|
2199
2233
|
}
|
|
2200
2234
|
return n <= 1 ? e : null;
|
|
2201
2235
|
}
|
|
2202
|
-
x("om-graticule",
|
|
2203
|
-
function
|
|
2236
|
+
x("om-graticule", He);
|
|
2237
|
+
function vn(r, t) {
|
|
2204
2238
|
if (r == null || typeof r != "object") return;
|
|
2205
2239
|
const e = r.properties;
|
|
2206
2240
|
return e && t in e ? e[t] : r[t];
|
|
2207
2241
|
}
|
|
2208
|
-
function
|
|
2242
|
+
function Lt(r, t) {
|
|
2209
2243
|
if (Array.isArray(r)) {
|
|
2210
2244
|
if (typeof r[0] == "number") {
|
|
2211
2245
|
t.push([r[0], r[1]]);
|
|
2212
2246
|
return;
|
|
2213
2247
|
}
|
|
2214
|
-
for (const e of r)
|
|
2248
|
+
for (const e of r) Lt(e, t);
|
|
2215
2249
|
}
|
|
2216
2250
|
}
|
|
2217
|
-
function
|
|
2251
|
+
function Mn(r) {
|
|
2218
2252
|
return r ? r.tileData != null ? "tiled" : r.asset != null ? "asset" : null : "empty";
|
|
2219
2253
|
}
|
|
2220
2254
|
function I(r, t) {
|
|
2221
|
-
return
|
|
2255
|
+
return vn(r, t);
|
|
2222
2256
|
}
|
|
2223
|
-
function
|
|
2257
|
+
function Ft(r) {
|
|
2224
2258
|
const t = {}, e = (i) => {
|
|
2225
2259
|
for (const [s, o] of Object.entries(i))
|
|
2226
2260
|
o == null || typeof o == "object" || (t[s] = String(o));
|
|
@@ -2229,11 +2263,11 @@ function Lt(r) {
|
|
|
2229
2263
|
const n = r.properties;
|
|
2230
2264
|
return n && typeof n == "object" && e(n), t;
|
|
2231
2265
|
}
|
|
2232
|
-
function
|
|
2266
|
+
function An(r) {
|
|
2233
2267
|
let t = 1 / 0, e = 1 / 0, n = -1 / 0, i = -1 / 0;
|
|
2234
2268
|
const s = [], o = r.geometry;
|
|
2235
|
-
if (o?.coordinates != null)
|
|
2236
|
-
else if (Array.isArray(r.coordinates))
|
|
2269
|
+
if (o?.coordinates != null) Lt(o.coordinates, s);
|
|
2270
|
+
else if (Array.isArray(r.coordinates)) Lt(r.coordinates, s);
|
|
2237
2271
|
else {
|
|
2238
2272
|
const a = Number(I(r, "lng") ?? I(r, "longitude") ?? I(r, "lon") ?? I(r, "x")), l = Number(I(r, "lat") ?? I(r, "latitude") ?? I(r, "y"));
|
|
2239
2273
|
Number.isFinite(a) && Number.isFinite(l) && s.push([a, l]);
|
|
@@ -2242,52 +2276,52 @@ function wn(r) {
|
|
|
2242
2276
|
!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));
|
|
2243
2277
|
return !Number.isFinite(t) || !Number.isFinite(e) ? null : [t, e, n, i];
|
|
2244
2278
|
}
|
|
2245
|
-
function
|
|
2279
|
+
function Sn(r, t) {
|
|
2246
2280
|
const [e, n, i, s] = r, o = Math.max(i - e, 1e-4), a = Math.max(s - n, 1e-4), l = o * t, c = a * t;
|
|
2247
2281
|
return [e - l, n - c, i + l, s + c];
|
|
2248
2282
|
}
|
|
2249
|
-
const
|
|
2250
|
-
function
|
|
2251
|
-
let n = t ? r.filter((s) =>
|
|
2252
|
-
const i =
|
|
2283
|
+
const Jn = ([r, t, e, n]) => Math.max(0, e - r) * Math.max(0, n - t);
|
|
2284
|
+
function Cn({ features: r, filter: t, sort: e }) {
|
|
2285
|
+
let n = t ? r.filter((s) => xn(t, s)) : [...r];
|
|
2286
|
+
const i = kn(e);
|
|
2253
2287
|
return i.length > 0 && (n = [...n].sort((s, o) => {
|
|
2254
2288
|
for (const { field: a, descending: l } of i) {
|
|
2255
2289
|
const c = I(s, a), u = I(o, a);
|
|
2256
2290
|
if (c == null && u == null) continue;
|
|
2257
2291
|
if (c == null) return 1;
|
|
2258
2292
|
if (u == null) return -1;
|
|
2259
|
-
const
|
|
2260
|
-
if (
|
|
2293
|
+
const h = $n(c, u);
|
|
2294
|
+
if (h !== 0) return l ? -h : h;
|
|
2261
2295
|
}
|
|
2262
2296
|
return 0;
|
|
2263
2297
|
})), n;
|
|
2264
2298
|
}
|
|
2265
|
-
function
|
|
2299
|
+
function xn(r, t) {
|
|
2266
2300
|
try {
|
|
2267
2301
|
return !!r(t);
|
|
2268
2302
|
} catch {
|
|
2269
2303
|
return !1;
|
|
2270
2304
|
}
|
|
2271
2305
|
}
|
|
2272
|
-
function
|
|
2306
|
+
function kn(r) {
|
|
2273
2307
|
return r ? r.split(",").map((t) => t.trim()).filter(Boolean).map((t) => t.startsWith("-") ? { field: t.slice(1), descending: !0 } : { field: t, descending: !1 }) : [];
|
|
2274
2308
|
}
|
|
2275
|
-
function
|
|
2309
|
+
function $n(r, t) {
|
|
2276
2310
|
return typeof r == "number" && typeof t == "number" ? r - t : String(r).localeCompare(String(t), void 0, { numeric: !0, sensitivity: "base" });
|
|
2277
2311
|
}
|
|
2278
|
-
function
|
|
2312
|
+
function En(r) {
|
|
2279
2313
|
const t = r.replace(/[\x00-\x1f<>:"/\\|?*]+/g, "-").replace(/\s+/g, "-").replace(/-+/g, "-").replace(/^[-.]+|[-.]+$/g, "").slice(0, 100);
|
|
2280
2314
|
return t === "" ? "page" : t;
|
|
2281
2315
|
}
|
|
2282
|
-
function
|
|
2316
|
+
function Nn(r, t, e) {
|
|
2283
2317
|
const n = /* @__PURE__ */ new Map();
|
|
2284
2318
|
return t.map((i, s) => {
|
|
2285
|
-
const o =
|
|
2319
|
+
const o = Ft(i), a = (r ?? "page-{{atlas.index}}").replace(/\{\{\s*atlas\.([\w]+)\s*\}\}/g, (u, h) => h === "index" ? String(s + 1) : h === "count" ? String(t.length) : o[h] ?? u), l = En(a), c = n.get(l) ?? 0;
|
|
2286
2320
|
return n.set(l, c + 1), `${c === 0 ? l : `${l}-${c + 1}`}.${e}`;
|
|
2287
2321
|
});
|
|
2288
2322
|
}
|
|
2289
|
-
class
|
|
2290
|
-
static observedAttributes = [...
|
|
2323
|
+
class Ke extends R {
|
|
2324
|
+
static observedAttributes = [...T["om-atlas"]];
|
|
2291
2325
|
/**
|
|
2292
2326
|
* Pages are SNAPSHOTTED when iteration first starts. A streaming or polling
|
|
2293
2327
|
* layer would otherwise change the page count halfway through an export,
|
|
@@ -2298,7 +2332,7 @@ class He extends R {
|
|
|
2298
2332
|
rejection = null;
|
|
2299
2333
|
/** The frame whose layer drives the iteration — the same `for=` rule every furniture element follows. */
|
|
2300
2334
|
get frame() {
|
|
2301
|
-
return
|
|
2335
|
+
return _(this);
|
|
2302
2336
|
}
|
|
2303
2337
|
get count() {
|
|
2304
2338
|
return this.ensurePages().length;
|
|
@@ -2315,13 +2349,13 @@ class He extends R {
|
|
|
2315
2349
|
}
|
|
2316
2350
|
/** Export filenames, one per page, already de-duplicated. */
|
|
2317
2351
|
filenames(t = "png") {
|
|
2318
|
-
return
|
|
2352
|
+
return Nn(this.getAttribute("filename"), this.ensurePages(), t);
|
|
2319
2353
|
}
|
|
2320
2354
|
/** Human page labels, for an editor's stepper and PDF bookmarks. */
|
|
2321
2355
|
pageName(t) {
|
|
2322
2356
|
const e = this.ensurePages()[t];
|
|
2323
2357
|
if (!e) return `Page ${t + 1}`;
|
|
2324
|
-
const n =
|
|
2358
|
+
const n = Ft(e), i = this.getAttribute("page-name");
|
|
2325
2359
|
return i ? i.replace(
|
|
2326
2360
|
/\{\{\s*atlas\.([\w]+)\s*\}\}/g,
|
|
2327
2361
|
(s, o) => o === "index" ? String(t + 1) : o === "count" ? String(this.count) : n[o] ?? s
|
|
@@ -2339,11 +2373,11 @@ class He extends R {
|
|
|
2339
2373
|
}
|
|
2340
2374
|
ensurePages() {
|
|
2341
2375
|
if (this.pages) return this.pages;
|
|
2342
|
-
const e = this.frame?.mapElement?.getLayers?.(), n = this.getAttribute("layer"), i = e?.find((a) => a.id === n), s = e ?
|
|
2376
|
+
const e = this.frame?.mapElement?.getLayers?.(), n = this.getAttribute("layer"), i = e?.find((a) => a.id === n), s = e ? Mn(i) : null;
|
|
2343
2377
|
if (!e || s)
|
|
2344
2378
|
return this.rejection = e ? s : null, this.pages = [];
|
|
2345
2379
|
const o = this.materialize(i);
|
|
2346
|
-
return this.pages =
|
|
2380
|
+
return this.pages = Cn({ features: o, filter: this.compileFilter(), sort: this.getAttribute("sort") }), this.currentIndex = Math.min(this.currentIndex, Math.max(0, this.pages.length - 1)), this.pages;
|
|
2347
2381
|
}
|
|
2348
2382
|
/**
|
|
2349
2383
|
* Rows from the layer, with the layer's OWN declarative filters applied —
|
|
@@ -2351,7 +2385,7 @@ class He extends R {
|
|
|
2351
2385
|
* sheets for features the map itself is hiding.
|
|
2352
2386
|
*/
|
|
2353
2387
|
materialize(t) {
|
|
2354
|
-
const e =
|
|
2388
|
+
const e = H(), n = t.data;
|
|
2355
2389
|
if (!n) return [];
|
|
2356
2390
|
const i = e?.asRows ? e.asRows(n) : Array.isArray(n) ? n : [], s = [t.filter, t.categoryFilter].filter(Boolean);
|
|
2357
2391
|
return s.length === 0 ? i : i.filter(
|
|
@@ -2370,7 +2404,7 @@ class He extends R {
|
|
|
2370
2404
|
compileFilter() {
|
|
2371
2405
|
const t = this.getAttribute("filter");
|
|
2372
2406
|
if (!t) return;
|
|
2373
|
-
const e =
|
|
2407
|
+
const e = H();
|
|
2374
2408
|
if (e?.compileExpression)
|
|
2375
2409
|
try {
|
|
2376
2410
|
const n = e.compileExpression(t, { shape: "geojson", paramName: "d" });
|
|
@@ -2394,12 +2428,12 @@ class He extends R {
|
|
|
2394
2428
|
const e = this.closest("om-cartograph");
|
|
2395
2429
|
for (const n of e?.querySelectorAll("om-frame") ?? []) {
|
|
2396
2430
|
if (n.getAttribute("atlas-fit") !== "feature") continue;
|
|
2397
|
-
const i =
|
|
2431
|
+
const i = An(t);
|
|
2398
2432
|
if (!i) continue;
|
|
2399
|
-
const s = Number(n.getAttribute("atlas-margin")), o =
|
|
2433
|
+
const s = Number(n.getAttribute("atlas-margin")), o = Sn(i, Number.isFinite(s) && s > 0 ? s : 0.15);
|
|
2400
2434
|
n.fitBounds?.(o);
|
|
2401
2435
|
}
|
|
2402
|
-
e?.setAtlasFields({ ...
|
|
2436
|
+
e?.setAtlasFields({ ...Ft(t), index: String(this.currentIndex + 1), count: String(this.count) }), e?.refreshFurniture(), this.dispatchEvent(
|
|
2403
2437
|
new CustomEvent("om-atlas-page", {
|
|
2404
2438
|
bubbles: !0,
|
|
2405
2439
|
detail: { index: this.currentIndex, count: this.count, name: this.pageName(this.currentIndex), feature: t }
|
|
@@ -2410,95 +2444,95 @@ class He extends R {
|
|
|
2410
2444
|
this.style.display = "none", this.refresh();
|
|
2411
2445
|
}
|
|
2412
2446
|
}
|
|
2413
|
-
x("om-atlas",
|
|
2414
|
-
const
|
|
2447
|
+
x("om-atlas", Ke);
|
|
2448
|
+
const Pn = /* @__PURE__ */ new Set(["class", "style", "id", "hidden", "title", "lang", "dir", "slot", "part", "role", "tabindex"]), Tn = /* @__PURE__ */ new Set(["style", "script", "img", "template", "om-map"]), Ln = ["data-om-carto-credit", "data-om-carto-marks", "data-om-carto-flattened"], Fn = /* @__PURE__ */ new Set(["om-text", "om-legend", "om-scalebar", "om-north", "om-shape", "om-image"]), In = /* @__PURE__ */ new Set(["om-frame", "om-legend", "om-scalebar", "om-north", "om-graticule", "om-text", "om-shape", "om-image"]), Rn = 0.02, On = (r) => Math.max(0, Number(r.getAttribute("bleed")) || 0);
|
|
2415
2449
|
function Ye(r) {
|
|
2416
2450
|
const t = r.tagName.toLowerCase();
|
|
2417
2451
|
return r.id ? `${t}#${r.id}` : t;
|
|
2418
2452
|
}
|
|
2419
|
-
function
|
|
2453
|
+
function V(r, t) {
|
|
2420
2454
|
const e = r.getAttribute(t);
|
|
2421
2455
|
if (e == null || e.trim() === "") return null;
|
|
2422
2456
|
const n = Number(e);
|
|
2423
2457
|
return Number.isFinite(n) ? n : null;
|
|
2424
2458
|
}
|
|
2425
|
-
function
|
|
2459
|
+
function _n(r, t) {
|
|
2426
2460
|
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;
|
|
2427
2461
|
}
|
|
2428
|
-
function
|
|
2462
|
+
function Un(r, t) {
|
|
2429
2463
|
const e = r.getAttribute("style");
|
|
2430
2464
|
if (!e) return null;
|
|
2431
2465
|
const n = new RegExp(`(?:^|;)\\s*${t}\\s*:\\s*(-?[\\d.]+)mm`, "i").exec(e);
|
|
2432
2466
|
return n ? Number(n[1]) : null;
|
|
2433
2467
|
}
|
|
2434
|
-
function
|
|
2468
|
+
function Xe(r) {
|
|
2435
2469
|
const t = [], e = (o, a, l, c, u) => {
|
|
2436
2470
|
t.push({ severity: o, element: Ye(a), ...u ? { attribute: u } : {}, message: l, fix: c });
|
|
2437
2471
|
}, n = [...r.querySelectorAll("om-cartograph")];
|
|
2438
2472
|
if (n.length === 0 && r.tagName?.toLowerCase() === "om-cartograph" && n.push(r), n.length === 0)
|
|
2439
2473
|
return { valid: !0, errors: [], warnings: [] };
|
|
2440
|
-
for (const o of n)
|
|
2474
|
+
for (const o of n) zn(o, e);
|
|
2441
2475
|
const i = t.filter((o) => o.severity === "error"), s = t.filter((o) => o.severity === "warning");
|
|
2442
2476
|
return { valid: i.length === 0, errors: i, warnings: s };
|
|
2443
2477
|
}
|
|
2444
|
-
function
|
|
2445
|
-
const e = r.getAttribute("size"), n =
|
|
2446
|
-
e && !
|
|
2478
|
+
function zn(r, t) {
|
|
2479
|
+
const e = r.getAttribute("size"), n = V(r, "width") != null && V(r, "height") != null;
|
|
2480
|
+
e && !Ht.includes(e) && !n && t(
|
|
2447
2481
|
"error",
|
|
2448
2482
|
r,
|
|
2449
2483
|
`Unknown page size "${e}" and no width/height to fall back on.`,
|
|
2450
|
-
`Use one of ${
|
|
2484
|
+
`Use one of ${Ht.join(", ")}, or give width= and height= in millimetres.`,
|
|
2451
2485
|
"size"
|
|
2452
2486
|
);
|
|
2453
2487
|
const i = r.getAttribute("cvd");
|
|
2454
|
-
i && i.trim().toLowerCase() !== "none" && !
|
|
2455
|
-
const s =
|
|
2488
|
+
i && i.trim().toLowerCase() !== "none" && !It(i) && t("warning", r, `Unknown cvd="${i}" — no simulation applied.`, `Use one of ${nr.join(", ")}.`, "cvd"), r.hasAttribute("crop-marks") && On(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");
|
|
2489
|
+
const s = V(r, "safe-zone");
|
|
2456
2490
|
if (s != null && s > 0) {
|
|
2457
|
-
const
|
|
2458
|
-
s * 2 >= Math.min(
|
|
2491
|
+
const m = ut(r.getAttribute("size"), r.getAttribute("width"), r.getAttribute("height"), r.getAttribute("orientation"));
|
|
2492
|
+
s * 2 >= Math.min(m.widthMm, m.heightMm) && t("warning", r, `safe-zone=${s}mm leaves no usable area on a ${m.widthMm} × ${m.heightMm} mm page.`, "Use a smaller inset — 5–10mm is typical.", "safe-zone");
|
|
2459
2493
|
}
|
|
2460
2494
|
const o = r.getAttribute("format");
|
|
2461
2495
|
o == null ? t("warning", r, "No format= on the cartograph root.", `Add format="${pt}" so future runtimes can migrate this document.`, "format") : o !== pt && t("warning", r, `Unrecognised document format "${o}".`, `This build understands "${pt}".`, "format");
|
|
2462
|
-
const { widthMm: a, heightMm: l } =
|
|
2463
|
-
for (const
|
|
2464
|
-
|
|
2465
|
-
for (const
|
|
2466
|
-
if (
|
|
2467
|
-
const f =
|
|
2468
|
-
!
|
|
2496
|
+
const { widthMm: a, heightMm: l } = ut(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")];
|
|
2497
|
+
for (const m of h)
|
|
2498
|
+
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");
|
|
2499
|
+
for (const m of r.children) {
|
|
2500
|
+
if (Ln.some((g) => m.hasAttribute(g))) continue;
|
|
2501
|
+
const f = m.tagName.toLowerCase();
|
|
2502
|
+
!bt.includes(f) && !Tn.has(f) && t("error", m, `<${f}> is not a cartograph element.`, `Use one of ${bt.join(", ")}, or move this content inside an <om-text>.`);
|
|
2469
2503
|
}
|
|
2470
2504
|
const d = [];
|
|
2471
|
-
for (const
|
|
2472
|
-
const f =
|
|
2473
|
-
if (
|
|
2474
|
-
if (
|
|
2475
|
-
const
|
|
2476
|
-
|
|
2505
|
+
for (const m of [r, ...r.querySelectorAll("*")]) {
|
|
2506
|
+
const f = m.tagName.toLowerCase();
|
|
2507
|
+
if (bt.includes(f) && !m.closest("om-map")) {
|
|
2508
|
+
if (Dn(m, f, t), In.has(f)) {
|
|
2509
|
+
const g = C(m);
|
|
2510
|
+
jn(m, g, a, l, c, t), Fn.has(f) && !m.hasAttribute("hidden") && d.push({ el: m, box: g });
|
|
2477
2511
|
}
|
|
2478
|
-
f === "om-frame" &&
|
|
2479
|
-
for (const
|
|
2480
|
-
const
|
|
2481
|
-
|
|
2512
|
+
f === "om-frame" && Gn(m, t), f === "om-legend" && qn(m, h, t), f === "om-atlas" && Wn(m, h, t), f === "om-scalebar" && Bn(m, h, t), f === "om-text" && Vn(m, h, t);
|
|
2513
|
+
for (const g of ["for", "overview-of"]) {
|
|
2514
|
+
const p = m.getAttribute(g);
|
|
2515
|
+
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);
|
|
2482
2516
|
}
|
|
2483
2517
|
}
|
|
2484
2518
|
}
|
|
2485
|
-
for (let
|
|
2486
|
-
for (let f =
|
|
2487
|
-
const
|
|
2488
|
-
|
|
2519
|
+
for (let m = 0; m < d.length; m++)
|
|
2520
|
+
for (let f = m + 1; f < d.length; f++) {
|
|
2521
|
+
const g = d[m], p = d[f];
|
|
2522
|
+
g.box.w <= 0 || g.box.h <= 0 || p.box.w <= 0 || p.box.h <= 0 || _n(g.box, p.box) && t(
|
|
2489
2523
|
"warning",
|
|
2490
|
-
|
|
2491
|
-
`Overlaps ${Ye(
|
|
2524
|
+
g.el,
|
|
2525
|
+
`Overlaps ${Ye(p.el)} on the page.`,
|
|
2492
2526
|
"Move one of them — furniture overlapping furniture usually means a stale layout (frames may sit under anything)."
|
|
2493
2527
|
);
|
|
2494
2528
|
}
|
|
2495
2529
|
}
|
|
2496
|
-
function
|
|
2497
|
-
const n = new Set(
|
|
2530
|
+
function Dn(r, t, e) {
|
|
2531
|
+
const n = new Set(T[t] ?? []);
|
|
2498
2532
|
for (const i of r.attributes) {
|
|
2499
2533
|
const s = i.name.toLowerCase();
|
|
2500
|
-
if (n.has(s) ||
|
|
2501
|
-
const o =
|
|
2534
|
+
if (n.has(s) || Pn.has(s) || s.startsWith("data-") || s.startsWith("aria-")) continue;
|
|
2535
|
+
const o = br.get(s);
|
|
2502
2536
|
if (o) {
|
|
2503
2537
|
e("warning", r, `Attribute "${s}" has no effect: ${o}`, "Remove it, or use the documented alternative.", s);
|
|
2504
2538
|
continue;
|
|
@@ -2506,7 +2540,7 @@ function On(r, t, e) {
|
|
|
2506
2540
|
e("warning", r, `Unknown attribute "${s}" on <${t}> — likely a typo.`, `Valid attributes: ${[...n].join(", ")}.`, s);
|
|
2507
2541
|
}
|
|
2508
2542
|
}
|
|
2509
|
-
function
|
|
2543
|
+
function jn(r, t, e, n, i, s) {
|
|
2510
2544
|
if (t.w <= 0 || t.h <= 0) {
|
|
2511
2545
|
s("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");
|
|
2512
2546
|
return;
|
|
@@ -2524,20 +2558,20 @@ function Un(r, t, e, n, i, s) {
|
|
|
2524
2558
|
["width", t.w],
|
|
2525
2559
|
["height", t.h]
|
|
2526
2560
|
];
|
|
2527
|
-
for (const [u,
|
|
2528
|
-
const d =
|
|
2529
|
-
d != null && Math.abs(d -
|
|
2561
|
+
for (const [u, h] of c) {
|
|
2562
|
+
const d = Un(r, u);
|
|
2563
|
+
d != null && Math.abs(d - h) > 0.01 && s(
|
|
2530
2564
|
"error",
|
|
2531
2565
|
r,
|
|
2532
|
-
`Inline style ${u}:${d}mm disagrees with the placement attribute (${
|
|
2566
|
+
`Inline style ${u}:${d}mm disagrees with the placement attribute (${h}mm).`,
|
|
2533
2567
|
"The attributes are authoritative — make the inline style match, or drop it and let the runtime write it.",
|
|
2534
2568
|
"style"
|
|
2535
2569
|
);
|
|
2536
2570
|
}
|
|
2537
2571
|
}
|
|
2538
|
-
function
|
|
2572
|
+
function Gn(r, t) {
|
|
2539
2573
|
if ((r.getAttribute("mode") === "static" ? "static" : "live") === "static") {
|
|
2540
|
-
const n = r.getAttribute("corners"), i =
|
|
2574
|
+
const n = r.getAttribute("corners"), i = dt(n);
|
|
2541
2575
|
i || t(
|
|
2542
2576
|
"error",
|
|
2543
2577
|
r,
|
|
@@ -2545,14 +2579,14 @@ function zn(r, t) {
|
|
|
2545
2579
|
'Give four lon/lat pairs in tl, tr, br, bl order — corners="[[lng,lat],[lng,lat],[lng,lat],[lng,lat]]".',
|
|
2546
2580
|
"corners"
|
|
2547
2581
|
), r.querySelector(":scope > img") || t("error", r, "Static frame has no <img> child to place.", "Add the georeferenced raster as an <img> child — it is also what renders with JavaScript disabled.");
|
|
2548
|
-
const s =
|
|
2582
|
+
const s = C(r), o = X(r.getAttribute("crs"));
|
|
2549
2583
|
if (i && o && s.w > 0 && s.h > 0) {
|
|
2550
|
-
const a =
|
|
2584
|
+
const a = mt({ corners: i, widthMm: s.w, heightMm: s.h, crsForward: o });
|
|
2551
2585
|
if (a.degenerate)
|
|
2552
2586
|
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");
|
|
2553
2587
|
else {
|
|
2554
|
-
const l =
|
|
2555
|
-
l != null && l >
|
|
2588
|
+
const l = Yr(a);
|
|
2589
|
+
l != null && l > Rn && t(
|
|
2556
2590
|
"warning",
|
|
2557
2591
|
r,
|
|
2558
2592
|
`Ground scale varies ${(l * 100).toFixed(1)}% across this frame, so a single scale bar is only true near its anchor.`,
|
|
@@ -2561,7 +2595,7 @@ function zn(r, t) {
|
|
|
2561
2595
|
}
|
|
2562
2596
|
}
|
|
2563
2597
|
} else {
|
|
2564
|
-
|
|
2598
|
+
ct(r) || t(
|
|
2565
2599
|
"error",
|
|
2566
2600
|
r,
|
|
2567
2601
|
"Live frame has no valid camera.",
|
|
@@ -2584,7 +2618,7 @@ function _t(r, t) {
|
|
|
2584
2618
|
const e = r.getAttribute("for");
|
|
2585
2619
|
return e ? t.find((n) => n.id === e) : t.length === 1 ? t[0] : void 0;
|
|
2586
2620
|
}
|
|
2587
|
-
function
|
|
2621
|
+
function qn(r, t, e) {
|
|
2588
2622
|
const n = r.getAttribute("derived") !== "false", i = _t(r, t);
|
|
2589
2623
|
n && i?.getAttribute("mode") === "static" && e(
|
|
2590
2624
|
"warning",
|
|
@@ -2593,9 +2627,9 @@ function jn(r, t, e) {
|
|
|
2593
2627
|
'Write the rows as <om-legend-row color= label= shape=> children and set derived="false".',
|
|
2594
2628
|
"derived"
|
|
2595
2629
|
);
|
|
2596
|
-
const s =
|
|
2630
|
+
const s = Be(r);
|
|
2597
2631
|
if (s.length < 2) return;
|
|
2598
|
-
const o =
|
|
2632
|
+
const o = sr(s.map((a) => ({ label: a.label, color: a.color, layer: a.layerId })));
|
|
2599
2633
|
if (o.collapses.length > 0 && o.worstType) {
|
|
2600
2634
|
const a = o.collapses.filter((c) => c.type === o.worstType), l = a.slice(0, 3).map((c) => `"${c.a.label}"/"${c.b.label}"`).join(", ");
|
|
2601
2635
|
e(
|
|
@@ -2606,7 +2640,7 @@ function jn(r, t, e) {
|
|
|
2606
2640
|
);
|
|
2607
2641
|
}
|
|
2608
2642
|
}
|
|
2609
|
-
function
|
|
2643
|
+
function Wn(r, t, e) {
|
|
2610
2644
|
const n = r.getAttribute("layer");
|
|
2611
2645
|
n || e("error", r, "Atlas has no layer= to iterate.", 'Name a layer inside the frame, e.g. layer="parcels".', "layer");
|
|
2612
2646
|
const i = r.getAttribute("for"), s = _t(r, t);
|
|
@@ -2641,17 +2675,17 @@ function Dn(r, t, e) {
|
|
|
2641
2675
|
);
|
|
2642
2676
|
}
|
|
2643
2677
|
}
|
|
2644
|
-
function
|
|
2645
|
-
const n =
|
|
2678
|
+
function Bn(r, t, e) {
|
|
2679
|
+
const n = V(r, "segment-length");
|
|
2646
2680
|
if (n == null) return;
|
|
2647
2681
|
const i = _t(r, t);
|
|
2648
2682
|
if (!i) return;
|
|
2649
|
-
const s =
|
|
2683
|
+
const s = dt(i.getAttribute("corners")), o = X(i.getAttribute("crs")), a = C(i);
|
|
2650
2684
|
if (!s || !o || a.w <= 0 || a.h <= 0) return;
|
|
2651
|
-
const l =
|
|
2685
|
+
const l = mt({ corners: s, widthMm: a.w, heightMm: a.h, crsForward: o }), c = C(r), u = $e({
|
|
2652
2686
|
groundMetersPerMm: l.groundMetersPerMm(),
|
|
2653
2687
|
maxWidthMm: c.w,
|
|
2654
|
-
segments:
|
|
2688
|
+
segments: V(r, "segments") ?? void 0,
|
|
2655
2689
|
segmentLengthMeters: n
|
|
2656
2690
|
});
|
|
2657
2691
|
u && u.totalMm > c.w + 1e-6 && e(
|
|
@@ -2662,9 +2696,9 @@ function Gn(r, t, e) {
|
|
|
2662
2696
|
"segment-length"
|
|
2663
2697
|
);
|
|
2664
2698
|
}
|
|
2665
|
-
function
|
|
2699
|
+
function Vn(r, t, e) {
|
|
2666
2700
|
const n = r.textContent ?? "", i = /* @__PURE__ */ new Set(["title", "attribution", "date", "notes", "scale", "crs"]), s = new Set(t.map((o) => o.id).filter(Boolean));
|
|
2667
|
-
for (const o of
|
|
2701
|
+
for (const o of $r(n))
|
|
2668
2702
|
if (!o.startsWith("atlas.")) {
|
|
2669
2703
|
if (o.startsWith("frame.")) {
|
|
2670
2704
|
const a = o.slice(6), l = a.lastIndexOf("."), c = l > 0 ? a.slice(0, l) : "", u = l > 0 ? a.slice(l + 1) : "";
|
|
@@ -2683,13 +2717,13 @@ function qn(r, t, e) {
|
|
|
2683
2717
|
i.has(o) || e("warning", r, `Unknown token {{${o}}} — it will render literally.`, `Known tokens: ${[...i].join(", ")}, frame.<id>.scale, frame.<id>.crs, atlas.<field>.`);
|
|
2684
2718
|
}
|
|
2685
2719
|
}
|
|
2686
|
-
function
|
|
2687
|
-
return
|
|
2720
|
+
function Zn(r) {
|
|
2721
|
+
return Xe(pr(r));
|
|
2688
2722
|
}
|
|
2689
|
-
async function
|
|
2690
|
-
const t =
|
|
2723
|
+
async function Qn(r) {
|
|
2724
|
+
const t = Xe(r), e = [...r.querySelectorAll("om-frame")].filter((a) => a.querySelector(":scope > om-map"));
|
|
2691
2725
|
if (e.length === 0) return t;
|
|
2692
|
-
const { loadCore: n } = await Promise.resolve().then(() =>
|
|
2726
|
+
const { loadCore: n } = await Promise.resolve().then(() => Qe), i = await n(), s = [...t.errors], o = [...t.warnings];
|
|
2693
2727
|
for (const a of e) {
|
|
2694
2728
|
const l = a.id ? `om-frame#${a.id}` : "om-frame", c = i.validateManifest(a);
|
|
2695
2729
|
for (const u of c.errors) s.push({ ...u, element: `${l} > ${u.element}` });
|
|
@@ -2697,113 +2731,113 @@ async function Kn(r) {
|
|
|
2697
2731
|
}
|
|
2698
2732
|
return { valid: s.length === 0, errors: s, warnings: o };
|
|
2699
2733
|
}
|
|
2700
|
-
function
|
|
2701
|
-
x("om-cartograph",
|
|
2734
|
+
function ti() {
|
|
2735
|
+
x("om-cartograph", Ie), x("om-text", Re), x("om-frame", De), x("om-scalebar", je), x("om-north", Ge), x("om-shape", qe), x("om-image", We), x("om-legend", Ve), x("om-graticule", He), x("om-atlas", Ke);
|
|
2702
2736
|
}
|
|
2703
2737
|
ye(() => import("@nika-js/onlymap"));
|
|
2704
|
-
|
|
2738
|
+
fr();
|
|
2705
2739
|
export {
|
|
2706
|
-
|
|
2740
|
+
T as CARTOGRAPH_ELEMENT_ATTRS,
|
|
2707
2741
|
pt as CARTOGRAPH_FORMAT,
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2742
|
+
bt as CARTOGRAPH_TAG_NAMES,
|
|
2743
|
+
Hn as CARTOGRAPH_THEMES,
|
|
2744
|
+
or as COLLAPSE_THRESHOLD,
|
|
2745
|
+
Rt as CVD_MATRICES,
|
|
2746
|
+
ft as CVD_TYPES,
|
|
2747
|
+
nr as CVD_VALUES,
|
|
2748
|
+
Tt as GEOGRAPHIC_PLANE,
|
|
2749
|
+
br as INERT_RESERVED_CARTOGRAPH_ATTRS,
|
|
2716
2750
|
Se as MAX_CANVAS_AREA,
|
|
2717
2751
|
Ae as MAX_CANVAS_DIMENSION,
|
|
2718
2752
|
xt as MAX_CATEGORY_ENTRIES,
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
|
|
2753
|
+
Ke as OmAtlasElement,
|
|
2754
|
+
Ie as OmCartographElement,
|
|
2755
|
+
De as OmFrameElement,
|
|
2756
|
+
He as OmGraticuleElement,
|
|
2757
|
+
We as OmImageElement,
|
|
2758
|
+
Ve as OmLegendElement,
|
|
2759
|
+
Ge as OmNorthElement,
|
|
2760
|
+
je as OmScalebarElement,
|
|
2761
|
+
qe as OmShapeElement,
|
|
2762
|
+
Re as OmTextElement,
|
|
2763
|
+
zt as PAGE_PRESETS,
|
|
2764
|
+
Ht as PAGE_SIZE_NAMES,
|
|
2765
|
+
z as PLACED_ATTR_NAMES,
|
|
2766
|
+
W as PX_PER_MM,
|
|
2767
|
+
Cr as SCALE_GROUP_SEPARATOR,
|
|
2768
|
+
mr as URL_ACTION_TIMEOUT_MS,
|
|
2769
|
+
Rr as alignOffset,
|
|
2736
2770
|
Le as allFrames,
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
|
|
2771
|
+
ar as applyCvdToCanvas,
|
|
2772
|
+
Er as applyTokens,
|
|
2773
|
+
dr as applyUrlActions,
|
|
2774
|
+
Ft as atlasFields,
|
|
2775
|
+
Jn as boundsArea,
|
|
2776
|
+
C as boxMm,
|
|
2777
|
+
fn as buildGraticule,
|
|
2778
|
+
Cn as buildPages,
|
|
2745
2779
|
$e as buildScalebar,
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2780
|
+
Sr as buildScalebarDrawing,
|
|
2781
|
+
X as builtinCrsForward,
|
|
2782
|
+
Kn as canvasMeasurer,
|
|
2783
|
+
Tr as clearUnlinked,
|
|
2784
|
+
Yn as cornersFromBounds,
|
|
2751
2785
|
Pt as cornersFromCamera,
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2786
|
+
mt as createFrameGeoref,
|
|
2787
|
+
rr as createZip,
|
|
2788
|
+
ti as defineCartographElements,
|
|
2789
|
+
qt as deltaE00,
|
|
2790
|
+
un as deriveLegendRows,
|
|
2791
|
+
lr as ensureCvdFilters,
|
|
2792
|
+
An as featureBounds,
|
|
2759
2793
|
I as fieldOf,
|
|
2760
2794
|
Te as findFrame,
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2795
|
+
bn as formatDms,
|
|
2796
|
+
xr as formatScaleDenominator,
|
|
2797
|
+
fr as installUrlActions,
|
|
2764
2798
|
Ze as isCoreLoaded,
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2799
|
+
Nr as isoDate,
|
|
2800
|
+
Ir as layoutText,
|
|
2801
|
+
sr as lintLegendColours,
|
|
2768
2802
|
we as loadCore,
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
|
|
2803
|
+
Xn as maxGeoreferenceablePitch,
|
|
2804
|
+
zr as mercatorForward,
|
|
2805
|
+
Oe as mercatorInverse,
|
|
2772
2806
|
de as niceInterval,
|
|
2773
2807
|
ke as niceNumberBelow,
|
|
2774
2808
|
Y as normalizeCrs,
|
|
2775
|
-
|
|
2809
|
+
Kr as northBearingDegrees,
|
|
2776
2810
|
Pe as ownerCartograph,
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
2811
|
+
Sn as padBounds,
|
|
2812
|
+
Ut as paintEnvForDpi,
|
|
2813
|
+
ir as parseColor,
|
|
2814
|
+
dt as parseCorners,
|
|
2815
|
+
kn as parseSort,
|
|
2816
|
+
H as peekCore,
|
|
2817
|
+
ct as readCamera,
|
|
2818
|
+
Be as readLiteralRows,
|
|
2819
|
+
dn as readOverrides,
|
|
2820
|
+
_ as referencedFrame,
|
|
2821
|
+
Mn as rejectionFor,
|
|
2822
|
+
Ot as renderCartograph,
|
|
2789
2823
|
Ce as renderCartographAtlas,
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2824
|
+
Ue as resolveCrsForward,
|
|
2825
|
+
It as resolveCvdType,
|
|
2826
|
+
Nn as resolveFilenames,
|
|
2827
|
+
ut as resolvePageSize,
|
|
2828
|
+
kr as resolveToken,
|
|
2795
2829
|
Ne as resolveTokens,
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
|
|
2830
|
+
cn as rowColorFor,
|
|
2831
|
+
Jr as sanitizeAdoptedMap,
|
|
2832
|
+
En as sanitizeFilename,
|
|
2833
|
+
Yr as scaleVariation,
|
|
2800
2834
|
ye as setCoreLoader,
|
|
2801
2835
|
jt as simulate,
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
|
|
2836
|
+
ln as swatchShapeFor,
|
|
2837
|
+
$r as tokensIn,
|
|
2838
|
+
oe as utmDef,
|
|
2839
|
+
Xe as validateCartograph,
|
|
2840
|
+
Qn as validateCartographDeep,
|
|
2841
|
+
Zn as validateCartographString,
|
|
2842
|
+
Vt as whenPageReady
|
|
2809
2843
|
};
|