@thibezer/ui-components-kit 2.28.1 → 2.29.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.
Files changed (64) hide show
  1. package/CHANGELOG.md +46 -0
  2. package/dist/camadas.cjs +87 -87
  3. package/dist/camadas.js +1864 -1309
  4. package/dist/canvas.cjs +42 -42
  5. package/dist/canvas.js +1713 -1609
  6. package/dist/components/ui-barra-ferramentas/ribbon-atualizacao.d.ts +10 -0
  7. package/dist/components/ui-barra-ferramentas/ui-ribbon.d.ts +25 -5
  8. package/dist/components/ui-camadas/camadas-arvore-renderer.d.ts +11 -0
  9. package/dist/components/ui-camadas/camadas-atualizacao-incremental.d.ts +26 -5
  10. package/dist/components/ui-camadas/camadas-colecao.d.ts +15 -0
  11. package/dist/components/ui-camadas/camadas-host.d.ts +12 -0
  12. package/dist/components/ui-camadas/camadas-janela-dom.d.ts +44 -0
  13. package/dist/components/ui-camadas/camadas-linha-feicao.d.ts +10 -1
  14. package/dist/components/ui-camadas/camadas-metricas.d.ts +2 -3
  15. package/dist/components/ui-camadas/camadas-render.d.ts +19 -2
  16. package/dist/components/ui-camadas/camadas-selecao-api.d.ts +6 -0
  17. package/dist/components/ui-camadas/camadas-virtual.d.ts +135 -0
  18. package/dist/components/ui-camadas/ui-camadas.d.ts +51 -2
  19. package/dist/components/ui-canvas-cad/cad-hud-coordenadas.d.ts +12 -0
  20. package/dist/components/ui-canvas-cad/ui-canvas-cad.d.ts +6 -1
  21. package/dist/custom-elements.json +32278 -30008
  22. package/dist/feature_caixa-DOchASgS.js +828 -0
  23. package/dist/feature_caixa-MrJEfMol.cjs +1 -0
  24. package/dist/{feature_desenho-CC8Mp5Gp.js → feature_desenho-Cq3H27as.js} +2 -2
  25. package/dist/{feature_desenho-BH-E1Q9Q.cjs → feature_desenho-eq3MIZR9.cjs} +1 -1
  26. package/dist/feature_metricas-CKQGG2nz.cjs +1 -0
  27. package/dist/feature_metricas-DGfd21VR.js +130 -0
  28. package/dist/geometria-px-BlB0OczX.cjs +1 -0
  29. package/dist/geometria-px-BxTQKrZN.js +577 -0
  30. package/dist/gerencigeo-canvas/dms.d.ts +7 -0
  31. package/dist/gerencigeo-canvas/feature_adapters.d.ts +7 -0
  32. package/dist/gerencigeo-canvas/feature_algoritmos.d.ts +1 -4
  33. package/dist/gerencigeo-canvas/feature_indice.d.ts +7 -0
  34. package/dist/gerencigeo-canvas/feature_lod.d.ts +16 -0
  35. package/dist/gerencigeo-canvas/motor/dados-camada.d.ts +11 -1
  36. package/dist/gerencigeo-canvas/motor/geometria-px.d.ts +9 -0
  37. package/dist/gerencigeo-canvas/motor/motor-formas.d.ts +28 -5
  38. package/dist/gerencigeo-canvas/motor/tipos.d.ts +7 -3
  39. package/dist/gerencigeo-canvas/qualidade.d.ts +5 -0
  40. package/dist/gerencigeo-canvas/renderers/canvas_formas_leaflet.d.ts +10 -0
  41. package/dist/gerencigeo-canvas/renderers/feicoes_canvas_renderer.d.ts +10 -0
  42. package/dist/gerencigeo-canvas/renderers/renderizador_formas.d.ts +7 -0
  43. package/dist/gerencigeo-canvas/utils.d.ts +1 -3
  44. package/dist/index.cjs +4 -4
  45. package/dist/index.js +84 -82
  46. package/dist/mapa.cjs +1 -1
  47. package/dist/mapa.js +1 -1
  48. package/dist/motor.cjs +1 -1
  49. package/dist/motor.js +620 -499
  50. package/dist/prancha-nucleo.cjs +3 -3
  51. package/dist/prancha-nucleo.js +283 -282
  52. package/dist/prancha.cjs +1 -1
  53. package/dist/prancha.js +3 -3
  54. package/dist/tools.cjs +5 -5
  55. package/dist/tools.js +438 -369
  56. package/dist/utils-B2HuBLwz.js +108 -0
  57. package/dist/utils-DpPysTeU.cjs +1 -0
  58. package/package.json +1 -1
  59. package/dist/feature_caixa-4M4MkFH7.cjs +0 -1
  60. package/dist/feature_caixa-BVc5LenS.js +0 -824
  61. package/dist/geometria-px-Cyi_oPD6.cjs +0 -1
  62. package/dist/geometria-px-DHMPUsxC.js +0 -639
  63. package/dist/utils-ClVgqVyJ.cjs +0 -1
  64. package/dist/utils-DrHoxxmf.js +0 -83
@@ -0,0 +1,577 @@
1
+ var ct = Object.defineProperty;
2
+ var ut = (t, n, o) => n in t ? ct(t, n, { enumerable: !0, configurable: !0, writable: !0, value: o }) : t[n] = o;
3
+ var y = (t, n, o) => ut(t, typeof n != "symbol" ? n + "" : n, o);
4
+ import { l as lt, p as K, b as ht } from "./feature_metricas-DGfd21VR.js";
5
+ const S = 16, dt = 256;
6
+ function U(t, n) {
7
+ const [[o, i], [a, e]] = lt(t.geometria, n);
8
+ return { minLon: i, minLat: o, maxLon: e, maxLat: a };
9
+ }
10
+ function N(t, n) {
11
+ return t.minLon <= n.maxLon && t.maxLon >= n.minLon && t.minLat <= n.maxLat && t.maxLat >= n.minLat;
12
+ }
13
+ function D(t) {
14
+ let n = 1 / 0, o = 1 / 0, i = -1 / 0, a = -1 / 0;
15
+ for (const e of t)
16
+ e.minLon < n && (n = e.minLon), e.minLat < o && (o = e.minLat), e.maxLon > i && (i = e.maxLon), e.maxLat > a && (a = e.maxLat);
17
+ return { minLon: n, minLat: o, maxLon: i, maxLat: a };
18
+ }
19
+ function z(t) {
20
+ const n = t.length, o = Math.ceil(n / S), a = Math.ceil(Math.sqrt(o)) * S, e = [...t].sort((c, s) => c.minLon + c.maxLon - (s.minLon + s.maxLon)), r = [];
21
+ for (let c = 0; c < n; c += a) {
22
+ const s = e.slice(c, c + a).sort((u, l) => u.minLat + u.maxLat - (l.minLat + l.maxLat));
23
+ for (let u = 0; u < s.length; u += S) r.push(s.slice(u, u + S));
24
+ }
25
+ return r;
26
+ }
27
+ function ft(t) {
28
+ if (t.length === 0) return null;
29
+ let n = z(t).map((o) => ({ ...D(o), folhas: o }));
30
+ for (; n.length > 1; )
31
+ n = z(n).map((o) => ({ ...D(o), filhos: o }));
32
+ return n[0];
33
+ }
34
+ class Vt {
35
+ /** `espaco` define o envelope do círculo (sem ele, o geográfico de sempre). */
36
+ constructor(n) {
37
+ y(this, "raiz", null);
38
+ /** Itens vivos: a fonte da verdade (a árvore pode conter itens já removidos/atualizados). */
39
+ y(this, "itens", /* @__PURE__ */ new Map());
40
+ /** Itens que entraram ou mudaram depois da última montagem. */
41
+ y(this, "delta", /* @__PURE__ */ new Map());
42
+ /** Ids que estão na árvore mas foram removidos ou substituídos. */
43
+ y(this, "obsoletos", /* @__PURE__ */ new Set());
44
+ /** Envelope em cache (`undefined` = recalcular). */
45
+ y(this, "envelopeCache");
46
+ this.espaco = n;
47
+ }
48
+ get tamanho() {
49
+ return this.itens.size;
50
+ }
51
+ construir(n) {
52
+ this.itens.clear();
53
+ for (const o of n)
54
+ o.excluida || this.itens.set(o.id, { id: o.id, ...U(o, this.espaco) });
55
+ this.remontar();
56
+ }
57
+ inserir(n) {
58
+ this.atualizar(n);
59
+ }
60
+ /** Insere ou substitui; feição `excluida` sai do índice. */
61
+ atualizar(n) {
62
+ if (n.excluida) {
63
+ this.remover(n.id);
64
+ return;
65
+ }
66
+ const o = { id: n.id, ...U(n, this.espaco) };
67
+ this.itens.has(n.id) && this.obsoletos.add(n.id), this.itens.set(n.id, o), this.delta.set(n.id, o), this.envelopeCache = void 0, this.compactarSeNecessario();
68
+ }
69
+ remover(n) {
70
+ this.itens.delete(n) && (this.obsoletos.add(n), this.delta.delete(n), this.compactarSeNecessario());
71
+ }
72
+ limpar() {
73
+ this.itens.clear(), this.remontar();
74
+ }
75
+ /** Ids das feições cujo envelope toca `caixa`. */
76
+ consultar(n) {
77
+ const o = [], i = this.raiz ? [this.raiz] : [];
78
+ for (; i.length > 0; ) {
79
+ const a = i.pop();
80
+ if (N(a, n))
81
+ if (a.folhas)
82
+ for (const e of a.folhas)
83
+ !this.obsoletos.has(e.id) && N(e, n) && o.push(e.id);
84
+ else a.filhos && i.push(...a.filhos);
85
+ }
86
+ for (const a of this.delta.values()) N(a, n) && o.push(a.id);
87
+ return o;
88
+ }
89
+ /**
90
+ * Envelope de tudo que está indexado (`null` se vazio). Pode ser MAIOR que o real enquanto houver itens removidos na
91
+ * árvore (até a próxima remontagem), nunca menor: serve para saber se uma caixa cobre a camada inteira.
92
+ */
93
+ envelope() {
94
+ if (this.envelopeCache !== void 0) return this.envelopeCache;
95
+ const n = [];
96
+ this.raiz && n.push(this.raiz);
97
+ for (const i of this.delta.values()) n.push(i);
98
+ const o = n.length > 0 ? D(n) : null;
99
+ return this.envelopeCache = o && Number.isFinite(o.minLat) && Number.isFinite(o.maxLat) && Number.isFinite(o.minLon) && Number.isFinite(o.maxLon) ? o : null, this.envelopeCache;
100
+ }
101
+ intersecta(n) {
102
+ return this.consultar(n).length > 0;
103
+ }
104
+ /** Envelope da feição indexada, se houver. */
105
+ caixaDe(n) {
106
+ return this.itens.get(n);
107
+ }
108
+ compactarSeNecessario() {
109
+ this.delta.size + this.obsoletos.size > Math.max(dt, this.itens.size * 0.1) && this.remontar();
110
+ }
111
+ remontar() {
112
+ this.envelopeCache = void 0, this.raiz = ft([...this.itens.values()]), this.delta.clear(), this.obsoletos.clear();
113
+ }
114
+ }
115
+ const pt = 17, mt = 9, Lt = 1.2;
116
+ function vt(t) {
117
+ return !Number.isFinite(t) || t >= pt ? 0 : 360 / (256 * 2 ** t) * Lt;
118
+ }
119
+ function k(t) {
120
+ return Number.isFinite(t) ? 1 / Math.max(0.05, Math.cos(Math.max(-85, Math.min(85, t)) * Math.PI / 180)) : 1;
121
+ }
122
+ function yt(t, n, o, i) {
123
+ const a = o[1] - n[1], e = (o[0] - n[0]) * i, r = a * a + e * e, c = (t[0] - n[0]) * i;
124
+ let s = r === 0 ? 0 : ((t[1] - n[1]) * a + c * e) / r;
125
+ return s = Math.max(0, Math.min(1, s)), Math.hypot(t[1] - (n[1] + s * a), c - s * e);
126
+ }
127
+ function W(t, n, o = 1) {
128
+ if (!(n > 0) || t.length < 3) return t;
129
+ const i = Number.isFinite(o) && o > 0 ? o : 1, a = new Uint8Array(t.length);
130
+ a[0] = 1, a[t.length - 1] = 1;
131
+ const e = [[0, t.length - 1]];
132
+ for (; e.length > 0; ) {
133
+ const [r, c] = e.pop();
134
+ let s = 0, u = -1;
135
+ for (let l = r + 1; l < c; l++) {
136
+ const d = yt(t[l], t[r], t[c], i);
137
+ d > s && (s = d, u = l);
138
+ }
139
+ u !== -1 && s > n && (a[u] = 1, e.push([r, u], [u, c]));
140
+ }
141
+ return t.filter((r, c) => a[c] === 1);
142
+ }
143
+ function At(t, n, o = 1) {
144
+ if (!(n > 0) || t.length < 4) return t;
145
+ const i = [...t, t[0]], a = W(i, n, o);
146
+ return a.pop(), a.length >= 3 ? a : t;
147
+ }
148
+ function Mt(t) {
149
+ return (t.tipo === "LineString" || t.tipo === "Polygon") && t.curva ? 0 : t.tipo === "LineString" ? K(t).reduce((n, o) => n + o.length, 0) : t.tipo === "Polygon" ? t.aneis.reduce((n, o) => n + o.length, 0) : 0;
150
+ }
151
+ function qt(t, n) {
152
+ var i, a, e, r;
153
+ const o = vt(n);
154
+ if (o === 0 || Mt(t) < mt) return t;
155
+ if (t.tipo === "LineString") {
156
+ const c = K(t), s = k(((a = (i = c[0]) == null ? void 0 : i[0]) == null ? void 0 : a[0]) ?? NaN);
157
+ return ht(c.map((u) => W(u, o, s)));
158
+ }
159
+ if (t.tipo === "Polygon") {
160
+ const c = k(((r = (e = t.aneis[0]) == null ? void 0 : e[0]) == null ? void 0 : r[0]) ?? NaN);
161
+ return { tipo: "Polygon", aneis: t.aneis.map((s) => At(s, o, c)) };
162
+ }
163
+ return t;
164
+ }
165
+ const gt = /* @__PURE__ */ new Set(["previa", "prévia", "preview", "rascunho", "draft", "proposta"]);
166
+ function _(t) {
167
+ var o, i;
168
+ const n = [t.status, (o = t.propriedades) == null ? void 0 : o.status, (i = t.propriedades) == null ? void 0 : i.tipo_geometria];
169
+ for (const a of n)
170
+ if (typeof a == "string" && gt.has(a.trim().toLowerCase())) return "previa";
171
+ return "oficial";
172
+ }
173
+ function T(t) {
174
+ var o;
175
+ const n = t.entidadeId ?? ((o = t.propriedades) == null ? void 0 : o.entidadeId);
176
+ return typeof n == "string" || typeof n == "number" ? String(n) : t.id;
177
+ }
178
+ const j = (t, n) => `${t}\0${n}`;
179
+ class Gt {
180
+ constructor() {
181
+ /** Mostra as prévias de todas as entidades. */
182
+ y(this, "global", !1);
183
+ y(this, "individuais", /* @__PURE__ */ new Set());
184
+ }
185
+ alternarIndividual(n, o) {
186
+ const i = j(n, o);
187
+ return this.individuais.has(i) ? this.individuais.delete(i) : this.individuais.add(i), this.individuais.has(i);
188
+ }
189
+ definirIndividual(n, o, i) {
190
+ const a = j(n, o);
191
+ i ? this.individuais.add(a) : this.individuais.delete(a);
192
+ }
193
+ individualAtiva(n, o) {
194
+ return this.individuais.has(j(n, o));
195
+ }
196
+ /** Entidades da camada que têm geometria oficial. */
197
+ static oficiais(n) {
198
+ const o = /* @__PURE__ */ new Set();
199
+ for (const i of n) !i.excluida && _(i) === "oficial" && o.add(T(i));
200
+ return o;
201
+ }
202
+ /** A feição aparece? `comOficial` = entidades da camada com geometria oficial (ver `oficiais`). */
203
+ visivel(n, o) {
204
+ if (_(n) === "oficial") return !0;
205
+ const i = T(n);
206
+ return this.global || !o.has(i) || this.individualAtiva(n.camadaId, i);
207
+ }
208
+ /** A prévia está sendo mostrada por pedido (global ou individual), e não só por falta de oficial? */
209
+ previaSolicitada(n) {
210
+ return this.global || this.individualAtiva(n.camadaId, T(n));
211
+ }
212
+ }
213
+ const tt = /* @__PURE__ */ new Set(["simetrico", "suave", "livre"]), V = 1e-6;
214
+ function Ht(t) {
215
+ if (!t.entrada && !t.saida) return "canto";
216
+ if (t.modo && tt.has(t.modo)) return t.modo;
217
+ if (!t.entrada || !t.saida) return "simetrico";
218
+ const n = t.ponto[0] - t.entrada[0], o = t.ponto[1] - t.entrada[1], i = t.saida[0] - t.ponto[0], a = t.saida[1] - t.ponto[1], e = Math.hypot(n, o), r = Math.hypot(i, a);
219
+ return e === 0 || r === 0 || !(Math.abs(n * a - o * i) <= V * e * r && n * i + o * a > 0) ? "livre" : Math.abs(e - r) <= V * Math.max(e, r) ? "simetrico" : "suave";
220
+ }
221
+ const xt = 24, Ct = 2, q = (t) => typeof t == "number" && Number.isFinite(t), O = (t) => Array.isArray(t) && t.length === 2 && q(t[0]) && q(t[1]);
222
+ function Xt(t, n) {
223
+ return [2 * t[0] - n[0], 2 * t[1] - n[1]];
224
+ }
225
+ function It(t) {
226
+ return t.some((n) => n.entrada !== void 0 || n.saida !== void 0);
227
+ }
228
+ function nt(t, n) {
229
+ return [t.saida ?? t.ponto, n.entrada ?? n.ponto];
230
+ }
231
+ function ot(t, n) {
232
+ const o = [];
233
+ for (let i = 0; i < t - 1; i++) o.push([i, i + 1]);
234
+ return n && t > 2 && o.push([t - 1, 0]), o;
235
+ }
236
+ function Pt(t, n, o, i, a) {
237
+ const e = 1 - a, r = e * e * e, c = 3 * e * e * a, s = 3 * e * a * a, u = a * a * a;
238
+ return [r * t[0] + c * n[0] + s * o[0] + u * i[0], r * t[1] + c * n[1] + s * o[1] + u * i[1]];
239
+ }
240
+ function Zt(t, n = !1, o = xt) {
241
+ if (t.length === 0) return [];
242
+ const i = [[t[0].ponto[0], t[0].ponto[1]]];
243
+ for (const [a, e] of ot(t.length, n)) {
244
+ const r = t[a], c = t[e];
245
+ if (!(r.saida === void 0 && c.entrada === void 0)) {
246
+ const [u, l] = nt(r, c);
247
+ for (let d = 1; d < o; d++) i.push(Pt(r.ponto, u, l, c.ponto, d / o));
248
+ }
249
+ e !== 0 && i.push([c.ponto[0], c.ponto[1]]);
250
+ }
251
+ return i;
252
+ }
253
+ function bt(t, n) {
254
+ if (t.length === 0) return [];
255
+ const o = [{ cmd: "M", pts: [t[0].ponto] }];
256
+ for (const [i, a] of ot(t.length, n)) {
257
+ const e = t[i], r = t[a];
258
+ if (e.saida === void 0 && r.entrada === void 0)
259
+ o.push({ cmd: "L", pts: [r.ponto] });
260
+ else {
261
+ const [c, s] = nt(e, r);
262
+ o.push({ cmd: "C", pts: [c, s, r.ponto] });
263
+ }
264
+ }
265
+ return o;
266
+ }
267
+ function Bt(t, n, o) {
268
+ const i = (e) => String(Math.round(e * 100) / 100), a = bt(t, n).map((e) => e.cmd + e.pts.map((r) => {
269
+ const c = o(r);
270
+ return `${i(c.x)} ${i(c.y)}`;
271
+ }).join(" ")).join("");
272
+ return a && n ? `${a}Z` : a;
273
+ }
274
+ function Jt(t, n = Ct) {
275
+ if (!Array.isArray(t) || t.length < n) return null;
276
+ const o = [];
277
+ for (const i of t) {
278
+ if (!i || typeof i != "object" || !O(i.ponto)) return null;
279
+ const a = i, e = { ponto: [a.ponto[0], a.ponto[1]] };
280
+ O(a.entrada) && (e.entrada = [a.entrada[0], a.entrada[1]]), O(a.saida) && (e.saida = [a.saida[0], a.saida[1]]), typeof a.modo == "string" && tt.has(a.modo) && (e.entrada || e.saida) && (e.modo = a.modo), o.push(e);
281
+ }
282
+ return It(o) ? o : null;
283
+ }
284
+ function Qt(t, n) {
285
+ return t.map((o) => {
286
+ const i = { ponto: n(o.ponto) };
287
+ return o.entrada && (i.entrada = n(o.entrada)), o.saida && (i.saida = n(o.saida)), o.modo && (i.modo = o.modo), i;
288
+ });
289
+ }
290
+ function Yt(t) {
291
+ return t.tipo === "LineString" ? t.curva && t.curva.length >= 2 && !(t.partes && t.partes.length > 1) ? t.curva : null : t.tipo === "Polygon" && t.curva && t.curva.length >= 3 && t.aneis.length === 1 ? t.curva : null;
292
+ }
293
+ const St = [
294
+ "continua",
295
+ "tracejada",
296
+ "tracejada-curta",
297
+ "tracejada-longa",
298
+ "pontilhada",
299
+ "traco-ponto",
300
+ "traco-ponto-ponto",
301
+ "oculta",
302
+ "centro",
303
+ "fantasma",
304
+ "divisa"
305
+ ], Nt = {
306
+ tracejada: [12, 6],
307
+ "tracejada-curta": [6, 4],
308
+ "tracejada-longa": [24, 8],
309
+ pontilhada: [0, 4],
310
+ "traco-ponto": [12, 4, 0, 4],
311
+ "traco-ponto-ponto": [12, 4, 0, 4, 0, 4],
312
+ oculta: [6, 3],
313
+ centro: [24, 4, 6, 4],
314
+ fantasma: [24, 4, 6, 4, 6, 4],
315
+ divisa: [12, 4, 12, 4, 0, 4]
316
+ }, G = { arredondada: "round", reta: "butt", quadrada: "square" }, H = { arredondada: "round", chanfrada: "bevel", angular: "miter" }, Tt = 0.05, jt = 100, X = {
317
+ continuous: "continua",
318
+ dashed: "tracejada",
319
+ dashed2: "tracejada-curta",
320
+ dashedx2: "tracejada-longa",
321
+ dot: "pontilhada",
322
+ dotted: "pontilhada",
323
+ dashdot: "traco-ponto",
324
+ divide: "traco-ponto-ponto",
325
+ hidden: "oculta",
326
+ center: "centro",
327
+ phantom: "fantasma",
328
+ border: "divisa"
329
+ };
330
+ function Z(t) {
331
+ return typeof t == "string" && St.includes(t);
332
+ }
333
+ function it(t) {
334
+ if (Z(t)) return t;
335
+ if (typeof t != "string") return;
336
+ const n = t.trim().toLowerCase();
337
+ return Z(n) ? n : Object.prototype.hasOwnProperty.call(X, n) ? X[n] : void 0;
338
+ }
339
+ function B(t) {
340
+ return typeof t == "string" && Object.prototype.hasOwnProperty.call(G, t) ? G[t] : void 0;
341
+ }
342
+ function J(t) {
343
+ return typeof t == "string" && Object.prototype.hasOwnProperty.call(H, t) ? H[t] : void 0;
344
+ }
345
+ function Ot(t) {
346
+ return typeof t != "number" || !Number.isFinite(t) || t <= 0 ? 1 : Math.min(jt, Math.max(Tt, t));
347
+ }
348
+ function Q(t, n, o = 1, i = "round") {
349
+ const a = it(t);
350
+ if (!a || a === "continua") return;
351
+ const e = Number.isFinite(n) && n > 0 ? n : 1, r = Ot(o) * Math.max(1, e / 2), c = i === "butt" ? e : 0, s = i === "butt" ? 0 : e;
352
+ return Nt[a].map((u, l) => {
353
+ const d = l % 2 === 0 ? u === 0 ? c : u * r : u * r + s;
354
+ return Math.round(d * 100) / 100;
355
+ }).join(" ");
356
+ }
357
+ const wt = "#38bdf8", Et = "#38bdf8", Ft = /^(#[0-9a-f]{3,8}|(rgb|hsl)a?\([0-9.,%\s\/-]+\)|[a-z]{3,20})$/i;
358
+ function w(t, n) {
359
+ return typeof t == "string" && Ft.test(t.trim()) ? t.trim() : n;
360
+ }
361
+ const g = (t) => typeof t == "number" && Number.isFinite(t);
362
+ function Kt(t, n, o = !1) {
363
+ const i = t.estilo ?? {}, a = w(i.corTraco ?? n.corPrimaria, wt), e = t.geometria.tipo, r = e === "Polygon" || e === "Circle", c = e === "Point", s = c && w(i.corContorno, "") || a, u = c && g(i.espessuraContorno) && i.espessuraContorno >= 0 ? i.espessuraContorno : void 0, l = u ?? (g(i.espessuraTraco) ? i.espessuraTraco : void 0) ?? (g(n.espessuraLinha) ? n.espessuraLinha : 2), d = g(i.opacidadePreenchimento) ? i.opacidadePreenchimento : r ? 0.2 : 0.85, f = o ? l + 2 : l, L = B(i.terminacaoTraco) ?? B(n.terminacaoLinha) ?? "round", A = g(i.opacidadeTraco) ? i.opacidadeTraco : g(n.opacidadeLinha) ? n.opacidadeLinha : 1;
364
+ return {
365
+ cor: o ? Et : s,
366
+ traco: !(u === 0 && !o),
367
+ peso: f,
368
+ dash: Dt(t, n, f, L),
369
+ // selecionada fica opaca: a seleção precisa aparecer mesmo numa linha quase transparente
370
+ opacidadeTraco: o ? 1 : Math.min(1, Math.max(0, A)),
371
+ terminacao: L,
372
+ juncao: J(i.juncaoTraco) ?? J(n.juncaoLinha) ?? "round",
373
+ deslocamentoDash: g(i.deslocamentoTracejado) ? i.deslocamentoTracejado : 0,
374
+ preencher: r || c,
375
+ corPreenchimento: w(i.corPreenchimento, a),
376
+ opacidadePreenchimento: o ? Math.min(1, d + 0.18) : d
377
+ };
378
+ }
379
+ function Dt(t, n, o, i) {
380
+ const a = t.estilo ?? {};
381
+ if (a.dashArray) return a.dashArray;
382
+ if (a.tipoLinha !== void 0 && a.tipoLinha !== null) {
383
+ const e = Q(a.tipoLinha, o, a.escalaTipoLinha ?? n.escalaTipoLinha, i);
384
+ if (e || it(a.tipoLinha) === "continua") return e;
385
+ }
386
+ return _(t) === "previa" ? "6 4" : n.dashArray ? n.dashArray : Q(n.tipoLinha, o, n.escalaTipoLinha, i);
387
+ }
388
+ function Wt(t, n) {
389
+ var i;
390
+ const o = ((i = t.estilo) == null ? void 0 : i.tamanhoIcone) ?? n.tamanhoMarcador ?? 8;
391
+ return (g(o) && o > 0 ? o : 8) / 2;
392
+ }
393
+ class tn {
394
+ constructor() {
395
+ y(this, "porChave", /* @__PURE__ */ new Map());
396
+ }
397
+ interno(n) {
398
+ const o = `${n.cor}|${n.traco ? 1 : 0}|${n.peso}|${n.dash ?? ""}|${n.opacidadeTraco ?? 1}|${n.terminacao ?? ""}|${n.juncao ?? ""}|${n.deslocamentoDash ?? 0}|${n.preencher ? 1 : 0}|${n.corPreenchimento}|${n.opacidadePreenchimento}`, i = this.porChave.get(o);
399
+ return i || (this.porChave.set(o, n), n);
400
+ }
401
+ limpar() {
402
+ this.porChave.clear();
403
+ }
404
+ }
405
+ const _t = 256, C = 85.0511287798, Rt = 4007501668557849e-8;
406
+ function R(t, n, o, i, a) {
407
+ const e = o > C ? C : o < -C ? -C : o, r = Math.sin(e * Math.PI / 180);
408
+ t[n] = (i + 180) / 360 * a, t[n + 1] = (0.5 - Math.log((1 + r) / (1 - r)) / (4 * Math.PI)) * a;
409
+ }
410
+ const P = (t) => _t * 2 ** t;
411
+ function nn(t, n, o) {
412
+ const i = P(o);
413
+ return [Math.atan(Math.sinh(Math.PI * (1 - 2 * n / i))) * 180 / Math.PI, t / i * 360 - 180];
414
+ }
415
+ function Y(t, n) {
416
+ const o = P(n), i = new Float64Array(t.length * 2);
417
+ for (let a = 0; a < t.length; a++) {
418
+ const e = t[a];
419
+ R(i, a * 2, e[0], e[1], o);
420
+ }
421
+ return i;
422
+ }
423
+ function on(t, n, o) {
424
+ const i = new Float64Array(2);
425
+ return R(i, 0, t, n, P(o)), i;
426
+ }
427
+ function $t(t, n) {
428
+ const o = Math.max(-C, Math.min(C, t));
429
+ return Rt * Math.cos(o * Math.PI / 180) / P(n);
430
+ }
431
+ function an(t, n, o) {
432
+ const i = $t(t, o), a = n / i;
433
+ return Number.isFinite(a) && a >= 0 ? a : 0;
434
+ }
435
+ function en(t) {
436
+ let n = 1 / 0, o = 1 / 0, i = -1 / 0, a = -1 / 0;
437
+ for (const e of t)
438
+ for (let r = 0; r + 1 < e.length; r += 2) {
439
+ const c = e[r], s = e[r + 1];
440
+ Number.isFinite(c) && Number.isFinite(s) && (c < n && (n = c), c > i && (i = c), s < o && (o = s), s > a && (a = s));
441
+ }
442
+ return n <= i && o <= a ? { minX: n, minY: o, maxX: i, maxY: a } : null;
443
+ }
444
+ function at(t, n, o, i, a, e) {
445
+ const r = a - o, c = e - i, s = r * r + c * c;
446
+ let u = s === 0 ? 0 : ((t - o) * r + (n - i) * c) / s;
447
+ return u = u < 0 ? 0 : u > 1 ? 1 : u, Math.hypot(t - (o + u * r), n - (i + u * c));
448
+ }
449
+ let E = new Float64Array(64), F = new Uint8Array(32);
450
+ const Ut = [];
451
+ function rn(t, n, o, i) {
452
+ const a = t.length;
453
+ if (!(o > 0) || a < 3) return Y(t, n);
454
+ const e = P(n);
455
+ E.length < (a + 1) * 2 && (E = new Float64Array((a + 1) * 2));
456
+ const r = E, c = o * o;
457
+ let s = 0;
458
+ for (let h = 0; h < a; h++) {
459
+ const m = t[h];
460
+ if (R(r, s * 2, m[0], m[1], e), s > 0) {
461
+ const M = r[s * 2] - r[(s - 1) * 2], p = r[s * 2 + 1] - r[(s - 1) * 2 + 1], x = M * M + p * p < c;
462
+ if (x && !(!i && h === a - 1)) continue;
463
+ if (x && s > 1) {
464
+ r[(s - 1) * 2] = r[s * 2], r[(s - 1) * 2 + 1] = r[s * 2 + 1];
465
+ continue;
466
+ }
467
+ }
468
+ s++;
469
+ }
470
+ if (i && s > 3) {
471
+ const h = r[(s - 1) * 2] - r[0], m = r[(s - 1) * 2 + 1] - r[1];
472
+ h * h + m * m < c && s--;
473
+ }
474
+ if (i && s < 3) return Y(t, n);
475
+ let u = s;
476
+ i && (r[s * 2] = r[0], r[s * 2 + 1] = r[1], u = s + 1), F.length < u && (F = new Uint8Array(u * 2));
477
+ const l = F;
478
+ l.fill(0, 0, u), l[0] = 1, l[u - 1] = 1;
479
+ const d = Ut;
480
+ for (d.length = 0, d.push(0, u - 1); d.length > 0; ) {
481
+ const h = d.pop(), m = d.pop();
482
+ let M = 0, p = -1;
483
+ const x = r[m * 2], et = r[m * 2 + 1], rt = r[h * 2], st = r[h * 2 + 1];
484
+ for (let I = m + 1; I < h; I++) {
485
+ const $ = at(r[I * 2], r[I * 2 + 1], x, et, rt, st);
486
+ $ > M && (M = $, p = I);
487
+ }
488
+ p !== -1 && M > o && (l[p] = 1, d.push(m, p, p, h));
489
+ }
490
+ const f = i ? u - 1 : u;
491
+ let L = 0;
492
+ for (let h = 0; h < f; h++) l[h] && L++;
493
+ const A = i && L < 3, v = new Float64Array((A ? f : L) * 2);
494
+ let b = 0;
495
+ for (let h = 0; h < f; h++)
496
+ !A && !l[h] || (v[b++] = r[h * 2], v[b++] = r[h * 2 + 1]);
497
+ return v;
498
+ }
499
+ function sn(t, n, o) {
500
+ const i = t.length >> 1;
501
+ if (!(n > 0) || i < 3) return t;
502
+ let a = t, e = i;
503
+ o && (a = new Float64Array((i + 1) * 2), a.set(t), a[i * 2] = t[0], a[i * 2 + 1] = t[1], e = i + 1);
504
+ const r = new Uint8Array(e);
505
+ r[0] = 1, r[e - 1] = 1;
506
+ const c = [0, e - 1];
507
+ for (; c.length > 0; ) {
508
+ const f = c.pop(), L = c.pop();
509
+ let A = 0, v = -1;
510
+ const b = a[L * 2], h = a[L * 2 + 1], m = a[f * 2], M = a[f * 2 + 1];
511
+ for (let p = L + 1; p < f; p++) {
512
+ const x = at(a[p * 2], a[p * 2 + 1], b, h, m, M);
513
+ x > A && (A = x, v = p);
514
+ }
515
+ v !== -1 && A > n && (r[v] = 1, c.push(L, v, v, f));
516
+ }
517
+ const s = o ? e - 1 : e;
518
+ let u = 0;
519
+ for (let f = 0; f < s; f++) r[f] && u++;
520
+ if (o && u < 3 || u === s) return t;
521
+ const l = new Float64Array(u * 2);
522
+ let d = 0;
523
+ for (let f = 0; f < s; f++)
524
+ r[f] && (l[d++] = a[f * 2], l[d++] = a[f * 2 + 1]);
525
+ return l;
526
+ }
527
+ export {
528
+ en as A,
529
+ Q as B,
530
+ Et as C,
531
+ at as D,
532
+ Z as E,
533
+ P as F,
534
+ k as G,
535
+ Ot as H,
536
+ Vt as I,
537
+ $t as J,
538
+ on as K,
539
+ R as L,
540
+ mt as M,
541
+ rn as N,
542
+ Y as O,
543
+ an as P,
544
+ At as Q,
545
+ Gt as R,
546
+ W as S,
547
+ St as T,
548
+ sn as U,
549
+ vt as V,
550
+ pt as Z,
551
+ Zt as a,
552
+ Ht as b,
553
+ nt as c,
554
+ w as d,
555
+ Xt as e,
556
+ bt as f,
557
+ Bt as g,
558
+ wt as h,
559
+ T as i,
560
+ qt as j,
561
+ N as k,
562
+ Kt as l,
563
+ Qt as m,
564
+ Yt as n,
565
+ nn as o,
566
+ Pt as p,
567
+ Jt as q,
568
+ Wt as r,
569
+ _ as s,
570
+ It as t,
571
+ J as u,
572
+ Mt as v,
573
+ B as w,
574
+ it as x,
575
+ tn as y,
576
+ U as z
577
+ };
@@ -0,0 +1,7 @@
1
+ /** `-23.5` -> `23°30'00.00"S`. `eixo` escolhe N/S ou L/O (leste/oeste). */
2
+ export declare function ddParaDms(valor: number, eixo: 'lat' | 'lon', casas?: number): string;
3
+ /**
4
+ * Aceita `23°30'00.00"S`, `23 30 0 S`, `-23°30'`, vírgula decimal. Só o último componente pode ter decimais e os graus vão
5
+ * até 180 (`-23.456.7`, `23.5 30` e `200 0 0` são recusados). Devolve `null` se não entender.
6
+ */
7
+ export declare function dmsParaDd(texto: string): number | null;
@@ -33,3 +33,10 @@ export declare function confrontanteParaFeicao(c: Confrontante, camadaId: string
33
33
  * o atributo `aceitar-origem`).
34
34
  */
35
35
  export declare function normalizarFeicaoEntrada(bruta: unknown, camadaId: string, opcoes?: OpcoesNormalizacao): Feicao | null;
36
+ /**
37
+ * As duas feições (já normalizadas) têm o mesmo conteúdo? Comparação estrutural de dados simples (números, textos,
38
+ * arrays e objetos), com profundidade limitada: além dela, ou com `NaN`, responde "diferentes" (o seguro: a feição é
39
+ * tratada como mudada). Serve para reaproveitar o objeto já guardado quando a lista inteira é reenviada, e assim o
40
+ * motor das formas só vê o que mudou de verdade (caches de projeção e índice preservados).
41
+ */
42
+ export declare function feicoesEquivalentes(a: Feicao | null | undefined, b: Feicao | null | undefined): boolean;
@@ -39,10 +39,7 @@ export type UnidadeComprimento = 'm' | 'km' | 'ft' | 'mi';
39
39
  export type UnidadeArea = 'm2' | 'ha' | 'km2' | 'ac' | 'alqueire';
40
40
  export declare function converterComprimento(valor: number, de: UnidadeComprimento, para: UnidadeComprimento): number;
41
41
  export declare function converterArea(valor: number, de: UnidadeArea, para: UnidadeArea): number;
42
- /** `-23.5` -> `23°30'00.00"S`. `eixo` escolhe N/S ou L/O (leste/oeste). */
43
- export declare function ddParaDms(valor: number, eixo: 'lat' | 'lon', casas?: number): string;
44
- /** Aceita `23°30'00.00"S`, `23 30 0 S`, `-23°30'`, vírgula decimal. Devolve `null` se não entender. */
45
- export declare function dmsParaDd(texto: string): number | null;
42
+ export { ddParaDms, dmsParaDd } from './dms';
46
43
  /** Distância entre dois pontos na unidade do espaço (metros no geográfico, o padrão); útil para testes e ferramentas. */
47
44
  export declare function distanciaEntre(a: LatLonPar, b: LatLonPar, espaco?: Espaco): number;
48
45
  /** Cópia profunda de uma feição com novo id (para duplicar/dividir). */
@@ -25,6 +25,8 @@ export declare class IndiceEspacial {
25
25
  private delta;
26
26
  /** Ids que estão na árvore mas foram removidos ou substituídos. */
27
27
  private obsoletos;
28
+ /** Envelope em cache (`undefined` = recalcular). */
29
+ private envelopeCache;
28
30
  /** `espaco` define o envelope do círculo (sem ele, o geográfico de sempre). */
29
31
  constructor(espaco?: Espaco | undefined);
30
32
  get tamanho(): number;
@@ -36,6 +38,11 @@ export declare class IndiceEspacial {
36
38
  limpar(): void;
37
39
  /** Ids das feições cujo envelope toca `caixa`. */
38
40
  consultar(caixa: CaixaGeo): string[];
41
+ /**
42
+ * Envelope de tudo que está indexado (`null` se vazio). Pode ser MAIOR que o real enquanto houver itens removidos na
43
+ * árvore (até a próxima remontagem), nunca menor: serve para saber se uma caixa cobre a camada inteira.
44
+ */
45
+ envelope(): CaixaGeo | null;
39
46
  intersecta(caixa: CaixaGeo): boolean;
40
47
  /** Envelope da feição indexada, se houver. */
41
48
  caixaDe(id: string): CaixaGeo | undefined;
@@ -13,6 +13,22 @@ export declare function projetarMercator(lat: number, lon: number, zoom: number)
13
13
  export declare function diagonalPx(c: CaixaGeo, zoom: number): number;
14
14
  /** Vira marca? Caixa ausente ou inválida nunca vira (a feição segue o caminho normal). */
15
15
  export declare function ehMarca(c: CaixaGeo | undefined, zoom: number, limite?: number): boolean;
16
+ /**
17
+ * Forma "miúda" (só no caminho canvas): diagonal a partir de `LIMITE_MARCA_PX` e abaixo desta, em zoom menor que
18
+ * `ZOOM_MAX_MIUDA`. Polígono e círculo miúdos são pintados como o retângulo do envelope (um `fillRect`, ~20× mais barato
19
+ * de rasterizar que um caminho de fill + stroke com antisserrilhado); linha miúda é simplificada mesmo com poucos
20
+ * vértices. Medido no navegador: 28 mil polígonos de ~3 px custam ~340 ms como caminho e ~18 ms como retângulo.
21
+ */
22
+ export declare const LIMITE_MIUDA_PX = 6;
23
+ /** A partir deste zoom (os zooms de trabalho) nenhuma forma é pintada como miúda: o desenho é o de sempre. */
24
+ export declare const ZOOM_MAX_MIUDA = 16;
25
+ /** Nível de detalhe de uma forma na tela: marca de LOD, forma miúda (retângulo ou linha simplificada) ou forma inteira. */
26
+ export type NivelDetalhe = 'marca' | 'miuda' | 'forma';
27
+ /**
28
+ * Classifica pelo tamanho na tela. Caixa ausente ou inválida = `forma` (segue o caminho normal). `limiteMiuda` menor ou
29
+ * igual a `limiteMarca`, ou zoom ≥ `ZOOM_MAX_MIUDA`, desliga o nível miúdo.
30
+ */
31
+ export declare function nivelDetalhe(c: CaixaGeo | undefined, zoom: number, limiteMarca?: number, limiteMiuda?: number): NivelDetalhe;
16
32
  /** Lado da marca em px: 1 para diagonais minúsculas, 2 para as demais. */
17
33
  export declare function ladoMarca(diagonal: number): 1 | 2;
18
34
  export interface MarcaLOD {
@@ -6,6 +6,10 @@ export interface ResultadoMudanca {
6
6
  removidas: string[];
7
7
  /** O conjunto de entidades com oficial mudou (com prévias na camada): a visibilidade de outras feições pode mudar. */
8
8
  oficiaisMudou: boolean;
9
+ /** `sincronizar` aplicou as mudanças como delta (o conjunto não foi refeito). */
10
+ incremental?: boolean;
11
+ /** Só no incremental: id -> a feição antes da mudança (`undefined` = não existia). */
12
+ antigas?: Map<string, Feicao | undefined>;
9
13
  }
10
14
  export declare class DadosCamada {
11
15
  readonly loja: Map<string, Feicao>;
@@ -31,7 +35,13 @@ export declare class DadosCamada {
31
35
  desenhavel(f: Feicao): boolean;
32
36
  /** Visível pela regra de versões (ignora `oculta`: o hit-test e a seleção seguem regras próprias). */
33
37
  visivelPorVersao(f: Feicao): boolean;
34
- /** Troca total: diferencia contra a loja, mantém o índice e a contabilidade de versões. */
38
+ /**
39
+ * Troca total: diferencia contra a loja, mantém o índice e a contabilidade de versões. Com poucas mudanças (até
40
+ * `FRACAO_REMONTAR_INDICE` da camada) vira um delta: só as feições mudadas e removidas são tocadas no índice, na loja
41
+ * e na contagem de versões, e o resultado sai `incremental` com as feições antigas (o motor mantém agrupamento e
42
+ * contagem de pontos sem refazer a camada). Antes, trocar 1 feição numa lista de 10 mil refazia a loja e recontava
43
+ * as versões de todas (~20 ms por camada).
44
+ */
35
45
  sincronizar(lista: Feicao[]): ResultadoMudanca;
36
46
  private recontarOficiais;
37
47
  /** Aplica só a diferença. Devolve `null` se o delta não parte da lista sincronizada (então use `sincronizar`). */