@opengis/bi 1.2.7 → 1.2.10

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.
@@ -1,525 +0,0 @@
1
- import { createElementBlock as l, openBlock as h, createStaticVNode as V, createElementVNode as a, withDirectives as B, toDisplayString as L, vShow as P, Fragment as z, renderList as S, normalizeClass as G, resolveComponent as j, createVNode as D } from "vue";
2
- import { _ as p } from "./import-file-DnbEvuUN.js";
3
- function N(t) {
4
- return [
5
- {
6
- type: "fill",
7
- paint: {
8
- "fill-color": t.color || "#ccc",
9
- "fill-outline-color": t.color || "blue",
10
- "fill-opacity": t.opacity || 1
11
- }
12
- }
13
- ];
14
- }
15
- function F(t) {
16
- return [
17
- {
18
- type: "line",
19
- paint: {
20
- "line-color": t.color || "#ccc",
21
- "line-opacity": t.opacity || 1
22
- }
23
- }
24
- ];
25
- }
26
- function H(t) {
27
- return [
28
- {
29
- type: "circle",
30
- paint: {
31
- "circle-radius": t.radius || 6,
32
- "circle-stroke-color": t.stroke || "#ccc",
33
- "circle-stroke-width": t.width || 1,
34
- "circle-color": t.color || "blue"
35
- }
36
- }
37
- ];
38
- }
39
- function x(t) {
40
- if (!t) return null;
41
- const e = t.type || "point";
42
- return e === "polygon" ? N(t) : e === "line" ? F(t) : H(t);
43
- }
44
- const O = {
45
- data() {
46
- return {
47
- layerList: [],
48
- activeLayer: ""
49
- };
50
- },
51
- computed: {
52
- interactiveSources() {
53
- return this.layerList.filter((t) => t == null ? void 0 : t.interactive).map((t) => t.id);
54
- }
55
- },
56
- methods: {
57
- moveLayer(t, e = this.map) {
58
- e.getStyle().layers.forEach((i) => {
59
- i.id.match(t) && e.moveLayer(i.id);
60
- });
61
- },
62
- async setVisible(t, e = !0, i = this.map) {
63
- if (!t) return;
64
- const s = (t == null ? void 0 : t.id) || t, o = this.layerList.find((r) => r.id === t) || t;
65
- if (!(o != null && o.id)) throw new Error("MixinError: Layer has no id");
66
- const n = i.getStyle().layers.filter((r) => r.id.match(s));
67
- n.forEach((r) => {
68
- i.setLayoutProperty(
69
- r.id,
70
- "visibility",
71
- e ? "visible" : "none"
72
- );
73
- }), !n.length && e && await this.addLayer(o);
74
- },
75
- async addLayer(t, e = this == null ? void 0 : this.map) {
76
- var o, n;
77
- const i = this.layerList.find((r) => r.id === t) || t;
78
- !this.map.getStyle() || this.map.getStyle().layers.find((r) => r.id === i.id) || (this.layerList.find((r) => r.id === i.id) || this.layerList.push(i), (i.service === "vtile" || i.service === "vector" || (o = i.url) != null && o.includes(".vmt")) && this.addVtileLayer(i, e), i.service === "geojson" && this.addGeoJsonLayer(i, e), ((n = i.url) != null && n.includes(".png") || ["tms", "raster"].includes(i.service)) && await this.addRasterLayer(i, e));
79
- },
80
- async addRasterLayer(t, e = this == null ? void 0 : this.map) {
81
- var i, s;
82
- e.getSource(t.id) || (await e.addSource(t.id, {
83
- type: "raster",
84
- tiles: [t == null ? void 0 : t.url],
85
- tileSize: 256,
86
- ...t != null && t.scheme ? { scheme: t == null ? void 0 : t.scheme } : {}
87
- }), await e.addLayer(
88
- {
89
- id: t.id,
90
- type: "raster",
91
- source: t.id,
92
- minzoom: 0,
93
- maxzoom: (t == null ? void 0 : t.maxzoom) || 22
94
- },
95
- t.basemap ? (s = (i = this.map.getStyle().layers) == null ? void 0 : i[0]) == null ? void 0 : s.id : null
96
- ));
97
- },
98
- async addVtileLayer(t, e = this == null ? void 0 : this.map) {
99
- var n;
100
- const i = ["props", "pointZoom"].filter((r) => t[r]).map((r) => `&${r}=${t[r]}`), s = {
101
- type: "vector",
102
- tiles: [
103
- `${(n = t == null ? void 0 : t.url) != null && n.startsWith("http") ? "" : window.location.origin}${t == null ? void 0 : t.url}${i}`
104
- ],
105
- minzoom: t.minzoom || 3,
106
- maxzoom: t.maxzoom || 24
107
- };
108
- e.addSource(t.id, s), (x(t.style) || t.layers || []).forEach((r, _) => {
109
- const c = {
110
- ...r,
111
- id: `${t.id}-${_}`,
112
- source: t.id,
113
- "source-layer": r["source-layer"] || t.source || t.id,
114
- maxzoom: +r.maxzoom || 24,
115
- minzoom: +r.minzoom || 0
116
- };
117
- e.addLayer(c);
118
- });
119
- },
120
- async addGeoJsonLayer(t, e = this.map) {
121
- var o;
122
- const i = t.data || ((o = t == null ? void 0 : t.url) != null && o.startsWith("http") ? "" : window.location.origin) + t.url;
123
- e.addSource(t.id, { type: "geojson", data: i }), (x(t.style) || t.layers || []).forEach((n) => {
124
- const r = {
125
- ...n,
126
- source: t.id,
127
- id: n.id || t.id,
128
- maxzoom: +n.maxzoom || 24,
129
- minzoom: +n.minzoom || 0,
130
- type: n.type || "circle"
131
- };
132
- e.addLayer(r);
133
- });
134
- },
135
- setLayerData(t, e) {
136
- this.layerList = this.layerList.map((i) => i.id === t ? { ...i, ...e } : i);
137
- },
138
- async removeLayer(t, e = this.map) {
139
- e.getSource(t) && (await e.getStyle().layers.forEach(async (i) => {
140
- i.source === t && await e.removeLayer(i.id);
141
- }), await e.removeSource(t));
142
- },
143
- async setFilter(t, e) {
144
- var o;
145
- const i = this.layerList.find((n) => n.id === t), s = await ((o = this.map) == null ? void 0 : o.getSource(t));
146
- if (s && i.service === "vtile") {
147
- await s.setTiles([
148
- `${window.location.origin}${i.url}${i.url.includes("?") ? "&" : "?"}filter=${e}${i.props ? `&props=${i.props}` : ""}`
149
- ]);
150
- return;
151
- }
152
- s && i.service;
153
- },
154
- async changeBaseLayer(t) {
155
- const e = t != null && t.id ? t : this.layerList.find((s) => s.id === t), { id: i } = e;
156
- if (i && i !== this.activeLayer) {
157
- if (this.activeLayer && this.map.setLayoutProperty(this.activeLayer, "visibility", "none"), this.activeLayer = i, this.map.getLayer(i)) {
158
- this.map.setLayoutProperty(i, "visibility", "visible");
159
- return;
160
- }
161
- await this.addRasterLayer(e);
162
- }
163
- },
164
- async refreshLayer(t, e = this.map) {
165
- await e.getStyle().layers.forEach((i) => {
166
- i.source === t && e.removeLayer(i.id);
167
- }), await e.removeSource(t), this.setVisible(t);
168
- }
169
- }
170
- }, R = {}, W = {
171
- xmlns: "http://www.w3.org/2000/svg",
172
- width: "24",
173
- height: "24",
174
- viewBox: "0 0 24 24",
175
- fill: "none",
176
- stroke: "currentColor",
177
- "stroke-width": "1",
178
- "stroke-linecap": "round",
179
- "stroke-linejoin": "round",
180
- class: "icon icon-tabler icons-tabler-outline icon-tabler-list-details"
181
- };
182
- function J(t, e) {
183
- return h(), l("svg", W, e[0] || (e[0] = [
184
- V('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M13 5h8"></path><path d="M13 9h5"></path><path d="M13 15h8"></path><path d="M13 19h5"></path><path d="M3 4m0 1a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1z"></path><path d="M3 14m0 1a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1z"></path>', 7)
185
- ]));
186
- }
187
- const U = /* @__PURE__ */ p(R, [["render", J]]), Z = {}, q = {
188
- class: "shrink-0 size-3",
189
- xmlns: "http://www.w3.org/2000/svg",
190
- width: "24",
191
- height: "24",
192
- viewBox: "0 0 24 24",
193
- fill: "none",
194
- stroke: "currentColor",
195
- "stroke-width": "2",
196
- "stroke-linecap": "round",
197
- "stroke-linejoin": "round"
198
- };
199
- function A(t, e) {
200
- return h(), l("svg", q, e[0] || (e[0] = [
201
- a("path", { d: "M18 6 6 18" }, null, -1),
202
- a("path", { d: "m6 6 12 12" }, null, -1)
203
- ]));
204
- }
205
- const K = /* @__PURE__ */ p(Z, [["render", A]]), zt = {
206
- pink: ["#fde7e2", "#feafbe", "#fd58a4", "#d7038e", "#86007b"],
207
- blue: ["#f1eef6", "#bdc9e1", "#74a9cf", "#2b8cbe", "#045a8d"],
208
- green: ["#edf8fb", "#b2e2e2", "#66c2a4", "#2ca25f", "#006d2c"],
209
- pink2: ["#f1eef6", "#d7b5d8", "#df65b0", "#dd1c77", "#980043"],
210
- red: ["#fef0d9", "#fdcc8a", "#fc8d59", "#e34a33", "#b30000"],
211
- teal: ["#f6eff7", "#bdc9e1", "#67a9cf", "#1c9099", "#016c59"]
212
- }, Q = {
213
- props: ["map", "coordinates"],
214
- data() {
215
- return {
216
- isMenuVisible: !1
217
- };
218
- },
219
- computed: {
220
- getCoordinates() {
221
- var e;
222
- return !(this != null && this.coordinates) || ((e = this.coordinates) == null ? void 0 : e.length) !== 2 ? "" : (this == null ? void 0 : this.coordinates).slice().reverse().map((i) => Number(i).toFixed(5)).join(", ");
223
- }
224
- }
225
- }, X = { class: "map__settings" }, Y = {
226
- ref: "attribution",
227
- class: "map__settings-attribution map__settings-item mt-[3px]"
228
- };
229
- function T(t, e, i, s, o, n) {
230
- return h(), l("div", X, [
231
- a("div", Y, [
232
- B(a("div", {
233
- ref: "mouse",
234
- class: "map__settings-item",
235
- style: { "min-width": "115px" }
236
- }, L(n.getCoordinates), 513), [
237
- [P, n.getCoordinates]
238
- ])
239
- ], 512)
240
- ]);
241
- }
242
- const St = /* @__PURE__ */ p(Q, [["render", T]]), I = {
243
- mixins: [O],
244
- props: {
245
- map: { type: Object, default: () => null }
246
- },
247
- data() {
248
- return {
249
- baseLayers: [
250
- {
251
- id: "orto10",
252
- name: "Ortophoto 1:10К",
253
- url: "https://data.gki.com.ua/api-user/rtile/orto10/ua/{z}/{x}/{y}.png",
254
- service: "TMS",
255
- image: "https://data.gki.com.ua/api-user/rtile/orto10/ua/13/4954/2876.png"
256
- },
257
- {
258
- id: "graymap",
259
- name: "Сіра карта",
260
- url: "https://data.gki.com.ua/api-user/rtile/voyager/ua/{z}/{x}/{y}.png",
261
- service: "TMS",
262
- image: "https://data.gki.com.ua/api-user/rtile/positron/ua/10/601/348.png"
263
- }
264
- ]
265
- };
266
- },
267
- watch: {
268
- map(t) {
269
- t && t.on("load", this.handleMapLoad);
270
- }
271
- },
272
- created() {
273
- this.baseLayers.forEach((t) => {
274
- const e = { ...t, basemap: !0 };
275
- this.layerList.push(e);
276
- });
277
- },
278
- methods: {
279
- handleMapLoad() {
280
- this.changeBaseLayer("graymap");
281
- },
282
- isLayerInFocus(t) {
283
- return t.id === this.activeLayer;
284
- }
285
- }
286
- }, tt = { class: "vs-map-slot-layers" }, et = ["onClick"], it = ["src"];
287
- function st(t, e, i, s, o, n) {
288
- return h(), l("div", tt, [
289
- (h(!0), l(z, null, S(o.baseLayers, (r) => (h(), l("div", {
290
- key: r.id,
291
- class: G(["vs-map-slot-layers__layer", { focused: n.isLayerInFocus(r) }]),
292
- onClick: (_) => t.changeBaseLayer(r.id)
293
- }, [
294
- a("img", {
295
- src: r.image,
296
- class: "vs-map-slot-layers__image"
297
- }, null, 8, it)
298
- ], 10, et))), 128))
299
- ]);
300
- }
301
- const Et = /* @__PURE__ */ p(I, [["render", st]]);
302
- function E(t, e, i) {
303
- if (t !== null)
304
- for (var s, o, n, r, _, c, y, b = 0, u = 0, v, k = t.type, $ = k === "FeatureCollection", M = k === "Feature", C = $ ? t.features.length : 1, f = 0; f < C; f++) {
305
- y = $ ? t.features[f].geometry : M ? t.geometry : t, v = y ? y.type === "GeometryCollection" : !1, _ = v ? y.geometries.length : 1;
306
- for (var w = 0; w < _; w++) {
307
- var d = 0, m = 0;
308
- if (r = v ? y.geometries[w] : y, r !== null) {
309
- c = r.coordinates;
310
- var g = r.type;
311
- switch (b = 0, g) {
312
- case null:
313
- break;
314
- case "Point":
315
- if (e(
316
- c,
317
- u,
318
- f,
319
- d,
320
- m
321
- ) === !1)
322
- return !1;
323
- u++, d++;
324
- break;
325
- case "LineString":
326
- case "MultiPoint":
327
- for (s = 0; s < c.length; s++) {
328
- if (e(
329
- c[s],
330
- u,
331
- f,
332
- d,
333
- m
334
- ) === !1)
335
- return !1;
336
- u++, g === "MultiPoint" && d++;
337
- }
338
- g === "LineString" && d++;
339
- break;
340
- case "Polygon":
341
- case "MultiLineString":
342
- for (s = 0; s < c.length; s++) {
343
- for (o = 0; o < c[s].length - b; o++) {
344
- if (e(
345
- c[s][o],
346
- u,
347
- f,
348
- d,
349
- m
350
- ) === !1)
351
- return !1;
352
- u++;
353
- }
354
- g === "MultiLineString" && d++, g === "Polygon" && m++;
355
- }
356
- g === "Polygon" && d++;
357
- break;
358
- case "MultiPolygon":
359
- for (s = 0; s < c.length; s++) {
360
- for (m = 0, o = 0; o < c[s].length; o++) {
361
- for (n = 0; n < c[s][o].length - b; n++) {
362
- if (e(
363
- c[s][o][n],
364
- u,
365
- f,
366
- d,
367
- m
368
- ) === !1)
369
- return !1;
370
- u++;
371
- }
372
- m++;
373
- }
374
- d++;
375
- }
376
- break;
377
- case "GeometryCollection":
378
- for (s = 0; s < r.geometries.length; s++)
379
- if (E(r.geometries[s], e) === !1)
380
- return !1;
381
- break;
382
- default:
383
- throw new Error("Unknown Geometry Type");
384
- }
385
- }
386
- }
387
- }
388
- }
389
- function rt(t, e = {}) {
390
- if (t.bbox != null && e.recompute !== !0)
391
- return t.bbox;
392
- const i = [1 / 0, 1 / 0, -1 / 0, -1 / 0];
393
- return E(t, (s) => {
394
- i[0] > s[0] && (i[0] = s[0]), i[1] > s[1] && (i[1] = s[1]), i[2] < s[0] && (i[2] = s[0]), i[3] < s[1] && (i[3] = s[1]);
395
- }), i;
396
- }
397
- const ot = {}, nt = {
398
- xmlns: "http://www.w3.org/2000/svg",
399
- width: "24",
400
- height: "24",
401
- viewBox: "0 0 24 24",
402
- fill: "none",
403
- stroke: "currentColor",
404
- "stroke-width": "1",
405
- "stroke-linecap": "round",
406
- "stroke-linejoin": "round",
407
- class: "icon icon-tabler icons-tabler-outline icon-tabler-home"
408
- };
409
- function at(t, e) {
410
- return h(), l("svg", nt, e[0] || (e[0] = [
411
- a("path", {
412
- stroke: "none",
413
- d: "M0 0h24v24H0z",
414
- fill: "none"
415
- }, null, -1),
416
- a("path", { d: "M5 12l-2 0l9 -9l9 9l-2 0" }, null, -1),
417
- a("path", { d: "M5 12v7a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-7" }, null, -1),
418
- a("path", { d: "M9 21v-6a2 2 0 0 1 2 -2h2a2 2 0 0 1 2 2v6" }, null, -1)
419
- ]));
420
- }
421
- const ct = /* @__PURE__ */ p(ot, [["render", at]]), lt = {
422
- props: ["bbox", "map"],
423
- components: { homeIcon: ct },
424
- methods: {
425
- setBounds() {
426
- const t = {
427
- type: "Feature",
428
- geometry: this == null ? void 0 : this.bbox
429
- }, e = rt(t);
430
- this.map.fitBounds(e);
431
- }
432
- }
433
- }, ht = { class: "z-100 flex justify-center items-center rounded-md w-[32px] h-[32px] cursor-pointer bg-white p-1 border-[2px]" };
434
- function dt(t, e, i, s, o, n) {
435
- const r = j("homeIcon");
436
- return h(), l("div", ht, [
437
- D(r, { onClick: n.setBounds }, null, 8, ["onClick"])
438
- ]);
439
- }
440
- const Mt = /* @__PURE__ */ p(lt, [["render", dt]]), ut = {}, pt = {
441
- class: "shrink-0 size-4",
442
- xmlns: "http://www.w3.org/2000/svg",
443
- width: "24",
444
- height: "24",
445
- viewBox: "0 0 24 24",
446
- fill: "#9E9E9E",
447
- stroke: "#9E9E9E",
448
- "stroke-width": "2",
449
- "stroke-linecap": "#9E9E9E",
450
- "stroke-linejoin": "#9E9E9E"
451
- };
452
- function ft(t, e) {
453
- return h(), l("svg", pt, e[0] || (e[0] = [
454
- a("circle", {
455
- cx: "12",
456
- cy: "12",
457
- r: "1"
458
- }, null, -1),
459
- a("circle", {
460
- cx: "12",
461
- cy: "5",
462
- r: "1"
463
- }, null, -1),
464
- a("circle", {
465
- cx: "12",
466
- cy: "19",
467
- r: "1"
468
- }, null, -1)
469
- ]));
470
- }
471
- const mt = /* @__PURE__ */ p(ut, [["render", ft]]), yt = {
472
- components: { legendIcon: U, menuIcon: mt, closeIcon: K },
473
- props: ["source", "count", "total", "mapId"],
474
- data() {
475
- return {
476
- isOpenLegend: !1,
477
- palette: ["#69D2E7", "yellow", "#FE4365"]
478
- };
479
- },
480
- methods: {
481
- calcSize(t) {
482
- return t / this.maxValue * 100 * 50 / 100;
483
- }
484
- },
485
- computed: {
486
- maxValue() {
487
- var t, e, i, s, o, n;
488
- return ((t = this.sizes) == null ? void 0 : t[0]) > ((i = this.sizes) == null ? void 0 : i[((e = this.sizes) == null ? void 0 : e.length) - 1]) ? (s = this.sizes) == null ? void 0 : s[0] : (n = this.sizes) == null ? void 0 : n[((o = this.sizes) == null ? void 0 : o.length) - 1];
489
- }
490
- }
491
- }, gt = { class: "w-full h-[calc(100%-40px)] bg-white" }, _t = { class: "w-full flex flex-col gap-[8px] h-[250px] overflow-auto [&::-webkit-scrollbar]:h-1.5 [&::-webkit-scrollbar]:w-1.5 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-gray-300 [&::-webkit-scrollbar-track]:bg-transparent text-xs" }, bt = { class: "relative min-w-full bg-white text-[12px]" }, vt = { class: "divide-gray-200 dark:divide-neutral-700" }, wt = { class: "px-2 py-1" }, Lt = { class: "px-2 py-1" };
492
- function kt(t, e, i, s, o, n) {
493
- return h(), l("div", gt, [
494
- a("div", _t, [
495
- a("table", bt, [
496
- e[0] || (e[0] = a("thead", { class: "sticky top-[-1px] z-[1] bg-white w-full after:absolute after:content-[''] after:block after:w-full after:h-px after:bg-stone-200" }, [
497
- a("tr", null, [
498
- a("th", { class: "px-2 py-1 text-start" }, "Назва"),
499
- a("th", { class: "px-2 py-1 text-start" }, "Метрика")
500
- ])
501
- ], -1)),
502
- a("tbody", vt, [
503
- (h(!0), l(z, null, S(i.source, (r) => (h(), l("tr", {
504
- key: r.id,
505
- class: "border-b cursor-pointer hover:bg-gray-100 odd:bg-gray-50"
506
- }, [
507
- a("td", wt, L(r.title || "—"), 1),
508
- a("td", Lt, L(r.metric), 1)
509
- ]))), 128))
510
- ])
511
- ])
512
- ])
513
- ]);
514
- }
515
- const Ct = /* @__PURE__ */ p(yt, [["render", kt]]);
516
- export {
517
- Ct as V,
518
- Mt as a,
519
- Et as b,
520
- K as c,
521
- St as d,
522
- O as e,
523
- U as l,
524
- zt as p
525
- };