ol 9.2.5-dev.1718652616882 → 9.2.5-dev.1718925536936

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 (143) hide show
  1. package/DataTile.d.ts +14 -0
  2. package/DataTile.d.ts.map +1 -1
  3. package/DataTile.js +24 -1
  4. package/Map.d.ts +1 -1
  5. package/Map.d.ts.map +1 -1
  6. package/Map.js +9 -10
  7. package/Tile.d.ts +2 -22
  8. package/Tile.d.ts.map +1 -1
  9. package/Tile.js +2 -77
  10. package/TileQueue.d.ts.map +1 -1
  11. package/TileQueue.js +6 -4
  12. package/VectorRenderTile.d.ts +8 -13
  13. package/VectorRenderTile.d.ts.map +1 -1
  14. package/VectorRenderTile.js +17 -24
  15. package/VectorTile.d.ts +5 -5
  16. package/VectorTile.d.ts.map +1 -1
  17. package/VectorTile.js +3 -3
  18. package/dist/ol.d.ts +10 -2
  19. package/dist/ol.d.ts.map +1 -1
  20. package/dist/ol.js +2 -2
  21. package/dist/ol.js.map +1 -1
  22. package/featureloader.d.ts +4 -4
  23. package/featureloader.d.ts.map +1 -1
  24. package/featureloader.js +2 -2
  25. package/format/EsriJSON.d.ts +1 -1
  26. package/format/Feature.d.ts +8 -8
  27. package/format/Feature.d.ts.map +1 -1
  28. package/format/Feature.js +7 -5
  29. package/format/GeoJSON.d.ts +9 -9
  30. package/format/GeoJSON.d.ts.map +1 -1
  31. package/format/GeoJSON.js +10 -14
  32. package/format/JSONFeature.d.ts +7 -7
  33. package/format/JSONFeature.d.ts.map +1 -1
  34. package/format/JSONFeature.js +9 -11
  35. package/format/MVT.d.ts +12 -12
  36. package/format/MVT.d.ts.map +1 -1
  37. package/format/MVT.js +12 -14
  38. package/format/TextFeature.d.ts +1 -1
  39. package/format/TopoJSON.d.ts +1 -1
  40. package/format/WKB.d.ts +1 -1
  41. package/format/XMLFeature.d.ts +1 -1
  42. package/interaction/DragAndDrop.d.ts +1 -1
  43. package/layer/BaseTile.d.ts +23 -6
  44. package/layer/BaseTile.d.ts.map +1 -1
  45. package/layer/BaseTile.js +22 -3
  46. package/layer/Tile.d.ts +1 -1
  47. package/layer/Tile.d.ts.map +1 -1
  48. package/layer/Tile.js +3 -1
  49. package/layer/VectorTile.d.ts +19 -6
  50. package/layer/VectorTile.d.ts.map +1 -1
  51. package/layer/VectorTile.js +20 -8
  52. package/layer/WebGLTile.d.ts +5 -10
  53. package/layer/WebGLTile.d.ts.map +1 -1
  54. package/layer/WebGLTile.js +3 -12
  55. package/package.json +1 -1
  56. package/renderer/Layer.d.ts +22 -25
  57. package/renderer/Layer.d.ts.map +1 -1
  58. package/renderer/Layer.js +36 -36
  59. package/renderer/canvas/TileLayer.d.ts +100 -38
  60. package/renderer/canvas/TileLayer.d.ts.map +1 -1
  61. package/renderer/canvas/TileLayer.js +542 -329
  62. package/renderer/canvas/VectorTileLayer.d.ts +11 -11
  63. package/renderer/canvas/VectorTileLayer.d.ts.map +1 -1
  64. package/renderer/canvas/VectorTileLayer.js +33 -46
  65. package/renderer/webgl/TileLayerBase.d.ts +0 -6
  66. package/renderer/webgl/TileLayerBase.d.ts.map +1 -1
  67. package/renderer/webgl/TileLayerBase.js +61 -78
  68. package/reproj/DataTile.d.ts.map +1 -1
  69. package/reproj/DataTile.js +103 -100
  70. package/source/BingMaps.d.ts +2 -2
  71. package/source/BingMaps.d.ts.map +1 -1
  72. package/source/BingMaps.js +1 -2
  73. package/source/CartoDB.d.ts +2 -2
  74. package/source/CartoDB.js +1 -1
  75. package/source/DataTile.d.ts +49 -20
  76. package/source/DataTile.d.ts.map +1 -1
  77. package/source/DataTile.js +56 -9
  78. package/source/GeoTIFF.d.ts +2 -6
  79. package/source/GeoTIFF.d.ts.map +1 -1
  80. package/source/GeoTIFF.js +3 -3
  81. package/source/Google.d.ts.map +1 -1
  82. package/source/Google.js +0 -2
  83. package/source/IIIF.d.ts +1 -1
  84. package/source/IIIF.js +1 -1
  85. package/source/ImageTile.d.ts +102 -0
  86. package/source/ImageTile.d.ts.map +1 -0
  87. package/source/ImageTile.js +208 -0
  88. package/source/OGCMapTile.d.ts +2 -2
  89. package/source/OGCMapTile.js +1 -1
  90. package/source/OGCVectorTile.d.ts +4 -4
  91. package/source/OGCVectorTile.js +2 -2
  92. package/source/OSM.d.ts +2 -7
  93. package/source/OSM.d.ts.map +1 -1
  94. package/source/OSM.js +1 -3
  95. package/source/StadiaMaps.d.ts +2 -2
  96. package/source/StadiaMaps.d.ts.map +1 -1
  97. package/source/StadiaMaps.js +2 -18
  98. package/source/Tile.d.ts +7 -36
  99. package/source/Tile.d.ts.map +1 -1
  100. package/source/Tile.js +5 -69
  101. package/source/TileArcGISRest.d.ts +2 -2
  102. package/source/TileArcGISRest.js +1 -1
  103. package/source/TileDebug.d.ts.map +1 -1
  104. package/source/TileDebug.js +0 -1
  105. package/source/TileImage.d.ts +7 -11
  106. package/source/TileImage.d.ts.map +1 -1
  107. package/source/TileImage.js +11 -43
  108. package/source/TileJSON.d.ts +2 -2
  109. package/source/TileJSON.js +1 -1
  110. package/source/TileWMS.d.ts +2 -2
  111. package/source/TileWMS.d.ts.map +1 -1
  112. package/source/TileWMS.js +1 -4
  113. package/source/UTFGrid.d.ts +1 -1
  114. package/source/UrlTile.d.ts +14 -12
  115. package/source/UrlTile.d.ts.map +1 -1
  116. package/source/UrlTile.js +12 -7
  117. package/source/Vector.d.ts +5 -5
  118. package/source/Vector.d.ts.map +1 -1
  119. package/source/Vector.js +3 -3
  120. package/source/VectorTile.d.ts +4 -17
  121. package/source/VectorTile.d.ts.map +1 -1
  122. package/source/VectorTile.js +10 -85
  123. package/source/WMTS.d.ts +2 -2
  124. package/source/WMTS.js +3 -3
  125. package/source/XYZ.d.ts +14 -17
  126. package/source/XYZ.d.ts.map +1 -1
  127. package/source/XYZ.js +7 -8
  128. package/source/Zoomify.d.ts +2 -2
  129. package/source/Zoomify.d.ts.map +1 -1
  130. package/source/Zoomify.js +3 -2
  131. package/source.d.ts +1 -0
  132. package/source.d.ts.map +1 -1
  133. package/source.js +1 -0
  134. package/tilecoord.d.ts +7 -0
  135. package/tilecoord.d.ts.map +1 -1
  136. package/tilecoord.js +11 -1
  137. package/tileurlfunction.d.ts +3 -7
  138. package/tileurlfunction.d.ts.map +1 -1
  139. package/tileurlfunction.js +14 -47
  140. package/uri.d.ts +23 -3
  141. package/uri.d.ts.map +1 -1
  142. package/uri.js +75 -0
  143. package/util.js +1 -1
@@ -8,8 +8,9 @@ export default CanvasVectorTileLayerRenderer;
8
8
  declare class CanvasVectorTileLayerRenderer extends CanvasTileLayerRenderer<import("../../layer/VectorTile.js").default<import("../../source/VectorTile.js").default<import("../../Feature.js").FeatureLike>, import("../../Feature.js").FeatureLike>> {
9
9
  /**
10
10
  * @param {import("../../layer/VectorTile.js").default} layer VectorTile layer.
11
+ * @param {import("./TileLayer.js").Options} options Options.
11
12
  */
12
- constructor(layer: import("../../layer/VectorTile.js").default);
13
+ constructor(layer: import("../../layer/VectorTile.js").default, options: import("./TileLayer.js").Options);
13
14
  /** @private */
14
15
  private boundHandleStyleImageChange_;
15
16
  /**
@@ -44,16 +45,15 @@ declare class CanvasVectorTileLayerRenderer extends CanvasTileLayerRenderer<impo
44
45
  private tileClipContexts_;
45
46
  /**
46
47
  * @param {import("../../VectorRenderTile.js").default} tile Tile.
47
- * @param {number} pixelRatio Pixel ratio.
48
- * @param {import("../../proj/Projection").default} projection Projection.
49
- * @return {boolean|undefined} Tile needs to be rendered.
50
- */
51
- prepareTile(tile: import("../../VectorRenderTile.js").default, pixelRatio: number, projection: import("../../proj/Projection").default): boolean | undefined;
52
- /**
53
- * @param {import("../../VectorRenderTile.js").default} tile Tile.
54
- * @return {boolean} Tile is drawable.
55
- */
56
- isDrawableTile(tile: import("../../VectorRenderTile.js").default): boolean;
48
+ * @param {import("../../Map.js").FrameState} frameState Frame state.
49
+ * @param {number} x Left of the tile.
50
+ * @param {number} y Top of the tile.
51
+ * @param {number} w Width of the tile.
52
+ * @param {number} h Height of the tile.
53
+ * @param {number} gutter Tile gutter.
54
+ * @param {boolean} transition Apply an alpha transition.
55
+ */
56
+ drawTile(tile: import("../../VectorRenderTile.js").default, frameState: import("../../Map.js").FrameState, x: number, y: number, w: number, h: number, gutter: number, transition: boolean): void;
57
57
  /**
58
58
  * @inheritDoc
59
59
  */
@@ -1 +1 @@
1
- {"version":3,"file":"VectorTileLayer.d.ts","sourceRoot":"","sources":["VectorTileLayer.js"],"names":[],"mappings":";AA4DA;;;;;GAKG;AACH;IACE;;OAEG;IACH,mBAFW,OAAO,2BAA2B,EAAE,OAAO,EA2CrD;IAtCC,eAAe;IACf,qCAA2E;IAE3E;;;OAGG;IACH,+BAA2B;IAE3B;;;OAGG;IACH,4CAA+C;IAE/C;;;OAGG;IACH,0BAAsB;IAEtB;;;OAGG;IACH,yBAAyB;IAEzB;;;OAGG;IACH,sBAAsC;IAEtC;;;OAGG;IACH,0BAA6B;IAG/B;;;;;OAKG;IACH,kBALW,OAAO,2BAA2B,EAAE,OAAO,cAC3C,MAAM,cACN,OAAO,uBAAuB,EAAE,OAAO,GACtC,OAAO,GAAC,SAAS,CAY5B;IAkCD;;;OAGG;IACH,qBAHW,OAAO,2BAA2B,EAAE,OAAO,GAC1C,OAAO,CAUlB;IAED;;OAEG;IACH,6BAEC;IAgBD;;;;;OAKG;IACH,6BAqHC;IAyND;;;;OAIG;IACH,gCAEC;IAED;;;;OAIG;IACH,4BAHW,OAAO,cAAc,EAAE,UAAU,cACjC,OAAO,sBAAsB,EAAE,KAAK,QAiC9C;IA0DD,6DA+BC;IAkID;;;;;;;;OAQG;IACH,uBARW,OAAO,kBAAkB,EAAE,WAAW,oBACtC,MAAM,UACN,OAAO,sBAAsB,EAAE,OAAO,GAAC,MAAM,OAAO,sBAAsB,EAAE,OAAO,CAAC,gBACpF,OAAO,qCAAqC,EAAE,OAAO,gEAGpD,OAAO,CAyClB;IAED;;;;OAIG;IACH,8BAcC;IAED;;;;OAIG;IACH,yBAwDC;CACF;oCAh6BmC,gBAAgB"}
1
+ {"version":3,"file":"VectorTileLayer.d.ts","sourceRoot":"","sources":["VectorTileLayer.js"],"names":[],"mappings":";AA4DA;;;;;GAKG;AACH;IACE;;;OAGG;IACH,mBAHW,OAAO,2BAA2B,EAAE,OAAO,WAC3C,OAAO,gBAAgB,EAAE,OAAO,EA2C1C;IAtCC,eAAe;IACf,qCAA2E;IAE3E;;;OAGG;IACH,+BAA2B;IAE3B;;;OAGG;IACH,4CAA+C;IAE/C;;;OAGG;IACH,0BAAsB;IAEtB;;;OAGG;IACH,yBAAyB;IAEzB;;;OAGG;IACH,sBAAsC;IAEtC;;;OAGG;IACH,0BAA6B;IAG/B;;;;;;;;;OASG;IACH,eATW,OAAO,2BAA2B,EAAE,OAAO,cAC3C,OAAO,cAAc,EAAE,UAAU,KACjC,MAAM,KACN,MAAM,KACN,MAAM,KACN,MAAM,UACN,MAAM,cACN,OAAO,QAYjB;IA6BD;;OAEG;IACH,6BAEC;IAgBD;;;;;OAKG;IACH,6BAqHC;IAyND;;;;OAIG;IACH,gCAEC;IAED;;;;OAIG;IACH,4BAHW,OAAO,cAAc,EAAE,UAAU,cACjC,OAAO,sBAAsB,EAAE,KAAK,QAiC9C;IA0DD,6DAgCC;IAkID;;;;;;;;OAQG;IACH,uBARW,OAAO,kBAAkB,EAAE,WAAW,oBACtC,MAAM,UACN,OAAO,sBAAsB,EAAE,OAAO,GAAC,MAAM,OAAO,sBAAsB,EAAE,OAAO,CAAC,gBACpF,OAAO,qCAAqC,EAAE,OAAO,gEAGpD,OAAO,CAyClB;IAED;;;;OAIG;IACH,8BAcC;IAED;;;;OAIG;IACH,yBAwDC;CACF;oCAn5BmC,gBAAgB"}
@@ -67,9 +67,10 @@ const VECTOR_REPLAYS = {
67
67
  class CanvasVectorTileLayerRenderer extends CanvasTileLayerRenderer {
68
68
  /**
69
69
  * @param {import("../../layer/VectorTile.js").default} layer VectorTile layer.
70
+ * @param {import("./TileLayer.js").Options} options Options.
70
71
  */
71
- constructor(layer) {
72
- super(layer);
72
+ constructor(layer, options) {
73
+ super(layer, options);
73
74
 
74
75
  /** @private */
75
76
  this.boundHandleStyleImageChange_ = this.handleStyleImageChange_.bind(this);
@@ -113,20 +114,24 @@ class CanvasVectorTileLayerRenderer extends CanvasTileLayerRenderer {
113
114
 
114
115
  /**
115
116
  * @param {import("../../VectorRenderTile.js").default} tile Tile.
116
- * @param {number} pixelRatio Pixel ratio.
117
- * @param {import("../../proj/Projection").default} projection Projection.
118
- * @return {boolean|undefined} Tile needs to be rendered.
117
+ * @param {import("../../Map.js").FrameState} frameState Frame state.
118
+ * @param {number} x Left of the tile.
119
+ * @param {number} y Top of the tile.
120
+ * @param {number} w Width of the tile.
121
+ * @param {number} h Height of the tile.
122
+ * @param {number} gutter Tile gutter.
123
+ * @param {boolean} transition Apply an alpha transition.
119
124
  */
120
- prepareTile(tile, pixelRatio, projection) {
121
- let render;
122
- const state = tile.getState();
123
- if (state === TileState.LOADED || state === TileState.ERROR) {
124
- this.updateExecutorGroup_(tile, pixelRatio, projection);
125
- if (this.tileImageNeedsRender_(tile)) {
126
- render = true;
127
- }
125
+ drawTile(tile, frameState, x, y, w, h, gutter, transition) {
126
+ this.updateExecutorGroup_(
127
+ tile,
128
+ frameState.pixelRatio,
129
+ frameState.viewState.projection,
130
+ );
131
+ if (this.tileImageNeedsRender_(tile)) {
132
+ this.renderTileImage_(tile, frameState);
128
133
  }
129
- return render;
134
+ super.drawTile(tile, frameState, x, y, w, h, gutter, transition);
130
135
  }
131
136
 
132
137
  /**
@@ -134,15 +139,18 @@ class CanvasVectorTileLayerRenderer extends CanvasTileLayerRenderer {
134
139
  * @param {number} x Tile coordinate x.
135
140
  * @param {number} y Tile coordinate y.
136
141
  * @param {import("../../Map.js").FrameState} frameState Frame state.
137
- * @return {!import("../../Tile.js").default} Tile.
142
+ * @return {import("../../Tile.js").default|null} Tile (or null if outside source extent).
138
143
  */
139
144
  getTile(z, x, y, frameState) {
140
- const pixelRatio = frameState.pixelRatio;
145
+ const tile = /** @type {import("../../VectorRenderTile.js").default} */ (
146
+ this.getOrCreateTile(z, x, y, frameState)
147
+ );
148
+ if (!tile) {
149
+ return null;
150
+ }
151
+
141
152
  const viewState = frameState.viewState;
142
153
  const resolution = viewState.resolution;
143
- const projection = viewState.projection;
144
- const layer = this.getLayer();
145
- const tile = layer.getSource().getTile(z, x, y, pixelRatio, projection);
146
154
  const viewHints = frameState.viewHints;
147
155
  const hifi = !(
148
156
  viewHints[ViewHint.ANIMATING] || viewHints[ViewHint.INTERACTING]
@@ -150,29 +158,7 @@ class CanvasVectorTileLayerRenderer extends CanvasTileLayerRenderer {
150
158
  if (hifi || !tile.wantedResolution) {
151
159
  tile.wantedResolution = resolution;
152
160
  }
153
- const render = this.prepareTile(tile, pixelRatio, projection);
154
- if (
155
- render &&
156
- (hifi || Date.now() - frameState.time < 8) &&
157
- layer.getRenderMode() !== 'vector'
158
- ) {
159
- this.renderTileImage_(tile, frameState);
160
- }
161
- return super.getTile(z, x, y, frameState);
162
- }
163
-
164
- /**
165
- * @param {import("../../VectorRenderTile.js").default} tile Tile.
166
- * @return {boolean} Tile is drawable.
167
- */
168
- isDrawableTile(tile) {
169
- const layer = this.getLayer();
170
- return (
171
- super.isDrawableTile(tile) &&
172
- (layer.getRenderMode() === 'vector'
173
- ? getUid(layer) in tile.executorGroups
174
- : tile.hasContext(layer))
175
- );
161
+ return tile;
176
162
  }
177
163
 
178
164
  /**
@@ -243,7 +229,7 @@ class CanvasVectorTileLayerRenderer extends CanvasTileLayerRenderer {
243
229
  const builderExtent = buffer(
244
230
  sharedExtent,
245
231
  layer.getRenderBuffer() * resolution,
246
- this.tmpExtent,
232
+ this.tempExtent,
247
233
  );
248
234
  const bufferedExtent = equals(sourceTileExtent, sharedExtent)
249
235
  ? null
@@ -656,7 +642,8 @@ class CanvasVectorTileLayerRenderer extends CanvasTileLayerRenderer {
656
642
  const tileCoord = tile.tileCoord;
657
643
  const tileExtent = tileGrid.getTileCoordExtent(tile.wrappedTileCoord);
658
644
  const worldOffset =
659
- tileGrid.getTileCoordExtent(tileCoord, this.tmpExtent)[0] - tileExtent[0];
645
+ tileGrid.getTileCoordExtent(tileCoord, this.tempExtent)[0] -
646
+ tileExtent[0];
660
647
  const transform = multiply(
661
648
  scale(this.inversePixelTransform.slice(), 1 / pixelRatio, 1 / pixelRatio),
662
649
  this.getRenderTransform(
@@ -896,7 +883,7 @@ class CanvasVectorTileLayerRenderer extends CanvasTileLayerRenderer {
896
883
  const renderPixelRatio =
897
884
  (frameState.pixelRatio / tile.wantedResolution) * tileResolution;
898
885
  const resolution = tileGrid.getResolution(z);
899
- const context = tile.getContext(layer);
886
+ const context = tile.getContext();
900
887
 
901
888
  // Increase tile size when overzooming for low pixel ratio, to avoid blurry tiles
902
889
  pixelRatio = Math.round(
@@ -911,7 +898,7 @@ class CanvasVectorTileLayerRenderer extends CanvasTileLayerRenderer {
911
898
  scaleTransform(canvasTransform, renderScale, renderScale);
912
899
  context.setTransform.apply(context, canvasTransform);
913
900
  }
914
- const tileExtent = tileGrid.getTileCoordExtent(tileCoord, this.tmpExtent);
901
+ const tileExtent = tileGrid.getTileCoordExtent(tileCoord, this.tempExtent);
915
902
  const pixelScale = renderPixelRatio / resolution;
916
903
  const transform = resetTransform(this.tmpTransform_);
917
904
  scaleTransform(transform, pixelScale, -pixelScale);
@@ -129,12 +129,6 @@ declare class WebGLBaseTileLayerRenderer<LayerType extends import("../../layer/B
129
129
  * @param {Options} options Options.
130
130
  */
131
131
  reset(options: Options): void;
132
- /**
133
- * @param {TileType} tile Tile.
134
- * @return {boolean} Tile is drawable.
135
- * @private
136
- */
137
- private isDrawableTile_;
138
132
  /**
139
133
  * @abstract
140
134
  * @param {import("../../webgl/BaseTileRepresentation.js").TileRepresentationOptions<TileType>} options tile representation options
@@ -1 +1 @@
1
- {"version":3,"file":"TileLayerBase.d.ts","sourceRoot":"","sources":["TileLayerBase.js"],"names":[],"mappings":"AAuDA;;GAEG;AACH;;;;GAIG;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FU,OAAO,cAAc,EAAE,UAAU,GAAC,IAAI,CAE1B;IAEtB;;;OAGG;IACH,oBAA4B;IAG9B;;OAEG;IACH,eAFW,OAAO,QAMjB;IA2BD;;;;;OAKG;IACH,4CAJW,OAAO,uCAAuC,EAAE,yBAAyB,CAAC,QAAQ,CAAC,GAClF,kBAAkB,CAK7B;IAED;;;;;;OAMG;IACH,yBANW,OAAO,cAAc,EAAE,UAAU,UACjC,OAAO,iBAAiB,EAAE,MAAM,YAChC,MAAM,4BACN,wBAAwB,WACxB,MAAM,QAqHhB;IAED;;;;OAIG;IACH,wCAJW,OAAO,cAAc,EAAE,UAAU,kBACjC,OAAO,QAKjB;IAED;;;;OAIG;IACH,4CAJW,OAAO,cAAc,EAAE,UAAU,GAChC,OAAO,CAKlB;IAED;;;;;;;;;;;;;OAaG;IACH,yCAbW,kBAAkB,iBAClB,OAAO,oBAAoB,EAAE,SAAS,cACtC,OAAO,cAAc,EAAE,UAAU,gBACjC,OAAO,iBAAiB,EAAE,MAAM,kBAChC,MAAM,YACN,OAAO,eAAe,EAAE,IAAI,cAC5B,OAAO,qBAAqB,EAAE,UAAU,cACxC,OAAO,iBAAiB,EAAE,MAAM,SAChC,MAAM,UACN,MAAM,SACN,MAAM,QAeb;IAEJ;;;;;;OAMG;IACH,6CANW,kBAAkB,SAClB,MAAM,UACN,OAAO,iBAAiB,EAAE,MAAM,SAChC,MAAM,QAG0C;IAE3D,iIAuEC;IAED;;;;OAIG;IACH,wBAHW,OAAO,cAAc,EAAE,UAAU,GAChC,WAAW,CAwNtB;IAED;;;;;;;;;;OAUG;IACH,sBAsCC;IAED,mBAMC;CAiBF;+BAlyB8B,YAAY"}
@@ -226,22 +226,6 @@ class WebGLBaseTileLayerRenderer extends WebGLLayerRenderer {
226
226
  });
227
227
  }
228
228
 
229
- /**
230
- * @param {TileType} tile Tile.
231
- * @return {boolean} Tile is drawable.
232
- * @private
233
- */
234
- isDrawableTile_(tile) {
235
- const tileLayer = this.getLayer();
236
- const tileState = tile.getState();
237
- const useInterimTilesOnError = tileLayer.getUseInterimTilesOnError();
238
- return (
239
- tileState == TileState.LOADED ||
240
- tileState == TileState.EMPTY ||
241
- (tileState == TileState.ERROR && !useInterimTilesOnError)
242
- );
243
- }
244
-
245
229
  /**
246
230
  * Determine whether renderFrame should be called.
247
231
  * @param {import("../../Map.js").FrameState} frameState Frame state.
@@ -356,6 +340,9 @@ class WebGLBaseTileLayerRenderer extends WebGLLayerRenderer {
356
340
  frameState.pixelRatio,
357
341
  viewState.projection,
358
342
  );
343
+ if (!tile) {
344
+ continue;
345
+ }
359
346
  }
360
347
 
361
348
  if (lookupHasTile(tileRepresentationLookup, tile)) {
@@ -371,14 +358,7 @@ class WebGLBaseTileLayerRenderer extends WebGLLayerRenderer {
371
358
  });
372
359
  tileRepresentationCache.set(cacheKey, tileRepresentation);
373
360
  } else {
374
- if (this.isDrawableTile_(tile)) {
375
- tileRepresentation.setTile(tile);
376
- } else {
377
- const interimTile = /** @type {TileType} */ (
378
- tile.getInterimTile()
379
- );
380
- tileRepresentation.setTile(interimTile);
381
- }
361
+ tileRepresentation.setTile(tile);
382
362
  }
383
363
 
384
364
  addTileRepresentationToLookup(
@@ -601,60 +581,62 @@ class WebGLBaseTileLayerRenderer extends WebGLLayerRenderer {
601
581
  const time = frameState.time;
602
582
  let blend = false;
603
583
 
604
- // look for cached tiles to use if a target tile is not ready
605
- for (const tileRepresentation of tileRepresentationLookup
606
- .representationsByZ[z]) {
607
- const tile = tileRepresentation.tile;
608
- if (
609
- (tile instanceof ReprojTile || tile instanceof ReprojDataTile) &&
610
- tile.getState() === TileState.EMPTY
611
- ) {
612
- continue;
613
- }
614
- const tileCoord = tile.tileCoord;
584
+ const representationsByZ = tileRepresentationLookup.representationsByZ;
615
585
 
616
- if (tileRepresentation.ready) {
617
- const alpha = tile.getAlpha(uid, time);
618
- if (alpha === 1) {
619
- // no need to look for alt tiles
620
- tile.endTransition(uid);
586
+ // look for cached tiles to use if a target tile is not ready
587
+ if (z in representationsByZ) {
588
+ for (const tileRepresentation of representationsByZ[z]) {
589
+ const tile = tileRepresentation.tile;
590
+ if (
591
+ (tile instanceof ReprojTile || tile instanceof ReprojDataTile) &&
592
+ tile.getState() === TileState.EMPTY
593
+ ) {
621
594
  continue;
622
595
  }
623
- blend = true;
624
- const tileCoordKey = getTileCoordKey(tileCoord);
625
- alphaLookup[tileCoordKey] = alpha;
626
- }
627
- this.renderComplete = false;
628
-
629
- // first look for child tiles (at z + 1)
630
- const coveredByChildren = this.findAltTiles_(
631
- tileGrid,
632
- tileCoord,
633
- z + 1,
634
- tileRepresentationLookup,
635
- );
596
+ const tileCoord = tile.tileCoord;
636
597
 
637
- if (coveredByChildren) {
638
- continue;
639
- }
598
+ if (tileRepresentation.ready) {
599
+ const alpha = tile.getAlpha(uid, time);
600
+ if (alpha === 1) {
601
+ // no need to look for alt tiles
602
+ tile.endTransition(uid);
603
+ continue;
604
+ }
605
+ blend = true;
606
+ const tileCoordKey = getTileCoordKey(tileCoord);
607
+ alphaLookup[tileCoordKey] = alpha;
608
+ }
609
+ this.renderComplete = false;
640
610
 
641
- // next look for parent tiles
642
- const minZoom = tileGrid.getMinZoom();
643
- for (let parentZ = z - 1; parentZ >= minZoom; --parentZ) {
644
- const coveredByParent = this.findAltTiles_(
611
+ // first look for child tiles (at z + 1)
612
+ const coveredByChildren = this.findAltTiles_(
645
613
  tileGrid,
646
614
  tileCoord,
647
- parentZ,
615
+ z + 1,
648
616
  tileRepresentationLookup,
649
617
  );
650
618
 
651
- if (coveredByParent) {
652
- break;
619
+ if (coveredByChildren) {
620
+ continue;
621
+ }
622
+
623
+ // next look for parent tiles
624
+ const minZoom = tileGrid.getMinZoom();
625
+ for (let parentZ = z - 1; parentZ >= minZoom; --parentZ) {
626
+ const coveredByParent = this.findAltTiles_(
627
+ tileGrid,
628
+ tileCoord,
629
+ parentZ,
630
+ tileRepresentationLookup,
631
+ );
632
+
633
+ if (coveredByParent) {
634
+ break;
635
+ }
653
636
  }
654
637
  }
655
638
  }
656
639
 
657
- const representationsByZ = tileRepresentationLookup.representationsByZ;
658
640
  const zs = Object.keys(representationsByZ).map(Number).sort(descending);
659
641
 
660
642
  const renderTileMask = this.beforeTilesMaskRender(frameState);
@@ -703,19 +685,21 @@ class WebGLBaseTileLayerRenderer extends WebGLLayerRenderer {
703
685
  }
704
686
  }
705
687
 
706
- for (const tileRepresentation of representationsByZ[z]) {
707
- const tileCoord = tileRepresentation.tile.tileCoord;
708
- const tileCoordKey = getTileCoordKey(tileCoord);
709
- if (tileCoordKey in alphaLookup) {
710
- this.drawTile_(
711
- frameState,
712
- tileRepresentation,
713
- z,
714
- gutter,
715
- extent,
716
- alphaLookup,
717
- tileGrid,
718
- );
688
+ if (z in representationsByZ) {
689
+ for (const tileRepresentation of representationsByZ[z]) {
690
+ const tileCoord = tileRepresentation.tile.tileCoord;
691
+ const tileCoordKey = getTileCoordKey(tileCoord);
692
+ if (tileCoordKey in alphaLookup) {
693
+ this.drawTile_(
694
+ frameState,
695
+ tileRepresentation,
696
+ z,
697
+ gutter,
698
+ extent,
699
+ alphaLookup,
700
+ tileGrid,
701
+ );
702
+ }
719
703
  }
720
704
  }
721
705
 
@@ -741,7 +725,6 @@ class WebGLBaseTileLayerRenderer extends WebGLLayerRenderer {
741
725
  * @param {import("../../Map.js").FrameState} frameState Frame state.
742
726
  */
743
727
  const postRenderFunction = function (map, frameState) {
744
- tileSource.updateCacheSize(0.1, frameState.viewState.projection);
745
728
  tileSource.expireCache(frameState.viewState.projection, empty);
746
729
  };
747
730
 
@@ -1 +1 @@
1
- {"version":3,"file":"DataTile.d.ts","sourceRoot":"","sources":["DataTile.js"],"names":[],"mappings":";gCAoBsB,MAAM,QAAE,MAAM,QAAE,MAAM,QAAE,MAAM,KAAI,OAAO,gBAAgB,EAAE,OAAO;;;;;UAK1E,QAAQ;;;;YACR,MAAM;;;;;;gBAKN,OAAO,uBAAuB,EAAE,OAAO;;;;oBACvC,OAAO,yBAAyB,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;;;GAIG;AAEH;;;;;;;;;;;;;;;;GAgBG;AAEH;;;;;GAKG;AACH;IACE;;OAEG;IACH,qBAFW,OAAO,EAyNjB;IA/MC;;;OAGG;IACH,oBAAqC;IAErC;;;OAGG;IACH,gBAA6B;IAE7B;;;OAGG;IACH,oBAAuB;IAEvB;;;OAGG;IACH,qBAAwB;IAExB;;;OAGG;IACH,oBAA4B;IAE5B;;;OAGG;IACH,wBAA6C;IAE7C;;;OAGG;IACH,wBAA6C;IAE7C;;;OAGG;IACH,0BAAsE;IAEtE;;;OAGG;IACH,qBAAsB;IAEtB;;;OAGG;IACH,6BAAgC;IAEhC;;;OAGG;IACH,iBAAiB;IAMjB;;;OAGG;IACH,oBAIwB;IAmDxB;;;OAGG;IACH,uBAOC;IA6FH;;OAEG;IACH,mBAoLC;IAyDD;;OAEG;IACH,yBAGC;CACF;qBA5hByD,gBAAgB"}
@@ -58,7 +58,7 @@ class ReprojDataTile extends DataTile {
58
58
  constructor(options) {
59
59
  super({
60
60
  tileCoord: options.tileCoord,
61
- loader: () => Promise.resolve(new Uint8Array(4)),
61
+ loader: () => Promise.resolve(new Uint8ClampedArray(4)),
62
62
  interpolate: options.interpolate,
63
63
  transition: options.transition,
64
64
  });
@@ -301,6 +301,7 @@ class ReprojDataTile extends DataTile {
301
301
  */
302
302
  reproject_() {
303
303
  const dataSources = [];
304
+ let imageLike = false;
304
305
  this.sourceTiles_.forEach((source) => {
305
306
  const tile = source.tile;
306
307
  if (!tile || tile.getState() !== TileState.LOADED) {
@@ -316,12 +317,13 @@ class ReprojDataTile extends DataTile {
316
317
  if (arrayData) {
317
318
  tileData = arrayData;
318
319
  } else {
320
+ imageLike = true;
319
321
  tileData = toArray(asImageLike(tile.getData()));
320
322
  }
321
323
  const pixelSize = [size[0] + 2 * gutter, size[1] + 2 * gutter];
322
324
  const isFloat = tileData instanceof Float32Array;
323
325
  const pixelCount = pixelSize[0] * pixelSize[1];
324
- const DataType = isFloat ? Float32Array : Uint8Array;
326
+ const DataType = isFloat ? Float32Array : Uint8ClampedArray;
325
327
  const tileDataR = new DataType(tileData.buffer);
326
328
  const bytesPerElement = DataType.BYTES_PER_ELEMENT;
327
329
  const bytesPerPixel = (bytesPerElement * tileDataR.length) / pixelCount;
@@ -354,7 +356,7 @@ class ReprojDataTile extends DataTile {
354
356
  dataSources.push({
355
357
  extent: extent,
356
358
  clipExtent: clipExtent,
357
- data: new Uint8Array(packedData.buffer),
359
+ data: new Uint8ClampedArray(packedData.buffer),
358
360
  dataType: DataType,
359
361
  bytesPerPixel: bytesPerPixel,
360
362
  pixelSize: pixelSize,
@@ -364,117 +366,118 @@ class ReprojDataTile extends DataTile {
364
366
 
365
367
  if (dataSources.length === 0) {
366
368
  this.state = TileState.ERROR;
367
- } else {
368
- const z = this.wrappedTileCoord_[0];
369
- const size = this.targetTileGrid_.getTileSize(z);
370
- const targetWidth = typeof size === 'number' ? size : size[0];
371
- const targetHeight = typeof size === 'number' ? size : size[1];
372
- const targetResolution = this.targetTileGrid_.getResolution(z);
373
- const sourceResolution = this.sourceTileGrid_.getResolution(
374
- this.sourceZ_,
375
- );
376
-
377
- const targetExtent = this.targetTileGrid_.getTileCoordExtent(
378
- this.wrappedTileCoord_,
379
- );
369
+ this.changed();
370
+ return;
371
+ }
380
372
 
381
- let dataR, dataU;
382
-
383
- const bytesPerPixel = dataSources[0].bytesPerPixel;
384
-
385
- const reprojs = Math.ceil(bytesPerPixel / 3);
386
- for (let reproj = reprojs - 1; reproj >= 0; --reproj) {
387
- const sources = [];
388
- for (let i = 0, len = dataSources.length; i < len; ++i) {
389
- const dataSource = dataSources[i];
390
- const buffer = dataSource.data;
391
- const pixelSize = dataSource.pixelSize;
392
- const width = pixelSize[0];
393
- const height = pixelSize[1];
394
- const context = createCanvasContext2D(width, height, canvasPool);
395
- const imageData = context.createImageData(width, height);
396
- const data = imageData.data;
397
- let offset = reproj * 3;
398
- for (let j = 0, len = data.length; j < len; j += 4) {
399
- data[j] = buffer[offset];
400
- data[j + 1] = buffer[offset + 1];
401
- data[j + 2] = buffer[offset + 2];
402
- data[j + 3] = 255;
403
- offset += bytesPerPixel;
404
- }
405
- context.putImageData(imageData, 0, 0);
406
- sources.push({
407
- extent: dataSource.extent,
408
- clipExtent: dataSource.clipExtent,
409
- image: context.canvas,
410
- });
411
- }
373
+ const z = this.wrappedTileCoord_[0];
374
+ const size = this.targetTileGrid_.getTileSize(z);
375
+ const targetWidth = typeof size === 'number' ? size : size[0];
376
+ const targetHeight = typeof size === 'number' ? size : size[1];
377
+ const targetResolution = this.targetTileGrid_.getResolution(z);
378
+ const sourceResolution = this.sourceTileGrid_.getResolution(this.sourceZ_);
412
379
 
413
- const canvas = renderReprojected(
414
- targetWidth,
415
- targetHeight,
416
- this.pixelRatio_,
417
- sourceResolution,
418
- this.sourceTileGrid_.getExtent(),
419
- targetResolution,
420
- targetExtent,
421
- this.triangulation_,
422
- sources,
423
- this.gutter_,
424
- false,
425
- false,
426
- false,
427
- //true,
428
- );
380
+ const targetExtent = this.targetTileGrid_.getTileCoordExtent(
381
+ this.wrappedTileCoord_,
382
+ );
429
383
 
430
- for (let i = 0, len = sources.length; i < len; ++i) {
431
- const canvas = sources[i].image;
432
- const context = canvas.getContext('2d');
433
- releaseCanvas(context);
434
- canvasPool.push(context.canvas);
384
+ let dataR, dataU;
385
+
386
+ const bytesPerPixel = dataSources[0].bytesPerPixel;
387
+
388
+ const reprojs = Math.ceil(bytesPerPixel / 3);
389
+ for (let reproj = reprojs - 1; reproj >= 0; --reproj) {
390
+ const sources = [];
391
+ for (let i = 0, len = dataSources.length; i < len; ++i) {
392
+ const dataSource = dataSources[i];
393
+ const buffer = dataSource.data;
394
+ const pixelSize = dataSource.pixelSize;
395
+ const width = pixelSize[0];
396
+ const height = pixelSize[1];
397
+ const context = createCanvasContext2D(width, height, canvasPool);
398
+ const imageData = context.createImageData(width, height);
399
+ const data = imageData.data;
400
+ let offset = reproj * 3;
401
+ for (let j = 0, len = data.length; j < len; j += 4) {
402
+ data[j] = buffer[offset];
403
+ data[j + 1] = buffer[offset + 1];
404
+ data[j + 2] = buffer[offset + 2];
405
+ data[j + 3] = 255;
406
+ offset += bytesPerPixel;
435
407
  }
408
+ context.putImageData(imageData, 0, 0);
409
+ sources.push({
410
+ extent: dataSource.extent,
411
+ clipExtent: dataSource.clipExtent,
412
+ image: context.canvas,
413
+ });
414
+ }
436
415
 
437
- const context = canvas.getContext('2d');
438
- const imageData = context.getImageData(
439
- 0,
440
- 0,
441
- canvas.width,
442
- canvas.height,
443
- );
416
+ const canvas = renderReprojected(
417
+ targetWidth,
418
+ targetHeight,
419
+ this.pixelRatio_,
420
+ sourceResolution,
421
+ this.sourceTileGrid_.getExtent(),
422
+ targetResolution,
423
+ targetExtent,
424
+ this.triangulation_,
425
+ sources,
426
+ this.gutter_,
427
+ false,
428
+ false,
429
+ false,
430
+ );
444
431
 
432
+ for (let i = 0, len = sources.length; i < len; ++i) {
433
+ const canvas = sources[i].image;
434
+ const context = canvas.getContext('2d');
445
435
  releaseCanvas(context);
446
- canvasPool.push(canvas);
436
+ canvasPool.push(context.canvas);
437
+ }
447
438
 
448
- if (!dataR) {
449
- dataU = new Uint8Array(
450
- bytesPerPixel * imageData.width * imageData.height,
451
- );
452
- dataR = new dataSources[0].dataType(dataU.buffer);
453
- }
439
+ const context = canvas.getContext('2d');
440
+ const imageData = context.getImageData(0, 0, canvas.width, canvas.height);
454
441
 
455
- const data = imageData.data;
456
- let offset = reproj * 3;
457
- for (let i = 0, len = data.length; i < len; i += 4) {
458
- if (data[i + 3] === 255) {
459
- dataU[offset] = data[i];
460
- dataU[offset + 1] = data[i + 1];
461
- dataU[offset + 2] = data[i + 2];
462
- } else {
463
- dataU[offset] = 0;
464
- dataU[offset + 1] = 0;
465
- dataU[offset + 2] = 0;
466
- }
467
- offset += bytesPerPixel;
442
+ releaseCanvas(context);
443
+ canvasPool.push(canvas);
444
+
445
+ if (!dataR) {
446
+ dataU = new Uint8ClampedArray(
447
+ bytesPerPixel * imageData.width * imageData.height,
448
+ );
449
+ dataR = new dataSources[0].dataType(dataU.buffer);
450
+ }
451
+
452
+ const data = imageData.data;
453
+ let offset = reproj * 3;
454
+ for (let i = 0, len = data.length; i < len; i += 4) {
455
+ if (data[i + 3] === 255) {
456
+ dataU[offset] = data[i];
457
+ dataU[offset + 1] = data[i + 1];
458
+ dataU[offset + 2] = data[i + 2];
459
+ } else {
460
+ dataU[offset] = 0;
461
+ dataU[offset + 1] = 0;
462
+ dataU[offset + 2] = 0;
468
463
  }
464
+ offset += bytesPerPixel;
469
465
  }
466
+ }
470
467
 
468
+ if (imageLike) {
469
+ const context = createCanvasContext2D(targetWidth, targetHeight);
470
+ const imageData = new ImageData(dataR, targetWidth);
471
+ context.putImageData(imageData, 0, 0);
472
+ this.reprojData_ = context.canvas;
473
+ } else {
471
474
  this.reprojData_ = dataR;
472
- this.reprojSize_ = [
473
- Math.round(targetWidth * this.pixelRatio_),
474
- Math.round(targetHeight * this.pixelRatio_),
475
- ];
476
- this.state = TileState.LOADED;
477
475
  }
476
+ this.reprojSize_ = [
477
+ Math.round(targetWidth * this.pixelRatio_),
478
+ Math.round(targetHeight * this.pixelRatio_),
479
+ ];
480
+ this.state = TileState.LOADED;
478
481
  this.changed();
479
482
  }
480
483