@thibezer/ui-components-kit 2.28.2 → 2.30.0
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 +1260 -1206
- package/dist/camadas.cjs +87 -87
- package/dist/camadas.js +1871 -1302
- package/dist/canvas.cjs +41 -40
- package/dist/canvas.js +1727 -1620
- package/dist/components/ui-barra-ferramentas/ribbon-atualizacao.d.ts +10 -0
- package/dist/components/ui-barra-ferramentas/ui-ribbon.d.ts +25 -5
- package/dist/components/ui-camadas/camadas-arvore-renderer.d.ts +11 -0
- package/dist/components/ui-camadas/camadas-atualizacao-incremental.d.ts +26 -5
- package/dist/components/ui-camadas/camadas-colecao.d.ts +15 -0
- package/dist/components/ui-camadas/camadas-host.d.ts +12 -0
- package/dist/components/ui-camadas/camadas-janela-dom.d.ts +44 -0
- package/dist/components/ui-camadas/camadas-linha-feicao.d.ts +10 -1
- package/dist/components/ui-camadas/camadas-render.d.ts +19 -2
- package/dist/components/ui-camadas/camadas-selecao-api.d.ts +6 -0
- package/dist/components/ui-camadas/camadas-virtual.d.ts +135 -0
- package/dist/components/ui-camadas/ui-camadas.d.ts +51 -2
- package/dist/components/ui-canvas-cad/cad-hud-coordenadas.d.ts +4 -0
- package/dist/components/ui-canvas-cad/ui-canvas-cad.d.ts +10 -0
- package/dist/components/ui-seletor-mapa-base/index.d.ts +1 -0
- package/dist/components/ui-seletor-mapa-base/seletor-mapa-base-util.d.ts +32 -0
- package/dist/components/ui-seletor-mapa-base/tipos.d.ts +8 -1
- package/dist/components/ui-seletor-mapa-base/ui-seletor-mapa-base.d.ts +9 -0
- package/dist/custom-elements.json +13133 -10526
- package/dist/feature_caixa-DOchASgS.js +828 -0
- package/dist/feature_caixa-MrJEfMol.cjs +1 -0
- package/dist/{feature_desenho-edf-dHuf.js → feature_desenho-Cq3H27as.js} +2 -2
- package/dist/{feature_desenho-DRHnu8u8.cjs → feature_desenho-eq3MIZR9.cjs} +1 -1
- package/dist/geometria-px-BlB0OczX.cjs +1 -0
- package/dist/geometria-px-BxTQKrZN.js +577 -0
- package/dist/gerencigeo-canvas/feature_adapters.d.ts +7 -0
- package/dist/gerencigeo-canvas/feature_indice.d.ts +7 -0
- package/dist/gerencigeo-canvas/feature_lod.d.ts +16 -0
- package/dist/gerencigeo-canvas/motor/dados-camada.d.ts +11 -1
- package/dist/gerencigeo-canvas/motor/geometria-px.d.ts +9 -0
- package/dist/gerencigeo-canvas/motor/motor-formas.d.ts +28 -5
- package/dist/gerencigeo-canvas/motor/tipos.d.ts +7 -3
- package/dist/gerencigeo-canvas/qualidade.d.ts +5 -0
- package/dist/gerencigeo-canvas/renderers/canvas_formas_leaflet.d.ts +10 -0
- package/dist/gerencigeo-canvas/renderers/feicoes_canvas_renderer.d.ts +10 -0
- package/dist/gerencigeo-canvas/renderers/renderizador_formas.d.ts +7 -0
- package/dist/index.cjs +4 -4
- package/dist/index.js +84 -82
- package/dist/motor.cjs +1 -1
- package/dist/motor.js +616 -497
- package/dist/prancha-nucleo.cjs +1 -1
- package/dist/prancha-nucleo.js +3 -3
- package/dist/prancha.cjs +1 -1
- package/dist/prancha.js +3 -3
- package/dist/seletor-mapa-base.cjs +16 -16
- package/dist/seletor-mapa-base.js +183 -102
- package/dist/tipos-elementos.d.ts +2 -0
- package/dist/tipos-vue.d.ts +2 -0
- package/dist/tools.cjs +5 -5
- package/dist/tools.js +438 -369
- package/package.json +1 -1
- package/dist/feature_caixa-BLVtatpp.cjs +0 -1
- package/dist/feature_caixa-CHAdzESq.js +0 -806
- package/dist/geometria-px-DEAIxMG5.js +0 -512
- package/dist/geometria-px-DJcNHXbE.cjs +0 -1
|
@@ -1,806 +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 vt, d as Lt, b as xt, 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-DEAIxMG5.js";
|
|
6
|
-
const Ct = 111320;
|
|
7
|
-
function It(t) {
|
|
8
|
-
const { lat: n, lng: o } = q(t[0]), e = t[0], a = t[1], r = n, s = Math.max(o, 1);
|
|
9
|
-
return {
|
|
10
|
-
paraXY: (i) => [(i[1] - a) * s, (i[0] - e) * r],
|
|
11
|
-
deXY: (i) => [e + i[1] / r, a + i[0] / s]
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
const A = Object.freeze({
|
|
15
|
-
tipo: "geografico",
|
|
16
|
-
unidade: "m",
|
|
17
|
-
distancia: (t, n) => Lt(t, n),
|
|
18
|
-
comprimento: (t, n = !1) => vt(t, n),
|
|
19
|
-
area: (t) => Mt(t),
|
|
20
|
-
planoLocal: It,
|
|
21
|
-
deslocar(t, n, o) {
|
|
22
|
-
const e = q(t[0]), a = o / e.lat, r = n / Math.max(e.lng, 1);
|
|
23
|
-
return [t[0] + a, 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 a = !1;
|
|
35
|
-
for (let r = 0, s = e.length - 1; r < e.length; s = r++) {
|
|
36
|
-
const [i, c] = e[r], [l, u] = e[s];
|
|
37
|
-
i > t[0] != l > t[0] && t[1] < (u - c) * (t[0] - i) / (l - i) + c && (a = !a);
|
|
38
|
-
}
|
|
39
|
-
return a;
|
|
40
|
-
};
|
|
41
|
-
return !n[0] || !o(n[0]) ? !1 : !n.slice(1).some(o);
|
|
42
|
-
}
|
|
43
|
-
function ft(t, n, o, e) {
|
|
44
|
-
const a = n[0] - t[0], r = n[1] - t[1], s = e[0] - o[0], i = e[1] - o[1], c = a * i - r * s;
|
|
45
|
-
if (Math.abs(c) < 1e-12) return null;
|
|
46
|
-
const l = ((o[0] - t[0]) * i - (o[1] - t[1]) * s) / c, u = ((o[0] - t[0]) * r - (o[1] - t[1]) * a) / 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, a] = t[o], [r, s] = t[(o + 1) % t.length];
|
|
53
|
-
n += e * s - r * a;
|
|
54
|
-
}
|
|
55
|
-
return Math.abs(n) / 2;
|
|
56
|
-
}
|
|
57
|
-
function Zt(t, n, o = A) {
|
|
58
|
-
if (t.length < 3 || n.length < 2) return null;
|
|
59
|
-
const e = o.planoLocal(t[0]), a = T(t, e), r = T(n, e), s = ht(a, r, 0);
|
|
60
|
-
return s && s.length >= 2 ? s.map((i) => G(i, e)) : null;
|
|
61
|
-
}
|
|
62
|
-
function ht(t, n, o) {
|
|
63
|
-
if (o > 8) return null;
|
|
64
|
-
const e = t.length, a = [];
|
|
65
|
-
for (let h = 0; h < n.length - 1; h++)
|
|
66
|
-
for (let M = 0; M < e; M++) {
|
|
67
|
-
const v = ft(n[h], n[h + 1], t[M], t[(M + 1) % e]);
|
|
68
|
-
v && a.push({
|
|
69
|
-
tLinha: h + v.t,
|
|
70
|
-
tAnel: M + v.u,
|
|
71
|
-
ponto: [n[h][0] + v.t * (n[h + 1][0] - n[h][0]), n[h][1] + v.t * (n[h + 1][1] - n[h][1])]
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
if (a.sort((h, M) => h.tLinha - M.tLinha), a.length < 2) return null;
|
|
75
|
-
const [r, s] = a, i = [];
|
|
76
|
-
for (let h = Math.floor(r.tLinha) + 1; h <= Math.floor(s.tLinha); h++)
|
|
77
|
-
h > r.tLinha && h < s.tLinha && i.push(n[h]);
|
|
78
|
-
const c = [r.ponto, ...i, s.ponto];
|
|
79
|
-
let l = r, u = s, f = c;
|
|
80
|
-
r.tAnel > s.tAnel && (l = s, u = r, f = [...c].reverse());
|
|
81
|
-
const p = Math.floor(l.tAnel), d = Math.floor(u.tAnel), P = f.slice(1, -1), g = [l.ponto];
|
|
82
|
-
for (let h = p + 1; h <= d; h++) g.push(t[h % e]);
|
|
83
|
-
g.push(u.ponto, ...[...P].reverse());
|
|
84
|
-
const y = [u.ponto];
|
|
85
|
-
for (let h = d + 1; h <= p + e; h++) y.push(t[h % e]);
|
|
86
|
-
y.push(l.ponto, ...P);
|
|
87
|
-
const R = Y(t) * 1e-9, S = [g, y].filter((h) => h.length >= 3 && Y(h) > R);
|
|
88
|
-
if (S.length < 2) return null;
|
|
89
|
-
const m = [s.ponto, ...n.slice(Math.floor(s.tLinha) + 1)];
|
|
90
|
-
if (a.length > 2 && m.length >= 2) {
|
|
91
|
-
const h = [];
|
|
92
|
-
for (const M of S) {
|
|
93
|
-
const v = ht(M, m, o + 1);
|
|
94
|
-
v ? h.push(...v) : h.push(M);
|
|
95
|
-
}
|
|
96
|
-
return h;
|
|
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 b = (t, n) => Math.hypot(t[0] - n[0], t[1] - n[1]);
|
|
107
|
-
function $t(t, n = 0, o = A) {
|
|
108
|
-
if (t.length === 0 || t.some((s) => s.length < 2)) return null;
|
|
109
|
-
const e = o.planoLocal(t[0][0]), a = t.slice(1).map((s) => T(s, e));
|
|
110
|
-
let r = T(t[0], e);
|
|
111
|
-
for (; a.length > 0; ) {
|
|
112
|
-
let s = null;
|
|
113
|
-
if (a.forEach((f, p) => {
|
|
114
|
-
const d = r[0], P = r[r.length - 1], g = [
|
|
115
|
-
{ inverter: !1, noFim: !0, d: b(P, f[0]) },
|
|
116
|
-
{ inverter: !0, noFim: !0, d: b(P, f[f.length - 1]) },
|
|
117
|
-
{ inverter: !1, noFim: !1, d: b(d, f[f.length - 1]) },
|
|
118
|
-
{ inverter: !0, noFim: !1, d: b(d, f[0]) }
|
|
119
|
-
];
|
|
120
|
-
for (const y of g) (!s || y.d < s.d) && (s = { idx: p, ...y });
|
|
121
|
-
}), !s || s.d > n) return null;
|
|
122
|
-
const { idx: i, inverter: c, noFim: l } = s;
|
|
123
|
-
let u = a.splice(i, 1)[0];
|
|
124
|
-
c && (u = [...u].reverse()), r = l ? [...r, ...b(r[r.length - 1], u[0]) > 0 ? u : u.slice(1)] : [...u, ...b(u[u.length - 1], r[0]) > 0 ? r : r.slice(1)];
|
|
125
|
-
}
|
|
126
|
-
return G(r, e);
|
|
127
|
-
}
|
|
128
|
-
function Ot(t, n, o, e) {
|
|
129
|
-
const a = ft(t, n, o, e);
|
|
130
|
-
return !!a && a.t > 1e-9 && a.t < 1 - 1e-9 && a.u > 1e-9;
|
|
131
|
-
}
|
|
132
|
-
function bt(t, n) {
|
|
133
|
-
for (let o = 0; o < t.length; o++)
|
|
134
|
-
for (let e = 0; e < n.length; e++)
|
|
135
|
-
if (Ot(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 = A) {
|
|
139
|
-
if (t.length < 3 || n.length < 3) return null;
|
|
140
|
-
const a = e.planoLocal(t[0]), r = T(t, a), s = T(n, a);
|
|
141
|
-
if (bt(r, s)) return null;
|
|
142
|
-
let i = { i: 0, j: 0, d: 1 / 0 };
|
|
143
|
-
for (let f = 0; f < r.length; f++)
|
|
144
|
-
for (let p = 0; p < s.length; p++) {
|
|
145
|
-
const d = b(r[f], s[p]);
|
|
146
|
-
d < i.d && (i = { i: f, j: p, 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 <= s.length; f++) u.push(s[(l + f) % s.length]);
|
|
152
|
-
return G(u, a);
|
|
153
|
-
}
|
|
154
|
-
const Z = 16;
|
|
155
|
-
function $(t, n, o, e) {
|
|
156
|
-
const a = [];
|
|
157
|
-
for (let r = 0; r <= Z; r++) {
|
|
158
|
-
const s = o + (e - o) * r / Z;
|
|
159
|
-
a.push([t[0] + n * Math.cos(s), t[1] + n * Math.sin(s)]);
|
|
160
|
-
}
|
|
161
|
-
return a;
|
|
162
|
-
}
|
|
163
|
-
function V(t, n) {
|
|
164
|
-
const o = b(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, a = [], r = e;
|
|
169
|
-
for (let s = 0; s < r; s++) {
|
|
170
|
-
const i = o ? t[(s - 1 + e) % e] : t[Math.max(0, s - 1)], c = t[s], l = o ? t[(s + 1) % e] : t[Math.min(e - 1, s + 1)], u = s === 0 && !o ? V(c, l) : V(i, c), f = s === e - 1 && !o ? V(i, c) : V(c, l);
|
|
171
|
-
let p = u[0] + f[0], d = u[1] + f[1];
|
|
172
|
-
const P = Math.hypot(p, d);
|
|
173
|
-
if (P < 1e-9) {
|
|
174
|
-
a.push([c[0] + u[0] * n, c[1] + u[1] * n]);
|
|
175
|
-
continue;
|
|
176
|
-
}
|
|
177
|
-
p /= P, d /= P;
|
|
178
|
-
const g = p * u[0] + d * u[1], y = Math.min(1 / Math.max(g, 0.5), 2);
|
|
179
|
-
a.push([c[0] + p * n * y, c[1] + d * n * y]);
|
|
180
|
-
}
|
|
181
|
-
return a;
|
|
182
|
-
}
|
|
183
|
-
function Tt(t) {
|
|
184
|
-
let n = 0;
|
|
185
|
-
for (let o = 0; o < t.length; o++) {
|
|
186
|
-
const [e, a] = t[o], [r, s] = t[(o + 1) % t.length];
|
|
187
|
-
n += (r - e) * (s + a);
|
|
188
|
-
}
|
|
189
|
-
return n > 0;
|
|
190
|
-
}
|
|
191
|
-
function nn(t, n, o = A) {
|
|
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, a = t.tipo === "Circle" ? t.raioMetros + n : n;
|
|
195
|
-
if (a <= 0) return null;
|
|
196
|
-
const r = o.planoLocal(e), s = 64;
|
|
197
|
-
return Array.from({ length: s }, (i, c) => [a * Math.cos(2 * Math.PI * c / s), a * Math.sin(2 * Math.PI * c / s)]).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]), a = T(t.coordenadas, e), r = J(a, n, !1), s = J([...a].reverse(), n, !1), i = a[a.length - 1], c = a[0], l = Math.atan2(i[1] - a[a.length - 2][1], i[0] - a[a.length - 2][0]), u = Math.atan2(c[1] - a[1][1], c[0] - a[1][0]), f = $(i, n, l + Math.PI / 2, l - Math.PI / 2), p = $(c, n, u + Math.PI / 2, u - Math.PI / 2);
|
|
202
|
-
return G([...r, ...f, ...s, ...p], e);
|
|
203
|
-
}
|
|
204
|
-
if (t.tipo === "Polygon") {
|
|
205
|
-
const e = t.aneis[0];
|
|
206
|
-
if (!e || e.length < 3) return null;
|
|
207
|
-
const a = o.planoLocal(e[0]);
|
|
208
|
-
let r = T(e, a);
|
|
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, a);
|
|
212
|
-
}
|
|
213
|
-
return null;
|
|
214
|
-
}
|
|
215
|
-
function on(t, n, o, e = A) {
|
|
216
|
-
const a = (r) => e.deslocar(r, n, o);
|
|
217
|
-
switch (t.tipo) {
|
|
218
|
-
case "Point":
|
|
219
|
-
return { tipo: "Point", coordenada: a(t.coordenada) };
|
|
220
|
-
case "Text":
|
|
221
|
-
return { ...t, coordenada: a(t.coordenada) };
|
|
222
|
-
case "Circle":
|
|
223
|
-
return { ...t, centro: a(t.centro) };
|
|
224
|
-
case "LineString": {
|
|
225
|
-
const r = xt(B(t).map((s) => s.map(a)));
|
|
226
|
-
return t.curva ? { ...r, curva: Q(t.curva, a) } : r;
|
|
227
|
-
}
|
|
228
|
-
case "Polygon": {
|
|
229
|
-
const r = { tipo: "Polygon", aneis: t.aneis.map((s) => s.map(a)) };
|
|
230
|
-
return t.curva ? { ...r, curva: Q(t.curva, a) } : 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 sn(t, n, o = A) {
|
|
242
|
-
return o.distancia(t, n);
|
|
243
|
-
}
|
|
244
|
-
function an(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" : C(o).length > Nt ? "muitos-vertices" : null;
|
|
261
|
-
}
|
|
262
|
-
function C(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 = C(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 = C(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 = C(t);
|
|
280
|
-
return n < 0 || n >= o.length || o.length <= W(t) ? null : z(t, o.filter((e, a) => a !== 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 = C(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 = A) {
|
|
296
|
-
return o.pontoDaBorda(t, n);
|
|
297
|
-
}
|
|
298
|
-
function un(t, n = A) {
|
|
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)) ?? C(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 = A) {
|
|
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 a = e.map((r, s) => {
|
|
312
|
-
const i = n[s][0] - r.ponto[0], c = n[s][1] - r.ponto[1], l = (f) => [f[0] + i, f[1] + c], u = { ponto: n[s] };
|
|
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, a);
|
|
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, a] = U(t, n);
|
|
322
|
-
let r = 0.5, s = 1 / 0;
|
|
323
|
-
for (let i = 1; i < 64; i++) {
|
|
324
|
-
const c = i / 64, l = ut(t.ponto, e, a, n.ponto, c), u = (l[0] - o[0]) ** 2 + (l[1] - o[1]) ** 2;
|
|
325
|
-
u < s && (s = u, r = c);
|
|
326
|
-
}
|
|
327
|
-
return r;
|
|
328
|
-
}
|
|
329
|
-
function jt(t, n, o) {
|
|
330
|
-
const e = N(t);
|
|
331
|
-
if (!e) {
|
|
332
|
-
const s = C(t);
|
|
333
|
-
return mt(s[n], s[o]);
|
|
334
|
-
}
|
|
335
|
-
const [a, r] = U(e[n], e[o]);
|
|
336
|
-
return ut(e[n].ponto, a, 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 a = (n + 1) % e.length, r = e[n], s = e[a], i = r.saida === void 0 && s.entrada === void 0;
|
|
350
|
-
let c, l = r, u = s;
|
|
351
|
-
if (i)
|
|
352
|
-
c = { ponto: o };
|
|
353
|
-
else {
|
|
354
|
-
const p = Xt(r, s, o), [d, P] = U(r, s), g = k(r.ponto, d, p), y = k(d, P, p), D = k(P, s.ponto, p), R = k(g, y, p), S = k(y, D, p);
|
|
355
|
-
c = { ponto: k(R, S, p), entrada: R, saida: S, modo: "suave" }, l = { ...r, saida: g }, u = { ...s, entrada: D }, H(r) === "simetrico" && r.entrada && (l.modo = "suave"), H(s) === "simetrico" && s.saida && (u.modo = "suave");
|
|
356
|
-
}
|
|
357
|
-
const f = e.slice();
|
|
358
|
-
return f[n] = l, f[a] = 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, a) => a !== n)) : Dt(t, n);
|
|
363
|
-
}
|
|
364
|
-
function K(t) {
|
|
365
|
-
return t.tipo !== "LineString" && t.tipo !== "Polygon" ? null : N(t) ?? C(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 a = t.tipo === "Polygon", r = e.length, s = o === "saida" ? n < r - 1 ? e[n + 1] : a ? e[0] : null : n > 0 ? e[n - 1] : a ? e[r - 1] : null;
|
|
372
|
-
if (!s) return null;
|
|
373
|
-
const i = e[n].ponto;
|
|
374
|
-
return [i[0] + (s.ponto[0] - i[0]) / 3, i[1] + (s.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, a = !1) {
|
|
382
|
-
const r = H(t), s = a ? "livre" : r === "canto" ? e : r, i = n === "saida" ? "entrada" : "saida", c = { ...t, [n]: o, modo: s };
|
|
383
|
-
if (s === "simetrico")
|
|
384
|
-
c[i] = St(t.ponto, o);
|
|
385
|
-
else if (s === "suave") {
|
|
386
|
-
const l = Gt(t.ponto), [u, f] = ot(l, o), p = Math.hypot(u, f), d = t[i], [P, g] = d ? ot(l, d) : [u, f], y = Math.hypot(P, g);
|
|
387
|
-
p > 0 && y > 0 && (c[i] = Vt(l, -(u / p) * y, -(f / p) * y));
|
|
388
|
-
}
|
|
389
|
-
return c;
|
|
390
|
-
}
|
|
391
|
-
function gn(t, n, o, e, a = !0) {
|
|
392
|
-
const r = K(t);
|
|
393
|
-
if (!r || n < 0 || n >= r.length || !qt(e)) return t;
|
|
394
|
-
const s = r.slice();
|
|
395
|
-
return s[n] = Yt(r[n], o, e, "simetrico", !a), F(t, s);
|
|
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], a = o.slice();
|
|
401
|
-
if (e.entrada || e.saida)
|
|
402
|
-
return a[n] = { ponto: e.ponto }, F(t, a);
|
|
403
|
-
const r = t.tipo === "Polygon", s = o.length, i = n > 0 ? o[n - 1] : r ? o[s - 1] : null, c = n < s - 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 p = (c ?? i).ponto, d = c ? 1 : -1;
|
|
411
|
-
u = (p[0] - l[0]) / 3 * d, f = (p[1] - l[1]) / 3 * d;
|
|
412
|
-
}
|
|
413
|
-
return a[n] = { ponto: l, saida: [l[0] + u, l[1] + f], entrada: [l[0] - u, l[1] - f] }, F(t, a);
|
|
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 O = (t) => Number.isFinite(t), Jt = /* @__PURE__ */ new Set(["marca", "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 a = { itens: 0, marcas: 0, preenchimentos: 0, tracos: 0, chamadas: 0 };
|
|
453
|
-
if (this.destruido || !n) return a;
|
|
454
|
-
const r = e.alvo === "sobreposicao", s = o && O(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, s);
|
|
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, s) : c.ctx.setTransform(s, 0, 0, s, 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, a);
|
|
467
|
-
} finally {
|
|
468
|
-
l && c.ctx.restore();
|
|
469
|
-
}
|
|
470
|
-
}
|
|
471
|
-
return this.ultima = a, a;
|
|
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, a, r) {
|
|
478
|
-
const s = n.ctx, i = [], c = [], l = [], u = [];
|
|
479
|
-
for (const f of o.itens)
|
|
480
|
-
switch (f.forma) {
|
|
481
|
-
case "marca":
|
|
482
|
-
i.push(f);
|
|
483
|
-
break;
|
|
484
|
-
case "poligono":
|
|
485
|
-
case "circulo":
|
|
486
|
-
c.push(f);
|
|
487
|
-
break;
|
|
488
|
-
case "linha":
|
|
489
|
-
l.push(f);
|
|
490
|
-
break;
|
|
491
|
-
case "ponto":
|
|
492
|
-
u.push(f);
|
|
493
|
-
break;
|
|
494
|
-
}
|
|
495
|
-
if (r.itens += i.length + c.length + l.length + u.length, s.lineJoin = "round", s.lineCap = "round", a)
|
|
496
|
-
for (const f of [...c, ...l, ...u]) (f.destaque || this.destaques.has(f.id)) && this.halo(s, f, e, r);
|
|
497
|
-
this.pintarMarcas(s, i, e, r), this.pintarGrupos(s, c, e, r, !0), this.pintarGrupos(s, l, e, r, !1), this.pintarGrupos(s, u, e, r, !0), s.globalAlpha = 1, s.setLineDash([]), s.lineDashOffset = 0;
|
|
498
|
-
}
|
|
499
|
-
agrupar(n) {
|
|
500
|
-
const o = /* @__PURE__ */ new Map();
|
|
501
|
-
for (const e of n) {
|
|
502
|
-
const a = o.get(e.estilo);
|
|
503
|
-
a ? a.push(e) : o.set(e.estilo, [e]);
|
|
504
|
-
}
|
|
505
|
-
return o;
|
|
506
|
-
}
|
|
507
|
-
/** Marcas de LOD: `fillRect` por marca, a cor definida uma vez por grupo. */
|
|
508
|
-
pintarMarcas(n, o, e, a) {
|
|
509
|
-
for (const [r, s] of this.agrupar(o)) {
|
|
510
|
-
n.fillStyle = r.corPreenchimento, n.globalAlpha = r.opacidadePreenchimento, a.chamadas += 2;
|
|
511
|
-
for (const i of s) {
|
|
512
|
-
const c = i.geometriaEmPx[0];
|
|
513
|
-
if (!c) continue;
|
|
514
|
-
const l = c[0] - e.x, u = c[1] - e.y;
|
|
515
|
-
if (!(O(l) && O(u))) continue;
|
|
516
|
-
const f = i.raioPx >= 2 ? 2 : 1;
|
|
517
|
-
n.fillRect(Math.round(l - f / 2), Math.round(u - f / 2), f, f), a.marcas++, a.chamadas++;
|
|
518
|
-
}
|
|
519
|
-
}
|
|
520
|
-
}
|
|
521
|
-
/** Caminho de um item: anéis/partes (polígono e linha), círculo ou ponto. */
|
|
522
|
-
caminho(n, o, e) {
|
|
523
|
-
if (o.forma === "circulo" || o.forma === "ponto") {
|
|
524
|
-
const r = o.geometriaEmPx[0];
|
|
525
|
-
if (!r) return;
|
|
526
|
-
const s = r[0] - e.x, i = r[1] - e.y;
|
|
527
|
-
O(s) && O(i) && O(o.raioPx) && (n.moveTo(s + o.raioPx, i), n.arc(s, i, o.raioPx, 0, Math.PI * 2));
|
|
528
|
-
return;
|
|
529
|
-
}
|
|
530
|
-
const a = o.forma === "poligono";
|
|
531
|
-
for (const r of o.geometriaEmPx) {
|
|
532
|
-
const s = r.length >> 1;
|
|
533
|
-
if (s < 2) continue;
|
|
534
|
-
let i = !1;
|
|
535
|
-
for (let c = 0; c < s; c++) {
|
|
536
|
-
const l = r[c * 2] - e.x, u = r[c * 2 + 1] - e.y;
|
|
537
|
-
O(l) && O(u) && (i ? n.lineTo(l, u) : (n.moveTo(l, u), i = !0));
|
|
538
|
-
}
|
|
539
|
-
i && a && n.closePath();
|
|
540
|
-
}
|
|
541
|
-
}
|
|
542
|
-
/**
|
|
543
|
-
* Polígonos, círculos, linhas e pontos: o estilo do grupo é definido uma vez; cada forma é um caminho próprio com
|
|
544
|
-
* preenchimento (se o estilo preenche) e traço. `areas` = tipos que podem ser preenchidos.
|
|
545
|
-
*/
|
|
546
|
-
pintarGrupos(n, o, e, a, r) {
|
|
547
|
-
for (const [s, i] of this.agrupar(o)) {
|
|
548
|
-
const c = r && s.preencher && s.opacidadePreenchimento > 0, l = s.traco && s.peso > 0;
|
|
549
|
-
if (!(!c && !l)) {
|
|
550
|
-
c && (n.fillStyle = s.corPreenchimento), l && (n.strokeStyle = s.cor, n.lineWidth = s.peso, n.setLineDash(this.semTracejado ? [] : zt(s.dash)), n.lineDashOffset = this.semTracejado ? 0 : s.deslocamentoDash ?? 0, n.lineCap = s.terminacao ?? "round", n.lineJoin = s.juncao ?? "round"), a.chamadas += 3;
|
|
551
|
-
for (const u of i)
|
|
552
|
-
n.beginPath(), this.caminho(n, u, e), c && (n.globalAlpha = s.opacidadePreenchimento, n.fill(), a.preenchimentos++, a.chamadas++), l && (n.globalAlpha = s.opacidadeTraco ?? 1, n.stroke(), a.tracos++, a.chamadas++);
|
|
553
|
-
}
|
|
554
|
-
}
|
|
555
|
-
}
|
|
556
|
-
/** Halo de destaque (hover): traço claro, mais grosso, por baixo do desenho normal. */
|
|
557
|
-
halo(n, o, e, a) {
|
|
558
|
-
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(), a.tracos++, a.chamadas += 4;
|
|
559
|
-
}
|
|
560
|
-
}
|
|
561
|
-
const et = 36, rt = 0.45;
|
|
562
|
-
function vn(t, n) {
|
|
563
|
-
const o = Math.abs(n[0] - t[0]), e = Math.abs(n[1] - t[1]);
|
|
564
|
-
if (o === 0 && e === 0) return null;
|
|
565
|
-
const a = [];
|
|
566
|
-
for (let r = 0; r < et; r++) {
|
|
567
|
-
const s = r * 2 * Math.PI / et;
|
|
568
|
-
a.push([t[0] + o * Math.sin(s), t[1] + e * Math.cos(s)]);
|
|
569
|
-
}
|
|
570
|
-
return a;
|
|
571
|
-
}
|
|
572
|
-
function pt(t, n, o) {
|
|
573
|
-
const e = o.fatorEixo(t), a = n[0] - t[0], r = (n[1] - t[1]) * e, s = Math.hypot(a, r);
|
|
574
|
-
return s === 0 ? null : { raio: s, inicio: Math.atan2(a, r), cosLat: e };
|
|
575
|
-
}
|
|
576
|
-
function Ln(t, n, o = 6, e = A) {
|
|
577
|
-
const a = pt(t, n, e);
|
|
578
|
-
if (!a || o < 3) return null;
|
|
579
|
-
const r = [];
|
|
580
|
-
for (let s = 0; s < o; s++) {
|
|
581
|
-
const i = a.inicio + s * 2 * Math.PI / o;
|
|
582
|
-
r.push([t[0] + a.raio * Math.sin(i), t[1] + a.raio * Math.cos(i) / a.cosLat]);
|
|
583
|
-
}
|
|
584
|
-
return r;
|
|
585
|
-
}
|
|
586
|
-
function xn(t, n, o = 5, e = A, a = rt) {
|
|
587
|
-
const r = pt(t, n, e);
|
|
588
|
-
if (!r || o < 3) return null;
|
|
589
|
-
const s = Number.isFinite(a) && a > 0 && a <= 1 ? a : rt, i = o * 2, c = [];
|
|
590
|
-
for (let l = 0; l < i; l++) {
|
|
591
|
-
const u = l % 2 === 0 ? r.raio : r.raio * s, f = r.inicio + l * 2 * Math.PI / i;
|
|
592
|
-
c.push([t[0] + u * Math.sin(f), t[1] + u * Math.cos(f) / r.cosLat]);
|
|
593
|
-
}
|
|
594
|
-
return c;
|
|
595
|
-
}
|
|
596
|
-
const Ht = 10, j = (t, n) => Math.hypot(t.x - n.x, t.y - n.y);
|
|
597
|
-
function st(t, n, o) {
|
|
598
|
-
const e = o.x - n.x, a = o.y - n.y, r = e * e + a * a, s = r === 0 ? 0 : Math.max(0, Math.min(1, ((t.x - n.x) * e + (t.y - n.y) * a) / r));
|
|
599
|
-
return { t: s, d: Math.hypot(t.x - (n.x + s * e), t.y - (n.y + s * a)) };
|
|
600
|
-
}
|
|
601
|
-
function Sn(t, n, o, e = {}, a) {
|
|
602
|
-
const r = e.toleranciaPx ?? Ht, s = e.vertice !== !1, i = e.meio !== !1, c = e.aresta !== !1;
|
|
603
|
-
let l = null, u = null, f = null;
|
|
604
|
-
const p = (d, P) => !d || P.distanciaPx < d.distanciaPx ? P : d;
|
|
605
|
-
for (const d of n) {
|
|
606
|
-
if (d.excluida || d.oculta) continue;
|
|
607
|
-
const P = !!a && a.feicaoId === d.id && (a.camadaId === void 0 || a.camadaId === d.camadaId), g = d.geometria, y = { feicaoId: d.id, camadaId: d.camadaId };
|
|
608
|
-
if (g.tipo === "Point" || g.tipo === "Text" || g.tipo === "Circle") {
|
|
609
|
-
if (!s || P) continue;
|
|
610
|
-
const m = g.tipo === "Circle" ? g.centro : g.coordenada, h = j(t, o(m));
|
|
611
|
-
h <= r && (l = p(l, { tipo: "vertice", coordenada: m, distanciaPx: h, ...y }));
|
|
612
|
-
continue;
|
|
613
|
-
}
|
|
614
|
-
if (P && (g.tipo === "LineString" || g.tipo === "Polygon") && g.curva) continue;
|
|
615
|
-
const D = g.tipo === "LineString" || g.tipo === "Polygon" ? N(g) : null;
|
|
616
|
-
if (D) {
|
|
617
|
-
if (s)
|
|
618
|
-
for (const m of D) {
|
|
619
|
-
const h = j(t, o(m.ponto));
|
|
620
|
-
h <= r && (l = p(l, { tipo: "vertice", coordenada: m.ponto, distanciaPx: h, ...y }));
|
|
621
|
-
}
|
|
622
|
-
if (i)
|
|
623
|
-
for (const [m, h] of wt(g)) {
|
|
624
|
-
const M = jt(g, m, h), v = j(t, o(M));
|
|
625
|
-
v <= r && (u = p(u, { tipo: "meio", coordenada: M, distanciaPx: v, ...y }));
|
|
626
|
-
}
|
|
627
|
-
if (c) {
|
|
628
|
-
const m = C(g), h = m.map(o), M = g.tipo === "Polygon" && m.length > 2 ? m.length : m.length - 1;
|
|
629
|
-
for (let v = 0; v < M; v++) {
|
|
630
|
-
const L = v, x = (v + 1) % m.length, { t: I, d: E } = st(t, h[L], h[x]);
|
|
631
|
-
if (E <= r) {
|
|
632
|
-
const _ = [m[L][0] + I * (m[x][0] - m[L][0]), m[L][1] + I * (m[x][1] - m[L][1])];
|
|
633
|
-
f = p(f, { tipo: "aresta", coordenada: _, distanciaPx: E, ...y });
|
|
634
|
-
}
|
|
635
|
-
}
|
|
636
|
-
}
|
|
637
|
-
continue;
|
|
638
|
-
}
|
|
639
|
-
const R = g.tipo === "LineString" ? B(g).map((m) => ({ pts: m, fechado: !1 })) : [{ pts: C(g), fechado: g.tipo === "Polygon" }], S = P ? a.vertice : void 0;
|
|
640
|
-
for (const { pts: m, fechado: h } of R) {
|
|
641
|
-
const M = m.map(o);
|
|
642
|
-
if (s)
|
|
643
|
-
for (let L = 0; L < m.length; L++) {
|
|
644
|
-
if (L === S) continue;
|
|
645
|
-
const x = j(t, M[L]);
|
|
646
|
-
x <= r && (l = p(l, { tipo: "vertice", coordenada: m[L], distanciaPx: x, ...y }));
|
|
647
|
-
}
|
|
648
|
-
if (!i && !c) continue;
|
|
649
|
-
const v = h && m.length > 2 ? m.length : m.length - 1;
|
|
650
|
-
for (let L = 0; L < v; L++) {
|
|
651
|
-
const x = L, I = (L + 1) % m.length;
|
|
652
|
-
if (!(S !== void 0 && (x === S || I === S)) && !(P && S === void 0)) {
|
|
653
|
-
if (i) {
|
|
654
|
-
const E = mt(m[x], m[I]), _ = j(t, o(E));
|
|
655
|
-
_ <= r && (u = p(u, { tipo: "meio", coordenada: E, distanciaPx: _, ...y }));
|
|
656
|
-
}
|
|
657
|
-
if (c) {
|
|
658
|
-
const { t: E, d: _ } = st(t, M[x], M[I]);
|
|
659
|
-
if (_ <= r) {
|
|
660
|
-
const dt = [m[x][0] + E * (m[I][0] - m[x][0]), m[x][1] + E * (m[I][1] - m[x][1])];
|
|
661
|
-
f = p(f, { tipo: "aresta", coordenada: dt, distanciaPx: _, ...y });
|
|
662
|
-
}
|
|
663
|
-
}
|
|
664
|
-
}
|
|
665
|
-
}
|
|
666
|
-
}
|
|
667
|
-
}
|
|
668
|
-
return l ?? u ?? f;
|
|
669
|
-
}
|
|
670
|
-
function w(t, n) {
|
|
671
|
-
return t.x >= n.x1 && t.x <= n.x2 && t.y >= n.y1 && t.y <= n.y2;
|
|
672
|
-
}
|
|
673
|
-
function at(t, n, o) {
|
|
674
|
-
let e = 0, a = 1;
|
|
675
|
-
const r = n.x - t.x, s = n.y - t.y, i = [-r, r, -s, s], c = [t.x - o.x1, o.x2 - t.x, t.y - o.y1, o.y2 - t.y];
|
|
676
|
-
for (let l = 0; l < 4; l++)
|
|
677
|
-
if (i[l] === 0) {
|
|
678
|
-
if (c[l] < 0) return !1;
|
|
679
|
-
} else {
|
|
680
|
-
const u = c[l] / i[l];
|
|
681
|
-
if (i[l] < 0) {
|
|
682
|
-
if (u > a) return !1;
|
|
683
|
-
u > e && (e = u);
|
|
684
|
-
} else {
|
|
685
|
-
if (u < e) return !1;
|
|
686
|
-
u < a && (a = u);
|
|
687
|
-
}
|
|
688
|
-
}
|
|
689
|
-
return !0;
|
|
690
|
-
}
|
|
691
|
-
function it(t, n) {
|
|
692
|
-
let o = !1;
|
|
693
|
-
for (let e = 0, a = n.length - 1; e < n.length; a = e++) {
|
|
694
|
-
const r = n[e], s = n[a];
|
|
695
|
-
r.y > t.y != s.y > t.y && t.x < (s.x - r.x) * (t.y - r.y) / (s.y - r.y) + r.x && (o = !o);
|
|
696
|
-
}
|
|
697
|
-
return o;
|
|
698
|
-
}
|
|
699
|
-
function ct(t, n, o) {
|
|
700
|
-
for (let e = 1; e < t.length; e++) if (at(t[e - 1], t[e], n)) return !0;
|
|
701
|
-
return o && t.length > 2 && at(t[t.length - 1], t[0], n);
|
|
702
|
-
}
|
|
703
|
-
function Ut(t, n, o, e) {
|
|
704
|
-
const a = o(t), r = o(e.pontoDeMedidaDoRaio(t, n));
|
|
705
|
-
return Math.hypot(r.x - a.x, r.y - a.y);
|
|
706
|
-
}
|
|
707
|
-
function An(t, n, o, e, a = A) {
|
|
708
|
-
if (t.oculta) return !1;
|
|
709
|
-
const r = t.geometria, s = e === "window";
|
|
710
|
-
switch (r.tipo) {
|
|
711
|
-
case "Point":
|
|
712
|
-
case "Text":
|
|
713
|
-
return w(o(r.coordenada), n);
|
|
714
|
-
case "LineString": {
|
|
715
|
-
const i = B(r).map((c) => c.map(o));
|
|
716
|
-
return s ? i.every((c) => c.every((l) => w(l, n))) : i.some((c) => c.some((l) => w(l, n)) || ct(c, n, !1));
|
|
717
|
-
}
|
|
718
|
-
case "Polygon": {
|
|
719
|
-
const i = r.aneis.map((u) => u.map(o)), c = i[0];
|
|
720
|
-
if (!c) return !1;
|
|
721
|
-
if (s) return c.every((u) => w(u, n));
|
|
722
|
-
if (i.some((u) => u.some((f) => w(f, n)) || ct(u, n, !0))) return !0;
|
|
723
|
-
const l = { x: n.x1, y: n.y1 };
|
|
724
|
-
return it(l, c) && !i.slice(1).some((u) => it(l, u));
|
|
725
|
-
}
|
|
726
|
-
case "Circle": {
|
|
727
|
-
const i = o(r.centro), c = Ut(r.centro, r.raioMetros, o, a);
|
|
728
|
-
if (s)
|
|
729
|
-
return i.x - c >= n.x1 && i.x + c <= n.x2 && i.y - c >= n.y1 && i.y + c <= n.y2;
|
|
730
|
-
const l = Math.max(n.x1, Math.min(i.x, n.x2)), u = Math.max(n.y1, Math.min(i.y, n.y2));
|
|
731
|
-
return Math.hypot(i.x - l, i.y - u) <= c;
|
|
732
|
-
}
|
|
733
|
-
}
|
|
734
|
-
}
|
|
735
|
-
function Cn(t, n) {
|
|
736
|
-
if (n.length < 3 || t.oculta) return !1;
|
|
737
|
-
const o = (a) => Et(a, [n]), e = t.geometria;
|
|
738
|
-
switch (e.tipo) {
|
|
739
|
-
case "Point":
|
|
740
|
-
case "Text":
|
|
741
|
-
return o(e.coordenada);
|
|
742
|
-
case "Circle":
|
|
743
|
-
return o(e.centro);
|
|
744
|
-
case "LineString":
|
|
745
|
-
return B(e).some((a) => a.some(o));
|
|
746
|
-
case "Polygon": {
|
|
747
|
-
const a = e.aneis[0] ?? [];
|
|
748
|
-
if (a.some(o)) return !0;
|
|
749
|
-
if (a.length < 3) return !1;
|
|
750
|
-
const r = a.reduce((s, i) => [s[0] + i[0], s[1] + i[1]], [0, 0]);
|
|
751
|
-
return o([r[0] / a.length, r[1] / a.length]);
|
|
752
|
-
}
|
|
753
|
-
}
|
|
754
|
-
}
|
|
755
|
-
export {
|
|
756
|
-
hn as A,
|
|
757
|
-
mn as B,
|
|
758
|
-
W as C,
|
|
759
|
-
cn as D,
|
|
760
|
-
A as E,
|
|
761
|
-
Sn as F,
|
|
762
|
-
Cn as G,
|
|
763
|
-
An as H,
|
|
764
|
-
Nt as I,
|
|
765
|
-
z as J,
|
|
766
|
-
rn as K,
|
|
767
|
-
en as L,
|
|
768
|
-
pn as M,
|
|
769
|
-
sn as N,
|
|
770
|
-
_t as O,
|
|
771
|
-
Mn as P,
|
|
772
|
-
ln as Q,
|
|
773
|
-
kt as R,
|
|
774
|
-
zt as S,
|
|
775
|
-
Ht as T,
|
|
776
|
-
Ft as U,
|
|
777
|
-
mt as V,
|
|
778
|
-
Dt as W,
|
|
779
|
-
C as X,
|
|
780
|
-
Ln as a,
|
|
781
|
-
xn as b,
|
|
782
|
-
Pn as c,
|
|
783
|
-
Zt as d,
|
|
784
|
-
an as e,
|
|
785
|
-
nn as f,
|
|
786
|
-
vn as g,
|
|
787
|
-
on as h,
|
|
788
|
-
tn as i,
|
|
789
|
-
$t as j,
|
|
790
|
-
ot as k,
|
|
791
|
-
Vt as l,
|
|
792
|
-
F as m,
|
|
793
|
-
K as n,
|
|
794
|
-
yn as o,
|
|
795
|
-
Et as p,
|
|
796
|
-
un as q,
|
|
797
|
-
fn as r,
|
|
798
|
-
Rt as s,
|
|
799
|
-
gn as t,
|
|
800
|
-
Yt as u,
|
|
801
|
-
Gt as v,
|
|
802
|
-
dn as w,
|
|
803
|
-
wt as x,
|
|
804
|
-
N as y,
|
|
805
|
-
jt as z
|
|
806
|
-
};
|