@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.
- package/CHANGELOG.md +46 -0
- package/dist/camadas.cjs +87 -87
- package/dist/camadas.js +1864 -1309
- package/dist/canvas.cjs +42 -42
- package/dist/canvas.js +1713 -1609
- package/dist/components/ui-barra-ferramentas/ribbon-atualizacao.d.ts +10 -0
- package/dist/components/ui-barra-ferramentas/ui-ribbon.d.ts +25 -5
- package/dist/components/ui-camadas/camadas-arvore-renderer.d.ts +11 -0
- package/dist/components/ui-camadas/camadas-atualizacao-incremental.d.ts +26 -5
- package/dist/components/ui-camadas/camadas-colecao.d.ts +15 -0
- package/dist/components/ui-camadas/camadas-host.d.ts +12 -0
- package/dist/components/ui-camadas/camadas-janela-dom.d.ts +44 -0
- package/dist/components/ui-camadas/camadas-linha-feicao.d.ts +10 -1
- package/dist/components/ui-camadas/camadas-metricas.d.ts +2 -3
- package/dist/components/ui-camadas/camadas-render.d.ts +19 -2
- package/dist/components/ui-camadas/camadas-selecao-api.d.ts +6 -0
- package/dist/components/ui-camadas/camadas-virtual.d.ts +135 -0
- package/dist/components/ui-camadas/ui-camadas.d.ts +51 -2
- package/dist/components/ui-canvas-cad/cad-hud-coordenadas.d.ts +12 -0
- package/dist/components/ui-canvas-cad/ui-canvas-cad.d.ts +6 -1
- package/dist/custom-elements.json +32278 -30008
- package/dist/feature_caixa-DOchASgS.js +828 -0
- package/dist/feature_caixa-MrJEfMol.cjs +1 -0
- package/dist/{feature_desenho-CC8Mp5Gp.js → feature_desenho-Cq3H27as.js} +2 -2
- package/dist/{feature_desenho-BH-E1Q9Q.cjs → feature_desenho-eq3MIZR9.cjs} +1 -1
- package/dist/feature_metricas-CKQGG2nz.cjs +1 -0
- package/dist/feature_metricas-DGfd21VR.js +130 -0
- package/dist/geometria-px-BlB0OczX.cjs +1 -0
- package/dist/geometria-px-BxTQKrZN.js +577 -0
- package/dist/gerencigeo-canvas/dms.d.ts +7 -0
- package/dist/gerencigeo-canvas/feature_adapters.d.ts +7 -0
- package/dist/gerencigeo-canvas/feature_algoritmos.d.ts +1 -4
- package/dist/gerencigeo-canvas/feature_indice.d.ts +7 -0
- package/dist/gerencigeo-canvas/feature_lod.d.ts +16 -0
- package/dist/gerencigeo-canvas/motor/dados-camada.d.ts +11 -1
- package/dist/gerencigeo-canvas/motor/geometria-px.d.ts +9 -0
- package/dist/gerencigeo-canvas/motor/motor-formas.d.ts +28 -5
- package/dist/gerencigeo-canvas/motor/tipos.d.ts +7 -3
- package/dist/gerencigeo-canvas/qualidade.d.ts +5 -0
- package/dist/gerencigeo-canvas/renderers/canvas_formas_leaflet.d.ts +10 -0
- package/dist/gerencigeo-canvas/renderers/feicoes_canvas_renderer.d.ts +10 -0
- package/dist/gerencigeo-canvas/renderers/renderizador_formas.d.ts +7 -0
- package/dist/gerencigeo-canvas/utils.d.ts +1 -3
- package/dist/index.cjs +4 -4
- package/dist/index.js +84 -82
- package/dist/mapa.cjs +1 -1
- package/dist/mapa.js +1 -1
- package/dist/motor.cjs +1 -1
- package/dist/motor.js +620 -499
- package/dist/prancha-nucleo.cjs +3 -3
- package/dist/prancha-nucleo.js +283 -282
- package/dist/prancha.cjs +1 -1
- package/dist/prancha.js +3 -3
- package/dist/tools.cjs +5 -5
- package/dist/tools.js +438 -369
- package/dist/utils-B2HuBLwz.js +108 -0
- package/dist/utils-DpPysTeU.cjs +1 -0
- package/package.json +1 -1
- package/dist/feature_caixa-4M4MkFH7.cjs +0 -1
- package/dist/feature_caixa-BVc5LenS.js +0 -824
- package/dist/geometria-px-Cyi_oPD6.cjs +0 -1
- package/dist/geometria-px-DHMPUsxC.js +0 -639
- package/dist/utils-ClVgqVyJ.cjs +0 -1
- package/dist/utils-DrHoxxmf.js +0 -83
package/dist/motor.js
CHANGED
|
@@ -1,37 +1,39 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var g = (
|
|
4
|
-
import { I as
|
|
5
|
-
import { C as
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
var da = Object.defineProperty;
|
|
2
|
+
var la = (d, a, i) => a in d ? da(d, a, { enumerable: !0, configurable: !0, writable: !0, value: i }) : d[a] = i;
|
|
3
|
+
var g = (d, a, i) => la(d, typeof a != "symbol" ? a + "" : a, i);
|
|
4
|
+
import { I as ua, s as S, i as j, y as ma, K as C, l as K, Z as fa, N as W, O as Y, P as ha, r as ga, d as pa, n as V, k as aa, h as G, M as va } from "./geometria-px-BxTQKrZN.js";
|
|
5
|
+
import { C as Xa, R as ka, T as Ua, z as Ha, A as Ja, B as Qa, D as Ka, E as Wa, F as Ya, G as ai, H as ii, u as ei, o as oi, J as ti, x as si, L as ni, Q as ri, j as ci, S as di, U as li, w as ui, V as mi, v as fi } from "./geometria-px-BxTQKrZN.js";
|
|
6
|
+
import { p as xa, t as Pa } from "./feature_metricas-DGfd21VR.js";
|
|
7
|
+
import { b as gi, f as pi } from "./feature_metricas-DGfd21VR.js";
|
|
8
|
+
const b = 55, La = 17, Ma = 8;
|
|
9
|
+
function ta(d, a) {
|
|
10
|
+
return a < La && d > Ma;
|
|
9
11
|
}
|
|
10
|
-
function
|
|
11
|
-
let a = 0,
|
|
12
|
-
for (const
|
|
13
|
-
a +=
|
|
14
|
-
return [a /
|
|
12
|
+
function Da(d) {
|
|
13
|
+
let a = 0, i = 0;
|
|
14
|
+
for (const e of d)
|
|
15
|
+
a += e.coordenada[0], i += e.coordenada[1];
|
|
16
|
+
return [a / d.length, i / d.length];
|
|
15
17
|
}
|
|
16
|
-
function
|
|
17
|
-
if (!
|
|
18
|
-
const
|
|
19
|
-
for (const s of
|
|
20
|
-
const { x:
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
const
|
|
24
|
-
for (const [s,
|
|
25
|
-
|
|
26
|
-
return { clusters:
|
|
18
|
+
function Va(d, a, i) {
|
|
19
|
+
if (!ta(d.length, a)) return { clusters: [], isolados: d };
|
|
20
|
+
const e = /* @__PURE__ */ new Map();
|
|
21
|
+
for (const s of d) {
|
|
22
|
+
const { x: n, y: l } = i(s.coordenada), r = `${a}:${Math.floor(n / b)}:${Math.floor(l / b)}`, c = e.get(r);
|
|
23
|
+
c ? c.push(s) : e.set(r, [s]);
|
|
24
|
+
}
|
|
25
|
+
const o = [], t = [];
|
|
26
|
+
for (const [s, n] of e)
|
|
27
|
+
n.length === 1 ? t.push(n[0]) : o.push({ chave: s, coordenada: Da(n), membros: n });
|
|
28
|
+
return { clusters: o, isolados: t };
|
|
27
29
|
}
|
|
28
|
-
class
|
|
29
|
-
constructor(a,
|
|
30
|
+
class Aa {
|
|
31
|
+
constructor(a, i) {
|
|
30
32
|
g(this, "celulas", /* @__PURE__ */ new Map());
|
|
31
33
|
g(this, "celulaDe", /* @__PURE__ */ new Map());
|
|
32
34
|
/** Chaves das células com 2 ou mais pontos (as únicas que viram cluster). */
|
|
33
35
|
g(this, "multiplas", /* @__PURE__ */ new Set());
|
|
34
|
-
this.zoom = a, this.projetar =
|
|
36
|
+
this.zoom = a, this.projetar = i;
|
|
35
37
|
}
|
|
36
38
|
/** Pontos agrupáveis na grade. */
|
|
37
39
|
get total() {
|
|
@@ -47,80 +49,86 @@ class la {
|
|
|
47
49
|
/** Só as células que viram cluster (2+ pontos). */
|
|
48
50
|
*celulasAgrupadas() {
|
|
49
51
|
for (const a of this.multiplas) {
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
+
const i = this.celulas.get(a);
|
|
53
|
+
i && (yield [a, i]);
|
|
52
54
|
}
|
|
53
55
|
}
|
|
54
56
|
/** Está numa célula com 2 ou mais pontos (ou seja, dentro de um cluster)? */
|
|
55
57
|
emCluster(a) {
|
|
56
|
-
var
|
|
57
|
-
const
|
|
58
|
-
return
|
|
58
|
+
var e;
|
|
59
|
+
const i = this.celulaDe.get(a);
|
|
60
|
+
return i !== void 0 && (((e = this.celulas.get(i)) == null ? void 0 : e.membros.size) ?? 0) >= 2;
|
|
59
61
|
}
|
|
60
62
|
/** Insere (ou move) o ponto; devolve a chave da célula nova. */
|
|
61
63
|
inserir(a) {
|
|
62
64
|
this.remover(a.id);
|
|
63
|
-
const { x:
|
|
64
|
-
let t = this.celulas.get(
|
|
65
|
-
return t || (t = { membros: /* @__PURE__ */ new Map(), somaLat: 0, somaLon: 0 }, this.celulas.set(
|
|
65
|
+
const { x: i, y: e } = this.projetar(a.coordenada), o = `${this.zoom}:${Math.floor(i / b)}:${Math.floor(e / b)}`;
|
|
66
|
+
let t = this.celulas.get(o);
|
|
67
|
+
return t || (t = { membros: /* @__PURE__ */ new Map(), somaLat: 0, somaLon: 0 }, this.celulas.set(o, t)), t.membros.set(a.id, a), t.somaLat += a.coordenada[0], t.somaLon += a.coordenada[1], t.membros.size >= 2 && this.multiplas.add(o), this.celulaDe.set(a.id, o), o;
|
|
66
68
|
}
|
|
67
69
|
/** Tira o ponto da grade; devolve a chave da célula de onde saiu. */
|
|
68
70
|
remover(a) {
|
|
69
|
-
const
|
|
70
|
-
if (
|
|
71
|
+
const i = this.celulaDe.get(a);
|
|
72
|
+
if (i === void 0) return;
|
|
71
73
|
this.celulaDe.delete(a);
|
|
72
|
-
const
|
|
73
|
-
return
|
|
74
|
+
const e = this.celulas.get(i), o = e == null ? void 0 : e.membros.get(a);
|
|
75
|
+
return e && o && (e.membros.delete(a), e.somaLat -= o.coordenada[0], e.somaLon -= o.coordenada[1], e.membros.size < 2 && this.multiplas.delete(i), e.membros.size === 0 && this.celulas.delete(i)), i;
|
|
74
76
|
}
|
|
75
77
|
}
|
|
76
|
-
const
|
|
77
|
-
function
|
|
78
|
-
const
|
|
78
|
+
const $ = 3, sa = 0.75, ia = 85.0511287798, Oa = 256;
|
|
79
|
+
function q(d, a, i) {
|
|
80
|
+
const e = Oa * 2 ** i, o = Math.max(-ia, Math.min(ia, d)), t = Math.sin(o * Math.PI / 180);
|
|
79
81
|
return {
|
|
80
|
-
x: (a + 180) / 360 *
|
|
81
|
-
y: (0.5 - Math.log((1 + t) / (1 - t)) / (4 * Math.PI)) *
|
|
82
|
+
x: (a + 180) / 360 * e,
|
|
83
|
+
y: (0.5 - Math.log((1 + t) / (1 - t)) / (4 * Math.PI)) * e
|
|
82
84
|
};
|
|
83
85
|
}
|
|
84
|
-
const
|
|
85
|
-
function
|
|
86
|
-
if (!Number.isFinite(a) || a < 0 || !
|
|
87
|
-
const
|
|
88
|
-
return Math.hypot(
|
|
86
|
+
const Ca = (d) => Number.isFinite(d.minLat) && Number.isFinite(d.maxLat) && Number.isFinite(d.minLon) && Number.isFinite(d.maxLon) && d.minLat <= d.maxLat && d.minLon <= d.maxLon;
|
|
87
|
+
function Z(d, a) {
|
|
88
|
+
if (!Number.isFinite(a) || a < 0 || !Ca(d)) return NaN;
|
|
89
|
+
const i = q(d.minLat, d.minLon, a), e = q(d.maxLat, d.maxLon, a);
|
|
90
|
+
return Math.hypot(e.x - i.x, e.y - i.y);
|
|
91
|
+
}
|
|
92
|
+
function Ba(d, a, i = $) {
|
|
93
|
+
if (!d) return !1;
|
|
94
|
+
const e = Z(d, a);
|
|
95
|
+
return Number.isFinite(e) && e < i;
|
|
89
96
|
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
97
|
+
const na = 6, za = 16;
|
|
98
|
+
function Ra(d, a, i = $, e = na) {
|
|
99
|
+
if (!d) return "forma";
|
|
100
|
+
const o = Z(d, a);
|
|
101
|
+
return Number.isFinite(o) ? o < i ? "marca" : a < za && o < e ? "miuda" : "forma" : "forma";
|
|
94
102
|
}
|
|
95
|
-
function
|
|
96
|
-
return Number.isFinite(
|
|
103
|
+
function Sa(d) {
|
|
104
|
+
return Number.isFinite(d) && d < 1.5 ? 1 : 2;
|
|
97
105
|
}
|
|
98
|
-
function
|
|
106
|
+
function ja(d) {
|
|
99
107
|
const a = /* @__PURE__ */ new Map();
|
|
100
|
-
for (const
|
|
101
|
-
const
|
|
102
|
-
|
|
108
|
+
for (const i of d) {
|
|
109
|
+
const e = a.get(i.cor);
|
|
110
|
+
e ? e.push(i) : a.set(i.cor, [i]);
|
|
103
111
|
}
|
|
104
112
|
return a;
|
|
105
113
|
}
|
|
106
|
-
const
|
|
107
|
-
function
|
|
108
|
-
let
|
|
109
|
-
const
|
|
110
|
-
for (const [
|
|
111
|
-
let
|
|
112
|
-
for (const m of
|
|
113
|
-
const
|
|
114
|
-
L >= -2 &&
|
|
114
|
+
const Ea = "#38bdf8";
|
|
115
|
+
function Ga(d, a, i, e, o, t, s) {
|
|
116
|
+
let n = 0;
|
|
117
|
+
const l = ja(a);
|
|
118
|
+
for (const [r, c] of l) {
|
|
119
|
+
let u = !1;
|
|
120
|
+
for (const m of c) {
|
|
121
|
+
const p = q(m.lat, m.lon, i), L = p.x - e, v = p.y - o;
|
|
122
|
+
L >= -2 && v >= -2 && L <= t + 2 && v <= s + 2 && (u || (d.fillStyle = r || Ea, d.globalAlpha = sa, u = !0), d.fillRect(Math.round(L - m.lado / 2), Math.round(v - m.lado / 2), m.lado, m.lado), n++);
|
|
115
123
|
}
|
|
116
124
|
}
|
|
117
|
-
return
|
|
125
|
+
return n;
|
|
118
126
|
}
|
|
119
|
-
const
|
|
120
|
-
class
|
|
127
|
+
const ea = 0.3, oa = (d) => !!d && typeof d.id == "string" && !!d.geometria && typeof d.geometria.tipo == "string";
|
|
128
|
+
class wa {
|
|
121
129
|
constructor() {
|
|
122
130
|
g(this, "loja", /* @__PURE__ */ new Map());
|
|
123
|
-
g(this, "indice", new
|
|
131
|
+
g(this, "indice", new ua());
|
|
124
132
|
/** Muda a cada alteração dos dados (invalida cache de geometria por feição). */
|
|
125
133
|
g(this, "revisao", 0);
|
|
126
134
|
/** Muda quando o agrupamento e a contagem de pontos precisam ser refeitos do zero. */
|
|
@@ -149,113 +157,132 @@ class xa {
|
|
|
149
157
|
visivelPorVersao(a) {
|
|
150
158
|
return !this.regra || this.regra(a, this.oficiais);
|
|
151
159
|
}
|
|
152
|
-
/**
|
|
160
|
+
/**
|
|
161
|
+
* Troca total: diferencia contra a loja, mantém o índice e a contabilidade de versões. Com poucas mudanças (até
|
|
162
|
+
* `FRACAO_REMONTAR_INDICE` da camada) vira um delta: só as feições mudadas e removidas são tocadas no índice, na loja
|
|
163
|
+
* e na contagem de versões, e o resultado sai `incremental` com as feições antigas (o motor mantém agrupamento e
|
|
164
|
+
* contagem de pontos sem refazer a camada). Antes, trocar 1 feição numa lista de 10 mil refazia a loja e recontava
|
|
165
|
+
* as versões de todas (~20 ms por camada).
|
|
166
|
+
*/
|
|
153
167
|
sincronizar(a) {
|
|
154
|
-
const
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
168
|
+
const i = a.filter((r) => oa(r) && !r.excluida), e = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Set();
|
|
169
|
+
let t = 0;
|
|
170
|
+
for (const r of i)
|
|
171
|
+
o.has(r.id) || (o.add(r.id), this.loja.has(r.id) || t++), this.loja.get(r.id) !== r && e.add(r.id);
|
|
172
|
+
const n = this.loja.size - (o.size - t) > 0 ? [...this.loja.keys()].filter((r) => !o.has(r)) : [];
|
|
173
|
+
if (this.loja.size > 0 && this.listaSincronizada !== null && (e.size > 0 || n.length > 0) && e.size + n.length <= i.length * ea) {
|
|
174
|
+
const r = /* @__PURE__ */ new Map();
|
|
175
|
+
for (const m of e) r.set(m, this.loja.get(m));
|
|
176
|
+
for (const m of n) r.set(m, this.loja.get(m));
|
|
177
|
+
const c = { base: this.listaSincronizada, mudadas: i.filter((m) => e.has(m.id)), removidas: n }, u = this.aplicarDelta(a, c);
|
|
178
|
+
if (u) return { ...u, incremental: !0, antigas: r };
|
|
179
|
+
}
|
|
180
|
+
if (e.size > 0 || n.length > 0) {
|
|
181
|
+
if (this.revisao++, this.revisaoBase++, this.loja.size === 0 || e.size + n.length > i.length * ea)
|
|
182
|
+
this.indice.construir(i);
|
|
161
183
|
else {
|
|
162
|
-
for (const
|
|
163
|
-
for (const
|
|
184
|
+
for (const r of i) e.has(r.id) && this.indice.atualizar(r);
|
|
185
|
+
for (const r of n) this.indice.remover(r);
|
|
164
186
|
}
|
|
165
187
|
this.loja.clear();
|
|
166
|
-
for (const
|
|
167
|
-
for (const
|
|
168
|
-
for (const
|
|
188
|
+
for (const r of i) this.loja.set(r.id, r);
|
|
189
|
+
for (const r of n) this.revisaoDe.delete(r);
|
|
190
|
+
for (const r of e) this.revisaoDe.set(r, ++this.contador);
|
|
169
191
|
this.recontarOficiais();
|
|
170
192
|
}
|
|
171
193
|
this.listaSincronizada = a;
|
|
172
|
-
for (const
|
|
173
|
-
return { mudadas: [...
|
|
194
|
+
for (const r of [...this.selecionadas]) o.has(r) || this.selecionadas.delete(r);
|
|
195
|
+
return { mudadas: [...e], removidas: n, oficiaisMudou: !1 };
|
|
174
196
|
}
|
|
175
197
|
recontarOficiais() {
|
|
176
198
|
this.contOficiais = /* @__PURE__ */ new Map(), this.contPrevias = /* @__PURE__ */ new Map(), this.nPrevias = 0;
|
|
177
199
|
for (const a of this.loja.values()) {
|
|
178
|
-
if (
|
|
200
|
+
if (S(a) !== "oficial") {
|
|
179
201
|
this.nPrevias++;
|
|
180
|
-
const
|
|
181
|
-
this.contPrevias.set(
|
|
202
|
+
const e = j(a);
|
|
203
|
+
this.contPrevias.set(e, (this.contPrevias.get(e) ?? 0) + 1);
|
|
182
204
|
continue;
|
|
183
205
|
}
|
|
184
|
-
const
|
|
185
|
-
this.contOficiais.set(
|
|
206
|
+
const i = j(a);
|
|
207
|
+
this.contOficiais.set(i, (this.contOficiais.get(i) ?? 0) + 1);
|
|
186
208
|
}
|
|
187
209
|
this.oficiais = new Set(this.contOficiais.keys());
|
|
188
210
|
}
|
|
189
211
|
/** Aplica só a diferença. Devolve `null` se o delta não parte da lista sincronizada (então use `sincronizar`). */
|
|
190
|
-
aplicarDelta(a,
|
|
191
|
-
if (!
|
|
192
|
-
const
|
|
193
|
-
if (!
|
|
194
|
-
const m =
|
|
195
|
-
|
|
196
|
-
const
|
|
197
|
-
|
|
198
|
-
}, t = (
|
|
199
|
-
const m =
|
|
200
|
-
|
|
201
|
-
}, s = [],
|
|
202
|
-
const
|
|
203
|
-
|
|
212
|
+
aplicarDelta(a, i) {
|
|
213
|
+
if (!i || i.base !== this.listaSincronizada) return null;
|
|
214
|
+
const e = /* @__PURE__ */ new Map(), o = (c, u) => {
|
|
215
|
+
if (!c || c.excluida || S(c) !== "oficial") return;
|
|
216
|
+
const m = j(c);
|
|
217
|
+
e.has(m) || e.set(m, this.oficiais.has(m));
|
|
218
|
+
const p = (this.contOficiais.get(m) ?? 0) + u;
|
|
219
|
+
p <= 0 ? (this.contOficiais.delete(m), this.oficiais.delete(m)) : (this.contOficiais.set(m, p), this.oficiais.add(m));
|
|
220
|
+
}, t = (c, u) => {
|
|
221
|
+
const m = j(c), p = (this.contPrevias.get(m) ?? 0) + u;
|
|
222
|
+
p <= 0 ? this.contPrevias.delete(m) : this.contPrevias.set(m, p);
|
|
223
|
+
}, s = [], n = [], l = (c) => {
|
|
224
|
+
const u = this.loja.get(c);
|
|
225
|
+
u && (S(u) === "previa" && (this.nPrevias--, t(u, -1)), o(u, -1), this.loja.delete(c), this.indice.remover(c), this.selecionadas.delete(c), this.revisaoDe.delete(c), n.push(c));
|
|
204
226
|
};
|
|
205
|
-
for (const
|
|
206
|
-
for (const
|
|
207
|
-
if (
|
|
208
|
-
if (
|
|
209
|
-
|
|
227
|
+
for (const c of i.removidas ?? []) l(c);
|
|
228
|
+
for (const c of i.mudadas ?? []) {
|
|
229
|
+
if (!oa(c)) continue;
|
|
230
|
+
if (c.excluida) {
|
|
231
|
+
l(c.id);
|
|
210
232
|
continue;
|
|
211
233
|
}
|
|
212
|
-
const
|
|
213
|
-
|
|
234
|
+
const u = this.loja.get(c.id);
|
|
235
|
+
S(c) === "previa" && (this.nPrevias++, t(c, 1)), u && (S(u) === "previa" && (this.nPrevias--, t(u, -1)), o(u, -1)), this.loja.set(c.id, c), this.indice.atualizar(c), o(c, 1), this.revisaoDe.set(c.id, ++this.contador), s.push(c.id);
|
|
214
236
|
}
|
|
215
|
-
let
|
|
237
|
+
let r = !1;
|
|
216
238
|
if (this.nPrevias > 0)
|
|
217
|
-
for (const [
|
|
218
|
-
return this.listaSincronizada = a, this.revisao++,
|
|
239
|
+
for (const [c, u] of e) u !== this.oficiais.has(c) && (r = !0);
|
|
240
|
+
return this.listaSincronizada = a, this.revisao++, r && this.revisaoBase++, { mudadas: s, removidas: n, oficiaisMudou: r };
|
|
219
241
|
}
|
|
220
242
|
}
|
|
221
|
-
const
|
|
222
|
-
cor:
|
|
243
|
+
const Ia = 1.2, w = 1e-9, ba = 6, ra = 3, ya = 0.25, Fa = 3 * ra, I = {
|
|
244
|
+
cor: G,
|
|
223
245
|
traco: !1,
|
|
224
246
|
peso: 0,
|
|
225
247
|
dash: void 0,
|
|
226
248
|
preencher: !1,
|
|
227
|
-
corPreenchimento:
|
|
249
|
+
corPreenchimento: G,
|
|
228
250
|
opacidadePreenchimento: 0
|
|
229
|
-
},
|
|
230
|
-
class
|
|
251
|
+
}, B = (d) => !!d && Number.isFinite(d.zoom) && d.zoom >= 0 && !!d.caixa && Number.isFinite(d.caixa.minLat) && Number.isFinite(d.caixa.maxLat) && Number.isFinite(d.caixa.minLon) && Number.isFinite(d.caixa.maxLon);
|
|
252
|
+
class qa {
|
|
231
253
|
constructor() {
|
|
232
254
|
g(this, "camadas", /* @__PURE__ */ new Map());
|
|
233
255
|
g(this, "regra", null);
|
|
234
|
-
g(this, "limiteMarcaPx",
|
|
235
|
-
g(this, "
|
|
256
|
+
g(this, "limiteMarcaPx", $);
|
|
257
|
+
g(this, "limiteMiudaPx", na);
|
|
258
|
+
g(this, "toleranciaPx", Ia);
|
|
236
259
|
}
|
|
237
260
|
/**
|
|
238
|
-
* Ajusta o LOD (diagonal em px abaixo da qual a feição vira marca
|
|
239
|
-
* `qualidade.ts`). Valor inválido (NaN, <= 0) mantém o atual. Ao mudar de verdade, os
|
|
261
|
+
* Ajusta o LOD (diagonal em px abaixo da qual a feição vira marca, e abaixo da qual é miúda) e a tolerância da
|
|
262
|
+
* simplificação em px (perfis de `qualidade.ts`). Valor inválido (NaN, <= 0) mantém o atual. Ao mudar de verdade, os
|
|
263
|
+
* caches por zoom são descartados.
|
|
240
264
|
*/
|
|
241
265
|
definirQualidade(a) {
|
|
242
|
-
const
|
|
243
|
-
if (!(e === this.limiteMarcaPx && o === this.toleranciaPx)) {
|
|
244
|
-
this.limiteMarcaPx = e, this.toleranciaPx =
|
|
245
|
-
for (const
|
|
246
|
-
|
|
266
|
+
const i = (s, n) => Number.isFinite(s) && s > 0 ? s : n, e = i(a == null ? void 0 : a.limiteMarcaPx, this.limiteMarcaPx), o = i(a == null ? void 0 : a.limiteMiudaPx, this.limiteMiudaPx), t = i(a == null ? void 0 : a.toleranciaPx, this.toleranciaPx);
|
|
267
|
+
if (!(e === this.limiteMarcaPx && o === this.limiteMiudaPx && t === this.toleranciaPx)) {
|
|
268
|
+
this.limiteMarcaPx = e, this.limiteMiudaPx = o, this.toleranciaPx = t;
|
|
269
|
+
for (const s of this.camadas.values())
|
|
270
|
+
s.zooms.clear(), s.geom = /* @__PURE__ */ new Map(), s.lod = /* @__PURE__ */ new Map(), s.zoomCache = -1, s.dados.revisao++;
|
|
247
271
|
}
|
|
248
272
|
}
|
|
249
273
|
// ---------------------------------------------------------------- camadas
|
|
250
274
|
/** Cria a camada ou atualiza a definição (estilo, zIndex, opacidade, visibilidade). */
|
|
251
275
|
definirCamada(a) {
|
|
252
276
|
if (!a || typeof a.id != "string") return;
|
|
253
|
-
let
|
|
254
|
-
if (!
|
|
255
|
-
|
|
277
|
+
let i = this.camadas.get(a.id);
|
|
278
|
+
if (!i) {
|
|
279
|
+
i = {
|
|
256
280
|
def: a,
|
|
257
|
-
dados: new
|
|
281
|
+
dados: new wa(),
|
|
258
282
|
zoomCache: -1,
|
|
283
|
+
zooms: /* @__PURE__ */ new Map(),
|
|
284
|
+
candidatasDom: [],
|
|
285
|
+
candidatasRev: -1,
|
|
259
286
|
geom: /* @__PURE__ */ new Map(),
|
|
260
287
|
estilos: /* @__PURE__ */ new Map(),
|
|
261
288
|
lod: /* @__PURE__ */ new Map(),
|
|
@@ -267,13 +294,15 @@ class Ca {
|
|
|
267
294
|
previas: /* @__PURE__ */ new Map(),
|
|
268
295
|
destaques: /* @__PURE__ */ new Set(),
|
|
269
296
|
revEstilo: 0,
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
297
|
+
revLista: 0,
|
|
298
|
+
listasGuardadas: /* @__PURE__ */ new Map(),
|
|
299
|
+
internador: new ma(),
|
|
300
|
+
ultima: { total: 0, desenhadas: 0, marcasLOD: 0, miudas: 0, clusters: 0, marcadoresDom: 0, avaliacoesLOD: 0 }
|
|
301
|
+
}, i.dados.regra = this.regra, this.camadas.set(a.id, i);
|
|
273
302
|
return;
|
|
274
303
|
}
|
|
275
|
-
const
|
|
276
|
-
|
|
304
|
+
const e = JSON.stringify(i.def.estilo) !== JSON.stringify(a.estilo);
|
|
305
|
+
i.def = a, i.revLista++, e && (i.revEstilo++, i.estilos.clear(), i.internador.limpar(), i.zooms.clear(), i.geom = /* @__PURE__ */ new Map(), i.lod = /* @__PURE__ */ new Map(), i.zoomCache = -1);
|
|
277
306
|
}
|
|
278
307
|
removerCamada(a) {
|
|
279
308
|
this.camadas.delete(a);
|
|
@@ -283,131 +312,147 @@ class Ca {
|
|
|
283
312
|
}
|
|
284
313
|
definirRegra(a) {
|
|
285
314
|
this.regra = a;
|
|
286
|
-
for (const
|
|
315
|
+
for (const i of this.camadas.values())
|
|
316
|
+
i.dados.regra = a, i.revLista++;
|
|
287
317
|
}
|
|
288
318
|
/** A regra de versões mudou (prévias ligadas/desligadas): o conjunto desenhado e o agrupamento precisam ser refeitos. */
|
|
289
319
|
reavaliarVersoes(a) {
|
|
290
|
-
const
|
|
291
|
-
|
|
320
|
+
const i = this.camadas.get(a);
|
|
321
|
+
i && (i.dados.revisao++, i.dados.revisaoBase++);
|
|
292
322
|
}
|
|
293
323
|
// ---------------------------------------------------------------- dados
|
|
294
324
|
/** Troca total dos dados da camada (diferencia contra o que já existe). */
|
|
295
|
-
definirFeicoes(a,
|
|
296
|
-
const
|
|
297
|
-
if (!
|
|
298
|
-
const
|
|
299
|
-
|
|
325
|
+
definirFeicoes(a, i) {
|
|
326
|
+
const e = this.camadas.get(a);
|
|
327
|
+
if (!e) return;
|
|
328
|
+
const o = Array.isArray(i) ? i : [], t = e.dados.sincronizar(o);
|
|
329
|
+
if (t.incremental && t.antigas) {
|
|
330
|
+
let s = e.nPontos;
|
|
331
|
+
for (const [n, l] of t.antigas)
|
|
332
|
+
s += (this.pontoVisivel(e, e.dados.loja.get(n)) ? 1 : 0) - (this.pontoVisivel(e, l) ? 1 : 0);
|
|
333
|
+
e.nPontos = Math.max(0, s), this.aposMudanca(e, t.mudadas, t.removidas, t.oficiaisMudou), t.oficiaisMudou || this.manterAgrupador(e, t.mudadas, t.removidas);
|
|
334
|
+
return;
|
|
335
|
+
}
|
|
336
|
+
this.aposMudanca(e, t.mudadas, t.removidas, !0);
|
|
300
337
|
}
|
|
301
338
|
/**
|
|
302
339
|
* Mudança incremental: só vale se `delta.base` for a lista sincronizada por último; senão a camada é refeita
|
|
303
340
|
* por inteiro a partir de `lista`.
|
|
304
341
|
*/
|
|
305
|
-
aplicarDelta(a,
|
|
306
|
-
const
|
|
307
|
-
if (!
|
|
308
|
-
const t = Array.isArray(
|
|
309
|
-
if (
|
|
310
|
-
for (const
|
|
311
|
-
for (const
|
|
342
|
+
aplicarDelta(a, i, e) {
|
|
343
|
+
const o = this.camadas.get(a);
|
|
344
|
+
if (!o) return;
|
|
345
|
+
const t = Array.isArray(i) ? i : [], s = /* @__PURE__ */ new Map();
|
|
346
|
+
if (e) {
|
|
347
|
+
for (const r of e.removidas ?? []) s.set(r, this.pontoVisivel(o, o.dados.loja.get(r)));
|
|
348
|
+
for (const r of e.mudadas ?? []) r && typeof r.id == "string" && s.set(r.id, this.pontoVisivel(o, o.dados.loja.get(r.id)));
|
|
312
349
|
}
|
|
313
|
-
const
|
|
314
|
-
if (!
|
|
350
|
+
const n = o.dados.aplicarDelta(t, e);
|
|
351
|
+
if (!n) {
|
|
315
352
|
this.definirFeicoes(a, t);
|
|
316
353
|
return;
|
|
317
354
|
}
|
|
318
|
-
let
|
|
319
|
-
for (const [
|
|
320
|
-
const
|
|
321
|
-
|
|
355
|
+
let l = o.nPontos;
|
|
356
|
+
for (const [r, c] of s) {
|
|
357
|
+
const u = this.pontoVisivel(o, o.dados.loja.get(r));
|
|
358
|
+
l += (u ? 1 : 0) - (c ? 1 : 0);
|
|
322
359
|
}
|
|
323
|
-
|
|
324
|
-
}
|
|
325
|
-
pontoVisivel(a, e) {
|
|
326
|
-
var o;
|
|
327
|
-
return !!e && ((o = e.geometria) == null ? void 0 : o.tipo) === "Point" && a.dados.desenhavel(e);
|
|
360
|
+
o.nPontos = Math.max(0, l), this.aposMudanca(o, n.mudadas, n.removidas, n.oficiaisMudou), n.oficiaisMudou || this.manterAgrupador(o, n.mudadas, n.removidas);
|
|
328
361
|
}
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
362
|
+
pontoVisivel(a, i) {
|
|
363
|
+
var e;
|
|
364
|
+
return !!i && ((e = i.geometria) == null ? void 0 : e.tipo) === "Point" && a.dados.desenhavel(i);
|
|
365
|
+
}
|
|
366
|
+
aposMudanca(a, i, e, o) {
|
|
367
|
+
const t = [...a.zooms.values()];
|
|
368
|
+
for (const s of i) {
|
|
369
|
+
for (const n of t)
|
|
370
|
+
n.lod.delete(s), n.geom.delete(s);
|
|
371
|
+
a.estilos.delete(s), a.previas.delete(s);
|
|
372
|
+
}
|
|
373
|
+
for (const s of e) {
|
|
374
|
+
for (const n of t)
|
|
375
|
+
n.lod.delete(s), n.geom.delete(s);
|
|
376
|
+
a.estilos.delete(s), a.previas.delete(s), a.destaques.delete(s);
|
|
377
|
+
}
|
|
378
|
+
o && (a.agrupador = null);
|
|
335
379
|
}
|
|
336
380
|
/** O agrupador do zoom atual acompanha os pontos que mudaram (células afetadas, sem reagrupar a camada). */
|
|
337
|
-
manterAgrupador(a,
|
|
338
|
-
const
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
for (const t of e)
|
|
381
|
+
manterAgrupador(a, i, e) {
|
|
382
|
+
const o = a.agrupador;
|
|
383
|
+
for (const t of a.zooms.values()) t.ag !== o && (t.ag = null);
|
|
384
|
+
if (o) {
|
|
385
|
+
for (const t of e) o.remover(t);
|
|
386
|
+
for (const t of i) {
|
|
342
387
|
const s = a.dados.loja.get(t);
|
|
343
|
-
s && s.geometria.tipo === "Point" && a.dados.desenhavel(s) ?
|
|
388
|
+
s && s.geometria.tipo === "Point" && a.dados.desenhavel(s) ? o.inserir({ id: t, coordenada: s.geometria.coordenada }) : o.remover(t);
|
|
344
389
|
}
|
|
345
390
|
}
|
|
346
391
|
}
|
|
347
392
|
// ---------------------------------------------------------------- seleção e edição
|
|
348
393
|
/** Define a seleção da camada. Devolve quem entrou e quem saiu (só o que mudou). */
|
|
349
|
-
selecionar(a,
|
|
350
|
-
const
|
|
351
|
-
if (!
|
|
352
|
-
const
|
|
353
|
-
for (const
|
|
394
|
+
selecionar(a, i) {
|
|
395
|
+
const e = this.camadas.get(a);
|
|
396
|
+
if (!e) return { entrou: [], saiu: [] };
|
|
397
|
+
const o = /* @__PURE__ */ new Set();
|
|
398
|
+
for (const n of i) e.dados.loja.has(n) && o.add(n);
|
|
354
399
|
const t = [], s = [];
|
|
355
|
-
for (const
|
|
356
|
-
for (const
|
|
357
|
-
|
|
358
|
-
for (const
|
|
359
|
-
return { entrou: t, saiu: s };
|
|
400
|
+
for (const n of o) e.dados.selecionadas.has(n) || t.push(n);
|
|
401
|
+
for (const n of e.dados.selecionadas) o.has(n) || s.push(n);
|
|
402
|
+
e.dados.selecionadas.clear();
|
|
403
|
+
for (const n of o) e.dados.selecionadas.add(n);
|
|
404
|
+
return (t.length > 0 || s.length > 0) && e.revLista++, { entrou: t, saiu: s };
|
|
360
405
|
}
|
|
361
406
|
selecionadas(a) {
|
|
362
|
-
var
|
|
363
|
-
return ((
|
|
407
|
+
var i;
|
|
408
|
+
return ((i = this.camadas.get(a)) == null ? void 0 : i.dados.selecionadas) ?? /* @__PURE__ */ new Set();
|
|
364
409
|
}
|
|
365
410
|
/** Geometria provisória (arrasto de vértice): o canvas base deixa de desenhar a feição e a sobreposição a mostra. */
|
|
366
|
-
previsualizar(a,
|
|
367
|
-
const
|
|
368
|
-
!
|
|
411
|
+
previsualizar(a, i) {
|
|
412
|
+
const e = this.camadas.get(a);
|
|
413
|
+
!e || !i || typeof i.id != "string" || !e.dados.loja.has(i.id) || (e.previas.set(i.id, i), e.revLista++);
|
|
369
414
|
}
|
|
370
|
-
temPrevia(a,
|
|
371
|
-
var
|
|
372
|
-
return ((
|
|
415
|
+
temPrevia(a, i) {
|
|
416
|
+
var e;
|
|
417
|
+
return ((e = this.camadas.get(a)) == null ? void 0 : e.previas.has(i)) ?? !1;
|
|
373
418
|
}
|
|
374
419
|
/** Realce temporário (hover): as feições entram na sobreposição com `destaque: true`. */
|
|
375
|
-
destacar(a,
|
|
376
|
-
const
|
|
377
|
-
|
|
420
|
+
destacar(a, i) {
|
|
421
|
+
const e = this.camadas.get(a);
|
|
422
|
+
e && (e.destaques = new Set(i), e.revLista++);
|
|
378
423
|
}
|
|
379
424
|
// ---------------------------------------------------------------- consultas (geometria original)
|
|
380
|
-
feicao(a,
|
|
381
|
-
var
|
|
382
|
-
return (
|
|
425
|
+
feicao(a, i) {
|
|
426
|
+
var e;
|
|
427
|
+
return (e = this.camadas.get(a)) == null ? void 0 : e.dados.loja.get(i);
|
|
383
428
|
}
|
|
384
|
-
caixaDe(a,
|
|
385
|
-
var
|
|
386
|
-
return (
|
|
429
|
+
caixaDe(a, i) {
|
|
430
|
+
var e;
|
|
431
|
+
return (e = this.camadas.get(a)) == null ? void 0 : e.dados.indice.caixaDe(i);
|
|
387
432
|
}
|
|
388
433
|
/** Feições cujo envelope toca `caixa`, sem as ocultas (snap, hit-test, seleção por caixa). Não passa pelo LOD. */
|
|
389
|
-
consultarCaixa(a,
|
|
390
|
-
const
|
|
391
|
-
if (!
|
|
392
|
-
const
|
|
393
|
-
for (const t of
|
|
394
|
-
const s =
|
|
395
|
-
s && !s.oculta &&
|
|
434
|
+
consultarCaixa(a, i) {
|
|
435
|
+
const e = this.camadas.get(a);
|
|
436
|
+
if (!e) return [];
|
|
437
|
+
const o = [];
|
|
438
|
+
for (const t of e.dados.indice.consultar(i)) {
|
|
439
|
+
const s = e.dados.loja.get(t);
|
|
440
|
+
s && !s.oculta && o.push(s);
|
|
396
441
|
}
|
|
397
|
-
return
|
|
442
|
+
return o;
|
|
398
443
|
}
|
|
399
|
-
feicaoVisivel(a,
|
|
400
|
-
const
|
|
401
|
-
return !
|
|
444
|
+
feicaoVisivel(a, i) {
|
|
445
|
+
const e = this.camadas.get(a);
|
|
446
|
+
return !e || e.dados.visivelPorVersao(i);
|
|
402
447
|
}
|
|
403
448
|
estatisticas(a) {
|
|
404
|
-
const
|
|
405
|
-
return
|
|
449
|
+
const i = this.camadas.get(a);
|
|
450
|
+
return i ? { ...i.ultima, total: i.dados.loja.size, avaliacoesLOD: i.avaliacoesLOD } : null;
|
|
406
451
|
}
|
|
407
452
|
/** Entidades da camada com prévia e com oficial (pares em detalhe completo): para testes e diagnóstico. */
|
|
408
|
-
ehPar(a,
|
|
409
|
-
const
|
|
410
|
-
return !!
|
|
453
|
+
ehPar(a, i) {
|
|
454
|
+
const e = this.camadas.get(a);
|
|
455
|
+
return !!e && this.emPar(e, i);
|
|
411
456
|
}
|
|
412
457
|
// ---------------------------------------------------------------- lista de desenho
|
|
413
458
|
/**
|
|
@@ -416,24 +461,24 @@ class Ca {
|
|
|
416
461
|
* curvas (clusters, ícones, textos, rótulos), `'tudo'` (padrão) os dois. O pan incremental pede o canvas só das faixas
|
|
417
462
|
* expostas e o DOM da vista inteira (poucos itens, sem projetar nem simplificar formas).
|
|
418
463
|
*/
|
|
419
|
-
listaDesenho(a,
|
|
420
|
-
const
|
|
421
|
-
if (!
|
|
422
|
-
const t =
|
|
423
|
-
s.sort((
|
|
424
|
-
for (const
|
|
464
|
+
listaDesenho(a, i) {
|
|
465
|
+
const e = this.origemDe(a), o = { vista: a, origem: e, camadas: [] };
|
|
466
|
+
if (!B(a)) return o;
|
|
467
|
+
const t = i != null && i.camadas ? new Set(i.camadas) : null, s = [...this.camadas.values()].filter((n) => n.def.visivel && (!t || t.has(n.def.id)));
|
|
468
|
+
s.sort((n, l) => n.def.zIndex - l.def.zIndex);
|
|
469
|
+
for (const n of s)
|
|
425
470
|
try {
|
|
426
|
-
|
|
471
|
+
o.camadas.push(this.listarCamada(n, a, (i == null ? void 0 : i.parte) ?? "tudo"));
|
|
427
472
|
} catch {
|
|
428
|
-
|
|
473
|
+
o.camadas.push(this.camadaVazia(n));
|
|
429
474
|
}
|
|
430
|
-
return
|
|
475
|
+
return o;
|
|
431
476
|
}
|
|
432
477
|
origemDe(a) {
|
|
433
478
|
if (a != null && a.origemPx && Number.isFinite(a.origemPx.x) && Number.isFinite(a.origemPx.y)) return a.origemPx;
|
|
434
|
-
if (!
|
|
435
|
-
const
|
|
436
|
-
return { x:
|
|
479
|
+
if (!B(a)) return { x: 0, y: 0 };
|
|
480
|
+
const i = C(a.caixa.maxLat, a.caixa.minLon, a.zoom);
|
|
481
|
+
return { x: i[0], y: i[1] };
|
|
437
482
|
}
|
|
438
483
|
camadaVazia(a) {
|
|
439
484
|
return {
|
|
@@ -441,129 +486,190 @@ class Ca {
|
|
|
441
486
|
zIndex: a.def.zIndex,
|
|
442
487
|
opacidade: a.def.opacidade,
|
|
443
488
|
itens: [],
|
|
444
|
-
estatisticas: { total: a.dados.loja.size, desenhadas: 0, marcasLOD: 0, clusters: 0, marcadoresDom: 0, avaliacoesLOD: a.avaliacoesLOD }
|
|
489
|
+
estatisticas: { total: a.dados.loja.size, desenhadas: 0, marcasLOD: 0, miudas: 0, clusters: 0, marcadoresDom: 0, avaliacoesLOD: a.avaliacoesLOD }
|
|
445
490
|
};
|
|
446
491
|
}
|
|
447
|
-
|
|
448
|
-
|
|
492
|
+
/** Torna atual o cache do zoom (reaproveitando o de um zoom visitado há pouco) e descarta os mais antigos. */
|
|
493
|
+
prepararZoom(a, i) {
|
|
494
|
+
if (i === a.zoomCache) return;
|
|
495
|
+
let e = a.zooms.get(i);
|
|
496
|
+
for (e ? a.zooms.delete(i) : e = { geom: /* @__PURE__ */ new Map(), lod: /* @__PURE__ */ new Map(), ag: null, agRev: -1 }, a.zooms.set(i, e); a.zooms.size > ra; ) {
|
|
497
|
+
const o = a.zooms.keys().next().value;
|
|
498
|
+
a.zooms.delete(o);
|
|
499
|
+
for (const t of ["tudo", "canvas", "dom"]) a.listasGuardadas.delete(`${o}|${t}`);
|
|
500
|
+
}
|
|
501
|
+
a.geom = e.geom, a.lod = e.lod, a.zoomCache = i;
|
|
449
502
|
}
|
|
450
|
-
estiloDe(a,
|
|
451
|
-
const
|
|
452
|
-
if (
|
|
453
|
-
const t = a.internador.interno(
|
|
454
|
-
return a.estilos.set(
|
|
503
|
+
estiloDe(a, i) {
|
|
504
|
+
const e = a.dados.revisaoDaFeicao(i.id), o = a.estilos.get(i.id);
|
|
505
|
+
if (o && o.rev === e && o.revEstilo === a.revEstilo) return o.estilo;
|
|
506
|
+
const t = a.internador.interno(K(i, a.def.estilo, !1));
|
|
507
|
+
return a.estilos.set(i.id, { rev: e, revEstilo: a.revEstilo, estilo: t }), t;
|
|
455
508
|
}
|
|
456
|
-
emPar(a,
|
|
509
|
+
emPar(a, i) {
|
|
457
510
|
if (a.dados.contPrevias.size === 0) return !1;
|
|
458
|
-
const
|
|
459
|
-
return a.dados.contPrevias.has(
|
|
511
|
+
const e = j(i);
|
|
512
|
+
return a.dados.contPrevias.has(e) && a.dados.oficiais.has(e);
|
|
460
513
|
}
|
|
461
514
|
/**
|
|
462
|
-
*
|
|
463
|
-
* entra aqui: o canvas base não depende dela (a sobreposição desenha a
|
|
515
|
+
* Nível de detalhe (marca, miúda ou forma inteira). Sempre forma inteira: com rótulo e em par oficial × prévia; ponto
|
|
516
|
+
* e texto nunca entram no LOD. A seleção NÃO entra aqui: o canvas base não depende dela (a sobreposição desenha a
|
|
517
|
+
* selecionada em detalhe completo por cima).
|
|
464
518
|
*/
|
|
465
|
-
|
|
466
|
-
var
|
|
467
|
-
const
|
|
468
|
-
if (
|
|
469
|
-
const t = a.lod.get(
|
|
519
|
+
nivel(a, i, e) {
|
|
520
|
+
var n;
|
|
521
|
+
const o = i.geometria.tipo;
|
|
522
|
+
if (o === "Point" || o === "Text" || (n = i.estilo) != null && n.mostrarRotulo || this.emPar(a, i)) return "forma";
|
|
523
|
+
const t = a.lod.get(i.id);
|
|
470
524
|
if (t !== void 0) return t;
|
|
471
525
|
a.avaliacoesLOD++;
|
|
472
|
-
const s =
|
|
473
|
-
return a.lod.set(
|
|
526
|
+
const s = Ra(a.dados.indice.caixaDe(i.id), e, this.limiteMarcaPx, this.limiteMiudaPx);
|
|
527
|
+
return a.lod.set(i.id, s), s;
|
|
474
528
|
}
|
|
475
529
|
/** Geometria projetada e simplificada em px, em cache por (feição, revisão, zoom). `null` se não há o que desenhar. */
|
|
476
|
-
geometriaProjetada(a,
|
|
477
|
-
const
|
|
478
|
-
if (t && t.rev ===
|
|
479
|
-
const s = this.construirGeometria(a, e, o
|
|
480
|
-
return s && a.geom.set(
|
|
481
|
-
}
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
530
|
+
geometriaProjetada(a, i, e) {
|
|
531
|
+
const o = a.dados.revisaoDaFeicao(i.id), t = a.geom.get(i.id);
|
|
532
|
+
if (t && t.rev === o && !t.marca && !t.miuda) return t;
|
|
533
|
+
const s = this.construirGeometria(a, i, e, o);
|
|
534
|
+
return s && a.geom.set(i.id, s), s;
|
|
535
|
+
}
|
|
536
|
+
/**
|
|
537
|
+
* Geometria do nível miúdo, em cache como a projetada: polígono e círculo viram o envelope em px (`[minX, minY, maxX,
|
|
538
|
+
* maxY]`, pintado como um retângulo); linha é simplificada mesmo com menos de `MIN_VERTICES_SIMPLIFICAR` vértices.
|
|
539
|
+
*/
|
|
540
|
+
geometriaMiuda(a, i, e) {
|
|
541
|
+
const o = a.dados.revisaoDaFeicao(i.id), t = a.geom.get(i.id);
|
|
542
|
+
if (t && t.rev === o && t.miuda) return t;
|
|
543
|
+
let s;
|
|
544
|
+
if (i.geometria.tipo === "LineString")
|
|
545
|
+
s = this.construirGeometria(a, i, e, o, !0);
|
|
546
|
+
else {
|
|
547
|
+
const n = a.dados.indice.caixaDe(i.id);
|
|
548
|
+
if (!n) return null;
|
|
549
|
+
const l = C(n.maxLat, n.minLon, e), r = C(n.minLat, n.maxLon, e);
|
|
550
|
+
if (!(Number.isFinite(l[0]) && Number.isFinite(l[1]) && Number.isFinite(r[0]) && Number.isFinite(r[1]))) return null;
|
|
551
|
+
s = { rev: o, partes: [Float64Array.of(l[0], l[1], r[0], r[1])], raioPx: 0, marca: !1 };
|
|
552
|
+
}
|
|
553
|
+
return s ? (s.miuda = !0, a.geom.set(i.id, s), s) : null;
|
|
554
|
+
}
|
|
555
|
+
/** `simplificarSempre`: linha miúda, simplificada mesmo abaixo de `MIN_VERTICES_SIMPLIFICAR`. */
|
|
556
|
+
construirGeometria(a, i, e, o, t = !1) {
|
|
557
|
+
const s = i.geometria, n = e < fa ? this.toleranciaPx : 0, l = t ? 3 : va;
|
|
558
|
+
if (s.tipo === "Polygon") {
|
|
485
559
|
const r = [];
|
|
486
|
-
for (const
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
s > 0 && d.length >= V && (u = q(u, s, !0)), r.push(u);
|
|
490
|
-
}
|
|
491
|
-
return r.length > 0 ? { rev: i, partes: r, raioPx: 0, marca: !1 } : null;
|
|
560
|
+
for (const c of s.aneis ?? [])
|
|
561
|
+
!Array.isArray(c) || c.length < 3 || r.push(n > 0 && c.length >= l ? W(c, e, n, !0) : Y(c, e));
|
|
562
|
+
return r.length > 0 ? { rev: o, partes: r, raioPx: 0, marca: !1 } : null;
|
|
492
563
|
}
|
|
493
|
-
if (
|
|
564
|
+
if (s.tipo === "LineString") {
|
|
494
565
|
const r = [];
|
|
495
|
-
for (const
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
s > 0 && d.length >= V && (u = q(u, s, !1)), r.push(u);
|
|
499
|
-
}
|
|
500
|
-
return r.length > 0 ? { rev: i, partes: r, raioPx: 0, marca: !1 } : null;
|
|
566
|
+
for (const c of xa(s))
|
|
567
|
+
!Array.isArray(c) || c.length < 2 || r.push(n > 0 && c.length >= l ? W(c, e, n, !1) : Y(c, e));
|
|
568
|
+
return r.length > 0 ? { rev: o, partes: r, raioPx: 0, marca: !1 } : null;
|
|
501
569
|
}
|
|
502
|
-
if (
|
|
503
|
-
const r =
|
|
570
|
+
if (s.tipo === "Circle") {
|
|
571
|
+
const r = s.centro;
|
|
504
572
|
if (!Array.isArray(r)) return null;
|
|
505
|
-
const
|
|
506
|
-
return { rev:
|
|
573
|
+
const c = C(r[0], r[1], e);
|
|
574
|
+
return { rev: o, partes: [c], raioPx: ha(r[0], s.raioMetros, e), marca: !1 };
|
|
507
575
|
}
|
|
508
|
-
return
|
|
576
|
+
return s.tipo === "Point" || s.tipo === "Text" ? { rev: o, partes: [C(s.coordenada[0], s.coordenada[1], e)], raioPx: s.tipo === "Point" ? ga(i, a.def.estilo) : 0, marca: !1 } : null;
|
|
509
577
|
}
|
|
510
578
|
/** Marca de LOD: centro do envelope, lado de 1–2 px, cor do preenchimento/contorno. */
|
|
511
|
-
marcaDe(a,
|
|
512
|
-
const
|
|
513
|
-
if (t && t.rev ===
|
|
514
|
-
const s = a.dados.indice.caixaDe(
|
|
579
|
+
marcaDe(a, i, e) {
|
|
580
|
+
const o = a.dados.revisaoDaFeicao(i.id), t = a.geom.get(i.id);
|
|
581
|
+
if (t && t.rev === o && t.marca) return t;
|
|
582
|
+
const s = a.dados.indice.caixaDe(i.id);
|
|
515
583
|
if (!s) return null;
|
|
516
|
-
const
|
|
517
|
-
if (!(Number.isFinite(
|
|
518
|
-
const
|
|
519
|
-
return a.geom.set(
|
|
584
|
+
const n = C((s.minLat + s.maxLat) / 2, (s.minLon + s.maxLon) / 2, e);
|
|
585
|
+
if (!(Number.isFinite(n[0]) && Number.isFinite(n[1]))) return null;
|
|
586
|
+
const l = { rev: o, partes: [n], raioPx: Sa(Z(s, e)), marca: !0 };
|
|
587
|
+
return a.geom.set(i.id, l), l;
|
|
520
588
|
}
|
|
521
589
|
/**
|
|
522
590
|
* Item da marca, em cache junto com a geometria por (feição, zoom). Com 100 mil marcas na tela, montar o item e internar
|
|
523
591
|
* o estilo a cada vista custava a maior parte da lista; no pan agora só se confere se algo mudou, sem alocar.
|
|
524
592
|
*/
|
|
525
|
-
itemMarca(a,
|
|
526
|
-
const
|
|
527
|
-
if (!
|
|
528
|
-
const t =
|
|
529
|
-
if (t && t.feicao ===
|
|
530
|
-
const s = this.itemBase(a,
|
|
531
|
-
return
|
|
532
|
-
}
|
|
533
|
-
estiloMarca(a,
|
|
534
|
-
const
|
|
535
|
-
return a.internador.interno({ cor:
|
|
536
|
-
}
|
|
537
|
-
agrupadorAtivo(a,
|
|
538
|
-
const { dados:
|
|
539
|
-
if (a.nPontosRev !==
|
|
540
|
-
let
|
|
541
|
-
for (const
|
|
542
|
-
a.nPontos =
|
|
593
|
+
itemMarca(a, i, e) {
|
|
594
|
+
const o = this.marcaDe(a, i, e);
|
|
595
|
+
if (!o) return null;
|
|
596
|
+
const t = o.item;
|
|
597
|
+
if (t && t.feicao === i && o.revEstilo === a.revEstilo && t.selecionada === a.dados.selecionadas.has(i.id) && t.destaque === !0 === a.destaques.has(i.id)) return t;
|
|
598
|
+
const s = this.itemBase(a, i, "marca", o.partes, o.raioPx, this.estiloMarca(a, i));
|
|
599
|
+
return o.item = s, o.revEstilo = a.revEstilo, s;
|
|
600
|
+
}
|
|
601
|
+
estiloMarca(a, i) {
|
|
602
|
+
const e = i.estilo ?? {}, o = pa(e.corPreenchimento ?? e.corTraco ?? a.def.estilo.corPrimaria, G);
|
|
603
|
+
return a.internador.interno({ cor: o, traco: !1, peso: 0, dash: void 0, preencher: !0, corPreenchimento: o, opacidadePreenchimento: sa });
|
|
604
|
+
}
|
|
605
|
+
agrupadorAtivo(a, i) {
|
|
606
|
+
const { dados: e } = a;
|
|
607
|
+
if (a.nPontosRev !== e.revisaoBase) {
|
|
608
|
+
let n = 0;
|
|
609
|
+
for (const l of e.loja.values()) l.geometria.tipo === "Point" && e.desenhavel(l) && n++;
|
|
610
|
+
a.nPontos = n, a.nPontosRev = e.revisaoBase;
|
|
543
611
|
}
|
|
544
|
-
if (!
|
|
612
|
+
if (!ta(a.nPontos, i))
|
|
545
613
|
return a.agrupador = null, null;
|
|
546
|
-
const
|
|
547
|
-
if (
|
|
548
|
-
const t =
|
|
549
|
-
|
|
550
|
-
return
|
|
614
|
+
const o = a.agrupador;
|
|
615
|
+
if (o && o.zoom === i && a.agrupadorRev === e.revisaoBase) return o;
|
|
616
|
+
const t = a.zooms.get(i);
|
|
617
|
+
if (t != null && t.ag && t.ag.zoom === i && t.agRev === e.revisaoBase)
|
|
618
|
+
return a.agrupador = t.ag, a.agrupadorRev = t.agRev, t.ag;
|
|
619
|
+
const s = new Aa(i, (n) => {
|
|
620
|
+
const l = C(n[0], n[1], i);
|
|
621
|
+
return { x: l[0], y: l[1] };
|
|
551
622
|
});
|
|
552
|
-
for (const
|
|
553
|
-
|
|
554
|
-
return a.agrupador =
|
|
623
|
+
for (const n of e.loja.values())
|
|
624
|
+
n.geometria.tipo === "Point" && e.desenhavel(n) && s.inserir({ id: n.id, coordenada: n.geometria.coordenada });
|
|
625
|
+
return a.agrupador = s, a.agrupadorRev = e.revisaoBase, t && (t.ag = s, t.agRev = e.revisaoBase), s;
|
|
626
|
+
}
|
|
627
|
+
/**
|
|
628
|
+
* Item de forma ou ponto montado sobre a geometria em cache, reaproveitado enquanto feição, estilo da camada, seleção
|
|
629
|
+
* e destaque não mudam. Em par oficial × prévia o item não é guardado (o caminho quente não o confere).
|
|
630
|
+
*/
|
|
631
|
+
itemPronto(a, i, e, o) {
|
|
632
|
+
const t = e.item;
|
|
633
|
+
if (t && t.feicao === i && t.forma === o && e.revEstilo === a.revEstilo && t.selecionada === a.dados.selecionadas.has(i.id) && t.destaque === !0 === a.destaques.has(i.id)) return t;
|
|
634
|
+
const s = o === "circulo" || o === "ponto" ? e.raioPx : 0, n = this.itemBase(a, i, o, e.partes, s, this.estiloDe(a, i));
|
|
635
|
+
return this.emPar(a, i) || (e.item = n, e.revEstilo = a.revEstilo), n;
|
|
636
|
+
}
|
|
637
|
+
/** Gera marcador DOM (ícone, texto, curva) ou rótulo? Pontos sem ícone e formas comuns são só do canvas. */
|
|
638
|
+
candidataDom(a) {
|
|
639
|
+
var e, o;
|
|
640
|
+
const i = a.geometria;
|
|
641
|
+
return (e = a.estilo) != null && e.mostrarRotulo || i.tipo === "Text" ? !0 : i.tipo === "Point" ? !!((o = a.estilo) != null && o.icone) : !!V(i);
|
|
642
|
+
}
|
|
643
|
+
/**
|
|
644
|
+
* Ids para a passada só de DOM: as candidatas cujo envelope toca a vista, quando são poucas; senão o índice. Clusters
|
|
645
|
+
* não dependem disto (vêm do agrupador). Recontadas quando os dados mudam (uma varredura por mudança, não por pan).
|
|
646
|
+
*/
|
|
647
|
+
idsDom(a, i) {
|
|
648
|
+
const { dados: e } = a;
|
|
649
|
+
if (a.candidatasRev !== e.revisao) {
|
|
650
|
+
const t = [];
|
|
651
|
+
for (const s of e.loja.values()) this.candidataDom(s) && t.push(s.id);
|
|
652
|
+
a.candidatasDom = t, a.candidatasRev = e.revisao;
|
|
653
|
+
}
|
|
654
|
+
if (a.candidatasDom.length > e.loja.size * ya) return e.indice.consultar(i);
|
|
655
|
+
const o = [];
|
|
656
|
+
for (const t of a.candidatasDom) {
|
|
657
|
+
const s = e.indice.caixaDe(t);
|
|
658
|
+
s && aa(s, i) && o.push(t);
|
|
659
|
+
}
|
|
660
|
+
return o;
|
|
555
661
|
}
|
|
556
|
-
itemBase(a, e, o,
|
|
662
|
+
itemBase(a, i, e, o, t, s) {
|
|
557
663
|
return {
|
|
558
664
|
camadaId: a.def.id,
|
|
559
|
-
id:
|
|
560
|
-
forma:
|
|
561
|
-
geometriaEmPx:
|
|
665
|
+
id: i.id,
|
|
666
|
+
forma: e,
|
|
667
|
+
geometriaEmPx: o,
|
|
562
668
|
raioPx: t,
|
|
563
669
|
estilo: s,
|
|
564
|
-
selecionada: a.dados.selecionadas.has(
|
|
565
|
-
feicao:
|
|
566
|
-
...a.destaques.has(
|
|
670
|
+
selecionada: a.dados.selecionadas.has(i.id),
|
|
671
|
+
feicao: i,
|
|
672
|
+
...a.destaques.has(i.id) ? { destaque: !0 } : {}
|
|
567
673
|
};
|
|
568
674
|
}
|
|
569
675
|
/**
|
|
@@ -571,254 +677,269 @@ class Ca {
|
|
|
571
677
|
* (o índice é por envelope). Sem isto, o pan incremental e o quadro completo divergem na borda do canvas.
|
|
572
678
|
*/
|
|
573
679
|
caixaComFolga(a) {
|
|
574
|
-
const
|
|
575
|
-
return { minLat:
|
|
576
|
-
}
|
|
577
|
-
listarCamada(a,
|
|
578
|
-
var
|
|
579
|
-
const { dados:
|
|
580
|
-
this.prepararZoom(a,
|
|
581
|
-
const
|
|
680
|
+
const i = a.caixa, o = 360 / (256 * 2 ** a.zoom) * ba, t = o * Math.cos((i.minLat + i.maxLat) / 2 * Math.PI / 180);
|
|
681
|
+
return { minLat: i.minLat - t, maxLat: i.maxLat + t, minLon: i.minLon - o, maxLon: i.maxLon + o };
|
|
682
|
+
}
|
|
683
|
+
listarCamada(a, i, e) {
|
|
684
|
+
var H;
|
|
685
|
+
const { dados: o, def: t } = a, s = e !== "dom", n = e !== "canvas", l = i.zoom;
|
|
686
|
+
this.prepararZoom(a, l);
|
|
687
|
+
const r = this.caixaComFolga(i), c = this.agrupadorAtivo(a, l), u = o.indice.envelope(), m = !!u && r.minLat <= u.minLat && r.maxLat >= u.maxLat && r.minLon <= u.minLon && r.maxLon >= u.maxLon, p = `${l}|${e}`, L = `${o.revisao}|${o.revisaoBase}|${a.revEstilo}|${a.revLista}`, v = a.listasGuardadas.get(p);
|
|
688
|
+
if (m && v && v.chave === L)
|
|
689
|
+
return e === "tudo" && (a.ultima = v.camada.estatisticas), v.camada;
|
|
690
|
+
const O = e === "dom" ? this.idsDom(a, r) : o.indice.consultar(r), A = [], y = [];
|
|
691
|
+
let F = 0;
|
|
692
|
+
const _ = [], N = [], X = [], z = [], P = { total: o.loja.size, desenhadas: 0, marcasLOD: 0, miudas: 0, clusters: 0, marcadoresDom: 0, avaliacoesLOD: 0 }, R = (h) => {
|
|
582
693
|
var M;
|
|
583
|
-
if (!
|
|
584
|
-
const
|
|
585
|
-
!
|
|
694
|
+
if (!n || !((M = h.estilo) != null && M.mostrarRotulo) || h.geometria.tipo === "Text") return;
|
|
695
|
+
const f = Pa(h, h.estilo.campoRotulo), x = o.indice.caixaDe(h.id);
|
|
696
|
+
!f || !x || (z.push({
|
|
586
697
|
camadaId: t.id,
|
|
587
|
-
id: `rotulo:${
|
|
698
|
+
id: `rotulo:${h.id}`,
|
|
588
699
|
forma: "rotulo",
|
|
589
700
|
geometriaEmPx: [],
|
|
590
701
|
raioPx: 0,
|
|
591
702
|
estilo: I,
|
|
592
703
|
selecionada: !1,
|
|
593
|
-
feicao:
|
|
594
|
-
texto:
|
|
595
|
-
coordenada: [(
|
|
596
|
-
}),
|
|
597
|
-
},
|
|
704
|
+
feicao: h,
|
|
705
|
+
texto: f,
|
|
706
|
+
coordenada: [(x.minLat + x.maxLat) / 2, (x.minLon + x.maxLon) / 2]
|
|
707
|
+
}), P.marcadoresDom++);
|
|
708
|
+
}, ca = (h) => {
|
|
598
709
|
var M;
|
|
599
|
-
const
|
|
600
|
-
if (
|
|
601
|
-
if ((M =
|
|
602
|
-
if (!
|
|
603
|
-
|
|
710
|
+
const f = h.geometria;
|
|
711
|
+
if (f.tipo !== "Point") return;
|
|
712
|
+
if ((M = h.estilo) != null && M.icone) {
|
|
713
|
+
if (!n) return;
|
|
714
|
+
z.push({ ...this.itemBase(a, h, "icone", [], 0, I), coordenada: f.coordenada }), P.marcadoresDom++;
|
|
604
715
|
return;
|
|
605
716
|
}
|
|
606
717
|
if (!s) return;
|
|
607
|
-
const
|
|
608
|
-
|
|
718
|
+
const x = this.geometriaProjetada(a, h, l);
|
|
719
|
+
x && (X.push(this.itemPronto(a, h, x, "ponto")), P.desenhadas++);
|
|
609
720
|
};
|
|
610
|
-
for (const
|
|
611
|
-
const
|
|
612
|
-
if (!
|
|
613
|
-
const
|
|
614
|
-
if (
|
|
615
|
-
if (
|
|
721
|
+
for (const h of O) {
|
|
722
|
+
const f = o.loja.get(h);
|
|
723
|
+
if (!f || !o.desenhavel(f) || a.previas.has(h)) continue;
|
|
724
|
+
const x = f.geometria;
|
|
725
|
+
if (x.tipo === "Point") {
|
|
726
|
+
if (c && c.emCluster(h) && (!((H = f.estilo) != null && H.icone) || !n || !this.soltoDoCluster(a, c, h)))
|
|
616
727
|
continue;
|
|
617
|
-
|
|
728
|
+
ca(f), R(f);
|
|
618
729
|
continue;
|
|
619
730
|
}
|
|
620
|
-
if (
|
|
621
|
-
if (!
|
|
622
|
-
|
|
731
|
+
if (x.tipo === "Text") {
|
|
732
|
+
if (!n) continue;
|
|
733
|
+
z.push({ ...this.itemBase(a, f, "texto", [], 0, I), coordenada: x.coordenada }), P.marcadoresDom++;
|
|
623
734
|
continue;
|
|
624
735
|
}
|
|
625
|
-
if (
|
|
626
|
-
if (!
|
|
627
|
-
|
|
736
|
+
if (V(x)) {
|
|
737
|
+
if (!n) continue;
|
|
738
|
+
z.push(this.itemBase(a, f, "curva", [], 0, this.estiloDe(a, f))), P.marcadoresDom++, R(f);
|
|
628
739
|
continue;
|
|
629
740
|
}
|
|
630
741
|
if (!s) {
|
|
631
|
-
|
|
742
|
+
R(f);
|
|
632
743
|
continue;
|
|
633
744
|
}
|
|
634
|
-
const M = a.geom.get(
|
|
635
|
-
if (
|
|
636
|
-
|
|
745
|
+
const M = a.geom.get(h), D = M == null ? void 0 : M.item;
|
|
746
|
+
if (D && D.feicao === f && M.revEstilo === a.revEstilo && !this.emPar(a, f) && D.selecionada === o.selecionadas.has(h) && D.destaque === !0 === a.destaques.has(h)) {
|
|
747
|
+
if (D.forma === "marca") {
|
|
748
|
+
A.push(D), P.marcasLOD++;
|
|
749
|
+
continue;
|
|
750
|
+
}
|
|
751
|
+
D.forma === "caixa" ? y.push(D) : (D.forma === "linha" ? N : _).push(D), P.desenhadas++, M.miuda && F++, R(f);
|
|
637
752
|
continue;
|
|
638
753
|
}
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
754
|
+
const J = this.nivel(a, f, l);
|
|
755
|
+
if (J === "marca") {
|
|
756
|
+
const Q = this.itemMarca(a, f, l);
|
|
757
|
+
Q && (A.push(Q), P.marcasLOD++);
|
|
642
758
|
continue;
|
|
643
759
|
}
|
|
644
|
-
const
|
|
645
|
-
|
|
646
|
-
const y = this.estiloDe(a, h);
|
|
647
|
-
P.tipo === "LineString" ? x.push(this.itemBase(a, h, "linha", O.partes, 0, y)) : P.tipo === "Circle" ? m.push(this.itemBase(a, h, "circulo", O.partes, O.raioPx, y)) : m.push(this.itemBase(a, h, "poligono", O.partes, 0, y)), v.desenhadas++, D(h);
|
|
760
|
+
const T = J === "miuda", E = T ? this.geometriaMiuda(a, f, l) : this.geometriaProjetada(a, f, l);
|
|
761
|
+
E && (x.tipo === "LineString" ? N.push(this.itemPronto(a, f, E, "linha")) : T ? y.push(this.itemPronto(a, f, E, "caixa")) : _.push(this.itemPronto(a, f, E, x.tipo === "Circle" ? "circulo" : "poligono")), P.desenhadas++, T && F++, R(f));
|
|
648
762
|
}
|
|
649
|
-
|
|
650
|
-
const
|
|
651
|
-
for (const
|
|
652
|
-
|
|
763
|
+
c && n && this.listarClusters(a, i, c, z, P, n), P.avaliacoesLOD = a.avaliacoesLOD, P.miudas = F, e === "tudo" && (a.ultima = P);
|
|
764
|
+
const k = A;
|
|
765
|
+
for (const h of [y, _, N, X, z]) for (const f of h) k.push(f);
|
|
766
|
+
const U = { camadaId: t.id, zIndex: t.zIndex, opacidade: t.opacidade, itens: k, estatisticas: P };
|
|
767
|
+
if (a.listasGuardadas.delete(p), m)
|
|
768
|
+
for (a.listasGuardadas.set(p, { chave: L, camada: U }); a.listasGuardadas.size > Fa; ) a.listasGuardadas.delete(a.listasGuardadas.keys().next().value);
|
|
769
|
+
return U;
|
|
653
770
|
}
|
|
654
771
|
/**
|
|
655
772
|
* Clusters da vista (marcadores DOM). Selecionado nunca entra em cluster; o cluster só aparece com o centro dentro da
|
|
656
773
|
* vista e com 2 ou mais restantes. Os pontos individuais que a seleção solta (o selecionado e o único restante de uma
|
|
657
774
|
* célula) são da sobreposição: o canvas base não depende da seleção.
|
|
658
775
|
*/
|
|
659
|
-
listarClusters(a, e, o,
|
|
660
|
-
const { dados:
|
|
661
|
-
for (const [
|
|
662
|
-
const
|
|
663
|
-
let m = 0,
|
|
664
|
-
for (const
|
|
665
|
-
|
|
666
|
-
const
|
|
667
|
-
|
|
668
|
-
camadaId:
|
|
669
|
-
id:
|
|
776
|
+
listarClusters(a, i, e, o, t, s) {
|
|
777
|
+
const { dados: n, def: l } = a;
|
|
778
|
+
for (const [r, c] of e.celulasAgrupadas()) {
|
|
779
|
+
const u = c.membros.size;
|
|
780
|
+
let m = 0, p = c.somaLat, L = c.somaLon;
|
|
781
|
+
for (const A of c.membros.values())
|
|
782
|
+
n.selecionadas.has(A.id) && (m++, p -= A.coordenada[0], L -= A.coordenada[1]);
|
|
783
|
+
const v = u - m, O = [c.somaLat / u, c.somaLon / u];
|
|
784
|
+
O[0] >= i.caixa.minLat - w && O[0] <= i.caixa.maxLat + w && O[1] >= i.caixa.minLon - w && O[1] <= i.caixa.maxLon + w && (v < 2 || !s || (o.push({
|
|
785
|
+
camadaId: l.id,
|
|
786
|
+
id: r,
|
|
670
787
|
forma: "cluster",
|
|
671
788
|
geometriaEmPx: [],
|
|
672
789
|
raioPx: 0,
|
|
673
790
|
estilo: I,
|
|
674
791
|
selecionada: !1,
|
|
675
|
-
coordenada: [
|
|
676
|
-
total:
|
|
677
|
-
restantes:
|
|
792
|
+
coordenada: [p / v, L / v],
|
|
793
|
+
total: u,
|
|
794
|
+
restantes: v
|
|
678
795
|
}), t.clusters++, t.marcadoresDom++));
|
|
679
796
|
}
|
|
680
797
|
}
|
|
681
798
|
/** O ponto está dentro de um cluster neste zoom (não é desenhado nem clicável individualmente)? */
|
|
682
|
-
pontoAgrupado(a,
|
|
683
|
-
const
|
|
684
|
-
return !!(
|
|
799
|
+
pontoAgrupado(a, i) {
|
|
800
|
+
const e = this.camadas.get(a);
|
|
801
|
+
return !!(e != null && e.agrupador) && e.agrupador.emCluster(i) && !e.dados.selecionadas.has(i);
|
|
685
802
|
}
|
|
686
803
|
/** O ponto de uma célula de cluster aparece solto: está selecionado ou é o único restante não selecionado? */
|
|
687
|
-
soltoDoCluster(a,
|
|
688
|
-
if (a.dados.selecionadas.has(
|
|
689
|
-
const
|
|
804
|
+
soltoDoCluster(a, i, e) {
|
|
805
|
+
if (a.dados.selecionadas.has(e)) return !0;
|
|
806
|
+
const o = i.chaveDoPonto(e), t = o === void 0 ? void 0 : i.celula(o);
|
|
690
807
|
if (!t) return !1;
|
|
691
808
|
let s = 0;
|
|
692
|
-
for (const
|
|
809
|
+
for (const n of t.membros.keys()) a.dados.selecionadas.has(n) || s++;
|
|
693
810
|
return s === 1;
|
|
694
811
|
}
|
|
695
812
|
/** Membros (id e coordenada) da célula de cluster: o clique no cluster enquadra o grupo. */
|
|
696
|
-
membrosDoCluster(a,
|
|
813
|
+
membrosDoCluster(a, i) {
|
|
697
814
|
var t;
|
|
698
|
-
const
|
|
699
|
-
return
|
|
815
|
+
const e = this.camadas.get(a), o = (t = e == null ? void 0 : e.agrupador) == null ? void 0 : t.celula(i);
|
|
816
|
+
return o ? [...o.membros.values()].map((s) => ({ id: s.id, coordenada: s.coordenada })) : [];
|
|
700
817
|
}
|
|
701
818
|
// ---------------------------------------------------------------- sobreposição (seleção, destaque, edição)
|
|
702
819
|
/**
|
|
703
820
|
* Itens da sobreposição: feições selecionadas, em edição ou destacadas, sempre em detalhe completo e com o estilo
|
|
704
821
|
* de seleção. Custo O(selecionadas): selecionar não repinta o canvas base.
|
|
705
822
|
*/
|
|
706
|
-
listaSobreposicao(a,
|
|
707
|
-
var
|
|
708
|
-
const
|
|
709
|
-
if (!
|
|
710
|
-
this.prepararZoom(
|
|
711
|
-
const
|
|
712
|
-
if (s &&
|
|
713
|
-
const
|
|
714
|
-
for (const
|
|
715
|
-
const
|
|
716
|
-
|
|
823
|
+
listaSobreposicao(a, i) {
|
|
824
|
+
var n;
|
|
825
|
+
const e = this.camadas.get(a);
|
|
826
|
+
if (!e || !B(i)) return null;
|
|
827
|
+
this.prepararZoom(e, i.zoom);
|
|
828
|
+
const o = [], t = /* @__PURE__ */ new Set([...e.dados.selecionadas, ...e.previas.keys(), ...e.destaques]), s = e.agrupador;
|
|
829
|
+
if (s && e.dados.selecionadas.size > 0) {
|
|
830
|
+
const l = /* @__PURE__ */ new Set();
|
|
831
|
+
for (const r of e.dados.selecionadas) {
|
|
832
|
+
const c = s.chaveDoPonto(r);
|
|
833
|
+
c !== void 0 && l.add(c);
|
|
717
834
|
}
|
|
718
|
-
for (const
|
|
719
|
-
const
|
|
720
|
-
if (!
|
|
721
|
-
const
|
|
722
|
-
|
|
835
|
+
for (const r of l) {
|
|
836
|
+
const c = s.celula(r);
|
|
837
|
+
if (!c || c.membros.size < 2) continue;
|
|
838
|
+
const u = [...c.membros.keys()].filter((m) => !e.dados.selecionadas.has(m));
|
|
839
|
+
u.length === 1 && t.add(u[0]);
|
|
723
840
|
}
|
|
724
841
|
}
|
|
725
|
-
for (const
|
|
726
|
-
const
|
|
727
|
-
if (!
|
|
728
|
-
const
|
|
729
|
-
if (m.tipo === "Text" ||
|
|
730
|
-
const
|
|
731
|
-
if (
|
|
732
|
-
const L =
|
|
733
|
-
if (!L && !
|
|
734
|
-
const
|
|
735
|
-
if (!
|
|
736
|
-
const
|
|
737
|
-
|
|
842
|
+
for (const l of t) {
|
|
843
|
+
const r = e.dados.loja.get(l);
|
|
844
|
+
if (!r || !e.dados.desenhavel(r)) continue;
|
|
845
|
+
const c = e.previas.get(l), u = c ?? r, m = u.geometria;
|
|
846
|
+
if (m.tipo === "Text" || V(m) || m.tipo === "Point" && ((n = u.estilo) != null && n.icone)) continue;
|
|
847
|
+
const p = c ? null : e.dados.indice.caixaDe(l);
|
|
848
|
+
if (p && !aa(p, i.caixa)) continue;
|
|
849
|
+
const L = e.dados.selecionadas.has(l) || !!c;
|
|
850
|
+
if (!L && !e.destaques.has(l) && !(m.tipo === "Point" && (s != null && s.emCluster(l)))) continue;
|
|
851
|
+
const v = c ? this.construirGeometria(e, u, i.zoom, -1) : this.geometriaProjetada(e, u, i.zoom);
|
|
852
|
+
if (!v) continue;
|
|
853
|
+
const O = e.internador.interno(K(u, e.def.estilo, L)), A = m.tipo === "LineString" ? "linha" : m.tipo === "Circle" ? "circulo" : m.tipo === "Point" ? "ponto" : "poligono";
|
|
854
|
+
o.push({
|
|
738
855
|
camadaId: a,
|
|
739
|
-
id:
|
|
740
|
-
forma:
|
|
741
|
-
geometriaEmPx:
|
|
742
|
-
raioPx:
|
|
743
|
-
estilo:
|
|
856
|
+
id: l,
|
|
857
|
+
forma: A,
|
|
858
|
+
geometriaEmPx: v.partes,
|
|
859
|
+
raioPx: v.raioPx,
|
|
860
|
+
estilo: O,
|
|
744
861
|
selecionada: L,
|
|
745
|
-
feicao:
|
|
746
|
-
...
|
|
862
|
+
feicao: u,
|
|
863
|
+
...e.destaques.has(l) ? { destaque: !0 } : {}
|
|
747
864
|
});
|
|
748
865
|
}
|
|
749
866
|
return {
|
|
750
867
|
camadaId: a,
|
|
751
|
-
zIndex:
|
|
752
|
-
opacidade:
|
|
753
|
-
itens:
|
|
754
|
-
estatisticas: { total:
|
|
868
|
+
zIndex: e.def.zIndex,
|
|
869
|
+
opacidade: e.def.opacidade,
|
|
870
|
+
itens: o,
|
|
871
|
+
estatisticas: { total: e.dados.loja.size, desenhadas: o.length, marcasLOD: 0, miudas: 0, clusters: 0, marcadoresDom: 0, avaliacoesLOD: e.avaliacoesLOD }
|
|
755
872
|
};
|
|
756
873
|
}
|
|
757
874
|
/** A seleção da camada toca pontos sob agrupamento ativo? (então o conjunto de clusters muda e o base precisa refazer) */
|
|
758
|
-
selecaoAfetaAgrupamento(a,
|
|
759
|
-
var
|
|
760
|
-
const
|
|
761
|
-
if (!
|
|
762
|
-
for (const t of
|
|
875
|
+
selecaoAfetaAgrupamento(a, i) {
|
|
876
|
+
var o;
|
|
877
|
+
const e = this.camadas.get(a);
|
|
878
|
+
if (!e || !e.agrupador) return !1;
|
|
879
|
+
for (const t of i) if (((o = e.dados.loja.get(t)) == null ? void 0 : o.geometria.tipo) === "Point") return !0;
|
|
763
880
|
return !1;
|
|
764
881
|
}
|
|
765
882
|
}
|
|
766
883
|
export {
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
884
|
+
Aa as AgrupadorCluster,
|
|
885
|
+
b as CELULA_CLUSTER_PX,
|
|
886
|
+
G as COR_PADRAO,
|
|
887
|
+
Xa as COR_SELECAO,
|
|
888
|
+
wa as DadosCamada,
|
|
889
|
+
ua as IndiceEspacial,
|
|
890
|
+
ma as InternadorEstilos,
|
|
891
|
+
$ as LIMITE_MARCA_PX,
|
|
892
|
+
na as LIMITE_MIUDA_PX,
|
|
893
|
+
Ma as MAX_PONTOS_SEM_CLUSTER,
|
|
894
|
+
va as MIN_VERTICES_SIMPLIFICAR,
|
|
895
|
+
qa as MotorFormas,
|
|
896
|
+
sa as OPACIDADE_MARCA,
|
|
897
|
+
ka as RegraVersoes,
|
|
898
|
+
Ua as TIPOS_LINHA,
|
|
899
|
+
La as ZOOM_DESMEMBRAR,
|
|
900
|
+
za as ZOOM_MAX_MIUDA,
|
|
901
|
+
fa as ZOOM_SEM_SIMPLIFICACAO,
|
|
902
|
+
ja as agruparMarcasPorCor,
|
|
903
|
+
Va as agruparPontos,
|
|
904
|
+
Ha as caixaDaFeicao,
|
|
905
|
+
Ja as caixaPx,
|
|
906
|
+
aa as caixasSeTocam,
|
|
907
|
+
Da as centroDe,
|
|
908
|
+
pa as corSegura,
|
|
909
|
+
gi as criarLinha,
|
|
910
|
+
Qa as dashTipoLinha,
|
|
911
|
+
ta as deveAgrupar,
|
|
912
|
+
Z as diagonalPx,
|
|
913
|
+
Ka as distSegmentoPx,
|
|
914
|
+
Ba as ehMarca,
|
|
915
|
+
pi as ehMultilinha,
|
|
916
|
+
Wa as ehTipoLinha,
|
|
917
|
+
j as entidadeDe,
|
|
918
|
+
Ya as escalaDoZoom,
|
|
919
|
+
ai as escalaLatitude,
|
|
920
|
+
ii as escalaTipoLinhaSegura,
|
|
921
|
+
K as estiloVetorDe,
|
|
922
|
+
ei as juncaoCanvas,
|
|
923
|
+
Sa as ladoMarca,
|
|
924
|
+
oi as latLonDoMundo,
|
|
925
|
+
ti as metrosPorPixel,
|
|
926
|
+
Ra as nivelDetalhe,
|
|
927
|
+
si as normalizarTipoLinha,
|
|
928
|
+
xa as partesDaLinha,
|
|
929
|
+
Ga as pintarMarcas,
|
|
930
|
+
C as projetarCentro,
|
|
931
|
+
ni as projetarEm,
|
|
932
|
+
q as projetarMercator,
|
|
933
|
+
W as projetarSimplificado,
|
|
934
|
+
Y as projetarVertices,
|
|
935
|
+
ha as raioCirculoPx,
|
|
936
|
+
ga as raioPontoPx,
|
|
937
|
+
ri as simplificarAnel,
|
|
938
|
+
ci as simplificarGeometria,
|
|
939
|
+
di as simplificarLinha,
|
|
940
|
+
li as simplificarPx,
|
|
941
|
+
S as statusDe,
|
|
942
|
+
ui as terminacaoCanvas,
|
|
943
|
+
mi as toleranciaPorZoom,
|
|
944
|
+
fi as vertices
|
|
824
945
|
};
|