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