@urban-toolkit/autk-grammar 5.1.0 → 5.3.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/README.md +222 -1
- package/build/autk-grammar-schema.json +844 -24
- package/dist/autk-grammar.js +942 -671
- package/dist/autk-grammar.js.map +1 -1
- package/dist/autk-grammar.umd.cjs +2 -2
- package/dist/autk-grammar.umd.cjs.map +1 -1
- package/dist/data/autk-grammar-data.cjs +1 -1
- package/dist/data/autk-grammar-data.cjs.map +1 -1
- package/dist/data/autk-grammar-data.js +98 -94
- package/dist/data/autk-grammar-data.js.map +1 -1
- package/dist/index.d.ts +261 -13
- package/package.json +1 -1
package/dist/autk-grammar.js
CHANGED
|
@@ -1,601 +1,831 @@
|
|
|
1
|
-
import { DEFAULT_WORKSPACE_NAME as
|
|
2
|
-
import { AutkMap as
|
|
3
|
-
import { AutkPlot as
|
|
4
|
-
import { ColorMapInterpolator as
|
|
5
|
-
import { AutkComputeEngine as
|
|
6
|
-
function
|
|
7
|
-
const { spec: e, adapters:
|
|
8
|
-
let
|
|
1
|
+
import { DEFAULT_WORKSPACE_NAME as U, isVectorTable as Ht, AutkDb as Jt, isRenderableTable as Et, DEFAULT_WORKSPACE_COORDINATE_FORMAT as qt } from "@urban-toolkit/autk-db";
|
|
2
|
+
import { AutkMap as nt, MapEvent as J } from "@urban-toolkit/autk-map";
|
|
3
|
+
import { AutkPlot as Kt, PlotStyle as F, PlotEvent as B } from "@urban-toolkit/autk-plot";
|
|
4
|
+
import { ColorMapDomainStrategy as A, ColorMapInterpolator as _t, ColorMap as P, valueAtPath as zt } from "@urban-toolkit/autk-core";
|
|
5
|
+
import { AutkComputeEngine as at } from "@urban-toolkit/autk-compute";
|
|
6
|
+
function Xt(t) {
|
|
7
|
+
const { spec: e, adapters: o } = t;
|
|
8
|
+
let r;
|
|
9
9
|
async function n() {
|
|
10
|
-
let
|
|
11
|
-
if (e.workspaces?.length &&
|
|
12
|
-
for (const
|
|
13
|
-
|
|
10
|
+
let l;
|
|
11
|
+
if (e.workspaces?.length && o.db.resolveWorkspaces && (l = await o.db.resolveWorkspaces(l, e.workspaces)), e.data)
|
|
12
|
+
for (const s of e.data)
|
|
13
|
+
l = await o.db.resolveSource(l, s);
|
|
14
14
|
if (e.compute)
|
|
15
|
-
for (const
|
|
16
|
-
|
|
15
|
+
for (const s of e.compute)
|
|
16
|
+
l = await o.compute.resolveCompute(l, s);
|
|
17
17
|
if (e.map)
|
|
18
18
|
if (Array.isArray(e.map))
|
|
19
|
-
for (let
|
|
20
|
-
let u = e.map[
|
|
21
|
-
await
|
|
19
|
+
for (let s = 0; s < e.map.length; s++) {
|
|
20
|
+
let u = e.map[s];
|
|
21
|
+
await o.map.resolveMap(l, u, s);
|
|
22
22
|
}
|
|
23
23
|
else
|
|
24
|
-
await
|
|
24
|
+
await o.map.resolveMap(l, e.map);
|
|
25
25
|
if (e.plot)
|
|
26
26
|
if (Array.isArray(e.plot))
|
|
27
|
-
for (let
|
|
28
|
-
await
|
|
27
|
+
for (let s = 0; s < e.plot.length; s++)
|
|
28
|
+
await o.plot.resolvePlot(l, e.plot[s], s);
|
|
29
29
|
else
|
|
30
|
-
await
|
|
31
|
-
|
|
30
|
+
await o.plot.resolvePlot(l, e.plot);
|
|
31
|
+
r = l;
|
|
32
32
|
}
|
|
33
|
-
function
|
|
34
|
-
return console.log("Spec to update",
|
|
35
|
-
|
|
33
|
+
function i(l) {
|
|
34
|
+
return console.log("Spec to update", l), new Promise((s) => {
|
|
35
|
+
s();
|
|
36
36
|
});
|
|
37
37
|
}
|
|
38
38
|
function a() {
|
|
39
39
|
console.log("Function not implemented yet");
|
|
40
40
|
}
|
|
41
|
-
return { run: n, updatedSpec:
|
|
42
|
-
return
|
|
41
|
+
return { run: n, updatedSpec: i, destroy: a, get context() {
|
|
42
|
+
return r;
|
|
43
43
|
} };
|
|
44
44
|
}
|
|
45
|
-
function
|
|
45
|
+
function it(t) {
|
|
46
46
|
return t === void 0 ? [] : Array.isArray(t) ? t : [t];
|
|
47
47
|
}
|
|
48
|
-
function
|
|
49
|
-
const e = t.layout ?? {},
|
|
50
|
-
if (
|
|
51
|
-
throw new Error(`Layout type must be vertical, horizontal or grid, not ${JSON.stringify(
|
|
52
|
-
const
|
|
53
|
-
if (typeof
|
|
54
|
-
throw new Error(`Layout gap must be a number of pixels, 0 or more, not ${JSON.stringify(
|
|
48
|
+
function go(t) {
|
|
49
|
+
const e = t.layout ?? {}, o = e.type ?? "vertical";
|
|
50
|
+
if (o !== "vertical" && o !== "horizontal" && o !== "grid")
|
|
51
|
+
throw new Error(`Layout type must be vertical, horizontal or grid, not ${JSON.stringify(o)}.`);
|
|
52
|
+
const r = e.gap ?? 0;
|
|
53
|
+
if (typeof r != "number" || !Number.isFinite(r) || r < 0)
|
|
54
|
+
throw new Error(`Layout gap must be a number of pixels, 0 or more, not ${JSON.stringify(r)}.`);
|
|
55
55
|
const n = e.columns ?? 2;
|
|
56
56
|
if (!Number.isInteger(n) || n < 1)
|
|
57
57
|
throw new Error(`Layout columns must be a whole number, 1 or more, not ${JSON.stringify(n)}.`);
|
|
58
|
-
const
|
|
59
|
-
...
|
|
60
|
-
...
|
|
61
|
-
], a =
|
|
62
|
-
kind:
|
|
58
|
+
const i = [
|
|
59
|
+
...it(t.map).map((s, u) => ({ kind: "map", index: u, id: s.id, key: s.id ?? u })),
|
|
60
|
+
...it(t.plot).map((s, u) => ({ kind: "plot", index: u, id: s.id, key: s.id ?? s.dataRef }))
|
|
61
|
+
], a = o === "vertical" ? 1 : o === "horizontal" ? Math.max(i.length, 1) : n, l = i.map(({ kind: s, index: u, id: d, key: f }, c) => ({
|
|
62
|
+
kind: s,
|
|
63
63
|
index: u,
|
|
64
64
|
...d !== void 0 && { id: d },
|
|
65
|
-
key:
|
|
66
|
-
row: Math.floor(
|
|
67
|
-
column:
|
|
65
|
+
key: f,
|
|
66
|
+
row: Math.floor(c / a),
|
|
67
|
+
column: c % a
|
|
68
68
|
}));
|
|
69
|
-
return { type:
|
|
69
|
+
return { type: o, rows: Math.ceil(i.length / a), columns: a, gap: r, panes: l };
|
|
70
70
|
}
|
|
71
|
-
var
|
|
71
|
+
var Zt = /* @__PURE__ */ ((t) => (t.CAT_ACCENT = "schemeAccent", t.CAT_DARK2 = "schemeDark2", t.CAT_CATEGORY10 = "schemeCategory10", t.CAT_OBSERVABLE10 = "schemeObservable10", t.CAT_PAIRED = "schemePaired", t.CAT_PASTEL1 = "schemePastel1", t.CAT_PASTEL2 = "schemePastel2", t.CAT_SET1 = "schemeSet1", t.CAT_SET2 = "schemeSet2", t.CAT_SET3 = "schemeSet3", t.CAT_TABLEAU10 = "schemeTableau10", t.SEQ_REDS = "interpolateReds", t.SEQ_BLUES = "interpolateBlues", t.SEQ_GREENS = "interpolateGreens", t.SEQ_GREYS = "interpolateGreys", t.SEQ_ORANGES = "interpolateOranges", t.SEQ_PURPLES = "interpolatePurples", t.SEQ_TURBO = "interpolateTurbo", t.SEQ_VIRIDIS = "interpolateViridis", t.SEQ_INFERNO = "interpolateInferno", t.SEQ_MAGMA = "interpolateMagma", t.SEQ_PLASMA = "interpolatePlasma", t.SEQ_CIVIDIS = "interpolateCividis", t.SEQ_WARM = "interpolateWarm", t.SEQ_COOL = "interpolateCool", t.SEQ_CUBEHELIX_DEFAULT = "interpolateCubehelixDefault", t.SEQ_BU_GN = "interpolateBuGn", t.SEQ_BU_PU = "interpolateBuPu", t.SEQ_GN_BU = "interpolateGnBu", t.SEQ_OR_RD = "interpolateOrRd", t.SEQ_PU_BU_GN = "interpolatePuBuGn", t.SEQ_PU_BU = "interpolatePuBu", t.SEQ_PU_RD = "interpolatePuRd", t.SEQ_RD_PU = "interpolateRdPu", t.SEQ_YL_GN_BU = "interpolateYlGnBu", t.SEQ_YL_GN = "interpolateYlGn", t.SEQ_YL_OR_BR = "interpolateYlOrBr", t.SEQ_YL_OR_RD = "interpolateYlOrRd", t.DIV_BR_BG = "interpolateBrBG", t.DIV_PR_GN = "interpolatePRGn", t.DIV_PI_YG = "interpolatePiYG", t.DIV_PU_OR = "interpolatePuOr", t.DIV_RED_BLUE = "interpolateRdBu", t.DIV_RED_GREY = "interpolateRdGy", t.DIV_RED_YELLOW_BLUE = "interpolateRdYlBu", t.DIV_RED_YELLOW_GREEN = "interpolateRdYlGn", t.DIV_SPECTRAL = "interpolateSpectral", t))(Zt || {}), Ct = /* @__PURE__ */ ((t) => (t.MIN_MAX = "minMax", t.PERCENTILE = "percentile", t))(Ct || {});
|
|
72
72
|
async function I(t, e) {
|
|
73
|
-
const
|
|
74
|
-
t.getCurrentWorkspace() !==
|
|
73
|
+
const o = e ?? U;
|
|
74
|
+
t.getCurrentWorkspace() !== o && await t.setWorkspace(o);
|
|
75
|
+
}
|
|
76
|
+
function E(t, e) {
|
|
77
|
+
return t === void 0 || t === U ? e : `${t}/${e}`;
|
|
78
|
+
}
|
|
79
|
+
const te = /* @__PURE__ */ Symbol.for("@urban-toolkit/autk-grammar:source-crs"), ee = globalThis, $t = ee[te] ??= /* @__PURE__ */ new WeakMap();
|
|
80
|
+
function oe(t, e) {
|
|
81
|
+
$t.set(t, e);
|
|
75
82
|
}
|
|
76
|
-
function
|
|
77
|
-
|
|
83
|
+
function re(t, e) {
|
|
84
|
+
const o = t && $t.get(t);
|
|
85
|
+
return o !== void 0 && o.toUpperCase() === e.toUpperCase() ? t : void 0;
|
|
78
86
|
}
|
|
79
|
-
function
|
|
87
|
+
function Mt(t) {
|
|
80
88
|
const e = /* @__PURE__ */ new Set();
|
|
81
|
-
for (const
|
|
82
|
-
|
|
83
|
-
const
|
|
84
|
-
return t.map((
|
|
85
|
-
if (
|
|
86
|
-
let
|
|
87
|
-
for (; e.has(JSON.stringify(
|
|
88
|
-
return
|
|
89
|
+
for (const r of t)
|
|
90
|
+
r?.id != null && e.add(JSON.stringify(r.id));
|
|
91
|
+
const o = /* @__PURE__ */ new Set();
|
|
92
|
+
return t.map((r, n) => {
|
|
93
|
+
if (r?.id != null) return r.id;
|
|
94
|
+
let i = `autk-feature-${n}`;
|
|
95
|
+
for (; e.has(JSON.stringify(i)) || o.has(JSON.stringify(i)); ) i = `${i}-generated`;
|
|
96
|
+
return o.add(JSON.stringify(i)), i;
|
|
89
97
|
});
|
|
90
98
|
}
|
|
91
|
-
function
|
|
99
|
+
function kt(t) {
|
|
92
100
|
const e = /* @__PURE__ */ new Map();
|
|
93
|
-
return
|
|
94
|
-
const
|
|
95
|
-
return e.set(
|
|
101
|
+
return Mt(t).map((o) => {
|
|
102
|
+
const r = JSON.stringify(o), n = e.get(r) ?? 0;
|
|
103
|
+
return e.set(r, n + 1), n === 0 ? r : `${r} ${n}`;
|
|
96
104
|
});
|
|
97
105
|
}
|
|
98
|
-
const
|
|
99
|
-
function
|
|
100
|
-
let e =
|
|
101
|
-
return e || (e = /* @__PURE__ */ new Map(), t.forEach((
|
|
102
|
-
const n = e.get(
|
|
103
|
-
n ? n.push(
|
|
104
|
-
}),
|
|
105
|
-
}
|
|
106
|
-
function
|
|
107
|
-
const
|
|
108
|
-
for (const
|
|
109
|
-
const a = e[
|
|
106
|
+
const st = /* @__PURE__ */ new WeakMap();
|
|
107
|
+
function ne(t) {
|
|
108
|
+
let e = st.get(t);
|
|
109
|
+
return e || (e = /* @__PURE__ */ new Map(), t.forEach((o, r) => {
|
|
110
|
+
const n = e.get(o);
|
|
111
|
+
n ? n.push(r) : e.set(o, [r]);
|
|
112
|
+
}), st.set(t, e), e);
|
|
113
|
+
}
|
|
114
|
+
function D(t, e, o) {
|
|
115
|
+
const r = ne(o), n = /* @__PURE__ */ new Set();
|
|
116
|
+
for (const i of t) {
|
|
117
|
+
const a = e[i];
|
|
110
118
|
if (a !== void 0)
|
|
111
|
-
for (const
|
|
119
|
+
for (const l of r.get(a) ?? []) n.add(l);
|
|
112
120
|
}
|
|
113
121
|
return [...n];
|
|
114
122
|
}
|
|
115
|
-
const
|
|
116
|
-
function
|
|
117
|
-
const e = t.features ?? [],
|
|
118
|
-
let
|
|
119
|
-
const n = e.map((a,
|
|
120
|
-
return
|
|
123
|
+
const ae = { type: "GeometryCollection", geometries: [] };
|
|
124
|
+
function ie(t) {
|
|
125
|
+
const e = t.features ?? [], o = Mt(e);
|
|
126
|
+
let r = !1;
|
|
127
|
+
const n = e.map((a, l) => a == null || a.id != null && a.geometry != null ? a : (r = !0, { ...a, id: o[l], geometry: a.geometry ?? ae })), i = e.findIndex((a) => a?.geometry != null);
|
|
128
|
+
return i > 0 && e[0] != null && e[0].geometry == null && ([n[0], n[i]] = [n[i], n[0]], r = !0), r ? { ...t, features: n } : t;
|
|
121
129
|
}
|
|
122
|
-
function
|
|
130
|
+
function se(t) {
|
|
123
131
|
const { queryArea: e } = t;
|
|
124
132
|
if (e.bbox === void 0) return { geocodeArea: e.geocodeArea, areas: e.areas };
|
|
125
|
-
const
|
|
133
|
+
const o = (s) => new Error(`OSM source "${t.outputTableName}": ${s}`);
|
|
126
134
|
if (e.geocodeArea !== void 0 || e.areas !== void 0)
|
|
127
|
-
throw
|
|
128
|
-
const
|
|
129
|
-
if (!Array.isArray(
|
|
130
|
-
throw
|
|
131
|
-
const [n,
|
|
135
|
+
throw o("queryArea takes either bbox or geocodeArea with areas, not both.");
|
|
136
|
+
const r = e.bbox;
|
|
137
|
+
if (!Array.isArray(r) || r.length !== 4 || !r.every((s) => typeof s == "number" && Number.isFinite(s)))
|
|
138
|
+
throw o("queryArea.bbox must hold four numbers, [west, south, east, north] in degrees.");
|
|
139
|
+
const [n, i, a, l] = e.bbox;
|
|
132
140
|
if (Math.abs(n) > 180 || Math.abs(a) > 180)
|
|
133
|
-
throw
|
|
134
|
-
if (Math.abs(
|
|
135
|
-
throw
|
|
141
|
+
throw o("queryArea.bbox west and east must be longitudes from -180 to 180.");
|
|
142
|
+
if (Math.abs(i) > 90 || Math.abs(l) > 90)
|
|
143
|
+
throw o("queryArea.bbox south and north must be latitudes from -90 to 90.");
|
|
136
144
|
if (n >= a)
|
|
137
|
-
throw
|
|
138
|
-
if (
|
|
139
|
-
throw
|
|
140
|
-
return { bbox: [n,
|
|
145
|
+
throw o(`queryArea.bbox west (${n}) must be less than east (${a}); a box across the antimeridian is not supported.`);
|
|
146
|
+
if (i >= l)
|
|
147
|
+
throw o(`queryArea.bbox south (${i}) must be less than north (${l}).`);
|
|
148
|
+
return { bbox: [n, i, a, l] };
|
|
141
149
|
}
|
|
142
|
-
function
|
|
143
|
-
const { autoLoadLayers: e, ...
|
|
150
|
+
function le(t) {
|
|
151
|
+
const { autoLoadLayers: e, ...o } = t;
|
|
144
152
|
if (t.pbfFileUrl !== void 0 && (t.tagSets?.length ?? 0) > 0)
|
|
145
153
|
throw new Error(`OSM source "${t.outputTableName}": tagSets are read from the Overpass API only, so a source with pbfFileUrl cannot take them.`);
|
|
146
154
|
return {
|
|
147
|
-
...
|
|
148
|
-
queryArea:
|
|
155
|
+
...o,
|
|
156
|
+
queryArea: se(t),
|
|
149
157
|
autoLoadLayers: {
|
|
150
158
|
layers: e?.layers ?? [],
|
|
151
159
|
...e?.coordinateFormat !== void 0 && { coordinateFormat: e.coordinateFormat }
|
|
152
160
|
}
|
|
153
161
|
};
|
|
154
162
|
}
|
|
155
|
-
function
|
|
163
|
+
function lt(t) {
|
|
156
164
|
return `${t ? `coordinateFormat is set to "${t}"` : "no coordinateFormat was specified, so it defaults to EPSG:4326 (WGS84 per RFC 7946)"}. Verify that coordinateFormat matches the actual CRS of the input data.`;
|
|
157
165
|
}
|
|
158
|
-
function
|
|
159
|
-
return t === void 0 || t ===
|
|
166
|
+
function V(t) {
|
|
167
|
+
return t === void 0 || t === U ? "the default workspace" : `the workspace "${t}"`;
|
|
160
168
|
}
|
|
161
|
-
function
|
|
169
|
+
function ut(t) {
|
|
162
170
|
if (t != null)
|
|
163
171
|
return typeof t == "string" ? t : JSON.stringify(t);
|
|
164
172
|
}
|
|
165
|
-
async function
|
|
173
|
+
async function ue(t, e, o, r) {
|
|
166
174
|
const n = /* @__PURE__ */ new Map();
|
|
167
|
-
for (const
|
|
168
|
-
const
|
|
169
|
-
if (
|
|
170
|
-
if (
|
|
175
|
+
for (const l of (await t.getLayer(e.name)).features) {
|
|
176
|
+
const s = ut(l.properties?.[r]);
|
|
177
|
+
if (s !== void 0) {
|
|
178
|
+
if (l.id === void 0 || l.id === null)
|
|
171
179
|
throw new Error("its rows have no feature id to update them by.");
|
|
172
|
-
n.set(
|
|
180
|
+
n.set(s, [...n.get(s) ?? [], l.id]);
|
|
173
181
|
}
|
|
174
182
|
}
|
|
175
|
-
const
|
|
176
|
-
const
|
|
177
|
-
return
|
|
178
|
-
}), a = e.columns.some((
|
|
179
|
-
return { data: { ...
|
|
183
|
+
const i = o.features.flatMap((l) => {
|
|
184
|
+
const s = ut(l.properties?.[r]);
|
|
185
|
+
return s === void 0 ? [] : (n.get(s) ?? []).map((u) => ({ ...l, id: u }));
|
|
186
|
+
}), a = e.columns.some((l) => l.name === "geojson_id") ? "geojson_id" : "id";
|
|
187
|
+
return { data: { ...o, features: i }, idColumn: a };
|
|
180
188
|
}
|
|
181
|
-
async function
|
|
189
|
+
async function ft(t) {
|
|
182
190
|
if (t) return t;
|
|
183
|
-
const e = new
|
|
191
|
+
const e = new Jt();
|
|
184
192
|
return await e.init(), e;
|
|
185
193
|
}
|
|
186
|
-
function
|
|
187
|
-
let e = 1 / 0,
|
|
188
|
-
const
|
|
189
|
-
if (Array.isArray(
|
|
190
|
-
if (typeof
|
|
191
|
-
const [
|
|
192
|
-
|
|
194
|
+
function Rt(t) {
|
|
195
|
+
let e = 1 / 0, o = 1 / 0, r = -1 / 0, n = -1 / 0;
|
|
196
|
+
const i = (l) => {
|
|
197
|
+
if (Array.isArray(l)) {
|
|
198
|
+
if (typeof l[0] == "number") {
|
|
199
|
+
const [s, u] = l;
|
|
200
|
+
s < e && (e = s), s > r && (r = s), u < o && (o = u), u > n && (n = u);
|
|
193
201
|
return;
|
|
194
202
|
}
|
|
195
|
-
for (const
|
|
203
|
+
for (const s of l) i(s);
|
|
196
204
|
}
|
|
197
|
-
}, a = (
|
|
198
|
-
|
|
205
|
+
}, a = (l) => {
|
|
206
|
+
l && (l.type === "GeometryCollection" ? l.geometries.forEach(a) : i(l.coordinates));
|
|
199
207
|
};
|
|
200
|
-
for (const
|
|
201
|
-
return e <=
|
|
208
|
+
for (const l of t.features ?? []) a(l?.geometry);
|
|
209
|
+
return e <= r ? [e, o, r, n] : void 0;
|
|
202
210
|
}
|
|
203
|
-
function
|
|
204
|
-
function
|
|
205
|
-
if (!
|
|
211
|
+
function fe(t, e) {
|
|
212
|
+
function o(n, i) {
|
|
213
|
+
if (!i || !i.db)
|
|
206
214
|
return;
|
|
207
|
-
const a = document.getElementById(
|
|
215
|
+
const a = document.getElementById(i.db);
|
|
208
216
|
if (a) {
|
|
209
|
-
const
|
|
217
|
+
const l = n.getTablesMetadata();
|
|
210
218
|
a.innerHTML += "<ul>";
|
|
211
|
-
for (const
|
|
212
|
-
a.innerHTML += `<li>${
|
|
213
|
-
a.innerHTML += "</ul>", a.innerHTML += `<p>Number of tables: ${
|
|
219
|
+
for (const s of l)
|
|
220
|
+
a.innerHTML += `<li>${s.name}: (${s.source}, ${s.type}) </li>`;
|
|
221
|
+
a.innerHTML += "</ul>", a.innerHTML += `<p>Number of tables: ${l.length}</p>`;
|
|
214
222
|
}
|
|
215
223
|
}
|
|
216
|
-
async function
|
|
224
|
+
async function r(n, i, a) {
|
|
217
225
|
if (!e) return;
|
|
218
|
-
const
|
|
219
|
-
|
|
226
|
+
const l = E(i, a), s = n.getTablesMetadata().find((u) => u.name === a);
|
|
227
|
+
s && Et(s) ? e.set(l, await n.getLayer(a)) : e.delete(l);
|
|
220
228
|
}
|
|
221
229
|
return {
|
|
222
|
-
async resolveWorkspaces(n,
|
|
223
|
-
const a = await
|
|
224
|
-
for (const { name:
|
|
225
|
-
const
|
|
226
|
-
if (
|
|
227
|
-
throw new Error(`workspaces sets ${
|
|
228
|
-
|
|
230
|
+
async resolveWorkspaces(n, i) {
|
|
231
|
+
const a = await ft(n), l = /* @__PURE__ */ new Set();
|
|
232
|
+
for (const { name: s, coordinateFormat: u, precisionGrid: d } of i) {
|
|
233
|
+
const f = s ?? U;
|
|
234
|
+
if (l.has(f))
|
|
235
|
+
throw new Error(`workspaces sets ${V(s)} twice; give each workspace one entry.`);
|
|
236
|
+
l.add(f);
|
|
229
237
|
try {
|
|
230
|
-
await a.setWorkspace(
|
|
231
|
-
} catch (
|
|
232
|
-
throw new Error(`workspaces, ${
|
|
238
|
+
await a.setWorkspace(f, { coordinateFormat: u, precisionGrid: d });
|
|
239
|
+
} catch (c) {
|
|
240
|
+
throw new Error(`workspaces, ${V(s)}: ${c instanceof Error ? c.message : String(c)}`);
|
|
233
241
|
}
|
|
234
242
|
}
|
|
235
243
|
return await I(a), a;
|
|
236
244
|
},
|
|
237
|
-
async resolveSource(n,
|
|
238
|
-
const a = await
|
|
239
|
-
await I(a,
|
|
240
|
-
let { type:
|
|
241
|
-
switch (
|
|
245
|
+
async resolveSource(n, i) {
|
|
246
|
+
const a = await ft(n), { workspace: l } = i;
|
|
247
|
+
await I(a, l);
|
|
248
|
+
let { type: s, workspace: u, ...d } = i;
|
|
249
|
+
switch (s) {
|
|
242
250
|
case "osm":
|
|
243
|
-
return await a.loadOsm(
|
|
251
|
+
return await a.loadOsm(le(d)), o(a, t), a;
|
|
244
252
|
case "csv":
|
|
245
|
-
return await a.loadCsv(d),
|
|
253
|
+
return await a.loadCsv(d), o(a, t), a;
|
|
246
254
|
case "json":
|
|
247
|
-
return await a.loadJson(d),
|
|
255
|
+
return await a.loadJson(d), o(a, t), a;
|
|
248
256
|
case "geojson": {
|
|
249
|
-
const
|
|
250
|
-
let
|
|
251
|
-
|
|
252
|
-
const
|
|
253
|
-
const p = { ...
|
|
257
|
+
const f = d;
|
|
258
|
+
let c;
|
|
259
|
+
f.geojsonFileUrl ? c = await (await fetch(f.geojsonFileUrl)).json() : c = f.geojsonObject, e && c && (e.set(E(l, f.outputTableName), c), oe(c, f.coordinateFormat ?? "EPSG:4326"));
|
|
260
|
+
const h = c ? (() => {
|
|
261
|
+
const p = { ...f, geojsonObject: ie(c) };
|
|
254
262
|
return delete p.geojsonFileUrl, p;
|
|
255
|
-
})() :
|
|
256
|
-
if (
|
|
263
|
+
})() : f, m = /^EPSG:4326$/i.test(h.coordinateFormat ?? "EPSG:4326"), y = c && m ? Rt(c) : void 0;
|
|
264
|
+
if (y && (y[1] < -90 || y[3] > 90))
|
|
257
265
|
throw new Error(
|
|
258
|
-
`GeoJSON layer "${
|
|
266
|
+
`GeoJSON layer "${h.outputTableName}" has y coordinates outside -90 to 90 (bbox: [${y.join(", ")}]), so they cannot be EPSG:4326 degrees. ${lt(h.coordinateFormat)}`
|
|
259
267
|
);
|
|
260
268
|
try {
|
|
261
|
-
await a.loadGeojson(
|
|
269
|
+
await a.loadGeojson(h);
|
|
262
270
|
} catch (p) {
|
|
263
|
-
throw new Error(`Failed to load GeoJSON layer "${
|
|
271
|
+
throw new Error(`Failed to load GeoJSON layer "${h.outputTableName}": ${p instanceof Error ? p.message : String(p)}`);
|
|
264
272
|
}
|
|
265
273
|
try {
|
|
266
|
-
const p = await a.getBoundingBoxFromLayer(
|
|
267
|
-
if (!isFinite(p.minLon) || !isFinite(p.minLat) || !isFinite(p.maxLon) || !isFinite(p.maxLat) || Math.abs(p.minLon) >
|
|
274
|
+
const p = await a.getBoundingBoxFromLayer(h.outputTableName), g = 25e6;
|
|
275
|
+
if (!isFinite(p.minLon) || !isFinite(p.minLat) || !isFinite(p.maxLon) || !isFinite(p.maxLat) || Math.abs(p.minLon) > g || Math.abs(p.maxLon) > g || Math.abs(p.minLat) > g || Math.abs(p.maxLat) > g)
|
|
268
276
|
throw new Error(
|
|
269
|
-
`Geometry bounding box after transform is invalid for layer "${
|
|
277
|
+
`Geometry bounding box after transform is invalid for layer "${h.outputTableName}" (bbox: [${p.minLon}, ${p.minLat}, ${p.maxLon}, ${p.maxLat}]). ${lt(h.coordinateFormat)} The workspace uses ${a.getWorkspaceConfiguration().coordinateFormat}; input is expected in EPSG:4326 by default.`
|
|
270
278
|
);
|
|
271
279
|
} catch (p) {
|
|
272
280
|
if (p instanceof Error && p.message.includes("bounding box after transform")) throw p;
|
|
273
281
|
}
|
|
274
|
-
return
|
|
282
|
+
return o(a, t), a;
|
|
275
283
|
}
|
|
276
284
|
case "geotiff":
|
|
277
|
-
return await a.loadGeoTiff(d),
|
|
285
|
+
return await a.loadGeoTiff(d), o(a, t), a;
|
|
278
286
|
case "heatmap": {
|
|
279
|
-
const
|
|
280
|
-
if (
|
|
281
|
-
throw new Error(`Heatmap "${
|
|
287
|
+
const f = d;
|
|
288
|
+
if (f.groupBy?.some((c) => c.aggregateFn === "collect"))
|
|
289
|
+
throw new Error(`Heatmap "${f.outputTableName}": aggregateFn "collect" lists the rows near a cell, and a cell holds one value; use sum, avg, count, min, max or weighted.`);
|
|
282
290
|
return await a.buildHeatmap({
|
|
283
|
-
tableJoinName:
|
|
284
|
-
near:
|
|
285
|
-
outputTableName:
|
|
286
|
-
grid:
|
|
287
|
-
...
|
|
288
|
-
}),
|
|
291
|
+
tableJoinName: f.joinDataRef,
|
|
292
|
+
near: f.near,
|
|
293
|
+
outputTableName: f.outputTableName,
|
|
294
|
+
grid: f.grid,
|
|
295
|
+
...f.groupBy && { groupBy: f.groupBy }
|
|
296
|
+
}), o(a, t), a;
|
|
289
297
|
}
|
|
290
298
|
case "join": {
|
|
291
|
-
const
|
|
299
|
+
const f = d;
|
|
292
300
|
if (await a.spatialQuery({
|
|
293
|
-
tableRootName:
|
|
294
|
-
tableJoinName:
|
|
295
|
-
...
|
|
296
|
-
...
|
|
301
|
+
tableRootName: f.dataRef,
|
|
302
|
+
tableJoinName: f.joinDataRef,
|
|
303
|
+
...f.near && { near: f.near },
|
|
304
|
+
...f.groupBy && { groupBy: f.groupBy }
|
|
297
305
|
}), e) {
|
|
298
|
-
const
|
|
299
|
-
e.set(
|
|
306
|
+
const c = await a.getLayer(f.dataRef);
|
|
307
|
+
e.set(E(l, f.dataRef), c);
|
|
300
308
|
}
|
|
301
|
-
return
|
|
309
|
+
return o(a, t), a;
|
|
302
310
|
}
|
|
303
311
|
case "sql": {
|
|
304
|
-
const
|
|
312
|
+
const f = d;
|
|
305
313
|
try {
|
|
306
314
|
await a.rawQuery({
|
|
307
|
-
query:
|
|
315
|
+
query: f.query,
|
|
308
316
|
output: {
|
|
309
317
|
type: "CREATE_TABLE",
|
|
310
|
-
tableName:
|
|
318
|
+
tableName: f.outputTableName,
|
|
311
319
|
source: "user",
|
|
312
|
-
...
|
|
320
|
+
...f.layerType !== void 0 && { tableType: f.layerType }
|
|
313
321
|
}
|
|
314
322
|
});
|
|
315
|
-
} catch (
|
|
316
|
-
throw new Error(`SQL source "${
|
|
323
|
+
} catch (c) {
|
|
324
|
+
throw new Error(`SQL source "${f.outputTableName}": ${c instanceof Error ? c.message : String(c)}`);
|
|
317
325
|
}
|
|
318
|
-
return e?.delete(
|
|
326
|
+
return e?.delete(E(l, f.outputTableName)), o(a, t), a;
|
|
319
327
|
}
|
|
320
328
|
case "update": {
|
|
321
|
-
const
|
|
322
|
-
if (
|
|
323
|
-
throw
|
|
324
|
-
if (
|
|
325
|
-
throw
|
|
326
|
-
let
|
|
329
|
+
const f = d, c = (y) => new Error(`Update of "${f.dataRef}": ${y}`);
|
|
330
|
+
if (f.geojsonObject === void 0 == (f.jsonObject === void 0))
|
|
331
|
+
throw c("give its rows in geojsonObject or in jsonObject, one of the two.");
|
|
332
|
+
if (f.strategy === "update" && !f.idColumn)
|
|
333
|
+
throw c("the update strategy needs an idColumn, the column that matches a given row to the table's rows.");
|
|
334
|
+
let h = f.geojsonObject ?? f.jsonObject, m = f.idColumn;
|
|
327
335
|
try {
|
|
328
|
-
const
|
|
329
|
-
if (
|
|
330
|
-
return
|
|
336
|
+
const y = a.getTablesMetadata().find((p) => p.name === f.dataRef);
|
|
337
|
+
if (f.strategy === "update" && f.geojsonObject && m?.startsWith("properties.") && y && Ht(y) && ({ data: h, idColumn: m } = await ue(a, y, f.geojsonObject, m.slice(11)), h.features.length === 0))
|
|
338
|
+
return o(a, t), a;
|
|
331
339
|
await a.updateTable({
|
|
332
|
-
tableName:
|
|
333
|
-
data:
|
|
334
|
-
strategy:
|
|
340
|
+
tableName: f.dataRef,
|
|
341
|
+
data: h,
|
|
342
|
+
strategy: f.strategy,
|
|
335
343
|
...m !== void 0 && { idColumn: m }
|
|
336
344
|
});
|
|
337
|
-
} catch (
|
|
338
|
-
throw
|
|
345
|
+
} catch (y) {
|
|
346
|
+
throw c(y instanceof Error ? y.message : String(y));
|
|
339
347
|
}
|
|
340
|
-
return await
|
|
348
|
+
return await r(a, l, f.dataRef), o(a, t), a;
|
|
341
349
|
}
|
|
342
350
|
case "drop": {
|
|
343
|
-
const
|
|
344
|
-
if (!a.getTablesMetadata().some((
|
|
345
|
-
throw new Error(`Drop of "${
|
|
346
|
-
return await a.removeLayer(
|
|
351
|
+
const f = d;
|
|
352
|
+
if (!a.getTablesMetadata().some((c) => c.name === f.dataRef))
|
|
353
|
+
throw new Error(`Drop of "${f.dataRef}": ${V(l)} holds no table of that name.`);
|
|
354
|
+
return await a.removeLayer(f.dataRef), e?.delete(E(l, f.dataRef)), o(a, t), a;
|
|
347
355
|
}
|
|
348
356
|
default:
|
|
349
|
-
throw new Error(`Unknown data source type "${String(
|
|
357
|
+
throw new Error(`Unknown data source type "${String(s)}".`);
|
|
350
358
|
}
|
|
351
359
|
}
|
|
352
360
|
};
|
|
353
361
|
}
|
|
354
|
-
function
|
|
362
|
+
function St(t, e) {
|
|
355
363
|
return e === !0 ? `${t} osm-elements` : t;
|
|
356
364
|
}
|
|
357
|
-
function
|
|
365
|
+
function At(t) {
|
|
358
366
|
return t === !0 ? { osmElements: !0 } : void 0;
|
|
359
367
|
}
|
|
360
|
-
function
|
|
361
|
-
if (!t) return
|
|
362
|
-
let
|
|
363
|
-
return
|
|
368
|
+
function It(t, e, o) {
|
|
369
|
+
if (!t) return o();
|
|
370
|
+
let r = t.get(e);
|
|
371
|
+
return r || (r = o(), t.set(e, r)), r;
|
|
364
372
|
}
|
|
365
|
-
function
|
|
373
|
+
function Lt(t, e) {
|
|
366
374
|
return t?.id ?? e;
|
|
367
375
|
}
|
|
368
|
-
function
|
|
376
|
+
function Y(t, e) {
|
|
369
377
|
return e === void 0 ? !0 : typeof e == "number" ? t.mapIndex === e : t.mapId === e;
|
|
370
378
|
}
|
|
371
|
-
function
|
|
372
|
-
const
|
|
373
|
-
|
|
379
|
+
function Pt(t, e, o) {
|
|
380
|
+
const r = t?.get(e) ?? [];
|
|
381
|
+
r.includes(o) || t?.set(e, [...r, o]);
|
|
374
382
|
}
|
|
375
|
-
const
|
|
376
|
-
function
|
|
383
|
+
const Nt = 6378137, q = 0.0818191908426215;
|
|
384
|
+
function ce(t, e) {
|
|
377
385
|
if (t === void 0 || typeof t == "number" && Number.isFinite(t) && t > 0) return;
|
|
378
|
-
const
|
|
379
|
-
throw new Error(`Layer "${e}": pointSize must be a number of meters greater than 0, not ${
|
|
380
|
-
}
|
|
381
|
-
function
|
|
382
|
-
const e = Math.exp(-t /
|
|
383
|
-
let
|
|
384
|
-
for (let
|
|
385
|
-
const n =
|
|
386
|
-
if (Math.abs(
|
|
387
|
-
|
|
386
|
+
const o = typeof t == "number" ? String(t) : JSON.stringify(t);
|
|
387
|
+
throw new Error(`Layer "${e}": pointSize must be a number of meters greater than 0, not ${o}.`);
|
|
388
|
+
}
|
|
389
|
+
function de(t) {
|
|
390
|
+
const e = Math.exp(-t / Nt);
|
|
391
|
+
let o = Math.PI / 2 - 2 * Math.atan(e);
|
|
392
|
+
for (let r = 0; r < 10; r++) {
|
|
393
|
+
const n = q * Math.sin(o), i = Math.PI / 2 - 2 * Math.atan(e * ((1 - n) / (1 + n)) ** (q / 2));
|
|
394
|
+
if (Math.abs(i - o) < 1e-12) return i;
|
|
395
|
+
o = i;
|
|
388
396
|
}
|
|
389
|
-
return
|
|
397
|
+
return o;
|
|
390
398
|
}
|
|
391
|
-
function
|
|
399
|
+
function pe(t, e) {
|
|
392
400
|
if (/^EPSG:3395$/i.test(t)) {
|
|
393
|
-
const
|
|
394
|
-
return Math.sqrt(1 -
|
|
401
|
+
const o = de(e), r = q * Math.sin(o);
|
|
402
|
+
return Math.sqrt(1 - r * r) / Math.cos(o);
|
|
395
403
|
}
|
|
396
|
-
return /^EPSG:3857$/i.test(t) ? Math.cosh(e /
|
|
404
|
+
return /^EPSG:3857$/i.test(t) ? Math.cosh(e / Nt) : 1;
|
|
397
405
|
}
|
|
398
|
-
function
|
|
406
|
+
function he(t, e, o, r) {
|
|
399
407
|
if (t === void 0 || e !== "points") return;
|
|
400
|
-
const n =
|
|
408
|
+
const n = r();
|
|
401
409
|
if (n)
|
|
402
|
-
return t *
|
|
410
|
+
return t * pe(o, (n[1] + n[3]) / 2);
|
|
411
|
+
}
|
|
412
|
+
const G = /^#[0-9a-fA-F]{6}$/;
|
|
413
|
+
function Tt(t, e) {
|
|
414
|
+
if (t === void 0) return;
|
|
415
|
+
if (!Array.isArray(t) || t.length !== 2 || !t.every((n) => typeof n == "number" && Number.isFinite(n)))
|
|
416
|
+
return "colorMapRange must hold two numbers, [low, high].";
|
|
417
|
+
const [o, r] = t;
|
|
418
|
+
if (o >= r)
|
|
419
|
+
return `colorMapRange low (${o}) must be less than high (${r}).`;
|
|
420
|
+
if (e !== void 0)
|
|
421
|
+
return "set colorMapRange or colorMapDomain, not both.";
|
|
422
|
+
}
|
|
423
|
+
function Ot(t, e) {
|
|
424
|
+
return e && e.length > 0 ? { type: A.USER, params: e } : t?.mode === Ct.PERCENTILE ? t.lowerPercentile !== void 0 || t.upperPercentile !== void 0 ? {
|
|
425
|
+
type: A.PERCENTILE,
|
|
426
|
+
params: [t.lowerPercentile ?? 0, t.upperPercentile ?? 100]
|
|
427
|
+
} : { type: A.PERCENTILE } : { type: A.MIN_MAX };
|
|
403
428
|
}
|
|
404
|
-
function
|
|
429
|
+
function b(t) {
|
|
405
430
|
return typeof t.title == "string" && t.title !== "" ? t.title : t.dataRef;
|
|
406
431
|
}
|
|
407
|
-
function
|
|
408
|
-
const
|
|
409
|
-
for (const
|
|
410
|
-
const n =
|
|
411
|
-
if (
|
|
432
|
+
function me(t, e) {
|
|
433
|
+
const o = /* @__PURE__ */ new Set();
|
|
434
|
+
for (const r of t.layerRefs) {
|
|
435
|
+
const n = b(r);
|
|
436
|
+
if (o.has(n))
|
|
412
437
|
throw new Error(`Map ${e} draws two layers with the id "${n}". A layer's id is its title, else its dataRef: give each layer of a map its own title.`);
|
|
413
|
-
|
|
438
|
+
o.add(n);
|
|
414
439
|
}
|
|
415
440
|
}
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
return B.hexToRgb(t);
|
|
441
|
+
function ct(t, e, o) {
|
|
442
|
+
if (!G.test(t))
|
|
443
|
+
throw new Error(`Layer "${o}": ${e} must be a color written #rrggbb, not "${t}".`);
|
|
444
|
+
return P.hexToRgb(t);
|
|
421
445
|
}
|
|
422
|
-
function
|
|
423
|
-
const
|
|
424
|
-
return t.color != null && (
|
|
446
|
+
function ye(t, e) {
|
|
447
|
+
const o = {};
|
|
448
|
+
return t.color != null && (o.color = ct(t.color, "color", e)), t.stroke === !1 ? o.showBorders = !1 : t.stroke != null && (o.strokeColor = ct(t.stroke, "stroke", e)), t.width != null && (o.polylinesWidth = t.width), o;
|
|
425
449
|
}
|
|
426
|
-
function
|
|
427
|
-
return t.isColorMap != null ? t.isColorMap : e === "raster" ? t.colorMapInterpolator != null || t.colorMapRange != null || t.colorMapCenter != null || t.colorMapReverse === !0 : t.color != null ? !1 : t.colorMapInterpolator != null || t.getFnv != null;
|
|
450
|
+
function ge(t, e) {
|
|
451
|
+
return t.isColorMap != null ? t.isColorMap : e === "raster" ? t.colorMapInterpolator != null || t.colorMapRange != null || t.colorMapCenter != null || t.colorMapReverse === !0 || t.legend === !0 : t.color != null ? !1 : t.colorMapInterpolator != null || t.getFnv != null;
|
|
428
452
|
}
|
|
429
|
-
function
|
|
430
|
-
const
|
|
431
|
-
return
|
|
453
|
+
function we(t, e) {
|
|
454
|
+
const o = t.features?.[0]?.properties?.[e];
|
|
455
|
+
return o instanceof Float32Array ? o : ArrayBuffer.isView(o) && !(o instanceof DataView) || Array.isArray(o) ? Float32Array.from(o, (r) => Number.isFinite(Number(r)) ? Number(r) : NaN) : null;
|
|
432
456
|
}
|
|
433
|
-
function
|
|
434
|
-
if (
|
|
457
|
+
function be(t, e, o, r, n) {
|
|
458
|
+
if (P.isCategorical(e.interpolator)) return;
|
|
435
459
|
if (n != null) {
|
|
436
|
-
const u =
|
|
437
|
-
return
|
|
460
|
+
const u = o != null ? [n[0], o, n[1]] : [n[0], n[1]];
|
|
461
|
+
return r === !0 ? u.reverse() : u;
|
|
438
462
|
}
|
|
439
463
|
if (!t) return;
|
|
440
|
-
let
|
|
464
|
+
let i = 0, a = 0;
|
|
441
465
|
for (let u = 0; u < t.length; u++) {
|
|
442
466
|
const d = t[u];
|
|
443
|
-
Number.isFinite(d) && (a++,
|
|
467
|
+
Number.isFinite(d) && (a++, o != null && (i = Math.max(i, Math.abs(d - o))));
|
|
444
468
|
}
|
|
445
|
-
const
|
|
446
|
-
if (a === 0 || !
|
|
447
|
-
const
|
|
448
|
-
return
|
|
469
|
+
const l = o != null && i > 0;
|
|
470
|
+
if (a === 0 || !l && r !== !0) return;
|
|
471
|
+
const s = l && o != null ? [o - i, o, o + i] : P.resolveDomainFromData(t, e);
|
|
472
|
+
return r === !0 ? [...s].reverse() : s;
|
|
449
473
|
}
|
|
450
|
-
function
|
|
451
|
-
if (!(e == null ||
|
|
474
|
+
function ve(t, e) {
|
|
475
|
+
if (!(e == null || P.isCategorical(t.interpolator)))
|
|
452
476
|
return [e[0], e[1]];
|
|
453
477
|
}
|
|
454
|
-
function
|
|
478
|
+
function Ee(t) {
|
|
455
479
|
const e = t.colorMapRange;
|
|
456
480
|
if (e === void 0) return;
|
|
457
|
-
const
|
|
458
|
-
if (
|
|
459
|
-
throw r
|
|
460
|
-
const [
|
|
461
|
-
if (
|
|
462
|
-
throw
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
481
|
+
const o = (l) => new Error(`Layer "${b(t)}": ${l}`), r = Tt(e, t.colorMapDomain);
|
|
482
|
+
if (r)
|
|
483
|
+
throw o(r);
|
|
484
|
+
const [n, i] = e, a = t.colorMapCenter;
|
|
485
|
+
if (a != null && (a < n || a > i))
|
|
486
|
+
throw o(`colorMapCenter (${a}) must lie within colorMapRange [${n}, ${i}].`);
|
|
487
|
+
}
|
|
488
|
+
const H = ["background", "surface", "parks", "water", "roads", "buildings", "points", "polylines", "polygons"];
|
|
489
|
+
function _e(t, e) {
|
|
490
|
+
const o = (n) => new Error(`Map ${e}: ${n}`), r = t.style;
|
|
491
|
+
if (r !== void 0 && typeof r != "string") {
|
|
492
|
+
if (r === null || typeof r != "object" || Array.isArray(r))
|
|
493
|
+
throw o(`style must be the name of one of autk-map's styles or the colors of a style, not ${JSON.stringify(r)}.`);
|
|
494
|
+
const n = H.filter((i) => !(i in r));
|
|
495
|
+
if (n.length > 0)
|
|
496
|
+
throw o(`style gives no color for ${n.join(", ")}: a style of the spec's own gives each of ${H.join(", ")}.`);
|
|
497
|
+
for (const i of H) {
|
|
498
|
+
const a = r[i];
|
|
499
|
+
if (typeof a != "string" || !G.test(a))
|
|
500
|
+
throw o(`style.${i} must be a color written #rrggbb, not ${JSON.stringify(a)}.`);
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
for (const n of ["highlightColor", "invalidValueColor"]) {
|
|
504
|
+
const i = t[n];
|
|
505
|
+
if (i !== void 0 && (typeof i != "string" || !G.test(i)))
|
|
506
|
+
throw o(`${n} must be a color written #rrggbb, not ${JSON.stringify(i)}.`);
|
|
507
|
+
}
|
|
474
508
|
}
|
|
475
|
-
function
|
|
476
|
-
|
|
477
|
-
if (!(r == null || typeof r != "object"))
|
|
478
|
-
return r[o];
|
|
479
|
-
}, t);
|
|
509
|
+
function Ce(t, e) {
|
|
510
|
+
typeof e.style == "string" ? t.style.setPredefinedStyle(e.style) : e.style && t.style.setCustomStyle(e.style), e.highlightColor !== void 0 && t.style.setHighlightColor(e.highlightColor), e.invalidValueColor !== void 0 && t.style.setInvalidValueColor(e.invalidValueColor);
|
|
480
511
|
}
|
|
481
|
-
function
|
|
482
|
-
const o =
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
512
|
+
function $e(t, e) {
|
|
513
|
+
const o = t.widthBy;
|
|
514
|
+
if (o !== void 0) {
|
|
515
|
+
if (typeof o != "string" || o === "")
|
|
516
|
+
throw new Error(`Layer "${e}": widthBy must be the dot path to each line's width, not ${JSON.stringify(o)}.`);
|
|
517
|
+
if (t.width !== void 0)
|
|
518
|
+
throw new Error(`Layer "${e}": set width or widthBy, not both: width gives every line one width.`);
|
|
519
|
+
}
|
|
487
520
|
}
|
|
488
|
-
function
|
|
489
|
-
|
|
490
|
-
|
|
521
|
+
function Me(t, e, o, r, n) {
|
|
522
|
+
if (r !== "roads")
|
|
523
|
+
throw new Error(`Layer "${e}": widthBy sets the width of each line of a roads layer, and the layer is drawn as ${r}: draw a table of lines as roads with layerType: 'roads'.`);
|
|
524
|
+
const i = t.layerManager.searchByLayerId(e), a = i?.components ?? [], l = new Float32Array(a.length);
|
|
525
|
+
l.set(i?.layerRenderInfo.polylinesWidthByComponent?.subarray(0, a.length) ?? []);
|
|
526
|
+
const s = o.startsWith("properties.") ? o.slice(11) : o;
|
|
527
|
+
let u = 0;
|
|
528
|
+
if (a.forEach((d, f) => {
|
|
529
|
+
const c = n.features[d.featureIndex ?? f], h = Number(Bt(c?.properties, s));
|
|
530
|
+
Number.isFinite(h) && h > 0 && (l[f] = h, u++);
|
|
531
|
+
}), u === 0)
|
|
532
|
+
throw new Error(`Layer "${e}": widthBy "${o}" gives no line of the layer a width: none has a positive number there.`);
|
|
533
|
+
t.updateRenderInfo(e, { polylinesWidthByComponent: l });
|
|
534
|
+
}
|
|
535
|
+
function ke(t, e) {
|
|
536
|
+
const o = t.layerRefs.filter((r) => r.legend === !0).map(b);
|
|
537
|
+
if (o.length > 1)
|
|
538
|
+
throw new Error(`Map ${e}: layers ${o.map((r) => `"${r}"`).join(" and ")} each set legend: a map shows one legend.`);
|
|
539
|
+
if (o.length === 1 && t.showUi === !1)
|
|
540
|
+
throw new Error(`Layer "${o[0]}": legend shows the layer in the map's legend, and the map's showUi is false, which hides the legend.`);
|
|
541
|
+
}
|
|
542
|
+
function Re(t, e) {
|
|
543
|
+
const o = e.layerRefs.find((i) => i.legend === !0);
|
|
544
|
+
if (!o) return;
|
|
545
|
+
const r = b(o), n = t.layerManager.searchByLayerId(r);
|
|
546
|
+
if (!n?.layerRenderInfo.isColorMap)
|
|
547
|
+
throw new Error(`Layer "${r}": legend shows the color scale of a layer colored by value, and the layer is drawn in one color.`);
|
|
548
|
+
t.ui.activeLayer = n, t.ui.refreshLegend(null);
|
|
549
|
+
}
|
|
550
|
+
const Se = [
|
|
551
|
+
{ types: ["points"], drawn: "a table of points is drawn as points" },
|
|
552
|
+
{ types: ["polylines", "roads"], drawn: "a table of lines is drawn as polylines or roads" },
|
|
553
|
+
{ types: ["polygons", "surface", "parks", "water", "buildings"], drawn: "a table of polygons is drawn as polygons, surface, parks, water or buildings" },
|
|
554
|
+
{ types: ["raster"], drawn: "a raster table is drawn as raster" }
|
|
555
|
+
];
|
|
556
|
+
function Ae(t, e, o) {
|
|
557
|
+
const r = t.layerType;
|
|
558
|
+
if (r === void 0 || e === void 0) return r ?? e;
|
|
559
|
+
const n = Se.find((i) => i.types.includes(e));
|
|
560
|
+
if (!n || n.types.includes(r)) return r;
|
|
561
|
+
throw new Error(`Layer "${o}": layerType "${r}" cannot draw the table "${t.dataRef}", a ${e} table: ${n.drawn}.`);
|
|
562
|
+
}
|
|
563
|
+
function Ft(t, e, o) {
|
|
564
|
+
if (!Array.isArray(t) || !t.every((r) => Number.isInteger(r) && r >= 0))
|
|
565
|
+
throw new Error(`Layer "${o}": ${e} must list the positions of features the layer draws, whole numbers from 0, not ${JSON.stringify(t)}.`);
|
|
566
|
+
}
|
|
567
|
+
function dt(t, e, o, r, n) {
|
|
568
|
+
if (r === "raster")
|
|
569
|
+
throw new Error(`Layer "${o}": ${e} names features, and a raster layer has none.`);
|
|
570
|
+
const i = t.find((a) => a >= n);
|
|
571
|
+
if (i !== void 0)
|
|
572
|
+
throw new Error(`Layer "${o}": ${e} names position ${i}, past the ${n} features the layer draws.`);
|
|
573
|
+
}
|
|
574
|
+
function Ie(t) {
|
|
575
|
+
t.layerRefs.forEach((e, o) => {
|
|
576
|
+
if (e.pickedComps === void 0) return;
|
|
577
|
+
const r = b(e);
|
|
578
|
+
if (Ft(e.pickedComps, "pickedComps", r), e.isPick !== !0)
|
|
579
|
+
throw new Error(`Layer "${r}": pickedComps draws features as picked, which autk-map does only on the layer that picks: set isPick: true.`);
|
|
580
|
+
const n = t.layerRefs.slice(o + 1).find((i) => i.isPick === !0);
|
|
581
|
+
if (n)
|
|
582
|
+
throw new Error(`Layer "${r}": pickedComps draws features as picked on the layer that picks, but layer "${b(n)}", after it, picks too: autk-map lets one layer of a map pick, the last.`);
|
|
583
|
+
});
|
|
491
584
|
}
|
|
492
|
-
function
|
|
585
|
+
function Bt(t, e) {
|
|
586
|
+
return e.split(".").reduce((o, r) => {
|
|
587
|
+
if (!(o == null || typeof o != "object"))
|
|
588
|
+
return o[r];
|
|
589
|
+
}, t);
|
|
590
|
+
}
|
|
591
|
+
function Le(t, e, o) {
|
|
592
|
+
const r = e.split("."), n = { ...t };
|
|
593
|
+
let i = n;
|
|
594
|
+
for (let a = 0; a < r.length - 1; a++)
|
|
595
|
+
i[r[a]] = { ...i[r[a]] ?? {} }, i = i[r[a]];
|
|
596
|
+
return i[r[r.length - 1]] = o, n;
|
|
597
|
+
}
|
|
598
|
+
function jt(t, e, o) {
|
|
599
|
+
const n = t.features?.[0]?.properties?.bands ?? [];
|
|
600
|
+
if (e === void 0) return n[0]?.id ?? "";
|
|
601
|
+
const i = n.find((a) => a.id === e || a.label === e.replace(/\./g, "_"));
|
|
602
|
+
if (i) return i.id;
|
|
603
|
+
if (n.length > 1) {
|
|
604
|
+
const a = n.map((l) => l.label && l.label !== l.id ? `${l.id} (${l.label})` : l.id);
|
|
605
|
+
throw o(`"${e}" names none of its ${n.length} bands: ${a.join(", ")}.`);
|
|
606
|
+
}
|
|
607
|
+
return n[0]?.id ?? e;
|
|
608
|
+
}
|
|
609
|
+
function xt(t) {
|
|
493
610
|
const { pitch: e } = t;
|
|
494
611
|
return e === void 0 || typeof e == "number" && e >= 0 && e < 90 ? void 0 : `camera.pitch must be at least 0 and less than 90 degrees, not ${typeof e == "number" ? String(e) : JSON.stringify(e)}: at 90 the eye would sit on the ground, edge-on to the map's flat layers, and the map could not pan.`;
|
|
495
612
|
}
|
|
496
|
-
function
|
|
497
|
-
const
|
|
498
|
-
if (
|
|
613
|
+
function Pe(t, e) {
|
|
614
|
+
const o = xt(e);
|
|
615
|
+
if (o) throw new Error(o);
|
|
499
616
|
if (e.zoom === void 0 && !e.pitch && !e.bearing) return;
|
|
500
|
-
const
|
|
501
|
-
n - a * Math.sin(
|
|
502
|
-
|
|
503
|
-
a * Math.cos(
|
|
504
|
-
], d = [Math.cos(
|
|
505
|
-
|
|
506
|
-
}
|
|
507
|
-
function
|
|
508
|
-
const s =
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
}
|
|
514
|
-
|
|
515
|
-
|
|
617
|
+
const r = t.camera, [n, i] = r.getLookAt(), a = e.zoom !== void 0 ? 1e4 / Math.pow(2, e.zoom - 10) : Math.abs(r.getEye()[2]), l = (e.pitch ?? 0) * Math.PI / 180, s = (e.bearing ?? 0) * Math.PI / 180, u = [
|
|
618
|
+
n - a * Math.sin(l) * Math.sin(s),
|
|
619
|
+
i - a * Math.sin(l) * Math.cos(s),
|
|
620
|
+
a * Math.cos(l)
|
|
621
|
+
], d = [Math.cos(l) * Math.sin(s), Math.cos(l) * Math.cos(s), Math.sin(l)];
|
|
622
|
+
r.resetCamera(d, [n, i, 0], u);
|
|
623
|
+
}
|
|
624
|
+
async function Ne(t, e, o, r) {
|
|
625
|
+
const n = (s) => new Error(`Map ${r}: terrain ${s}`), i = e.getTablesMetadata().find((s) => s.name === o.dataRef);
|
|
626
|
+
if (!i)
|
|
627
|
+
throw n(`dataRef "${o.dataRef}" names no table of the map's workspace.`);
|
|
628
|
+
if (i.type !== "raster")
|
|
629
|
+
throw n(`dataRef "${o.dataRef}" names a ${i.type ?? "plain"} table, and a terrain takes its heights from a raster table, such as a geotiff source's.`);
|
|
630
|
+
const a = await e.getRaster(o.dataRef), l = jt(a, o.band, (s) => n(`band ${s}`));
|
|
631
|
+
try {
|
|
632
|
+
t.enableTerrainMode(a, l);
|
|
633
|
+
} catch (s) {
|
|
634
|
+
throw n(`"${o.dataRef}": ${s instanceof Error ? s.message : String(s)}`);
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
function Te(t, e, o, r) {
|
|
638
|
+
const i = t.layerManager.searchByLayerId(e)?.components;
|
|
639
|
+
return Array.isArray(i) ? i.map((a, l) => {
|
|
640
|
+
const s = Number.isInteger(a?.featureIndex) ? a.featureIndex : l;
|
|
641
|
+
return o[r[s]] ?? "";
|
|
642
|
+
}) : r.map((a) => o[a] ?? "");
|
|
643
|
+
}
|
|
644
|
+
function Oe(t, e, o, r, n, i) {
|
|
645
|
+
async function a(l, s, u) {
|
|
516
646
|
let d = {};
|
|
517
|
-
for (const
|
|
518
|
-
|
|
519
|
-
const
|
|
520
|
-
for (const
|
|
521
|
-
const
|
|
522
|
-
p === "raster"
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
647
|
+
for (const c of s.getTablesMetadata())
|
|
648
|
+
c.type !== void 0 && (d[c.name] = c.type);
|
|
649
|
+
const f = [];
|
|
650
|
+
for (const c of u.layerRefs) {
|
|
651
|
+
const h = c.dataRef, m = b(c), y = E(u.workspace, h), p = Ae(c, n?.get(y) ?? d[h], m), g = c.getFnv, _ = o?.get(y) ?? (p === "raster" ? await s.getRaster(h) : await It(i, St(y, c.osmElements), () => s.getLayer(h, At(c.osmElements)))), $ = _.features ?? [], S = p === "raster" ? [] : $.flatMap((w, M) => w?.geometry != null ? [M] : []), k = p === "raster" ? _ : { ..._, features: S.map((w) => $[w]) }, K = p === "raster" ? jt(k, g, (w) => new Error(`Layer "${m}": getFnv ${w}`)) : "";
|
|
652
|
+
if (p === "raster")
|
|
653
|
+
l.loadCollection(m, { collection: k, type: "raster", property: K });
|
|
654
|
+
else {
|
|
655
|
+
const w = p === "buildings" && c.buildingsZeroHeight === !0;
|
|
656
|
+
l.loadCollection(m, { collection: k, type: p, ...w ? { loadConfig: { buildingsZeroHeight: !0 } } : {} });
|
|
657
|
+
}
|
|
658
|
+
c.opacity != null && l.updateRenderInfo(m, { opacity: c.opacity });
|
|
659
|
+
const z = ye(c, m);
|
|
660
|
+
Object.keys(z).length > 0 && l.updateRenderInfo(m, z), c.widthBy !== void 0 && Me(l, m, c.widthBy, p, k);
|
|
661
|
+
const Yt = s.getWorkspaceConfiguration().coordinateFormat, X = he(c.pointSize, p, Yt, () => Rt(k));
|
|
662
|
+
X !== void 0 && l.updateRenderInfo(m, { pointSize: X }), ge(c, p) && l.updateRenderInfo(m, { isColorMap: !0 }), c.isPick && l.updateRenderInfo(m, { isPick: !0 }), c.isSkip && l.updateRenderInfo(m, { isSkip: !0 });
|
|
663
|
+
const { catchAllCategory: T, colorMapDomain: L } = c;
|
|
664
|
+
let Z = k, tt = L;
|
|
665
|
+
if (g && T && L?.length) {
|
|
666
|
+
const w = new Set(L);
|
|
667
|
+
Z = {
|
|
668
|
+
...k,
|
|
669
|
+
features: k.features.map((M) => {
|
|
670
|
+
const rt = M.properties, Q = Bt(rt, g);
|
|
671
|
+
return Q == null || !w.has(String(Q)) ? { ...M, properties: Le(rt, g, T) } : M;
|
|
536
672
|
})
|
|
537
|
-
},
|
|
673
|
+
}, tt = w.has(T) ? L : [...L, T];
|
|
538
674
|
}
|
|
539
|
-
const
|
|
540
|
-
|
|
541
|
-
const O =
|
|
542
|
-
if (
|
|
543
|
-
const
|
|
675
|
+
const et = p === "raster" && c.transferFunction != null;
|
|
676
|
+
et && l.layerManager.searchByLayerId(m)?.setTransferFunction?.(c.transferFunction);
|
|
677
|
+
const O = c.colorMapRange, ot = p === "raster" && (O != null || c.colorMapCenter != null || c.colorMapReverse === !0);
|
|
678
|
+
if (c.colorMapInterpolator || ot || O) {
|
|
679
|
+
const w = {
|
|
544
680
|
// urban-grammar ColorMapInterpolator values are string-compatible
|
|
545
681
|
// with autk-core ColorMapInterpolator at runtime
|
|
546
|
-
interpolator:
|
|
547
|
-
domainSpec:
|
|
682
|
+
interpolator: c.colorMapInterpolator ?? l.layerManager.searchByLayerId(m)?.layerRenderInfo.colormap.config.interpolator ?? _t.SEQ_REDS,
|
|
683
|
+
domainSpec: Ot(c.normalization, tt)
|
|
548
684
|
};
|
|
549
685
|
let M;
|
|
550
|
-
|
|
551
|
-
} else
|
|
552
|
-
if (
|
|
553
|
-
const
|
|
554
|
-
|
|
686
|
+
ot ? M = be(we(k, K), w, c.colorMapCenter, c.colorMapReverse, O) : p !== "raster" && (M = ve(w, O)), M && (w.domainSpec = { type: A.USER, params: M }), l.updateColorMap(m, { colorMap: w });
|
|
687
|
+
} else et && l.updateColorMap(m, { colorMap: {} });
|
|
688
|
+
if (g && p !== "raster") {
|
|
689
|
+
const w = g.startsWith("properties.") ? g : `properties.${g}`;
|
|
690
|
+
l.updateThematic(m, { collection: Z, property: w });
|
|
555
691
|
}
|
|
556
|
-
|
|
692
|
+
const W = p === "raster" ? [] : Te(l, m, kt($), S);
|
|
693
|
+
c.pickedComps && dt(c.pickedComps, "pickedComps", m, p, W.length), c.skippedComps && (dt(c.skippedComps, "skippedComps", m, p, W.length), l.layerManager.searchByLayerId(m)?.setSkippedIds(c.skippedComps)), f.push(W);
|
|
557
694
|
}
|
|
558
|
-
return
|
|
695
|
+
return f;
|
|
559
696
|
}
|
|
560
697
|
return {
|
|
561
|
-
async resolveMap(
|
|
562
|
-
if (t && t.map &&
|
|
563
|
-
|
|
564
|
-
for (const
|
|
565
|
-
|
|
566
|
-
|
|
698
|
+
async resolveMap(l, s, u = 0) {
|
|
699
|
+
if (t && t.map && l) {
|
|
700
|
+
me(s, u);
|
|
701
|
+
for (const y of s.layerRefs)
|
|
702
|
+
Ee(y), ce(y.pointSize, b(y)), y.skippedComps !== void 0 && Ft(y.skippedComps, "skippedComps", b(y)), $e(y, b(y));
|
|
703
|
+
Ie(s), _e(s, u), ke(s, u);
|
|
704
|
+
const d = s.camera && xt(s.camera);
|
|
567
705
|
if (d)
|
|
568
706
|
throw new Error(`Map ${u}: ${d}`);
|
|
569
|
-
let
|
|
570
|
-
if (Array.isArray(t.map) ?
|
|
707
|
+
let f;
|
|
708
|
+
if (Array.isArray(t.map) ? f = document.getElementById(t.map[u]) : f = document.getElementById(t.map), !f)
|
|
571
709
|
throw new Error("Could not find rendering target for map: " + t.map);
|
|
572
|
-
if (!(
|
|
710
|
+
if (!(f instanceof HTMLCanvasElement))
|
|
573
711
|
throw new Error("Target for map is not a canvas: " + t.map);
|
|
574
|
-
const
|
|
575
|
-
let
|
|
712
|
+
const c = s.showUi === !1 ? new nt(f, !1) : new nt(f);
|
|
713
|
+
let h;
|
|
576
714
|
try {
|
|
577
|
-
|
|
578
|
-
} catch (
|
|
715
|
+
Ce(c, s), await c.init(), await I(l, s.workspace), h = await a(c, l, s), s.terrain && await Ne(c, l, s.terrain, u), Re(c, s);
|
|
716
|
+
} catch (y) {
|
|
579
717
|
try {
|
|
580
|
-
|
|
718
|
+
c.destroy();
|
|
581
719
|
} catch {
|
|
582
720
|
}
|
|
583
|
-
throw
|
|
721
|
+
throw y;
|
|
584
722
|
}
|
|
585
|
-
const m =
|
|
586
|
-
|
|
587
|
-
map:
|
|
723
|
+
const m = Lt(s, u);
|
|
724
|
+
s.layerRefs.forEach((y, p) => e?.push({
|
|
725
|
+
map: c,
|
|
588
726
|
mapIndex: u,
|
|
589
727
|
mapId: m,
|
|
590
|
-
layerId:
|
|
591
|
-
dataRef:
|
|
592
|
-
rows:
|
|
593
|
-
})),
|
|
728
|
+
layerId: b(y),
|
|
729
|
+
dataRef: y.dataRef,
|
|
730
|
+
rows: h[p]
|
|
731
|
+
})), r && (r[u] = c), s.camera && Pe(c, s.camera), c.draw();
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
};
|
|
735
|
+
}
|
|
736
|
+
function C(t) {
|
|
737
|
+
return t.id ?? t.dataRef;
|
|
738
|
+
}
|
|
739
|
+
const Fe = new Set(Object.values(_t));
|
|
740
|
+
function pt(t, e, o) {
|
|
741
|
+
if (e !== void 0) {
|
|
742
|
+
if (typeof e != "string" || !Fe.has(e)) return `${t} ${JSON.stringify(e)} is not a color scheme.`;
|
|
743
|
+
if (P.isCategorical(e) !== o)
|
|
744
|
+
return o ? `${t} "${e}" is not a categorical scheme: categories take a scheme* scheme, such as schemeTableau10.` : `${t} "${e}" is a categorical scheme: numbers take an interpolate* scheme, and categories take categoricalColorMapInterpolator.`;
|
|
745
|
+
}
|
|
746
|
+
}
|
|
747
|
+
const Be = /^(?:.?[<>=^])?[-+( ]?[$#]?0?\d*,?(?:\.\d+)?~?[a-zA-Z%]?$/;
|
|
748
|
+
function je(t) {
|
|
749
|
+
if (t === void 0) return;
|
|
750
|
+
if (!Array.isArray(t) || t.length !== 2)
|
|
751
|
+
return "tickFormats must hold two d3-format specifiers, [x, y].";
|
|
752
|
+
const e = t.findIndex((o) => typeof o != "string" || !Be.test(o));
|
|
753
|
+
if (e >= 0)
|
|
754
|
+
return `tickFormats[${e}] ${JSON.stringify(t[e])} is not a d3-format specifier, such as "~s", ",d" or ".0%".`;
|
|
755
|
+
}
|
|
756
|
+
function xe(t, e) {
|
|
757
|
+
if (t === void 0) return;
|
|
758
|
+
if (!Array.isArray(t) || !t.every((r) => typeof r == "string"))
|
|
759
|
+
return "axisLabels must be a list of titles, one for each column of axis.";
|
|
760
|
+
if (t.length > e.length)
|
|
761
|
+
return `axisLabels has ${t.length} titles for the ${e.length} columns of axis.`;
|
|
762
|
+
const o = t.find((r, n) => t.indexOf(r) !== n);
|
|
763
|
+
if (o !== void 0)
|
|
764
|
+
return `axisLabels gives two axes the title ${JSON.stringify(o)}.`;
|
|
765
|
+
}
|
|
766
|
+
function ht(t, e) {
|
|
767
|
+
if (!(e === void 0 || typeof e == "string" && G.test(e)))
|
|
768
|
+
return `${t} must be a color written #rrggbb, not ${JSON.stringify(e)}.`;
|
|
769
|
+
}
|
|
770
|
+
function De(t) {
|
|
771
|
+
if (t !== void 0 && (!Array.isArray(t) || !t.every((e) => Number.isInteger(e) && e >= 0)))
|
|
772
|
+
return "selection must list the positions of rows, whole numbers from 0.";
|
|
773
|
+
}
|
|
774
|
+
function Ge(t) {
|
|
775
|
+
const e = pt("colorMapInterpolator", t.colorMapInterpolator, !1) ?? pt("categoricalColorMapInterpolator", t.categoricalColorMapInterpolator, !0) ?? Tt(t.colorMapRange, t.colorMapDomain) ?? je(t.tickFormats) ?? xe(t.axisLabels, t.axis) ?? De(t.selection) ?? ht("markColor", t.markColor) ?? ht("highlightColor", t.highlightColor);
|
|
776
|
+
if (e) throw new Error(`Plot "${C(t)}": ${e}`);
|
|
777
|
+
}
|
|
778
|
+
function Ue(t) {
|
|
779
|
+
const e = {};
|
|
780
|
+
for (const [o, r] of [["markColor", "mark"], ["highlightColor", "highlight"]]) {
|
|
781
|
+
let n;
|
|
782
|
+
for (const i of t) {
|
|
783
|
+
const a = i[o];
|
|
784
|
+
if (a !== void 0) {
|
|
785
|
+
if (n && n[o].toLowerCase() !== a.toLowerCase())
|
|
786
|
+
throw new Error(`Plots "${C(n)}" and "${C(i)}" set different ${o} values, "${n[o]}" and "${a}": autk-plot draws every plot of a page in one ${r} color.`);
|
|
787
|
+
n ??= i;
|
|
594
788
|
}
|
|
595
789
|
}
|
|
790
|
+
n && (e[o] = n[o]);
|
|
791
|
+
}
|
|
792
|
+
return e;
|
|
793
|
+
}
|
|
794
|
+
function We(t, e) {
|
|
795
|
+
const o = t.selection?.find((r) => r >= e);
|
|
796
|
+
if (o !== void 0)
|
|
797
|
+
throw new Error(`Plot "${C(t)}": selection names row ${o}, but the plot draws ${e === 1 ? "1 row" : `${e} rows`}.`);
|
|
798
|
+
}
|
|
799
|
+
function Qe(t, e) {
|
|
800
|
+
return t === void 0 || t === "@transform" ? !1 : e.some((o) => {
|
|
801
|
+
const r = zt(o?.properties ?? {}, t);
|
|
802
|
+
return typeof r == "string" && isNaN(Number(r));
|
|
803
|
+
});
|
|
804
|
+
}
|
|
805
|
+
function Ve(t, e) {
|
|
806
|
+
const o = t.colorMapRange;
|
|
807
|
+
if (o !== void 0 && !Qe(t.color, e))
|
|
808
|
+
return { type: A.USER, params: [o[0], o[1]] };
|
|
809
|
+
if (!(t.normalization === void 0 && t.colorMapDomain === void 0))
|
|
810
|
+
return Ot(t.normalization, t.colorMapDomain);
|
|
811
|
+
}
|
|
812
|
+
function Ye(t) {
|
|
813
|
+
return t.axis.map((e, o) => t.axisLabels?.[o] ?? (e === "@transform" ? "value" : e));
|
|
814
|
+
}
|
|
815
|
+
function He(t, e) {
|
|
816
|
+
const o = Ve(t, e);
|
|
817
|
+
return {
|
|
818
|
+
labels: { axis: Ye(t), title: t.title },
|
|
819
|
+
// The grammar's scheme names are autk-core's, as strings.
|
|
820
|
+
...t.colorMapInterpolator !== void 0 && { colorMapInterpolator: t.colorMapInterpolator },
|
|
821
|
+
...t.categoricalColorMapInterpolator !== void 0 && {
|
|
822
|
+
categoricalColorMapInterpolator: t.categoricalColorMapInterpolator
|
|
823
|
+
},
|
|
824
|
+
...o && { domainSpec: o },
|
|
825
|
+
...t.tickFormats !== void 0 && { tickFormats: [...t.tickFormats] }
|
|
596
826
|
};
|
|
597
827
|
}
|
|
598
|
-
function
|
|
828
|
+
function Je(t) {
|
|
599
829
|
return {
|
|
600
830
|
scatter: "scatterplot",
|
|
601
831
|
bar: "barchart",
|
|
@@ -606,311 +836,314 @@ function fe(t) {
|
|
|
606
836
|
heatmatrix: "heatmatrix"
|
|
607
837
|
}[t];
|
|
608
838
|
}
|
|
609
|
-
|
|
610
|
-
|
|
839
|
+
let j;
|
|
840
|
+
function qe(t) {
|
|
841
|
+
t.markColor === void 0 && t.highlightColor === void 0 && !j || (j ??= { markColor: F.default, highlightColor: F.highlight }, F.setDefaultColor(t.markColor ?? j.markColor), F.setHighlightColor(t.highlightColor ?? j.highlightColor));
|
|
611
842
|
}
|
|
612
|
-
function
|
|
613
|
-
const { map: n, layerId:
|
|
614
|
-
n.updateRenderInfo(
|
|
615
|
-
a ===
|
|
843
|
+
function Dt(t, e, o, r) {
|
|
844
|
+
const { map: n, layerId: i } = r;
|
|
845
|
+
n.updateRenderInfo(i, { isPick: !0 }), n.events.on(J.PICKING, ({ layerId: a, selection: l }) => {
|
|
846
|
+
a === i && t.setSelection(D(l, r.rows, e));
|
|
616
847
|
});
|
|
617
|
-
for (const a of
|
|
618
|
-
t.events.on(a, ({ selection:
|
|
619
|
-
n.setHighlightedIds(
|
|
848
|
+
for (const a of o)
|
|
849
|
+
t.events.on(a, ({ selection: l }) => {
|
|
850
|
+
n.setHighlightedIds(i, D(l, e, r.rows));
|
|
620
851
|
});
|
|
621
852
|
}
|
|
622
|
-
async function
|
|
623
|
-
const
|
|
624
|
-
return
|
|
853
|
+
async function Ke(t, e, o, r, n) {
|
|
854
|
+
const i = t.getTablesMetadata().find((a) => a.name === e);
|
|
855
|
+
return i && !Et(i) ? { type: "FeatureCollection", features: (await t.getTable(e)).map((l) => ({ type: "Feature", geometry: null, properties: l })) } : It(r, St(o, n), () => t.getLayer(e, At(n)));
|
|
625
856
|
}
|
|
626
|
-
function
|
|
857
|
+
function ze(t, e, o, r, n, i, a, l) {
|
|
627
858
|
return {
|
|
628
|
-
async resolvePlot(
|
|
859
|
+
async resolvePlot(s, u, d = 0) {
|
|
629
860
|
if (!t || !t.plot) return;
|
|
630
|
-
const
|
|
631
|
-
if (
|
|
632
|
-
const
|
|
633
|
-
if (!
|
|
634
|
-
const
|
|
635
|
-
if (!
|
|
636
|
-
await I(
|
|
637
|
-
const m =
|
|
638
|
-
|
|
861
|
+
const f = Array.isArray(t.plot) ? t.plot[d] : t.plot;
|
|
862
|
+
if (f === void 0) throw new Error(`Plot ${d} has no target: the plot targets name ${t.plot.length} elements.`);
|
|
863
|
+
const c = document.getElementById(f);
|
|
864
|
+
if (!c) throw new Error(`Could not find plot target: ${f}`);
|
|
865
|
+
const h = s;
|
|
866
|
+
if (!h) throw new Error("No data context available for plot.");
|
|
867
|
+
await I(h, u.workspace);
|
|
868
|
+
const m = E(u.workspace, u.dataRef), y = u.osmElements === !0 ? void 0 : n?.get(m), p = i?.get(m) ?? y ?? await Ke(h, u.dataRef, m, l, u.osmElements);
|
|
869
|
+
We(u, p.features?.length ?? 0);
|
|
870
|
+
const g = u.events ?? [], _ = new Kt(c, {
|
|
871
|
+
type: Je(u.mark),
|
|
639
872
|
collection: p,
|
|
640
873
|
attributes: { axis: u.axis, ...u.color && { color: u.color } },
|
|
641
|
-
|
|
642
|
-
|
|
874
|
+
events: g,
|
|
875
|
+
...He(u, p.features ?? []),
|
|
643
876
|
...u.width && { width: u.width },
|
|
644
877
|
...u.height && { height: u.height },
|
|
645
878
|
...u.margins && { margins: u.margins },
|
|
646
879
|
...u.transform && { transform: u.transform }
|
|
647
880
|
});
|
|
648
|
-
|
|
649
|
-
const
|
|
650
|
-
a?.set(
|
|
881
|
+
u.mark === "scatter" && u.color !== void 0 && _.setSelection([]), o?.set(C(u), _);
|
|
882
|
+
const $ = kt(p.features ?? []);
|
|
883
|
+
a?.set(C(u), $);
|
|
651
884
|
for (const S of e ?? [])
|
|
652
|
-
!u.mapRef || S.dataRef !== u.mapRef || (
|
|
885
|
+
!u.mapRef || S.dataRef !== u.mapRef || (Dt(_, $, g, S), Pt(r, C(u), S));
|
|
653
886
|
}
|
|
654
887
|
};
|
|
655
888
|
}
|
|
656
|
-
const
|
|
657
|
-
function
|
|
889
|
+
const Gt = 134217728, Xe = 4, Ze = 32;
|
|
890
|
+
function to(t) {
|
|
658
891
|
return Array.isArray(t) ? t.join(`
|
|
659
892
|
`) : t;
|
|
660
893
|
}
|
|
661
|
-
function
|
|
894
|
+
function R(t) {
|
|
662
895
|
return !!t && typeof t == "object" && !Array.isArray(t) && typeof t.fromFeature == "object" && t.fromFeature !== null;
|
|
663
896
|
}
|
|
664
|
-
function
|
|
897
|
+
function N(t, e) {
|
|
665
898
|
return t instanceof Map ? t.get(e) : t[e];
|
|
666
899
|
}
|
|
667
|
-
function
|
|
668
|
-
return e.split(".").reduce((
|
|
669
|
-
if (!(
|
|
670
|
-
return r
|
|
900
|
+
function x(t, e) {
|
|
901
|
+
return e.split(".").reduce((o, r) => {
|
|
902
|
+
if (!(o == null || typeof o != "object"))
|
|
903
|
+
return o[r];
|
|
671
904
|
}, t);
|
|
672
905
|
}
|
|
673
|
-
function
|
|
906
|
+
function Ut(t) {
|
|
674
907
|
const e = [];
|
|
675
|
-
for (const
|
|
676
|
-
for (const
|
|
677
|
-
|
|
908
|
+
for (const o of [t.uniforms, t.uniformMatrices])
|
|
909
|
+
for (const r of Object.values(o ?? {}))
|
|
910
|
+
R(r) && e.push(r);
|
|
678
911
|
return e;
|
|
679
912
|
}
|
|
680
|
-
function
|
|
681
|
-
return [.../* @__PURE__ */ new Set([t.dataRef, ...
|
|
913
|
+
function eo(t) {
|
|
914
|
+
return [.../* @__PURE__ */ new Set([t.dataRef, ...Ut(t).map((e) => e.fromFeature.layer)])];
|
|
682
915
|
}
|
|
683
|
-
function
|
|
684
|
-
for (const e of
|
|
685
|
-
const { iterate:
|
|
686
|
-
if (
|
|
916
|
+
function Wt(t) {
|
|
917
|
+
for (const e of Ut(t)) {
|
|
918
|
+
const { iterate: o, layer: r } = e.fromFeature;
|
|
919
|
+
if (o === "all" || o === "batched") return { mode: o, layer: r };
|
|
687
920
|
}
|
|
688
921
|
return null;
|
|
689
922
|
}
|
|
690
|
-
function
|
|
691
|
-
const
|
|
692
|
-
return
|
|
923
|
+
function Qt(t, e, o) {
|
|
924
|
+
const r = t.fromFeature, n = o !== void 0 && r.iterate === "all" ? o : r.index ?? 0, i = N(e, r.layer)?.features?.[n];
|
|
925
|
+
return i ? x(i, r.path) : void 0;
|
|
693
926
|
}
|
|
694
|
-
function
|
|
927
|
+
function mt(t, e, o) {
|
|
695
928
|
if (!t) return;
|
|
696
|
-
const
|
|
697
|
-
for (const [n,
|
|
698
|
-
if (!
|
|
699
|
-
|
|
929
|
+
const r = {};
|
|
930
|
+
for (const [n, i] of Object.entries(t)) {
|
|
931
|
+
if (!R(i)) {
|
|
932
|
+
r[n] = i;
|
|
700
933
|
continue;
|
|
701
934
|
}
|
|
702
|
-
const a = Number(
|
|
703
|
-
Number.isFinite(a) ?
|
|
935
|
+
const a = Number(Qt(i, e, o) ?? NaN);
|
|
936
|
+
Number.isFinite(a) ? r[n] = a : typeof i.default == "number" && (r[n] = i.default);
|
|
704
937
|
}
|
|
705
|
-
return
|
|
938
|
+
return r;
|
|
706
939
|
}
|
|
707
|
-
function
|
|
940
|
+
function yt(t, e, o) {
|
|
708
941
|
if (!t) return;
|
|
709
|
-
const
|
|
710
|
-
for (const [n,
|
|
711
|
-
if (!
|
|
712
|
-
|
|
942
|
+
const r = {};
|
|
943
|
+
for (const [n, i] of Object.entries(t)) {
|
|
944
|
+
if (!R(i)) {
|
|
945
|
+
r[n] = i;
|
|
713
946
|
continue;
|
|
714
947
|
}
|
|
715
|
-
const a =
|
|
716
|
-
if (!
|
|
717
|
-
const
|
|
718
|
-
|
|
948
|
+
const a = Qt(i, e, o), l = Array.isArray(a) ? a : Array.isArray(i.default) ? i.default : void 0;
|
|
949
|
+
if (!l) continue;
|
|
950
|
+
const s = i.cols ?? (Array.isArray(l[0]) ? l[0].length : 0);
|
|
951
|
+
s > 0 ? r[n] = { data: l, cols: s } : console.warn(`[autk-grammar] uniform matrix "${n}" has no column count; entry dropped`);
|
|
719
952
|
}
|
|
720
|
-
return
|
|
953
|
+
return r;
|
|
721
954
|
}
|
|
722
|
-
function
|
|
955
|
+
function oo(t) {
|
|
723
956
|
return t != null && !(typeof t == "number" && !Number.isFinite(t));
|
|
724
957
|
}
|
|
725
|
-
function
|
|
726
|
-
return
|
|
958
|
+
function gt(t) {
|
|
959
|
+
return R(t) && t.fromFeature.iterate === "batched";
|
|
727
960
|
}
|
|
728
|
-
function
|
|
729
|
-
return Object.values(e ?? {}).some(
|
|
961
|
+
function Vt(t, e) {
|
|
962
|
+
return Object.values(e ?? {}).some(gt) ? Ze : Object.values(t ?? {}).some(gt) ? Xe : 0;
|
|
730
963
|
}
|
|
731
|
-
function
|
|
732
|
-
const
|
|
733
|
-
return
|
|
964
|
+
function ro(t, e, o = Gt) {
|
|
965
|
+
const r = Vt(t, e);
|
|
966
|
+
return r > 0 ? Math.floor(o / r) : Number.POSITIVE_INFINITY;
|
|
734
967
|
}
|
|
735
|
-
function
|
|
736
|
-
const n = {},
|
|
737
|
-
for (const
|
|
738
|
-
for (const u of Object.values(
|
|
739
|
-
|
|
968
|
+
function no(t, e, o, r = Gt) {
|
|
969
|
+
const n = {}, i = {}, a = [];
|
|
970
|
+
for (const s of [t, e])
|
|
971
|
+
for (const u of Object.values(s ?? {}))
|
|
972
|
+
R(u) && u.fromFeature.iterate === "batched" && u.fromFeature.required && a.push(u.fromFeature.path);
|
|
740
973
|
if (a.length > 0) {
|
|
741
|
-
const
|
|
742
|
-
|
|
974
|
+
const s = o.length;
|
|
975
|
+
o = o.filter((u) => a.every((d) => oo(x(u, d)))), o.length < s && console.info(`[autk-grammar] batched compute dropped ${s - o.length} feature(s) missing ${a.join(", ")}`);
|
|
743
976
|
}
|
|
744
|
-
const
|
|
745
|
-
|
|
746
|
-
`[autk-grammar] batched compute capped at ${
|
|
747
|
-
),
|
|
748
|
-
for (const [
|
|
749
|
-
if (
|
|
977
|
+
const l = ro(t, e, r);
|
|
978
|
+
o.length > l && (console.warn(
|
|
979
|
+
`[autk-grammar] batched compute capped at ${l} features (got ${o.length}): its largest packed array takes ${Vt(t, e)} B per feature, and a storage buffer binding holds ${r} B`
|
|
980
|
+
), o = o.slice(0, l));
|
|
981
|
+
for (const [s, u] of Object.entries(t ?? {}))
|
|
982
|
+
if (R(u) && u.fromFeature.iterate === "batched") {
|
|
750
983
|
const d = typeof u.default == "number" ? u.default : void 0;
|
|
751
|
-
s
|
|
752
|
-
const
|
|
753
|
-
return Number.isFinite(
|
|
984
|
+
i[s] = o.map((f) => {
|
|
985
|
+
const c = Number(x(f, u.fromFeature.path) ?? d);
|
|
986
|
+
return Number.isFinite(c) ? c : 0;
|
|
754
987
|
});
|
|
755
|
-
} else typeof u == "number" && (n[
|
|
756
|
-
for (const [
|
|
757
|
-
if (!
|
|
988
|
+
} else typeof u == "number" && (n[s] = u);
|
|
989
|
+
for (const [s, u] of Object.entries(e ?? {})) {
|
|
990
|
+
if (!R(u) || u.fromFeature.iterate !== "batched") continue;
|
|
758
991
|
const d = [];
|
|
759
|
-
for (const
|
|
760
|
-
const
|
|
761
|
-
let
|
|
762
|
-
if (Array.isArray(
|
|
763
|
-
for (const
|
|
764
|
-
if (!Array.isArray(
|
|
765
|
-
const _ = Number(
|
|
766
|
-
!Number.isFinite(_) || !Number.isFinite(
|
|
992
|
+
for (const f of o) {
|
|
993
|
+
const c = x(f, u.fromFeature.path);
|
|
994
|
+
let h = 1 / 0, m = 1 / 0, y = -1 / 0, p = -1 / 0;
|
|
995
|
+
if (Array.isArray(c))
|
|
996
|
+
for (const g of c) {
|
|
997
|
+
if (!Array.isArray(g) || g.length < 2) continue;
|
|
998
|
+
const _ = Number(g[0]), $ = Number(g[1]);
|
|
999
|
+
!Number.isFinite(_) || !Number.isFinite($) || (h = Math.min(h, _), m = Math.min(m, $), y = Math.max(y, _), p = Math.max(p, $));
|
|
767
1000
|
}
|
|
768
|
-
Number.isFinite(
|
|
1001
|
+
Number.isFinite(h) || (h = 0, m = 0, y = 0, p = 0), d.push(h, m, y, m, y, p, h, p);
|
|
769
1002
|
}
|
|
770
|
-
s
|
|
1003
|
+
i[s] = d;
|
|
771
1004
|
}
|
|
772
|
-
return n.num_features =
|
|
1005
|
+
return n.num_features = o.length, { uniforms: n, uniformArrays: i };
|
|
773
1006
|
}
|
|
774
|
-
function
|
|
775
|
-
const
|
|
776
|
-
if (!
|
|
1007
|
+
function wt(t, e, o) {
|
|
1008
|
+
const r = N(e, t.dataRef);
|
|
1009
|
+
if (!r) throw new Error(`compute: table "${t.dataRef}" is not loaded`);
|
|
777
1010
|
const n = {
|
|
778
|
-
collection:
|
|
1011
|
+
collection: r,
|
|
779
1012
|
variableMapping: t.attributes,
|
|
780
|
-
wgslBody:
|
|
1013
|
+
wgslBody: to(t.wgslFunction)
|
|
781
1014
|
};
|
|
782
1015
|
t.attributeArrays && (n.attributeArrays = t.attributeArrays), t.attributeMatrices && (n.attributeMatrices = t.attributeMatrices), t.uniformArrays && (n.uniformArrays = t.uniformArrays), t.outputColumnName && (n.resultField = t.outputColumnName), t.outputColumns && (n.outputColumns = t.outputColumns);
|
|
783
|
-
const
|
|
784
|
-
if (
|
|
785
|
-
const u =
|
|
786
|
-
return n.uniforms = { ...
|
|
1016
|
+
const i = Wt(t);
|
|
1017
|
+
if (i?.mode === "batched") {
|
|
1018
|
+
const u = N(e, i.layer)?.features ?? [], d = no(t.uniforms, t.uniformMatrices, u), f = mt(bt(t.uniforms), e) ?? {}, c = yt(bt(t.uniformMatrices), e);
|
|
1019
|
+
return n.uniforms = { ...f, ...d.uniforms }, n.uniformArrays = { ...n.uniformArrays ?? {}, ...d.uniformArrays }, c && Object.keys(c).length > 0 && (n.uniformMatrices = c), n;
|
|
787
1020
|
}
|
|
788
|
-
const a =
|
|
789
|
-
return
|
|
1021
|
+
const a = i?.mode === "all" ? o : void 0, l = mt(t.uniforms, e, a), s = yt(t.uniformMatrices, e, a);
|
|
1022
|
+
return l && (n.uniforms = l), s && (n.uniformMatrices = s), n;
|
|
790
1023
|
}
|
|
791
|
-
function
|
|
1024
|
+
function bt(t) {
|
|
792
1025
|
if (t)
|
|
793
|
-
return Object.fromEntries(Object.entries(t).filter(([, e]) => !(
|
|
1026
|
+
return Object.fromEntries(Object.entries(t).filter(([, e]) => !(R(e) && e.fromFeature.iterate === "batched")));
|
|
794
1027
|
}
|
|
795
|
-
function
|
|
1028
|
+
function ao(t) {
|
|
796
1029
|
return t.outputColumns ?? (t.outputColumnName ? [t.outputColumnName] : []);
|
|
797
1030
|
}
|
|
798
|
-
async function
|
|
799
|
-
const
|
|
800
|
-
if (
|
|
801
|
-
const n =
|
|
1031
|
+
async function io(t, e, o) {
|
|
1032
|
+
const r = Wt(t);
|
|
1033
|
+
if (r?.mode !== "all") return o(wt(t, e));
|
|
1034
|
+
const n = N(e, t.dataRef);
|
|
802
1035
|
if (!n) throw new Error(`compute: table "${t.dataRef}" is not loaded`);
|
|
803
|
-
const
|
|
804
|
-
for (const
|
|
805
|
-
const u =
|
|
806
|
-
for (const
|
|
1036
|
+
const i = ao(t), a = structuredClone(n);
|
|
1037
|
+
for (const s of a.features) {
|
|
1038
|
+
const u = s.properties ??= {}, d = u.compute ??= {};
|
|
1039
|
+
for (const f of i) d[f] = 0;
|
|
807
1040
|
}
|
|
808
|
-
const
|
|
809
|
-
for (let
|
|
810
|
-
const u = await
|
|
811
|
-
a.features.forEach((d,
|
|
812
|
-
const
|
|
813
|
-
if (!(!
|
|
814
|
-
for (const m of
|
|
815
|
-
const
|
|
816
|
-
Number.isFinite(
|
|
1041
|
+
const l = N(e, r.layer)?.features?.length ?? 0;
|
|
1042
|
+
for (let s = 0; s < l; s++) {
|
|
1043
|
+
const u = await o({ ...wt(t, e, s), collection: a });
|
|
1044
|
+
a.features.forEach((d, f) => {
|
|
1045
|
+
const c = d.properties?.compute, h = u.features[f]?.properties?.compute;
|
|
1046
|
+
if (!(!c || !h))
|
|
1047
|
+
for (const m of i) {
|
|
1048
|
+
const y = Number(h[m]);
|
|
1049
|
+
Number.isFinite(y) && (c[m] += y);
|
|
817
1050
|
}
|
|
818
1051
|
});
|
|
819
1052
|
}
|
|
820
1053
|
return a;
|
|
821
1054
|
}
|
|
822
|
-
const
|
|
823
|
-
function
|
|
824
|
-
return
|
|
1055
|
+
const vt = ["surface", "parks", "water", "roads", "buildings", "polygons", "polylines"];
|
|
1056
|
+
function so(t, e, o, r) {
|
|
1057
|
+
return r?.get(E(o, e)) ?? t.getTablesMetadata().find((n) => n.name === e)?.type;
|
|
825
1058
|
}
|
|
826
|
-
function
|
|
827
|
-
async function r(
|
|
828
|
-
return t?.get(
|
|
1059
|
+
function lo(t, e, o) {
|
|
1060
|
+
async function r(l, s, u) {
|
|
1061
|
+
return t?.get(E(u, s)) ?? await l.getLayer(s);
|
|
829
1062
|
}
|
|
830
|
-
function
|
|
1063
|
+
function n(l, s, u, d, f) {
|
|
831
1064
|
if (!t) return;
|
|
832
|
-
const c =
|
|
833
|
-
t.set(
|
|
834
|
-
const
|
|
835
|
-
|
|
1065
|
+
const c = d.outputTableName ?? u;
|
|
1066
|
+
t.set(E(d.workspace, c), s);
|
|
1067
|
+
const h = d.layerType ?? f ?? so(l, u, d.workspace, e);
|
|
1068
|
+
d.outputTableName && h && e?.set(E(d.workspace, c), h);
|
|
836
1069
|
}
|
|
837
|
-
async function
|
|
838
|
-
for (const
|
|
839
|
-
if (!
|
|
840
|
-
throw new Error(`Render pass "${
|
|
841
|
-
const
|
|
842
|
-
id:
|
|
843
|
-
collection: await r(
|
|
844
|
-
type:
|
|
845
|
-
objectIdProperty:
|
|
846
|
-
}))),
|
|
847
|
-
layers:
|
|
1070
|
+
async function i(l, s) {
|
|
1071
|
+
for (const f of s.layers)
|
|
1072
|
+
if (!vt.includes(f.type))
|
|
1073
|
+
throw new Error(`Render pass "${s.outputTableName}": layer "${f.id}" has the type "${f.type}", which a render pass cannot draw. A layer's type is one of ${vt.join(", ")}.`);
|
|
1074
|
+
const u = await Promise.all(s.layers.map(async (f) => ({
|
|
1075
|
+
id: f.id,
|
|
1076
|
+
collection: await r(l, f.dataRef, s.workspace),
|
|
1077
|
+
type: f.type,
|
|
1078
|
+
objectIdProperty: f.objectIdProperty
|
|
1079
|
+
}))), d = await new at().renderPipeline({
|
|
1080
|
+
layers: u,
|
|
848
1081
|
viewpoints: {
|
|
849
|
-
collection: await r(
|
|
850
|
-
strategy:
|
|
851
|
-
sampling:
|
|
1082
|
+
collection: await r(l, s.viewpoints.dataRef, s.workspace),
|
|
1083
|
+
strategy: s.viewpoints.strategy,
|
|
1084
|
+
sampling: s.viewpoints.sampling
|
|
852
1085
|
},
|
|
853
|
-
aggregation:
|
|
854
|
-
camera:
|
|
855
|
-
tileSize:
|
|
1086
|
+
aggregation: s.aggregation,
|
|
1087
|
+
camera: s.camera,
|
|
1088
|
+
tileSize: s.tileSize
|
|
856
1089
|
});
|
|
857
|
-
|
|
1090
|
+
n(l, d, s.viewpoints.dataRef, s, s.viewpoints.strategy?.type === "building-windows" ? "points" : void 0);
|
|
858
1091
|
}
|
|
859
|
-
async function
|
|
860
|
-
const
|
|
861
|
-
for (const
|
|
862
|
-
const
|
|
863
|
-
if (
|
|
864
|
-
else if (
|
|
1092
|
+
async function a(l, s) {
|
|
1093
|
+
const u = {}, d = l.getWorkspaceConfiguration().coordinateFormat;
|
|
1094
|
+
for (const h of eo(s)) {
|
|
1095
|
+
const m = E(s.workspace, h), y = t?.get(m) ?? (h === s.dataRef ? void 0 : re(o?.get(m), d));
|
|
1096
|
+
if (y) u[h] = y;
|
|
1097
|
+
else if (h === s.dataRef) u[h] = await l.getLayer(h);
|
|
865
1098
|
else
|
|
866
1099
|
try {
|
|
867
|
-
|
|
1100
|
+
u[h] = await l.getLayer(h);
|
|
868
1101
|
} catch {
|
|
869
|
-
|
|
1102
|
+
u[h] = void 0;
|
|
870
1103
|
}
|
|
871
1104
|
}
|
|
872
|
-
const
|
|
873
|
-
|
|
1105
|
+
const f = new at(), c = await io(s, u, (h) => f.gpgpuPipeline(h));
|
|
1106
|
+
n(l, c, s.dataRef, s);
|
|
874
1107
|
}
|
|
875
1108
|
return {
|
|
876
|
-
async resolveCompute(
|
|
877
|
-
if (
|
|
878
|
-
return await I(
|
|
1109
|
+
async resolveCompute(l, s) {
|
|
1110
|
+
if (l)
|
|
1111
|
+
return await I(l, s.workspace), s.type === "render" ? await i(l, s) : await a(l, s), l;
|
|
879
1112
|
}
|
|
880
1113
|
};
|
|
881
1114
|
}
|
|
882
|
-
class
|
|
1115
|
+
class uo {
|
|
883
1116
|
_listeners = /* @__PURE__ */ new Map();
|
|
884
|
-
on(e,
|
|
1117
|
+
on(e, o) {
|
|
885
1118
|
this._listeners.has(e) || this._listeners.set(e, /* @__PURE__ */ new Set());
|
|
886
|
-
const
|
|
887
|
-
return
|
|
1119
|
+
const r = this._listeners.get(e);
|
|
1120
|
+
return r.add(o), () => r.delete(o);
|
|
888
1121
|
}
|
|
889
1122
|
/** @internal */
|
|
890
|
-
emit(e,
|
|
891
|
-
this._listeners.get(e)?.forEach((
|
|
1123
|
+
emit(e, o) {
|
|
1124
|
+
this._listeners.get(e)?.forEach((r) => r(o));
|
|
892
1125
|
}
|
|
893
1126
|
}
|
|
894
|
-
function
|
|
1127
|
+
function v(t) {
|
|
895
1128
|
return t === void 0 ? [] : Array.isArray(t) ? t : [t];
|
|
896
1129
|
}
|
|
897
|
-
function
|
|
1130
|
+
function fo(t) {
|
|
898
1131
|
const e = /* @__PURE__ */ new Set();
|
|
899
|
-
for (const
|
|
900
|
-
if (
|
|
901
|
-
if (
|
|
902
|
-
if (e.has(
|
|
903
|
-
e.add(
|
|
1132
|
+
for (const r of [...v(t.map), ...v(t.plot)])
|
|
1133
|
+
if (r.id !== void 0) {
|
|
1134
|
+
if (r.id === "") throw new Error("A map or plot has an empty id.");
|
|
1135
|
+
if (e.has(r.id)) throw new Error(`Two maps or plots have the id "${r.id}"; an id names one view.`);
|
|
1136
|
+
e.add(r.id);
|
|
904
1137
|
}
|
|
905
|
-
const
|
|
906
|
-
for (const
|
|
907
|
-
const n =
|
|
908
|
-
if (
|
|
909
|
-
throw new Error(
|
|
910
|
-
|
|
1138
|
+
const o = /* @__PURE__ */ new Map();
|
|
1139
|
+
for (const r of v(t.plot)) {
|
|
1140
|
+
const n = C(r), i = o.get(n);
|
|
1141
|
+
if (i)
|
|
1142
|
+
throw new Error(i.id === void 0 && r.id === void 0 ? `Two plots of the table "${n}" have no id; give each plot an id.` : `A plot's id "${n}" is the dataRef of a plot without an id; give each plot an id.`);
|
|
1143
|
+
o.set(n, r);
|
|
911
1144
|
}
|
|
912
1145
|
}
|
|
913
|
-
class
|
|
1146
|
+
class wo {
|
|
914
1147
|
dataAdapter;
|
|
915
1148
|
mapAdapter;
|
|
916
1149
|
plotAdapter;
|
|
@@ -928,9 +1161,9 @@ class $e {
|
|
|
928
1161
|
_exports = /* @__PURE__ */ new Map();
|
|
929
1162
|
/** Each GeoJSON table a run loaded and each table a join wrote, which its plots read before the database. */
|
|
930
1163
|
_geojsonCache = /* @__PURE__ */ new Map();
|
|
931
|
-
interactions = new
|
|
1164
|
+
interactions = new uo();
|
|
932
1165
|
constructor(e) {
|
|
933
|
-
this.dataAdapter =
|
|
1166
|
+
this.dataAdapter = fe(e, this._geojsonCache), this.mapAdapter = Oe(e, this._layers, this._computeCache, this._maps, this._computeTypes, this._exports), this.plotAdapter = ze(e, this._layers, this._plotRegistry, this._plotLinks, this._geojsonCache, this._computeCache, this._plotRows, this._exports), this.computeAdapter = lo(this._computeCache, this._computeTypes, this._geojsonCache);
|
|
934
1167
|
}
|
|
935
1168
|
/**
|
|
936
1169
|
* The coordinate reference system autk-db stores a workspace's tables in, unless the spec's `workspaces` sets
|
|
@@ -942,7 +1175,7 @@ class $e {
|
|
|
942
1175
|
* instead of hard-coding a CRS string.
|
|
943
1176
|
*/
|
|
944
1177
|
get workspaceCrs() {
|
|
945
|
-
return
|
|
1178
|
+
return qt;
|
|
946
1179
|
}
|
|
947
1180
|
get data() {
|
|
948
1181
|
return this._data;
|
|
@@ -967,8 +1200,8 @@ class $e {
|
|
|
967
1200
|
* @param mapId The map to look in, by its {@link MapId}: a string names a map by its `id`, a number by its index in
|
|
968
1201
|
* the spec's `map` list. Without it, every map.
|
|
969
1202
|
*/
|
|
970
|
-
mapLayers(e,
|
|
971
|
-
return this._layersOf(e,
|
|
1203
|
+
mapLayers(e, o) {
|
|
1204
|
+
return this._layersOf(e, o).map(({ map: r, layerId: n }) => ({ map: r, layerId: n }));
|
|
972
1205
|
}
|
|
973
1206
|
/**
|
|
974
1207
|
* The layer a map of the last {@link run} draws for a table, found by the table's name (a layer's `dataRef`):
|
|
@@ -984,12 +1217,12 @@ class $e {
|
|
|
984
1217
|
* const layer = grammar.mapLayer('buildings');
|
|
985
1218
|
* layer?.map.updateRenderInfo(layer.layerId, { opacity: 0.5 });
|
|
986
1219
|
*/
|
|
987
|
-
mapLayer(e,
|
|
988
|
-
return this.mapLayers(e,
|
|
1220
|
+
mapLayer(e, o) {
|
|
1221
|
+
return this.mapLayers(e, o).pop();
|
|
989
1222
|
}
|
|
990
1223
|
/** The drawn layers of a table, on every map or on the one `mapId` names. */
|
|
991
|
-
_layersOf(e,
|
|
992
|
-
return this._layers.filter((
|
|
1224
|
+
_layersOf(e, o) {
|
|
1225
|
+
return this._layers.filter((r) => r.dataRef === e && Y(r, o));
|
|
993
1226
|
}
|
|
994
1227
|
/**
|
|
995
1228
|
* Releases what the last run created: every map (its layers' GPU buffers, its textures, its canvas context, the
|
|
@@ -1013,7 +1246,10 @@ class $e {
|
|
|
1013
1246
|
throw new Error("Plot adapter not initialized. Please call the constructor first.");
|
|
1014
1247
|
if (!this.computeAdapter)
|
|
1015
1248
|
throw new Error("Compute adapter not initialized. Please call the constructor first.");
|
|
1016
|
-
|
|
1249
|
+
fo(e);
|
|
1250
|
+
for (const i of v(e.plot)) Ge(i);
|
|
1251
|
+
const o = Ue(v(e.plot));
|
|
1252
|
+
this.destroy(), v(e.plot).length > 0 && qe(o), this.grammarEngine = Xt({
|
|
1017
1253
|
spec: e,
|
|
1018
1254
|
adapters: {
|
|
1019
1255
|
db: this.dataAdapter,
|
|
@@ -1023,27 +1259,27 @@ class $e {
|
|
|
1023
1259
|
}
|
|
1024
1260
|
}), await this.grammarEngine.run();
|
|
1025
1261
|
const r = this.grammarEngine.context;
|
|
1026
|
-
if (r && await I(r), this._wireLinks(e), this._rewireInteractions(e), !r) {
|
|
1262
|
+
if (r && await I(r), this._wireLinks(e), this._pickFromTheStart(e), this._selectFromTheStart(e), this._rewireInteractions(e), !r) {
|
|
1027
1263
|
console.warn("Grammar engine produced no data context."), this._data = {};
|
|
1028
1264
|
return;
|
|
1029
1265
|
}
|
|
1030
|
-
const
|
|
1031
|
-
for (const
|
|
1032
|
-
Object.defineProperty(
|
|
1266
|
+
const n = {};
|
|
1267
|
+
for (const i of r.getLayersMetadata())
|
|
1268
|
+
Object.defineProperty(n, i.name, {
|
|
1033
1269
|
get: () => {
|
|
1034
|
-
const
|
|
1035
|
-
return
|
|
1270
|
+
const a = this._computeCache.get(i.name);
|
|
1271
|
+
return a ? Promise.resolve(a) : r.getLayer(i.name);
|
|
1036
1272
|
},
|
|
1037
1273
|
enumerable: !0,
|
|
1038
1274
|
configurable: !0
|
|
1039
1275
|
});
|
|
1040
|
-
for (const
|
|
1041
|
-
|
|
1042
|
-
get: () => Promise.resolve(this._computeCache.get(
|
|
1276
|
+
for (const i of this._computeCache.keys())
|
|
1277
|
+
i in n || Object.defineProperty(n, i, {
|
|
1278
|
+
get: () => Promise.resolve(this._computeCache.get(i)),
|
|
1043
1279
|
enumerable: !0,
|
|
1044
1280
|
configurable: !0
|
|
1045
1281
|
});
|
|
1046
|
-
this._data =
|
|
1282
|
+
this._data = n;
|
|
1047
1283
|
}
|
|
1048
1284
|
/**
|
|
1049
1285
|
* Highlights features on every layer that draws the table `dataRef`, in every map (see {@link mapLayers}), or only
|
|
@@ -1056,10 +1292,10 @@ class $e {
|
|
|
1056
1292
|
* @param mapId The map to highlight on, by its {@link MapId}: a string names a map by its `id`, a number by its
|
|
1057
1293
|
* index in the spec's `map` list. Without it, every map that draws the table.
|
|
1058
1294
|
*/
|
|
1059
|
-
highlightOnMap(e,
|
|
1060
|
-
const n = this._layersOf(e,
|
|
1061
|
-
for (const { map:
|
|
1062
|
-
this._selectInLinkedPlots(n,
|
|
1295
|
+
highlightOnMap(e, o, r) {
|
|
1296
|
+
const n = this._layersOf(e, r);
|
|
1297
|
+
for (const { map: i, layerId: a } of n) i.setHighlightedIds(a, o);
|
|
1298
|
+
this._selectInLinkedPlots(n, o);
|
|
1063
1299
|
}
|
|
1064
1300
|
/**
|
|
1065
1301
|
* Clears highlighted features on every layer that draws the table `dataRef`, in every map (see {@link mapLayers}),
|
|
@@ -1070,10 +1306,10 @@ class $e {
|
|
|
1070
1306
|
* @param mapId The map to clear, by its {@link MapId}: a string names a map by its `id`, a number by its index in
|
|
1071
1307
|
* the spec's `map` list. Without it, every map that draws the table.
|
|
1072
1308
|
*/
|
|
1073
|
-
clearHighlightOnMap(e,
|
|
1074
|
-
const
|
|
1075
|
-
for (const { map: n, layerId:
|
|
1076
|
-
this._selectInLinkedPlots(
|
|
1309
|
+
clearHighlightOnMap(e, o) {
|
|
1310
|
+
const r = this._layersOf(e, o);
|
|
1311
|
+
for (const { map: n, layerId: i } of r) n.clearHighlightedIds(i);
|
|
1312
|
+
this._selectInLinkedPlots(r, []);
|
|
1077
1313
|
}
|
|
1078
1314
|
/**
|
|
1079
1315
|
* Clears the selection on the plot `plotId` names: its `id`, else its `dataRef`.
|
|
@@ -1084,10 +1320,10 @@ class $e {
|
|
|
1084
1320
|
* @param mapId The map whose linked layers to clear, by its {@link MapId}: a string names a map by its `id`, a
|
|
1085
1321
|
* number by its index in the spec's `map` list. Without it, every linked layer.
|
|
1086
1322
|
*/
|
|
1087
|
-
clearHighlightOnPlot(e,
|
|
1323
|
+
clearHighlightOnPlot(e, o) {
|
|
1088
1324
|
this._plotRegistry.get(e)?.setSelection([]);
|
|
1089
|
-
for (const
|
|
1090
|
-
|
|
1325
|
+
for (const r of this._plotLinks.get(e) ?? [])
|
|
1326
|
+
Y(r, o) && r.map.clearHighlightedIds(r.layerId);
|
|
1091
1327
|
}
|
|
1092
1328
|
/**
|
|
1093
1329
|
* Applies a selection to the plot `plotId` names: its `id`, else its `dataRef`.
|
|
@@ -1099,86 +1335,121 @@ class $e {
|
|
|
1099
1335
|
* @param mapId The map whose linked layers to highlight, by its {@link MapId}: a string names a map by its `id`, a
|
|
1100
1336
|
* number by its index in the spec's `map` list. Without it, every linked layer.
|
|
1101
1337
|
*/
|
|
1102
|
-
setPlotSelection(e,
|
|
1103
|
-
this._plotRegistry.get(e)?.setSelection(
|
|
1338
|
+
setPlotSelection(e, o, r) {
|
|
1339
|
+
this._plotRegistry.get(e)?.setSelection(o);
|
|
1104
1340
|
const n = this._plotRows.get(e) ?? [];
|
|
1105
|
-
for (const
|
|
1106
|
-
|
|
1341
|
+
for (const i of this._plotLinks.get(e) ?? [])
|
|
1342
|
+
Y(i, r) && i.map.setHighlightedIds(i.layerId, D(o, n, i.rows));
|
|
1107
1343
|
}
|
|
1108
1344
|
/**
|
|
1109
1345
|
* Applies a selection made on `layers`, by their positions `featureIds`, to every plot linked to one of them, at the
|
|
1110
1346
|
* plot's own positions of the selected rows.
|
|
1111
1347
|
*/
|
|
1112
|
-
_selectInLinkedPlots(e,
|
|
1113
|
-
for (const [
|
|
1114
|
-
const
|
|
1115
|
-
if (
|
|
1116
|
-
const a = this._plotRows.get(
|
|
1117
|
-
this._plotRegistry.get(
|
|
1348
|
+
_selectInLinkedPlots(e, o) {
|
|
1349
|
+
for (const [r, n] of this._plotLinks) {
|
|
1350
|
+
const i = n.filter((s) => e.includes(s));
|
|
1351
|
+
if (i.length === 0) continue;
|
|
1352
|
+
const a = this._plotRows.get(r) ?? [], l = new Set(i.flatMap((s) => D(o, s.rows, a)));
|
|
1353
|
+
this._plotRegistry.get(r)?.setSelection([...l]);
|
|
1118
1354
|
}
|
|
1119
1355
|
}
|
|
1120
1356
|
/** Wires each entry of `links` between a plot and a layer of a map, both now drawn. */
|
|
1121
1357
|
_wireLinks(e) {
|
|
1122
|
-
const
|
|
1358
|
+
const o = v(e.map), r = v(e.plot);
|
|
1123
1359
|
for (const n of e.links ?? []) {
|
|
1124
|
-
const
|
|
1125
|
-
if (!
|
|
1360
|
+
const i = r.find((f) => C(f) === n.source), a = this._plotRegistry.get(n.source);
|
|
1361
|
+
if (!i || !a)
|
|
1126
1362
|
throw new Error(`Link source "${n.source}" is not the id (or the dataRef) of a plot of this specification.`);
|
|
1127
|
-
const
|
|
1128
|
-
if (
|
|
1363
|
+
const l = o.findIndex((f) => f.id === n.target), s = this._maps[l];
|
|
1364
|
+
if (l < 0 || !s)
|
|
1129
1365
|
throw new Error(`Link target "${n.target}" is not the id of a map of this specification.`);
|
|
1130
|
-
const u =
|
|
1366
|
+
const u = o[l].layerRefs.find((f) => n.layer !== void 0 ? b(f) === n.layer : f.dataRef === i.dataRef);
|
|
1131
1367
|
if (!u)
|
|
1132
|
-
throw new Error(n.layer !== void 0 ? `Link from "${n.source}": map "${n.target}" has no layer "${n.layer}".` : `Link from "${n.source}": map "${n.target}" draws no layer of the table "${
|
|
1133
|
-
const d = this._layers.find((
|
|
1134
|
-
d && (
|
|
1368
|
+
throw new Error(n.layer !== void 0 ? `Link from "${n.source}": map "${n.target}" has no layer "${n.layer}".` : `Link from "${n.source}": map "${n.target}" draws no layer of the table "${i.dataRef}"; name the layer.`);
|
|
1369
|
+
const d = this._layers.find((f) => f.mapIndex === l && f.layerId === b(u));
|
|
1370
|
+
d && (Dt(a, this._plotRows.get(n.source) ?? [], i.events ?? [], d), Pt(this._plotLinks, n.source, d));
|
|
1135
1371
|
}
|
|
1136
1372
|
}
|
|
1373
|
+
/**
|
|
1374
|
+
* Draws each layer's `pickedComps` as picked once the maps, the plots and their links exist, as `highlightOnMap` does
|
|
1375
|
+
* for that one layer: the layer highlights the features, and the plots linked to it select the same rows. autk-map
|
|
1376
|
+
* draws picked features only on the layer of a map that picks, and lets one layer of a map pick, so a layer that no
|
|
1377
|
+
* longer picks, since a link or a plot's `mapRef` made another layer of its map pick, is refused. So is one linked to a
|
|
1378
|
+
* plot that sets `selection`, which sets what both show too.
|
|
1379
|
+
*/
|
|
1380
|
+
_pickFromTheStart(e) {
|
|
1381
|
+
const o = v(e.plot);
|
|
1382
|
+
v(e.map).forEach((r, n) => {
|
|
1383
|
+
for (const i of r.layerRefs) {
|
|
1384
|
+
if (!i.pickedComps) continue;
|
|
1385
|
+
const a = b(i), l = this._layers.find((u) => u.mapIndex === n && u.layerId === a);
|
|
1386
|
+
if (!l) continue;
|
|
1387
|
+
const s = l.map.activePickingLayer?.layerInfo.id;
|
|
1388
|
+
if (s !== a)
|
|
1389
|
+
throw new Error(`Layer "${a}": pickedComps draws features as picked on the layer that picks, but ${s === void 0 ? "no layer of its map picks" : `a link or a plot's mapRef made layer "${s}" of its map pick`}: autk-map lets one layer of a map pick.`);
|
|
1390
|
+
for (const [u, d] of this._plotLinks) {
|
|
1391
|
+
const f = o.find((c) => C(c) === u);
|
|
1392
|
+
if (d.includes(l) && (f?.selection?.length ?? 0) > 0)
|
|
1393
|
+
throw new Error(`Layer "${a}": pickedComps and the selection of plot "${u}", which is linked to it, both set what the two show: set one of them.`);
|
|
1394
|
+
}
|
|
1395
|
+
l.map.setHighlightedIds(a, i.pickedComps), this._selectInLinkedPlots([l], i.pickedComps);
|
|
1396
|
+
}
|
|
1397
|
+
});
|
|
1398
|
+
}
|
|
1399
|
+
/**
|
|
1400
|
+
* Applies each plot's `selection` once the plots and their links exist, as `setPlotSelection` does: the plot selects
|
|
1401
|
+
* the rows, and the layers it is linked to, by `mapRef` or `links`, highlight them. autk-plot's `setSelection` emits
|
|
1402
|
+
* no event, so no `plot:selection` reports it.
|
|
1403
|
+
*/
|
|
1404
|
+
_selectFromTheStart(e) {
|
|
1405
|
+
for (const o of v(e.plot))
|
|
1406
|
+
o.selection && o.selection.length > 0 && this.setPlotSelection(C(o), o.selection);
|
|
1407
|
+
}
|
|
1137
1408
|
_rewireInteractions(e) {
|
|
1138
|
-
for (const
|
|
1409
|
+
for (const r of this._fwdCleanups) r();
|
|
1139
1410
|
this._fwdCleanups = [];
|
|
1140
|
-
const
|
|
1141
|
-
this._maps.forEach((
|
|
1142
|
-
const
|
|
1143
|
-
this.interactions.emit("map:picking", { mapId:
|
|
1411
|
+
const o = v(e.map);
|
|
1412
|
+
this._maps.forEach((r, n) => {
|
|
1413
|
+
const i = Lt(o[n], n), a = ({ layerId: l, selection: s }) => {
|
|
1414
|
+
this.interactions.emit("map:picking", { mapId: i, layerId: l, selection: s });
|
|
1144
1415
|
};
|
|
1145
|
-
|
|
1416
|
+
r.events.on(J.PICKING, a), this._fwdCleanups.push(() => r.events.off(J.PICKING, a));
|
|
1146
1417
|
});
|
|
1147
|
-
for (const [
|
|
1148
|
-
for (const
|
|
1149
|
-
const a = ({ selection:
|
|
1418
|
+
for (const [r, n] of this._plotRegistry)
|
|
1419
|
+
for (const i of [B.CLICK, B.BRUSH, B.BRUSH_X, B.BRUSH_Y]) {
|
|
1420
|
+
const a = ({ selection: l }) => {
|
|
1150
1421
|
this.interactions.emit("plot:selection", {
|
|
1151
|
-
plotId:
|
|
1152
|
-
event:
|
|
1153
|
-
selection:
|
|
1422
|
+
plotId: r,
|
|
1423
|
+
event: i,
|
|
1424
|
+
selection: l
|
|
1154
1425
|
});
|
|
1155
1426
|
};
|
|
1156
|
-
n.events.on(
|
|
1427
|
+
n.events.on(i, a), this._fwdCleanups.push(() => n.events.off(i, a));
|
|
1157
1428
|
}
|
|
1158
1429
|
}
|
|
1159
1430
|
}
|
|
1160
1431
|
export {
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1432
|
+
wo as AutkGrammar,
|
|
1433
|
+
Zt as ColorMapInterpolator,
|
|
1434
|
+
uo as GrammarEventEmitter,
|
|
1435
|
+
Ct as NormalizationMode,
|
|
1436
|
+
Gt as STORAGE_BUFFER_BINDING_SIZE,
|
|
1437
|
+
Pe as applyCamera,
|
|
1438
|
+
go as arrangeViews,
|
|
1439
|
+
no as buildBatchedUniforms,
|
|
1440
|
+
eo as computeLayerNames,
|
|
1441
|
+
lo as createComputeAdapter,
|
|
1442
|
+
fe as createDataAdapter,
|
|
1443
|
+
Xt as createEngine,
|
|
1173
1444
|
I as enterWorkspace,
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1445
|
+
Wt as findIterateSource,
|
|
1446
|
+
R as isFromFeature,
|
|
1447
|
+
to as joinWgsl,
|
|
1448
|
+
ro as maxBatchedFeatures,
|
|
1449
|
+
wt as resolveComputeParams,
|
|
1450
|
+
yt as resolveUniformMatrices,
|
|
1451
|
+
mt as resolveUniforms,
|
|
1452
|
+
io as runCompute,
|
|
1453
|
+
E as tableKey
|
|
1183
1454
|
};
|
|
1184
1455
|
//# sourceMappingURL=autk-grammar.js.map
|