@thibezer/ui-components-kit 2.28.2 → 2.30.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1260 -1206
- package/dist/camadas.cjs +87 -87
- package/dist/camadas.js +1871 -1302
- package/dist/canvas.cjs +41 -40
- package/dist/canvas.js +1727 -1620
- package/dist/components/ui-barra-ferramentas/ribbon-atualizacao.d.ts +10 -0
- package/dist/components/ui-barra-ferramentas/ui-ribbon.d.ts +25 -5
- package/dist/components/ui-camadas/camadas-arvore-renderer.d.ts +11 -0
- package/dist/components/ui-camadas/camadas-atualizacao-incremental.d.ts +26 -5
- package/dist/components/ui-camadas/camadas-colecao.d.ts +15 -0
- package/dist/components/ui-camadas/camadas-host.d.ts +12 -0
- package/dist/components/ui-camadas/camadas-janela-dom.d.ts +44 -0
- package/dist/components/ui-camadas/camadas-linha-feicao.d.ts +10 -1
- package/dist/components/ui-camadas/camadas-render.d.ts +19 -2
- package/dist/components/ui-camadas/camadas-selecao-api.d.ts +6 -0
- package/dist/components/ui-camadas/camadas-virtual.d.ts +135 -0
- package/dist/components/ui-camadas/ui-camadas.d.ts +51 -2
- package/dist/components/ui-canvas-cad/cad-hud-coordenadas.d.ts +4 -0
- package/dist/components/ui-canvas-cad/ui-canvas-cad.d.ts +10 -0
- package/dist/components/ui-seletor-mapa-base/index.d.ts +1 -0
- package/dist/components/ui-seletor-mapa-base/seletor-mapa-base-util.d.ts +32 -0
- package/dist/components/ui-seletor-mapa-base/tipos.d.ts +8 -1
- package/dist/components/ui-seletor-mapa-base/ui-seletor-mapa-base.d.ts +9 -0
- package/dist/custom-elements.json +13133 -10526
- package/dist/feature_caixa-DOchASgS.js +828 -0
- package/dist/feature_caixa-MrJEfMol.cjs +1 -0
- package/dist/{feature_desenho-edf-dHuf.js → feature_desenho-Cq3H27as.js} +2 -2
- package/dist/{feature_desenho-DRHnu8u8.cjs → feature_desenho-eq3MIZR9.cjs} +1 -1
- package/dist/geometria-px-BlB0OczX.cjs +1 -0
- package/dist/geometria-px-BxTQKrZN.js +577 -0
- package/dist/gerencigeo-canvas/feature_adapters.d.ts +7 -0
- package/dist/gerencigeo-canvas/feature_indice.d.ts +7 -0
- package/dist/gerencigeo-canvas/feature_lod.d.ts +16 -0
- package/dist/gerencigeo-canvas/motor/dados-camada.d.ts +11 -1
- package/dist/gerencigeo-canvas/motor/geometria-px.d.ts +9 -0
- package/dist/gerencigeo-canvas/motor/motor-formas.d.ts +28 -5
- package/dist/gerencigeo-canvas/motor/tipos.d.ts +7 -3
- package/dist/gerencigeo-canvas/qualidade.d.ts +5 -0
- package/dist/gerencigeo-canvas/renderers/canvas_formas_leaflet.d.ts +10 -0
- package/dist/gerencigeo-canvas/renderers/feicoes_canvas_renderer.d.ts +10 -0
- package/dist/gerencigeo-canvas/renderers/renderizador_formas.d.ts +7 -0
- package/dist/index.cjs +4 -4
- package/dist/index.js +84 -82
- package/dist/motor.cjs +1 -1
- package/dist/motor.js +616 -497
- package/dist/prancha-nucleo.cjs +1 -1
- package/dist/prancha-nucleo.js +3 -3
- package/dist/prancha.cjs +1 -1
- package/dist/prancha.js +3 -3
- package/dist/seletor-mapa-base.cjs +16 -16
- package/dist/seletor-mapa-base.js +183 -102
- package/dist/tipos-elementos.d.ts +2 -0
- package/dist/tipos-vue.d.ts +2 -0
- package/dist/tools.cjs +5 -5
- package/dist/tools.js +438 -369
- package/package.json +1 -1
- package/dist/feature_caixa-BLVtatpp.cjs +0 -1
- package/dist/feature_caixa-CHAdzESq.js +0 -806
- package/dist/geometria-px-DEAIxMG5.js +0 -512
- package/dist/geometria-px-DJcNHXbE.cjs +0 -1
package/dist/motor.js
CHANGED
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var g = (
|
|
4
|
-
import { I as
|
|
5
|
-
import { C as
|
|
6
|
-
import { p as
|
|
7
|
-
import { b as
|
|
8
|
-
const
|
|
9
|
-
function
|
|
10
|
-
return a <
|
|
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;
|
|
11
11
|
}
|
|
12
|
-
function
|
|
13
|
-
let a = 0,
|
|
14
|
-
for (const
|
|
15
|
-
a +=
|
|
16
|
-
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];
|
|
17
17
|
}
|
|
18
|
-
function
|
|
19
|
-
if (
|
|
20
|
-
const
|
|
21
|
-
for (const s of
|
|
22
|
-
const { x:
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
const
|
|
26
|
-
for (const [s,
|
|
27
|
-
|
|
28
|
-
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 };
|
|
29
29
|
}
|
|
30
|
-
class
|
|
31
|
-
constructor(a,
|
|
30
|
+
class Aa {
|
|
31
|
+
constructor(a, i) {
|
|
32
32
|
g(this, "celulas", /* @__PURE__ */ new Map());
|
|
33
33
|
g(this, "celulaDe", /* @__PURE__ */ new Map());
|
|
34
34
|
/** Chaves das células com 2 ou mais pontos (as únicas que viram cluster). */
|
|
35
35
|
g(this, "multiplas", /* @__PURE__ */ new Set());
|
|
36
|
-
this.zoom = a, this.projetar =
|
|
36
|
+
this.zoom = a, this.projetar = i;
|
|
37
37
|
}
|
|
38
38
|
/** Pontos agrupáveis na grade. */
|
|
39
39
|
get total() {
|
|
@@ -49,80 +49,86 @@ class la {
|
|
|
49
49
|
/** Só as células que viram cluster (2+ pontos). */
|
|
50
50
|
*celulasAgrupadas() {
|
|
51
51
|
for (const a of this.multiplas) {
|
|
52
|
-
const
|
|
53
|
-
|
|
52
|
+
const i = this.celulas.get(a);
|
|
53
|
+
i && (yield [a, i]);
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
/** Está numa célula com 2 ou mais pontos (ou seja, dentro de um cluster)? */
|
|
57
57
|
emCluster(a) {
|
|
58
|
-
var
|
|
59
|
-
const
|
|
60
|
-
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;
|
|
61
61
|
}
|
|
62
62
|
/** Insere (ou move) o ponto; devolve a chave da célula nova. */
|
|
63
63
|
inserir(a) {
|
|
64
64
|
this.remover(a.id);
|
|
65
|
-
const { x:
|
|
66
|
-
let t = this.celulas.get(
|
|
67
|
-
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;
|
|
68
68
|
}
|
|
69
69
|
/** Tira o ponto da grade; devolve a chave da célula de onde saiu. */
|
|
70
70
|
remover(a) {
|
|
71
|
-
const
|
|
72
|
-
if (
|
|
71
|
+
const i = this.celulaDe.get(a);
|
|
72
|
+
if (i === void 0) return;
|
|
73
73
|
this.celulaDe.delete(a);
|
|
74
|
-
const
|
|
75
|
-
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;
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
|
-
const
|
|
79
|
-
function
|
|
80
|
-
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);
|
|
81
81
|
return {
|
|
82
|
-
x: (a + 180) / 360 *
|
|
83
|
-
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
|
|
84
84
|
};
|
|
85
85
|
}
|
|
86
|
-
const
|
|
87
|
-
function
|
|
88
|
-
if (!Number.isFinite(a) || a < 0 || !
|
|
89
|
-
const
|
|
90
|
-
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;
|
|
91
96
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
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";
|
|
96
102
|
}
|
|
97
|
-
function
|
|
98
|
-
return Number.isFinite(
|
|
103
|
+
function Sa(d) {
|
|
104
|
+
return Number.isFinite(d) && d < 1.5 ? 1 : 2;
|
|
99
105
|
}
|
|
100
|
-
function
|
|
106
|
+
function ja(d) {
|
|
101
107
|
const a = /* @__PURE__ */ new Map();
|
|
102
|
-
for (const
|
|
103
|
-
const
|
|
104
|
-
|
|
108
|
+
for (const i of d) {
|
|
109
|
+
const e = a.get(i.cor);
|
|
110
|
+
e ? e.push(i) : a.set(i.cor, [i]);
|
|
105
111
|
}
|
|
106
112
|
return a;
|
|
107
113
|
}
|
|
108
|
-
const
|
|
109
|
-
function
|
|
110
|
-
let
|
|
111
|
-
const
|
|
112
|
-
for (const [
|
|
113
|
-
let
|
|
114
|
-
for (const m of
|
|
115
|
-
const
|
|
116
|
-
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++);
|
|
117
123
|
}
|
|
118
124
|
}
|
|
119
|
-
return
|
|
125
|
+
return n;
|
|
120
126
|
}
|
|
121
|
-
const
|
|
122
|
-
class
|
|
127
|
+
const ea = 0.3, oa = (d) => !!d && typeof d.id == "string" && !!d.geometria && typeof d.geometria.tipo == "string";
|
|
128
|
+
class wa {
|
|
123
129
|
constructor() {
|
|
124
130
|
g(this, "loja", /* @__PURE__ */ new Map());
|
|
125
|
-
g(this, "indice", new
|
|
131
|
+
g(this, "indice", new ua());
|
|
126
132
|
/** Muda a cada alteração dos dados (invalida cache de geometria por feição). */
|
|
127
133
|
g(this, "revisao", 0);
|
|
128
134
|
/** Muda quando o agrupamento e a contagem de pontos precisam ser refeitos do zero. */
|
|
@@ -151,113 +157,132 @@ class xa {
|
|
|
151
157
|
visivelPorVersao(a) {
|
|
152
158
|
return !this.regra || this.regra(a, this.oficiais);
|
|
153
159
|
}
|
|
154
|
-
/**
|
|
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
|
+
*/
|
|
155
167
|
sincronizar(a) {
|
|
156
|
-
const
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
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);
|
|
163
183
|
else {
|
|
164
|
-
for (const
|
|
165
|
-
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);
|
|
166
186
|
}
|
|
167
187
|
this.loja.clear();
|
|
168
|
-
for (const
|
|
169
|
-
for (const
|
|
170
|
-
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);
|
|
171
191
|
this.recontarOficiais();
|
|
172
192
|
}
|
|
173
193
|
this.listaSincronizada = a;
|
|
174
|
-
for (const
|
|
175
|
-
return { mudadas: [...
|
|
194
|
+
for (const r of [...this.selecionadas]) o.has(r) || this.selecionadas.delete(r);
|
|
195
|
+
return { mudadas: [...e], removidas: n, oficiaisMudou: !1 };
|
|
176
196
|
}
|
|
177
197
|
recontarOficiais() {
|
|
178
198
|
this.contOficiais = /* @__PURE__ */ new Map(), this.contPrevias = /* @__PURE__ */ new Map(), this.nPrevias = 0;
|
|
179
199
|
for (const a of this.loja.values()) {
|
|
180
|
-
if (
|
|
200
|
+
if (S(a) !== "oficial") {
|
|
181
201
|
this.nPrevias++;
|
|
182
|
-
const
|
|
183
|
-
this.contPrevias.set(
|
|
202
|
+
const e = j(a);
|
|
203
|
+
this.contPrevias.set(e, (this.contPrevias.get(e) ?? 0) + 1);
|
|
184
204
|
continue;
|
|
185
205
|
}
|
|
186
|
-
const
|
|
187
|
-
this.contOficiais.set(
|
|
206
|
+
const i = j(a);
|
|
207
|
+
this.contOficiais.set(i, (this.contOficiais.get(i) ?? 0) + 1);
|
|
188
208
|
}
|
|
189
209
|
this.oficiais = new Set(this.contOficiais.keys());
|
|
190
210
|
}
|
|
191
211
|
/** Aplica só a diferença. Devolve `null` se o delta não parte da lista sincronizada (então use `sincronizar`). */
|
|
192
|
-
aplicarDelta(a,
|
|
193
|
-
if (!
|
|
194
|
-
const
|
|
195
|
-
if (!
|
|
196
|
-
const m =
|
|
197
|
-
|
|
198
|
-
const
|
|
199
|
-
|
|
200
|
-
}, t = (
|
|
201
|
-
const m =
|
|
202
|
-
|
|
203
|
-
}, s = [],
|
|
204
|
-
const
|
|
205
|
-
|
|
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));
|
|
206
226
|
};
|
|
207
|
-
for (const
|
|
208
|
-
for (const
|
|
209
|
-
if (!
|
|
210
|
-
if (
|
|
211
|
-
|
|
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);
|
|
212
232
|
continue;
|
|
213
233
|
}
|
|
214
|
-
const
|
|
215
|
-
|
|
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);
|
|
216
236
|
}
|
|
217
|
-
let
|
|
237
|
+
let r = !1;
|
|
218
238
|
if (this.nPrevias > 0)
|
|
219
|
-
for (const [
|
|
220
|
-
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 };
|
|
221
241
|
}
|
|
222
242
|
}
|
|
223
|
-
const
|
|
224
|
-
cor:
|
|
243
|
+
const Ia = 1.2, w = 1e-9, ba = 6, ra = 3, ya = 0.25, Fa = 3 * ra, I = {
|
|
244
|
+
cor: G,
|
|
225
245
|
traco: !1,
|
|
226
246
|
peso: 0,
|
|
227
247
|
dash: void 0,
|
|
228
248
|
preencher: !1,
|
|
229
|
-
corPreenchimento:
|
|
249
|
+
corPreenchimento: G,
|
|
230
250
|
opacidadePreenchimento: 0
|
|
231
|
-
},
|
|
232
|
-
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 {
|
|
233
253
|
constructor() {
|
|
234
254
|
g(this, "camadas", /* @__PURE__ */ new Map());
|
|
235
255
|
g(this, "regra", null);
|
|
236
|
-
g(this, "limiteMarcaPx",
|
|
237
|
-
g(this, "
|
|
256
|
+
g(this, "limiteMarcaPx", $);
|
|
257
|
+
g(this, "limiteMiudaPx", na);
|
|
258
|
+
g(this, "toleranciaPx", Ia);
|
|
238
259
|
}
|
|
239
260
|
/**
|
|
240
|
-
* Ajusta o LOD (diagonal em px abaixo da qual a feição vira marca
|
|
241
|
-
* `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.
|
|
242
264
|
*/
|
|
243
265
|
definirQualidade(a) {
|
|
244
|
-
const
|
|
245
|
-
if (!(e === this.limiteMarcaPx && o === this.toleranciaPx)) {
|
|
246
|
-
this.limiteMarcaPx = e, this.toleranciaPx =
|
|
247
|
-
for (const
|
|
248
|
-
|
|
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++;
|
|
249
271
|
}
|
|
250
272
|
}
|
|
251
273
|
// ---------------------------------------------------------------- camadas
|
|
252
274
|
/** Cria a camada ou atualiza a definição (estilo, zIndex, opacidade, visibilidade). */
|
|
253
275
|
definirCamada(a) {
|
|
254
276
|
if (!a || typeof a.id != "string") return;
|
|
255
|
-
let
|
|
256
|
-
if (!
|
|
257
|
-
|
|
277
|
+
let i = this.camadas.get(a.id);
|
|
278
|
+
if (!i) {
|
|
279
|
+
i = {
|
|
258
280
|
def: a,
|
|
259
|
-
dados: new
|
|
281
|
+
dados: new wa(),
|
|
260
282
|
zoomCache: -1,
|
|
283
|
+
zooms: /* @__PURE__ */ new Map(),
|
|
284
|
+
candidatasDom: [],
|
|
285
|
+
candidatasRev: -1,
|
|
261
286
|
geom: /* @__PURE__ */ new Map(),
|
|
262
287
|
estilos: /* @__PURE__ */ new Map(),
|
|
263
288
|
lod: /* @__PURE__ */ new Map(),
|
|
@@ -269,13 +294,15 @@ class Sa {
|
|
|
269
294
|
previas: /* @__PURE__ */ new Map(),
|
|
270
295
|
destaques: /* @__PURE__ */ new Set(),
|
|
271
296
|
revEstilo: 0,
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
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);
|
|
275
302
|
return;
|
|
276
303
|
}
|
|
277
|
-
const
|
|
278
|
-
|
|
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);
|
|
279
306
|
}
|
|
280
307
|
removerCamada(a) {
|
|
281
308
|
this.camadas.delete(a);
|
|
@@ -285,131 +312,147 @@ class Sa {
|
|
|
285
312
|
}
|
|
286
313
|
definirRegra(a) {
|
|
287
314
|
this.regra = a;
|
|
288
|
-
for (const
|
|
315
|
+
for (const i of this.camadas.values())
|
|
316
|
+
i.dados.regra = a, i.revLista++;
|
|
289
317
|
}
|
|
290
318
|
/** A regra de versões mudou (prévias ligadas/desligadas): o conjunto desenhado e o agrupamento precisam ser refeitos. */
|
|
291
319
|
reavaliarVersoes(a) {
|
|
292
|
-
const
|
|
293
|
-
|
|
320
|
+
const i = this.camadas.get(a);
|
|
321
|
+
i && (i.dados.revisao++, i.dados.revisaoBase++);
|
|
294
322
|
}
|
|
295
323
|
// ---------------------------------------------------------------- dados
|
|
296
324
|
/** Troca total dos dados da camada (diferencia contra o que já existe). */
|
|
297
|
-
definirFeicoes(a,
|
|
298
|
-
const
|
|
299
|
-
if (!
|
|
300
|
-
const
|
|
301
|
-
|
|
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);
|
|
302
337
|
}
|
|
303
338
|
/**
|
|
304
339
|
* Mudança incremental: só vale se `delta.base` for a lista sincronizada por último; senão a camada é refeita
|
|
305
340
|
* por inteiro a partir de `lista`.
|
|
306
341
|
*/
|
|
307
|
-
aplicarDelta(a,
|
|
308
|
-
const
|
|
309
|
-
if (!
|
|
310
|
-
const t = Array.isArray(
|
|
311
|
-
if (
|
|
312
|
-
for (const
|
|
313
|
-
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)));
|
|
314
349
|
}
|
|
315
|
-
const
|
|
316
|
-
if (!
|
|
350
|
+
const n = o.dados.aplicarDelta(t, e);
|
|
351
|
+
if (!n) {
|
|
317
352
|
this.definirFeicoes(a, t);
|
|
318
353
|
return;
|
|
319
354
|
}
|
|
320
|
-
let
|
|
321
|
-
for (const [
|
|
322
|
-
const
|
|
323
|
-
|
|
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);
|
|
324
359
|
}
|
|
325
|
-
|
|
326
|
-
}
|
|
327
|
-
pontoVisivel(a, e) {
|
|
328
|
-
var o;
|
|
329
|
-
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);
|
|
330
361
|
}
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
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);
|
|
337
379
|
}
|
|
338
380
|
/** O agrupador do zoom atual acompanha os pontos que mudaram (células afetadas, sem reagrupar a camada). */
|
|
339
|
-
manterAgrupador(a,
|
|
340
|
-
const
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
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) {
|
|
344
387
|
const s = a.dados.loja.get(t);
|
|
345
|
-
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);
|
|
346
389
|
}
|
|
347
390
|
}
|
|
348
391
|
}
|
|
349
392
|
// ---------------------------------------------------------------- seleção e edição
|
|
350
393
|
/** Define a seleção da camada. Devolve quem entrou e quem saiu (só o que mudou). */
|
|
351
|
-
selecionar(a,
|
|
352
|
-
const
|
|
353
|
-
if (!
|
|
354
|
-
const
|
|
355
|
-
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);
|
|
356
399
|
const t = [], s = [];
|
|
357
|
-
for (const
|
|
358
|
-
for (const
|
|
359
|
-
|
|
360
|
-
for (const
|
|
361
|
-
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 };
|
|
362
405
|
}
|
|
363
406
|
selecionadas(a) {
|
|
364
|
-
var
|
|
365
|
-
return ((
|
|
407
|
+
var i;
|
|
408
|
+
return ((i = this.camadas.get(a)) == null ? void 0 : i.dados.selecionadas) ?? /* @__PURE__ */ new Set();
|
|
366
409
|
}
|
|
367
410
|
/** Geometria provisória (arrasto de vértice): o canvas base deixa de desenhar a feição e a sobreposição a mostra. */
|
|
368
|
-
previsualizar(a,
|
|
369
|
-
const
|
|
370
|
-
!
|
|
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++);
|
|
371
414
|
}
|
|
372
|
-
temPrevia(a,
|
|
373
|
-
var
|
|
374
|
-
return ((
|
|
415
|
+
temPrevia(a, i) {
|
|
416
|
+
var e;
|
|
417
|
+
return ((e = this.camadas.get(a)) == null ? void 0 : e.previas.has(i)) ?? !1;
|
|
375
418
|
}
|
|
376
419
|
/** Realce temporário (hover): as feições entram na sobreposição com `destaque: true`. */
|
|
377
|
-
destacar(a,
|
|
378
|
-
const
|
|
379
|
-
|
|
420
|
+
destacar(a, i) {
|
|
421
|
+
const e = this.camadas.get(a);
|
|
422
|
+
e && (e.destaques = new Set(i), e.revLista++);
|
|
380
423
|
}
|
|
381
424
|
// ---------------------------------------------------------------- consultas (geometria original)
|
|
382
|
-
feicao(a,
|
|
383
|
-
var
|
|
384
|
-
return (
|
|
425
|
+
feicao(a, i) {
|
|
426
|
+
var e;
|
|
427
|
+
return (e = this.camadas.get(a)) == null ? void 0 : e.dados.loja.get(i);
|
|
385
428
|
}
|
|
386
|
-
caixaDe(a,
|
|
387
|
-
var
|
|
388
|
-
return (
|
|
429
|
+
caixaDe(a, i) {
|
|
430
|
+
var e;
|
|
431
|
+
return (e = this.camadas.get(a)) == null ? void 0 : e.dados.indice.caixaDe(i);
|
|
389
432
|
}
|
|
390
433
|
/** Feições cujo envelope toca `caixa`, sem as ocultas (snap, hit-test, seleção por caixa). Não passa pelo LOD. */
|
|
391
|
-
consultarCaixa(a,
|
|
392
|
-
const
|
|
393
|
-
if (!
|
|
394
|
-
const
|
|
395
|
-
for (const t of
|
|
396
|
-
const s =
|
|
397
|
-
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);
|
|
398
441
|
}
|
|
399
|
-
return
|
|
442
|
+
return o;
|
|
400
443
|
}
|
|
401
|
-
feicaoVisivel(a,
|
|
402
|
-
const
|
|
403
|
-
return !
|
|
444
|
+
feicaoVisivel(a, i) {
|
|
445
|
+
const e = this.camadas.get(a);
|
|
446
|
+
return !e || e.dados.visivelPorVersao(i);
|
|
404
447
|
}
|
|
405
448
|
estatisticas(a) {
|
|
406
|
-
const
|
|
407
|
-
return
|
|
449
|
+
const i = this.camadas.get(a);
|
|
450
|
+
return i ? { ...i.ultima, total: i.dados.loja.size, avaliacoesLOD: i.avaliacoesLOD } : null;
|
|
408
451
|
}
|
|
409
452
|
/** Entidades da camada com prévia e com oficial (pares em detalhe completo): para testes e diagnóstico. */
|
|
410
|
-
ehPar(a,
|
|
411
|
-
const
|
|
412
|
-
return !!
|
|
453
|
+
ehPar(a, i) {
|
|
454
|
+
const e = this.camadas.get(a);
|
|
455
|
+
return !!e && this.emPar(e, i);
|
|
413
456
|
}
|
|
414
457
|
// ---------------------------------------------------------------- lista de desenho
|
|
415
458
|
/**
|
|
@@ -418,24 +461,24 @@ class Sa {
|
|
|
418
461
|
* curvas (clusters, ícones, textos, rótulos), `'tudo'` (padrão) os dois. O pan incremental pede o canvas só das faixas
|
|
419
462
|
* expostas e o DOM da vista inteira (poucos itens, sem projetar nem simplificar formas).
|
|
420
463
|
*/
|
|
421
|
-
listaDesenho(a,
|
|
422
|
-
const
|
|
423
|
-
if (!
|
|
424
|
-
const t =
|
|
425
|
-
s.sort((
|
|
426
|
-
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)
|
|
427
470
|
try {
|
|
428
|
-
|
|
471
|
+
o.camadas.push(this.listarCamada(n, a, (i == null ? void 0 : i.parte) ?? "tudo"));
|
|
429
472
|
} catch {
|
|
430
|
-
|
|
473
|
+
o.camadas.push(this.camadaVazia(n));
|
|
431
474
|
}
|
|
432
|
-
return
|
|
475
|
+
return o;
|
|
433
476
|
}
|
|
434
477
|
origemDe(a) {
|
|
435
478
|
if (a != null && a.origemPx && Number.isFinite(a.origemPx.x) && Number.isFinite(a.origemPx.y)) return a.origemPx;
|
|
436
|
-
if (!
|
|
437
|
-
const
|
|
438
|
-
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] };
|
|
439
482
|
}
|
|
440
483
|
camadaVazia(a) {
|
|
441
484
|
return {
|
|
@@ -443,129 +486,190 @@ class Sa {
|
|
|
443
486
|
zIndex: a.def.zIndex,
|
|
444
487
|
opacidade: a.def.opacidade,
|
|
445
488
|
itens: [],
|
|
446
|
-
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 }
|
|
447
490
|
};
|
|
448
491
|
}
|
|
449
|
-
|
|
450
|
-
|
|
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;
|
|
451
502
|
}
|
|
452
|
-
estiloDe(a,
|
|
453
|
-
const
|
|
454
|
-
if (
|
|
455
|
-
const t = a.internador.interno(
|
|
456
|
-
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;
|
|
457
508
|
}
|
|
458
|
-
emPar(a,
|
|
509
|
+
emPar(a, i) {
|
|
459
510
|
if (a.dados.contPrevias.size === 0) return !1;
|
|
460
|
-
const
|
|
461
|
-
return a.dados.contPrevias.has(
|
|
511
|
+
const e = j(i);
|
|
512
|
+
return a.dados.contPrevias.has(e) && a.dados.oficiais.has(e);
|
|
462
513
|
}
|
|
463
514
|
/**
|
|
464
|
-
*
|
|
465
|
-
* 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).
|
|
466
518
|
*/
|
|
467
|
-
|
|
468
|
-
var
|
|
469
|
-
const
|
|
470
|
-
if (
|
|
471
|
-
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);
|
|
472
524
|
if (t !== void 0) return t;
|
|
473
525
|
a.avaliacoesLOD++;
|
|
474
|
-
const s =
|
|
475
|
-
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;
|
|
476
528
|
}
|
|
477
529
|
/** Geometria projetada e simplificada em px, em cache por (feição, revisão, zoom). `null` se não há o que desenhar. */
|
|
478
|
-
geometriaProjetada(a,
|
|
479
|
-
const
|
|
480
|
-
if (t && t.rev ===
|
|
481
|
-
const s = this.construirGeometria(a, e, o
|
|
482
|
-
return s && a.geom.set(
|
|
483
|
-
}
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
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") {
|
|
487
559
|
const r = [];
|
|
488
|
-
for (const
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
s > 0 && d.length >= V && (u = q(u, s, !0)), r.push(u);
|
|
492
|
-
}
|
|
493
|
-
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;
|
|
494
563
|
}
|
|
495
|
-
if (
|
|
564
|
+
if (s.tipo === "LineString") {
|
|
496
565
|
const r = [];
|
|
497
|
-
for (const
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
s > 0 && d.length >= V && (u = q(u, s, !1)), r.push(u);
|
|
501
|
-
}
|
|
502
|
-
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;
|
|
503
569
|
}
|
|
504
|
-
if (
|
|
505
|
-
const r =
|
|
570
|
+
if (s.tipo === "Circle") {
|
|
571
|
+
const r = s.centro;
|
|
506
572
|
if (!Array.isArray(r)) return null;
|
|
507
|
-
const
|
|
508
|
-
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 };
|
|
509
575
|
}
|
|
510
|
-
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;
|
|
511
577
|
}
|
|
512
578
|
/** Marca de LOD: centro do envelope, lado de 1–2 px, cor do preenchimento/contorno. */
|
|
513
|
-
marcaDe(a,
|
|
514
|
-
const
|
|
515
|
-
if (t && t.rev ===
|
|
516
|
-
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);
|
|
517
583
|
if (!s) return null;
|
|
518
|
-
const
|
|
519
|
-
if (!(Number.isFinite(
|
|
520
|
-
const
|
|
521
|
-
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;
|
|
522
588
|
}
|
|
523
589
|
/**
|
|
524
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
|
|
525
591
|
* o estilo a cada vista custava a maior parte da lista; no pan agora só se confere se algo mudou, sem alocar.
|
|
526
592
|
*/
|
|
527
|
-
itemMarca(a,
|
|
528
|
-
const
|
|
529
|
-
if (!
|
|
530
|
-
const t =
|
|
531
|
-
if (t && t.feicao ===
|
|
532
|
-
const s = this.itemBase(a,
|
|
533
|
-
return
|
|
534
|
-
}
|
|
535
|
-
estiloMarca(a,
|
|
536
|
-
const
|
|
537
|
-
return a.internador.interno({ cor:
|
|
538
|
-
}
|
|
539
|
-
agrupadorAtivo(a,
|
|
540
|
-
const { dados:
|
|
541
|
-
if (a.nPontosRev !==
|
|
542
|
-
let
|
|
543
|
-
for (const
|
|
544
|
-
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;
|
|
545
611
|
}
|
|
546
|
-
if (
|
|
612
|
+
if (!ta(a.nPontos, i))
|
|
547
613
|
return a.agrupador = null, null;
|
|
548
|
-
const
|
|
549
|
-
if (
|
|
550
|
-
const t =
|
|
551
|
-
|
|
552
|
-
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] };
|
|
553
622
|
});
|
|
554
|
-
for (const
|
|
555
|
-
|
|
556
|
-
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;
|
|
557
661
|
}
|
|
558
|
-
itemBase(a, e, o,
|
|
662
|
+
itemBase(a, i, e, o, t, s) {
|
|
559
663
|
return {
|
|
560
664
|
camadaId: a.def.id,
|
|
561
|
-
id:
|
|
562
|
-
forma:
|
|
563
|
-
geometriaEmPx:
|
|
665
|
+
id: i.id,
|
|
666
|
+
forma: e,
|
|
667
|
+
geometriaEmPx: o,
|
|
564
668
|
raioPx: t,
|
|
565
669
|
estilo: s,
|
|
566
|
-
selecionada: a.dados.selecionadas.has(
|
|
567
|
-
feicao:
|
|
568
|
-
...a.destaques.has(
|
|
670
|
+
selecionada: a.dados.selecionadas.has(i.id),
|
|
671
|
+
feicao: i,
|
|
672
|
+
...a.destaques.has(i.id) ? { destaque: !0 } : {}
|
|
569
673
|
};
|
|
570
674
|
}
|
|
571
675
|
/**
|
|
@@ -573,254 +677,269 @@ class Sa {
|
|
|
573
677
|
* (o índice é por envelope). Sem isto, o pan incremental e o quadro completo divergem na borda do canvas.
|
|
574
678
|
*/
|
|
575
679
|
caixaComFolga(a) {
|
|
576
|
-
const
|
|
577
|
-
return { minLat:
|
|
578
|
-
}
|
|
579
|
-
listarCamada(a,
|
|
580
|
-
var
|
|
581
|
-
const { dados:
|
|
582
|
-
this.prepararZoom(a,
|
|
583
|
-
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) => {
|
|
584
693
|
var M;
|
|
585
|
-
if (!
|
|
586
|
-
const f =
|
|
587
|
-
!f || !
|
|
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({
|
|
588
697
|
camadaId: t.id,
|
|
589
698
|
id: `rotulo:${h.id}`,
|
|
590
699
|
forma: "rotulo",
|
|
591
700
|
geometriaEmPx: [],
|
|
592
701
|
raioPx: 0,
|
|
593
|
-
estilo:
|
|
702
|
+
estilo: I,
|
|
594
703
|
selecionada: !1,
|
|
595
704
|
feicao: h,
|
|
596
705
|
texto: f,
|
|
597
|
-
coordenada: [(
|
|
598
|
-
}),
|
|
599
|
-
},
|
|
706
|
+
coordenada: [(x.minLat + x.maxLat) / 2, (x.minLon + x.maxLon) / 2]
|
|
707
|
+
}), P.marcadoresDom++);
|
|
708
|
+
}, ca = (h) => {
|
|
600
709
|
var M;
|
|
601
710
|
const f = h.geometria;
|
|
602
711
|
if (f.tipo !== "Point") return;
|
|
603
712
|
if ((M = h.estilo) != null && M.icone) {
|
|
604
|
-
if (!
|
|
605
|
-
|
|
713
|
+
if (!n) return;
|
|
714
|
+
z.push({ ...this.itemBase(a, h, "icone", [], 0, I), coordenada: f.coordenada }), P.marcadoresDom++;
|
|
606
715
|
return;
|
|
607
716
|
}
|
|
608
717
|
if (!s) return;
|
|
609
|
-
const
|
|
610
|
-
|
|
718
|
+
const x = this.geometriaProjetada(a, h, l);
|
|
719
|
+
x && (X.push(this.itemPronto(a, h, x, "ponto")), P.desenhadas++);
|
|
611
720
|
};
|
|
612
|
-
for (const h of
|
|
613
|
-
const f =
|
|
614
|
-
if (!f || !
|
|
615
|
-
const
|
|
616
|
-
if (
|
|
617
|
-
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)))
|
|
618
727
|
continue;
|
|
619
|
-
|
|
728
|
+
ca(f), R(f);
|
|
620
729
|
continue;
|
|
621
730
|
}
|
|
622
|
-
if (
|
|
623
|
-
if (!
|
|
624
|
-
|
|
731
|
+
if (x.tipo === "Text") {
|
|
732
|
+
if (!n) continue;
|
|
733
|
+
z.push({ ...this.itemBase(a, f, "texto", [], 0, I), coordenada: x.coordenada }), P.marcadoresDom++;
|
|
625
734
|
continue;
|
|
626
735
|
}
|
|
627
|
-
if (
|
|
628
|
-
if (!
|
|
629
|
-
|
|
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);
|
|
630
739
|
continue;
|
|
631
740
|
}
|
|
632
741
|
if (!s) {
|
|
633
|
-
|
|
742
|
+
R(f);
|
|
634
743
|
continue;
|
|
635
744
|
}
|
|
636
|
-
const M = a.geom.get(h),
|
|
637
|
-
if (
|
|
638
|
-
|
|
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);
|
|
639
752
|
continue;
|
|
640
753
|
}
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
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++);
|
|
644
758
|
continue;
|
|
645
759
|
}
|
|
646
|
-
const
|
|
647
|
-
|
|
648
|
-
const y = this.estiloDe(a, f);
|
|
649
|
-
P.tipo === "LineString" ? x.push(this.itemBase(a, f, "linha", O.partes, 0, y)) : P.tipo === "Circle" ? m.push(this.itemBase(a, f, "circulo", O.partes, O.raioPx, y)) : m.push(this.itemBase(a, f, "poligono", O.partes, 0, y)), v.desenhadas++, D(f);
|
|
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));
|
|
650
762
|
}
|
|
651
|
-
|
|
652
|
-
const
|
|
653
|
-
for (const h of [
|
|
654
|
-
|
|
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;
|
|
655
770
|
}
|
|
656
771
|
/**
|
|
657
772
|
* Clusters da vista (marcadores DOM). Selecionado nunca entra em cluster; o cluster só aparece com o centro dentro da
|
|
658
773
|
* vista e com 2 ou mais restantes. Os pontos individuais que a seleção solta (o selecionado e o único restante de uma
|
|
659
774
|
* célula) são da sobreposição: o canvas base não depende da seleção.
|
|
660
775
|
*/
|
|
661
|
-
listarClusters(a, e, o,
|
|
662
|
-
const { dados:
|
|
663
|
-
for (const [
|
|
664
|
-
const
|
|
665
|
-
let m = 0,
|
|
666
|
-
for (const
|
|
667
|
-
|
|
668
|
-
const
|
|
669
|
-
|
|
670
|
-
camadaId:
|
|
671
|
-
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,
|
|
672
787
|
forma: "cluster",
|
|
673
788
|
geometriaEmPx: [],
|
|
674
789
|
raioPx: 0,
|
|
675
|
-
estilo:
|
|
790
|
+
estilo: I,
|
|
676
791
|
selecionada: !1,
|
|
677
|
-
coordenada: [
|
|
678
|
-
total:
|
|
679
|
-
restantes:
|
|
792
|
+
coordenada: [p / v, L / v],
|
|
793
|
+
total: u,
|
|
794
|
+
restantes: v
|
|
680
795
|
}), t.clusters++, t.marcadoresDom++));
|
|
681
796
|
}
|
|
682
797
|
}
|
|
683
798
|
/** O ponto está dentro de um cluster neste zoom (não é desenhado nem clicável individualmente)? */
|
|
684
|
-
pontoAgrupado(a,
|
|
685
|
-
const
|
|
686
|
-
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);
|
|
687
802
|
}
|
|
688
803
|
/** O ponto de uma célula de cluster aparece solto: está selecionado ou é o único restante não selecionado? */
|
|
689
|
-
soltoDoCluster(a,
|
|
690
|
-
if (a.dados.selecionadas.has(
|
|
691
|
-
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);
|
|
692
807
|
if (!t) return !1;
|
|
693
808
|
let s = 0;
|
|
694
|
-
for (const
|
|
809
|
+
for (const n of t.membros.keys()) a.dados.selecionadas.has(n) || s++;
|
|
695
810
|
return s === 1;
|
|
696
811
|
}
|
|
697
812
|
/** Membros (id e coordenada) da célula de cluster: o clique no cluster enquadra o grupo. */
|
|
698
|
-
membrosDoCluster(a,
|
|
813
|
+
membrosDoCluster(a, i) {
|
|
699
814
|
var t;
|
|
700
|
-
const
|
|
701
|
-
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 })) : [];
|
|
702
817
|
}
|
|
703
818
|
// ---------------------------------------------------------------- sobreposição (seleção, destaque, edição)
|
|
704
819
|
/**
|
|
705
820
|
* Itens da sobreposição: feições selecionadas, em edição ou destacadas, sempre em detalhe completo e com o estilo
|
|
706
821
|
* de seleção. Custo O(selecionadas): selecionar não repinta o canvas base.
|
|
707
822
|
*/
|
|
708
|
-
listaSobreposicao(a,
|
|
709
|
-
var
|
|
710
|
-
const
|
|
711
|
-
if (!
|
|
712
|
-
this.prepararZoom(
|
|
713
|
-
const
|
|
714
|
-
if (s &&
|
|
715
|
-
const
|
|
716
|
-
for (const
|
|
717
|
-
const
|
|
718
|
-
|
|
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);
|
|
719
834
|
}
|
|
720
|
-
for (const
|
|
721
|
-
const
|
|
722
|
-
if (!
|
|
723
|
-
const
|
|
724
|
-
|
|
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]);
|
|
725
840
|
}
|
|
726
841
|
}
|
|
727
|
-
for (const
|
|
728
|
-
const
|
|
729
|
-
if (!
|
|
730
|
-
const
|
|
731
|
-
if (m.tipo === "Text" ||
|
|
732
|
-
const
|
|
733
|
-
if (
|
|
734
|
-
const L =
|
|
735
|
-
if (!L && !
|
|
736
|
-
const
|
|
737
|
-
if (!
|
|
738
|
-
const
|
|
739
|
-
|
|
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({
|
|
740
855
|
camadaId: a,
|
|
741
|
-
id:
|
|
742
|
-
forma:
|
|
743
|
-
geometriaEmPx:
|
|
744
|
-
raioPx:
|
|
745
|
-
estilo:
|
|
856
|
+
id: l,
|
|
857
|
+
forma: A,
|
|
858
|
+
geometriaEmPx: v.partes,
|
|
859
|
+
raioPx: v.raioPx,
|
|
860
|
+
estilo: O,
|
|
746
861
|
selecionada: L,
|
|
747
|
-
feicao:
|
|
748
|
-
...
|
|
862
|
+
feicao: u,
|
|
863
|
+
...e.destaques.has(l) ? { destaque: !0 } : {}
|
|
749
864
|
});
|
|
750
865
|
}
|
|
751
866
|
return {
|
|
752
867
|
camadaId: a,
|
|
753
|
-
zIndex:
|
|
754
|
-
opacidade:
|
|
755
|
-
itens:
|
|
756
|
-
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 }
|
|
757
872
|
};
|
|
758
873
|
}
|
|
759
874
|
/** A seleção da camada toca pontos sob agrupamento ativo? (então o conjunto de clusters muda e o base precisa refazer) */
|
|
760
|
-
selecaoAfetaAgrupamento(a,
|
|
761
|
-
var
|
|
762
|
-
const
|
|
763
|
-
if (!
|
|
764
|
-
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;
|
|
765
880
|
return !1;
|
|
766
881
|
}
|
|
767
882
|
}
|
|
768
883
|
export {
|
|
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
|
-
|
|
824
|
-
|
|
825
|
-
|
|
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
|
|
826
945
|
};
|