@datagouv/components-next 1.0.2-dev.208 → 1.0.2-dev.209
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-B9WQxlpJ.js → Control-DMgMzWnv.js} +1 -1
- package/dist/{Datafair.client-CZhPt853.js → Datafair.client-DpdHdQSx.js} +1 -1
- package/dist/{Event-iXDrp-fy.js → Event-CfA33G1K.js} +9 -9
- package/dist/{Image-mNMBOofs.js → Image-Dueb7njC.js} +12 -12
- package/dist/{ImagePreview.client-CTF6hyMR.js → ImagePreview.client-CtbvW_Q_.js} +1 -1
- package/dist/{JsonPreview.client-BwsgTnR7.js → JsonPreview.client-CboMjF2M.js} +2 -2
- package/dist/{Map-BfqKMw0S.js → Map-B4L0JtRr.js} +1113 -1025
- package/dist/{MapContainer.client-C95seuim.js → MapContainer.client-BPAbtzkr.js} +7 -7
- package/dist/{OSM-CcrUhItr.js → OSM-BUakwXg7.js} +1 -1
- package/dist/{PdfPreview.client-DaXPl9xc.js → PdfPreview.client-DQF8gS3o.js} +2 -2
- package/dist/{Pmtiles.client-PSLUkGmF.js → Pmtiles.client-B-X5pTXq.js} +5788 -5737
- package/dist/{PreviewWrapper.vue_vue_type_script_setup_true_lang-McCfJHd3.js → PreviewWrapper.vue_vue_type_script_setup_true_lang-CzFj5TX2.js} +1 -1
- package/dist/{ScaleLine-VGQ7nkMS.js → ScaleLine-4id_Lp0T.js} +2 -2
- package/dist/{Tile-CSpn0Ca8.js → Tile-DI5PtNs-.js} +375 -325
- package/dist/{TileImage-CpbaEFwd.js → TileImage-DFTatxB8.js} +83 -63
- package/dist/{View-BYBpt-AU.js → View-CwG9s9BF.js} +108 -101
- package/dist/{XmlPreview.client-BOVVyHXW.js → XmlPreview.client-BvlwpV00.js} +3 -3
- package/dist/{common-BoeTUnDZ.js → common-C3bYhKiN.js} +71 -70
- package/dist/components-next.css +1 -1
- package/dist/components-next.js +1 -1
- package/dist/components.css +2 -2
- package/dist/{index-CeH9i6IP.js → index-D2eZ5uVt.js} +5683 -5785
- package/dist/{leaflet-src-D1Cl1V-1.js → leaflet-src-CM7H_PEp.js} +1 -1
- package/dist/{main-DADRUTDs.js → main-D1VXLvop.js} +12531 -13523
- package/dist/{proj-DxGbobp7.js → proj-DQrI7bbu.js} +302 -282
- package/dist/{tilecoord-DvX7WWiA.js → tilecoord-xLae1hR5.js} +106 -106
- package/dist/{vue3-xml-viewer.common-BzsQ7xw8.js → vue3-xml-viewer.common-D8NyU_-4.js} +1 -1
- package/package.json +25 -25
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { T as De, b as Oe, d as
|
|
2
|
-
import { T as
|
|
3
|
-
import {
|
|
4
|
-
import { a as
|
|
5
|
-
import { a as
|
|
6
|
-
function
|
|
1
|
+
import { T as De, b as Oe, d as ye, g as te, I as Pe, R as Ke } from "./tilecoord-xLae1hR5.js";
|
|
2
|
+
import { T as E, g as Me, d as j, k as xe, i as ze, j as Ae, c as me, t as je } from "./Image-Dueb7njC.js";
|
|
3
|
+
import { aJ as be, aL as ke, am as ne, E as Fe, _ as Ne, ao as we, aM as Ze, aC as Ue, aN as qe, J as Ge, z as Be, v as We, e as Ve, W as He, a as b, aO as Xe, j as ve, d as oe, a2 as Ye, i as Qe, ap as $e, C as Je } from "./proj-DQrI7bbu.js";
|
|
4
|
+
import { a as ie, e as se, p as et, g as S, d as ae, n as tt, q as nt } from "./common-C3bYhKiN.js";
|
|
5
|
+
import { a as Te, c as it, R as V, L as st } from "./Event-CfA33G1K.js";
|
|
6
|
+
function le(u) {
|
|
7
7
|
return u instanceof Image || u instanceof HTMLCanvasElement || u instanceof HTMLVideoElement || u instanceof ImageBitmap ? u : null;
|
|
8
8
|
}
|
|
9
|
-
const
|
|
10
|
-
class
|
|
9
|
+
const rt = new Error("disposed"), ot = [256, 256];
|
|
10
|
+
class Re extends De {
|
|
11
11
|
/**
|
|
12
12
|
* @param {Options} options Tile options.
|
|
13
13
|
*/
|
|
14
14
|
constructor(e) {
|
|
15
|
-
const t =
|
|
15
|
+
const t = E.IDLE;
|
|
16
16
|
super(e.tileCoord, t, {
|
|
17
17
|
transition: e.transition,
|
|
18
18
|
interpolate: e.interpolate
|
|
@@ -25,8 +25,8 @@ class Te extends De {
|
|
|
25
25
|
getSize() {
|
|
26
26
|
if (this.size_)
|
|
27
27
|
return this.size_;
|
|
28
|
-
const e =
|
|
29
|
-
return e ? [e.width, e.height] :
|
|
28
|
+
const e = le(this.data_);
|
|
29
|
+
return e ? [e.width, e.height] : ot;
|
|
30
30
|
}
|
|
31
31
|
/**
|
|
32
32
|
* Get the data for the tile.
|
|
@@ -50,14 +50,14 @@ class Te extends De {
|
|
|
50
50
|
* @override
|
|
51
51
|
*/
|
|
52
52
|
load() {
|
|
53
|
-
if (this.state !==
|
|
53
|
+
if (this.state !== E.IDLE && this.state !== E.ERROR)
|
|
54
54
|
return;
|
|
55
|
-
this.state =
|
|
55
|
+
this.state = E.LOADING, this.changed();
|
|
56
56
|
const e = this;
|
|
57
57
|
this.loader_().then(function(t) {
|
|
58
|
-
e.data_ = t, e.state =
|
|
58
|
+
e.data_ = t, e.state = E.LOADED, e.changed();
|
|
59
59
|
}).catch(function(t) {
|
|
60
|
-
e.error_ = t, e.state =
|
|
60
|
+
e.error_ = t, e.state = E.ERROR, e.changed();
|
|
61
61
|
});
|
|
62
62
|
}
|
|
63
63
|
/**
|
|
@@ -65,10 +65,10 @@ class Te extends De {
|
|
|
65
65
|
* @override
|
|
66
66
|
*/
|
|
67
67
|
disposeInternal() {
|
|
68
|
-
this.controller_ && (this.controller_.abort(
|
|
68
|
+
this.controller_ && (this.controller_.abort(rt), this.controller_ = null), super.disposeInternal();
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
|
-
class
|
|
71
|
+
class Ce {
|
|
72
72
|
/**
|
|
73
73
|
* @param {number} [highWaterMark] High water mark.
|
|
74
74
|
*/
|
|
@@ -77,7 +77,7 @@ class xe {
|
|
|
77
77
|
}
|
|
78
78
|
deleteOldest() {
|
|
79
79
|
const e = this.pop();
|
|
80
|
-
e instanceof
|
|
80
|
+
e instanceof be && e.dispose();
|
|
81
81
|
}
|
|
82
82
|
/**
|
|
83
83
|
* @return {boolean} Can expire cache.
|
|
@@ -126,7 +126,7 @@ class xe {
|
|
|
126
126
|
*/
|
|
127
127
|
get(e, t) {
|
|
128
128
|
const n = this.entries_[e];
|
|
129
|
-
return
|
|
129
|
+
return ie(
|
|
130
130
|
n !== void 0,
|
|
131
131
|
"Tried to get a value for a key that does not exist in the cache"
|
|
132
132
|
), n === this.newest_ || (n === this.oldest_ ? (this.oldest_ = /** @type {Entry} */
|
|
@@ -139,7 +139,7 @@ class xe {
|
|
|
139
139
|
*/
|
|
140
140
|
remove(e) {
|
|
141
141
|
const t = this.entries_[e];
|
|
142
|
-
return
|
|
142
|
+
return ie(
|
|
143
143
|
t !== void 0,
|
|
144
144
|
"Tried to get a value for a key that does not exist in the cache"
|
|
145
145
|
), t === this.newest_ ? (this.newest_ = /** @type {Entry} */
|
|
@@ -219,7 +219,7 @@ class xe {
|
|
|
219
219
|
* @param {T} value Value.
|
|
220
220
|
*/
|
|
221
221
|
set(e, t) {
|
|
222
|
-
|
|
222
|
+
ie(
|
|
223
223
|
!(e in this.entries_),
|
|
224
224
|
"Tried to set a value for a key that is used already"
|
|
225
225
|
);
|
|
@@ -240,14 +240,14 @@ class xe {
|
|
|
240
240
|
this.highWaterMark = e;
|
|
241
241
|
}
|
|
242
242
|
}
|
|
243
|
-
class
|
|
243
|
+
class at {
|
|
244
244
|
constructor() {
|
|
245
|
-
this.instructions_ = [], this.zIndex = 0, this.offset_ = 0, this.context_ = /** @type {ZIndexContextProxy} */
|
|
246
|
-
new Proxy(
|
|
245
|
+
this.instructions_ = [], this.zIndex = 0, this.offset_ = 0, this.pendingMethod_, this.context_ = /** @type {ZIndexContextProxy} */
|
|
246
|
+
new Proxy(Me(), {
|
|
247
247
|
get: (e, t) => {
|
|
248
248
|
if (typeof /** @type {*} */
|
|
249
|
-
|
|
250
|
-
return this.
|
|
249
|
+
e[t] == "function")
|
|
250
|
+
return this.pendingMethod_ = t, this.pushMethodArgs_;
|
|
251
251
|
},
|
|
252
252
|
set: (e, t, n) => (this.push_(t, n), !0)
|
|
253
253
|
});
|
|
@@ -261,11 +261,14 @@ class ot {
|
|
|
261
261
|
t[n] || (t[n] = []), t[n].push(...e);
|
|
262
262
|
}
|
|
263
263
|
/**
|
|
264
|
-
*
|
|
264
|
+
* Pushes the method name captured at access time together with the arguments
|
|
265
|
+
* passed at call time. Reused across all proxied method calls.
|
|
265
266
|
* @param {...*} args Args.
|
|
266
|
-
* @
|
|
267
|
+
* @private
|
|
267
268
|
*/
|
|
268
|
-
pushMethodArgs_ = (...e) =>
|
|
269
|
+
pushMethodArgs_ = (...e) => {
|
|
270
|
+
this.push_(this.pendingMethod_, e);
|
|
271
|
+
};
|
|
269
272
|
/**
|
|
270
273
|
* Push a function that renders to the context directly.
|
|
271
274
|
* @param {function(CanvasRenderingContext2D): void} render Function.
|
|
@@ -288,23 +291,15 @@ class ot {
|
|
|
288
291
|
*/
|
|
289
292
|
draw(e) {
|
|
290
293
|
this.instructions_.forEach((t) => {
|
|
291
|
-
for (let n = 0,
|
|
292
|
-
const
|
|
293
|
-
if (typeof
|
|
294
|
-
|
|
294
|
+
for (let n = 0, s = t.length; n < s; ++n) {
|
|
295
|
+
const l = t[n];
|
|
296
|
+
if (typeof l == "function") {
|
|
297
|
+
l(e);
|
|
295
298
|
continue;
|
|
296
299
|
}
|
|
297
|
-
const
|
|
298
|
-
|
|
299
|
-
e[
|
|
300
|
-
e[r](...a);
|
|
301
|
-
else {
|
|
302
|
-
if (typeof a == "function") {
|
|
303
|
-
e[r] = a(e);
|
|
304
|
-
continue;
|
|
305
|
-
}
|
|
306
|
-
e[r] = a;
|
|
307
|
-
}
|
|
300
|
+
const c = t[++n];
|
|
301
|
+
typeof /** @type {*} */
|
|
302
|
+
e[l] == "function" ? e[l](...c) : typeof c == "function" ? e[l] = c(e) : e[l] = c;
|
|
308
303
|
}
|
|
309
304
|
});
|
|
310
305
|
}
|
|
@@ -319,13 +314,13 @@ class ot {
|
|
|
319
314
|
this.offset_ = this.instructions_.length, this.zIndex = 0;
|
|
320
315
|
}
|
|
321
316
|
}
|
|
322
|
-
const
|
|
323
|
-
class
|
|
317
|
+
const lt = 5;
|
|
318
|
+
class ct extends ke {
|
|
324
319
|
/**
|
|
325
320
|
* @param {LayerType} layer Layer.
|
|
326
321
|
*/
|
|
327
322
|
constructor(e) {
|
|
328
|
-
super(), this.ready = !0, this.boundHandleImageChange_ = this.handleImageChange_.bind(this), this.layer_ = e, this.staleKeys_ = new Array(), this.maxStaleKeys =
|
|
323
|
+
super(), this.ready = !0, this.boundHandleImageChange_ = this.handleImageChange_.bind(this), this.layer_ = e, this.staleKeys_ = new Array(), this.maxStaleKeys = lt, this.renderedSourceKey_;
|
|
329
324
|
}
|
|
330
325
|
/**
|
|
331
326
|
* @return {Array<string>} Get the list of stale keys.
|
|
@@ -339,6 +334,14 @@ class lt extends ke {
|
|
|
339
334
|
prependStaleKey(e) {
|
|
340
335
|
this.staleKeys_.unshift(e), this.staleKeys_.length > this.maxStaleKeys && (this.staleKeys_.length = this.maxStaleKeys);
|
|
341
336
|
}
|
|
337
|
+
/**
|
|
338
|
+
* Remember the previous source key as stale when the key changes.
|
|
339
|
+
* @param {string} sourceKey The current source key.
|
|
340
|
+
* @protected
|
|
341
|
+
*/
|
|
342
|
+
updateStaleKeys(e) {
|
|
343
|
+
this.renderedSourceKey_ ? this.renderedSourceKey_ !== e && (this.prependStaleKey(this.renderedSourceKey_), this.renderedSourceKey_ = e) : this.renderedSourceKey_ = e;
|
|
344
|
+
}
|
|
342
345
|
/**
|
|
343
346
|
* Asynchronous layer level hit detection.
|
|
344
347
|
* @param {import("../pixel.js").Pixel} pixel Pixel.
|
|
@@ -346,7 +349,7 @@ class lt extends ke {
|
|
|
346
349
|
* an array of features.
|
|
347
350
|
*/
|
|
348
351
|
getFeatures(e) {
|
|
349
|
-
return
|
|
352
|
+
return ne();
|
|
350
353
|
}
|
|
351
354
|
/**
|
|
352
355
|
* @param {import("../pixel.js").Pixel} pixel Pixel.
|
|
@@ -362,7 +365,7 @@ class lt extends ke {
|
|
|
362
365
|
* @return {boolean} Layer is ready to be rendered.
|
|
363
366
|
*/
|
|
364
367
|
prepareFrame(e) {
|
|
365
|
-
return
|
|
368
|
+
return ne();
|
|
366
369
|
}
|
|
367
370
|
/**
|
|
368
371
|
* Render the layer.
|
|
@@ -372,7 +375,7 @@ class lt extends ke {
|
|
|
372
375
|
* @return {HTMLElement} The rendered element.
|
|
373
376
|
*/
|
|
374
377
|
renderFrame(e, t) {
|
|
375
|
-
return
|
|
378
|
+
return ne();
|
|
376
379
|
}
|
|
377
380
|
/**
|
|
378
381
|
* @abstract
|
|
@@ -384,7 +387,7 @@ class lt extends ke {
|
|
|
384
387
|
* @return {T|undefined} Callback result.
|
|
385
388
|
* @template T
|
|
386
389
|
*/
|
|
387
|
-
forEachFeatureAtCoordinate(e, t, n,
|
|
390
|
+
forEachFeatureAtCoordinate(e, t, n, s, l) {
|
|
388
391
|
}
|
|
389
392
|
/**
|
|
390
393
|
* @return {LayerType} Layer.
|
|
@@ -441,19 +444,19 @@ class lt extends ke {
|
|
|
441
444
|
delete this.layer_, super.disposeInternal();
|
|
442
445
|
}
|
|
443
446
|
}
|
|
444
|
-
const
|
|
445
|
-
let
|
|
446
|
-
function
|
|
447
|
-
|
|
447
|
+
const Ct = [];
|
|
448
|
+
let k = null;
|
|
449
|
+
function ht() {
|
|
450
|
+
k = me(1, 1, void 0, {
|
|
448
451
|
willReadFrequently: !0
|
|
449
452
|
});
|
|
450
453
|
}
|
|
451
|
-
class
|
|
454
|
+
class dt extends ct {
|
|
452
455
|
/**
|
|
453
456
|
* @param {LayerType} layer Layer.
|
|
454
457
|
*/
|
|
455
458
|
constructor(e) {
|
|
456
|
-
super(e), this.container = null, this.renderedResolution, this.tempTransform =
|
|
459
|
+
super(e), this.container = null, this.renderedResolution, this.tempTransform = se(), this.pixelTransform = se(), this.inversePixelTransform = se(), this.context = null, this.deferredContext_ = null, this.containerReused = !1, this.frameState = null;
|
|
457
460
|
}
|
|
458
461
|
/**
|
|
459
462
|
* @param {import('../../DataTile.js').ImageLike} image Image.
|
|
@@ -462,14 +465,14 @@ class ht extends lt {
|
|
|
462
465
|
* @return {Uint8ClampedArray|null} The image data.
|
|
463
466
|
*/
|
|
464
467
|
getImageData(e, t, n) {
|
|
465
|
-
|
|
466
|
-
let
|
|
468
|
+
k || ht(), k.clearRect(0, 0, 1, 1);
|
|
469
|
+
let s;
|
|
467
470
|
try {
|
|
468
|
-
|
|
471
|
+
k.drawImage(e, t, n, 1, 1, 0, 0, 1, 1), s = k.getImageData(0, 0, 1, 1).data;
|
|
469
472
|
} catch {
|
|
470
|
-
return
|
|
473
|
+
return k = null, null;
|
|
471
474
|
}
|
|
472
|
-
return
|
|
475
|
+
return s;
|
|
473
476
|
}
|
|
474
477
|
/**
|
|
475
478
|
* @param {import('../../Map.js').FrameState} frameState Frame state.
|
|
@@ -484,26 +487,38 @@ class ht extends lt {
|
|
|
484
487
|
* @param {HTMLElement} target Potential render target.
|
|
485
488
|
* @param {string} transform CSS transform matrix.
|
|
486
489
|
* @param {string} [backgroundColor] Background color.
|
|
490
|
+
* @param {number} [width] Physical pixel width of the rendering canvas.
|
|
491
|
+
* @param {number} [height] Physical pixel height of the rendering canvas.
|
|
487
492
|
*/
|
|
488
|
-
useContainer(e, t, n) {
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
493
|
+
useContainer(e, t, n, s, l) {
|
|
494
|
+
if (xe(e) && this.pixelTransform[1] === 0 && this.pixelTransform[2] === 0 && this.pixelTransform[4] === 0 && this.pixelTransform[5] === 0 && e.width === s && e.height === l) {
|
|
495
|
+
const a = (
|
|
496
|
+
/** @type {HTMLCanvasElement} */
|
|
497
|
+
e
|
|
498
|
+
), i = a.getContext("2d");
|
|
499
|
+
if (i) {
|
|
500
|
+
this.container = e, this.context = i, this.containerReused = !0, n && (i.fillStyle = n, i.fillRect(0, 0, a.width, a.height));
|
|
501
|
+
return;
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
const c = this.getLayer().getClassName();
|
|
505
|
+
let r, o;
|
|
506
|
+
if (e && e.className === c && (!n || e && e.style.backgroundColor && Ne(
|
|
507
|
+
Te(e.style.backgroundColor),
|
|
508
|
+
Te(n)
|
|
494
509
|
))) {
|
|
495
|
-
const
|
|
496
|
-
|
|
510
|
+
const a = e.firstElementChild;
|
|
511
|
+
xe(a) && (o = a.getContext("2d"));
|
|
497
512
|
}
|
|
498
|
-
if (
|
|
499
|
-
r = ze ? Ae() : document.createElement("div"), r.className =
|
|
500
|
-
let
|
|
501
|
-
|
|
502
|
-
const
|
|
513
|
+
if (o && et(o.canvas.style.transform, t) ? (this.container = e, this.context = o, this.containerReused = !0) : this.containerReused ? (this.container = null, this.context = null, this.containerReused = !1) : this.container && (this.container.style.backgroundColor = null), !this.container) {
|
|
514
|
+
r = ze ? Ae() : document.createElement("div"), r.className = c;
|
|
515
|
+
let a = r.style;
|
|
516
|
+
a.position = "absolute", a.width = "100%", a.height = "100%", o = me();
|
|
517
|
+
const i = (
|
|
503
518
|
/** @type {HTMLCanvasElement} */
|
|
504
|
-
|
|
519
|
+
o.canvas
|
|
505
520
|
);
|
|
506
|
-
r.appendChild(
|
|
521
|
+
r.appendChild(i), a = i.style, a.position = "absolute", a.left = "0", a.transformOrigin = "top left", this.container = r, this.context = o;
|
|
507
522
|
}
|
|
508
523
|
!this.containerReused && n && !this.container.style.backgroundColor && (this.container.style.backgroundColor = n);
|
|
509
524
|
}
|
|
@@ -514,10 +529,10 @@ class ht extends lt {
|
|
|
514
529
|
* @protected
|
|
515
530
|
*/
|
|
516
531
|
clipUnrotated(e, t, n) {
|
|
517
|
-
const
|
|
518
|
-
S(t.coordinateToPixelTransform,
|
|
519
|
-
const
|
|
520
|
-
S(
|
|
532
|
+
const s = we(n), l = Ze(n), c = Ue(n), r = qe(n);
|
|
533
|
+
S(t.coordinateToPixelTransform, s), S(t.coordinateToPixelTransform, l), S(t.coordinateToPixelTransform, c), S(t.coordinateToPixelTransform, r);
|
|
534
|
+
const o = this.inversePixelTransform;
|
|
535
|
+
S(o, s), S(o, l), S(o, c), S(o, r), e.save(), e.beginPath(), e.moveTo(Math.round(s[0]), Math.round(s[1])), e.lineTo(Math.round(l[0]), Math.round(l[1])), e.lineTo(Math.round(c[0]), Math.round(c[1])), e.lineTo(Math.round(r[0]), Math.round(r[1])), e.clip();
|
|
521
536
|
}
|
|
522
537
|
/**
|
|
523
538
|
* @param {import("../../Map.js").FrameState} frameState Frame state.
|
|
@@ -525,22 +540,22 @@ class ht extends lt {
|
|
|
525
540
|
* @protected
|
|
526
541
|
*/
|
|
527
542
|
prepareContainer(e, t) {
|
|
528
|
-
const n = e.extent,
|
|
529
|
-
|
|
543
|
+
const n = e.extent, s = e.viewState.resolution, l = e.viewState.rotation, c = e.pixelRatio, r = Math.round(Ge(n) / s * c), o = Math.round(Be(n) / s * c);
|
|
544
|
+
ae(
|
|
530
545
|
this.pixelTransform,
|
|
531
546
|
e.size[0] / 2,
|
|
532
547
|
e.size[1] / 2,
|
|
533
|
-
1 /
|
|
534
|
-
1 /
|
|
535
|
-
|
|
536
|
-
-
|
|
537
|
-
-
|
|
538
|
-
),
|
|
539
|
-
const
|
|
540
|
-
if (this.useContainer(t,
|
|
541
|
-
const
|
|
542
|
-
|
|
543
|
-
|
|
548
|
+
1 / c,
|
|
549
|
+
1 / c,
|
|
550
|
+
l,
|
|
551
|
+
-r / 2,
|
|
552
|
+
-o / 2
|
|
553
|
+
), tt(this.inversePixelTransform, this.pixelTransform);
|
|
554
|
+
const a = nt(this.pixelTransform), i = this.getBackground(e);
|
|
555
|
+
if (this.useContainer(t, a, i, r, o), !this.containerReused) {
|
|
556
|
+
const h = this.context.canvas;
|
|
557
|
+
h.width != r || h.height != o ? (h.width = r, h.height = o) : this.context.clearRect(0, 0, r, o), a !== /** @type {HTMLCanvasElement} */
|
|
558
|
+
h.style.transform && (h.style.transform = a);
|
|
544
559
|
}
|
|
545
560
|
}
|
|
546
561
|
/**
|
|
@@ -550,15 +565,15 @@ class ht extends lt {
|
|
|
550
565
|
* @private
|
|
551
566
|
*/
|
|
552
567
|
dispatchRenderEvent_(e, t, n) {
|
|
553
|
-
const
|
|
554
|
-
if (
|
|
555
|
-
const
|
|
568
|
+
const s = this.getLayer();
|
|
569
|
+
if (s.hasListener(e)) {
|
|
570
|
+
const l = new it(
|
|
556
571
|
e,
|
|
557
572
|
this.inversePixelTransform,
|
|
558
573
|
n,
|
|
559
574
|
t
|
|
560
575
|
);
|
|
561
|
-
|
|
576
|
+
s.dispatchEvent(l);
|
|
562
577
|
}
|
|
563
578
|
}
|
|
564
579
|
/**
|
|
@@ -567,7 +582,7 @@ class ht extends lt {
|
|
|
567
582
|
* @protected
|
|
568
583
|
*/
|
|
569
584
|
preRender(e, t) {
|
|
570
|
-
this.frameState = t, !t.declutter && this.dispatchRenderEvent_(
|
|
585
|
+
this.frameState = t, !t.declutter && this.dispatchRenderEvent_(V.PRERENDER, e, t);
|
|
571
586
|
}
|
|
572
587
|
/**
|
|
573
588
|
* @param {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} context Context.
|
|
@@ -575,7 +590,7 @@ class ht extends lt {
|
|
|
575
590
|
* @protected
|
|
576
591
|
*/
|
|
577
592
|
postRender(e, t) {
|
|
578
|
-
t.declutter || this.dispatchRenderEvent_(
|
|
593
|
+
t.declutter || this.dispatchRenderEvent_(V.POSTRENDER, e, t);
|
|
579
594
|
}
|
|
580
595
|
/**
|
|
581
596
|
* @param {import("../../Map.js").FrameState} frameState Frame state.
|
|
@@ -587,7 +602,7 @@ class ht extends lt {
|
|
|
587
602
|
* @return {import('../../render/canvas/ZIndexContext.js').ZIndexContextProxy} Context.
|
|
588
603
|
*/
|
|
589
604
|
getRenderContext(e) {
|
|
590
|
-
return e.declutter && !this.deferredContext_ && (this.deferredContext_ = new
|
|
605
|
+
return e.declutter && !this.deferredContext_ && (this.deferredContext_ = new at()), e.declutter ? this.deferredContext_.getContext() : this.context;
|
|
591
606
|
}
|
|
592
607
|
/**
|
|
593
608
|
* @param {import("../../Map.js").FrameState} frameState Frame state.
|
|
@@ -595,11 +610,11 @@ class ht extends lt {
|
|
|
595
610
|
*/
|
|
596
611
|
renderDeferred(e) {
|
|
597
612
|
e.declutter && (this.dispatchRenderEvent_(
|
|
598
|
-
|
|
613
|
+
V.PRERENDER,
|
|
599
614
|
this.context,
|
|
600
615
|
e
|
|
601
616
|
), e.declutter && this.deferredContext_ && (this.deferredContext_.draw(this.context), this.deferredContext_.clear()), this.renderDeferredInternal(e), this.dispatchRenderEvent_(
|
|
602
|
-
|
|
617
|
+
V.POSTRENDER,
|
|
603
618
|
this.context,
|
|
604
619
|
e
|
|
605
620
|
));
|
|
@@ -616,13 +631,13 @@ class ht extends lt {
|
|
|
616
631
|
* @protected
|
|
617
632
|
* @return {!import("../../transform.js").Transform} Transform.
|
|
618
633
|
*/
|
|
619
|
-
getRenderTransform(e, t, n,
|
|
620
|
-
const
|
|
621
|
-
return
|
|
634
|
+
getRenderTransform(e, t, n, s, l, c, r) {
|
|
635
|
+
const o = l / 2, a = c / 2, i = s / t, h = -i, d = -e[0] + r, g = -e[1];
|
|
636
|
+
return ae(
|
|
622
637
|
this.tempTransform,
|
|
623
|
-
l,
|
|
624
|
-
c,
|
|
625
638
|
o,
|
|
639
|
+
a,
|
|
640
|
+
i,
|
|
626
641
|
h,
|
|
627
642
|
-n,
|
|
628
643
|
d,
|
|
@@ -637,41 +652,41 @@ class ht extends lt {
|
|
|
637
652
|
delete this.frameState, super.disposeInternal();
|
|
638
653
|
}
|
|
639
654
|
}
|
|
640
|
-
function
|
|
655
|
+
function re(u, e, t) {
|
|
641
656
|
if (!(t in u))
|
|
642
657
|
return u[t] = /* @__PURE__ */ new Set([e]), !0;
|
|
643
|
-
const n = u[t],
|
|
644
|
-
return
|
|
658
|
+
const n = u[t], s = n.has(e);
|
|
659
|
+
return s || n.add(e), !s;
|
|
645
660
|
}
|
|
646
|
-
function
|
|
661
|
+
function ut(u, e, t) {
|
|
647
662
|
const n = u[t];
|
|
648
663
|
return n ? n.delete(e) : !1;
|
|
649
664
|
}
|
|
650
|
-
function
|
|
665
|
+
function Ee(u, e) {
|
|
651
666
|
const t = u.layerStatesArray[u.layerIndex];
|
|
652
|
-
t.extent && (e =
|
|
667
|
+
t.extent && (e = oe(
|
|
653
668
|
e,
|
|
654
|
-
|
|
669
|
+
ve(t.extent, u.viewState.projection)
|
|
655
670
|
));
|
|
656
671
|
const n = (
|
|
657
672
|
/** @type {import("../../source/Tile.js").default} */
|
|
658
673
|
t.layer.getRenderSource()
|
|
659
674
|
);
|
|
660
675
|
if (!n.getWrapX()) {
|
|
661
|
-
const
|
|
662
|
-
|
|
676
|
+
const s = n.getTileGridForProjection(u.viewState.projection).getExtent();
|
|
677
|
+
s && (e = oe(e, s));
|
|
663
678
|
}
|
|
664
679
|
return e;
|
|
665
680
|
}
|
|
666
|
-
class
|
|
681
|
+
class gt extends dt {
|
|
667
682
|
/**
|
|
668
683
|
* @param {LayerType} tileLayer Tile layer.
|
|
669
684
|
* @param {Options} [options] Options.
|
|
670
685
|
*/
|
|
671
686
|
constructor(e, t) {
|
|
672
|
-
super(e), t = t || {}, this.extentChanged = !0, this.renderComplete = !1, this.renderedExtent_ = null, this.renderedPixelRatio, this.renderedProjection = null, this.renderedTiles = [], this.
|
|
687
|
+
super(e), t = t || {}, this.extentChanged = !0, this.renderComplete = !1, this.renderedExtent_ = null, this.renderedPixelRatio, this.renderedProjection = null, this.renderedTiles = [], this.renderedSourceRevision_, this.tempExtent = We(), this.tempTileRange_ = new Oe(0, 0, 0, 0), this.tempTileCoord_ = ye(0, 0, 0);
|
|
673
688
|
const n = t.cacheSize !== void 0 ? t.cacheSize : 512;
|
|
674
|
-
this.tileCache_ = new
|
|
689
|
+
this.tileCache_ = new Ce(n), this.sourceTileCache_ = null, this.layerExtent = null, this.maxStaleKeys = n * 0.5;
|
|
675
690
|
}
|
|
676
691
|
/**
|
|
677
692
|
* @return {LRUCache} Tile cache.
|
|
@@ -683,7 +698,7 @@ class ut extends ht {
|
|
|
683
698
|
* @return {LRUCache} Tile cache.
|
|
684
699
|
*/
|
|
685
700
|
getSourceTileCache() {
|
|
686
|
-
return this.sourceTileCache_ || (this.sourceTileCache_ = new
|
|
701
|
+
return this.sourceTileCache_ || (this.sourceTileCache_ = new Ce(512)), this.sourceTileCache_;
|
|
687
702
|
}
|
|
688
703
|
/**
|
|
689
704
|
* Get a tile from the cache or create one if needed.
|
|
@@ -695,25 +710,25 @@ class ut extends ht {
|
|
|
695
710
|
* @return {import("../../Tile.js").default|null} Tile (or null if outside source extent).
|
|
696
711
|
* @protected
|
|
697
712
|
*/
|
|
698
|
-
getOrCreateTile(e, t, n,
|
|
699
|
-
const
|
|
700
|
-
let
|
|
701
|
-
if (
|
|
702
|
-
|
|
713
|
+
getOrCreateTile(e, t, n, s) {
|
|
714
|
+
const l = this.tileCache_, r = this.getLayer().getSource(), o = te(r, r.getKey(), e, t, n);
|
|
715
|
+
let a;
|
|
716
|
+
if (l.containsKey(o))
|
|
717
|
+
a = l.get(o);
|
|
703
718
|
else {
|
|
704
|
-
const
|
|
705
|
-
if (
|
|
719
|
+
const i = s.viewState.projection, h = r.getProjection();
|
|
720
|
+
if (a = r.getTile(
|
|
706
721
|
e,
|
|
707
722
|
t,
|
|
708
723
|
n,
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
!h ||
|
|
712
|
-
), !
|
|
724
|
+
s.pixelRatio,
|
|
725
|
+
i,
|
|
726
|
+
!h || Ve(h, i) ? void 0 : this.getSourceTileCache()
|
|
727
|
+
), !a)
|
|
713
728
|
return null;
|
|
714
|
-
|
|
729
|
+
l.set(o, a);
|
|
715
730
|
}
|
|
716
|
-
return
|
|
731
|
+
return a;
|
|
717
732
|
}
|
|
718
733
|
/**
|
|
719
734
|
* @param {number} z Tile coordinate z.
|
|
@@ -723,9 +738,9 @@ class ut extends ht {
|
|
|
723
738
|
* @return {import("../../Tile.js").default|null} Tile (or null if outside source extent).
|
|
724
739
|
* @protected
|
|
725
740
|
*/
|
|
726
|
-
getTile(e, t, n,
|
|
727
|
-
const
|
|
728
|
-
return
|
|
741
|
+
getTile(e, t, n, s) {
|
|
742
|
+
const l = this.getOrCreateTile(e, t, n, s);
|
|
743
|
+
return l || null;
|
|
729
744
|
}
|
|
730
745
|
/**
|
|
731
746
|
* @param {import("../../pixel.js").Pixel} pixel Pixel.
|
|
@@ -736,34 +751,34 @@ class ut extends ht {
|
|
|
736
751
|
const t = this.frameState;
|
|
737
752
|
if (!t)
|
|
738
753
|
return null;
|
|
739
|
-
const n = this.getLayer(),
|
|
754
|
+
const n = this.getLayer(), s = S(
|
|
740
755
|
t.pixelToCoordinateTransform,
|
|
741
756
|
e.slice()
|
|
742
|
-
),
|
|
743
|
-
if (
|
|
757
|
+
), l = n.getExtent();
|
|
758
|
+
if (l && !He(l, s))
|
|
744
759
|
return null;
|
|
745
|
-
const
|
|
746
|
-
for (let
|
|
747
|
-
const h =
|
|
748
|
-
if (!d || d.getState() !==
|
|
760
|
+
const c = t.viewState, r = n.getRenderSource(), o = r.getTileGridForProjection(c.projection), a = r.getTilePixelRatio(t.pixelRatio);
|
|
761
|
+
for (let i = o.getZForResolution(c.resolution); i >= o.getMinZoom(); --i) {
|
|
762
|
+
const h = o.getTileCoordForCoordAndZ(s, i), d = this.getTile(i, h[1], h[2], t);
|
|
763
|
+
if (!d || d.getState() !== E.LOADED)
|
|
749
764
|
continue;
|
|
750
|
-
const g =
|
|
765
|
+
const g = o.getOrigin(i), p = je(o.getTileSize(i)), R = o.getResolution(i);
|
|
751
766
|
let f;
|
|
752
767
|
if (d instanceof Pe || d instanceof Ke)
|
|
753
768
|
f = d.getImage();
|
|
754
|
-
else if (d instanceof
|
|
755
|
-
if (f =
|
|
769
|
+
else if (d instanceof Re) {
|
|
770
|
+
if (f = le(d.getData()), !f)
|
|
756
771
|
continue;
|
|
757
772
|
} else
|
|
758
773
|
continue;
|
|
759
|
-
const
|
|
760
|
-
|
|
761
|
-
),
|
|
762
|
-
|
|
763
|
-
),
|
|
764
|
-
|
|
774
|
+
const m = Math.floor(
|
|
775
|
+
a * ((s[0] - g[0]) / R - h[1] * p[0])
|
|
776
|
+
), I = Math.floor(
|
|
777
|
+
a * ((g[1] - s[1]) / R - h[2] * p[1])
|
|
778
|
+
), C = Math.round(
|
|
779
|
+
a * r.getGutterForProjection(c.projection)
|
|
765
780
|
);
|
|
766
|
-
return this.getImageData(f,
|
|
781
|
+
return this.getImageData(f, m + C, I + C);
|
|
767
782
|
}
|
|
768
783
|
return null;
|
|
769
784
|
}
|
|
@@ -796,46 +811,46 @@ class ut extends ht {
|
|
|
796
811
|
* @param {TileLookup} tilesByZ Lookup of tiles by zoom level.
|
|
797
812
|
* @param {number} preload Number of additional levels to load.
|
|
798
813
|
*/
|
|
799
|
-
enqueueTiles(e, t, n,
|
|
800
|
-
const
|
|
801
|
-
|
|
802
|
-
const h = e.wantedTiles[
|
|
803
|
-
n -
|
|
804
|
-
|
|
805
|
-
|
|
814
|
+
enqueueTiles(e, t, n, s, l) {
|
|
815
|
+
const c = e.viewState, r = this.getLayer(), o = r.getRenderSource(), a = o.getTileGridForProjection(c.projection), i = b(o);
|
|
816
|
+
i in e.wantedTiles || (e.wantedTiles[i] = {});
|
|
817
|
+
const h = e.wantedTiles[i], d = r.getMapInternal(), g = Math.max(
|
|
818
|
+
n - l,
|
|
819
|
+
a.getMinZoom(),
|
|
820
|
+
a.getZForResolution(
|
|
806
821
|
Math.min(
|
|
807
|
-
|
|
808
|
-
d ? d.getView().getResolutionForZoom(Math.max(
|
|
822
|
+
r.getMaxResolution(),
|
|
823
|
+
d ? d.getView().getResolutionForZoom(Math.max(r.getMinZoom(), 0)) : a.getResolution(0)
|
|
809
824
|
),
|
|
810
|
-
|
|
825
|
+
o.zDirection
|
|
811
826
|
)
|
|
812
|
-
), p =
|
|
813
|
-
|
|
814
|
-
|
|
827
|
+
), p = c.rotation, R = p ? Xe(
|
|
828
|
+
c.center,
|
|
829
|
+
c.resolution,
|
|
815
830
|
p,
|
|
816
831
|
e.size
|
|
817
832
|
) : void 0;
|
|
818
833
|
for (let f = n; f >= g; --f) {
|
|
819
|
-
const
|
|
834
|
+
const m = a.getTileRangeForExtentAndZ(
|
|
820
835
|
t,
|
|
821
836
|
f,
|
|
822
837
|
this.tempTileRange_
|
|
823
|
-
),
|
|
824
|
-
for (let
|
|
825
|
-
for (let
|
|
826
|
-
if (p && !
|
|
838
|
+
), I = a.getResolution(f);
|
|
839
|
+
for (let C = m.minX; C <= m.maxX; ++C)
|
|
840
|
+
for (let T = m.minY; T <= m.maxY; ++T) {
|
|
841
|
+
if (p && !a.tileCoordIntersectsViewport([f, C, T], R))
|
|
827
842
|
continue;
|
|
828
|
-
const
|
|
829
|
-
if (!
|
|
843
|
+
const _ = this.getTile(f, C, T, e);
|
|
844
|
+
if (!_ || !re(s, _, f))
|
|
830
845
|
continue;
|
|
831
|
-
const
|
|
832
|
-
if (h[
|
|
833
|
-
const
|
|
846
|
+
const O = _.getKey();
|
|
847
|
+
if (h[O] = !0, _.getState() === E.IDLE && !e.tileQueue.isKeyQueued(O)) {
|
|
848
|
+
const P = ye(f, C, T, this.tempTileCoord_);
|
|
834
849
|
e.tileQueue.enqueue([
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
850
|
+
_,
|
|
851
|
+
i,
|
|
852
|
+
a.getTileCoordCenter(P),
|
|
853
|
+
I
|
|
839
854
|
]);
|
|
840
855
|
}
|
|
841
856
|
}
|
|
@@ -850,19 +865,19 @@ class ut extends ht {
|
|
|
850
865
|
* @private
|
|
851
866
|
*/
|
|
852
867
|
findStaleTile_(e, t) {
|
|
853
|
-
const n = this.tileCache_,
|
|
854
|
-
for (let
|
|
855
|
-
const
|
|
868
|
+
const n = this.tileCache_, s = e[0], l = e[1], c = e[2], r = this.getStaleKeys();
|
|
869
|
+
for (let o = 0; o < r.length; ++o) {
|
|
870
|
+
const a = te(
|
|
856
871
|
this.getLayer().getSource(),
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
872
|
+
r[o],
|
|
873
|
+
s,
|
|
874
|
+
l,
|
|
875
|
+
c
|
|
861
876
|
);
|
|
862
|
-
if (n.containsKey(
|
|
863
|
-
const
|
|
864
|
-
if (
|
|
865
|
-
return
|
|
877
|
+
if (n.containsKey(a)) {
|
|
878
|
+
const i = n.peek(a);
|
|
879
|
+
if (i.getState() === E.LOADED)
|
|
880
|
+
return i.endTransition(b(this)), re(t, i, s), !0;
|
|
866
881
|
}
|
|
867
882
|
}
|
|
868
883
|
return !1;
|
|
@@ -877,27 +892,27 @@ class ut extends ht {
|
|
|
877
892
|
* @return {boolean} The tile coordinate is covered by loaded tiles at the alternate zoom level.
|
|
878
893
|
* @private
|
|
879
894
|
*/
|
|
880
|
-
findAltTiles_(e, t, n,
|
|
881
|
-
const
|
|
895
|
+
findAltTiles_(e, t, n, s) {
|
|
896
|
+
const l = e.getTileRangeForTileCoordAndZ(
|
|
882
897
|
t,
|
|
883
898
|
n,
|
|
884
899
|
this.tempTileRange_
|
|
885
900
|
);
|
|
886
|
-
if (!
|
|
901
|
+
if (!l)
|
|
887
902
|
return !1;
|
|
888
|
-
let
|
|
889
|
-
const
|
|
890
|
-
for (let
|
|
891
|
-
for (let h =
|
|
892
|
-
const d =
|
|
903
|
+
let c = !0;
|
|
904
|
+
const r = this.tileCache_, o = this.getLayer().getRenderSource(), a = o.getKey();
|
|
905
|
+
for (let i = l.minX; i <= l.maxX; ++i)
|
|
906
|
+
for (let h = l.minY; h <= l.maxY; ++h) {
|
|
907
|
+
const d = te(o, a, n, i, h);
|
|
893
908
|
let g = !1;
|
|
894
|
-
if (
|
|
895
|
-
const p =
|
|
896
|
-
p.getState() ===
|
|
909
|
+
if (r.containsKey(d)) {
|
|
910
|
+
const p = r.peek(d);
|
|
911
|
+
p.getState() === E.LOADED && (re(s, p, n), g = !0);
|
|
897
912
|
}
|
|
898
|
-
g || (
|
|
913
|
+
g || (c = !1);
|
|
899
914
|
}
|
|
900
|
-
return
|
|
915
|
+
return c;
|
|
901
916
|
}
|
|
902
917
|
/**
|
|
903
918
|
* Render the layer.
|
|
@@ -915,119 +930,130 @@ class ut extends ht {
|
|
|
915
930
|
*/
|
|
916
931
|
renderFrame(e, t) {
|
|
917
932
|
this.renderComplete = !0;
|
|
918
|
-
const n = e.layerStatesArray[e.layerIndex],
|
|
919
|
-
this.
|
|
920
|
-
let
|
|
921
|
-
const
|
|
933
|
+
const n = e.layerStatesArray[e.layerIndex], s = e.viewState, l = s.projection, c = s.resolution, r = s.center, o = e.pixelRatio, a = this.getLayer(), i = a.getSource(), h = i.getTileGridForProjection(l), d = h.getZForResolution(c, i.zDirection), g = h.getResolution(d);
|
|
934
|
+
this.updateStaleKeys(i.getKey());
|
|
935
|
+
let p = e.extent;
|
|
936
|
+
const R = i.getTilePixelRatio(o);
|
|
922
937
|
this.prepareContainer(e, t);
|
|
923
|
-
const
|
|
924
|
-
this.layerExtent = n.extent ?
|
|
925
|
-
const
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
],
|
|
938
|
+
const f = this.context.canvas.width, m = this.context.canvas.height;
|
|
939
|
+
this.layerExtent = n.extent ? ve(n.extent) : null, this.layerExtent && (p = oe(p, this.layerExtent));
|
|
940
|
+
const I = g * f / 2 / R, C = g * m / 2 / R, T = [
|
|
941
|
+
r[0] - I,
|
|
942
|
+
r[1] - C,
|
|
943
|
+
r[0] + I,
|
|
944
|
+
r[1] + C
|
|
945
|
+
], _ = {};
|
|
931
946
|
this.renderedTiles.length = 0;
|
|
932
|
-
const
|
|
947
|
+
const w = a.getPreload();
|
|
933
948
|
if (e.nextExtent && this.enqueueTilesForNextExtent()) {
|
|
934
|
-
const
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
), x =
|
|
938
|
-
this.enqueueTiles(e, x,
|
|
949
|
+
const y = h.getZForResolution(
|
|
950
|
+
s.nextResolution,
|
|
951
|
+
i.zDirection
|
|
952
|
+
), x = Ee(e, e.nextExtent);
|
|
953
|
+
this.enqueueTiles(e, x, y, _, w);
|
|
939
954
|
}
|
|
940
|
-
const
|
|
941
|
-
if (this.enqueueTiles(e,
|
|
955
|
+
const O = Ee(e, p);
|
|
956
|
+
if (this.enqueueTiles(e, O, d, _, 0), w > 0 && setTimeout(() => {
|
|
942
957
|
this.enqueueTiles(
|
|
943
958
|
e,
|
|
944
|
-
|
|
959
|
+
O,
|
|
945
960
|
d - 1,
|
|
946
|
-
|
|
947
|
-
|
|
961
|
+
_,
|
|
962
|
+
w - 1
|
|
948
963
|
);
|
|
949
|
-
}, 0), !(d in
|
|
964
|
+
}, 0), !(d in _))
|
|
950
965
|
return this.container;
|
|
951
|
-
const
|
|
952
|
-
for (const
|
|
953
|
-
const x =
|
|
954
|
-
if (x ===
|
|
966
|
+
const P = b(this), G = e.time;
|
|
967
|
+
for (const y of _[d]) {
|
|
968
|
+
const x = y.getState();
|
|
969
|
+
if (x === E.EMPTY)
|
|
955
970
|
continue;
|
|
956
|
-
const
|
|
957
|
-
if (x ===
|
|
958
|
-
|
|
971
|
+
const v = y.tileCoord;
|
|
972
|
+
if (x === E.LOADED && y.getAlpha(P, G) === 1) {
|
|
973
|
+
y.endTransition(P);
|
|
959
974
|
continue;
|
|
960
975
|
}
|
|
961
|
-
if (x !==
|
|
962
|
-
|
|
976
|
+
if (x !== E.ERROR && (this.renderComplete = !1), this.findStaleTile_(v, _)) {
|
|
977
|
+
ut(_, y, d), e.animate = !0;
|
|
963
978
|
continue;
|
|
964
979
|
}
|
|
965
980
|
if (this.findAltTiles_(
|
|
966
981
|
h,
|
|
967
|
-
|
|
982
|
+
v,
|
|
968
983
|
d + 1,
|
|
969
|
-
|
|
984
|
+
_
|
|
970
985
|
))
|
|
971
986
|
continue;
|
|
972
|
-
const
|
|
973
|
-
for (let
|
|
987
|
+
const M = h.getMinZoom();
|
|
988
|
+
for (let L = d - 1; L >= M && !this.findAltTiles_(
|
|
974
989
|
h,
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
); --
|
|
990
|
+
v,
|
|
991
|
+
L,
|
|
992
|
+
_
|
|
993
|
+
); --L)
|
|
979
994
|
;
|
|
980
995
|
}
|
|
981
|
-
const
|
|
982
|
-
|
|
996
|
+
const z = g / c * o / R, F = this.getRenderContext(e);
|
|
997
|
+
ae(
|
|
983
998
|
this.tempTransform,
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
999
|
+
f / 2,
|
|
1000
|
+
m / 2,
|
|
1001
|
+
z,
|
|
1002
|
+
z,
|
|
988
1003
|
0,
|
|
989
|
-
-
|
|
990
|
-
-
|
|
991
|
-
), this.layerExtent && this.clipUnrotated(
|
|
992
|
-
const
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
const x = q[T], D = o.getTilePixelSize(
|
|
1004
|
+
-f / 2,
|
|
1005
|
+
-m / 2
|
|
1006
|
+
), this.layerExtent && this.clipUnrotated(F, e, this.layerExtent), i.getInterpolate() || (F.imageSmoothingEnabled = !1), this.preRender(F, e);
|
|
1007
|
+
const X = Object.keys(_).map(Number);
|
|
1008
|
+
X.sort(Ye);
|
|
1009
|
+
const B = [], ce = [], Y = [];
|
|
1010
|
+
for (let y = X.length - 1; y >= 0; --y) {
|
|
1011
|
+
const x = X[y], v = i.getTilePixelSize(
|
|
998
1012
|
x,
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
),
|
|
1002
|
-
|
|
1013
|
+
o,
|
|
1014
|
+
l
|
|
1015
|
+
), K = h.getResolution(x) / g, M = v[0] * K * z, L = v[1] * K * z, A = h.getTileCoordForCoordAndZ(
|
|
1016
|
+
we(T),
|
|
1003
1017
|
x
|
|
1004
|
-
), he = h.getTileCoordExtent(
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
]),
|
|
1008
|
-
for (const
|
|
1009
|
-
if (
|
|
1018
|
+
), he = h.getTileCoordExtent(A), W = S(this.tempTransform, [
|
|
1019
|
+
R * (he[0] - T[0]) / g,
|
|
1020
|
+
R * (T[3] - he[3]) / g
|
|
1021
|
+
]), de = R * i.getGutterForProjection(l);
|
|
1022
|
+
for (const D of _[x]) {
|
|
1023
|
+
if (D.getState() !== E.LOADED)
|
|
1010
1024
|
continue;
|
|
1011
|
-
const
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1025
|
+
const ue = D.tileCoord, ge = A[1] - ue[1], Se = Math.round(W[0] - (ge - 1) * M), fe = A[2] - ue[2], Ie = Math.round(W[1] - (fe - 1) * L), Z = Math.round(W[0] - ge * M), U = Math.round(W[1] - fe * L), Q = Se - Z, $ = Ie - U, _e = x === d;
|
|
1026
|
+
if (_e && D.inTransition(P)) {
|
|
1027
|
+
Y.push({ tile: D, x: Z, y: U, w: Q, h: $, gutter: de }), this.renderedTiles.unshift(D), this.updateUsedTiles(e.usedTiles, i, D);
|
|
1028
|
+
continue;
|
|
1029
|
+
}
|
|
1030
|
+
const J = [Z, U, Z + Q, U + $], ee = [];
|
|
1031
|
+
for (let q = 0, Le = B.length; q < Le; ++q)
|
|
1032
|
+
x < ce[q] && Qe(J, B[q]) && ee.push(B[q]);
|
|
1033
|
+
let pe;
|
|
1034
|
+
ee.length > 0 && (pe = $e(J, ee)), B.push(J), ce.push(x), this.drawTile(
|
|
1035
|
+
D,
|
|
1036
|
+
e,
|
|
1037
|
+
Z,
|
|
1038
|
+
U,
|
|
1039
|
+
Q,
|
|
1040
|
+
$,
|
|
1041
|
+
de,
|
|
1042
|
+
_e,
|
|
1043
|
+
pe
|
|
1044
|
+
), this.renderedTiles.unshift(D), this.updateUsedTiles(e.usedTiles, i, D);
|
|
1023
1045
|
}
|
|
1024
1046
|
}
|
|
1025
|
-
|
|
1026
|
-
const
|
|
1027
|
-
|
|
1028
|
-
|
|
1047
|
+
for (let y = 0, x = Y.length; y < x; ++y) {
|
|
1048
|
+
const { tile: v, x: N, y: K, w: M, h: L, gutter: A } = Y[y];
|
|
1049
|
+
this.drawTile(v, e, N, K, M, L, A, !0, void 0);
|
|
1050
|
+
}
|
|
1051
|
+
if (this.renderedResolution = g, this.extentChanged = !this.renderedExtent_ || !Je(this.renderedExtent_, T), this.renderedExtent_ = T, this.renderedPixelRatio = o, this.postRender(this.context, e), this.layerExtent && F.restore(), F.imageSmoothingEnabled = !0, this.renderComplete) {
|
|
1052
|
+
const y = (x, v) => {
|
|
1053
|
+
const N = b(i), K = v.wantedTiles[N], M = K ? Object.keys(K).length : 0;
|
|
1054
|
+
this.updateCacheSize(M), this.tileCache_.expireCache(), this.sourceTileCache_?.expireCache();
|
|
1029
1055
|
};
|
|
1030
|
-
e.postRenderFunctions.push(
|
|
1056
|
+
e.postRenderFunctions.push(y);
|
|
1031
1057
|
}
|
|
1032
1058
|
return this.container;
|
|
1033
1059
|
}
|
|
@@ -1050,32 +1076,56 @@ class ut extends ht {
|
|
|
1050
1076
|
* @param {number} h Height of the tile.
|
|
1051
1077
|
* @param {number} gutter Tile gutter.
|
|
1052
1078
|
* @param {boolean} transition Apply an alpha transition.
|
|
1079
|
+
* @param {Array<import("../../extent.js").Extent>} [clipRects] Sub-rectangles
|
|
1080
|
+
* of the tile to draw. When not provided, the whole tile is drawn; when an
|
|
1081
|
+
* empty array is provided, nothing is drawn (the tile is fully covered by
|
|
1082
|
+
* higher-z tiles).
|
|
1053
1083
|
* @protected
|
|
1054
1084
|
*/
|
|
1055
|
-
drawTile(e, t, n,
|
|
1056
|
-
let
|
|
1057
|
-
if (e instanceof
|
|
1058
|
-
if (
|
|
1085
|
+
drawTile(e, t, n, s, l, c, r, o, a) {
|
|
1086
|
+
let i;
|
|
1087
|
+
if (e instanceof Re) {
|
|
1088
|
+
if (i = le(e.getData()), !i)
|
|
1059
1089
|
throw new Error("Rendering array data is not yet supported");
|
|
1060
1090
|
} else
|
|
1061
|
-
|
|
1091
|
+
i = this.getTileImage(
|
|
1062
1092
|
/** @type {import("../../ImageTile.js").default} */
|
|
1063
1093
|
e
|
|
1064
1094
|
);
|
|
1065
|
-
if (!
|
|
1095
|
+
if (!i)
|
|
1066
1096
|
return;
|
|
1067
|
-
const
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1097
|
+
const h = this.getRenderContext(t), d = b(this), g = t.layerStatesArray[t.layerIndex], p = g.opacity * (o ? e.getAlpha(d, t.time) : 1), R = p !== h.globalAlpha;
|
|
1098
|
+
R && (h.save(), h.globalAlpha = p);
|
|
1099
|
+
const f = i.width - 2 * r, m = i.height - 2 * r;
|
|
1100
|
+
if (a) {
|
|
1101
|
+
const I = f / l, C = m / c;
|
|
1102
|
+
for (let T = 0, _ = a.length; T < _; ++T) {
|
|
1103
|
+
const w = a[T], O = w[0], P = w[1], G = w[2] - w[0], z = w[3] - w[1];
|
|
1104
|
+
h.drawImage(
|
|
1105
|
+
i,
|
|
1106
|
+
r + (O - n) * I,
|
|
1107
|
+
r + (P - s) * C,
|
|
1108
|
+
G * I,
|
|
1109
|
+
z * C,
|
|
1110
|
+
O,
|
|
1111
|
+
P,
|
|
1112
|
+
G,
|
|
1113
|
+
z
|
|
1114
|
+
);
|
|
1115
|
+
}
|
|
1116
|
+
} else
|
|
1117
|
+
h.drawImage(
|
|
1118
|
+
i,
|
|
1119
|
+
r,
|
|
1120
|
+
r,
|
|
1121
|
+
f,
|
|
1122
|
+
m,
|
|
1123
|
+
n,
|
|
1124
|
+
s,
|
|
1125
|
+
l,
|
|
1126
|
+
c
|
|
1127
|
+
);
|
|
1128
|
+
R && h.restore(), p !== g.opacity ? t.animate = !0 : o && e.endTransition(d);
|
|
1079
1129
|
}
|
|
1080
1130
|
/**
|
|
1081
1131
|
* @return {HTMLCanvasElement|OffscreenCanvas} Image
|
|
@@ -1100,15 +1150,15 @@ class ut extends ht {
|
|
|
1100
1150
|
* @protected
|
|
1101
1151
|
*/
|
|
1102
1152
|
updateUsedTiles(e, t, n) {
|
|
1103
|
-
const
|
|
1104
|
-
|
|
1153
|
+
const s = b(t);
|
|
1154
|
+
s in e || (e[s] = {}), e[s][n.getKey()] = !0;
|
|
1105
1155
|
}
|
|
1106
1156
|
}
|
|
1107
|
-
const
|
|
1157
|
+
const H = {
|
|
1108
1158
|
PRELOAD: "preload",
|
|
1109
1159
|
USE_INTERIM_TILES_ON_ERROR: "useInterimTilesOnError"
|
|
1110
1160
|
};
|
|
1111
|
-
class
|
|
1161
|
+
class ft extends st {
|
|
1112
1162
|
/**
|
|
1113
1163
|
* @param {Options<TileSourceType>} [options] Tile layer options.
|
|
1114
1164
|
*/
|
|
@@ -1135,7 +1185,7 @@ class gt extends it {
|
|
|
1135
1185
|
getPreload() {
|
|
1136
1186
|
return (
|
|
1137
1187
|
/** @type {number} */
|
|
1138
|
-
this.get(
|
|
1188
|
+
this.get(H.PRELOAD)
|
|
1139
1189
|
);
|
|
1140
1190
|
}
|
|
1141
1191
|
/**
|
|
@@ -1145,7 +1195,7 @@ class gt extends it {
|
|
|
1145
1195
|
* @api
|
|
1146
1196
|
*/
|
|
1147
1197
|
setPreload(e) {
|
|
1148
|
-
this.set(
|
|
1198
|
+
this.set(H.PRELOAD, e);
|
|
1149
1199
|
}
|
|
1150
1200
|
/**
|
|
1151
1201
|
* Deprecated. Whether we use interim tiles on error.
|
|
@@ -1156,7 +1206,7 @@ class gt extends it {
|
|
|
1156
1206
|
getUseInterimTilesOnError() {
|
|
1157
1207
|
return (
|
|
1158
1208
|
/** @type {boolean} */
|
|
1159
|
-
this.get(
|
|
1209
|
+
this.get(H.USE_INTERIM_TILES_ON_ERROR)
|
|
1160
1210
|
);
|
|
1161
1211
|
}
|
|
1162
1212
|
/**
|
|
@@ -1166,7 +1216,7 @@ class gt extends it {
|
|
|
1166
1216
|
* @api
|
|
1167
1217
|
*/
|
|
1168
1218
|
setUseInterimTilesOnError(e) {
|
|
1169
|
-
this.set(
|
|
1219
|
+
this.set(H.USE_INTERIM_TILES_ON_ERROR, e);
|
|
1170
1220
|
}
|
|
1171
1221
|
/**
|
|
1172
1222
|
* Get data for a pixel location. The return type depends on the source data. For image tiles,
|
|
@@ -1189,7 +1239,7 @@ class gt extends it {
|
|
|
1189
1239
|
return super.getData(e);
|
|
1190
1240
|
}
|
|
1191
1241
|
}
|
|
1192
|
-
class
|
|
1242
|
+
class _t extends ft {
|
|
1193
1243
|
/**
|
|
1194
1244
|
* @param {import("./BaseTile.js").Options<TileSourceType>} [options] Tile layer options.
|
|
1195
1245
|
*/
|
|
@@ -1200,21 +1250,21 @@ class ft extends gt {
|
|
|
1200
1250
|
* @override
|
|
1201
1251
|
*/
|
|
1202
1252
|
createRenderer() {
|
|
1203
|
-
return new
|
|
1253
|
+
return new gt(this, {
|
|
1204
1254
|
cacheSize: this.getCacheSize()
|
|
1205
1255
|
});
|
|
1206
1256
|
}
|
|
1207
1257
|
}
|
|
1208
|
-
const
|
|
1258
|
+
const Et = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1209
1259
|
__proto__: null,
|
|
1210
|
-
default:
|
|
1260
|
+
default: _t
|
|
1211
1261
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1212
1262
|
export {
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1263
|
+
dt as C,
|
|
1264
|
+
_t as T,
|
|
1265
|
+
at as Z,
|
|
1266
|
+
gt as a,
|
|
1267
|
+
H as b,
|
|
1268
|
+
Ct as c,
|
|
1269
|
+
Et as d
|
|
1220
1270
|
};
|