@thibezer/ui-components-kit 2.8.2 → 2.10.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 +233 -0
- package/README.md +37 -10
- package/dist/acessibilidade-CSzX-DkG.cjs +1 -0
- package/dist/acessibilidade-CUlSXc2X.js +38 -0
- package/dist/altura-controle-ukMRPckR.cjs +1 -0
- package/dist/altura-controle-vxQiXG4q.js +62 -0
- package/dist/botao.cjs +1 -1
- package/dist/botao.js +1 -1
- package/dist/camadas.cjs +111 -109
- package/dist/camadas.js +1360 -1182
- package/dist/campo-texto.cjs +1 -1
- package/dist/campo-texto.js +1 -1
- package/dist/canvas.cjs +88 -86
- package/dist/canvas.js +4695 -3395
- package/dist/card.cjs +1 -1
- package/dist/card.js +1 -1
- package/dist/components/ui-area-texto/area-texto-altura.d.ts +16 -0
- package/dist/components/ui-area-texto/area-texto-contador.d.ts +6 -0
- package/dist/components/ui-area-texto/area-texto-template.d.ts +2 -0
- package/dist/components/ui-area-texto/index.d.ts +3 -0
- package/dist/components/ui-area-texto/tipos.d.ts +19 -0
- package/dist/components/ui-area-texto/ui-area-texto.d.ts +100 -0
- package/dist/components/ui-avatar/ui-avatar.d.ts +11 -0
- package/dist/components/ui-badge/ui-badge.d.ts +2 -0
- package/dist/components/ui-barra-ferramentas/ferramentas-comum.d.ts +3 -1
- package/dist/components/ui-barra-ferramentas/paleta-atalhos.d.ts +23 -0
- package/dist/components/ui-barra-ferramentas/paleta-pressao-longa.d.ts +24 -0
- package/dist/components/ui-barra-ferramentas/ribbon-render.d.ts +22 -0
- package/dist/components/ui-barra-ferramentas/ribbon-teclado.d.ts +24 -0
- package/dist/components/ui-barra-ferramentas/ui-paleta-ferramentas.d.ts +3 -7
- package/dist/components/ui-barra-ferramentas/ui-ribbon.d.ts +0 -1
- package/dist/components/ui-camadas/camadas-arraste-controles.d.ts +2 -0
- package/dist/components/ui-camadas/camadas-arvore-renderer.d.ts +4 -11
- package/dist/components/ui-camadas/camadas-colecao.d.ts +27 -0
- package/dist/components/ui-camadas/camadas-drag-drop.d.ts +13 -1
- package/dist/components/ui-camadas/camadas-drop-ops.d.ts +31 -0
- package/dist/components/ui-camadas/camadas-hierarquia.d.ts +10 -0
- package/dist/components/ui-camadas/camadas-host.d.ts +1 -0
- package/dist/components/ui-camadas/camadas-lembranca.d.ts +34 -0
- package/dist/components/ui-camadas/camadas-mapas-base.d.ts +3 -1
- package/dist/components/ui-camadas/camadas-render.d.ts +15 -0
- package/dist/components/ui-camadas/camadas-renomear.d.ts +12 -0
- package/dist/components/ui-camadas/camadas-selecao-api.d.ts +17 -0
- package/dist/components/ui-camadas/camadas-selecao.d.ts +12 -0
- package/dist/components/ui-camadas/camadas-thumb.d.ts +1 -0
- package/dist/components/ui-camadas/ui-camadas.d.ts +8 -5
- package/dist/components/ui-campo-texto/campo-texto-estados.d.ts +5 -1
- package/dist/components/ui-campo-texto/ui-campo-texto.d.ts +1 -0
- package/dist/components/ui-canvas-cad/cad-acessibilidade.d.ts +21 -0
- package/dist/components/ui-canvas-cad/cad-atributos-sync.d.ts +2 -1
- package/dist/components/ui-canvas-cad/cad-broadcast.d.ts +1 -1
- package/dist/components/ui-canvas-cad/cad-evento-coordenadas.d.ts +22 -0
- package/dist/components/ui-canvas-cad/cad-eventos-canvas.d.ts +3 -8
- package/dist/components/ui-canvas-cad/cad-feicoes-camera.d.ts +26 -0
- package/dist/components/ui-canvas-cad/cad-feicoes-consulta.d.ts +21 -0
- package/dist/components/ui-canvas-cad/cad-feicoes-dados.d.ts +39 -0
- package/dist/components/ui-canvas-cad/cad-feicoes-desenho.d.ts +68 -0
- package/dist/components/ui-canvas-cad/cad-feicoes-edicao.d.ts +37 -0
- package/dist/components/ui-canvas-cad/cad-feicoes-operacoes.d.ts +48 -0
- package/dist/components/ui-canvas-cad/cad-feicoes-ponteiro.d.ts +28 -0
- package/dist/components/ui-canvas-cad/cad-feicoes-selecao-regiao.d.ts +22 -0
- package/dist/components/ui-canvas-cad/cad-feicoes-tipos.d.ts +53 -0
- package/dist/components/ui-canvas-cad/cad-feicoes-versoes.d.ts +33 -0
- package/dist/components/ui-canvas-cad/cad-feicoes.d.ts +39 -106
- package/dist/components/ui-canvas-cad/cad-inicializador.d.ts +3 -1
- package/dist/components/ui-canvas-cad/cad-leaflet-adaptador.d.ts +5 -0
- package/dist/components/ui-canvas-cad/cad-recusas.d.ts +6 -0
- package/dist/components/ui-canvas-cad/cad-selecao-pontos.d.ts +5 -0
- package/dist/components/ui-canvas-cad/tipos.d.ts +37 -0
- package/dist/components/ui-canvas-cad/ui-canvas-cad.d.ts +30 -1
- package/dist/components/ui-card/card-interacao.d.ts +17 -0
- package/dist/components/ui-card/card-secoes.d.ts +10 -0
- package/dist/components/ui-card/ui-card.d.ts +23 -0
- package/dist/components/ui-checkbox/ui-checkbox.d.ts +4 -1
- package/dist/components/ui-cores/tipos.d.ts +2 -0
- package/dist/components/ui-cores/ui-controle-cores.d.ts +8 -3
- package/dist/components/ui-cores/ui-seletor-cor.d.ts +3 -1
- package/dist/components/ui-linha/index.d.ts +1 -0
- package/dist/components/ui-linha/ui-linha.d.ts +48 -0
- package/dist/components/ui-mapa/mapa-atributos.d.ts +14 -0
- package/dist/components/ui-mapa/mapa-basemaps.d.ts +7 -0
- package/dist/components/ui-mapa/mapa-icones.d.ts +4 -0
- package/dist/components/ui-mapa/mapa-leaflet.d.ts +5 -0
- package/dist/components/ui-mapa/mapa-vinculo-pai.d.ts +22 -0
- package/dist/components/ui-mapa/tipos.d.ts +13 -0
- package/dist/components/ui-mapa/ui-mapa-linha.d.ts +12 -5
- package/dist/components/ui-mapa/ui-mapa-marcador.d.ts +15 -6
- package/dist/components/ui-mapa/ui-mapa.d.ts +14 -1
- package/dist/components/ui-modal/modal-acessibilidade.d.ts +5 -5
- package/dist/components/ui-modal/modal-foco.d.ts +28 -0
- package/dist/components/ui-modal/ui-modal.d.ts +1 -11
- package/dist/components/ui-radio/radio-grupo-registry.d.ts +10 -0
- package/dist/components/ui-radio/ui-radio.d.ts +9 -2
- package/dist/components/ui-skeleton/ui-skeleton.d.ts +9 -0
- package/dist/components/ui-switch/ui-switch.d.ts +3 -1
- package/dist/components/ui-tabela/tabela-estados.d.ts +16 -0
- package/dist/components/ui-tabela/tabela-rolagem.d.ts +44 -0
- package/dist/components/ui-tabela/tabela-teclado.d.ts +16 -0
- package/dist/components/ui-tabela/ui-tabela.d.ts +1 -19
- package/dist/components/ui-texto/ui-texto.d.ts +16 -0
- package/dist/components/ui-tooltip/tooltip-popover.d.ts +7 -0
- package/dist/components/ui-tooltip/tooltip-posicionamento.d.ts +29 -0
- package/dist/components/ui-tooltip/ui-tooltip.d.ts +24 -1
- package/dist/core/altura-controle.d.ts +34 -0
- package/dist/core/alvo-digitavel.d.ts +5 -0
- package/dist/core/index.d.ts +1 -0
- package/dist/core/opcoes.d.ts +16 -0
- package/dist/core/rotulo-controle.d.ts +13 -0
- package/dist/core.cjs +1 -1
- package/dist/core.js +28 -18
- package/dist/cores.cjs +1 -1
- package/dist/cores.js +9 -8
- package/dist/custom-elements.json +28294 -20127
- package/dist/data.cjs +1 -1
- package/dist/data.js +2 -2
- package/dist/feedback.cjs +1 -1
- package/dist/feedback.js +2 -2
- package/dist/form-validacao-BlQFxUVj.js +104 -0
- package/dist/form-validacao-DIeyQVH5.cjs +1 -0
- package/dist/forms.cjs +1 -1
- package/dist/forms.d.ts +4 -0
- package/dist/forms.js +15 -12
- package/dist/gerencigeo-canvas/canvas_interacao.d.ts +2 -1
- package/dist/gerencigeo-canvas/curva_leaflet.d.ts +2 -2
- package/dist/gerencigeo-canvas/feature_curvas.d.ts +3 -1
- package/dist/gerencigeo-canvas/feature_desenho.d.ts +13 -1
- package/dist/gerencigeo-canvas/feature_desenho_controle.d.ts +3 -0
- package/dist/gerencigeo-canvas/feature_edicao_ops.d.ts +9 -0
- package/dist/gerencigeo-canvas/feature_editor_vertices.d.ts +13 -2
- package/dist/gerencigeo-canvas/feature_lod.d.ts +38 -0
- package/dist/gerencigeo-canvas/feature_popup.d.ts +2 -0
- package/dist/gerencigeo-canvas/feature_simplificacao.d.ts +16 -8
- package/dist/gerencigeo-canvas/index.d.ts +7 -0
- package/dist/gerencigeo-canvas/layer_hit_test.d.ts +22 -0
- package/dist/gerencigeo-canvas/layer_manager.d.ts +5 -0
- package/dist/gerencigeo-canvas/mapa_core.d.ts +10 -0
- package/dist/gerencigeo-canvas/motor/dados-camada.d.ts +39 -0
- package/dist/gerencigeo-canvas/motor/estilo.d.ts +28 -0
- package/dist/gerencigeo-canvas/motor/geometria-px.d.ts +27 -0
- package/dist/gerencigeo-canvas/motor/index.d.ts +5 -0
- package/dist/gerencigeo-canvas/motor/motor-formas.d.ts +107 -0
- package/dist/gerencigeo-canvas/motor/tipos.d.ts +100 -0
- package/dist/gerencigeo-canvas/popup_gate.d.ts +30 -0
- package/dist/gerencigeo-canvas/popup_residual.d.ts +5 -0
- package/dist/gerencigeo-canvas/renderers/canvas_formas_leaflet.d.ts +87 -0
- package/dist/gerencigeo-canvas/renderers/feicoes_canvas_renderer.d.ts +58 -0
- package/dist/gerencigeo-canvas/renderers/feicoes_despachante.d.ts +31 -0
- package/dist/gerencigeo-canvas/renderers/feicoes_renderer.d.ts +48 -9
- package/dist/gerencigeo-canvas/renderers/marcadores_feicoes.d.ts +11 -0
- package/dist/gerencigeo-canvas/renderers/marcas_lod_layer.d.ts +19 -0
- package/dist/gerencigeo-canvas/renderers/renderizador_feicoes_tipos.d.ts +44 -0
- package/dist/gerencigeo-canvas/renderers/renderizador_formas.d.ts +95 -0
- package/dist/gerencigeo-canvas/renderers/selecao_visual.d.ts +6 -0
- package/dist/gerencigeo-canvas/types.d.ts +2 -0
- package/dist/gerencigeo-canvas/zoom_opcoes.d.ts +10 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +7 -0
- package/dist/index.js +196 -189
- package/dist/mapa.cjs +11 -16
- package/dist/mapa.js +242 -170
- package/dist/modal.cjs +1 -1
- package/dist/modal.js +1 -1
- package/dist/motor-BB6tB6U-.cjs +1 -0
- package/dist/motor-CFI84lM2.js +1301 -0
- package/dist/motor.cjs +1 -0
- package/dist/motor.d.ts +7 -0
- package/dist/motor.js +52 -0
- package/dist/opcoes-CupvWVIm.js +24 -0
- package/dist/opcoes-vdAUY5OI.cjs +1 -0
- package/dist/register.cjs +1 -1
- package/dist/register.js +14 -13
- package/dist/tabela.cjs +1 -1
- package/dist/tabela.js +1 -1
- package/dist/tipos-elementos.d.ts +123 -8
- package/dist/tipos-react.d.ts +6 -0
- package/dist/tipos-vue.d.ts +119 -8
- package/dist/tools.cjs +1 -1
- package/dist/tools.js +1 -1
- package/dist/ui-badge-B5J_c5P5.js +197 -0
- package/dist/ui-badge-DC4y6Dik.cjs +28 -0
- package/dist/ui-botao-D24oXySA.cjs +12 -0
- package/dist/ui-botao-Dsj08jjw.js +165 -0
- package/dist/ui-campo-texto-19tIrmBK.js +377 -0
- package/dist/ui-campo-texto-CH8mzX61.cjs +16 -0
- package/dist/ui-card-0wu4rjEX.cjs +20 -0
- package/dist/ui-card-DRtpOo3l.js +143 -0
- package/dist/ui-controle-cores-BEUKOq4n.js +275 -0
- package/dist/ui-controle-cores-BLhrZHMh.cjs +32 -0
- package/dist/ui-kit.css +1 -1
- package/dist/ui-linha-C306zxWG.cjs +19 -0
- package/dist/ui-linha-C_azWkcG.js +517 -0
- package/dist/{ui-modal-DBOtSTbR.js → ui-modal-BkYvNP0G.js} +116 -140
- package/dist/ui-modal-CUNbpbZ1.cjs +18 -0
- package/dist/{ui-paleta-ferramentas-DbwdWVtT.js → ui-paleta-ferramentas-BXXrI1Y7.js} +491 -431
- package/dist/ui-paleta-ferramentas-CsPMTY0G.cjs +21 -0
- package/dist/ui-seletor-cor-2yGryC_Z.cjs +86 -0
- package/dist/ui-seletor-cor-BuyhoDZz.js +345 -0
- package/dist/{ui-skeleton-W9uwIceA.js → ui-skeleton-B2Rgrv8o.js} +254 -191
- package/dist/{ui-skeleton-SPYqku8P.cjs → ui-skeleton-DiOxTBZK.cjs} +10 -10
- package/dist/ui-switch-BL-x_-SM.js +1202 -0
- package/dist/ui-switch-C0i_3QXu.cjs +66 -0
- package/dist/{ui-tabela-propriedades-C-PeuW1i.cjs → ui-tabela-propriedades-CjK2gG14.cjs} +10 -10
- package/dist/{ui-tabela-propriedades-BokvDD3b.js → ui-tabela-propriedades-DoL4SE0r.js} +845 -826
- package/package.json +8 -3
- package/dist/form-validacao-BIOXxt-1.js +0 -140
- package/dist/form-validacao-ytRYSF3E.cjs +0 -1
- package/dist/svg-seguro-BsbNQqpd.js +0 -50
- package/dist/svg-seguro-C76iLlAZ.cjs +0 -1
- package/dist/ui-badge-BxT-sDmV.cjs +0 -28
- package/dist/ui-badge-C0eKBI8E.js +0 -183
- package/dist/ui-botao-BOOnP8ds.cjs +0 -12
- package/dist/ui-botao-DfqSivHl.js +0 -165
- package/dist/ui-botao-OGJV6Vfk.js +0 -165
- package/dist/ui-botao-psS1juof.cjs +0 -12
- package/dist/ui-campo-texto-Cnn2UAkS.cjs +0 -16
- package/dist/ui-campo-texto-Uu2dJE_0.js +0 -379
- package/dist/ui-card-B86lJXTP.cjs +0 -20
- package/dist/ui-card-C_o5_0cB.js +0 -111
- package/dist/ui-controle-cores-BS0WYPdi.js +0 -572
- package/dist/ui-controle-cores-Er6ZcQ7U.cjs +0 -111
- package/dist/ui-modal-CvGFGh1h.cjs +0 -18
- package/dist/ui-paleta-ferramentas-CEZYcN4J.js +0 -624
- package/dist/ui-paleta-ferramentas-CU4icLl0.js +0 -1171
- package/dist/ui-paleta-ferramentas-Ccmo-rB5.cjs +0 -21
- package/dist/ui-paleta-ferramentas-DLwZHIDv.cjs +0 -21
- package/dist/ui-paleta-ferramentas-DNN5i6nL.js +0 -860
- package/dist/ui-paleta-ferramentas-Dbj1kBS9.cjs +0 -18
- package/dist/ui-paleta-ferramentas-bvqxj1Yd.cjs +0 -21
- package/dist/ui-segmented-D6b6zxVs.cjs +0 -19
- package/dist/ui-segmented-DyF5YLsV.js +0 -418
- package/dist/ui-segmented-rn9RxRGM.cjs +0 -19
- package/dist/ui-segmented-wUraId2e.js +0 -412
- package/dist/ui-skeleton-DI4_9WOX.js +0 -428
- package/dist/ui-skeleton-elhKIh2B.cjs +0 -33
- package/dist/ui-switch-BcOqOkiV.js +0 -856
- package/dist/ui-switch-D7iPKDj-.cjs +0 -53
- package/dist/ui-tabela-propriedades-BBr5sqki.cjs +0 -145
- package/dist/ui-tabela-propriedades-BecPqC-e.cjs +0 -141
- package/dist/ui-tabela-propriedades-Boy7I5yW.js +0 -2412
- package/dist/ui-tabela-propriedades-Df9ajC6M.js +0 -2648
- package/dist/ui-toast-Bp_NlM5G.js +0 -156
- package/dist/ui-toast-DGTZKne5.cjs +0 -20
- package/dist/zero-js-triggers-C_KrvFOQ.js +0 -244
- package/dist/zero-js-triggers-C_gtaojZ.cjs +0 -1
|
@@ -0,0 +1,1301 @@
|
|
|
1
|
+
var At = Object.defineProperty;
|
|
2
|
+
var yt = (e, t, a) => t in e ? At(e, t, { enumerable: !0, configurable: !0, writable: !0, value: a }) : e[t] = a;
|
|
3
|
+
var M = (e, t, a) => yt(e, typeof t != "symbol" ? t + "" : t, a);
|
|
4
|
+
function z(e) {
|
|
5
|
+
return e.partes && e.partes.length > 1 ? e.partes : [e.coordenadas];
|
|
6
|
+
}
|
|
7
|
+
function La(e) {
|
|
8
|
+
return e.tipo === "LineString" && !!e.partes && e.partes.length > 1;
|
|
9
|
+
}
|
|
10
|
+
function Ct(e) {
|
|
11
|
+
return e.length > 1 ? { tipo: "LineString", coordenadas: e[0], partes: e } : { tipo: "LineString", coordenadas: e[0] };
|
|
12
|
+
}
|
|
13
|
+
const R = 6378137, V = 1 / 298.257222101, W = V * (2 - V), A = (e) => e * Math.PI / 180;
|
|
14
|
+
function Q(e) {
|
|
15
|
+
const t = Math.sin(A(e)), a = 1 - W * t * t;
|
|
16
|
+
return { N: R / Math.sqrt(a), M: R * (1 - W) / (a * Math.sqrt(a)) };
|
|
17
|
+
}
|
|
18
|
+
function Pa(e) {
|
|
19
|
+
const { M: t, N: a } = Q(e);
|
|
20
|
+
return { lat: A(1) * t, lng: A(1) * a * Math.cos(A(e)) };
|
|
21
|
+
}
|
|
22
|
+
function It(e, t) {
|
|
23
|
+
const a = R * (1 - V), o = V, i = A(t[1] - e[1]), n = Math.atan((1 - o) * Math.tan(A(e[0]))), s = Math.atan((1 - o) * Math.tan(A(t[0]))), r = Math.sin(n), c = Math.cos(n), l = Math.sin(s), d = Math.cos(s);
|
|
24
|
+
let h = i, u = 0, v = 0, x = 0, f = 0, m = 0;
|
|
25
|
+
for (let g = 0; g < 100; g++) {
|
|
26
|
+
const p = Math.sin(h), P = Math.cos(h);
|
|
27
|
+
if (u = Math.hypot(d * p, c * l - r * d * P), u === 0) return 0;
|
|
28
|
+
v = r * l + c * d * P, x = Math.atan2(u, v);
|
|
29
|
+
const D = c * d * p / u;
|
|
30
|
+
f = 1 - D * D, m = f === 0 ? 0 : v - 2 * r * l / f;
|
|
31
|
+
const C = o / 16 * f * (4 + o * (4 - 3 * f)), O = h;
|
|
32
|
+
if (h = i + (1 - C) * o * D * (x + C * u * (m + C * v * (-1 + 2 * m * m))), Math.abs(h - O) < 1e-12) break;
|
|
33
|
+
}
|
|
34
|
+
const L = f * (R * R - a * a) / (a * a), w = 1 + L / 16384 * (4096 + L * (-768 + L * (320 - 175 * L))), I = L / 1024 * (256 + L * (-128 + L * (74 - 47 * L))), y = I * u * (m + I / 4 * (v * (-1 + 2 * m * m) - I / 6 * m * (-3 + 4 * u * u) * (-3 + 4 * m * m)));
|
|
35
|
+
return a * w * (x - y);
|
|
36
|
+
}
|
|
37
|
+
function tt(e, t) {
|
|
38
|
+
const a = t[0] - e[0], o = t[1] - e[1];
|
|
39
|
+
if (Math.abs(a) < 0.1 && Math.abs(o) < 0.1) {
|
|
40
|
+
const { M: i, N: n } = Q((e[0] + t[0]) / 2), s = A(a) * i, r = A(o) * n * Math.cos(A((e[0] + t[0]) / 2));
|
|
41
|
+
return Math.hypot(r, s);
|
|
42
|
+
}
|
|
43
|
+
return It(e, t);
|
|
44
|
+
}
|
|
45
|
+
function at(e, t = !1) {
|
|
46
|
+
let a = 0;
|
|
47
|
+
for (let o = 1; o < e.length; o++) a += tt(e[o - 1], e[o]);
|
|
48
|
+
return t && e.length > 2 && (a += tt(e[e.length - 1], e[0])), a;
|
|
49
|
+
}
|
|
50
|
+
function ot(e) {
|
|
51
|
+
const t = e.length;
|
|
52
|
+
if (t < 3) return 0;
|
|
53
|
+
let a = 0, o = 0;
|
|
54
|
+
for (let r = 0; r < t; r++) {
|
|
55
|
+
const c = e[(r - 1 + t) % t], l = e[r], d = e[(r + 1) % t];
|
|
56
|
+
a += A(d[1] - c[1]) * Math.sin(A(l[0])), o += l[0];
|
|
57
|
+
}
|
|
58
|
+
const { M: i, N: n } = Q(o / t), s = Math.abs(a * i * n / 2);
|
|
59
|
+
return Number.isFinite(s) ? s : 0;
|
|
60
|
+
}
|
|
61
|
+
function St(e) {
|
|
62
|
+
const [t, ...a] = e;
|
|
63
|
+
return t ? Math.max(0, ot(t) - a.reduce((o, i) => o + ot(i), 0)) : 0;
|
|
64
|
+
}
|
|
65
|
+
const bt = new Intl.NumberFormat("pt-BR", { minimumFractionDigits: 4, maximumFractionDigits: 4 }), et = new Intl.NumberFormat("pt-BR", { minimumFractionDigits: 2, maximumFractionDigits: 2 });
|
|
66
|
+
function Ot(e) {
|
|
67
|
+
return `${bt.format(e / 1e4)} ha`;
|
|
68
|
+
}
|
|
69
|
+
function Nt(e) {
|
|
70
|
+
return e >= 1e3 ? `${et.format(e / 1e3)} km` : `${et.format(e)} m`;
|
|
71
|
+
}
|
|
72
|
+
function wt(e) {
|
|
73
|
+
return e.tipo === "Polygon" ? St(e.aneis) : e.tipo === "Circle" ? Math.PI * e.raioMetros ** 2 : null;
|
|
74
|
+
}
|
|
75
|
+
function Et(e) {
|
|
76
|
+
return e.tipo === "LineString" ? z(e).reduce((t, a) => t + at(a), 0) : e.tipo === "Polygon" ? at(e.aneis[0] ?? [], !0) : e.tipo === "Circle" ? 2 * Math.PI * e.raioMetros : null;
|
|
77
|
+
}
|
|
78
|
+
function Ft(e, t) {
|
|
79
|
+
var i;
|
|
80
|
+
const a = t ?? "name";
|
|
81
|
+
if (a === "area") {
|
|
82
|
+
const n = wt(e.geometria);
|
|
83
|
+
return n === null ? "" : Ot(n);
|
|
84
|
+
}
|
|
85
|
+
if (a === "extensao") {
|
|
86
|
+
const n = Et(e.geometria);
|
|
87
|
+
return n === null ? "" : Nt(n);
|
|
88
|
+
}
|
|
89
|
+
if (a === "id") return e.id;
|
|
90
|
+
const o = (i = e.propriedades) == null ? void 0 : i[a];
|
|
91
|
+
return o != null && o !== "" ? String(o) : t ? "" : e.id;
|
|
92
|
+
}
|
|
93
|
+
function Rt(e) {
|
|
94
|
+
let t;
|
|
95
|
+
switch (e.tipo) {
|
|
96
|
+
case "Point":
|
|
97
|
+
case "Text":
|
|
98
|
+
t = [e.coordenada];
|
|
99
|
+
break;
|
|
100
|
+
case "LineString":
|
|
101
|
+
t = z(e).flat();
|
|
102
|
+
break;
|
|
103
|
+
case "Polygon":
|
|
104
|
+
t = e.aneis.flat();
|
|
105
|
+
break;
|
|
106
|
+
case "Circle": {
|
|
107
|
+
const i = e.raioMetros / 111320, n = i / Math.max(0.01, Math.cos(A(e.centro[0])));
|
|
108
|
+
t = [[e.centro[0] - i, e.centro[1] - n], [e.centro[0] + i, e.centro[1] + n]];
|
|
109
|
+
break;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
const a = t.map((i) => i[0]), o = t.map((i) => i[1]);
|
|
113
|
+
return [[Math.min(...a), Math.min(...o)], [Math.max(...a), Math.max(...o)]];
|
|
114
|
+
}
|
|
115
|
+
const j = 16, zt = 256;
|
|
116
|
+
function it(e) {
|
|
117
|
+
const [[t, a], [o, i]] = Rt(e.geometria);
|
|
118
|
+
return { minLon: a, minLat: t, maxLon: i, maxLat: o };
|
|
119
|
+
}
|
|
120
|
+
function $(e, t) {
|
|
121
|
+
return e.minLon <= t.maxLon && e.maxLon >= t.minLon && e.minLat <= t.maxLat && e.maxLat >= t.minLat;
|
|
122
|
+
}
|
|
123
|
+
function nt(e) {
|
|
124
|
+
let t = 1 / 0, a = 1 / 0, o = -1 / 0, i = -1 / 0;
|
|
125
|
+
for (const n of e)
|
|
126
|
+
n.minLon < t && (t = n.minLon), n.minLat < a && (a = n.minLat), n.maxLon > o && (o = n.maxLon), n.maxLat > i && (i = n.maxLat);
|
|
127
|
+
return { minLon: t, minLat: a, maxLon: o, maxLat: i };
|
|
128
|
+
}
|
|
129
|
+
function st(e) {
|
|
130
|
+
const t = e.length, a = Math.ceil(t / j), i = Math.ceil(Math.sqrt(a)) * j, n = [...e].sort((r, c) => r.minLon + r.maxLon - (c.minLon + c.maxLon)), s = [];
|
|
131
|
+
for (let r = 0; r < t; r += i) {
|
|
132
|
+
const c = n.slice(r, r + i).sort((l, d) => l.minLat + l.maxLat - (d.minLat + d.maxLat));
|
|
133
|
+
for (let l = 0; l < c.length; l += j) s.push(c.slice(l, l + j));
|
|
134
|
+
}
|
|
135
|
+
return s;
|
|
136
|
+
}
|
|
137
|
+
function jt(e) {
|
|
138
|
+
if (e.length === 0) return null;
|
|
139
|
+
let t = st(e).map((a) => ({ ...nt(a), folhas: a }));
|
|
140
|
+
for (; t.length > 1; )
|
|
141
|
+
t = st(t).map((a) => ({ ...nt(a), filhos: a }));
|
|
142
|
+
return t[0];
|
|
143
|
+
}
|
|
144
|
+
class _t {
|
|
145
|
+
constructor() {
|
|
146
|
+
M(this, "raiz", null);
|
|
147
|
+
/** Itens vivos: a fonte da verdade (a árvore pode conter itens já removidos/atualizados). */
|
|
148
|
+
M(this, "itens", /* @__PURE__ */ new Map());
|
|
149
|
+
/** Itens que entraram ou mudaram depois da última montagem. */
|
|
150
|
+
M(this, "delta", /* @__PURE__ */ new Map());
|
|
151
|
+
/** Ids que estão na árvore mas foram removidos ou substituídos. */
|
|
152
|
+
M(this, "obsoletos", /* @__PURE__ */ new Set());
|
|
153
|
+
}
|
|
154
|
+
get tamanho() {
|
|
155
|
+
return this.itens.size;
|
|
156
|
+
}
|
|
157
|
+
construir(t) {
|
|
158
|
+
this.itens.clear();
|
|
159
|
+
for (const a of t)
|
|
160
|
+
a.excluida || this.itens.set(a.id, { id: a.id, ...it(a) });
|
|
161
|
+
this.remontar();
|
|
162
|
+
}
|
|
163
|
+
inserir(t) {
|
|
164
|
+
this.atualizar(t);
|
|
165
|
+
}
|
|
166
|
+
/** Insere ou substitui; feição `excluida` sai do índice. */
|
|
167
|
+
atualizar(t) {
|
|
168
|
+
if (t.excluida) {
|
|
169
|
+
this.remover(t.id);
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
const a = { id: t.id, ...it(t) };
|
|
173
|
+
this.itens.has(t.id) && this.obsoletos.add(t.id), this.itens.set(t.id, a), this.delta.set(t.id, a), this.compactarSeNecessario();
|
|
174
|
+
}
|
|
175
|
+
remover(t) {
|
|
176
|
+
this.itens.delete(t) && (this.obsoletos.add(t), this.delta.delete(t), this.compactarSeNecessario());
|
|
177
|
+
}
|
|
178
|
+
limpar() {
|
|
179
|
+
this.itens.clear(), this.remontar();
|
|
180
|
+
}
|
|
181
|
+
/** Ids das feições cujo envelope toca `caixa`. */
|
|
182
|
+
consultar(t) {
|
|
183
|
+
const a = [], o = this.raiz ? [this.raiz] : [];
|
|
184
|
+
for (; o.length > 0; ) {
|
|
185
|
+
const i = o.pop();
|
|
186
|
+
if ($(i, t))
|
|
187
|
+
if (i.folhas)
|
|
188
|
+
for (const n of i.folhas)
|
|
189
|
+
!this.obsoletos.has(n.id) && $(n, t) && a.push(n.id);
|
|
190
|
+
else i.filhos && o.push(...i.filhos);
|
|
191
|
+
}
|
|
192
|
+
for (const i of this.delta.values()) $(i, t) && a.push(i.id);
|
|
193
|
+
return a;
|
|
194
|
+
}
|
|
195
|
+
intersecta(t) {
|
|
196
|
+
return this.consultar(t).length > 0;
|
|
197
|
+
}
|
|
198
|
+
/** Envelope da feição indexada, se houver. */
|
|
199
|
+
caixaDe(t) {
|
|
200
|
+
return this.itens.get(t);
|
|
201
|
+
}
|
|
202
|
+
compactarSeNecessario() {
|
|
203
|
+
this.delta.size + this.obsoletos.size > Math.max(zt, this.itens.size * 0.1) && this.remontar();
|
|
204
|
+
}
|
|
205
|
+
remontar() {
|
|
206
|
+
this.raiz = jt([...this.itens.values()]), this.delta.clear(), this.obsoletos.clear();
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
const pt = 17, J = 9, Tt = 1.2;
|
|
210
|
+
function $t(e) {
|
|
211
|
+
return !Number.isFinite(e) || e >= pt ? 0 : 360 / (256 * 2 ** e) * Tt;
|
|
212
|
+
}
|
|
213
|
+
function rt(e) {
|
|
214
|
+
return Number.isFinite(e) ? 1 / Math.max(0.05, Math.cos(Math.max(-85, Math.min(85, e)) * Math.PI / 180)) : 1;
|
|
215
|
+
}
|
|
216
|
+
function Bt(e, t, a, o) {
|
|
217
|
+
const i = a[1] - t[1], n = (a[0] - t[0]) * o, s = i * i + n * n, r = (e[0] - t[0]) * o;
|
|
218
|
+
let c = s === 0 ? 0 : ((e[1] - t[1]) * i + r * n) / s;
|
|
219
|
+
return c = Math.max(0, Math.min(1, c)), Math.hypot(e[1] - (t[1] + c * i), r - c * n);
|
|
220
|
+
}
|
|
221
|
+
function gt(e, t, a = 1) {
|
|
222
|
+
if (!(t > 0) || e.length < 3) return e;
|
|
223
|
+
const o = Number.isFinite(a) && a > 0 ? a : 1, i = new Uint8Array(e.length);
|
|
224
|
+
i[0] = 1, i[e.length - 1] = 1;
|
|
225
|
+
const n = [[0, e.length - 1]];
|
|
226
|
+
for (; n.length > 0; ) {
|
|
227
|
+
const [s, r] = n.pop();
|
|
228
|
+
let c = 0, l = -1;
|
|
229
|
+
for (let d = s + 1; d < r; d++) {
|
|
230
|
+
const h = Bt(e[d], e[s], e[r], o);
|
|
231
|
+
h > c && (c = h, l = d);
|
|
232
|
+
}
|
|
233
|
+
l !== -1 && c > t && (i[l] = 1, n.push([s, l], [l, r]));
|
|
234
|
+
}
|
|
235
|
+
return e.filter((s, r) => i[r] === 1);
|
|
236
|
+
}
|
|
237
|
+
function Vt(e, t, a = 1) {
|
|
238
|
+
if (!(t > 0) || e.length < 4) return e;
|
|
239
|
+
const o = [...e, e[0]], i = gt(o, t, a);
|
|
240
|
+
return i.pop(), i.length >= 3 ? i : e;
|
|
241
|
+
}
|
|
242
|
+
function kt(e) {
|
|
243
|
+
return (e.tipo === "LineString" || e.tipo === "Polygon") && e.curva ? 0 : e.tipo === "LineString" ? z(e).reduce((t, a) => t + a.length, 0) : e.tipo === "Polygon" ? e.aneis.reduce((t, a) => t + a.length, 0) : 0;
|
|
244
|
+
}
|
|
245
|
+
function Da(e, t) {
|
|
246
|
+
var o, i, n, s;
|
|
247
|
+
const a = $t(t);
|
|
248
|
+
if (a === 0 || kt(e) < J) return e;
|
|
249
|
+
if (e.tipo === "LineString") {
|
|
250
|
+
const r = z(e), c = rt(((i = (o = r[0]) == null ? void 0 : o[0]) == null ? void 0 : i[0]) ?? NaN);
|
|
251
|
+
return Ct(r.map((l) => gt(l, a, c)));
|
|
252
|
+
}
|
|
253
|
+
if (e.tipo === "Polygon") {
|
|
254
|
+
const r = rt(((s = (n = e.aneis[0]) == null ? void 0 : n[0]) == null ? void 0 : s[0]) ?? NaN);
|
|
255
|
+
return { tipo: "Polygon", aneis: e.aneis.map((c) => Vt(c, a, r)) };
|
|
256
|
+
}
|
|
257
|
+
return e;
|
|
258
|
+
}
|
|
259
|
+
const qt = /* @__PURE__ */ new Set(["previa", "prévia", "preview", "rascunho", "draft", "proposta"]);
|
|
260
|
+
function S(e) {
|
|
261
|
+
var a, o;
|
|
262
|
+
const t = [e.status, (a = e.propriedades) == null ? void 0 : a.status, (o = e.propriedades) == null ? void 0 : o.tipo_geometria];
|
|
263
|
+
for (const i of t)
|
|
264
|
+
if (typeof i == "string" && qt.has(i.trim().toLowerCase())) return "previa";
|
|
265
|
+
return "oficial";
|
|
266
|
+
}
|
|
267
|
+
function b(e) {
|
|
268
|
+
var a;
|
|
269
|
+
const t = e.entidadeId ?? ((a = e.propriedades) == null ? void 0 : a.entidadeId);
|
|
270
|
+
return typeof t == "string" || typeof t == "number" ? String(t) : e.id;
|
|
271
|
+
}
|
|
272
|
+
const G = (e, t) => `${e}\0${t}`;
|
|
273
|
+
class Aa {
|
|
274
|
+
constructor() {
|
|
275
|
+
/** Mostra as prévias de todas as entidades. */
|
|
276
|
+
M(this, "global", !1);
|
|
277
|
+
M(this, "individuais", /* @__PURE__ */ new Set());
|
|
278
|
+
}
|
|
279
|
+
alternarIndividual(t, a) {
|
|
280
|
+
const o = G(t, a);
|
|
281
|
+
return this.individuais.has(o) ? this.individuais.delete(o) : this.individuais.add(o), this.individuais.has(o);
|
|
282
|
+
}
|
|
283
|
+
definirIndividual(t, a, o) {
|
|
284
|
+
const i = G(t, a);
|
|
285
|
+
o ? this.individuais.add(i) : this.individuais.delete(i);
|
|
286
|
+
}
|
|
287
|
+
individualAtiva(t, a) {
|
|
288
|
+
return this.individuais.has(G(t, a));
|
|
289
|
+
}
|
|
290
|
+
/** Entidades da camada que têm geometria oficial. */
|
|
291
|
+
static oficiais(t) {
|
|
292
|
+
const a = /* @__PURE__ */ new Set();
|
|
293
|
+
for (const o of t) !o.excluida && S(o) === "oficial" && a.add(b(o));
|
|
294
|
+
return a;
|
|
295
|
+
}
|
|
296
|
+
/** A feição aparece? `comOficial` = entidades da camada com geometria oficial (ver `oficiais`). */
|
|
297
|
+
visivel(t, a) {
|
|
298
|
+
if (S(t) === "oficial") return !0;
|
|
299
|
+
const o = b(t);
|
|
300
|
+
return this.global || !a.has(o) || this.individualAtiva(t.camadaId, o);
|
|
301
|
+
}
|
|
302
|
+
/** A prévia está sendo mostrada por pedido (global ou individual), e não só por falta de oficial? */
|
|
303
|
+
previaSolicitada(t) {
|
|
304
|
+
return this.global || this.individualAtiva(t.camadaId, b(t));
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
const Ut = 24, Xt = 2, ct = (e) => typeof e == "number" && Number.isFinite(e), Z = (e) => Array.isArray(e) && e.length === 2 && ct(e[0]) && ct(e[1]);
|
|
308
|
+
function ya(e, t) {
|
|
309
|
+
return [2 * e[0] - t[0], 2 * e[1] - t[1]];
|
|
310
|
+
}
|
|
311
|
+
function Gt(e) {
|
|
312
|
+
return e.some((t) => t.entrada !== void 0 || t.saida !== void 0);
|
|
313
|
+
}
|
|
314
|
+
function vt(e, t) {
|
|
315
|
+
return [e.saida ?? e.ponto, t.entrada ?? t.ponto];
|
|
316
|
+
}
|
|
317
|
+
function Mt(e, t) {
|
|
318
|
+
const a = [];
|
|
319
|
+
for (let o = 0; o < e - 1; o++) a.push([o, o + 1]);
|
|
320
|
+
return t && e > 2 && a.push([e - 1, 0]), a;
|
|
321
|
+
}
|
|
322
|
+
function Zt(e, t, a, o, i) {
|
|
323
|
+
const n = 1 - i, s = n * n * n, r = 3 * n * n * i, c = 3 * n * i * i, l = i * i * i;
|
|
324
|
+
return [s * e[0] + r * t[0] + c * a[0] + l * o[0], s * e[1] + r * t[1] + c * a[1] + l * o[1]];
|
|
325
|
+
}
|
|
326
|
+
function Ca(e, t = !1, a = Ut) {
|
|
327
|
+
if (e.length === 0) return [];
|
|
328
|
+
const o = [[e[0].ponto[0], e[0].ponto[1]]];
|
|
329
|
+
for (const [i, n] of Mt(e.length, t)) {
|
|
330
|
+
const s = e[i], r = e[n];
|
|
331
|
+
if (!(s.saida === void 0 && r.entrada === void 0)) {
|
|
332
|
+
const [l, d] = vt(s, r);
|
|
333
|
+
for (let h = 1; h < a; h++) o.push(Zt(s.ponto, l, d, r.ponto, h / a));
|
|
334
|
+
}
|
|
335
|
+
n !== 0 && o.push([r.ponto[0], r.ponto[1]]);
|
|
336
|
+
}
|
|
337
|
+
return o;
|
|
338
|
+
}
|
|
339
|
+
function Ht(e, t) {
|
|
340
|
+
if (e.length === 0) return [];
|
|
341
|
+
const a = [{ cmd: "M", pts: [e[0].ponto] }];
|
|
342
|
+
for (const [o, i] of Mt(e.length, t)) {
|
|
343
|
+
const n = e[o], s = e[i];
|
|
344
|
+
if (n.saida === void 0 && s.entrada === void 0)
|
|
345
|
+
a.push({ cmd: "L", pts: [s.ponto] });
|
|
346
|
+
else {
|
|
347
|
+
const [r, c] = vt(n, s);
|
|
348
|
+
a.push({ cmd: "C", pts: [r, c, s.ponto] });
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
return a;
|
|
352
|
+
}
|
|
353
|
+
function Ia(e, t, a) {
|
|
354
|
+
const o = (n) => String(Math.round(n * 100) / 100), i = Ht(e, t).map((n) => n.cmd + n.pts.map((s) => {
|
|
355
|
+
const r = a(s);
|
|
356
|
+
return `${o(r.x)} ${o(r.y)}`;
|
|
357
|
+
}).join(" ")).join("");
|
|
358
|
+
return i && t ? `${i}Z` : i;
|
|
359
|
+
}
|
|
360
|
+
function Sa(e, t = Xt) {
|
|
361
|
+
if (!Array.isArray(e) || e.length < t) return null;
|
|
362
|
+
const a = [];
|
|
363
|
+
for (const o of e) {
|
|
364
|
+
if (!o || typeof o != "object" || !Z(o.ponto)) return null;
|
|
365
|
+
const i = o, n = { ponto: [i.ponto[0], i.ponto[1]] };
|
|
366
|
+
Z(i.entrada) && (n.entrada = [i.entrada[0], i.entrada[1]]), Z(i.saida) && (n.saida = [i.saida[0], i.saida[1]]), a.push(n);
|
|
367
|
+
}
|
|
368
|
+
return Gt(a) ? a : null;
|
|
369
|
+
}
|
|
370
|
+
function ba(e, t) {
|
|
371
|
+
return e.map((a) => {
|
|
372
|
+
const o = { ponto: t(a.ponto) };
|
|
373
|
+
return a.entrada && (o.entrada = t(a.entrada)), a.saida && (o.saida = t(a.saida)), o;
|
|
374
|
+
});
|
|
375
|
+
}
|
|
376
|
+
function dt(e) {
|
|
377
|
+
return e.tipo === "LineString" ? e.curva && e.curva.length >= 2 && !(e.partes && e.partes.length > 1) ? e.curva : null : e.tipo === "Polygon" && e.curva && e.curva.length >= 3 && e.aneis.length === 1 ? e.curva : null;
|
|
378
|
+
}
|
|
379
|
+
const k = 55, Jt = 17, Yt = 8;
|
|
380
|
+
function xt(e, t) {
|
|
381
|
+
return t < Jt && e > Yt;
|
|
382
|
+
}
|
|
383
|
+
function Qt(e) {
|
|
384
|
+
let t = 0, a = 0;
|
|
385
|
+
for (const o of e)
|
|
386
|
+
t += o.coordenada[0], a += o.coordenada[1];
|
|
387
|
+
return [t / e.length, a / e.length];
|
|
388
|
+
}
|
|
389
|
+
function Oa(e, t, a) {
|
|
390
|
+
if (!xt(e.length, t)) return { clusters: [], isolados: e };
|
|
391
|
+
const o = /* @__PURE__ */ new Map();
|
|
392
|
+
for (const s of e) {
|
|
393
|
+
const { x: r, y: c } = a(s.coordenada), l = `${t}:${Math.floor(r / k)}:${Math.floor(c / k)}`, d = o.get(l);
|
|
394
|
+
d ? d.push(s) : o.set(l, [s]);
|
|
395
|
+
}
|
|
396
|
+
const i = [], n = [];
|
|
397
|
+
for (const [s, r] of o)
|
|
398
|
+
r.length === 1 ? n.push(r[0]) : i.push({ chave: s, coordenada: Qt(r), membros: r });
|
|
399
|
+
return { clusters: i, isolados: n };
|
|
400
|
+
}
|
|
401
|
+
class Kt {
|
|
402
|
+
constructor(t, a) {
|
|
403
|
+
M(this, "celulas", /* @__PURE__ */ new Map());
|
|
404
|
+
M(this, "celulaDe", /* @__PURE__ */ new Map());
|
|
405
|
+
/** Chaves das células com 2 ou mais pontos (as únicas que viram cluster). */
|
|
406
|
+
M(this, "multiplas", /* @__PURE__ */ new Set());
|
|
407
|
+
this.zoom = t, this.projetar = a;
|
|
408
|
+
}
|
|
409
|
+
/** Pontos agrupáveis na grade. */
|
|
410
|
+
get total() {
|
|
411
|
+
return this.celulaDe.size;
|
|
412
|
+
}
|
|
413
|
+
/** Chave da célula do ponto, ou `undefined` se ele não está na grade. */
|
|
414
|
+
chaveDoPonto(t) {
|
|
415
|
+
return this.celulaDe.get(t);
|
|
416
|
+
}
|
|
417
|
+
celula(t) {
|
|
418
|
+
return this.celulas.get(t);
|
|
419
|
+
}
|
|
420
|
+
/** Só as células que viram cluster (2+ pontos). */
|
|
421
|
+
*celulasAgrupadas() {
|
|
422
|
+
for (const t of this.multiplas) {
|
|
423
|
+
const a = this.celulas.get(t);
|
|
424
|
+
a && (yield [t, a]);
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
/** Está numa célula com 2 ou mais pontos (ou seja, dentro de um cluster)? */
|
|
428
|
+
emCluster(t) {
|
|
429
|
+
var o;
|
|
430
|
+
const a = this.celulaDe.get(t);
|
|
431
|
+
return a !== void 0 && (((o = this.celulas.get(a)) == null ? void 0 : o.membros.size) ?? 0) >= 2;
|
|
432
|
+
}
|
|
433
|
+
/** Insere (ou move) o ponto; devolve a chave da célula nova. */
|
|
434
|
+
inserir(t) {
|
|
435
|
+
this.remover(t.id);
|
|
436
|
+
const { x: a, y: o } = this.projetar(t.coordenada), i = `${this.zoom}:${Math.floor(a / k)}:${Math.floor(o / k)}`;
|
|
437
|
+
let n = this.celulas.get(i);
|
|
438
|
+
return n || (n = { membros: /* @__PURE__ */ new Map(), somaLat: 0, somaLon: 0 }, this.celulas.set(i, n)), n.membros.set(t.id, t), n.somaLat += t.coordenada[0], n.somaLon += t.coordenada[1], n.membros.size >= 2 && this.multiplas.add(i), this.celulaDe.set(t.id, i), i;
|
|
439
|
+
}
|
|
440
|
+
/** Tira o ponto da grade; devolve a chave da célula de onde saiu. */
|
|
441
|
+
remover(t) {
|
|
442
|
+
const a = this.celulaDe.get(t);
|
|
443
|
+
if (a === void 0) return;
|
|
444
|
+
this.celulaDe.delete(t);
|
|
445
|
+
const o = this.celulas.get(a), i = o == null ? void 0 : o.membros.get(t);
|
|
446
|
+
return o && i && (o.membros.delete(t), o.somaLat -= i.coordenada[0], o.somaLon -= i.coordenada[1], o.membros.size < 2 && this.multiplas.delete(a), o.membros.size === 0 && this.celulas.delete(a)), a;
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
const Wt = 3, Lt = 0.75, lt = 85.0511287798, ta = 256;
|
|
450
|
+
function Y(e, t, a) {
|
|
451
|
+
const o = ta * 2 ** a, i = Math.max(-lt, Math.min(lt, e)), n = Math.sin(i * Math.PI / 180);
|
|
452
|
+
return {
|
|
453
|
+
x: (t + 180) / 360 * o,
|
|
454
|
+
y: (0.5 - Math.log((1 + n) / (1 - n)) / (4 * Math.PI)) * o
|
|
455
|
+
};
|
|
456
|
+
}
|
|
457
|
+
const aa = (e) => Number.isFinite(e.minLat) && Number.isFinite(e.maxLat) && Number.isFinite(e.minLon) && Number.isFinite(e.maxLon) && e.minLat <= e.maxLat && e.minLon <= e.maxLon;
|
|
458
|
+
function Pt(e, t) {
|
|
459
|
+
if (!Number.isFinite(t) || t < 0 || !aa(e)) return NaN;
|
|
460
|
+
const a = Y(e.minLat, e.minLon, t), o = Y(e.maxLat, e.maxLon, t);
|
|
461
|
+
return Math.hypot(o.x - a.x, o.y - a.y);
|
|
462
|
+
}
|
|
463
|
+
function oa(e, t, a = Wt) {
|
|
464
|
+
if (!e) return !1;
|
|
465
|
+
const o = Pt(e, t);
|
|
466
|
+
return Number.isFinite(o) && o < a;
|
|
467
|
+
}
|
|
468
|
+
function ea(e) {
|
|
469
|
+
return Number.isFinite(e) && e < 1.5 ? 1 : 2;
|
|
470
|
+
}
|
|
471
|
+
function ia(e) {
|
|
472
|
+
const t = /* @__PURE__ */ new Map();
|
|
473
|
+
for (const a of e) {
|
|
474
|
+
const o = t.get(a.cor);
|
|
475
|
+
o ? o.push(a) : t.set(a.cor, [a]);
|
|
476
|
+
}
|
|
477
|
+
return t;
|
|
478
|
+
}
|
|
479
|
+
const na = "#38bdf8";
|
|
480
|
+
function Na(e, t, a, o, i, n, s) {
|
|
481
|
+
let r = 0;
|
|
482
|
+
const c = ia(t);
|
|
483
|
+
for (const [l, d] of c) {
|
|
484
|
+
let h = !1;
|
|
485
|
+
for (const u of d) {
|
|
486
|
+
const v = Y(u.lat, u.lon, a), x = v.x - o, f = v.y - i;
|
|
487
|
+
x >= -2 && f >= -2 && x <= n + 2 && f <= s + 2 && (h || (e.fillStyle = l || na, e.globalAlpha = Lt, h = !0), e.fillRect(Math.round(x - u.lado / 2), Math.round(f - u.lado / 2), u.lado, u.lado), r++);
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
return r;
|
|
491
|
+
}
|
|
492
|
+
const q = "#38bdf8", sa = "#38bdf8", ra = /^(#[0-9a-f]{3,8}|(rgb|hsl)a?\([0-9.,%\s\/-]+\)|[a-z]{3,20})$/i;
|
|
493
|
+
function B(e, t) {
|
|
494
|
+
return typeof e == "string" && ra.test(e.trim()) ? e.trim() : t;
|
|
495
|
+
}
|
|
496
|
+
const F = (e) => typeof e == "number" && Number.isFinite(e);
|
|
497
|
+
function ut(e, t, a = !1) {
|
|
498
|
+
const o = e.estilo ?? {}, i = B(o.corTraco ?? t.corPrimaria, q), n = e.geometria.tipo, s = n === "Polygon" || n === "Circle", r = n === "Point", c = r && B(o.corContorno, "") || i, l = r && F(o.espessuraContorno) && o.espessuraContorno >= 0 ? o.espessuraContorno : void 0, d = l ?? (F(o.espessuraTraco) ? o.espessuraTraco : void 0) ?? (F(t.espessuraLinha) ? t.espessuraLinha : 2), h = F(o.opacidadePreenchimento) ? o.opacidadePreenchimento : s ? 0.2 : 0.85;
|
|
499
|
+
return {
|
|
500
|
+
cor: a ? sa : c,
|
|
501
|
+
traco: !(l === 0 && !a),
|
|
502
|
+
peso: a ? d + 2 : d,
|
|
503
|
+
dash: o.dashArray ?? (S(e) === "previa" ? "6 4" : t.dashArray),
|
|
504
|
+
preencher: s || r,
|
|
505
|
+
corPreenchimento: B(o.corPreenchimento, i),
|
|
506
|
+
opacidadePreenchimento: a ? Math.min(1, h + 0.18) : h
|
|
507
|
+
};
|
|
508
|
+
}
|
|
509
|
+
function ca(e, t) {
|
|
510
|
+
var o;
|
|
511
|
+
const a = ((o = e.estilo) == null ? void 0 : o.tamanhoIcone) ?? t.tamanhoMarcador ?? 8;
|
|
512
|
+
return (F(a) && a > 0 ? a : 8) / 2;
|
|
513
|
+
}
|
|
514
|
+
class da {
|
|
515
|
+
constructor() {
|
|
516
|
+
M(this, "porChave", /* @__PURE__ */ new Map());
|
|
517
|
+
}
|
|
518
|
+
interno(t) {
|
|
519
|
+
const a = `${t.cor}|${t.traco ? 1 : 0}|${t.peso}|${t.dash ?? ""}|${t.preencher ? 1 : 0}|${t.corPreenchimento}|${t.opacidadePreenchimento}`, o = this.porChave.get(a);
|
|
520
|
+
return o || (this.porChave.set(a, t), t);
|
|
521
|
+
}
|
|
522
|
+
limpar() {
|
|
523
|
+
this.porChave.clear();
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
const la = 0.3, ht = (e) => !!e && typeof e.id == "string" && !!e.geometria && typeof e.geometria.tipo == "string";
|
|
527
|
+
class ua {
|
|
528
|
+
constructor() {
|
|
529
|
+
M(this, "loja", /* @__PURE__ */ new Map());
|
|
530
|
+
M(this, "indice", new _t());
|
|
531
|
+
/** Muda a cada alteração dos dados (invalida cache de geometria por feição). */
|
|
532
|
+
M(this, "revisao", 0);
|
|
533
|
+
/** Muda quando o agrupamento e a contagem de pontos precisam ser refeitos do zero. */
|
|
534
|
+
M(this, "revisaoBase", 0);
|
|
535
|
+
M(this, "listaSincronizada", null);
|
|
536
|
+
/** Entidades com geometria oficial, e quantas oficiais cada uma tem. */
|
|
537
|
+
M(this, "oficiais", /* @__PURE__ */ new Set());
|
|
538
|
+
M(this, "contOficiais", /* @__PURE__ */ new Map());
|
|
539
|
+
/** Entidade -> quantas prévias (entidade com oficial E prévia forma um par: sempre em detalhe completo). */
|
|
540
|
+
M(this, "contPrevias", /* @__PURE__ */ new Map());
|
|
541
|
+
M(this, "nPrevias", 0);
|
|
542
|
+
M(this, "selecionadas", /* @__PURE__ */ new Set());
|
|
543
|
+
M(this, "regra", null);
|
|
544
|
+
/** Revisão por feição (id → número crescente): chave do cache de geometria projetada. */
|
|
545
|
+
M(this, "revisaoDe", /* @__PURE__ */ new Map());
|
|
546
|
+
M(this, "contador", 0);
|
|
547
|
+
}
|
|
548
|
+
revisaoDaFeicao(t) {
|
|
549
|
+
return this.revisaoDe.get(t) ?? 0;
|
|
550
|
+
}
|
|
551
|
+
/** Aparece segundo a regra (não oculta e visível por versão)? */
|
|
552
|
+
desenhavel(t) {
|
|
553
|
+
return t.oculta ? !1 : !this.regra || this.regra(t, this.oficiais);
|
|
554
|
+
}
|
|
555
|
+
/** Visível pela regra de versões (ignora `oculta`: o hit-test e a seleção seguem regras próprias). */
|
|
556
|
+
visivelPorVersao(t) {
|
|
557
|
+
return !this.regra || this.regra(t, this.oficiais);
|
|
558
|
+
}
|
|
559
|
+
/** Troca total: diferencia contra a loja, mantém o índice e a contabilidade de versões. */
|
|
560
|
+
sincronizar(t) {
|
|
561
|
+
const a = t.filter((s) => ht(s) && !s.excluida), o = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set();
|
|
562
|
+
for (const s of a)
|
|
563
|
+
i.add(s.id), this.loja.get(s.id) !== s && o.add(s.id);
|
|
564
|
+
const n = [...this.loja.keys()].filter((s) => !i.has(s));
|
|
565
|
+
if (o.size > 0 || n.length > 0) {
|
|
566
|
+
if (this.revisao++, this.revisaoBase++, this.loja.size === 0 || o.size + n.length > a.length * la)
|
|
567
|
+
this.indice.construir(a);
|
|
568
|
+
else {
|
|
569
|
+
for (const s of a) o.has(s.id) && this.indice.atualizar(s);
|
|
570
|
+
for (const s of n) this.indice.remover(s);
|
|
571
|
+
}
|
|
572
|
+
this.loja.clear();
|
|
573
|
+
for (const s of a) this.loja.set(s.id, s);
|
|
574
|
+
for (const s of n) this.revisaoDe.delete(s);
|
|
575
|
+
for (const s of o) this.revisaoDe.set(s, ++this.contador);
|
|
576
|
+
this.recontarOficiais();
|
|
577
|
+
}
|
|
578
|
+
this.listaSincronizada = t;
|
|
579
|
+
for (const s of [...this.selecionadas]) i.has(s) || this.selecionadas.delete(s);
|
|
580
|
+
return { mudadas: [...o], removidas: n, oficiaisMudou: !1 };
|
|
581
|
+
}
|
|
582
|
+
recontarOficiais() {
|
|
583
|
+
this.contOficiais = /* @__PURE__ */ new Map(), this.contPrevias = /* @__PURE__ */ new Map(), this.nPrevias = 0;
|
|
584
|
+
for (const t of this.loja.values()) {
|
|
585
|
+
if (S(t) !== "oficial") {
|
|
586
|
+
this.nPrevias++;
|
|
587
|
+
const o = b(t);
|
|
588
|
+
this.contPrevias.set(o, (this.contPrevias.get(o) ?? 0) + 1);
|
|
589
|
+
continue;
|
|
590
|
+
}
|
|
591
|
+
const a = b(t);
|
|
592
|
+
this.contOficiais.set(a, (this.contOficiais.get(a) ?? 0) + 1);
|
|
593
|
+
}
|
|
594
|
+
this.oficiais = new Set(this.contOficiais.keys());
|
|
595
|
+
}
|
|
596
|
+
/** Aplica só a diferença. Devolve `null` se o delta não parte da lista sincronizada (então use `sincronizar`). */
|
|
597
|
+
aplicarDelta(t, a) {
|
|
598
|
+
if (!a || a.base !== this.listaSincronizada) return null;
|
|
599
|
+
const o = /* @__PURE__ */ new Map(), i = (d, h) => {
|
|
600
|
+
if (!d || d.excluida || S(d) !== "oficial") return;
|
|
601
|
+
const u = b(d);
|
|
602
|
+
o.has(u) || o.set(u, this.oficiais.has(u));
|
|
603
|
+
const v = (this.contOficiais.get(u) ?? 0) + h;
|
|
604
|
+
v <= 0 ? (this.contOficiais.delete(u), this.oficiais.delete(u)) : (this.contOficiais.set(u, v), this.oficiais.add(u));
|
|
605
|
+
}, n = (d, h) => {
|
|
606
|
+
const u = b(d), v = (this.contPrevias.get(u) ?? 0) + h;
|
|
607
|
+
v <= 0 ? this.contPrevias.delete(u) : this.contPrevias.set(u, v);
|
|
608
|
+
}, s = [], r = [], c = (d) => {
|
|
609
|
+
const h = this.loja.get(d);
|
|
610
|
+
h && (S(h) === "previa" && (this.nPrevias--, n(h, -1)), i(h, -1), this.loja.delete(d), this.indice.remover(d), this.selecionadas.delete(d), this.revisaoDe.delete(d), r.push(d));
|
|
611
|
+
};
|
|
612
|
+
for (const d of a.removidas ?? []) c(d);
|
|
613
|
+
for (const d of a.mudadas ?? []) {
|
|
614
|
+
if (!ht(d)) continue;
|
|
615
|
+
if (d.excluida) {
|
|
616
|
+
c(d.id);
|
|
617
|
+
continue;
|
|
618
|
+
}
|
|
619
|
+
const h = this.loja.get(d.id);
|
|
620
|
+
S(d) === "previa" && (this.nPrevias++, n(d, 1)), h && (S(h) === "previa" && (this.nPrevias--, n(h, -1)), i(h, -1)), this.loja.set(d.id, d), this.indice.atualizar(d), i(d, 1), this.revisaoDe.set(d.id, ++this.contador), s.push(d.id);
|
|
621
|
+
}
|
|
622
|
+
let l = !1;
|
|
623
|
+
if (this.nPrevias > 0)
|
|
624
|
+
for (const [d, h] of o) h !== this.oficiais.has(d) && (l = !0);
|
|
625
|
+
return this.listaSincronizada = t, this.revisao++, l && this.revisaoBase++, { mudadas: s, removidas: r, oficiaisMudou: l };
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
const ha = 256, N = 85.0511287798, fa = 4007501668557849e-8;
|
|
629
|
+
function Dt(e, t, a, o, i) {
|
|
630
|
+
const n = a > N ? N : a < -N ? -N : a, s = Math.sin(n * Math.PI / 180);
|
|
631
|
+
e[t] = (o + 180) / 360 * i, e[t + 1] = (0.5 - Math.log((1 + s) / (1 - s)) / (4 * Math.PI)) * i;
|
|
632
|
+
}
|
|
633
|
+
const U = (e) => ha * 2 ** e;
|
|
634
|
+
function wa(e, t, a) {
|
|
635
|
+
const o = U(a);
|
|
636
|
+
return [Math.atan(Math.sinh(Math.PI * (1 - 2 * t / o))) * 180 / Math.PI, e / o * 360 - 180];
|
|
637
|
+
}
|
|
638
|
+
function ft(e, t) {
|
|
639
|
+
const a = U(t), o = new Float64Array(e.length * 2);
|
|
640
|
+
for (let i = 0; i < e.length; i++) {
|
|
641
|
+
const n = e[i];
|
|
642
|
+
Dt(o, i * 2, n[0], n[1], a);
|
|
643
|
+
}
|
|
644
|
+
return o;
|
|
645
|
+
}
|
|
646
|
+
function E(e, t, a) {
|
|
647
|
+
const o = new Float64Array(2);
|
|
648
|
+
return Dt(o, 0, e, t, U(a)), o;
|
|
649
|
+
}
|
|
650
|
+
function ma(e, t) {
|
|
651
|
+
const a = Math.max(-N, Math.min(N, e));
|
|
652
|
+
return fa * Math.cos(a * Math.PI / 180) / U(t);
|
|
653
|
+
}
|
|
654
|
+
function pa(e, t, a) {
|
|
655
|
+
const o = ma(e, a), i = t / o;
|
|
656
|
+
return Number.isFinite(i) && i >= 0 ? i : 0;
|
|
657
|
+
}
|
|
658
|
+
function Ea(e) {
|
|
659
|
+
let t = 1 / 0, a = 1 / 0, o = -1 / 0, i = -1 / 0;
|
|
660
|
+
for (const n of e)
|
|
661
|
+
for (let s = 0; s + 1 < n.length; s += 2) {
|
|
662
|
+
const r = n[s], c = n[s + 1];
|
|
663
|
+
Number.isFinite(r) && Number.isFinite(c) && (r < t && (t = r), r > o && (o = r), c < a && (a = c), c > i && (i = c));
|
|
664
|
+
}
|
|
665
|
+
return t <= o && a <= i ? { minX: t, minY: a, maxX: o, maxY: i } : null;
|
|
666
|
+
}
|
|
667
|
+
function ga(e, t, a, o, i, n) {
|
|
668
|
+
const s = i - a, r = n - o, c = s * s + r * r;
|
|
669
|
+
let l = c === 0 ? 0 : ((e - a) * s + (t - o) * r) / c;
|
|
670
|
+
return l = l < 0 ? 0 : l > 1 ? 1 : l, Math.hypot(e - (a + l * s), t - (o + l * r));
|
|
671
|
+
}
|
|
672
|
+
function mt(e, t, a) {
|
|
673
|
+
const o = e.length >> 1;
|
|
674
|
+
if (!(t > 0) || o < 3) return e;
|
|
675
|
+
let i = e, n = o;
|
|
676
|
+
a && (i = new Float64Array((o + 1) * 2), i.set(e), i[o * 2] = e[0], i[o * 2 + 1] = e[1], n = o + 1);
|
|
677
|
+
const s = new Uint8Array(n);
|
|
678
|
+
s[0] = 1, s[n - 1] = 1;
|
|
679
|
+
const r = [0, n - 1];
|
|
680
|
+
for (; r.length > 0; ) {
|
|
681
|
+
const u = r.pop(), v = r.pop();
|
|
682
|
+
let x = 0, f = -1;
|
|
683
|
+
const m = i[v * 2], L = i[v * 2 + 1], w = i[u * 2], I = i[u * 2 + 1];
|
|
684
|
+
for (let y = v + 1; y < u; y++) {
|
|
685
|
+
const g = ga(i[y * 2], i[y * 2 + 1], m, L, w, I);
|
|
686
|
+
g > x && (x = g, f = y);
|
|
687
|
+
}
|
|
688
|
+
f !== -1 && x > t && (s[f] = 1, r.push(v, f, f, u));
|
|
689
|
+
}
|
|
690
|
+
const c = a ? n - 1 : n;
|
|
691
|
+
let l = 0;
|
|
692
|
+
for (let u = 0; u < c; u++) s[u] && l++;
|
|
693
|
+
if (a && l < 3 || l === c) return e;
|
|
694
|
+
const d = new Float64Array(l * 2);
|
|
695
|
+
let h = 0;
|
|
696
|
+
for (let u = 0; u < c; u++)
|
|
697
|
+
s[u] && (d[h++] = i[u * 2], d[h++] = i[u * 2 + 1]);
|
|
698
|
+
return d;
|
|
699
|
+
}
|
|
700
|
+
const va = 1.2, _ = 1e-9, Ma = 6, T = {
|
|
701
|
+
cor: q,
|
|
702
|
+
traco: !1,
|
|
703
|
+
peso: 0,
|
|
704
|
+
dash: void 0,
|
|
705
|
+
preencher: !1,
|
|
706
|
+
corPreenchimento: q,
|
|
707
|
+
opacidadePreenchimento: 0
|
|
708
|
+
}, H = (e) => !!e && Number.isFinite(e.zoom) && e.zoom >= 0 && !!e.caixa && Number.isFinite(e.caixa.minLat) && Number.isFinite(e.caixa.maxLat) && Number.isFinite(e.caixa.minLon) && Number.isFinite(e.caixa.maxLon);
|
|
709
|
+
class Fa {
|
|
710
|
+
constructor() {
|
|
711
|
+
M(this, "camadas", /* @__PURE__ */ new Map());
|
|
712
|
+
M(this, "regra", null);
|
|
713
|
+
}
|
|
714
|
+
// ---------------------------------------------------------------- camadas
|
|
715
|
+
/** Cria a camada ou atualiza a definição (estilo, zIndex, opacidade, visibilidade). */
|
|
716
|
+
definirCamada(t) {
|
|
717
|
+
if (!t || typeof t.id != "string") return;
|
|
718
|
+
let a = this.camadas.get(t.id);
|
|
719
|
+
if (!a) {
|
|
720
|
+
a = {
|
|
721
|
+
def: t,
|
|
722
|
+
dados: new ua(),
|
|
723
|
+
zoomCache: -1,
|
|
724
|
+
geom: /* @__PURE__ */ new Map(),
|
|
725
|
+
estilos: /* @__PURE__ */ new Map(),
|
|
726
|
+
lod: /* @__PURE__ */ new Map(),
|
|
727
|
+
avaliacoesLOD: 0,
|
|
728
|
+
agrupador: null,
|
|
729
|
+
agrupadorRev: -1,
|
|
730
|
+
nPontos: 0,
|
|
731
|
+
nPontosRev: -1,
|
|
732
|
+
previas: /* @__PURE__ */ new Map(),
|
|
733
|
+
destaques: /* @__PURE__ */ new Set(),
|
|
734
|
+
revEstilo: 0,
|
|
735
|
+
internador: new da(),
|
|
736
|
+
ultima: { total: 0, desenhadas: 0, marcasLOD: 0, clusters: 0, marcadoresDom: 0, avaliacoesLOD: 0 }
|
|
737
|
+
}, a.dados.regra = this.regra, this.camadas.set(t.id, a);
|
|
738
|
+
return;
|
|
739
|
+
}
|
|
740
|
+
const o = JSON.stringify(a.def.estilo) !== JSON.stringify(t.estilo);
|
|
741
|
+
a.def = t, o && (a.revEstilo++, a.estilos.clear(), a.internador.limpar());
|
|
742
|
+
}
|
|
743
|
+
removerCamada(t) {
|
|
744
|
+
this.camadas.delete(t);
|
|
745
|
+
}
|
|
746
|
+
temCamada(t) {
|
|
747
|
+
return this.camadas.has(t);
|
|
748
|
+
}
|
|
749
|
+
definirRegra(t) {
|
|
750
|
+
this.regra = t;
|
|
751
|
+
for (const a of this.camadas.values()) a.dados.regra = t;
|
|
752
|
+
}
|
|
753
|
+
/** A regra de versões mudou (prévias ligadas/desligadas): o conjunto desenhado e o agrupamento precisam ser refeitos. */
|
|
754
|
+
reavaliarVersoes(t) {
|
|
755
|
+
const a = this.camadas.get(t);
|
|
756
|
+
a && (a.dados.revisao++, a.dados.revisaoBase++);
|
|
757
|
+
}
|
|
758
|
+
// ---------------------------------------------------------------- dados
|
|
759
|
+
/** Troca total dos dados da camada (diferencia contra o que já existe). */
|
|
760
|
+
definirFeicoes(t, a) {
|
|
761
|
+
const o = this.camadas.get(t);
|
|
762
|
+
if (!o) return;
|
|
763
|
+
const i = Array.isArray(a) ? a : [], n = o.dados.sincronizar(i);
|
|
764
|
+
this.aposMudanca(o, n.mudadas, n.removidas, !0);
|
|
765
|
+
}
|
|
766
|
+
/**
|
|
767
|
+
* Mudança incremental: só vale se `delta.base` for a lista sincronizada por último; senão a camada é refeita
|
|
768
|
+
* por inteiro a partir de `lista`.
|
|
769
|
+
*/
|
|
770
|
+
aplicarDelta(t, a, o) {
|
|
771
|
+
const i = this.camadas.get(t);
|
|
772
|
+
if (!i) return;
|
|
773
|
+
const n = Array.isArray(a) ? a : [], s = /* @__PURE__ */ new Map();
|
|
774
|
+
if (o) {
|
|
775
|
+
for (const l of o.removidas ?? []) s.set(l, this.pontoVisivel(i, i.dados.loja.get(l)));
|
|
776
|
+
for (const l of o.mudadas ?? []) l && typeof l.id == "string" && s.set(l.id, this.pontoVisivel(i, i.dados.loja.get(l.id)));
|
|
777
|
+
}
|
|
778
|
+
const r = i.dados.aplicarDelta(n, o);
|
|
779
|
+
if (!r) {
|
|
780
|
+
this.definirFeicoes(t, n);
|
|
781
|
+
return;
|
|
782
|
+
}
|
|
783
|
+
let c = i.nPontos;
|
|
784
|
+
for (const [l, d] of s) {
|
|
785
|
+
const h = this.pontoVisivel(i, i.dados.loja.get(l));
|
|
786
|
+
c += (h ? 1 : 0) - (d ? 1 : 0);
|
|
787
|
+
}
|
|
788
|
+
i.nPontos = Math.max(0, c), this.aposMudanca(i, r.mudadas, r.removidas, r.oficiaisMudou), r.oficiaisMudou || this.manterAgrupador(i, r.mudadas, r.removidas);
|
|
789
|
+
}
|
|
790
|
+
pontoVisivel(t, a) {
|
|
791
|
+
var o;
|
|
792
|
+
return !!a && ((o = a.geometria) == null ? void 0 : o.tipo) === "Point" && t.dados.desenhavel(a);
|
|
793
|
+
}
|
|
794
|
+
aposMudanca(t, a, o, i) {
|
|
795
|
+
for (const n of a)
|
|
796
|
+
t.lod.delete(n), t.geom.delete(n), t.estilos.delete(n), t.previas.delete(n);
|
|
797
|
+
for (const n of o)
|
|
798
|
+
t.lod.delete(n), t.geom.delete(n), t.estilos.delete(n), t.previas.delete(n), t.destaques.delete(n);
|
|
799
|
+
i && (t.agrupador = null);
|
|
800
|
+
}
|
|
801
|
+
/** O agrupador do zoom atual acompanha os pontos que mudaram (células afetadas, sem reagrupar a camada). */
|
|
802
|
+
manterAgrupador(t, a, o) {
|
|
803
|
+
const i = t.agrupador;
|
|
804
|
+
if (i) {
|
|
805
|
+
for (const n of o) i.remover(n);
|
|
806
|
+
for (const n of a) {
|
|
807
|
+
const s = t.dados.loja.get(n);
|
|
808
|
+
s && s.geometria.tipo === "Point" && t.dados.desenhavel(s) ? i.inserir({ id: n, coordenada: s.geometria.coordenada }) : i.remover(n);
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
}
|
|
812
|
+
// ---------------------------------------------------------------- seleção e edição
|
|
813
|
+
/** Define a seleção da camada. Devolve quem entrou e quem saiu (só o que mudou). */
|
|
814
|
+
selecionar(t, a) {
|
|
815
|
+
const o = this.camadas.get(t);
|
|
816
|
+
if (!o) return { entrou: [], saiu: [] };
|
|
817
|
+
const i = /* @__PURE__ */ new Set();
|
|
818
|
+
for (const r of a) o.dados.loja.has(r) && i.add(r);
|
|
819
|
+
const n = [], s = [];
|
|
820
|
+
for (const r of i) o.dados.selecionadas.has(r) || n.push(r);
|
|
821
|
+
for (const r of o.dados.selecionadas) i.has(r) || s.push(r);
|
|
822
|
+
o.dados.selecionadas.clear();
|
|
823
|
+
for (const r of i) o.dados.selecionadas.add(r);
|
|
824
|
+
return { entrou: n, saiu: s };
|
|
825
|
+
}
|
|
826
|
+
selecionadas(t) {
|
|
827
|
+
var a;
|
|
828
|
+
return ((a = this.camadas.get(t)) == null ? void 0 : a.dados.selecionadas) ?? /* @__PURE__ */ new Set();
|
|
829
|
+
}
|
|
830
|
+
/** Geometria provisória (arrasto de vértice): o canvas base deixa de desenhar a feição e a sobreposição a mostra. */
|
|
831
|
+
previsualizar(t, a) {
|
|
832
|
+
const o = this.camadas.get(t);
|
|
833
|
+
!o || !a || typeof a.id != "string" || !o.dados.loja.has(a.id) || o.previas.set(a.id, a);
|
|
834
|
+
}
|
|
835
|
+
temPrevia(t, a) {
|
|
836
|
+
var o;
|
|
837
|
+
return ((o = this.camadas.get(t)) == null ? void 0 : o.previas.has(a)) ?? !1;
|
|
838
|
+
}
|
|
839
|
+
/** Realce temporário (hover): as feições entram na sobreposição com `destaque: true`. */
|
|
840
|
+
destacar(t, a) {
|
|
841
|
+
const o = this.camadas.get(t);
|
|
842
|
+
o && (o.destaques = new Set(a));
|
|
843
|
+
}
|
|
844
|
+
// ---------------------------------------------------------------- consultas (geometria original)
|
|
845
|
+
feicao(t, a) {
|
|
846
|
+
var o;
|
|
847
|
+
return (o = this.camadas.get(t)) == null ? void 0 : o.dados.loja.get(a);
|
|
848
|
+
}
|
|
849
|
+
caixaDe(t, a) {
|
|
850
|
+
var o;
|
|
851
|
+
return (o = this.camadas.get(t)) == null ? void 0 : o.dados.indice.caixaDe(a);
|
|
852
|
+
}
|
|
853
|
+
/** Feições cujo envelope toca `caixa`, sem as ocultas (snap, hit-test, seleção por caixa). Não passa pelo LOD. */
|
|
854
|
+
consultarCaixa(t, a) {
|
|
855
|
+
const o = this.camadas.get(t);
|
|
856
|
+
if (!o) return [];
|
|
857
|
+
const i = [];
|
|
858
|
+
for (const n of o.dados.indice.consultar(a)) {
|
|
859
|
+
const s = o.dados.loja.get(n);
|
|
860
|
+
s && !s.oculta && i.push(s);
|
|
861
|
+
}
|
|
862
|
+
return i;
|
|
863
|
+
}
|
|
864
|
+
feicaoVisivel(t, a) {
|
|
865
|
+
const o = this.camadas.get(t);
|
|
866
|
+
return !o || o.dados.visivelPorVersao(a);
|
|
867
|
+
}
|
|
868
|
+
estatisticas(t) {
|
|
869
|
+
const a = this.camadas.get(t);
|
|
870
|
+
return a ? { ...a.ultima, total: a.dados.loja.size, avaliacoesLOD: a.avaliacoesLOD } : null;
|
|
871
|
+
}
|
|
872
|
+
/** Entidades da camada com prévia e com oficial (pares em detalhe completo): para testes e diagnóstico. */
|
|
873
|
+
ehPar(t, a) {
|
|
874
|
+
const o = this.camadas.get(t);
|
|
875
|
+
return !!o && this.emPar(o, a);
|
|
876
|
+
}
|
|
877
|
+
// ---------------------------------------------------------------- lista de desenho
|
|
878
|
+
/**
|
|
879
|
+
* O que desenhar nesta vista, camada a camada, na ordem de empilhamento (a última fica por cima).
|
|
880
|
+
* `parte`: `'canvas'` só o que se pinta no canvas (marcas, formas, pontos sem ícone), `'dom'` só marcadores DOM e
|
|
881
|
+
* curvas (clusters, ícones, textos, rótulos), `'tudo'` (padrão) os dois. O pan incremental pede o canvas só das faixas
|
|
882
|
+
* expostas e o DOM da vista inteira (poucos itens, sem projetar nem simplificar formas).
|
|
883
|
+
*/
|
|
884
|
+
listaDesenho(t, a) {
|
|
885
|
+
const o = this.origemDe(t), i = { vista: t, origem: o, camadas: [] };
|
|
886
|
+
if (!H(t)) return i;
|
|
887
|
+
const n = a != null && a.camadas ? new Set(a.camadas) : null, s = [...this.camadas.values()].filter((r) => r.def.visivel && (!n || n.has(r.def.id)));
|
|
888
|
+
s.sort((r, c) => r.def.zIndex - c.def.zIndex);
|
|
889
|
+
for (const r of s)
|
|
890
|
+
try {
|
|
891
|
+
i.camadas.push(this.listarCamada(r, t, (a == null ? void 0 : a.parte) ?? "tudo"));
|
|
892
|
+
} catch {
|
|
893
|
+
i.camadas.push(this.camadaVazia(r));
|
|
894
|
+
}
|
|
895
|
+
return i;
|
|
896
|
+
}
|
|
897
|
+
origemDe(t) {
|
|
898
|
+
if (t != null && t.origemPx && Number.isFinite(t.origemPx.x) && Number.isFinite(t.origemPx.y)) return t.origemPx;
|
|
899
|
+
if (!H(t)) return { x: 0, y: 0 };
|
|
900
|
+
const a = E(t.caixa.maxLat, t.caixa.minLon, t.zoom);
|
|
901
|
+
return { x: a[0], y: a[1] };
|
|
902
|
+
}
|
|
903
|
+
camadaVazia(t) {
|
|
904
|
+
return {
|
|
905
|
+
camadaId: t.def.id,
|
|
906
|
+
zIndex: t.def.zIndex,
|
|
907
|
+
opacidade: t.def.opacidade,
|
|
908
|
+
itens: [],
|
|
909
|
+
estatisticas: { total: t.dados.loja.size, desenhadas: 0, marcasLOD: 0, clusters: 0, marcadoresDom: 0, avaliacoesLOD: t.avaliacoesLOD }
|
|
910
|
+
};
|
|
911
|
+
}
|
|
912
|
+
prepararZoom(t, a) {
|
|
913
|
+
a !== t.zoomCache && (t.geom.clear(), t.lod.clear(), t.zoomCache = a);
|
|
914
|
+
}
|
|
915
|
+
estiloDe(t, a) {
|
|
916
|
+
const o = t.dados.revisaoDaFeicao(a.id), i = t.estilos.get(a.id);
|
|
917
|
+
if (i && i.rev === o && i.revEstilo === t.revEstilo) return i.estilo;
|
|
918
|
+
const n = t.internador.interno(ut(a, t.def.estilo, !1));
|
|
919
|
+
return t.estilos.set(a.id, { rev: o, revEstilo: t.revEstilo, estilo: n }), n;
|
|
920
|
+
}
|
|
921
|
+
emPar(t, a) {
|
|
922
|
+
if (t.dados.contPrevias.size === 0) return !1;
|
|
923
|
+
const o = b(a);
|
|
924
|
+
return t.dados.contPrevias.has(o) && t.dados.oficiais.has(o);
|
|
925
|
+
}
|
|
926
|
+
/**
|
|
927
|
+
* Vira marca? Sempre em detalhe completo: com rótulo e em par oficial × prévia; ponto e texto nunca. A seleção NÃO
|
|
928
|
+
* entra aqui: o canvas base não depende dela (a sobreposição desenha a selecionada em detalhe completo por cima).
|
|
929
|
+
*/
|
|
930
|
+
comoMarca(t, a, o) {
|
|
931
|
+
var r;
|
|
932
|
+
const i = a.geometria.tipo;
|
|
933
|
+
if (i === "Point" || i === "Text" || (r = a.estilo) != null && r.mostrarRotulo || this.emPar(t, a)) return !1;
|
|
934
|
+
const n = t.lod.get(a.id);
|
|
935
|
+
if (n !== void 0) return n;
|
|
936
|
+
t.avaliacoesLOD++;
|
|
937
|
+
const s = oa(t.dados.indice.caixaDe(a.id), o);
|
|
938
|
+
return t.lod.set(a.id, s), s;
|
|
939
|
+
}
|
|
940
|
+
/** Geometria projetada e simplificada em px, em cache por (feição, revisão, zoom). `null` se não há o que desenhar. */
|
|
941
|
+
geometriaProjetada(t, a, o) {
|
|
942
|
+
const i = t.dados.revisaoDaFeicao(a.id), n = t.geom.get(a.id);
|
|
943
|
+
if (n && n.rev === i) return n;
|
|
944
|
+
const s = this.construirGeometria(t, a, o, i);
|
|
945
|
+
return s && t.geom.set(a.id, s), s;
|
|
946
|
+
}
|
|
947
|
+
construirGeometria(t, a, o, i) {
|
|
948
|
+
const n = a.geometria, s = o < pt ? va : 0;
|
|
949
|
+
if (n.tipo === "Polygon") {
|
|
950
|
+
const r = [];
|
|
951
|
+
for (const c of n.aneis ?? []) {
|
|
952
|
+
if (!Array.isArray(c) || c.length < 3) continue;
|
|
953
|
+
let l = ft(c, o);
|
|
954
|
+
s > 0 && c.length >= J && (l = mt(l, s, !0)), r.push(l);
|
|
955
|
+
}
|
|
956
|
+
return r.length > 0 ? { rev: i, partes: r, raioPx: 0, marca: !1 } : null;
|
|
957
|
+
}
|
|
958
|
+
if (n.tipo === "LineString") {
|
|
959
|
+
const r = [];
|
|
960
|
+
for (const c of z(n)) {
|
|
961
|
+
if (!Array.isArray(c) || c.length < 2) continue;
|
|
962
|
+
let l = ft(c, o);
|
|
963
|
+
s > 0 && c.length >= J && (l = mt(l, s, !1)), r.push(l);
|
|
964
|
+
}
|
|
965
|
+
return r.length > 0 ? { rev: i, partes: r, raioPx: 0, marca: !1 } : null;
|
|
966
|
+
}
|
|
967
|
+
if (n.tipo === "Circle") {
|
|
968
|
+
const r = n.centro;
|
|
969
|
+
if (!Array.isArray(r)) return null;
|
|
970
|
+
const c = E(r[0], r[1], o);
|
|
971
|
+
return { rev: i, partes: [c], raioPx: pa(r[0], n.raioMetros, o), marca: !1 };
|
|
972
|
+
}
|
|
973
|
+
return n.tipo === "Point" || n.tipo === "Text" ? { rev: i, partes: [E(n.coordenada[0], n.coordenada[1], o)], raioPx: n.tipo === "Point" ? ca(a, t.def.estilo) : 0, marca: !1 } : null;
|
|
974
|
+
}
|
|
975
|
+
/** Marca de LOD: centro do envelope, lado de 1–2 px, cor do preenchimento/contorno. */
|
|
976
|
+
marcaDe(t, a, o) {
|
|
977
|
+
const i = t.dados.revisaoDaFeicao(a.id), n = t.geom.get(a.id);
|
|
978
|
+
if (n && n.rev === i) return n;
|
|
979
|
+
const s = t.dados.indice.caixaDe(a.id);
|
|
980
|
+
if (!s) return null;
|
|
981
|
+
const r = E((s.minLat + s.maxLat) / 2, (s.minLon + s.maxLon) / 2, o);
|
|
982
|
+
if (!(Number.isFinite(r[0]) && Number.isFinite(r[1]))) return null;
|
|
983
|
+
const c = { rev: i, partes: [r], raioPx: ea(Pt(s, o)), marca: !0 };
|
|
984
|
+
return t.geom.set(a.id, c), c;
|
|
985
|
+
}
|
|
986
|
+
/**
|
|
987
|
+
* Item da marca, em cache junto com a geometria por (feição, zoom). Com 100 mil marcas na tela, montar o item e internar
|
|
988
|
+
* o estilo a cada vista custava a maior parte da lista; no pan agora só se confere se algo mudou, sem alocar.
|
|
989
|
+
*/
|
|
990
|
+
itemMarca(t, a, o) {
|
|
991
|
+
const i = this.marcaDe(t, a, o);
|
|
992
|
+
if (!i) return null;
|
|
993
|
+
const n = i.item;
|
|
994
|
+
if (n && n.feicao === a && i.revEstilo === t.revEstilo && n.selecionada === t.dados.selecionadas.has(a.id) && n.destaque === !0 === t.destaques.has(a.id)) return n;
|
|
995
|
+
const s = this.itemBase(t, a, "marca", i.partes, i.raioPx, this.estiloMarca(t, a));
|
|
996
|
+
return i.item = s, i.revEstilo = t.revEstilo, s;
|
|
997
|
+
}
|
|
998
|
+
estiloMarca(t, a) {
|
|
999
|
+
const o = a.estilo ?? {}, i = B(o.corPreenchimento ?? o.corTraco ?? t.def.estilo.corPrimaria, q);
|
|
1000
|
+
return t.internador.interno({ cor: i, traco: !1, peso: 0, dash: void 0, preencher: !0, corPreenchimento: i, opacidadePreenchimento: Lt });
|
|
1001
|
+
}
|
|
1002
|
+
agrupadorAtivo(t, a) {
|
|
1003
|
+
const { dados: o } = t;
|
|
1004
|
+
if (t.nPontosRev !== o.revisaoBase) {
|
|
1005
|
+
let s = 0;
|
|
1006
|
+
for (const r of o.loja.values()) r.geometria.tipo === "Point" && o.desenhavel(r) && s++;
|
|
1007
|
+
t.nPontos = s, t.nPontosRev = o.revisaoBase;
|
|
1008
|
+
}
|
|
1009
|
+
if (!xt(t.nPontos, a))
|
|
1010
|
+
return t.agrupador = null, null;
|
|
1011
|
+
const i = t.agrupador;
|
|
1012
|
+
if (i && i.zoom === a && t.agrupadorRev === o.revisaoBase) return i;
|
|
1013
|
+
const n = new Kt(a, (s) => {
|
|
1014
|
+
const r = E(s[0], s[1], a);
|
|
1015
|
+
return { x: r[0], y: r[1] };
|
|
1016
|
+
});
|
|
1017
|
+
for (const s of o.loja.values())
|
|
1018
|
+
s.geometria.tipo === "Point" && o.desenhavel(s) && n.inserir({ id: s.id, coordenada: s.geometria.coordenada });
|
|
1019
|
+
return t.agrupador = n, t.agrupadorRev = o.revisaoBase, n;
|
|
1020
|
+
}
|
|
1021
|
+
itemBase(t, a, o, i, n, s) {
|
|
1022
|
+
return {
|
|
1023
|
+
camadaId: t.def.id,
|
|
1024
|
+
id: a.id,
|
|
1025
|
+
forma: o,
|
|
1026
|
+
geometriaEmPx: i,
|
|
1027
|
+
raioPx: n,
|
|
1028
|
+
estilo: s,
|
|
1029
|
+
selecionada: t.dados.selecionadas.has(a.id),
|
|
1030
|
+
feicao: a,
|
|
1031
|
+
...t.destaques.has(a.id) ? { destaque: !0 } : {}
|
|
1032
|
+
};
|
|
1033
|
+
}
|
|
1034
|
+
/**
|
|
1035
|
+
* A caixa da vista com uma folga de poucos px: o traço de uma feição com o envelope logo fora da vista ainda entra nela
|
|
1036
|
+
* (o índice é por envelope). Sem isto, o pan incremental e o quadro completo divergem na borda do canvas.
|
|
1037
|
+
*/
|
|
1038
|
+
caixaComFolga(t) {
|
|
1039
|
+
const a = t.caixa, i = 360 / (256 * 2 ** t.zoom) * Ma, n = i * Math.cos((a.minLat + a.maxLat) / 2 * Math.PI / 180);
|
|
1040
|
+
return { minLat: a.minLat - n, maxLat: a.maxLat + n, minLon: a.minLon - i, maxLon: a.maxLon + i };
|
|
1041
|
+
}
|
|
1042
|
+
listarCamada(t, a, o) {
|
|
1043
|
+
var y;
|
|
1044
|
+
const { dados: i, def: n } = t, s = o !== "dom", r = o !== "canvas", c = a.zoom;
|
|
1045
|
+
this.prepararZoom(t, c);
|
|
1046
|
+
const l = i.indice.consultar(this.caixaComFolga(a)), d = this.agrupadorAtivo(t, c), h = [], u = [], v = [], x = [], f = [], m = { total: i.loja.size, desenhadas: 0, marcasLOD: 0, clusters: 0, marcadoresDom: 0, avaliacoesLOD: 0 }, L = (g) => {
|
|
1047
|
+
var D;
|
|
1048
|
+
if (!r || !((D = g.estilo) != null && D.mostrarRotulo) || g.geometria.tipo === "Text") return;
|
|
1049
|
+
const p = Ft(g, g.estilo.campoRotulo), P = i.indice.caixaDe(g.id);
|
|
1050
|
+
!p || !P || (f.push({
|
|
1051
|
+
camadaId: n.id,
|
|
1052
|
+
id: `rotulo:${g.id}`,
|
|
1053
|
+
forma: "rotulo",
|
|
1054
|
+
geometriaEmPx: [],
|
|
1055
|
+
raioPx: 0,
|
|
1056
|
+
estilo: T,
|
|
1057
|
+
selecionada: !1,
|
|
1058
|
+
feicao: g,
|
|
1059
|
+
texto: p,
|
|
1060
|
+
coordenada: [(P.minLat + P.maxLat) / 2, (P.minLon + P.maxLon) / 2]
|
|
1061
|
+
}), m.marcadoresDom++);
|
|
1062
|
+
}, w = (g) => {
|
|
1063
|
+
var D;
|
|
1064
|
+
const p = g.geometria;
|
|
1065
|
+
if (p.tipo !== "Point") return;
|
|
1066
|
+
if ((D = g.estilo) != null && D.icone) {
|
|
1067
|
+
if (!r) return;
|
|
1068
|
+
f.push({ ...this.itemBase(t, g, "icone", [], 0, T), coordenada: p.coordenada }), m.marcadoresDom++;
|
|
1069
|
+
return;
|
|
1070
|
+
}
|
|
1071
|
+
if (!s) return;
|
|
1072
|
+
const P = this.geometriaProjetada(t, g, c);
|
|
1073
|
+
P && (x.push(this.itemBase(t, g, "ponto", P.partes, P.raioPx, this.estiloDe(t, g))), m.desenhadas++);
|
|
1074
|
+
};
|
|
1075
|
+
for (const g of l) {
|
|
1076
|
+
const p = i.loja.get(g);
|
|
1077
|
+
if (!p || !i.desenhavel(p) || t.previas.has(g)) continue;
|
|
1078
|
+
const P = p.geometria;
|
|
1079
|
+
if (P.tipo === "Point") {
|
|
1080
|
+
if (d && d.emCluster(g) && (!((y = p.estilo) != null && y.icone) || !r || !this.soltoDoCluster(t, d, g)))
|
|
1081
|
+
continue;
|
|
1082
|
+
w(p), L(p);
|
|
1083
|
+
continue;
|
|
1084
|
+
}
|
|
1085
|
+
if (P.tipo === "Text") {
|
|
1086
|
+
if (!r) continue;
|
|
1087
|
+
f.push({ ...this.itemBase(t, p, "texto", [], 0, T), coordenada: P.coordenada }), m.marcadoresDom++;
|
|
1088
|
+
continue;
|
|
1089
|
+
}
|
|
1090
|
+
if (dt(P)) {
|
|
1091
|
+
if (!r) continue;
|
|
1092
|
+
f.push(this.itemBase(t, p, "curva", [], 0, this.estiloDe(t, p))), m.marcadoresDom++, L(p);
|
|
1093
|
+
continue;
|
|
1094
|
+
}
|
|
1095
|
+
if (!s) {
|
|
1096
|
+
L(p);
|
|
1097
|
+
continue;
|
|
1098
|
+
}
|
|
1099
|
+
const D = t.geom.get(g), C = D == null ? void 0 : D.item;
|
|
1100
|
+
if (C && C.feicao === p && D.revEstilo === t.revEstilo && !this.emPar(t, p) && C.selecionada === i.selecionadas.has(g) && C.destaque === !0 === t.destaques.has(g)) {
|
|
1101
|
+
h.push(C), m.marcasLOD++;
|
|
1102
|
+
continue;
|
|
1103
|
+
}
|
|
1104
|
+
if (this.comoMarca(t, p, c)) {
|
|
1105
|
+
const K = this.itemMarca(t, p, c);
|
|
1106
|
+
K && (h.push(K), m.marcasLOD++);
|
|
1107
|
+
continue;
|
|
1108
|
+
}
|
|
1109
|
+
const O = this.geometriaProjetada(t, p, c);
|
|
1110
|
+
if (!O) continue;
|
|
1111
|
+
const X = this.estiloDe(t, p);
|
|
1112
|
+
P.tipo === "LineString" ? v.push(this.itemBase(t, p, "linha", O.partes, 0, X)) : P.tipo === "Circle" ? u.push(this.itemBase(t, p, "circulo", O.partes, O.raioPx, X)) : u.push(this.itemBase(t, p, "poligono", O.partes, 0, X)), m.desenhadas++, L(p);
|
|
1113
|
+
}
|
|
1114
|
+
d && r && this.listarClusters(t, a, d, f, m, r), m.avaliacoesLOD = t.avaliacoesLOD, o === "tudo" && (t.ultima = m);
|
|
1115
|
+
const I = h;
|
|
1116
|
+
for (const g of [u, v, x, f]) for (const p of g) I.push(p);
|
|
1117
|
+
return { camadaId: n.id, zIndex: n.zIndex, opacidade: n.opacidade, itens: I, estatisticas: m };
|
|
1118
|
+
}
|
|
1119
|
+
/**
|
|
1120
|
+
* Clusters da vista (marcadores DOM). Selecionado nunca entra em cluster; o cluster só aparece com o centro dentro da
|
|
1121
|
+
* vista e com 2 ou mais restantes. Os pontos individuais que a seleção solta (o selecionado e o único restante de uma
|
|
1122
|
+
* célula) são da sobreposição: o canvas base não depende da seleção.
|
|
1123
|
+
*/
|
|
1124
|
+
listarClusters(t, a, o, i, n, s) {
|
|
1125
|
+
const { dados: r, def: c } = t;
|
|
1126
|
+
for (const [l, d] of o.celulasAgrupadas()) {
|
|
1127
|
+
const h = d.membros.size;
|
|
1128
|
+
let u = 0, v = d.somaLat, x = d.somaLon;
|
|
1129
|
+
for (const L of d.membros.values())
|
|
1130
|
+
r.selecionadas.has(L.id) && (u++, v -= L.coordenada[0], x -= L.coordenada[1]);
|
|
1131
|
+
const f = h - u, m = [d.somaLat / h, d.somaLon / h];
|
|
1132
|
+
m[0] >= a.caixa.minLat - _ && m[0] <= a.caixa.maxLat + _ && m[1] >= a.caixa.minLon - _ && m[1] <= a.caixa.maxLon + _ && (f < 2 || !s || (i.push({
|
|
1133
|
+
camadaId: c.id,
|
|
1134
|
+
id: l,
|
|
1135
|
+
forma: "cluster",
|
|
1136
|
+
geometriaEmPx: [],
|
|
1137
|
+
raioPx: 0,
|
|
1138
|
+
estilo: T,
|
|
1139
|
+
selecionada: !1,
|
|
1140
|
+
coordenada: [v / f, x / f],
|
|
1141
|
+
total: h,
|
|
1142
|
+
restantes: f
|
|
1143
|
+
}), n.clusters++, n.marcadoresDom++));
|
|
1144
|
+
}
|
|
1145
|
+
}
|
|
1146
|
+
/** O ponto está dentro de um cluster neste zoom (não é desenhado nem clicável individualmente)? */
|
|
1147
|
+
pontoAgrupado(t, a) {
|
|
1148
|
+
const o = this.camadas.get(t);
|
|
1149
|
+
return !!(o != null && o.agrupador) && o.agrupador.emCluster(a) && !o.dados.selecionadas.has(a);
|
|
1150
|
+
}
|
|
1151
|
+
/** O ponto de uma célula de cluster aparece solto: está selecionado ou é o único restante não selecionado? */
|
|
1152
|
+
soltoDoCluster(t, a, o) {
|
|
1153
|
+
if (t.dados.selecionadas.has(o)) return !0;
|
|
1154
|
+
const i = a.chaveDoPonto(o), n = i === void 0 ? void 0 : a.celula(i);
|
|
1155
|
+
if (!n) return !1;
|
|
1156
|
+
let s = 0;
|
|
1157
|
+
for (const r of n.membros.keys()) t.dados.selecionadas.has(r) || s++;
|
|
1158
|
+
return s === 1;
|
|
1159
|
+
}
|
|
1160
|
+
/** Membros (id e coordenada) da célula de cluster: o clique no cluster enquadra o grupo. */
|
|
1161
|
+
membrosDoCluster(t, a) {
|
|
1162
|
+
var n;
|
|
1163
|
+
const o = this.camadas.get(t), i = (n = o == null ? void 0 : o.agrupador) == null ? void 0 : n.celula(a);
|
|
1164
|
+
return i ? [...i.membros.values()].map((s) => ({ id: s.id, coordenada: s.coordenada })) : [];
|
|
1165
|
+
}
|
|
1166
|
+
// ---------------------------------------------------------------- sobreposição (seleção, destaque, edição)
|
|
1167
|
+
/**
|
|
1168
|
+
* Itens da sobreposição: feições selecionadas, em edição ou destacadas, sempre em detalhe completo e com o estilo
|
|
1169
|
+
* de seleção. Custo O(selecionadas): selecionar não repinta o canvas base.
|
|
1170
|
+
*/
|
|
1171
|
+
listaSobreposicao(t, a) {
|
|
1172
|
+
var r;
|
|
1173
|
+
const o = this.camadas.get(t);
|
|
1174
|
+
if (!o || !H(a)) return null;
|
|
1175
|
+
this.prepararZoom(o, a.zoom);
|
|
1176
|
+
const i = [], n = /* @__PURE__ */ new Set([...o.dados.selecionadas, ...o.previas.keys(), ...o.destaques]), s = o.agrupador;
|
|
1177
|
+
if (s && o.dados.selecionadas.size > 0) {
|
|
1178
|
+
const c = /* @__PURE__ */ new Set();
|
|
1179
|
+
for (const l of o.dados.selecionadas) {
|
|
1180
|
+
const d = s.chaveDoPonto(l);
|
|
1181
|
+
d !== void 0 && c.add(d);
|
|
1182
|
+
}
|
|
1183
|
+
for (const l of c) {
|
|
1184
|
+
const d = s.celula(l);
|
|
1185
|
+
if (!d || d.membros.size < 2) continue;
|
|
1186
|
+
const h = [...d.membros.keys()].filter((u) => !o.dados.selecionadas.has(u));
|
|
1187
|
+
h.length === 1 && n.add(h[0]);
|
|
1188
|
+
}
|
|
1189
|
+
}
|
|
1190
|
+
for (const c of n) {
|
|
1191
|
+
const l = o.dados.loja.get(c);
|
|
1192
|
+
if (!l || !o.dados.desenhavel(l)) continue;
|
|
1193
|
+
const d = o.previas.get(c), h = d ?? l, u = h.geometria;
|
|
1194
|
+
if (u.tipo === "Text" || dt(u) || u.tipo === "Point" && ((r = h.estilo) != null && r.icone)) continue;
|
|
1195
|
+
const v = d ? null : o.dados.indice.caixaDe(c);
|
|
1196
|
+
if (v && !$(v, a.caixa)) continue;
|
|
1197
|
+
const x = o.dados.selecionadas.has(c) || !!d;
|
|
1198
|
+
if (!x && !o.destaques.has(c) && !(u.tipo === "Point" && (s != null && s.emCluster(c)))) continue;
|
|
1199
|
+
const f = d ? this.construirGeometria(o, h, a.zoom, -1) : this.geometriaProjetada(o, h, a.zoom);
|
|
1200
|
+
if (!f) continue;
|
|
1201
|
+
const m = o.internador.interno(ut(h, o.def.estilo, x)), L = u.tipo === "LineString" ? "linha" : u.tipo === "Circle" ? "circulo" : u.tipo === "Point" ? "ponto" : "poligono";
|
|
1202
|
+
i.push({
|
|
1203
|
+
camadaId: t,
|
|
1204
|
+
id: c,
|
|
1205
|
+
forma: L,
|
|
1206
|
+
geometriaEmPx: f.partes,
|
|
1207
|
+
raioPx: f.raioPx,
|
|
1208
|
+
estilo: m,
|
|
1209
|
+
selecionada: x,
|
|
1210
|
+
feicao: h,
|
|
1211
|
+
...o.destaques.has(c) ? { destaque: !0 } : {}
|
|
1212
|
+
});
|
|
1213
|
+
}
|
|
1214
|
+
return {
|
|
1215
|
+
camadaId: t,
|
|
1216
|
+
zIndex: o.def.zIndex,
|
|
1217
|
+
opacidade: o.def.opacidade,
|
|
1218
|
+
itens: i,
|
|
1219
|
+
estatisticas: { total: o.dados.loja.size, desenhadas: i.length, marcasLOD: 0, clusters: 0, marcadoresDom: 0, avaliacoesLOD: o.avaliacoesLOD }
|
|
1220
|
+
};
|
|
1221
|
+
}
|
|
1222
|
+
/** A seleção da camada toca pontos sob agrupamento ativo? (então o conjunto de clusters muda e o base precisa refazer) */
|
|
1223
|
+
selecaoAfetaAgrupamento(t, a) {
|
|
1224
|
+
var i;
|
|
1225
|
+
const o = this.camadas.get(t);
|
|
1226
|
+
if (!o || !o.agrupador) return !1;
|
|
1227
|
+
for (const n of a) if (((i = o.dados.loja.get(n)) == null ? void 0 : i.geometria.tipo) === "Point") return !0;
|
|
1228
|
+
return !1;
|
|
1229
|
+
}
|
|
1230
|
+
}
|
|
1231
|
+
export {
|
|
1232
|
+
St as $,
|
|
1233
|
+
Kt as A,
|
|
1234
|
+
ca as B,
|
|
1235
|
+
q as C,
|
|
1236
|
+
Ft as D,
|
|
1237
|
+
Fa as E,
|
|
1238
|
+
wa as F,
|
|
1239
|
+
Sa as G,
|
|
1240
|
+
wt as H,
|
|
1241
|
+
_t as I,
|
|
1242
|
+
Et as J,
|
|
1243
|
+
Ot as K,
|
|
1244
|
+
Nt as L,
|
|
1245
|
+
J as M,
|
|
1246
|
+
Rt as N,
|
|
1247
|
+
at as O,
|
|
1248
|
+
Gt as P,
|
|
1249
|
+
k as Q,
|
|
1250
|
+
Aa as R,
|
|
1251
|
+
ua as S,
|
|
1252
|
+
da as T,
|
|
1253
|
+
Wt as U,
|
|
1254
|
+
Yt as V,
|
|
1255
|
+
Lt as W,
|
|
1256
|
+
Jt as X,
|
|
1257
|
+
ia as Y,
|
|
1258
|
+
pt as Z,
|
|
1259
|
+
Oa as _,
|
|
1260
|
+
Ct as a,
|
|
1261
|
+
it as a0,
|
|
1262
|
+
Ea as a1,
|
|
1263
|
+
Qt as a2,
|
|
1264
|
+
U as a3,
|
|
1265
|
+
rt as a4,
|
|
1266
|
+
ma as a5,
|
|
1267
|
+
E as a6,
|
|
1268
|
+
Dt as a7,
|
|
1269
|
+
Y as a8,
|
|
1270
|
+
ft as a9,
|
|
1271
|
+
pa as aa,
|
|
1272
|
+
Vt as ab,
|
|
1273
|
+
gt as ac,
|
|
1274
|
+
mt as ad,
|
|
1275
|
+
$t as ae,
|
|
1276
|
+
z as b,
|
|
1277
|
+
Ia as c,
|
|
1278
|
+
Pa as d,
|
|
1279
|
+
La as e,
|
|
1280
|
+
tt as f,
|
|
1281
|
+
ya as g,
|
|
1282
|
+
vt as h,
|
|
1283
|
+
Zt as i,
|
|
1284
|
+
Ca as j,
|
|
1285
|
+
Na as k,
|
|
1286
|
+
B as l,
|
|
1287
|
+
ba as m,
|
|
1288
|
+
dt as n,
|
|
1289
|
+
sa as o,
|
|
1290
|
+
Ht as p,
|
|
1291
|
+
b as q,
|
|
1292
|
+
Da as r,
|
|
1293
|
+
S as s,
|
|
1294
|
+
oa as t,
|
|
1295
|
+
ea as u,
|
|
1296
|
+
kt as v,
|
|
1297
|
+
Pt as w,
|
|
1298
|
+
xt as x,
|
|
1299
|
+
$ as y,
|
|
1300
|
+
ut as z
|
|
1301
|
+
};
|