@thibezer/ui-components-kit 2.30.0 → 2.31.2
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 +42 -0
- package/dist/camadas.cjs +1 -1
- package/dist/camadas.js +1 -1
- package/dist/canvas.cjs +67 -67
- package/dist/canvas.js +1788 -1381
- package/dist/components/ui-seletor-mapa-base/ui-seletor-mapa-base.d.ts +6 -0
- package/dist/custom-elements.json +29797 -29723
- package/dist/feature_caixa-DAyED81R.cjs +1 -0
- package/dist/feature_caixa-zoUAn0qg.js +877 -0
- package/dist/{feature_desenho-eq3MIZR9.cjs → feature_desenho-CESNXi8g.cjs} +1 -1
- package/dist/{feature_desenho-Cq3H27as.js → feature_desenho-fQfbVPvn.js} +2 -2
- package/dist/feature_metricas-CnSFE0at.cjs +1 -0
- package/dist/feature_metricas-hUren6kK.js +135 -0
- package/dist/geometria-px-C4xatxmY.cjs +1 -0
- package/dist/{geometria-px-BxTQKrZN.js → geometria-px-wXudjSxA.js} +224 -206
- package/dist/gerencigeo-canvas/motor/motor-formas.d.ts +37 -1
- package/dist/gerencigeo-canvas/motor/tipos.d.ts +8 -2
- package/dist/gerencigeo-canvas/renderers/agenda_fatias.d.ts +56 -0
- package/dist/gerencigeo-canvas/renderers/canvas_formas_leaflet.d.ts +76 -2
- package/dist/gerencigeo-canvas/renderers/feicoes_canvas_renderer.d.ts +20 -0
- package/dist/gerencigeo-canvas/renderers/renderizador_formas.d.ts +21 -11
- package/dist/motor.cjs +1 -1
- package/dist/motor.js +445 -342
- package/dist/prancha-nucleo.cjs +1 -1
- package/dist/prancha-nucleo.js +4 -4
- package/dist/prancha.cjs +1 -1
- package/dist/prancha.js +3 -3
- package/dist/seletor-mapa-base.cjs +7 -7
- package/dist/seletor-mapa-base.js +50 -38
- package/package.json +1 -1
- package/dist/feature_caixa-DOchASgS.js +0 -828
- package/dist/feature_caixa-MrJEfMol.cjs +0 -1
- package/dist/feature_metricas-CKQGG2nz.cjs +0 -1
- package/dist/feature_metricas-DGfd21VR.js +0 -130
- package/dist/geometria-px-BlB0OczX.cjs +0 -1
|
@@ -1,828 +0,0 @@
|
|
|
1
|
-
var gt = Object.defineProperty;
|
|
2
|
-
var yt = (t, n, o) => n in t ? gt(t, n, { enumerable: !0, configurable: !0, writable: !0, value: o }) : t[n] = o;
|
|
3
|
-
var X = (t, n, o) => yt(t, typeof n != "symbol" ? n + "" : n, o);
|
|
4
|
-
import { e as Pt, m as q, a as Mt, c as xt, d as vt, b as Lt, p as B, f as lt } from "./feature_metricas-DGfd21VR.js";
|
|
5
|
-
import { m as Q, b as H, e as St, a as At, c as U, p as ut } from "./geometria-px-BxTQKrZN.js";
|
|
6
|
-
const Ct = 111320;
|
|
7
|
-
function It(t) {
|
|
8
|
-
const { lat: n, lng: o } = q(t[0]), e = t[0], s = t[1], r = n, a = Math.max(o, 1);
|
|
9
|
-
return {
|
|
10
|
-
paraXY: (i) => [(i[1] - s) * a, (i[0] - e) * r],
|
|
11
|
-
deXY: (i) => [e + i[1] / r, s + i[0] / a]
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
const C = Object.freeze({
|
|
15
|
-
tipo: "geografico",
|
|
16
|
-
unidade: "m",
|
|
17
|
-
distancia: (t, n) => vt(t, n),
|
|
18
|
-
comprimento: (t, n = !1) => xt(t, n),
|
|
19
|
-
area: (t) => Mt(t),
|
|
20
|
-
planoLocal: It,
|
|
21
|
-
deslocar(t, n, o) {
|
|
22
|
-
const e = q(t[0]), s = o / e.lat, r = n / Math.max(e.lng, 1);
|
|
23
|
-
return [t[0] + s, t[1] + r];
|
|
24
|
-
},
|
|
25
|
-
pontoDaBorda(t, n) {
|
|
26
|
-
return [t[0], t[1] + n / Math.max(q(t[0]).lng, 1)];
|
|
27
|
-
},
|
|
28
|
-
pontoDeMedidaDoRaio: (t, n) => [t[0] + n / Ct, t[1]],
|
|
29
|
-
extremosDoCirculo: Pt,
|
|
30
|
-
fatorEixo: (t) => Math.cos(t[0] * Math.PI / 180) || 1
|
|
31
|
-
});
|
|
32
|
-
function Et(t, n) {
|
|
33
|
-
const o = (e) => {
|
|
34
|
-
let s = !1;
|
|
35
|
-
for (let r = 0, a = e.length - 1; r < e.length; a = r++) {
|
|
36
|
-
const [i, c] = e[r], [l, u] = e[a];
|
|
37
|
-
i > t[0] != l > t[0] && t[1] < (u - c) * (t[0] - i) / (l - i) + c && (s = !s);
|
|
38
|
-
}
|
|
39
|
-
return s;
|
|
40
|
-
};
|
|
41
|
-
return !n[0] || !o(n[0]) ? !1 : !n.slice(1).some(o);
|
|
42
|
-
}
|
|
43
|
-
function ft(t, n, o, e) {
|
|
44
|
-
const s = n[0] - t[0], r = n[1] - t[1], a = e[0] - o[0], i = e[1] - o[1], c = s * i - r * a;
|
|
45
|
-
if (Math.abs(c) < 1e-12) return null;
|
|
46
|
-
const l = ((o[0] - t[0]) * i - (o[1] - t[1]) * a) / c, u = ((o[0] - t[0]) * r - (o[1] - t[1]) * s) / c;
|
|
47
|
-
return l < 0 || l > 1 || u < 0 || u >= 1 ? null : { t: l, u };
|
|
48
|
-
}
|
|
49
|
-
function Y(t) {
|
|
50
|
-
let n = 0;
|
|
51
|
-
for (let o = 0; o < t.length; o++) {
|
|
52
|
-
const [e, s] = t[o], [r, a] = t[(o + 1) % t.length];
|
|
53
|
-
n += e * a - r * s;
|
|
54
|
-
}
|
|
55
|
-
return Math.abs(n) / 2;
|
|
56
|
-
}
|
|
57
|
-
function Zt(t, n, o = C) {
|
|
58
|
-
if (t.length < 3 || n.length < 2) return null;
|
|
59
|
-
const e = o.planoLocal(t[0]), s = T(t, e), r = T(n, e), a = ht(s, r, 0);
|
|
60
|
-
return a && a.length >= 2 ? a.map((i) => G(i, e)) : null;
|
|
61
|
-
}
|
|
62
|
-
function ht(t, n, o) {
|
|
63
|
-
if (o > 8) return null;
|
|
64
|
-
const e = t.length, s = [];
|
|
65
|
-
for (let m = 0; m < n.length - 1; m++)
|
|
66
|
-
for (let M = 0; M < e; M++) {
|
|
67
|
-
const x = ft(n[m], n[m + 1], t[M], t[(M + 1) % e]);
|
|
68
|
-
x && s.push({
|
|
69
|
-
tLinha: m + x.t,
|
|
70
|
-
tAnel: M + x.u,
|
|
71
|
-
ponto: [n[m][0] + x.t * (n[m + 1][0] - n[m][0]), n[m][1] + x.t * (n[m + 1][1] - n[m][1])]
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
if (s.sort((m, M) => m.tLinha - M.tLinha), s.length < 2) return null;
|
|
75
|
-
const [r, a] = s, i = [];
|
|
76
|
-
for (let m = Math.floor(r.tLinha) + 1; m <= Math.floor(a.tLinha); m++)
|
|
77
|
-
m > r.tLinha && m < a.tLinha && i.push(n[m]);
|
|
78
|
-
const c = [r.ponto, ...i, a.ponto];
|
|
79
|
-
let l = r, u = a, f = c;
|
|
80
|
-
r.tAnel > a.tAnel && (l = a, u = r, f = [...c].reverse());
|
|
81
|
-
const h = Math.floor(l.tAnel), d = Math.floor(u.tAnel), y = f.slice(1, -1), g = [l.ponto];
|
|
82
|
-
for (let m = h + 1; m <= d; m++) g.push(t[m % e]);
|
|
83
|
-
g.push(u.ponto, ...[...y].reverse());
|
|
84
|
-
const P = [u.ponto];
|
|
85
|
-
for (let m = d + 1; m <= h + e; m++) P.push(t[m % e]);
|
|
86
|
-
P.push(l.ponto, ...y);
|
|
87
|
-
const R = Y(t) * 1e-9, S = [g, P].filter((m) => m.length >= 3 && Y(m) > R);
|
|
88
|
-
if (S.length < 2) return null;
|
|
89
|
-
const p = [a.ponto, ...n.slice(Math.floor(a.tLinha) + 1)];
|
|
90
|
-
if (s.length > 2 && p.length >= 2) {
|
|
91
|
-
const m = [];
|
|
92
|
-
for (const M of S) {
|
|
93
|
-
const x = ht(M, p, o + 1);
|
|
94
|
-
x ? m.push(...x) : m.push(M);
|
|
95
|
-
}
|
|
96
|
-
return m;
|
|
97
|
-
}
|
|
98
|
-
return S;
|
|
99
|
-
}
|
|
100
|
-
function T(t, n) {
|
|
101
|
-
return t.map((o) => n.paraXY(o));
|
|
102
|
-
}
|
|
103
|
-
function G(t, n) {
|
|
104
|
-
return t.map((o) => n.deXY(o));
|
|
105
|
-
}
|
|
106
|
-
const O = (t, n) => Math.hypot(t[0] - n[0], t[1] - n[1]);
|
|
107
|
-
function $t(t, n = 0, o = C) {
|
|
108
|
-
if (t.length === 0 || t.some((a) => a.length < 2)) return null;
|
|
109
|
-
const e = o.planoLocal(t[0][0]), s = t.slice(1).map((a) => T(a, e));
|
|
110
|
-
let r = T(t[0], e);
|
|
111
|
-
for (; s.length > 0; ) {
|
|
112
|
-
let a = null;
|
|
113
|
-
if (s.forEach((f, h) => {
|
|
114
|
-
const d = r[0], y = r[r.length - 1], g = [
|
|
115
|
-
{ inverter: !1, noFim: !0, d: O(y, f[0]) },
|
|
116
|
-
{ inverter: !0, noFim: !0, d: O(y, f[f.length - 1]) },
|
|
117
|
-
{ inverter: !1, noFim: !1, d: O(d, f[f.length - 1]) },
|
|
118
|
-
{ inverter: !0, noFim: !1, d: O(d, f[0]) }
|
|
119
|
-
];
|
|
120
|
-
for (const P of g) (!a || P.d < a.d) && (a = { idx: h, ...P });
|
|
121
|
-
}), !a || a.d > n) return null;
|
|
122
|
-
const { idx: i, inverter: c, noFim: l } = a;
|
|
123
|
-
let u = s.splice(i, 1)[0];
|
|
124
|
-
c && (u = [...u].reverse()), r = l ? [...r, ...O(r[r.length - 1], u[0]) > 0 ? u : u.slice(1)] : [...u, ...O(u[u.length - 1], r[0]) > 0 ? r : r.slice(1)];
|
|
125
|
-
}
|
|
126
|
-
return G(r, e);
|
|
127
|
-
}
|
|
128
|
-
function bt(t, n, o, e) {
|
|
129
|
-
const s = ft(t, n, o, e);
|
|
130
|
-
return !!s && s.t > 1e-9 && s.t < 1 - 1e-9 && s.u > 1e-9;
|
|
131
|
-
}
|
|
132
|
-
function Ot(t, n) {
|
|
133
|
-
for (let o = 0; o < t.length; o++)
|
|
134
|
-
for (let e = 0; e < n.length; e++)
|
|
135
|
-
if (bt(t[o], t[(o + 1) % t.length], n[e], n[(e + 1) % n.length])) return !0;
|
|
136
|
-
return !1;
|
|
137
|
-
}
|
|
138
|
-
function tn(t, n, o = 0, e = C) {
|
|
139
|
-
if (t.length < 3 || n.length < 3) return null;
|
|
140
|
-
const s = e.planoLocal(t[0]), r = T(t, s), a = T(n, s);
|
|
141
|
-
if (Ot(r, a)) return null;
|
|
142
|
-
let i = { i: 0, j: 0, d: 1 / 0 };
|
|
143
|
-
for (let f = 0; f < r.length; f++)
|
|
144
|
-
for (let h = 0; h < a.length; h++) {
|
|
145
|
-
const d = O(r[f], a[h]);
|
|
146
|
-
d < i.d && (i = { i: f, j: h, d });
|
|
147
|
-
}
|
|
148
|
-
if (i.d > o) return null;
|
|
149
|
-
const { i: c, j: l } = i, u = [];
|
|
150
|
-
for (let f = 0; f <= r.length; f++) u.push(r[(c + f) % r.length]);
|
|
151
|
-
for (let f = 0; f <= a.length; f++) u.push(a[(l + f) % a.length]);
|
|
152
|
-
return G(u, s);
|
|
153
|
-
}
|
|
154
|
-
const Z = 16;
|
|
155
|
-
function $(t, n, o, e) {
|
|
156
|
-
const s = [];
|
|
157
|
-
for (let r = 0; r <= Z; r++) {
|
|
158
|
-
const a = o + (e - o) * r / Z;
|
|
159
|
-
s.push([t[0] + n * Math.cos(a), t[1] + n * Math.sin(a)]);
|
|
160
|
-
}
|
|
161
|
-
return s;
|
|
162
|
-
}
|
|
163
|
-
function V(t, n) {
|
|
164
|
-
const o = O(t, n) || 1;
|
|
165
|
-
return [-(n[1] - t[1]) / o, (n[0] - t[0]) / o];
|
|
166
|
-
}
|
|
167
|
-
function J(t, n, o) {
|
|
168
|
-
const e = t.length, s = [], r = e;
|
|
169
|
-
for (let a = 0; a < r; a++) {
|
|
170
|
-
const i = o ? t[(a - 1 + e) % e] : t[Math.max(0, a - 1)], c = t[a], l = o ? t[(a + 1) % e] : t[Math.min(e - 1, a + 1)], u = a === 0 && !o ? V(c, l) : V(i, c), f = a === e - 1 && !o ? V(i, c) : V(c, l);
|
|
171
|
-
let h = u[0] + f[0], d = u[1] + f[1];
|
|
172
|
-
const y = Math.hypot(h, d);
|
|
173
|
-
if (y < 1e-9) {
|
|
174
|
-
s.push([c[0] + u[0] * n, c[1] + u[1] * n]);
|
|
175
|
-
continue;
|
|
176
|
-
}
|
|
177
|
-
h /= y, d /= y;
|
|
178
|
-
const g = h * u[0] + d * u[1], P = Math.min(1 / Math.max(g, 0.5), 2);
|
|
179
|
-
s.push([c[0] + h * n * P, c[1] + d * n * P]);
|
|
180
|
-
}
|
|
181
|
-
return s;
|
|
182
|
-
}
|
|
183
|
-
function Tt(t) {
|
|
184
|
-
let n = 0;
|
|
185
|
-
for (let o = 0; o < t.length; o++) {
|
|
186
|
-
const [e, s] = t[o], [r, a] = t[(o + 1) % t.length];
|
|
187
|
-
n += (r - e) * (a + s);
|
|
188
|
-
}
|
|
189
|
-
return n > 0;
|
|
190
|
-
}
|
|
191
|
-
function nn(t, n, o = C) {
|
|
192
|
-
if (!Number.isFinite(n) || n === 0) return null;
|
|
193
|
-
if (t.tipo === "Point" || t.tipo === "Text" || t.tipo === "Circle") {
|
|
194
|
-
const e = t.tipo === "Circle" ? t.centro : t.coordenada, s = t.tipo === "Circle" ? t.raioMetros + n : n;
|
|
195
|
-
if (s <= 0) return null;
|
|
196
|
-
const r = o.planoLocal(e), a = 64;
|
|
197
|
-
return Array.from({ length: a }, (i, c) => [s * Math.cos(2 * Math.PI * c / a), s * Math.sin(2 * Math.PI * c / a)]).map((i) => r.deXY(i));
|
|
198
|
-
}
|
|
199
|
-
if (t.tipo === "LineString") {
|
|
200
|
-
if (n < 0 || t.coordenadas.length < 2 || lt(t)) return null;
|
|
201
|
-
const e = o.planoLocal(t.coordenadas[0]), s = T(t.coordenadas, e), r = J(s, n, !1), a = J([...s].reverse(), n, !1), i = s[s.length - 1], c = s[0], l = Math.atan2(i[1] - s[s.length - 2][1], i[0] - s[s.length - 2][0]), u = Math.atan2(c[1] - s[1][1], c[0] - s[1][0]), f = $(i, n, l + Math.PI / 2, l - Math.PI / 2), h = $(c, n, u + Math.PI / 2, u - Math.PI / 2);
|
|
202
|
-
return G([...r, ...f, ...a, ...h], e);
|
|
203
|
-
}
|
|
204
|
-
if (t.tipo === "Polygon") {
|
|
205
|
-
const e = t.aneis[0];
|
|
206
|
-
if (!e || e.length < 3) return null;
|
|
207
|
-
const s = o.planoLocal(e[0]);
|
|
208
|
-
let r = T(e, s);
|
|
209
|
-
Tt(r) && (r = [...r].reverse());
|
|
210
|
-
const i = J(r, -n, !0);
|
|
211
|
-
return i.length < 3 || n < 0 && Y(i) >= Y(r) ? null : G(i, s);
|
|
212
|
-
}
|
|
213
|
-
return null;
|
|
214
|
-
}
|
|
215
|
-
function on(t, n, o, e = C) {
|
|
216
|
-
const s = (r) => e.deslocar(r, n, o);
|
|
217
|
-
switch (t.tipo) {
|
|
218
|
-
case "Point":
|
|
219
|
-
return { tipo: "Point", coordenada: s(t.coordenada) };
|
|
220
|
-
case "Text":
|
|
221
|
-
return { ...t, coordenada: s(t.coordenada) };
|
|
222
|
-
case "Circle":
|
|
223
|
-
return { ...t, centro: s(t.centro) };
|
|
224
|
-
case "LineString": {
|
|
225
|
-
const r = Lt(B(t).map((a) => a.map(s)));
|
|
226
|
-
return t.curva ? { ...r, curva: Q(t.curva, s) } : r;
|
|
227
|
-
}
|
|
228
|
-
case "Polygon": {
|
|
229
|
-
const r = { tipo: "Polygon", aneis: t.aneis.map((a) => a.map(s)) };
|
|
230
|
-
return t.curva ? { ...r, curva: Q(t.curva, s) } : r;
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
const tt = { m: 1, km: 1e3, ft: 0.3048, mi: 1609.344 }, nt = { m2: 1, ha: 1e4, km2: 1e6, ac: 4046.8564224, alqueire: 24200 };
|
|
235
|
-
function en(t, n, o) {
|
|
236
|
-
return t * tt[n] / tt[o];
|
|
237
|
-
}
|
|
238
|
-
function rn(t, n, o) {
|
|
239
|
-
return t * nt[n] / nt[o];
|
|
240
|
-
}
|
|
241
|
-
function an(t, n, o = C) {
|
|
242
|
-
return o.distancia(t, n);
|
|
243
|
-
}
|
|
244
|
-
function sn(t, n, o) {
|
|
245
|
-
return {
|
|
246
|
-
...t,
|
|
247
|
-
id: n,
|
|
248
|
-
geometria: o ?? JSON.parse(JSON.stringify(t.geometria)),
|
|
249
|
-
estilo: t.estilo ? { ...t.estilo } : void 0,
|
|
250
|
-
propriedades: { ...t.propriedades }
|
|
251
|
-
};
|
|
252
|
-
}
|
|
253
|
-
const Nt = 5e3;
|
|
254
|
-
function W(t) {
|
|
255
|
-
return t.tipo === "Polygon" ? 3 : t.tipo === "LineString" ? 2 : 1;
|
|
256
|
-
}
|
|
257
|
-
function cn(t, n = !1) {
|
|
258
|
-
if (t.bloqueada || n) return "bloqueada";
|
|
259
|
-
const o = t.geometria;
|
|
260
|
-
return o.tipo !== "Point" && o.tipo !== "LineString" && o.tipo !== "Polygon" && o.tipo !== "Circle" ? "tipo-nao-suportado" : o.tipo === "Polygon" && o.aneis.length !== 1 ? "poligono-com-furos" : lt(o) ? "multiparte" : I(o).length > Nt ? "muitos-vertices" : null;
|
|
261
|
-
}
|
|
262
|
-
function I(t) {
|
|
263
|
-
return t.tipo === "Point" ? [t.coordenada] : t.tipo === "LineString" ? t.coordenadas : t.tipo === "Polygon" ? t.aneis[0] ?? [] : [];
|
|
264
|
-
}
|
|
265
|
-
function z(t, n) {
|
|
266
|
-
return t.tipo === "Point" ? { tipo: "Point", coordenada: n[0] } : t.tipo === "LineString" ? { tipo: "LineString", coordenadas: n } : t.tipo === "Polygon" ? { tipo: "Polygon", aneis: [n] } : t;
|
|
267
|
-
}
|
|
268
|
-
function ln(t, n, o) {
|
|
269
|
-
const e = I(t).slice();
|
|
270
|
-
return n < 0 || n >= e.length ? t : (e[n] = o, z(t, e));
|
|
271
|
-
}
|
|
272
|
-
function _t(t, n, o) {
|
|
273
|
-
if (t.tipo !== "LineString" && t.tipo !== "Polygon") return t;
|
|
274
|
-
const e = I(t).slice();
|
|
275
|
-
return n < 0 || n >= e.length ? t : (e.splice(n + 1, 0, o), z(t, e));
|
|
276
|
-
}
|
|
277
|
-
function Dt(t, n) {
|
|
278
|
-
if (t.tipo !== "LineString" && t.tipo !== "Polygon") return null;
|
|
279
|
-
const o = I(t);
|
|
280
|
-
return n < 0 || n >= o.length || o.length <= W(t) ? null : z(t, o.filter((e, s) => s !== n));
|
|
281
|
-
}
|
|
282
|
-
function mt(t, n) {
|
|
283
|
-
return [(t[0] + n[0]) / 2, (t[1] + n[1]) / 2];
|
|
284
|
-
}
|
|
285
|
-
function Rt(t) {
|
|
286
|
-
const n = I(t).length, o = [];
|
|
287
|
-
if (t.tipo !== "LineString" && t.tipo !== "Polygon") return o;
|
|
288
|
-
for (let e = 0; e < n - 1; e++) o.push([e, e + 1]);
|
|
289
|
-
return t.tipo === "Polygon" && n > 2 && o.push([n - 1, 0]), o;
|
|
290
|
-
}
|
|
291
|
-
function N(t) {
|
|
292
|
-
return (t.tipo === "LineString" || t.tipo === "Polygon") && t.curva && t.curva.length >= W(t) ? t.curva : null;
|
|
293
|
-
}
|
|
294
|
-
const kt = 0.5;
|
|
295
|
-
function Ft(t, n, o = C) {
|
|
296
|
-
return o.pontoDaBorda(t, n);
|
|
297
|
-
}
|
|
298
|
-
function un(t, n = C) {
|
|
299
|
-
var o;
|
|
300
|
-
return t.tipo === "Circle" ? [t.centro, Ft(t.centro, t.raioMetros, n)] : ((o = N(t)) == null ? void 0 : o.map((e) => e.ponto)) ?? I(t);
|
|
301
|
-
}
|
|
302
|
-
function F(t, n) {
|
|
303
|
-
const o = t.tipo === "Polygon", e = At(n, o);
|
|
304
|
-
return o ? { tipo: "Polygon", aneis: [e], curva: n } : { tipo: "LineString", coordenadas: e, curva: n };
|
|
305
|
-
}
|
|
306
|
-
function fn(t, n, o = C) {
|
|
307
|
-
if (t.tipo === "Circle")
|
|
308
|
-
return n.length < 2 ? t : { ...t, centro: n[0], raioMetros: Math.max(kt, o.distancia(n[0], n[1])) };
|
|
309
|
-
const e = N(t);
|
|
310
|
-
if (!e || e.length !== n.length) return z(t, n);
|
|
311
|
-
const s = e.map((r, a) => {
|
|
312
|
-
const i = n[a][0] - r.ponto[0], c = n[a][1] - r.ponto[1], l = (f) => [f[0] + i, f[1] + c], u = { ponto: n[a] };
|
|
313
|
-
return r.entrada && (u.entrada = l(r.entrada)), r.saida && (u.saida = l(r.saida)), r.modo && (u.modo = r.modo), u;
|
|
314
|
-
});
|
|
315
|
-
return F(t, s);
|
|
316
|
-
}
|
|
317
|
-
function k(t, n, o) {
|
|
318
|
-
return [t[0] + (n[0] - t[0]) * o, t[1] + (n[1] - t[1]) * o];
|
|
319
|
-
}
|
|
320
|
-
function Xt(t, n, o) {
|
|
321
|
-
const [e, s] = U(t, n);
|
|
322
|
-
let r = 0.5, a = 1 / 0;
|
|
323
|
-
for (let i = 1; i < 64; i++) {
|
|
324
|
-
const c = i / 64, l = ut(t.ponto, e, s, n.ponto, c), u = (l[0] - o[0]) ** 2 + (l[1] - o[1]) ** 2;
|
|
325
|
-
u < a && (a = u, r = c);
|
|
326
|
-
}
|
|
327
|
-
return r;
|
|
328
|
-
}
|
|
329
|
-
function jt(t, n, o) {
|
|
330
|
-
const e = N(t);
|
|
331
|
-
if (!e) {
|
|
332
|
-
const a = I(t);
|
|
333
|
-
return mt(a[n], a[o]);
|
|
334
|
-
}
|
|
335
|
-
const [s, r] = U(e[n], e[o]);
|
|
336
|
-
return ut(e[n].ponto, s, r, e[o].ponto, 0.5);
|
|
337
|
-
}
|
|
338
|
-
function wt(t) {
|
|
339
|
-
const n = N(t);
|
|
340
|
-
if (!n) return Rt(t);
|
|
341
|
-
const o = [];
|
|
342
|
-
for (let e = 0; e < n.length - 1; e++) o.push([e, e + 1]);
|
|
343
|
-
return t.tipo === "Polygon" && n.length > 2 && o.push([n.length - 1, 0]), o;
|
|
344
|
-
}
|
|
345
|
-
function hn(t, n, o) {
|
|
346
|
-
const e = N(t);
|
|
347
|
-
if (!e) return _t(t, n, o);
|
|
348
|
-
if (n < 0 || n >= e.length) return t;
|
|
349
|
-
const s = (n + 1) % e.length, r = e[n], a = e[s], i = r.saida === void 0 && a.entrada === void 0;
|
|
350
|
-
let c, l = r, u = a;
|
|
351
|
-
if (i)
|
|
352
|
-
c = { ponto: o };
|
|
353
|
-
else {
|
|
354
|
-
const h = Xt(r, a, o), [d, y] = U(r, a), g = k(r.ponto, d, h), P = k(d, y, h), D = k(y, a.ponto, h), R = k(g, P, h), S = k(P, D, h);
|
|
355
|
-
c = { ponto: k(R, S, h), entrada: R, saida: S, modo: "suave" }, l = { ...r, saida: g }, u = { ...a, entrada: D }, H(r) === "simetrico" && r.entrada && (l.modo = "suave"), H(a) === "simetrico" && a.saida && (u.modo = "suave");
|
|
356
|
-
}
|
|
357
|
-
const f = e.slice();
|
|
358
|
-
return f[n] = l, f[s] = u, f.splice(n + 1, 0, c), F(t, f);
|
|
359
|
-
}
|
|
360
|
-
function mn(t, n) {
|
|
361
|
-
const o = N(t);
|
|
362
|
-
return o ? n < 0 || n >= o.length || o.length <= W(t) ? null : F(t, o.filter((e, s) => s !== n)) : Dt(t, n);
|
|
363
|
-
}
|
|
364
|
-
function K(t) {
|
|
365
|
-
return t.tipo !== "LineString" && t.tipo !== "Polygon" ? null : N(t) ?? I(t).map((n) => ({ ponto: [n[0], n[1]] }));
|
|
366
|
-
}
|
|
367
|
-
const pn = 40;
|
|
368
|
-
function dn(t, n, o) {
|
|
369
|
-
const e = K(t);
|
|
370
|
-
if (!e || n < 0 || n >= e.length) return null;
|
|
371
|
-
const s = t.tipo === "Polygon", r = e.length, a = o === "saida" ? n < r - 1 ? e[n + 1] : s ? e[0] : null : n > 0 ? e[n - 1] : s ? e[r - 1] : null;
|
|
372
|
-
if (!a) return null;
|
|
373
|
-
const i = e[n].ponto;
|
|
374
|
-
return [i[0] + (a.ponto[0] - i[0]) / 3, i[1] + (a.ponto[1] - i[1]) / 3];
|
|
375
|
-
}
|
|
376
|
-
function Gt(t) {
|
|
377
|
-
const n = q(t[0]);
|
|
378
|
-
return { ref: t, mLat: Math.max(n.lat, 1e-9), mLng: Math.max(n.lng, 1e-9) };
|
|
379
|
-
}
|
|
380
|
-
const ot = (t, n) => [(n[1] - t.ref[1]) * t.mLng, (n[0] - t.ref[0]) * t.mLat], Vt = (t, n, o) => [t.ref[0] + o / t.mLat, t.ref[1] + n / t.mLng], qt = (t) => Array.isArray(t) && t.length === 2 && Number.isFinite(t[0]) && Number.isFinite(t[1]);
|
|
381
|
-
function Yt(t, n, o, e, s = !1) {
|
|
382
|
-
const r = H(t), a = s ? "livre" : r === "canto" ? e : r, i = n === "saida" ? "entrada" : "saida", c = { ...t, [n]: o, modo: a };
|
|
383
|
-
if (a === "simetrico")
|
|
384
|
-
c[i] = St(t.ponto, o);
|
|
385
|
-
else if (a === "suave") {
|
|
386
|
-
const l = Gt(t.ponto), [u, f] = ot(l, o), h = Math.hypot(u, f), d = t[i], [y, g] = d ? ot(l, d) : [u, f], P = Math.hypot(y, g);
|
|
387
|
-
h > 0 && P > 0 && (c[i] = Vt(l, -(u / h) * P, -(f / h) * P));
|
|
388
|
-
}
|
|
389
|
-
return c;
|
|
390
|
-
}
|
|
391
|
-
function gn(t, n, o, e, s = !0) {
|
|
392
|
-
const r = K(t);
|
|
393
|
-
if (!r || n < 0 || n >= r.length || !qt(e)) return t;
|
|
394
|
-
const a = r.slice();
|
|
395
|
-
return a[n] = Yt(r[n], o, e, "simetrico", !s), F(t, a);
|
|
396
|
-
}
|
|
397
|
-
function yn(t, n) {
|
|
398
|
-
const o = K(t);
|
|
399
|
-
if (!o || n < 0 || n >= o.length) return t;
|
|
400
|
-
const e = o[n], s = o.slice();
|
|
401
|
-
if (e.entrada || e.saida)
|
|
402
|
-
return s[n] = { ponto: e.ponto }, F(t, s);
|
|
403
|
-
const r = t.tipo === "Polygon", a = o.length, i = n > 0 ? o[n - 1] : r ? o[a - 1] : null, c = n < a - 1 ? o[n + 1] : r ? o[0] : null;
|
|
404
|
-
if (!i && !c) return t;
|
|
405
|
-
const l = e.ponto;
|
|
406
|
-
let u, f;
|
|
407
|
-
if (i && c)
|
|
408
|
-
u = (c.ponto[0] - i.ponto[0]) / 6, f = (c.ponto[1] - i.ponto[1]) / 6;
|
|
409
|
-
else {
|
|
410
|
-
const h = (c ?? i).ponto, d = c ? 1 : -1;
|
|
411
|
-
u = (h[0] - l[0]) / 3 * d, f = (h[1] - l[1]) / 3 * d;
|
|
412
|
-
}
|
|
413
|
-
return s[n] = { ponto: l, saida: [l[0] + u, l[1] + f], entrada: [l[0] - u, l[1] - f] }, F(t, s);
|
|
414
|
-
}
|
|
415
|
-
const Bt = "rgba(255,255,255,0.9)";
|
|
416
|
-
function zt(t) {
|
|
417
|
-
if (!t) return [];
|
|
418
|
-
const n = t.split(/[\s,]+/).map(Number).filter((o) => Number.isFinite(o) && o >= 0);
|
|
419
|
-
return n.length > 0 && n.some((o) => o > 0) ? n.length % 2 === 1 ? [...n, ...n] : n : [];
|
|
420
|
-
}
|
|
421
|
-
const A = (t) => Number.isFinite(t), Jt = /* @__PURE__ */ new Set(["marca", "caixa", "poligono", "circulo", "linha", "ponto"]);
|
|
422
|
-
function Pn(t) {
|
|
423
|
-
let n = 0;
|
|
424
|
-
if (t)
|
|
425
|
-
for (const o of t.itens) Jt.has(o.forma) && n++;
|
|
426
|
-
return n;
|
|
427
|
-
}
|
|
428
|
-
class Mn {
|
|
429
|
-
constructor(n) {
|
|
430
|
-
X(this, "destaques", /* @__PURE__ */ new Set());
|
|
431
|
-
X(this, "destruido", !1);
|
|
432
|
-
/** Estatística da última pintura (diagnóstico e testes). */
|
|
433
|
-
X(this, "ultima", { itens: 0, marcas: 0, preenchimentos: 0, tracos: 0, chamadas: 0 });
|
|
434
|
-
/** Perfil de qualidade `baixa`: ignora `dash` (linha contínua, mais barata no Canvas 2D). */
|
|
435
|
-
X(this, "semTracejado", !1);
|
|
436
|
-
this.alvos = n;
|
|
437
|
-
}
|
|
438
|
-
definirTracejado(n) {
|
|
439
|
-
this.semTracejado = !n;
|
|
440
|
-
}
|
|
441
|
-
destacar(n) {
|
|
442
|
-
this.destaques = new Set(n);
|
|
443
|
-
}
|
|
444
|
-
limpar() {
|
|
445
|
-
const n = this.alvos.sobreposicao();
|
|
446
|
-
n && this.limparSuperficie(n);
|
|
447
|
-
}
|
|
448
|
-
destruir() {
|
|
449
|
-
this.destruido = !0, this.destaques.clear();
|
|
450
|
-
}
|
|
451
|
-
desenhar(n, o, e = {}) {
|
|
452
|
-
const s = { itens: 0, marcas: 0, caixas: 0, preenchimentos: 0, tracos: 0, chamadas: 0 };
|
|
453
|
-
if (this.destruido || !n) return s;
|
|
454
|
-
const r = e.alvo === "sobreposicao", a = o && A(o.dpr) && o.dpr > 0 ? o.dpr : 1;
|
|
455
|
-
if (r) {
|
|
456
|
-
const i = this.alvos.sobreposicao();
|
|
457
|
-
i && e.limpar !== !1 && this.limparSuperficie(i, a);
|
|
458
|
-
}
|
|
459
|
-
for (const i of n.camadas) {
|
|
460
|
-
const c = r ? this.alvos.sobreposicao() : this.alvos.camada(i.camadaId);
|
|
461
|
-
if (!c) continue;
|
|
462
|
-
!r && e.limpar !== !1 ? this.limparSuperficie(c, a) : c.ctx.setTransform(a, 0, 0, a, 0, 0);
|
|
463
|
-
const l = e.recorte;
|
|
464
|
-
l && (c.ctx.save(), c.ctx.beginPath(), c.ctx.rect(l.x, l.y, l.largura, l.altura), c.ctx.clip());
|
|
465
|
-
try {
|
|
466
|
-
this.pintarCamada(c, i, n.origem, r, s);
|
|
467
|
-
} finally {
|
|
468
|
-
l && c.ctx.restore();
|
|
469
|
-
}
|
|
470
|
-
}
|
|
471
|
-
return this.ultima = s, s;
|
|
472
|
-
}
|
|
473
|
-
limparSuperficie(n, o) {
|
|
474
|
-
const e = o ?? n.dpr;
|
|
475
|
-
n.ctx.setTransform(1, 0, 0, 1, 0, 0), n.ctx.clearRect(0, 0, Math.ceil(n.largura * e), Math.ceil(n.altura * e)), n.ctx.setTransform(e, 0, 0, e, 0, 0);
|
|
476
|
-
}
|
|
477
|
-
pintarCamada(n, o, e, s, r) {
|
|
478
|
-
const a = n.ctx, i = [], c = [], l = [], u = [], f = [];
|
|
479
|
-
for (const h of o.itens)
|
|
480
|
-
switch (h.forma) {
|
|
481
|
-
case "marca":
|
|
482
|
-
i.push(h);
|
|
483
|
-
break;
|
|
484
|
-
case "caixa":
|
|
485
|
-
c.push(h);
|
|
486
|
-
break;
|
|
487
|
-
case "poligono":
|
|
488
|
-
case "circulo":
|
|
489
|
-
l.push(h);
|
|
490
|
-
break;
|
|
491
|
-
case "linha":
|
|
492
|
-
u.push(h);
|
|
493
|
-
break;
|
|
494
|
-
case "ponto":
|
|
495
|
-
f.push(h);
|
|
496
|
-
break;
|
|
497
|
-
}
|
|
498
|
-
if (r.itens += i.length + c.length + l.length + u.length + f.length, a.lineJoin = "round", a.lineCap = "round", s)
|
|
499
|
-
for (const h of [...l, ...u, ...f]) (h.destaque || this.destaques.has(h.id)) && this.halo(a, h, e, r);
|
|
500
|
-
this.pintarMarcas(a, i, e, r), this.pintarCaixas(a, c, e, r), this.pintarGrupos(a, l, e, r, !0), this.pintarGrupos(a, u, e, r, !1), this.pintarGrupos(a, f, e, r, !0), a.globalAlpha = 1, a.setLineDash([]), a.lineDashOffset = 0;
|
|
501
|
-
}
|
|
502
|
-
agrupar(n) {
|
|
503
|
-
const o = /* @__PURE__ */ new Map();
|
|
504
|
-
for (const e of n) {
|
|
505
|
-
const s = o.get(e.estilo);
|
|
506
|
-
s ? s.push(e) : o.set(e.estilo, [e]);
|
|
507
|
-
}
|
|
508
|
-
return o;
|
|
509
|
-
}
|
|
510
|
-
/** Marcas de LOD: `fillRect` por marca, a cor definida uma vez por grupo. */
|
|
511
|
-
pintarMarcas(n, o, e, s) {
|
|
512
|
-
for (const [r, a] of this.agrupar(o)) {
|
|
513
|
-
n.fillStyle = r.corPreenchimento, n.globalAlpha = r.opacidadePreenchimento, s.chamadas += 2;
|
|
514
|
-
for (const i of a) {
|
|
515
|
-
const c = i.geometriaEmPx[0];
|
|
516
|
-
if (!c) continue;
|
|
517
|
-
const l = c[0] - e.x, u = c[1] - e.y;
|
|
518
|
-
if (!(A(l) && A(u))) continue;
|
|
519
|
-
const f = i.raioPx >= 2 ? 2 : 1;
|
|
520
|
-
n.fillRect(Math.round(l - f / 2), Math.round(u - f / 2), f, f), s.marcas++, s.chamadas++;
|
|
521
|
-
}
|
|
522
|
-
}
|
|
523
|
-
}
|
|
524
|
-
/**
|
|
525
|
-
* Formas miúdas: o envelope (`[minX, minY, maxX, maxY]` em px de mundo) alargado por meio traço e alinhado ao pixel,
|
|
526
|
-
* num `fillRect` sem antisserrilhado; lado mínimo de 1 px. Cor e opacidade do traço (sem traço: do preenchimento).
|
|
527
|
-
*/
|
|
528
|
-
pintarCaixas(n, o, e, s) {
|
|
529
|
-
for (const [r, a] of this.agrupar(o)) {
|
|
530
|
-
const i = r.traco && r.peso > 0, c = r.preencher && r.opacidadePreenchimento > 0;
|
|
531
|
-
if (!i && !c) continue;
|
|
532
|
-
n.fillStyle = i ? r.cor : r.corPreenchimento, n.globalAlpha = i ? r.opacidadeTraco ?? 1 : r.opacidadePreenchimento;
|
|
533
|
-
const l = i ? r.peso / 2 : 0;
|
|
534
|
-
s.chamadas += 2;
|
|
535
|
-
for (const u of a) {
|
|
536
|
-
const f = u.geometriaEmPx[0];
|
|
537
|
-
if (!f || f.length < 4) continue;
|
|
538
|
-
const h = Math.floor(f[0] - e.x - l), d = Math.floor(f[1] - e.y - l), y = Math.ceil(f[2] - e.x + l), g = Math.ceil(f[3] - e.y + l);
|
|
539
|
-
A(h) && A(d) && A(y) && A(g) && (n.fillRect(h, d, Math.max(1, y - h), Math.max(1, g - d)), s.caixas = (s.caixas ?? 0) + 1, s.chamadas++);
|
|
540
|
-
}
|
|
541
|
-
}
|
|
542
|
-
}
|
|
543
|
-
/** Caminho de um item: anéis/partes (polígono e linha), círculo ou ponto. */
|
|
544
|
-
caminho(n, o, e) {
|
|
545
|
-
if (o.forma === "circulo" || o.forma === "ponto") {
|
|
546
|
-
const r = o.geometriaEmPx[0];
|
|
547
|
-
if (!r) return;
|
|
548
|
-
const a = r[0] - e.x, i = r[1] - e.y;
|
|
549
|
-
A(a) && A(i) && A(o.raioPx) && (n.moveTo(a + o.raioPx, i), n.arc(a, i, o.raioPx, 0, Math.PI * 2));
|
|
550
|
-
return;
|
|
551
|
-
}
|
|
552
|
-
const s = o.forma === "poligono";
|
|
553
|
-
for (const r of o.geometriaEmPx) {
|
|
554
|
-
const a = r.length >> 1;
|
|
555
|
-
if (a < 2) continue;
|
|
556
|
-
let i = !1;
|
|
557
|
-
for (let c = 0; c < a; c++) {
|
|
558
|
-
const l = r[c * 2] - e.x, u = r[c * 2 + 1] - e.y;
|
|
559
|
-
A(l) && A(u) && (i ? n.lineTo(l, u) : (n.moveTo(l, u), i = !0));
|
|
560
|
-
}
|
|
561
|
-
i && s && n.closePath();
|
|
562
|
-
}
|
|
563
|
-
}
|
|
564
|
-
/**
|
|
565
|
-
* Polígonos, círculos, linhas e pontos: o estilo do grupo é definido uma vez; cada forma é um caminho próprio com
|
|
566
|
-
* preenchimento (se o estilo preenche) e traço. `areas` = tipos que podem ser preenchidos.
|
|
567
|
-
*/
|
|
568
|
-
pintarGrupos(n, o, e, s, r) {
|
|
569
|
-
for (const [a, i] of this.agrupar(o)) {
|
|
570
|
-
const c = r && a.preencher && a.opacidadePreenchimento > 0, l = a.traco && a.peso > 0;
|
|
571
|
-
if (!(!c && !l)) {
|
|
572
|
-
c && (n.fillStyle = a.corPreenchimento), l && (n.strokeStyle = a.cor, n.lineWidth = a.peso, n.setLineDash(this.semTracejado ? [] : zt(a.dash)), n.lineDashOffset = this.semTracejado ? 0 : a.deslocamentoDash ?? 0, n.lineCap = a.terminacao ?? "round", n.lineJoin = a.juncao ?? "round"), s.chamadas += 3;
|
|
573
|
-
for (const u of i)
|
|
574
|
-
n.beginPath(), this.caminho(n, u, e), c && (n.globalAlpha = a.opacidadePreenchimento, n.fill(), s.preenchimentos++, s.chamadas++), l && (n.globalAlpha = a.opacidadeTraco ?? 1, n.stroke(), s.tracos++, s.chamadas++);
|
|
575
|
-
}
|
|
576
|
-
}
|
|
577
|
-
}
|
|
578
|
-
/** Halo de destaque (hover): traço claro, mais grosso, por baixo do desenho normal. */
|
|
579
|
-
halo(n, o, e, s) {
|
|
580
|
-
n.strokeStyle = Bt, n.lineWidth = Math.max(o.estilo.peso, 1) + 4, n.globalAlpha = 0.9, n.setLineDash([]), n.lineCap = "round", n.lineJoin = "round", n.beginPath(), this.caminho(n, o, e), n.stroke(), s.tracos++, s.chamadas += 4;
|
|
581
|
-
}
|
|
582
|
-
}
|
|
583
|
-
const et = 36, rt = 0.45;
|
|
584
|
-
function xn(t, n) {
|
|
585
|
-
const o = Math.abs(n[0] - t[0]), e = Math.abs(n[1] - t[1]);
|
|
586
|
-
if (o === 0 && e === 0) return null;
|
|
587
|
-
const s = [];
|
|
588
|
-
for (let r = 0; r < et; r++) {
|
|
589
|
-
const a = r * 2 * Math.PI / et;
|
|
590
|
-
s.push([t[0] + o * Math.sin(a), t[1] + e * Math.cos(a)]);
|
|
591
|
-
}
|
|
592
|
-
return s;
|
|
593
|
-
}
|
|
594
|
-
function pt(t, n, o) {
|
|
595
|
-
const e = o.fatorEixo(t), s = n[0] - t[0], r = (n[1] - t[1]) * e, a = Math.hypot(s, r);
|
|
596
|
-
return a === 0 ? null : { raio: a, inicio: Math.atan2(s, r), cosLat: e };
|
|
597
|
-
}
|
|
598
|
-
function vn(t, n, o = 6, e = C) {
|
|
599
|
-
const s = pt(t, n, e);
|
|
600
|
-
if (!s || o < 3) return null;
|
|
601
|
-
const r = [];
|
|
602
|
-
for (let a = 0; a < o; a++) {
|
|
603
|
-
const i = s.inicio + a * 2 * Math.PI / o;
|
|
604
|
-
r.push([t[0] + s.raio * Math.sin(i), t[1] + s.raio * Math.cos(i) / s.cosLat]);
|
|
605
|
-
}
|
|
606
|
-
return r;
|
|
607
|
-
}
|
|
608
|
-
function Ln(t, n, o = 5, e = C, s = rt) {
|
|
609
|
-
const r = pt(t, n, e);
|
|
610
|
-
if (!r || o < 3) return null;
|
|
611
|
-
const a = Number.isFinite(s) && s > 0 && s <= 1 ? s : rt, i = o * 2, c = [];
|
|
612
|
-
for (let l = 0; l < i; l++) {
|
|
613
|
-
const u = l % 2 === 0 ? r.raio : r.raio * a, f = r.inicio + l * 2 * Math.PI / i;
|
|
614
|
-
c.push([t[0] + u * Math.sin(f), t[1] + u * Math.cos(f) / r.cosLat]);
|
|
615
|
-
}
|
|
616
|
-
return c;
|
|
617
|
-
}
|
|
618
|
-
const Ht = 10, j = (t, n) => Math.hypot(t.x - n.x, t.y - n.y);
|
|
619
|
-
function at(t, n, o) {
|
|
620
|
-
const e = o.x - n.x, s = o.y - n.y, r = e * e + s * s, a = r === 0 ? 0 : Math.max(0, Math.min(1, ((t.x - n.x) * e + (t.y - n.y) * s) / r));
|
|
621
|
-
return { t: a, d: Math.hypot(t.x - (n.x + a * e), t.y - (n.y + a * s)) };
|
|
622
|
-
}
|
|
623
|
-
function Sn(t, n, o, e = {}, s) {
|
|
624
|
-
const r = e.toleranciaPx ?? Ht, a = e.vertice !== !1, i = e.meio !== !1, c = e.aresta !== !1;
|
|
625
|
-
let l = null, u = null, f = null;
|
|
626
|
-
const h = (d, y) => !d || y.distanciaPx < d.distanciaPx ? y : d;
|
|
627
|
-
for (const d of n) {
|
|
628
|
-
if (d.excluida || d.oculta) continue;
|
|
629
|
-
const y = !!s && s.feicaoId === d.id && (s.camadaId === void 0 || s.camadaId === d.camadaId), g = d.geometria, P = { feicaoId: d.id, camadaId: d.camadaId };
|
|
630
|
-
if (g.tipo === "Point" || g.tipo === "Text" || g.tipo === "Circle") {
|
|
631
|
-
if (!a || y) continue;
|
|
632
|
-
const p = g.tipo === "Circle" ? g.centro : g.coordenada, m = j(t, o(p));
|
|
633
|
-
m <= r && (l = h(l, { tipo: "vertice", coordenada: p, distanciaPx: m, ...P }));
|
|
634
|
-
continue;
|
|
635
|
-
}
|
|
636
|
-
if (y && (g.tipo === "LineString" || g.tipo === "Polygon") && g.curva) continue;
|
|
637
|
-
const D = g.tipo === "LineString" || g.tipo === "Polygon" ? N(g) : null;
|
|
638
|
-
if (D) {
|
|
639
|
-
if (a)
|
|
640
|
-
for (const p of D) {
|
|
641
|
-
const m = j(t, o(p.ponto));
|
|
642
|
-
m <= r && (l = h(l, { tipo: "vertice", coordenada: p.ponto, distanciaPx: m, ...P }));
|
|
643
|
-
}
|
|
644
|
-
if (i)
|
|
645
|
-
for (const [p, m] of wt(g)) {
|
|
646
|
-
const M = jt(g, p, m), x = j(t, o(M));
|
|
647
|
-
x <= r && (u = h(u, { tipo: "meio", coordenada: M, distanciaPx: x, ...P }));
|
|
648
|
-
}
|
|
649
|
-
if (c) {
|
|
650
|
-
const p = I(g), m = p.map(o), M = g.tipo === "Polygon" && p.length > 2 ? p.length : p.length - 1;
|
|
651
|
-
for (let x = 0; x < M; x++) {
|
|
652
|
-
const v = x, L = (x + 1) % p.length, { t: E, d: b } = at(t, m[v], m[L]);
|
|
653
|
-
if (b <= r) {
|
|
654
|
-
const _ = [p[v][0] + E * (p[L][0] - p[v][0]), p[v][1] + E * (p[L][1] - p[v][1])];
|
|
655
|
-
f = h(f, { tipo: "aresta", coordenada: _, distanciaPx: b, ...P });
|
|
656
|
-
}
|
|
657
|
-
}
|
|
658
|
-
}
|
|
659
|
-
continue;
|
|
660
|
-
}
|
|
661
|
-
const R = g.tipo === "LineString" ? B(g).map((p) => ({ pts: p, fechado: !1 })) : [{ pts: I(g), fechado: g.tipo === "Polygon" }], S = y ? s.vertice : void 0;
|
|
662
|
-
for (const { pts: p, fechado: m } of R) {
|
|
663
|
-
const M = p.map(o);
|
|
664
|
-
if (a)
|
|
665
|
-
for (let v = 0; v < p.length; v++) {
|
|
666
|
-
if (v === S) continue;
|
|
667
|
-
const L = j(t, M[v]);
|
|
668
|
-
L <= r && (l = h(l, { tipo: "vertice", coordenada: p[v], distanciaPx: L, ...P }));
|
|
669
|
-
}
|
|
670
|
-
if (!i && !c) continue;
|
|
671
|
-
const x = m && p.length > 2 ? p.length : p.length - 1;
|
|
672
|
-
for (let v = 0; v < x; v++) {
|
|
673
|
-
const L = v, E = (v + 1) % p.length;
|
|
674
|
-
if (!(S !== void 0 && (L === S || E === S)) && !(y && S === void 0)) {
|
|
675
|
-
if (i) {
|
|
676
|
-
const b = mt(p[L], p[E]), _ = j(t, o(b));
|
|
677
|
-
_ <= r && (u = h(u, { tipo: "meio", coordenada: b, distanciaPx: _, ...P }));
|
|
678
|
-
}
|
|
679
|
-
if (c) {
|
|
680
|
-
const { t: b, d: _ } = at(t, M[L], M[E]);
|
|
681
|
-
if (_ <= r) {
|
|
682
|
-
const dt = [p[L][0] + b * (p[E][0] - p[L][0]), p[L][1] + b * (p[E][1] - p[L][1])];
|
|
683
|
-
f = h(f, { tipo: "aresta", coordenada: dt, distanciaPx: _, ...P });
|
|
684
|
-
}
|
|
685
|
-
}
|
|
686
|
-
}
|
|
687
|
-
}
|
|
688
|
-
}
|
|
689
|
-
}
|
|
690
|
-
return l ?? u ?? f;
|
|
691
|
-
}
|
|
692
|
-
function w(t, n) {
|
|
693
|
-
return t.x >= n.x1 && t.x <= n.x2 && t.y >= n.y1 && t.y <= n.y2;
|
|
694
|
-
}
|
|
695
|
-
function st(t, n, o) {
|
|
696
|
-
let e = 0, s = 1;
|
|
697
|
-
const r = n.x - t.x, a = n.y - t.y, i = [-r, r, -a, a], c = [t.x - o.x1, o.x2 - t.x, t.y - o.y1, o.y2 - t.y];
|
|
698
|
-
for (let l = 0; l < 4; l++)
|
|
699
|
-
if (i[l] === 0) {
|
|
700
|
-
if (c[l] < 0) return !1;
|
|
701
|
-
} else {
|
|
702
|
-
const u = c[l] / i[l];
|
|
703
|
-
if (i[l] < 0) {
|
|
704
|
-
if (u > s) return !1;
|
|
705
|
-
u > e && (e = u);
|
|
706
|
-
} else {
|
|
707
|
-
if (u < e) return !1;
|
|
708
|
-
u < s && (s = u);
|
|
709
|
-
}
|
|
710
|
-
}
|
|
711
|
-
return !0;
|
|
712
|
-
}
|
|
713
|
-
function it(t, n) {
|
|
714
|
-
let o = !1;
|
|
715
|
-
for (let e = 0, s = n.length - 1; e < n.length; s = e++) {
|
|
716
|
-
const r = n[e], a = n[s];
|
|
717
|
-
r.y > t.y != a.y > t.y && t.x < (a.x - r.x) * (t.y - r.y) / (a.y - r.y) + r.x && (o = !o);
|
|
718
|
-
}
|
|
719
|
-
return o;
|
|
720
|
-
}
|
|
721
|
-
function ct(t, n, o) {
|
|
722
|
-
for (let e = 1; e < t.length; e++) if (st(t[e - 1], t[e], n)) return !0;
|
|
723
|
-
return o && t.length > 2 && st(t[t.length - 1], t[0], n);
|
|
724
|
-
}
|
|
725
|
-
function Ut(t, n, o, e) {
|
|
726
|
-
const s = o(t), r = o(e.pontoDeMedidaDoRaio(t, n));
|
|
727
|
-
return Math.hypot(r.x - s.x, r.y - s.y);
|
|
728
|
-
}
|
|
729
|
-
function An(t, n, o, e, s = C) {
|
|
730
|
-
if (t.oculta) return !1;
|
|
731
|
-
const r = t.geometria, a = e === "window";
|
|
732
|
-
switch (r.tipo) {
|
|
733
|
-
case "Point":
|
|
734
|
-
case "Text":
|
|
735
|
-
return w(o(r.coordenada), n);
|
|
736
|
-
case "LineString": {
|
|
737
|
-
const i = B(r).map((c) => c.map(o));
|
|
738
|
-
return a ? i.every((c) => c.every((l) => w(l, n))) : i.some((c) => c.some((l) => w(l, n)) || ct(c, n, !1));
|
|
739
|
-
}
|
|
740
|
-
case "Polygon": {
|
|
741
|
-
const i = r.aneis.map((u) => u.map(o)), c = i[0];
|
|
742
|
-
if (!c) return !1;
|
|
743
|
-
if (a) return c.every((u) => w(u, n));
|
|
744
|
-
if (i.some((u) => u.some((f) => w(f, n)) || ct(u, n, !0))) return !0;
|
|
745
|
-
const l = { x: n.x1, y: n.y1 };
|
|
746
|
-
return it(l, c) && !i.slice(1).some((u) => it(l, u));
|
|
747
|
-
}
|
|
748
|
-
case "Circle": {
|
|
749
|
-
const i = o(r.centro), c = Ut(r.centro, r.raioMetros, o, s);
|
|
750
|
-
if (a)
|
|
751
|
-
return i.x - c >= n.x1 && i.x + c <= n.x2 && i.y - c >= n.y1 && i.y + c <= n.y2;
|
|
752
|
-
const l = Math.max(n.x1, Math.min(i.x, n.x2)), u = Math.max(n.y1, Math.min(i.y, n.y2));
|
|
753
|
-
return Math.hypot(i.x - l, i.y - u) <= c;
|
|
754
|
-
}
|
|
755
|
-
}
|
|
756
|
-
}
|
|
757
|
-
function Cn(t, n) {
|
|
758
|
-
if (n.length < 3 || t.oculta) return !1;
|
|
759
|
-
const o = (s) => Et(s, [n]), e = t.geometria;
|
|
760
|
-
switch (e.tipo) {
|
|
761
|
-
case "Point":
|
|
762
|
-
case "Text":
|
|
763
|
-
return o(e.coordenada);
|
|
764
|
-
case "Circle":
|
|
765
|
-
return o(e.centro);
|
|
766
|
-
case "LineString":
|
|
767
|
-
return B(e).some((s) => s.some(o));
|
|
768
|
-
case "Polygon": {
|
|
769
|
-
const s = e.aneis[0] ?? [];
|
|
770
|
-
if (s.some(o)) return !0;
|
|
771
|
-
if (s.length < 3) return !1;
|
|
772
|
-
const r = s.reduce((a, i) => [a[0] + i[0], a[1] + i[1]], [0, 0]);
|
|
773
|
-
return o([r[0] / s.length, r[1] / s.length]);
|
|
774
|
-
}
|
|
775
|
-
}
|
|
776
|
-
}
|
|
777
|
-
export {
|
|
778
|
-
hn as A,
|
|
779
|
-
mn as B,
|
|
780
|
-
W as C,
|
|
781
|
-
cn as D,
|
|
782
|
-
C as E,
|
|
783
|
-
Sn as F,
|
|
784
|
-
Cn as G,
|
|
785
|
-
An as H,
|
|
786
|
-
Nt as I,
|
|
787
|
-
z as J,
|
|
788
|
-
rn as K,
|
|
789
|
-
en as L,
|
|
790
|
-
pn as M,
|
|
791
|
-
an as N,
|
|
792
|
-
_t as O,
|
|
793
|
-
Mn as P,
|
|
794
|
-
ln as Q,
|
|
795
|
-
kt as R,
|
|
796
|
-
zt as S,
|
|
797
|
-
Ht as T,
|
|
798
|
-
Ft as U,
|
|
799
|
-
mt as V,
|
|
800
|
-
Dt as W,
|
|
801
|
-
I as X,
|
|
802
|
-
vn as a,
|
|
803
|
-
Ln as b,
|
|
804
|
-
Pn as c,
|
|
805
|
-
Zt as d,
|
|
806
|
-
sn as e,
|
|
807
|
-
nn as f,
|
|
808
|
-
xn as g,
|
|
809
|
-
on as h,
|
|
810
|
-
tn as i,
|
|
811
|
-
$t as j,
|
|
812
|
-
ot as k,
|
|
813
|
-
Vt as l,
|
|
814
|
-
F as m,
|
|
815
|
-
K as n,
|
|
816
|
-
yn as o,
|
|
817
|
-
Et as p,
|
|
818
|
-
un as q,
|
|
819
|
-
fn as r,
|
|
820
|
-
Rt as s,
|
|
821
|
-
gn as t,
|
|
822
|
-
Yt as u,
|
|
823
|
-
Gt as v,
|
|
824
|
-
dn as w,
|
|
825
|
-
wt as x,
|
|
826
|
-
N as y,
|
|
827
|
-
jt as z
|
|
828
|
-
};
|