ol 10.7.1-dev.1764736468522 → 10.7.1-dev.1764840646882
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/ol.js +1 -1
- package/dist/ol.js.map +1 -1
- package/package.json +1 -1
- package/render/canvas/ExecutorGroup.d.ts.map +1 -1
- package/render/canvas/ExecutorGroup.js +41 -5
- package/reproj/Tile.d.ts +7 -2
- package/reproj/Tile.d.ts.map +1 -1
- package/reproj/Tile.js +12 -6
- package/util.js +1 -1
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExecutorGroup.d.ts","sourceRoot":"","sources":["ExecutorGroup.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ExecutorGroup.d.ts","sourceRoot":"","sources":["ExecutorGroup.js"],"names":[],"mappings":"AAqfA;;;;;;GAMG;AACH,2CAHW,MAAM,GACL,KAAK,CAAC,MAAM,CAAC,CA2CxB;AAthBD;;;GAGG;AACH,kBAFU,KAAK,CAAC,OAAO,cAAc,EAAE,WAAW,CAAC,CASjD;AAEF;;;GAGG;AACH,wBAFU,KAAK,CAAC,OAAO,cAAc,EAAE,WAAW,CAAC,CAER;AAE3C;;;GAGG;AACH,4BAFU,KAAK,CAAC,OAAO,cAAc,EAAE,WAAW,CAAC,CAIjD;;AAqCF;IACE;;;;;;;;;;;;OAYG;IACH,uBAZW,OAAO,iBAAiB,EAAE,MAAM,cAIhC,MAAM,cACN,MAAM,YACN,OAAO,mBACP;YAAQ,MAAM,GAAE,GAA4F;KAAC,iBAE7G,MAAM,sBACN,OAAO,EAwEjB;IA7DC;;;OAGG;IACH,mBAA2B;IAE3B;;;OAGG;IACH,kBAAyB;IAEzB;;;OAGG;IACH,oBAA6B;IAE7B;;;OAGG;IACH,oBAA6B;IAE7B;;;OAGG;IACH,sBAAiC;IAEjC;;;OAGG;IACH,2BAA4B;IAE5B;;;OAGG;IACH,6BAAgC;IAEhC;;;OAGG;IACH,+BAA+C;IAE/C;;;OAGG;IACH,yBAA4B;IAE5B;;;OAGG;IACH,gCAAiC;IAKnC;;;OAGG;IACH,cAHW,wBAAwB,GAAC,iCAAiC,aAC1D,OAAO,oBAAoB,EAAE,SAAS,QAUhD;IAED;;;;;OAKG;IACH,yBAmBC;IAED;;;OAGG;IACH,wBAHW,KAAK,CAAC,OAAO,cAAc,EAAE,WAAW,CAAC,GACxC,OAAO,CAYlB;IAED;;;;;;;;;OASG;IACH,2BAFa,CAAC,cAPH,OAAO,qBAAqB,EAAE,UAAU,cACxC,MAAM,YACN,MAAM,gBACN,MAAM,YACN,CAAS,IAAsC,EAAtC,OAAO,kBAAkB,EAAE,WAAW,EAAE,IAA8C,EAA9C,OAAO,8BAA8B,EAAE,OAAO,EAAE,IAAM,EAAN,MAAM,KAAG,CAAC,uBAC3G,KAAK,CAAC,OAAO,kBAAkB,EAAE,WAAW,CAAC,GAC5C,CAAC,GAAC,SAAS,CAgItB;IAED;;;OAGG;IACH,yBAHW,OAAO,oBAAoB,EAAE,SAAS,GACrC,KAAK,CAAC,MAAM,CAAC,GAAC,IAAI,CAc7B;IAED;;OAEG;IACH,WAFY,OAAO,CAIlB;IAED;;;;;;;;;;OAUG;IACH,uBAVW,wBAAwB,GAAC,iCAAiC,oBAC1D,OAAO,eAAe,EAAE,IAAI,aAC5B,OAAO,oBAAoB,EAAE,SAAS,gBACtC,MAAM,eACN,OAAO,iBACP,KAAK,CAAC,OAAO,cAAc,EAAE,WAAW,CAAC,kBAEzC,OAAO,OAAO,EAAE,OAAO,CAAC,OAAO,eAAe,EAAE,cAAc,CAAC,GAAC,IAAI,QAgF9E;IAED;;MAEC;IAED,mFAEC;IAED,uBAUC;CACF"}
|
|
@@ -40,6 +40,41 @@ export const NON_DECLUTTER = ALL.filter(
|
|
|
40
40
|
(builderType) => !DECLUTTER.includes(builderType),
|
|
41
41
|
);
|
|
42
42
|
|
|
43
|
+
/** @type {boolean|undefined} */
|
|
44
|
+
let willReadFrequently = false;
|
|
45
|
+
|
|
46
|
+
/** @type {boolean|undefined} */
|
|
47
|
+
let canvasReadsBenchmarked = false;
|
|
48
|
+
|
|
49
|
+
/** Determine if canvas read operations are faster with willReadFrequently set to true or false */
|
|
50
|
+
function benchmarkCanvasReads() {
|
|
51
|
+
let bestResult = 0;
|
|
52
|
+
/**
|
|
53
|
+
* @param {boolean} willReadFrequently Will read frequently.
|
|
54
|
+
* @return {number} Operation count.
|
|
55
|
+
*/
|
|
56
|
+
const measure = (willReadFrequently) => {
|
|
57
|
+
const context = createCanvasContext2D(1, 1, null, {willReadFrequently});
|
|
58
|
+
let count = 0;
|
|
59
|
+
const start = performance.now();
|
|
60
|
+
for (; performance.now() - start < 50; ++count) {
|
|
61
|
+
context.fillStyle = `rgba(255,0,${count % 256},1)`;
|
|
62
|
+
context.fillRect(0, 0, 1, 1);
|
|
63
|
+
context.getImageData(0, 0, 1, 1);
|
|
64
|
+
}
|
|
65
|
+
bestResult = count > bestResult ? count : bestResult;
|
|
66
|
+
return count;
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const measures = {
|
|
70
|
+
[measure(true)]: true,
|
|
71
|
+
[measure(false)]: false,
|
|
72
|
+
[measure(undefined)]: undefined,
|
|
73
|
+
};
|
|
74
|
+
willReadFrequently = measures[bestResult];
|
|
75
|
+
canvasReadsBenchmarked = true;
|
|
76
|
+
}
|
|
77
|
+
|
|
43
78
|
class ExecutorGroup {
|
|
44
79
|
/**
|
|
45
80
|
* @param {import("../../extent.js").Extent} maxExtent Max extent for clipping. When a
|
|
@@ -201,6 +236,10 @@ class ExecutorGroup {
|
|
|
201
236
|
callback,
|
|
202
237
|
declutteredFeatures,
|
|
203
238
|
) {
|
|
239
|
+
if (canvasReadsBenchmarked === false) {
|
|
240
|
+
benchmarkCanvasReads();
|
|
241
|
+
}
|
|
242
|
+
|
|
204
243
|
hitTolerance = Math.round(hitTolerance);
|
|
205
244
|
const contextSize = hitTolerance * 2 + 1;
|
|
206
245
|
const transform = composeTransform(
|
|
@@ -216,14 +255,11 @@ class ExecutorGroup {
|
|
|
216
255
|
|
|
217
256
|
const newContext = !this.hitDetectionContext_;
|
|
218
257
|
if (newContext) {
|
|
219
|
-
// Refrain from adding a 'willReadFrequently' hint in the options here.
|
|
220
|
-
// While it will remove the "Canvas2D: Multiple readback operations using
|
|
221
|
-
// getImageData are faster with the willReadFrequently attribute set
|
|
222
|
-
// to true" warnings in the console, it makes hitDetection extremely
|
|
223
|
-
// slow in Chrome when there are many features on the map
|
|
224
258
|
this.hitDetectionContext_ = createCanvasContext2D(
|
|
225
259
|
contextSize,
|
|
226
260
|
contextSize,
|
|
261
|
+
null,
|
|
262
|
+
{willReadFrequently},
|
|
227
263
|
);
|
|
228
264
|
}
|
|
229
265
|
const context = this.hitDetectionContext_;
|
package/reproj/Tile.d.ts
CHANGED
|
@@ -4,7 +4,11 @@ export type TileOffset = {
|
|
|
4
4
|
/**
|
|
5
5
|
* Tile.
|
|
6
6
|
*/
|
|
7
|
-
tile
|
|
7
|
+
tile?: import("../ImageTile.js").default | undefined;
|
|
8
|
+
/**
|
|
9
|
+
* Tile getter.
|
|
10
|
+
*/
|
|
11
|
+
getTile: () => import("../ImageTile.js").default;
|
|
8
12
|
/**
|
|
9
13
|
* Offset.
|
|
10
14
|
*/
|
|
@@ -15,7 +19,8 @@ export type TileOffset = {
|
|
|
15
19
|
*/
|
|
16
20
|
/**
|
|
17
21
|
* @typedef {Object} TileOffset
|
|
18
|
-
* @property {import("../ImageTile.js").default} tile Tile.
|
|
22
|
+
* @property {import("../ImageTile.js").default} [tile] Tile.
|
|
23
|
+
* @property {function(): import("../ImageTile.js").default} getTile Tile getter.
|
|
19
24
|
* @property {number} offset Offset.
|
|
20
25
|
*/
|
|
21
26
|
/**
|
package/reproj/Tile.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tile.d.ts","sourceRoot":"","sources":["Tile.js"],"names":[],"mappings":";2BAoBa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AsDD;;OAEG;IACH,yBAGC;CAmBF;iBAtZgB,YAAY"}
|
package/reproj/Tile.js
CHANGED
|
@@ -23,7 +23,8 @@ import {ERROR_THRESHOLD} from './common.js';
|
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
25
|
* @typedef {Object} TileOffset
|
|
26
|
-
* @property {import("../ImageTile.js").default} tile Tile.
|
|
26
|
+
* @property {import("../ImageTile.js").default} [tile] Tile.
|
|
27
|
+
* @property {function(): import("../ImageTile.js").default} getTile Tile getter.
|
|
27
28
|
* @property {number} offset Offset.
|
|
28
29
|
*/
|
|
29
30
|
|
|
@@ -244,11 +245,12 @@ class ReprojTile extends Tile {
|
|
|
244
245
|
|
|
245
246
|
for (let srcX = sourceRange.minX; srcX <= sourceRange.maxX; srcX++) {
|
|
246
247
|
for (let srcY = sourceRange.minY; srcY <= sourceRange.maxY; srcY++) {
|
|
247
|
-
const
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
248
|
+
const offset = worldsAway * worldWidth;
|
|
249
|
+
this.sourceTiles_.push({
|
|
250
|
+
getTile: () =>
|
|
251
|
+
getTileFunction(this.sourceZ_, srcX, srcY, pixelRatio),
|
|
252
|
+
offset,
|
|
253
|
+
});
|
|
252
254
|
}
|
|
253
255
|
}
|
|
254
256
|
++worldsAway;
|
|
@@ -334,6 +336,9 @@ class ReprojTile extends Tile {
|
|
|
334
336
|
* @override
|
|
335
337
|
*/
|
|
336
338
|
load() {
|
|
339
|
+
for (const sourceTile of this.sourceTiles_) {
|
|
340
|
+
sourceTile.tile = sourceTile.getTile();
|
|
341
|
+
}
|
|
337
342
|
if (this.state == TileState.IDLE) {
|
|
338
343
|
this.state = TileState.LOADING;
|
|
339
344
|
this.changed();
|
|
@@ -400,6 +405,7 @@ class ReprojTile extends Tile {
|
|
|
400
405
|
canvasPool.push(this.canvas_);
|
|
401
406
|
this.canvas_ = null;
|
|
402
407
|
}
|
|
408
|
+
this.sourceTiles_.length = 0;
|
|
403
409
|
super.release();
|
|
404
410
|
}
|
|
405
411
|
}
|
package/util.js
CHANGED