ol 7.1.1-pr.14101.2 → 7.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (190) hide show
  1. package/AssertionError.d.ts.map +1 -1
  2. package/AssertionError.js +1 -0
  3. package/DataTile.d.ts +34 -11
  4. package/DataTile.d.ts.map +1 -1
  5. package/DataTile.js +84 -7
  6. package/Feature.d.ts +3 -3
  7. package/Feature.js +3 -3
  8. package/Geolocation.d.ts +34 -27
  9. package/Geolocation.d.ts.map +1 -1
  10. package/Geolocation.js +30 -12
  11. package/Map.d.ts +19 -6
  12. package/Map.d.ts.map +1 -1
  13. package/Map.js +70 -43
  14. package/MapBrowserEventHandler.d.ts.map +1 -1
  15. package/MapBrowserEventHandler.js +9 -13
  16. package/Overlay.d.ts +1 -1
  17. package/Overlay.js +1 -1
  18. package/README.md +9 -1
  19. package/Tile.d.ts +2 -2
  20. package/Tile.js +1 -1
  21. package/TileCache.d.ts.map +1 -1
  22. package/TileCache.js +6 -8
  23. package/array.d.ts +2 -2
  24. package/array.d.ts.map +1 -1
  25. package/array.js +4 -4
  26. package/console.d.ts +13 -0
  27. package/console.d.ts.map +1 -0
  28. package/console.js +54 -0
  29. package/control/MousePosition.d.ts +12 -0
  30. package/control/MousePosition.d.ts.map +1 -1
  31. package/control/MousePosition.js +14 -0
  32. package/coordinate.d.ts +11 -11
  33. package/coordinate.js +11 -11
  34. package/dist/ol.js +1 -3
  35. package/dist/ol.js.map +1 -1
  36. package/featureloader.d.ts.map +1 -1
  37. package/featureloader.js +0 -1
  38. package/format/KML.js +3 -1
  39. package/geom/flat/interiorpoint.js +2 -2
  40. package/interaction/DragPan.d.ts.map +1 -1
  41. package/interaction/DragPan.js +3 -2
  42. package/interaction/Draw.d.ts.map +1 -1
  43. package/interaction/Draw.js +11 -14
  44. package/interaction/KeyboardPan.d.ts.map +1 -1
  45. package/interaction/KeyboardPan.js +0 -1
  46. package/interaction/KeyboardZoom.d.ts.map +1 -1
  47. package/interaction/KeyboardZoom.js +0 -1
  48. package/interaction/Link.d.ts +14 -0
  49. package/interaction/Link.d.ts.map +1 -1
  50. package/interaction/Link.js +37 -6
  51. package/interaction/Modify.d.ts +10 -10
  52. package/interaction/Modify.d.ts.map +1 -1
  53. package/interaction/Modify.js +15 -15
  54. package/interaction/PinchRotate.d.ts.map +1 -1
  55. package/interaction/PinchRotate.js +3 -5
  56. package/interaction/PinchZoom.d.ts.map +1 -1
  57. package/interaction/PinchZoom.js +3 -5
  58. package/interaction/Pointer.d.ts +5 -2
  59. package/interaction/Pointer.d.ts.map +1 -1
  60. package/interaction/Pointer.js +2 -2
  61. package/interaction/Select.d.ts.map +1 -1
  62. package/interaction/Select.js +4 -5
  63. package/interaction/Snap.d.ts +1 -1
  64. package/interaction/Snap.d.ts.map +1 -1
  65. package/interaction/Snap.js +17 -23
  66. package/interaction/Translate.d.ts +12 -11
  67. package/interaction/Translate.d.ts.map +1 -1
  68. package/interaction/Translate.js +16 -13
  69. package/layer/BaseVector.js +1 -1
  70. package/layer/Graticule.d.ts.map +1 -1
  71. package/layer/Graticule.js +4 -4
  72. package/layer/Heatmap.js +10 -10
  73. package/layer/Layer.d.ts +2 -2
  74. package/layer/Layer.d.ts.map +1 -1
  75. package/layer/Layer.js +2 -2
  76. package/layer/VectorTile.js +1 -1
  77. package/package.json +2 -2
  78. package/proj.d.ts +2 -4
  79. package/proj.d.ts.map +1 -1
  80. package/proj.js +4 -6
  81. package/render/canvas/ExecutorGroup.d.ts.map +1 -1
  82. package/render/canvas/ExecutorGroup.js +6 -4
  83. package/render/canvas/Immediate.d.ts +5 -0
  84. package/render/canvas/Immediate.d.ts.map +1 -1
  85. package/render/canvas/Immediate.js +15 -0
  86. package/render/canvas/hitdetect.d.ts +4 -3
  87. package/render/canvas/hitdetect.d.ts.map +1 -1
  88. package/render/canvas/hitdetect.js +23 -11
  89. package/render/webgl/BatchRenderer.d.ts.map +1 -1
  90. package/render/webgl/BatchRenderer.js +2 -3
  91. package/render/webgl/LineStringBatchRenderer.d.ts.map +1 -1
  92. package/render/webgl/LineStringBatchRenderer.js +2 -4
  93. package/render/webgl/PointBatchRenderer.d.ts.map +1 -1
  94. package/render/webgl/PointBatchRenderer.js +2 -4
  95. package/render/webgl/PolygonBatchRenderer.d.ts.map +1 -1
  96. package/render/webgl/PolygonBatchRenderer.js +2 -4
  97. package/render.d.ts +3 -3
  98. package/render.d.ts.map +1 -1
  99. package/render.js +6 -4
  100. package/renderer/Layer.d.ts +2 -2
  101. package/renderer/Layer.d.ts.map +1 -1
  102. package/renderer/Layer.js +3 -4
  103. package/renderer/canvas/Layer.d.ts.map +1 -1
  104. package/renderer/canvas/Layer.js +3 -4
  105. package/renderer/canvas/TileLayer.js +2 -2
  106. package/renderer/canvas/VectorImageLayer.d.ts +6 -0
  107. package/renderer/canvas/VectorImageLayer.d.ts.map +1 -1
  108. package/renderer/canvas/VectorImageLayer.js +22 -25
  109. package/renderer/canvas/VectorLayer.d.ts +9 -2
  110. package/renderer/canvas/VectorLayer.d.ts.map +1 -1
  111. package/renderer/canvas/VectorLayer.js +87 -93
  112. package/renderer/canvas/VectorTileLayer.js +84 -84
  113. package/renderer/webgl/PointsLayer.d.ts.map +1 -1
  114. package/renderer/webgl/PointsLayer.js +10 -13
  115. package/renderer/webgl/TileLayer.d.ts.map +1 -1
  116. package/renderer/webgl/TileLayer.js +2 -4
  117. package/reproj/DataTile.d.ts +75 -17
  118. package/reproj/DataTile.d.ts.map +1 -1
  119. package/reproj/DataTile.js +121 -120
  120. package/reproj/Tile.d.ts +3 -3
  121. package/reproj/Tile.d.ts.map +1 -1
  122. package/reproj/Tile.js +37 -41
  123. package/reproj/Triangulation.d.ts.map +1 -1
  124. package/reproj/Triangulation.js +42 -44
  125. package/source/BingMaps.d.ts.map +1 -1
  126. package/source/BingMaps.js +33 -38
  127. package/source/DataTile.d.ts +5 -3
  128. package/source/DataTile.d.ts.map +1 -1
  129. package/source/DataTile.js +24 -20
  130. package/source/GeoTIFF.d.ts +10 -7
  131. package/source/GeoTIFF.d.ts.map +1 -1
  132. package/source/GeoTIFF.js +49 -20
  133. package/source/Image.d.ts +8 -0
  134. package/source/Image.d.ts.map +1 -1
  135. package/source/Image.js +13 -11
  136. package/source/OGCMapTile.d.ts +1 -0
  137. package/source/OGCMapTile.d.ts.map +1 -1
  138. package/source/OGCMapTile.js +3 -1
  139. package/source/OGCVectorTile.d.ts +1 -0
  140. package/source/OGCVectorTile.d.ts.map +1 -1
  141. package/source/OGCVectorTile.js +3 -1
  142. package/source/Raster.d.ts +16 -0
  143. package/source/Raster.d.ts.map +1 -1
  144. package/source/Raster.js +47 -7
  145. package/source/Source.d.ts +2 -2
  146. package/source/Source.d.ts.map +1 -1
  147. package/source/Source.js +3 -4
  148. package/source/Stamen.js +2 -2
  149. package/source/Tile.d.ts.map +1 -1
  150. package/source/Tile.js +7 -3
  151. package/source/TileImage.d.ts +2 -2
  152. package/source/TileImage.d.ts.map +1 -1
  153. package/source/TileImage.js +3 -4
  154. package/source/UTFGrid.d.ts.map +1 -1
  155. package/source/UTFGrid.js +3 -6
  156. package/source/Vector.d.ts +6 -6
  157. package/source/Vector.js +13 -13
  158. package/source/VectorTile.d.ts.map +1 -1
  159. package/source/VectorTile.js +5 -9
  160. package/source/Zoomify.d.ts.map +1 -1
  161. package/source/Zoomify.js +4 -7
  162. package/style/Icon.d.ts +51 -0
  163. package/style/Icon.d.ts.map +1 -1
  164. package/style/Icon.js +119 -0
  165. package/style/IconImage.d.ts.map +1 -1
  166. package/style/IconImage.js +3 -1
  167. package/style/Image.d.ts.map +1 -1
  168. package/style/Image.js +1 -0
  169. package/style/Style.d.ts +2 -2
  170. package/style/Style.js +2 -2
  171. package/style/expressions.js +5 -10
  172. package/tilegrid/TileGrid.d.ts.map +1 -1
  173. package/tilegrid/TileGrid.js +7 -12
  174. package/util.d.ts.map +1 -1
  175. package/util.js +1 -1
  176. package/webgl/Helper.d.ts +4 -0
  177. package/webgl/Helper.d.ts.map +1 -1
  178. package/webgl/Helper.js +78 -79
  179. package/webgl/PostProcessingPass.d.ts +2 -2
  180. package/webgl/PostProcessingPass.d.ts.map +1 -1
  181. package/webgl/PostProcessingPass.js +7 -9
  182. package/webgl/ShaderBuilder.d.ts +1 -1
  183. package/webgl/ShaderBuilder.js +1 -1
  184. package/webgl/TileTexture.d.ts +19 -2
  185. package/webgl/TileTexture.d.ts.map +1 -1
  186. package/webgl/TileTexture.js +93 -46
  187. package/worker/webgl.js +1 -1
  188. package/layer/STAC.d.ts +0 -257
  189. package/layer/STAC.d.ts.map +0 -1
  190. package/layer/STAC.js +0 -312
@@ -63,7 +63,7 @@ class CanvasVectorLayerRenderer extends CanvasLayerRenderer {
63
63
  this.animatingOrInteracting_;
64
64
 
65
65
  /**
66
- * @type {ImageData}
66
+ * @type {ImageData|null}
67
67
  */
68
68
  this.hitDetectionImageData_ = null;
69
69
 
@@ -334,100 +334,95 @@ class CanvasVectorLayerRenderer extends CanvasLayerRenderer {
334
334
  /**
335
335
  * Asynchronous layer level hit detection.
336
336
  * @param {import("../../pixel.js").Pixel} pixel Pixel.
337
- * @return {Promise<Array<import("../../Feature").default>>} Promise that resolves with an array of features.
337
+ * @return {Promise<Array<import("../../Feature").default>>} Promise
338
+ * that resolves with an array of features.
338
339
  */
339
340
  getFeatures(pixel) {
340
- return new Promise(
341
- /**
342
- * @param {function(Array<import("../../Feature").default|import("../../render/Feature").default>): void} resolve Resolver function.
343
- * @this {CanvasVectorLayerRenderer}
344
- */
345
- function (resolve) {
346
- if (!this.hitDetectionImageData_ && !this.animatingOrInteracting_) {
347
- const size = [this.context.canvas.width, this.context.canvas.height];
348
- apply(this.pixelTransform, size);
349
- const center = this.renderedCenter_;
350
- const resolution = this.renderedResolution_;
351
- const rotation = this.renderedRotation_;
352
- const projection = this.renderedProjection_;
353
- const extent = this.wrappedRenderedExtent_;
354
- const layer = this.getLayer();
355
- const transforms = [];
356
- const width = size[0] * HIT_DETECT_RESOLUTION;
357
- const height = size[1] * HIT_DETECT_RESOLUTION;
358
- transforms.push(
359
- this.getRenderTransform(
360
- center,
361
- resolution,
362
- rotation,
363
- HIT_DETECT_RESOLUTION,
364
- width,
365
- height,
366
- 0
367
- ).slice()
368
- );
369
- const source = layer.getSource();
370
- const projectionExtent = projection.getExtent();
371
- if (
372
- source.getWrapX() &&
373
- projection.canWrapX() &&
374
- !containsExtent(projectionExtent, extent)
375
- ) {
376
- let startX = extent[0];
377
- const worldWidth = getWidth(projectionExtent);
378
- let world = 0;
379
- let offsetX;
380
- while (startX < projectionExtent[0]) {
381
- --world;
382
- offsetX = worldWidth * world;
383
- transforms.push(
384
- this.getRenderTransform(
385
- center,
386
- resolution,
387
- rotation,
388
- HIT_DETECT_RESOLUTION,
389
- width,
390
- height,
391
- offsetX
392
- ).slice()
393
- );
394
- startX += worldWidth;
395
- }
396
- world = 0;
397
- startX = extent[2];
398
- while (startX > projectionExtent[2]) {
399
- ++world;
400
- offsetX = worldWidth * world;
401
- transforms.push(
402
- this.getRenderTransform(
403
- center,
404
- resolution,
405
- rotation,
406
- HIT_DETECT_RESOLUTION,
407
- width,
408
- height,
409
- offsetX
410
- ).slice()
411
- );
412
- startX -= worldWidth;
413
- }
414
- }
415
-
416
- this.hitDetectionImageData_ = createHitDetectionImageData(
417
- size,
418
- transforms,
419
- this.renderedFeatures_,
420
- layer.getStyleFunction(),
421
- extent,
341
+ return new Promise((resolve) => {
342
+ if (!this.hitDetectionImageData_ && !this.animatingOrInteracting_) {
343
+ const size = [this.context.canvas.width, this.context.canvas.height];
344
+ apply(this.pixelTransform, size);
345
+ const center = this.renderedCenter_;
346
+ const resolution = this.renderedResolution_;
347
+ const rotation = this.renderedRotation_;
348
+ const projection = this.renderedProjection_;
349
+ const extent = this.wrappedRenderedExtent_;
350
+ const layer = this.getLayer();
351
+ const transforms = [];
352
+ const width = size[0] * HIT_DETECT_RESOLUTION;
353
+ const height = size[1] * HIT_DETECT_RESOLUTION;
354
+ transforms.push(
355
+ this.getRenderTransform(
356
+ center,
422
357
  resolution,
423
- rotation
424
- );
358
+ rotation,
359
+ HIT_DETECT_RESOLUTION,
360
+ width,
361
+ height,
362
+ 0
363
+ ).slice()
364
+ );
365
+ const source = layer.getSource();
366
+ const projectionExtent = projection.getExtent();
367
+ if (
368
+ source.getWrapX() &&
369
+ projection.canWrapX() &&
370
+ !containsExtent(projectionExtent, extent)
371
+ ) {
372
+ let startX = extent[0];
373
+ const worldWidth = getWidth(projectionExtent);
374
+ let world = 0;
375
+ let offsetX;
376
+ while (startX < projectionExtent[0]) {
377
+ --world;
378
+ offsetX = worldWidth * world;
379
+ transforms.push(
380
+ this.getRenderTransform(
381
+ center,
382
+ resolution,
383
+ rotation,
384
+ HIT_DETECT_RESOLUTION,
385
+ width,
386
+ height,
387
+ offsetX
388
+ ).slice()
389
+ );
390
+ startX += worldWidth;
391
+ }
392
+ world = 0;
393
+ startX = extent[2];
394
+ while (startX > projectionExtent[2]) {
395
+ ++world;
396
+ offsetX = worldWidth * world;
397
+ transforms.push(
398
+ this.getRenderTransform(
399
+ center,
400
+ resolution,
401
+ rotation,
402
+ HIT_DETECT_RESOLUTION,
403
+ width,
404
+ height,
405
+ offsetX
406
+ ).slice()
407
+ );
408
+ startX -= worldWidth;
409
+ }
425
410
  }
426
- resolve(
427
- hitDetect(pixel, this.renderedFeatures_, this.hitDetectionImageData_)
411
+
412
+ this.hitDetectionImageData_ = createHitDetectionImageData(
413
+ size,
414
+ transforms,
415
+ this.renderedFeatures_,
416
+ layer.getStyleFunction(),
417
+ extent,
418
+ resolution,
419
+ rotation
428
420
  );
429
- }.bind(this)
430
- );
421
+ }
422
+ resolve(
423
+ hitDetect(pixel, this.renderedFeatures_, this.hitDetectionImageData_)
424
+ );
425
+ });
431
426
  }
432
427
 
433
428
  /**
@@ -679,9 +674,8 @@ class CanvasVectorLayerRenderer extends CanvasLayerRenderer {
679
674
  const render =
680
675
  /**
681
676
  * @param {import("../../Feature.js").default} feature Feature.
682
- * @this {CanvasVectorLayerRenderer}
683
677
  */
684
- function (feature) {
678
+ (feature) => {
685
679
  let styles;
686
680
  const styleFunction =
687
681
  feature.getStyleFunction() || vectorLayer.getStyleFunction();
@@ -699,7 +693,7 @@ class CanvasVectorLayerRenderer extends CanvasLayerRenderer {
699
693
  );
700
694
  ready = ready && !dirty;
701
695
  }
702
- }.bind(this);
696
+ };
703
697
 
704
698
  const userExtent = toUserExtent(extent, projection);
705
699
  /** @type {Array<import("../../Feature.js").default>} */
@@ -434,97 +434,97 @@ class CanvasVectorTileLayerRenderer extends CanvasTileLayerRenderer {
434
434
  /**
435
435
  * Asynchronous layer level hit detection.
436
436
  * @param {import("../../pixel.js").Pixel} pixel Pixel.
437
- * @return {Promise<Array<import("../../Feature").default>>} Promise that resolves with an array of features.
437
+ * @return {Promise<Array<import("../../Feature.js").FeatureLike>>} Promise that resolves with an array of features.
438
438
  */
439
439
  getFeatures(pixel) {
440
- return new Promise(
441
- function (resolve, reject) {
442
- const layer =
443
- /** @type {import("../../layer/VectorTile.js").default} */ (
444
- this.getLayer()
440
+ return new Promise((resolve, reject) => {
441
+ const layer = this.getLayer();
442
+ const layerUid = getUid(layer);
443
+ const source = layer.getSource();
444
+ const projection = this.renderedProjection;
445
+ const projectionExtent = projection.getExtent();
446
+ const resolution = this.renderedResolution;
447
+ const tileGrid = source.getTileGridForProjection(projection);
448
+ const coordinate = applyTransform(
449
+ this.renderedPixelToCoordinateTransform_,
450
+ pixel.slice()
451
+ );
452
+ const tileCoord = tileGrid.getTileCoordForCoordAndResolution(
453
+ coordinate,
454
+ resolution
455
+ );
456
+ /** @type {import("../../VectorRenderTile.js").default|undefined} */
457
+ let tile;
458
+ for (let i = 0, ii = this.renderedTiles.length; i < ii; ++i) {
459
+ if (
460
+ tileCoord.toString() === this.renderedTiles[i].tileCoord.toString()
461
+ ) {
462
+ tile = /** @type {import("../../VectorRenderTile.js").default} */ (
463
+ this.renderedTiles[i]
445
464
  );
446
- const layerUid = getUid(layer);
447
- const source = layer.getSource();
448
- const projection = this.renderedProjection;
449
- const projectionExtent = projection.getExtent();
450
- const resolution = this.renderedResolution;
451
- const tileGrid = source.getTileGridForProjection(projection);
452
- const coordinate = applyTransform(
453
- this.renderedPixelToCoordinateTransform_,
454
- pixel.slice()
455
- );
456
- const tileCoord = tileGrid.getTileCoordForCoordAndResolution(
457
- coordinate,
458
- resolution
459
- );
460
- let tile;
461
- for (let i = 0, ii = this.renderedTiles.length; i < ii; ++i) {
462
- if (
463
- tileCoord.toString() === this.renderedTiles[i].tileCoord.toString()
464
- ) {
465
- tile = this.renderedTiles[i];
466
- if (tile.getState() === TileState.LOADED) {
467
- const extent = tileGrid.getTileCoordExtent(tile.tileCoord);
468
- if (
469
- source.getWrapX() &&
470
- projection.canWrapX() &&
471
- !containsExtent(projectionExtent, extent)
472
- ) {
473
- wrapX(coordinate, projection);
474
- }
475
- break;
465
+ if (tile.getState() === TileState.LOADED) {
466
+ const extent = tileGrid.getTileCoordExtent(tile.tileCoord);
467
+ if (
468
+ source.getWrapX() &&
469
+ projection.canWrapX() &&
470
+ !containsExtent(projectionExtent, extent)
471
+ ) {
472
+ wrapX(coordinate, projection);
476
473
  }
477
- tile = undefined;
474
+ break;
478
475
  }
476
+ tile = undefined;
479
477
  }
480
- if (!tile || tile.loadingSourceTiles > 0) {
481
- resolve([]);
482
- return;
483
- }
484
- const extent = tileGrid.getTileCoordExtent(tile.wrappedTileCoord);
485
- const corner = getTopLeft(extent);
486
- const tilePixel = [
487
- (coordinate[0] - corner[0]) / resolution,
488
- (corner[1] - coordinate[1]) / resolution,
478
+ }
479
+ if (!tile || tile.loadingSourceTiles > 0) {
480
+ resolve([]);
481
+ return;
482
+ }
483
+ const extent = tileGrid.getTileCoordExtent(tile.wrappedTileCoord);
484
+ const corner = getTopLeft(extent);
485
+ const tilePixel = [
486
+ (coordinate[0] - corner[0]) / resolution,
487
+ (corner[1] - coordinate[1]) / resolution,
488
+ ];
489
+ /** @type {Array<import("../../Feature.js").FeatureLike>} */
490
+ const features = tile
491
+ .getSourceTiles()
492
+ .reduce(function (accumulator, sourceTile) {
493
+ return accumulator.concat(sourceTile.getFeatures());
494
+ }, []);
495
+ /** @type {ImageData|undefined} */
496
+ let hitDetectionImageData = tile.hitDetectionImageData[layerUid];
497
+ if (!hitDetectionImageData) {
498
+ const tileSize = toSize(
499
+ tileGrid.getTileSize(
500
+ tileGrid.getZForResolution(resolution, source.zDirection)
501
+ )
502
+ );
503
+ const rotation = this.renderedRotation_;
504
+ const transforms = [
505
+ this.getRenderTransform(
506
+ tileGrid.getTileCoordCenter(tile.wrappedTileCoord),
507
+ resolution,
508
+ 0,
509
+ HIT_DETECT_RESOLUTION,
510
+ tileSize[0] * HIT_DETECT_RESOLUTION,
511
+ tileSize[1] * HIT_DETECT_RESOLUTION,
512
+ 0
513
+ ),
489
514
  ];
490
- const features = tile
491
- .getSourceTiles()
492
- .reduce(function (accumulator, sourceTile) {
493
- return accumulator.concat(sourceTile.getFeatures());
494
- }, []);
495
- let hitDetectionImageData = tile.hitDetectionImageData[layerUid];
496
- if (!hitDetectionImageData && !this.animatingOrInteracting_) {
497
- const tileSize = toSize(
498
- tileGrid.getTileSize(
499
- tileGrid.getZForResolution(resolution, source.zDirection)
500
- )
501
- );
502
- const rotation = this.renderedRotation_;
503
- const transforms = [
504
- this.getRenderTransform(
505
- tileGrid.getTileCoordCenter(tile.wrappedTileCoord),
506
- resolution,
507
- 0,
508
- HIT_DETECT_RESOLUTION,
509
- tileSize[0] * HIT_DETECT_RESOLUTION,
510
- tileSize[1] * HIT_DETECT_RESOLUTION,
511
- 0
512
- ),
513
- ];
514
- hitDetectionImageData = createHitDetectionImageData(
515
- tileSize,
516
- transforms,
517
- features,
518
- layer.getStyleFunction(),
519
- tileGrid.getTileCoordExtent(tile.wrappedTileCoord),
520
- tile.getReplayState(layer).renderedResolution,
521
- rotation
522
- );
523
- tile.hitDetectionImageData[layerUid] = hitDetectionImageData;
524
- }
525
- resolve(hitDetect(tilePixel, features, hitDetectionImageData));
526
- }.bind(this)
527
- );
515
+ hitDetectionImageData = createHitDetectionImageData(
516
+ tileSize,
517
+ transforms,
518
+ features,
519
+ layer.getStyleFunction(),
520
+ tileGrid.getTileCoordExtent(tile.wrappedTileCoord),
521
+ tile.getReplayState(layer).renderedResolution,
522
+ rotation
523
+ );
524
+ tile.hitDetectionImageData[layerUid] = hitDetectionImageData;
525
+ }
526
+ resolve(hitDetect(tilePixel, features, hitDetectionImageData));
527
+ });
528
528
  }
529
529
 
530
530
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"PointsLayer.d.ts","sourceRoot":"","sources":["PointsLayer.js"],"names":[],"mappings":";;;;;;;;;UA6Bc,MAAM;;;;;qBACG,OAAO,eAAe,EAAE,OAAO;YAAS,MAAM;UAAM,MAAM;;;;;;;;;;aAOnE,OAAO,eAAe,EAAE,OAAO;;;;;YACxB,MAAM;;;;;cACb,OAAO,YAAY,EAAE,QAAQ;;;;;;;;;;;;;;;;;;kBAW7B,MAAM;;;;oBACN,MAAM;;;;;;;;;;;;;;;;;;;;;AAzBpB;;;;;;GAMG;AAEH;;;;;;GAMG;AAEH;;;;;;;;;;;;;;;GAeG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8DG;AACH;IACE;;;OAGG;IACH,mBAHW,OAAO,sBAAsB,EAAE,OAAO,WACtC,OAAO,EA4QjB;IA9PC,wBAAyB;IAEzB,kCAAuE;IACvE,qCAA0E;IAC1E,iCAGC;IAED;;OAEG;IACH,sBAAyC;IAEzC;;OAEG;IACH,wBAA6C;IAE7C;;;OAGG;IACH,iBAAa;IAEb;;;OAGG;IACH,6BACqE;IAErE;;OAEG;IACH,yBAA+C;IAE/C;;OAEG;IACH,2BAAmD;IAEnD;;;OAGG;IACH,oBAAgB;IAYhB;;;;OAIG;IACH,YAFU,MAAM,OAAO,uBAAuB,EAAE,oBAAoB,CAAC,CAa3C;IAE1B;;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sBAAsB,EAAE,OAAO,WACtC,OAAO,EAyQjB;IA3PC,wBAAyB;IAEzB,kCAAuE;IACvE,qCAA0E;IAC1E,iCAGC;IAED;;OAEG;IACH,sBAAyC;IAEzC;;OAEG;IACH,wBAA6C;IAE7C;;;OAGG;IACH,iBAAa;IAEb;;;OAGG;IACH,6BACqE;IAErE;;OAEG;IACH,yBAA+C;IAE/C;;OAEG;IACH,2BAAmD;IAEnD;;;OAGG;IACH,oBAAgB;IAYhB;;;;OAIG;IACH,YAFU,MAAM,OAAO,uBAAuB,EAAE,oBAAoB,CAAC,CAa3C;IAE1B;;;OAGG;IACH,wBAFU,MAAM,OAAO,uBAAuB,EAAE,oBAAoB,CAAC,CAuB3C;IAE1B,oCAAoE;IAEpE,kDAAoC;IAEpC;;;;;;OAMG;IACH,0BAAkD;IAElD;;;;OAIG;IACH,yBAAyC;IAEzC;;;OAGG;IACH,+BAA+C;IAE/C;;;OAGG;IACH,4BAA8C;IAE9C;;;;OAIG;IACH,+BAAiD;IAEjD;;;OAGG;IACH,yBAAqB;IAErB;;;;OAIG;IACH,4BAA4B;IAE5B;;OAEG;IACH,gBAAkC;IA4ClC;;;;OAIG;IACH,sBAAuB;IAEvB;;;;OAIG;IACH,sBAAsB;IAGtB,yDAyBC;IA2BH;;;OAGG;IACH,kCAQC;IAED;;;OAGG;IACH,oCAOC;IAED;;;OAGG;IACH,mCAIC;IAED;;OAEG;IACH,kCAGC;IAED;;;;OAIG;IACH,wBAHW,OAAO,cAAc,EAAE,UAAU,GAChC,WAAW,CAmDtB;IA6CD;;;;OAIG;IACH,wBA8GC;IA0CD;;;;;;OAMG;IACH,+BALW,OAAO,cAAc,EAAE,UAAU,cACjC,MAAM,YACN,MAAM,cACN,MAAM,QAmChB;CAcF"}
@@ -301,9 +301,8 @@ class WebGLPointsLayerRenderer extends WebGLLayerRenderer {
301
301
  'message',
302
302
  /**
303
303
  * @param {*} event Event.
304
- * @this {WebGLPointsLayerRenderer}
305
304
  */
306
- function (event) {
305
+ (event) => {
307
306
  const received = event.data;
308
307
  if (received.type === WebGLWorkerMessageType.GENERATE_POINT_BUFFERS) {
309
308
  const projectionTransform = received.projectionTransform;
@@ -337,7 +336,7 @@ class WebGLPointsLayerRenderer extends WebGLLayerRenderer {
337
336
 
338
337
  this.getLayer().changed();
339
338
  }
340
- }.bind(this)
339
+ }
341
340
  );
342
341
 
343
342
  /**
@@ -381,16 +380,14 @@ class WebGLPointsLayerRenderer extends WebGLLayerRenderer {
381
380
  this
382
381
  ),
383
382
  ];
384
- source.forEachFeature(
385
- function (feature) {
386
- this.featureCache_[getUid(feature)] = {
387
- feature: feature,
388
- properties: feature.getProperties(),
389
- geometry: feature.getGeometry(),
390
- };
391
- this.featureCount_++;
392
- }.bind(this)
393
- );
383
+ source.forEachFeature((feature) => {
384
+ this.featureCache_[getUid(feature)] = {
385
+ feature: feature,
386
+ properties: feature.getProperties(),
387
+ geometry: feature.getGeometry(),
388
+ };
389
+ this.featureCount_++;
390
+ });
394
391
  }
395
392
 
396
393
  afterHelperCreated() {
@@ -1 +1 @@
1
- {"version":3,"file":"TileLayer.d.ts","sourceRoot":"","sources":["TileLayer.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;kBAmIc,MAAM;;;;oBACN,MAAM;;;;;;;;;;;;;;;;;wBAQP,OAAO,0BAA0B,EAAE,OAAO;AAXvD;;;;;;;;GAQG;AAEH;;GAEG;AAEH;;;;;GAKG;AACH;IACE;;;OAGG;IACH,uBAHW,SAAS,WACT,OAAO,EAyGjB;IAlGC;;;OAGG;IACH,gBAFU,OAAO,CAEU;IAE3B;;;;OAIG;IACH,uBAAuC;IAEvC;;;OAGG;IACH,kBAA6B;IAE7B;;;OAGG;IACH,uBAA+C;IAE/C;;;OAGG;IACH,uBAA8C;IAE9C;;;OAGG;IACH,kBAAuB;IAEvB;;;OAGG;IACH,iBAAa;IAEb;;OAEG;IACH,sBAAyC;IAEzC;;OAEG;IACH,wBAA6C;IAE7C;;;;;;;;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AEhD;;;OAGG;IACH,yBAAqD;IAErD;;;OAGG;IACH,oBAAuB;IAEvB;;;OAGG;IACH,oBAA4B;IAG9B;;OAEG;IACH,eAFW,OAAO,QAgBjB;IAWD;;;;OAIG;IACH,wBASC;IA2BD;;;;;;OAMG;IACH,yBANW,OAAO,cAAc,EAAE,UAAU,UACjC,OAAO,iBAAiB,EAAE,MAAM,YAChC,MAAM;YACC,MAAM,GAAE,MAAM,WAAW,CAAC;gBACjC,MAAM,QAwGhB;IAED;;;;OAIG;IACH,wBAHW,OAAO,cAAc,EAAE,UAAU,GAChC,WAAW,CAmStB;IAED;;;OAGG;IACH,eAHW,OAAO,gBAAgB,EAAE,KAAK,GAC7B,iBAAiB,GAAC,UAAU,GAAC,YAAY,GAAC,QAAQ,CA4F7D;IAED;;;;;;;;;;OAUG;IACH,sBA+BC;IAED,mBAIC;CA6BF"}
@@ -19,6 +19,7 @@ import {
19
19
  scale as scaleTransform,
20
20
  translate as translateTransform,
21
21
  } from '../../transform.js';
22
+ import {ascending} from '../../array.js';
22
23
  import {
23
24
  boundingExtent,
24
25
  containsCoordinate,
@@ -35,7 +36,6 @@ import {
35
36
  } from '../../tilecoord.js';
36
37
  import {fromUserExtent} from '../../proj.js';
37
38
  import {getUid} from '../../util.js';
38
- import {numberSafeCompareFunction} from '../../array.js';
39
39
  import {toSize} from '../../size.js';
40
40
 
41
41
  export const Uniforms = {
@@ -562,9 +562,7 @@ class WebGLTileLayerRenderer extends WebGLLayerRenderer {
562
562
  this.helper.useProgram(this.program_, frameState);
563
563
  this.helper.prepareDraw(frameState, !blend);
564
564
 
565
- const zs = Object.keys(tileTexturesByZ)
566
- .map(Number)
567
- .sort(numberSafeCompareFunction);
565
+ const zs = Object.keys(tileTexturesByZ).map(Number).sort(ascending);
568
566
 
569
567
  const centerX = viewState.center[0];
570
568
  const centerY = viewState.center[1];
@@ -1,7 +1,76 @@
1
1
  export default ReprojDataTile;
2
- export type FunctionType = (arg0: number, arg1: number, arg2: number, arg3: number) => import("../DataTile.js").default;
2
+ export type TileGetter = (arg0: number, arg1: number, arg2: number, arg3: number) => import("../DataTile.js").default;
3
+ export type Options = {
4
+ /**
5
+ * Source projection.
6
+ */
7
+ sourceProj: import("../proj/Projection.js").default;
8
+ /**
9
+ * Source tile grid.
10
+ */
11
+ sourceTileGrid: import("../tilegrid/TileGrid.js").default;
12
+ /**
13
+ * Target projection.
14
+ */
15
+ targetProj: import("../proj/Projection.js").default;
16
+ /**
17
+ * Target tile grid.
18
+ */
19
+ targetTileGrid: import("../tilegrid/TileGrid.js").default;
20
+ /**
21
+ * Coordinate of the tile.
22
+ */
23
+ tileCoord: import("../tilecoord.js").TileCoord;
24
+ /**
25
+ * Coordinate of the tile wrapped in X.
26
+ */
27
+ wrappedTileCoord?: import("../tilecoord.js").TileCoord | undefined;
28
+ /**
29
+ * Pixel ratio.
30
+ */
31
+ pixelRatio: number;
32
+ /**
33
+ * Gutter of the source tiles.
34
+ */
35
+ gutter: number;
36
+ /**
37
+ * Function returning source tiles (z, x, y, pixelRatio).
38
+ */
39
+ getTileFunction: TileGetter;
40
+ /**
41
+ * Use interpolated values when resampling. By default,
42
+ * the nearest neighbor is used when resampling.
43
+ */
44
+ interpolate?: boolean | undefined;
45
+ /**
46
+ * Acceptable reprojection error (in px).
47
+ */
48
+ errorThreshold?: number | undefined;
49
+ /**
50
+ * A duration for tile opacity
51
+ * transitions in milliseconds. A duration of 0 disables the opacity transition.
52
+ */
53
+ transition?: number | undefined;
54
+ };
3
55
  /**
4
- * @typedef {function(number, number, number, number) : import("../DataTile.js").default} FunctionType
56
+ * @typedef {function(number, number, number, number) : import("../DataTile.js").default} TileGetter
57
+ */
58
+ /**
59
+ * @typedef {Object} Options
60
+ * @property {import("../proj/Projection.js").default} sourceProj Source projection.
61
+ * @property {import("../tilegrid/TileGrid.js").default} sourceTileGrid Source tile grid.
62
+ * @property {import("../proj/Projection.js").default} targetProj Target projection.
63
+ * @property {import("../tilegrid/TileGrid.js").default} targetTileGrid Target tile grid.
64
+ * @property {import("../tilecoord.js").TileCoord} tileCoord Coordinate of the tile.
65
+ * @property {import("../tilecoord.js").TileCoord} [wrappedTileCoord] Coordinate of the tile wrapped in X.
66
+ * @property {number} pixelRatio Pixel ratio.
67
+ * @property {number} gutter Gutter of the source tiles.
68
+ * @property {TileGetter} getTileFunction Function returning source tiles (z, x, y, pixelRatio).
69
+ * @property {boolean} [interpolate=false] Use interpolated values when resampling. By default,
70
+ * the nearest neighbor is used when resampling.
71
+ * @property {number} [errorThreshold] Acceptable reprojection error (in px).
72
+ * @property {number} [transition=250] A duration for tile opacity
73
+ * transitions in milliseconds. A duration of 0 disables the opacity transition.
5
74
  */
6
75
  /**
7
76
  * @classdesc
@@ -11,20 +80,9 @@ export type FunctionType = (arg0: number, arg1: number, arg2: number, arg3: numb
11
80
  */
12
81
  declare class ReprojDataTile extends DataTile {
13
82
  /**
14
- * @param {import("../proj/Projection.js").default} sourceProj Source projection.
15
- * @param {import("../tilegrid/TileGrid.js").default} sourceTileGrid Source tile grid.
16
- * @param {import("../proj/Projection.js").default} targetProj Target projection.
17
- * @param {import("../tilegrid/TileGrid.js").default} targetTileGrid Target tile grid.
18
- * @param {import("../tilecoord.js").TileCoord} tileCoord Coordinate of the tile.
19
- * @param {import("../tilecoord.js").TileCoord} wrappedTileCoord Coordinate of the tile wrapped in X.
20
- * @param {number} pixelRatio Pixel ratio.
21
- * @param {number} gutter Gutter of the source tiles.
22
- * @param {FunctionType} getTileFunction
23
- * Function returning source tiles (z, x, y, pixelRatio).
24
- * @param {boolean} interpolate Use linear interpolation when resampling.
25
- * @param {number} [errorThreshold] Acceptable reprojection error (in px).
26
- */
27
- constructor(sourceProj: import("../proj/Projection.js").default, sourceTileGrid: import("../tilegrid/TileGrid.js").default, targetProj: import("../proj/Projection.js").default, targetTileGrid: import("../tilegrid/TileGrid.js").default, tileCoord: import("../tilecoord.js").TileCoord, wrappedTileCoord: import("../tilecoord.js").TileCoord, pixelRatio: number, gutter: number, getTileFunction: FunctionType, interpolate: boolean, errorThreshold?: number | undefined);
83
+ * @param {Options} options Tile options.
84
+ */
85
+ constructor(options: Options);
28
86
  /**
29
87
  * @private
30
88
  * @type {number}
@@ -67,7 +125,7 @@ declare class ReprojDataTile extends DataTile {
67
125
  private wrappedTileCoord_;
68
126
  /**
69
127
  * @private
70
- * @type {!Array<import("../Tile.js").default>}
128
+ * @type {!Array<DataTile>}
71
129
  */
72
130
  private sourceTiles_;
73
131
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"DataTile.d.ts","sourceRoot":"","sources":["DataTile.js"],"names":[],"mappings":";kCAqBsB,MAAM,QAAE,MAAM,QAAE,MAAM,QAAE,MAAM,KAAI,OAAO,gBAAgB,EAAE,OAAO;AADxF;;GAEG;AAEH;;;;;GAKG;AACH;IACE;;;;;;;;;;;;;OAaG;IACH,wBAbW,OAAO,uBAAuB,EAAE,OAAO,kBACvC,OAAO,yBAAyB,EAAE,OAAO,cACzC,OAAO,uBAAuB,EAAE,OAAO,kBACvC,OAAO,yBAAyB,EAAE,OAAO,aACzC,OAAO,iBAAiB,EAAE,SAAS,oBACnC,OAAO,iBAAiB,EAAE,SAAS,cACnC,MAAM,UACN,MAAM,mBACN,YAAY,eAEZ,OAAO,uCAuMjB;IA7KC;;;OAGG;IACH,oBAA6B;IAE7B;;;OAGG;IACH,gBAAqB;IAErB;;;OAGG;IACH,oBAAuB;IAEvB;;;OAGG;IACH,qBAAwB;IAExB;;;OAGG;IACH,oBAA4B;IAE5B;;;OAGG;IACH,wBAAqC;IAErC;;;OAGG;IACH,wBAAqC;IAErC;;;OAGG;IACH,0BAAwE;IAExE;;;OAGG;IACH,qBAAsB;IAEtB;;;OAGG;IACH,6BAAgC;IAEhC;;;OAGG;IACH,iBAAiB;IAiDjB;;;OAGG;IACH,uBAOC;IA2EH;;OAEG;IACH,mBA6JC;IA0DD;;OAEG;IACH,yBAGC;CACF"}
1
+ {"version":3,"file":"DataTile.d.ts","sourceRoot":"","sources":["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