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