@datagouv/components-next 1.0.2-dev.113 → 1.0.2-dev.115
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/dist/{Control-ZFh5ta_U.js → Control-b-43UT2B.js} +10 -10
- package/dist/{Datafair.client-CKB2P_X1.js → Datafair.client-BH351yV9.js} +4 -4
- package/dist/{Event-DSQcW7OF.js → Event-py_AAwJY.js} +18 -18
- package/dist/{Image-BijNEG0p.js → Image-BHQYZWzH.js} +23 -23
- package/dist/{JsonPreview.client-Bx11-jfT.js → JsonPreview.client-CawLfTe_.js} +5 -5
- package/dist/{Map-BUtPf5GN.js → Map-CtP7leHl.js} +1313 -1173
- package/dist/{MapContainer.client-CdZSeT_L.js → MapContainer.client-DN8kHTOA.js} +17 -17
- package/dist/{OSM-D4MTdBtk.js → OSM-gdDSIsDA.js} +15 -23
- package/dist/{PdfPreview.client-Bh9lP-qU.js → PdfPreview.client-BGOycK0h.js} +6 -10
- package/dist/Pmtiles.client-CRaI4U8S.js +26123 -0
- package/dist/{PreviewWrapper.vue_vue_type_script_setup_true_lang-BnC7vWGP.js → PreviewWrapper.vue_vue_type_script_setup_true_lang-DAddoRna.js} +2 -2
- package/dist/{ScaleLine-hJQIqcZm.js → ScaleLine-hG-FhNqy.js} +2 -2
- package/dist/{Tile-Dcl7oIVu.js → Tile-D6rFonpT.js} +163 -166
- package/dist/{TileImage-BJeHipMX.js → TileImage-cfrEgz5y.js} +131 -119
- package/dist/{View-xp_P_OHw.js → View-vp7vDb9q.js} +169 -119
- package/dist/{XmlPreview.client-oFAOv828.js → XmlPreview.client-Dyv0J4kw.js} +5 -5
- package/dist/{common-BjQlan3k.js → common-C8efyyuc.js} +49 -49
- package/dist/components-next.css +1 -52
- package/dist/components-next.js +36 -36
- package/dist/components.css +2 -2
- package/dist/{index-CxCuKQ81.js → index-_qLRU0Z5.js} +6382 -6057
- package/dist/{leaflet-src-7m1mB8LI.js → leaflet-src-D_sX6kLJ.js} +162 -164
- package/dist/{main-CQ9ZQG7n.js → main-CR8bhz_w.js} +19161 -20321
- package/dist/{proj-CsNo9yH1.js → proj-CsjVeojN.js} +322 -306
- package/dist/{text-clamp.esm-B5kW_XMt.js → text-clamp.esm-DVseBqZZ.js} +4 -4
- package/dist/{tilecoord-A0fLnBZr.js → tilecoord-CPcQJnrF.js} +270 -261
- package/dist/{vue3-json-viewer-BXwup7nO.js → vue3-json-viewer-CJLQFzXZ.js} +10 -16
- package/dist/{vue3-xml-viewer.common-B9qp90K_.js → vue3-xml-viewer.common-DRgxPToX.js} +1 -1
- package/package.json +34 -34
- package/src/components/ResourceAccordion/Pmtiles.client.vue +3 -1
- package/dist/Pmtiles.client-Bi46wN14.js +0 -25185
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { T as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { T as d, b as nt, l as xt, c as H, r as st } from "./Image-BHQYZWzH.js";
|
|
2
|
+
import { f as Tt, b as pt } from "./common-C8efyyuc.js";
|
|
3
|
+
import { c as It, E as ft, d as Xt, aS as _t, ag as rt, u as Mt, X as vt, ae as b, ao as y, ai as dt, aI as Wt, y as gt, aa as Yt, $ as yt, I as Pt, ak as Lt, aj as Ot, a9 as Ft, a8 as wt, a7 as et, m as ot, aq as Dt, aA as $, Y as z, af as V, ax as Ct, aV as at, p as ht, aX as At, am as Rt } from "./proj-CsjVeojN.js";
|
|
4
4
|
class mt extends It {
|
|
5
5
|
/**
|
|
6
6
|
* @param {import("./tilecoord.js").TileCoord} tileCoord Tile coordinate.
|
|
7
7
|
* @param {import("./TileState.js").default} state State.
|
|
8
8
|
* @param {Options} [options] Tile options.
|
|
9
9
|
*/
|
|
10
|
-
constructor(t,
|
|
11
|
-
super(),
|
|
10
|
+
constructor(t, s, e) {
|
|
11
|
+
super(), e = e || {}, this.tileCoord = t, this.state = s, this.key = "", this.transition_ = e.transition === void 0 ? 250 : e.transition, this.transitionStarts_ = {}, this.interpolate = !!e.interpolate;
|
|
12
12
|
}
|
|
13
13
|
/**
|
|
14
14
|
* @protected
|
|
@@ -20,7 +20,7 @@ class mt extends It {
|
|
|
20
20
|
* Called by the tile cache when the tile is removed from the cache due to expiry
|
|
21
21
|
*/
|
|
22
22
|
release() {
|
|
23
|
-
this.setState(
|
|
23
|
+
this.setState(d.EMPTY);
|
|
24
24
|
}
|
|
25
25
|
/**
|
|
26
26
|
* @return {string} Key.
|
|
@@ -51,8 +51,8 @@ class mt extends It {
|
|
|
51
51
|
* @api
|
|
52
52
|
*/
|
|
53
53
|
setState(t) {
|
|
54
|
-
if (this.state !==
|
|
55
|
-
if (this.state !==
|
|
54
|
+
if (this.state !== d.EMPTY) {
|
|
55
|
+
if (this.state !== d.ERROR && this.state > t)
|
|
56
56
|
throw new Error("Tile load sequence violation");
|
|
57
57
|
this.state = t, this.changed();
|
|
58
58
|
}
|
|
@@ -73,16 +73,16 @@ class mt extends It {
|
|
|
73
73
|
* @param {number} time The render frame time.
|
|
74
74
|
* @return {number} A number between 0 and 1.
|
|
75
75
|
*/
|
|
76
|
-
getAlpha(t,
|
|
76
|
+
getAlpha(t, s) {
|
|
77
77
|
if (!this.transition_)
|
|
78
78
|
return 1;
|
|
79
|
-
let
|
|
80
|
-
if (!
|
|
81
|
-
|
|
82
|
-
else if (
|
|
79
|
+
let e = this.transitionStarts_[t];
|
|
80
|
+
if (!e)
|
|
81
|
+
e = s, this.transitionStarts_[t] = e;
|
|
82
|
+
else if (e === -1)
|
|
83
83
|
return 1;
|
|
84
|
-
const
|
|
85
|
-
return
|
|
84
|
+
const r = s - e + 1e3 / 60;
|
|
85
|
+
return r >= this.transition_ ? 1 : Tt(r / this.transition_);
|
|
86
86
|
}
|
|
87
87
|
/**
|
|
88
88
|
* Determine if a tile is in an alpha transition. A tile is considered in
|
|
@@ -108,17 +108,17 @@ class mt extends It {
|
|
|
108
108
|
this.release(), super.disposeInternal();
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
|
-
class
|
|
111
|
+
class $t extends mt {
|
|
112
112
|
/**
|
|
113
113
|
* @param {import("./tilecoord.js").TileCoord} tileCoord Tile coordinate.
|
|
114
114
|
* @param {import("./TileState.js").default} state State.
|
|
115
115
|
* @param {string} src Image source URI.
|
|
116
|
-
* @param {
|
|
116
|
+
* @param {import('./dom.js').ImageAttributes} imageAttributes Image attributes options.
|
|
117
117
|
* @param {import("./Tile.js").LoadFunction} tileLoadFunction Tile load function.
|
|
118
118
|
* @param {import("./Tile.js").Options} [options] Tile options.
|
|
119
119
|
*/
|
|
120
|
-
constructor(t,
|
|
121
|
-
super(t,
|
|
120
|
+
constructor(t, s, e, r, i, c) {
|
|
121
|
+
super(t, s, c), this.crossOrigin_ = r?.crossOrigin, this.referrerPolicy_ = r?.referrerPolicy, this.src_ = e, this.key = e, this.image_, nt ? this.image_ = new OffscreenCanvas(1, 1) : (this.image_ = new Image(), this.crossOrigin_ !== null && (this.image_.crossOrigin = this.crossOrigin_), this.referrerPolicy_ !== void 0 && (this.image_.referrerPolicy = this.referrerPolicy_)), this.unlisten_ = null, this.tileLoadFunction_ = i;
|
|
122
122
|
}
|
|
123
123
|
/**
|
|
124
124
|
* Get the HTML image element for this tile (may be a Canvas, OffscreenCanvas, Image, or Video).
|
|
@@ -133,7 +133,7 @@ class zt extends mt {
|
|
|
133
133
|
* @param {HTMLCanvasElement|OffscreenCanvas|HTMLImageElement} element Element.
|
|
134
134
|
*/
|
|
135
135
|
setImage(t) {
|
|
136
|
-
this.image_ = t, this.state =
|
|
136
|
+
this.image_ = t, this.state = d.LOADED, this.unlistenImage_(), this.changed();
|
|
137
137
|
}
|
|
138
138
|
/**
|
|
139
139
|
* Get the cross origin of the ImageTile.
|
|
@@ -142,13 +142,20 @@ class zt extends mt {
|
|
|
142
142
|
getCrossOrigin() {
|
|
143
143
|
return this.crossOrigin_;
|
|
144
144
|
}
|
|
145
|
+
/**
|
|
146
|
+
* Get the referrer policy of the ImageTile.
|
|
147
|
+
* @return {ReferrerPolicy} Referrer policy.
|
|
148
|
+
*/
|
|
149
|
+
getReferrerPolicy() {
|
|
150
|
+
return this.referrerPolicy_;
|
|
151
|
+
}
|
|
145
152
|
/**
|
|
146
153
|
* Tracks loading or read errors.
|
|
147
154
|
*
|
|
148
155
|
* @private
|
|
149
156
|
*/
|
|
150
157
|
handleImageError_() {
|
|
151
|
-
this.state =
|
|
158
|
+
this.state = d.ERROR, this.unlistenImage_(), this.image_ = kt(), this.changed();
|
|
152
159
|
}
|
|
153
160
|
/**
|
|
154
161
|
* Tracks successful image load.
|
|
@@ -157,13 +164,13 @@ class zt extends mt {
|
|
|
157
164
|
*/
|
|
158
165
|
handleImageLoad_() {
|
|
159
166
|
if (nt)
|
|
160
|
-
this.state =
|
|
167
|
+
this.state = d.LOADED;
|
|
161
168
|
else {
|
|
162
169
|
const t = (
|
|
163
170
|
/** @type {HTMLImageElement} */
|
|
164
171
|
this.image_
|
|
165
172
|
);
|
|
166
|
-
t.naturalWidth && t.naturalHeight ? this.state =
|
|
173
|
+
t.naturalWidth && t.naturalHeight ? this.state = d.LOADED : this.state = d.EMPTY;
|
|
167
174
|
}
|
|
168
175
|
this.unlistenImage_(), this.changed();
|
|
169
176
|
}
|
|
@@ -205,7 +212,7 @@ class zt extends mt {
|
|
|
205
212
|
* @override
|
|
206
213
|
*/
|
|
207
214
|
load() {
|
|
208
|
-
this.state ==
|
|
215
|
+
this.state == d.ERROR && (this.state = d.IDLE, this.image_ = new Image(), this.crossOrigin_ !== null && (this.image_.crossOrigin = this.crossOrigin_), this.referrerPolicy_ !== void 0 && (this.image_.referrerPolicy = this.referrerPolicy_)), this.state == d.IDLE && (this.state = d.LOADING, this.changed(), this.tileLoadFunction_(this, this.src_), this.unlisten_ = xt(
|
|
209
216
|
this.image_,
|
|
210
217
|
this.handleImageLoad_.bind(this),
|
|
211
218
|
this.handleImageError_.bind(this)
|
|
@@ -227,8 +234,8 @@ class zt extends mt {
|
|
|
227
234
|
}
|
|
228
235
|
}
|
|
229
236
|
function kt() {
|
|
230
|
-
const
|
|
231
|
-
return
|
|
237
|
+
const n = H(1, 1);
|
|
238
|
+
return n.fillStyle = "rgba(0,0,0,0)", n.fillRect(0, 0, 1, 1), n.canvas;
|
|
232
239
|
}
|
|
233
240
|
class Bt {
|
|
234
241
|
/**
|
|
@@ -237,8 +244,8 @@ class Bt {
|
|
|
237
244
|
* @param {number} minY Minimum Y.
|
|
238
245
|
* @param {number} maxY Maximum Y.
|
|
239
246
|
*/
|
|
240
|
-
constructor(t,
|
|
241
|
-
this.minX = t, this.maxX =
|
|
247
|
+
constructor(t, s, e, r) {
|
|
248
|
+
this.minX = t, this.maxX = s, this.minY = e, this.maxY = r;
|
|
242
249
|
}
|
|
243
250
|
/**
|
|
244
251
|
* @param {import("./tilecoord.js").TileCoord} tileCoord Tile coordinate.
|
|
@@ -259,8 +266,8 @@ class Bt {
|
|
|
259
266
|
* @param {number} y Tile coordinate y.
|
|
260
267
|
* @return {boolean} Contains coordinate.
|
|
261
268
|
*/
|
|
262
|
-
containsXY(t,
|
|
263
|
-
return this.minX <= t && t <= this.maxX && this.minY <=
|
|
269
|
+
containsXY(t, s) {
|
|
270
|
+
return this.minX <= t && t <= this.maxX && this.minY <= s && s <= this.maxY;
|
|
264
271
|
}
|
|
265
272
|
/**
|
|
266
273
|
* @param {TileRange} tileRange Tile range.
|
|
@@ -301,97 +308,97 @@ class Bt {
|
|
|
301
308
|
return this.minX <= t.maxX && this.maxX >= t.minX && this.minY <= t.maxY && this.maxY >= t.minY;
|
|
302
309
|
}
|
|
303
310
|
}
|
|
304
|
-
function
|
|
305
|
-
return
|
|
311
|
+
function zt(n, t, s, e, r) {
|
|
312
|
+
return r !== void 0 ? (r.minX = n, r.maxX = t, r.minY = s, r.maxY = e, r) : new Bt(n, t, s, e);
|
|
306
313
|
}
|
|
307
314
|
let J;
|
|
308
315
|
const B = [];
|
|
309
|
-
function ct(
|
|
310
|
-
|
|
316
|
+
function ct(n, t, s, e, r) {
|
|
317
|
+
n.beginPath(), n.moveTo(0, 0), n.lineTo(t, s), n.lineTo(e, r), n.closePath(), n.save(), n.clip(), n.fillRect(0, 0, Math.max(t, e) + 1, Math.max(s, r)), n.restore();
|
|
311
318
|
}
|
|
312
|
-
function tt(
|
|
313
|
-
return Math.abs(
|
|
319
|
+
function tt(n, t) {
|
|
320
|
+
return Math.abs(n[t * 4] - 210) > 2 || Math.abs(n[t * 4 + 3] - 0.75 * 255) > 2;
|
|
314
321
|
}
|
|
315
322
|
function Gt() {
|
|
316
323
|
if (J === void 0) {
|
|
317
|
-
const
|
|
318
|
-
|
|
319
|
-
const t =
|
|
320
|
-
J = tt(t, 0) || tt(t, 4) || tt(t, 8),
|
|
324
|
+
const n = H(6, 6, B);
|
|
325
|
+
n.globalCompositeOperation = "lighter", n.fillStyle = "rgba(210, 0, 0, 0.75)", ct(n, 4, 5, 4, 0), ct(n, 4, 5, 0, 5);
|
|
326
|
+
const t = n.getImageData(0, 0, 3, 3).data;
|
|
327
|
+
J = tt(t, 0) || tt(t, 4) || tt(t, 8), st(n), B.push(n.canvas);
|
|
321
328
|
}
|
|
322
329
|
return J;
|
|
323
330
|
}
|
|
324
|
-
function ut(
|
|
325
|
-
const
|
|
326
|
-
let i =
|
|
331
|
+
function ut(n, t, s, e) {
|
|
332
|
+
const r = _t(s, t, n);
|
|
333
|
+
let i = rt(
|
|
327
334
|
t,
|
|
328
|
-
|
|
329
|
-
|
|
335
|
+
e,
|
|
336
|
+
s
|
|
330
337
|
);
|
|
331
338
|
const c = t.getMetersPerUnit();
|
|
332
339
|
c !== void 0 && (i *= c);
|
|
333
|
-
const m =
|
|
340
|
+
const m = n.getMetersPerUnit();
|
|
334
341
|
m !== void 0 && (i /= m);
|
|
335
|
-
const g =
|
|
336
|
-
if (!g ||
|
|
337
|
-
const T =
|
|
342
|
+
const g = n.getExtent();
|
|
343
|
+
if (!g || Mt(g, r)) {
|
|
344
|
+
const T = rt(n, i, r) / i;
|
|
338
345
|
isFinite(T) && T > 0 && (i /= T);
|
|
339
346
|
}
|
|
340
347
|
return i;
|
|
341
348
|
}
|
|
342
|
-
function
|
|
343
|
-
const
|
|
349
|
+
function Nt(n, t, s, e) {
|
|
350
|
+
const r = Yt(s);
|
|
344
351
|
let i = ut(
|
|
345
|
-
a,
|
|
346
|
-
t,
|
|
347
352
|
n,
|
|
348
|
-
|
|
353
|
+
t,
|
|
354
|
+
r,
|
|
355
|
+
e
|
|
349
356
|
);
|
|
350
|
-
return (!isFinite(i) || i <= 0) &&
|
|
357
|
+
return (!isFinite(i) || i <= 0) && yt(s, function(c) {
|
|
351
358
|
return i = ut(
|
|
352
|
-
|
|
359
|
+
n,
|
|
353
360
|
t,
|
|
354
361
|
c,
|
|
355
|
-
|
|
362
|
+
e
|
|
356
363
|
), isFinite(i) && i > 0;
|
|
357
364
|
}), i;
|
|
358
365
|
}
|
|
359
|
-
function
|
|
360
|
-
const
|
|
361
|
-
Math.round(
|
|
362
|
-
Math.round(
|
|
366
|
+
function St(n, t, s, e, r, i, c, m, g, T, X, x, P, L) {
|
|
367
|
+
const a = H(
|
|
368
|
+
Math.round(s * n),
|
|
369
|
+
Math.round(s * t),
|
|
363
370
|
B
|
|
364
371
|
);
|
|
365
|
-
if (x || (
|
|
366
|
-
return
|
|
367
|
-
|
|
372
|
+
if (x || (a.imageSmoothingEnabled = !1), g.length === 0)
|
|
373
|
+
return a.canvas;
|
|
374
|
+
a.scale(s, s);
|
|
368
375
|
function h(o) {
|
|
369
|
-
return Math.round(o *
|
|
376
|
+
return Math.round(o * s) / s;
|
|
370
377
|
}
|
|
371
|
-
|
|
372
|
-
const E =
|
|
373
|
-
g.forEach(function(o,
|
|
374
|
-
|
|
378
|
+
a.globalCompositeOperation = "lighter";
|
|
379
|
+
const E = gt();
|
|
380
|
+
g.forEach(function(o, O, w) {
|
|
381
|
+
vt(E, o.extent);
|
|
375
382
|
});
|
|
376
383
|
let l;
|
|
377
|
-
const f =
|
|
378
|
-
(!
|
|
379
|
-
Math.round(
|
|
384
|
+
const f = s / e, _ = (x ? 1 : 1 + Math.pow(2, -24)) / f;
|
|
385
|
+
(!P || g.length !== 1 || T !== 0) && (l = H(
|
|
386
|
+
Math.round(y(E) * f),
|
|
380
387
|
Math.round(b(E) * f),
|
|
381
388
|
B
|
|
382
|
-
), x || (l.imageSmoothingEnabled = !1), g.forEach(function(o,
|
|
389
|
+
), x || (l.imageSmoothingEnabled = !1), g.forEach(function(o, O, w) {
|
|
383
390
|
if (o.image.width > 0 && o.image.height > 0) {
|
|
384
391
|
if (o.clipExtent) {
|
|
385
392
|
l.save();
|
|
386
|
-
const
|
|
393
|
+
const M = (o.clipExtent[0] - E[0]) * f, W = -(o.clipExtent[3] - E[3]) * f, D = y(o.clipExtent) * f, A = b(o.clipExtent) * f;
|
|
387
394
|
l.rect(
|
|
388
|
-
x ? W : Math.round(W),
|
|
389
395
|
x ? M : Math.round(M),
|
|
390
|
-
x ?
|
|
391
|
-
x ?
|
|
396
|
+
x ? W : Math.round(W),
|
|
397
|
+
x ? D : Math.round(M + D) - Math.round(M),
|
|
398
|
+
x ? A : Math.round(W + A) - Math.round(W)
|
|
392
399
|
), l.clip();
|
|
393
400
|
}
|
|
394
|
-
const p = (o.extent[0] - E[0]) * f, I = -(o.extent[3] - E[3]) * f, v =
|
|
401
|
+
const p = (o.extent[0] - E[0]) * f, I = -(o.extent[3] - E[3]) * f, v = y(o.extent) * f, Y = b(o.extent) * f;
|
|
395
402
|
l.drawImage(
|
|
396
403
|
o.image,
|
|
397
404
|
T,
|
|
@@ -405,69 +412,69 @@ function Nt(a, t, e, s, n, i, c, m, g, T, X, x, F, w) {
|
|
|
405
412
|
), o.clipExtent && l.restore();
|
|
406
413
|
}
|
|
407
414
|
}));
|
|
408
|
-
const u =
|
|
409
|
-
return m.getTriangles().forEach(function(o,
|
|
415
|
+
const u = dt(c);
|
|
416
|
+
return m.getTriangles().forEach(function(o, O, w) {
|
|
410
417
|
const p = o.source, I = o.target;
|
|
411
|
-
let v = p[0][0], Y = p[0][1],
|
|
412
|
-
const G = h((I[0][0] - u[0]) / i),
|
|
418
|
+
let v = p[0][0], Y = p[0][1], M = p[1][0], W = p[1][1], D = p[2][0], A = p[2][1];
|
|
419
|
+
const G = h((I[0][0] - u[0]) / i), N = h(
|
|
413
420
|
-(I[0][1] - u[1]) / i
|
|
414
421
|
), R = h((I[1][0] - u[0]) / i), k = h(
|
|
415
422
|
-(I[1][1] - u[1]) / i
|
|
416
|
-
),
|
|
423
|
+
), Q = h((I[2][0] - u[0]) / i), U = h(
|
|
417
424
|
-(I[2][1] - u[1]) / i
|
|
418
425
|
), j = v, q = Y;
|
|
419
|
-
v = 0, Y = 0,
|
|
426
|
+
v = 0, Y = 0, M -= j, W -= q, D -= j, A -= q;
|
|
420
427
|
const Et = [
|
|
421
|
-
[
|
|
422
|
-
[D, A, 0, 0,
|
|
423
|
-
[0, 0,
|
|
424
|
-
[0, 0, D, A,
|
|
425
|
-
],
|
|
426
|
-
if (!
|
|
428
|
+
[M, W, 0, 0, R - G],
|
|
429
|
+
[D, A, 0, 0, Q - G],
|
|
430
|
+
[0, 0, M, W, k - N],
|
|
431
|
+
[0, 0, D, A, U - N]
|
|
432
|
+
], S = Wt(Et);
|
|
433
|
+
if (!S)
|
|
427
434
|
return;
|
|
428
|
-
if (
|
|
429
|
-
|
|
430
|
-
const
|
|
431
|
-
for (let
|
|
432
|
-
|
|
433
|
-
R + h((
|
|
434
|
-
k + h(
|
|
435
|
-
),
|
|
436
|
-
R + h((
|
|
437
|
-
k + h((
|
|
435
|
+
if (a.save(), a.beginPath(), Gt() || !x) {
|
|
436
|
+
a.moveTo(R, k);
|
|
437
|
+
const F = 4, K = G - R, it = N - k;
|
|
438
|
+
for (let C = 0; C < F; C++)
|
|
439
|
+
a.lineTo(
|
|
440
|
+
R + h((C + 1) * K / F),
|
|
441
|
+
k + h(C * it / (F - 1))
|
|
442
|
+
), C != F - 1 && a.lineTo(
|
|
443
|
+
R + h((C + 1) * K / F),
|
|
444
|
+
k + h((C + 1) * it / (F - 1))
|
|
438
445
|
);
|
|
439
|
-
|
|
446
|
+
a.lineTo(Q, U);
|
|
440
447
|
} else
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
448
|
+
a.moveTo(R, k), a.lineTo(G, N), a.lineTo(Q, U);
|
|
449
|
+
a.clip(), a.transform(
|
|
450
|
+
S[0],
|
|
451
|
+
S[2],
|
|
452
|
+
S[1],
|
|
453
|
+
S[3],
|
|
447
454
|
G,
|
|
448
|
-
|
|
449
|
-
),
|
|
455
|
+
N
|
|
456
|
+
), a.translate(
|
|
450
457
|
E[0] - j,
|
|
451
458
|
E[3] - q
|
|
452
459
|
);
|
|
453
460
|
let Z;
|
|
454
461
|
if (l)
|
|
455
|
-
Z = l.canvas,
|
|
462
|
+
Z = l.canvas, a.scale(_, -_);
|
|
456
463
|
else {
|
|
457
|
-
const
|
|
458
|
-
Z =
|
|
459
|
-
|
|
460
|
-
-b(
|
|
464
|
+
const F = g[0], K = F.extent;
|
|
465
|
+
Z = F.image, a.scale(
|
|
466
|
+
y(K) / Z.width,
|
|
467
|
+
-b(K) / Z.height
|
|
461
468
|
);
|
|
462
469
|
}
|
|
463
|
-
|
|
464
|
-
}), l && (
|
|
465
|
-
const p = o.target, I = (p[0][0] - u[0]) / i, v = -(p[0][1] - u[1]) / i, Y = (p[1][0] - u[0]) / i,
|
|
466
|
-
|
|
467
|
-
}),
|
|
470
|
+
a.drawImage(Z, 0, 0), a.restore();
|
|
471
|
+
}), l && (st(l), B.push(l.canvas)), X && (a.save(), a.globalCompositeOperation = "source-over", a.strokeStyle = "black", a.lineWidth = 1, m.getTriangles().forEach(function(o, O, w) {
|
|
472
|
+
const p = o.target, I = (p[0][0] - u[0]) / i, v = -(p[0][1] - u[1]) / i, Y = (p[1][0] - u[0]) / i, M = -(p[1][1] - u[1]) / i, W = (p[2][0] - u[0]) / i, D = -(p[2][1] - u[1]) / i;
|
|
473
|
+
a.beginPath(), a.moveTo(Y, M), a.lineTo(I, v), a.lineTo(W, D), a.closePath(), a.stroke();
|
|
474
|
+
}), a.restore()), a.canvas;
|
|
468
475
|
}
|
|
469
476
|
const Zt = 10, lt = 0.25;
|
|
470
|
-
class
|
|
477
|
+
class Kt {
|
|
471
478
|
/**
|
|
472
479
|
* @param {import("../proj/Projection.js").default} sourceProj Source projection.
|
|
473
480
|
* @param {import("../proj/Projection.js").default} targetProj Target projection.
|
|
@@ -477,42 +484,42 @@ class St {
|
|
|
477
484
|
* @param {?number} destinationResolution The (optional) resolution of the destination.
|
|
478
485
|
* @param {import("../transform.js").Transform} [sourceMatrix] Source transform matrix.
|
|
479
486
|
*/
|
|
480
|
-
constructor(t,
|
|
481
|
-
this.sourceProj_ = t, this.targetProj_ =
|
|
487
|
+
constructor(t, s, e, r, i, c, m) {
|
|
488
|
+
this.sourceProj_ = t, this.targetProj_ = s;
|
|
482
489
|
let g = {};
|
|
483
|
-
const T = m ?
|
|
484
|
-
(
|
|
490
|
+
const T = m ? Pt(
|
|
491
|
+
(_) => pt(
|
|
485
492
|
m,
|
|
486
|
-
|
|
493
|
+
_t(_, this.targetProj_, this.sourceProj_)
|
|
487
494
|
)
|
|
488
|
-
) :
|
|
489
|
-
this.transformInv_ = function(
|
|
490
|
-
const u =
|
|
491
|
-
return g[u] || (g[u] = T(
|
|
492
|
-
}, this.maxSourceExtent_ =
|
|
493
|
-
const X =
|
|
495
|
+
) : Lt(this.targetProj_, this.sourceProj_);
|
|
496
|
+
this.transformInv_ = function(_) {
|
|
497
|
+
const u = _[0] + "/" + _[1];
|
|
498
|
+
return g[u] || (g[u] = T(_)), g[u];
|
|
499
|
+
}, this.maxSourceExtent_ = r, this.errorThresholdSquared_ = i * i, this.triangles_ = [], this.wrapsXInSource_ = !1, this.canWrapXInSource_ = this.sourceProj_.canWrapX() && !!r && !!this.sourceProj_.getExtent() && y(r) >= y(this.sourceProj_.getExtent()), this.sourceWorldWidth_ = this.sourceProj_.getExtent() ? y(this.sourceProj_.getExtent()) : null, this.targetWorldWidth_ = this.targetProj_.getExtent() ? y(this.targetProj_.getExtent()) : null;
|
|
500
|
+
const X = dt(e), x = Ot(e), P = Ft(e), L = wt(e), a = this.transformInv_(X), h = this.transformInv_(x), E = this.transformInv_(P), l = this.transformInv_(L), f = Zt + (c ? Math.max(
|
|
494
501
|
0,
|
|
495
502
|
Math.ceil(
|
|
496
503
|
Math.log2(
|
|
497
|
-
|
|
504
|
+
et(e) / (c * c * 256 * 256)
|
|
498
505
|
)
|
|
499
506
|
)
|
|
500
507
|
) : 0);
|
|
501
508
|
if (this.addQuad_(
|
|
502
509
|
X,
|
|
503
510
|
x,
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
511
|
+
P,
|
|
512
|
+
L,
|
|
513
|
+
a,
|
|
507
514
|
h,
|
|
508
515
|
E,
|
|
509
516
|
l,
|
|
510
517
|
f
|
|
511
518
|
), this.wrapsXInSource_) {
|
|
512
|
-
let
|
|
513
|
-
this.triangles_.forEach(function(u, o,
|
|
514
|
-
|
|
515
|
-
|
|
519
|
+
let _ = 1 / 0;
|
|
520
|
+
this.triangles_.forEach(function(u, o, O) {
|
|
521
|
+
_ = Math.min(
|
|
522
|
+
_,
|
|
516
523
|
u.source[0][0],
|
|
517
524
|
u.source[1][0],
|
|
518
525
|
u.source[2][0]
|
|
@@ -522,14 +529,14 @@ class St {
|
|
|
522
529
|
u.source[0][0],
|
|
523
530
|
u.source[1][0],
|
|
524
531
|
u.source[2][0]
|
|
525
|
-
) -
|
|
532
|
+
) - _ > this.sourceWorldWidth_ / 2) {
|
|
526
533
|
const o = [
|
|
527
534
|
[u.source[0][0], u.source[0][1]],
|
|
528
535
|
[u.source[1][0], u.source[1][1]],
|
|
529
536
|
[u.source[2][0], u.source[2][1]]
|
|
530
537
|
];
|
|
531
|
-
o[0][0] -
|
|
532
|
-
const
|
|
538
|
+
o[0][0] - _ > this.sourceWorldWidth_ / 2 && (o[0][0] -= this.sourceWorldWidth_), o[1][0] - _ > this.sourceWorldWidth_ / 2 && (o[1][0] -= this.sourceWorldWidth_), o[2][0] - _ > this.sourceWorldWidth_ / 2 && (o[2][0] -= this.sourceWorldWidth_);
|
|
539
|
+
const O = Math.min(
|
|
533
540
|
o[0][0],
|
|
534
541
|
o[1][0],
|
|
535
542
|
o[2][0]
|
|
@@ -538,7 +545,7 @@ class St {
|
|
|
538
545
|
o[0][0],
|
|
539
546
|
o[1][0],
|
|
540
547
|
o[2][0]
|
|
541
|
-
) -
|
|
548
|
+
) - O < this.sourceWorldWidth_ / 2 && (u.source = o);
|
|
542
549
|
}
|
|
543
550
|
});
|
|
544
551
|
}
|
|
@@ -554,10 +561,10 @@ class St {
|
|
|
554
561
|
* @param {import("../coordinate.js").Coordinate} cSrc The source c coordinate.
|
|
555
562
|
* @private
|
|
556
563
|
*/
|
|
557
|
-
addTriangle_(t,
|
|
564
|
+
addTriangle_(t, s, e, r, i, c) {
|
|
558
565
|
this.triangles_.push({
|
|
559
|
-
source: [
|
|
560
|
-
target: [t,
|
|
566
|
+
source: [r, i, c],
|
|
567
|
+
target: [t, s, e]
|
|
561
568
|
});
|
|
562
569
|
}
|
|
563
570
|
/**
|
|
@@ -576,93 +583,93 @@ class St {
|
|
|
576
583
|
* @param {number} maxSubdivision Maximal allowed subdivision of the quad.
|
|
577
584
|
* @private
|
|
578
585
|
*/
|
|
579
|
-
addQuad_(t,
|
|
580
|
-
const X = ot([i, c, m, g]), x = this.sourceWorldWidth_ ?
|
|
586
|
+
addQuad_(t, s, e, r, i, c, m, g, T) {
|
|
587
|
+
const X = ot([i, c, m, g]), x = this.sourceWorldWidth_ ? y(X) / this.sourceWorldWidth_ : null, P = (
|
|
581
588
|
/** @type {number} */
|
|
582
589
|
this.sourceWorldWidth_
|
|
583
|
-
),
|
|
584
|
-
let
|
|
590
|
+
), L = this.sourceProj_.canWrapX() && x > 0.5 && x < 1;
|
|
591
|
+
let a = !1;
|
|
585
592
|
if (T > 0) {
|
|
586
593
|
if (this.targetProj_.isGlobal() && this.targetWorldWidth_) {
|
|
587
|
-
const E = ot([t,
|
|
588
|
-
|
|
594
|
+
const E = ot([t, s, e, r]);
|
|
595
|
+
a = y(E) / this.targetWorldWidth_ > lt || a;
|
|
589
596
|
}
|
|
590
|
-
!
|
|
597
|
+
!L && this.sourceProj_.isGlobal() && x && (a = x > lt || a);
|
|
591
598
|
}
|
|
592
|
-
if (!
|
|
599
|
+
if (!a && this.maxSourceExtent_ && isFinite(X[0]) && isFinite(X[1]) && isFinite(X[2]) && isFinite(X[3]) && !Dt(X, this.maxSourceExtent_))
|
|
593
600
|
return;
|
|
594
601
|
let h = 0;
|
|
595
|
-
if (!
|
|
602
|
+
if (!a && (!isFinite(i[0]) || !isFinite(i[1]) || !isFinite(c[0]) || !isFinite(c[1]) || !isFinite(m[0]) || !isFinite(m[1]) || !isFinite(g[0]) || !isFinite(g[1]))) {
|
|
596
603
|
if (T > 0)
|
|
597
|
-
|
|
604
|
+
a = !0;
|
|
598
605
|
else if (h = (!isFinite(i[0]) || !isFinite(i[1]) ? 8 : 0) + (!isFinite(c[0]) || !isFinite(c[1]) ? 4 : 0) + (!isFinite(m[0]) || !isFinite(m[1]) ? 2 : 0) + (!isFinite(g[0]) || !isFinite(g[1]) ? 1 : 0), h != 1 && h != 2 && h != 4 && h != 8)
|
|
599
606
|
return;
|
|
600
607
|
}
|
|
601
608
|
if (T > 0) {
|
|
602
|
-
if (!
|
|
603
|
-
const E = [(t[0] +
|
|
609
|
+
if (!a) {
|
|
610
|
+
const E = [(t[0] + e[0]) / 2, (t[1] + e[1]) / 2], l = this.transformInv_(E);
|
|
604
611
|
let f;
|
|
605
|
-
|
|
606
|
-
const
|
|
607
|
-
|
|
612
|
+
L ? f = ($(i[0], P) + $(m[0], P)) / 2 - $(l[0], P) : f = (i[0] + m[0]) / 2 - l[0];
|
|
613
|
+
const _ = (i[1] + m[1]) / 2 - l[1];
|
|
614
|
+
a = f * f + _ * _ > this.errorThresholdSquared_;
|
|
608
615
|
}
|
|
609
|
-
if (
|
|
610
|
-
if (Math.abs(t[0] -
|
|
611
|
-
const E = [(
|
|
616
|
+
if (a) {
|
|
617
|
+
if (Math.abs(t[0] - e[0]) <= Math.abs(t[1] - e[1])) {
|
|
618
|
+
const E = [(s[0] + e[0]) / 2, (s[1] + e[1]) / 2], l = this.transformInv_(E), f = [(r[0] + t[0]) / 2, (r[1] + t[1]) / 2], _ = this.transformInv_(f);
|
|
612
619
|
this.addQuad_(
|
|
613
620
|
t,
|
|
614
|
-
|
|
621
|
+
s,
|
|
615
622
|
E,
|
|
616
623
|
f,
|
|
617
624
|
i,
|
|
618
625
|
c,
|
|
619
626
|
l,
|
|
620
|
-
|
|
627
|
+
_,
|
|
621
628
|
T - 1
|
|
622
629
|
), this.addQuad_(
|
|
623
630
|
f,
|
|
624
631
|
E,
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
632
|
+
e,
|
|
633
|
+
r,
|
|
634
|
+
_,
|
|
628
635
|
l,
|
|
629
636
|
m,
|
|
630
637
|
g,
|
|
631
638
|
T - 1
|
|
632
639
|
);
|
|
633
640
|
} else {
|
|
634
|
-
const E = [(t[0] +
|
|
641
|
+
const E = [(t[0] + s[0]) / 2, (t[1] + s[1]) / 2], l = this.transformInv_(E), f = [(e[0] + r[0]) / 2, (e[1] + r[1]) / 2], _ = this.transformInv_(f);
|
|
635
642
|
this.addQuad_(
|
|
636
643
|
t,
|
|
637
644
|
E,
|
|
638
645
|
f,
|
|
639
|
-
|
|
646
|
+
r,
|
|
640
647
|
i,
|
|
641
648
|
l,
|
|
642
|
-
|
|
649
|
+
_,
|
|
643
650
|
g,
|
|
644
651
|
T - 1
|
|
645
652
|
), this.addQuad_(
|
|
646
653
|
E,
|
|
647
|
-
e,
|
|
648
654
|
s,
|
|
655
|
+
e,
|
|
649
656
|
f,
|
|
650
657
|
l,
|
|
651
658
|
c,
|
|
652
659
|
m,
|
|
653
|
-
|
|
660
|
+
_,
|
|
654
661
|
T - 1
|
|
655
662
|
);
|
|
656
663
|
}
|
|
657
664
|
return;
|
|
658
665
|
}
|
|
659
666
|
}
|
|
660
|
-
if (
|
|
667
|
+
if (L) {
|
|
661
668
|
if (!this.canWrapXInSource_)
|
|
662
669
|
return;
|
|
663
670
|
this.wrapsXInSource_ = !0;
|
|
664
671
|
}
|
|
665
|
-
(h & 11) == 0 && this.addTriangle_(t,
|
|
672
|
+
(h & 11) == 0 && this.addTriangle_(t, e, r, i, m, g), (h & 14) == 0 && this.addTriangle_(t, e, s, i, m, c), h && ((h & 13) == 0 && this.addTriangle_(s, r, t, c, g, i), (h & 7) == 0 && this.addTriangle_(s, r, e, c, g, m));
|
|
666
673
|
}
|
|
667
674
|
/**
|
|
668
675
|
* Calculates extent of the `source` coordinates from all the triangles.
|
|
@@ -670,10 +677,10 @@ class St {
|
|
|
670
677
|
* @return {import("../extent.js").Extent} Calculated extent.
|
|
671
678
|
*/
|
|
672
679
|
calculateSourceExtent() {
|
|
673
|
-
const t =
|
|
674
|
-
return this.triangles_.forEach(function(
|
|
675
|
-
const i =
|
|
676
|
-
|
|
680
|
+
const t = gt();
|
|
681
|
+
return this.triangles_.forEach(function(s, e, r) {
|
|
682
|
+
const i = s.source;
|
|
683
|
+
z(t, i[0]), z(t, i[1]), z(t, i[2]);
|
|
677
684
|
}), t;
|
|
678
685
|
}
|
|
679
686
|
/**
|
|
@@ -700,44 +707,44 @@ class Vt extends mt {
|
|
|
700
707
|
* @param {boolean} [renderEdges] Render reprojection edges.
|
|
701
708
|
* @param {import("../Tile.js").Options} [options] Tile options.
|
|
702
709
|
*/
|
|
703
|
-
constructor(t,
|
|
704
|
-
super(i,
|
|
705
|
-
const
|
|
710
|
+
constructor(t, s, e, r, i, c, m, g, T, X, x, P) {
|
|
711
|
+
super(i, d.IDLE, P), this.renderEdges_ = x !== void 0 ? x : !1, this.pixelRatio_ = m, this.gutter_ = g, this.canvas_ = null, this.sourceTileGrid_ = s, this.targetTileGrid_ = r, this.wrappedTileCoord_ = c || i, this.sourceTiles_ = [], this.sourcesListenerKeys_ = null, this.sourceZ_ = 0, this.clipExtent_ = t.canWrapX() ? t.getExtent() : void 0;
|
|
712
|
+
const L = r.getTileCoordExtent(
|
|
706
713
|
this.wrappedTileCoord_
|
|
707
|
-
),
|
|
714
|
+
), a = this.targetTileGrid_.getExtent();
|
|
708
715
|
let h = this.sourceTileGrid_.getExtent();
|
|
709
|
-
const E =
|
|
710
|
-
if (
|
|
711
|
-
this.state =
|
|
716
|
+
const E = a ? V(L, a) : L;
|
|
717
|
+
if (et(E) === 0) {
|
|
718
|
+
this.state = d.EMPTY;
|
|
712
719
|
return;
|
|
713
720
|
}
|
|
714
721
|
const l = t.getExtent();
|
|
715
722
|
l && (h ? h = V(h, l) : h = l);
|
|
716
|
-
const f =
|
|
723
|
+
const f = r.getResolution(
|
|
717
724
|
this.wrappedTileCoord_[0]
|
|
718
|
-
),
|
|
725
|
+
), _ = Nt(
|
|
719
726
|
t,
|
|
720
|
-
|
|
727
|
+
e,
|
|
721
728
|
E,
|
|
722
729
|
f
|
|
723
730
|
);
|
|
724
|
-
if (!isFinite(
|
|
725
|
-
this.state =
|
|
731
|
+
if (!isFinite(_) || _ <= 0) {
|
|
732
|
+
this.state = d.EMPTY;
|
|
726
733
|
return;
|
|
727
734
|
}
|
|
728
735
|
const u = X !== void 0 ? X : bt;
|
|
729
|
-
if (this.triangulation_ = new
|
|
736
|
+
if (this.triangulation_ = new Kt(
|
|
730
737
|
t,
|
|
731
|
-
|
|
738
|
+
e,
|
|
732
739
|
E,
|
|
733
740
|
h,
|
|
734
|
-
|
|
741
|
+
_ * u,
|
|
735
742
|
f
|
|
736
743
|
), this.triangulation_.getTriangles().length === 0) {
|
|
737
|
-
this.state =
|
|
744
|
+
this.state = d.EMPTY;
|
|
738
745
|
return;
|
|
739
746
|
}
|
|
740
|
-
this.sourceZ_ =
|
|
747
|
+
this.sourceZ_ = s.getZForResolution(_);
|
|
741
748
|
let o = this.triangulation_.calculateSourceExtent();
|
|
742
749
|
if (h && (t.canWrapX() ? (o[1] = ht(
|
|
743
750
|
o[1],
|
|
@@ -747,31 +754,31 @@ class Vt extends mt {
|
|
|
747
754
|
o[3],
|
|
748
755
|
h[1],
|
|
749
756
|
h[3]
|
|
750
|
-
)) : o = V(o, h)), !
|
|
751
|
-
this.state =
|
|
757
|
+
)) : o = V(o, h)), !et(o))
|
|
758
|
+
this.state = d.EMPTY;
|
|
752
759
|
else {
|
|
753
|
-
let
|
|
754
|
-
t.canWrapX() && (
|
|
755
|
-
(o[0] - l[0]) /
|
|
760
|
+
let O = 0, w = 0;
|
|
761
|
+
t.canWrapX() && (O = y(l), w = Math.floor(
|
|
762
|
+
(o[0] - l[0]) / O
|
|
756
763
|
)), At(
|
|
757
764
|
o.slice(),
|
|
758
765
|
t,
|
|
759
766
|
!0
|
|
760
767
|
).forEach((I) => {
|
|
761
|
-
const v =
|
|
768
|
+
const v = s.getTileRangeForExtentAndZ(
|
|
762
769
|
I,
|
|
763
770
|
this.sourceZ_
|
|
764
771
|
);
|
|
765
772
|
for (let Y = v.minX; Y <= v.maxX; Y++)
|
|
766
|
-
for (let
|
|
767
|
-
const
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
}
|
|
773
|
+
for (let M = v.minY; M <= v.maxY; M++) {
|
|
774
|
+
const W = w * O;
|
|
775
|
+
this.sourceTiles_.push({
|
|
776
|
+
getTile: () => T(this.sourceZ_, Y, M, m),
|
|
777
|
+
offset: W
|
|
778
|
+
});
|
|
772
779
|
}
|
|
773
|
-
++
|
|
774
|
-
}), this.sourceTiles_.length === 0 && (this.state =
|
|
780
|
+
++w;
|
|
781
|
+
}), this.sourceTiles_.length === 0 && (this.state = d.EMPTY);
|
|
775
782
|
}
|
|
776
783
|
}
|
|
777
784
|
/**
|
|
@@ -786,28 +793,28 @@ class Vt extends mt {
|
|
|
786
793
|
*/
|
|
787
794
|
reproject_() {
|
|
788
795
|
const t = [];
|
|
789
|
-
if (this.sourceTiles_.forEach((
|
|
790
|
-
const
|
|
791
|
-
if (
|
|
792
|
-
const
|
|
793
|
-
|
|
796
|
+
if (this.sourceTiles_.forEach((s) => {
|
|
797
|
+
const e = s.tile;
|
|
798
|
+
if (e && e.getState() == d.LOADED) {
|
|
799
|
+
const r = this.sourceTileGrid_.getTileCoordExtent(e.tileCoord);
|
|
800
|
+
r[0] += s.offset, r[2] += s.offset;
|
|
794
801
|
const i = this.clipExtent_?.slice();
|
|
795
|
-
i && (i[0] +=
|
|
796
|
-
extent:
|
|
802
|
+
i && (i[0] += s.offset, i[2] += s.offset), t.push({
|
|
803
|
+
extent: r,
|
|
797
804
|
clipExtent: i,
|
|
798
|
-
image:
|
|
805
|
+
image: e.getImage()
|
|
799
806
|
});
|
|
800
807
|
}
|
|
801
808
|
}), this.sourceTiles_.length = 0, t.length === 0)
|
|
802
|
-
this.state =
|
|
809
|
+
this.state = d.ERROR;
|
|
803
810
|
else {
|
|
804
|
-
const
|
|
811
|
+
const s = this.wrappedTileCoord_[0], e = this.targetTileGrid_.getTileSize(s), r = typeof e == "number" ? e : e[0], i = typeof e == "number" ? e : e[1], c = this.targetTileGrid_.getResolution(s), m = this.sourceTileGrid_.getResolution(
|
|
805
812
|
this.sourceZ_
|
|
806
813
|
), g = this.targetTileGrid_.getTileCoordExtent(
|
|
807
814
|
this.wrappedTileCoord_
|
|
808
815
|
);
|
|
809
|
-
this.canvas_ =
|
|
810
|
-
|
|
816
|
+
this.canvas_ = St(
|
|
817
|
+
r,
|
|
811
818
|
i,
|
|
812
819
|
this.pixelRatio_,
|
|
813
820
|
m,
|
|
@@ -819,7 +826,7 @@ class Vt extends mt {
|
|
|
819
826
|
this.gutter_,
|
|
820
827
|
this.renderEdges_,
|
|
821
828
|
this.interpolate
|
|
822
|
-
), this.state =
|
|
829
|
+
), this.state = d.LOADED;
|
|
823
830
|
}
|
|
824
831
|
this.changed();
|
|
825
832
|
}
|
|
@@ -828,21 +835,23 @@ class Vt extends mt {
|
|
|
828
835
|
* @override
|
|
829
836
|
*/
|
|
830
837
|
load() {
|
|
831
|
-
|
|
832
|
-
|
|
838
|
+
for (const t of this.sourceTiles_)
|
|
839
|
+
t.tile = t.getTile();
|
|
840
|
+
if (this.state == d.IDLE) {
|
|
841
|
+
this.state = d.LOADING, this.changed();
|
|
833
842
|
let t = 0;
|
|
834
|
-
this.sourcesListenerKeys_ = [], this.sourceTiles_.forEach(({ tile:
|
|
835
|
-
const
|
|
836
|
-
if (
|
|
843
|
+
this.sourcesListenerKeys_ = [], this.sourceTiles_.forEach(({ tile: s }) => {
|
|
844
|
+
const e = s.getState();
|
|
845
|
+
if (e == d.IDLE || e == d.LOADING) {
|
|
837
846
|
t++;
|
|
838
|
-
const
|
|
839
|
-
const c =
|
|
840
|
-
(c ==
|
|
847
|
+
const r = Ct(s, ft.CHANGE, (i) => {
|
|
848
|
+
const c = s.getState();
|
|
849
|
+
(c == d.LOADED || c == d.ERROR || c == d.EMPTY) && (at(r), t--, t === 0 && (this.unlistenSources_(), this.reproject_()));
|
|
841
850
|
});
|
|
842
|
-
this.sourcesListenerKeys_.push(
|
|
851
|
+
this.sourcesListenerKeys_.push(r);
|
|
843
852
|
}
|
|
844
|
-
}), t === 0 ? setTimeout(this.reproject_.bind(this), 0) : this.sourceTiles_.forEach(function({ tile:
|
|
845
|
-
|
|
853
|
+
}), t === 0 ? setTimeout(this.reproject_.bind(this), 0) : this.sourceTiles_.forEach(function({ tile: s }, e, r) {
|
|
854
|
+
s.getState() == d.IDLE && s.load();
|
|
846
855
|
});
|
|
847
856
|
}
|
|
848
857
|
}
|
|
@@ -850,53 +859,53 @@ class Vt extends mt {
|
|
|
850
859
|
* @private
|
|
851
860
|
*/
|
|
852
861
|
unlistenSources_() {
|
|
853
|
-
this.sourcesListenerKeys_.forEach(
|
|
862
|
+
this.sourcesListenerKeys_.forEach(at), this.sourcesListenerKeys_ = null;
|
|
854
863
|
}
|
|
855
864
|
/**
|
|
856
865
|
* Remove from the cache due to expiry
|
|
857
866
|
* @override
|
|
858
867
|
*/
|
|
859
868
|
release() {
|
|
860
|
-
this.canvas_ && (
|
|
869
|
+
this.canvas_ && (st(
|
|
861
870
|
/** @type {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} */
|
|
862
871
|
this.canvas_.getContext("2d")
|
|
863
|
-
), B.push(this.canvas_), this.canvas_ = null), super.release();
|
|
872
|
+
), B.push(this.canvas_), this.canvas_ = null), this.sourceTiles_.length = 0, super.release();
|
|
864
873
|
}
|
|
865
874
|
}
|
|
866
|
-
function Jt(
|
|
867
|
-
return
|
|
875
|
+
function Jt(n, t, s, e) {
|
|
876
|
+
return e !== void 0 ? (e[0] = n, e[1] = t, e[2] = s, e) : [n, t, s];
|
|
868
877
|
}
|
|
869
|
-
function Ht(
|
|
870
|
-
return
|
|
878
|
+
function Ht(n, t, s) {
|
|
879
|
+
return n + "/" + t + "/" + s;
|
|
871
880
|
}
|
|
872
|
-
function
|
|
873
|
-
return `${Rt(
|
|
881
|
+
function te(n, t, s, e, r) {
|
|
882
|
+
return `${Rt(n)},${t},${Ht(s, e, r)}`;
|
|
874
883
|
}
|
|
875
|
-
function
|
|
876
|
-
return
|
|
884
|
+
function ee(n) {
|
|
885
|
+
return Qt(n[0], n[1], n[2]);
|
|
877
886
|
}
|
|
878
|
-
function
|
|
879
|
-
return (t <<
|
|
887
|
+
function Qt(n, t, s) {
|
|
888
|
+
return (t << n) + s;
|
|
880
889
|
}
|
|
881
|
-
function
|
|
882
|
-
const
|
|
883
|
-
if (t.getMinZoom() >
|
|
890
|
+
function se(n, t) {
|
|
891
|
+
const s = n[0], e = n[1], r = n[2];
|
|
892
|
+
if (t.getMinZoom() > s || s > t.getMaxZoom())
|
|
884
893
|
return !1;
|
|
885
|
-
const i = t.getFullTileRange(
|
|
886
|
-
return i ? i.containsXY(
|
|
894
|
+
const i = t.getFullTileRange(s);
|
|
895
|
+
return i ? i.containsXY(e, r) : !0;
|
|
887
896
|
}
|
|
888
897
|
export {
|
|
889
898
|
bt as E,
|
|
890
|
-
|
|
899
|
+
$t as I,
|
|
891
900
|
Vt as R,
|
|
892
901
|
mt as T,
|
|
893
|
-
|
|
894
|
-
|
|
902
|
+
Bt as a,
|
|
903
|
+
Kt as b,
|
|
895
904
|
ut as c,
|
|
896
905
|
Jt as d,
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
906
|
+
zt as e,
|
|
907
|
+
te as g,
|
|
908
|
+
ee as h,
|
|
909
|
+
St as r,
|
|
910
|
+
se as w
|
|
902
911
|
};
|