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
@@ -2,7 +2,7 @@
2
2
  * @module ol/webgl/TileTexture
3
3
  */
4
4
 
5
- import DataTile from '../DataTile.js';
5
+ import DataTile, {asArrayLike, asImageLike} from '../DataTile.js';
6
6
  import EventTarget from '../events/Target.js';
7
7
  import EventType from '../events/EventType.js';
8
8
  import ImageTile from '../ImageTile.js';
@@ -10,6 +10,7 @@ import ReprojTile from '../reproj/Tile.js';
10
10
  import TileState from '../TileState.js';
11
11
  import WebGLArrayBuffer from './Buffer.js';
12
12
  import {ARRAY_BUFFER, STATIC_DRAW} from '../webgl.js';
13
+ import {createCanvasContext2D} from '../dom.js';
13
14
  import {toSize} from '../size.js';
14
15
 
15
16
  /**
@@ -29,7 +30,7 @@ function bindAndConfigure(gl, texture, interpolate) {
29
30
  /**
30
31
  * @param {WebGLRenderingContext} gl The WebGL context.
31
32
  * @param {WebGLTexture} texture The texture.
32
- * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement} image The image.
33
+ * @param {import("../DataTile.js").ImageLike} image The image.
33
34
  * @param {boolean} interpolate Interpolate when resampling.
34
35
  */
35
36
  function uploadImageTexture(gl, texture, image, interpolate) {
@@ -41,7 +42,7 @@ function uploadImageTexture(gl, texture, image, interpolate) {
41
42
  /**
42
43
  * @param {import("./Helper.js").default} helper The WebGL helper.
43
44
  * @param {WebGLTexture} texture The texture.
44
- * @param {import("../DataTile.js").Data} data The pixel data.
45
+ * @param {import("../DataTile.js").ArrayLike} data The pixel data.
45
46
  * @param {import("../size.js").Size} size The pixel size.
46
47
  * @param {number} bandCount The band count.
47
48
  * @param {boolean} interpolate Interpolate when resampling.
@@ -123,10 +124,9 @@ function uploadDataTexture(
123
124
  let pixelContext = null;
124
125
 
125
126
  function createPixelContext() {
126
- const canvas = document.createElement('canvas');
127
- canvas.width = 1;
128
- canvas.height = 1;
129
- pixelContext = canvas.getContext('2d');
127
+ pixelContext = createCanvasContext2D(1, 1, undefined, {
128
+ willReadFrequently: true,
129
+ });
130
130
  }
131
131
 
132
132
  /**
@@ -235,20 +235,33 @@ class TileTexture extends EventTarget {
235
235
  const gl = helper.getGL();
236
236
  const tile = this.tile;
237
237
 
238
+ /**
239
+ * @type {import("../DataTile.js").Data}
240
+ */
241
+ let data;
242
+
238
243
  if (tile instanceof ImageTile || tile instanceof ReprojTile) {
244
+ data = tile.getImage();
245
+ } else {
246
+ data = tile.getData();
247
+ }
248
+
249
+ const image = asImageLike(data);
250
+ if (image) {
239
251
  const texture = gl.createTexture();
240
252
  this.textures.push(texture);
241
253
  this.bandCount = 4;
242
- uploadImageTexture(gl, texture, tile.getImage(), tile.interpolate);
254
+ uploadImageTexture(gl, texture, image, tile.interpolate);
243
255
  return;
244
256
  }
245
257
 
246
- const sourceTileSize = tile.getSize();
258
+ data = asArrayLike(data);
259
+
260
+ const sourceTileSize = /** @type {DataTile} */ (tile).getSize();
247
261
  const pixelSize = [
248
262
  sourceTileSize[0] + 2 * this.gutter_,
249
263
  sourceTileSize[1] + 2 * this.gutter_,
250
264
  ];
251
- const data = tile.getData();
252
265
  const isFloat = data instanceof Float32Array;
253
266
  const pixelCount = pixelSize[0] * pixelSize[1];
254
267
  const DataType = isFloat ? Float32Array : Uint8Array;
@@ -335,53 +348,22 @@ class TileTexture extends EventTarget {
335
348
  }
336
349
 
337
350
  /**
338
- * Get data for a pixel. If the tile is not loaded, null is returned.
351
+ * @param {import("../DataTile.js").ImageLike} image The image.
339
352
  * @param {number} renderCol The column index (in rendered tile space).
340
353
  * @param {number} renderRow The row index (in rendered tile space).
341
- * @return {import("../DataTile.js").Data|null} The data.
354
+ * @return {Uint8ClampedArray|null} The data.
355
+ * @private
342
356
  */
343
- getPixelData(renderCol, renderRow) {
344
- if (!this.loaded) {
345
- return null;
346
- }
357
+ getImagePixelData_(image, renderCol, renderRow) {
358
+ const gutter = this.gutter_;
347
359
  const renderWidth = this.renderSize_[0];
348
360
  const renderHeight = this.renderSize_[1];
349
- const gutter = this.gutter_;
350
-
351
- if (this.tile instanceof DataTile) {
352
- const sourceSize = this.tile.getSize();
353
-
354
- const sourceWidthWithoutGutter = sourceSize[0];
355
- const sourceHeightWithoutGutter = sourceSize[1];
356
- const sourceWidth = sourceWidthWithoutGutter + 2 * gutter;
357
- const sourceHeight = sourceHeightWithoutGutter + 2 * gutter;
358
-
359
- const sourceCol =
360
- gutter +
361
- Math.floor(sourceWidthWithoutGutter * (renderCol / renderWidth));
362
-
363
- const sourceRow =
364
- gutter +
365
- Math.floor(sourceHeightWithoutGutter * (renderRow / renderHeight));
366
-
367
- const data = this.tile.getData();
368
- if (data instanceof DataView) {
369
- const bytesPerPixel = data.byteLength / (sourceWidth * sourceHeight);
370
- const offset = bytesPerPixel * (sourceRow * sourceWidth + sourceCol);
371
- const buffer = data.buffer.slice(offset, offset + bytesPerPixel);
372
- return new DataView(buffer);
373
- }
374
-
375
- const offset = this.bandCount * (sourceRow * sourceWidth + sourceCol);
376
- return data.slice(offset, offset + this.bandCount);
377
- }
378
361
 
379
362
  if (!pixelContext) {
380
363
  createPixelContext();
381
364
  }
382
365
  pixelContext.clearRect(0, 0, 1, 1);
383
366
 
384
- const image = this.tile.getImage();
385
367
  const sourceWidth = image.width;
386
368
  const sourceHeight = image.height;
387
369
 
@@ -405,6 +387,71 @@ class TileTexture extends EventTarget {
405
387
  }
406
388
  return data;
407
389
  }
390
+
391
+ /**
392
+ * @param {import("../DataTile.js").ArrayLike} data The data.
393
+ * @param {import("../size.js").Size} sourceSize The size.
394
+ * @param {number} renderCol The column index (in rendered tile space).
395
+ * @param {number} renderRow The row index (in rendered tile space).
396
+ * @return {import("../DataTile.js").ArrayLike|null} The data.
397
+ * @private
398
+ */
399
+ getArrayPixelData_(data, sourceSize, renderCol, renderRow) {
400
+ const gutter = this.gutter_;
401
+ const renderWidth = this.renderSize_[0];
402
+ const renderHeight = this.renderSize_[1];
403
+
404
+ const sourceWidthWithoutGutter = sourceSize[0];
405
+ const sourceHeightWithoutGutter = sourceSize[1];
406
+ const sourceWidth = sourceWidthWithoutGutter + 2 * gutter;
407
+ const sourceHeight = sourceHeightWithoutGutter + 2 * gutter;
408
+
409
+ const sourceCol =
410
+ gutter + Math.floor(sourceWidthWithoutGutter * (renderCol / renderWidth));
411
+
412
+ const sourceRow =
413
+ gutter +
414
+ Math.floor(sourceHeightWithoutGutter * (renderRow / renderHeight));
415
+
416
+ if (data instanceof DataView) {
417
+ const bytesPerPixel = data.byteLength / (sourceWidth * sourceHeight);
418
+ const offset = bytesPerPixel * (sourceRow * sourceWidth + sourceCol);
419
+ const buffer = data.buffer.slice(offset, offset + bytesPerPixel);
420
+ return new DataView(buffer);
421
+ }
422
+
423
+ const offset = this.bandCount * (sourceRow * sourceWidth + sourceCol);
424
+ return data.slice(offset, offset + this.bandCount);
425
+ }
426
+
427
+ /**
428
+ * Get data for a pixel. If the tile is not loaded, null is returned.
429
+ * @param {number} renderCol The column index (in rendered tile space).
430
+ * @param {number} renderRow The row index (in rendered tile space).
431
+ * @return {import("../DataTile.js").ArrayLike|null} The data.
432
+ */
433
+ getPixelData(renderCol, renderRow) {
434
+ if (!this.loaded) {
435
+ return null;
436
+ }
437
+
438
+ if (this.tile instanceof DataTile) {
439
+ const data = this.tile.getData();
440
+ const arrayData = asArrayLike(data);
441
+ if (arrayData) {
442
+ const sourceSize = this.tile.getSize();
443
+ return this.getArrayPixelData_(
444
+ arrayData,
445
+ sourceSize,
446
+ renderCol,
447
+ renderRow
448
+ );
449
+ }
450
+ return this.getImagePixelData_(asImageLike(data), renderCol, renderRow);
451
+ }
452
+
453
+ return this.getImagePixelData_(this.tile.getImage(), renderCol, renderRow);
454
+ }
408
455
  }
409
456
 
410
457
  export default TileTexture;
package/worker/webgl.js CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
2
  export function create() {
3
- const source = "const e=\"GENERATE_POLYGON_BUFFERS\",t=\"GENERATE_POINT_BUFFERS\",n=\"GENERATE_LINE_STRING_BUFFERS\",r={1:\"The view center is not defined\",2:\"The view resolution is not defined\",3:\"The view rotation is not defined\",4:\"`image` and `src` cannot be provided at the same time\",5:\"`imgSize` must be set when `image` is provided\",7:\"`format` must be set when `url` is set\",8:\"Unknown `serverType` configured\",9:\"`url` must be configured or set using `#setUrl()`\",10:\"The default `geometryFunction` can only handle `Point` geometries\",11:\"`options.featureTypes` must be an Array\",12:\"`options.geometryName` must also be provided when `options.bbox` is set\",13:\"Invalid corner\",14:\"Invalid color\",15:\"Tried to get a value for a key that does not exist in the cache\",16:\"Tried to set a value for a key that is used already\",17:\"`resolutions` must be sorted in descending order\",18:\"Either `origin` or `origins` must be configured, never both\",19:\"Number of `tileSizes` and `resolutions` must be equal\",20:\"Number of `origins` and `resolutions` must be equal\",22:\"Either `tileSize` or `tileSizes` must be configured, never both\",24:\"Invalid extent or geometry provided as `geometry`\",25:\"Cannot fit empty extent provided as `geometry`\",26:\"Features must have an id set\",27:\"Features must have an id set\",28:'`renderMode` must be `\"hybrid\"` or `\"vector\"`',30:\"The passed `feature` was already added to the source\",31:\"Tried to enqueue an `element` that was already added to the queue\",32:\"Transformation matrix cannot be inverted\",33:\"Invalid units\",34:\"Invalid geometry layout\",36:\"Unknown SRS type\",37:\"Unknown geometry type found\",38:\"`styleMapValue` has an unknown type\",39:\"Unknown geometry type\",40:\"Expected `feature` to have a geometry\",41:\"Expected an `ol/style/Style` or an array of `ol/style/Style.js`\",42:\"Question unknown, the answer is 42\",43:\"Expected `layers` to be an array or a `Collection`\",47:\"Expected `controls` to be an array or an `ol/Collection`\",48:\"Expected `interactions` to be an array or an `ol/Collection`\",49:\"Expected `overlays` to be an array or an `ol/Collection`\",50:\"`options.featureTypes` should be an Array\",51:\"Either `url` or `tileJSON` options must be provided\",52:\"Unknown `serverType` configured\",53:\"Unknown `tierSizeCalculation` configured\",55:\"The {-y} placeholder requires a tile grid with extent\",56:\"mapBrowserEvent must originate from a pointer event\",57:\"At least 2 conditions are required\",59:\"Invalid command found in the PBF\",60:\"Missing or invalid `size`\",61:\"Cannot determine IIIF Image API version from provided image information JSON\",62:\"A `WebGLArrayBuffer` must either be of type `ELEMENT_ARRAY_BUFFER` or `ARRAY_BUFFER`\",64:\"Layer opacity must be a number\",66:\"`forEachFeatureAtCoordinate` cannot be used on a WebGL layer if the hit detection logic has not been enabled. This is done by providing adequate shaders using the `hitVertexShader` and `hitFragmentShader` properties of `WebGLPointsLayerRenderer`\",67:\"A layer can only be added to the map once. Use either `layer.setMap()` or `map.addLayer()`, not both\",68:\"A VectorTile source can only be rendered if it has a projection compatible with the view projection\"};class o extends Error{constructor(e){const t=r[e];super(t),this.code=e,this.name=\"AssertionError\",this.message=t}}var i=o;function a(e,t){const n=t[0],r=t[1];return t[0]=e[0]*n+e[2]*r+e[4],t[1]=e[1]*n+e[3]*r+e[5],t}function s(e,t){const n=(r=t)[0]*r[3]-r[1]*r[2];var r;!function(e,t){if(!e)throw new i(t)}(0!==n,32);const o=t[0],a=t[1],s=t[2],u=t[3],x=t[4],f=t[5];return e[0]=u/n,e[1]=-a/n,e[2]=-s/n,e[3]=o/n,e[4]=(s*f-u*x)/n,e[5]=-(o*f-a*x)/n,e}new Array(6);var u={exports:{}};function x(e,t,n){n=n||2;var r,o,i,a,s,u,x,l=t&&t.length,c=l?t[0]*n:e.length,v=f(e,0,c,n,!0),d=[];if(!v||v.next===v.prev)return d;if(l&&(v=function(e,t,n,r){var o,i,a,s=[];for(o=0,i=t.length;o<i;o++)(a=f(e,t[o]*r,o<i-1?t[o+1]*r:e.length,r,!1))===a.next&&(a.steiner=!0),s.push(w(a));for(s.sort(p),o=0;o<s.length;o++)n=b(s[o],n);return n}(e,t,v,n)),e.length>80*n){r=i=e[0],o=a=e[1];for(var y=n;y<c;y+=n)(s=e[y])<r&&(r=s),(u=e[y+1])<o&&(o=u),s>i&&(i=s),u>a&&(a=u);x=0!==(x=Math.max(i-r,a-o))?32767/x:0}return h(v,d,n,r,o,x,0),d}function f(e,t,n,r,o){var i,a;if(o===B(e,t,n,r)>0)for(i=t;i<n;i+=r)a=k(i,e[i],e[i+1],a);else for(i=n-r;i>=t;i-=r)a=k(i,e[i],e[i+1],a);return a&&M(a,a.next)&&(z(a),a=a.next),a}function l(e,t){if(!e)return e;t||(t=e);var n,r=e;do{if(n=!1,r.steiner||!M(r,r.next)&&0!==Z(r.prev,r,r.next))r=r.next;else{if(z(r),(r=t=r.prev)===r.next)break;n=!0}}while(n||r!==t);return t}function h(e,t,n,r,o,i,a){if(e){!a&&i&&function(e,t,n,r){var o=e;do{0===o.z&&(o.z=g(o.x,o.y,t,n,r)),o.prevZ=o.prev,o.nextZ=o.next,o=o.next}while(o!==e);o.prevZ.nextZ=null,o.prevZ=null,function(e){var t,n,r,o,i,a,s,u,x=1;do{for(n=e,e=null,i=null,a=0;n;){for(a++,r=n,s=0,t=0;t<x&&(s++,r=r.nextZ);t++);for(u=x;s>0||u>0&&r;)0!==s&&(0===u||!r||n.z<=r.z)?(o=n,n=n.nextZ,s--):(o=r,r=r.nextZ,u--),i?i.nextZ=o:e=o,o.prevZ=i,i=o;n=r}i.nextZ=null,x*=2}while(a>1)}(o)}(e,r,o,i);for(var s,u,x=e;e.prev!==e.next;)if(s=e.prev,u=e.next,i?v(e,r,o,i):c(e))t.push(s.i/n|0),t.push(e.i/n|0),t.push(u.i/n|0),z(e),e=u.next,x=u.next;else if((e=u)===x){a?1===a?h(e=d(l(e),t,n),t,n,r,o,i,2):2===a&&y(e,t,n,r,o,i):h(l(e),t,n,r,o,i,1);break}}}function c(e){var t=e.prev,n=e,r=e.next;if(Z(t,n,r)>=0)return!1;for(var o=t.x,i=n.x,a=r.x,s=t.y,u=n.y,x=r.y,f=o<i?o<a?o:a:i<a?i:a,l=s<u?s<x?s:x:u<x?u:x,h=o>i?o>a?o:a:i>a?i:a,c=s>u?s>x?s:x:u>x?u:x,v=r.next;v!==t;){if(v.x>=f&&v.x<=h&&v.y>=l&&v.y<=c&&A(o,s,i,u,a,x,v.x,v.y)&&Z(v.prev,v,v.next)>=0)return!1;v=v.next}return!0}function v(e,t,n,r){var o=e.prev,i=e,a=e.next;if(Z(o,i,a)>=0)return!1;for(var s=o.x,u=i.x,x=a.x,f=o.y,l=i.y,h=a.y,c=s<u?s<x?s:x:u<x?u:x,v=f<l?f<h?f:h:l<h?l:h,d=s>u?s>x?s:x:u>x?u:x,y=f>l?f>h?f:h:l>h?l:h,p=g(c,v,t,n,r),b=g(d,y,t,n,r),m=e.prevZ,w=e.nextZ;m&&m.z>=p&&w&&w.z<=b;){if(m.x>=c&&m.x<=d&&m.y>=v&&m.y<=y&&m!==o&&m!==a&&A(s,f,u,l,x,h,m.x,m.y)&&Z(m.prev,m,m.next)>=0)return!1;if(m=m.prevZ,w.x>=c&&w.x<=d&&w.y>=v&&w.y<=y&&w!==o&&w!==a&&A(s,f,u,l,x,h,w.x,w.y)&&Z(w.prev,w,w.next)>=0)return!1;w=w.nextZ}for(;m&&m.z>=p;){if(m.x>=c&&m.x<=d&&m.y>=v&&m.y<=y&&m!==o&&m!==a&&A(s,f,u,l,x,h,m.x,m.y)&&Z(m.prev,m,m.next)>=0)return!1;m=m.prevZ}for(;w&&w.z<=b;){if(w.x>=c&&w.x<=d&&w.y>=v&&w.y<=y&&w!==o&&w!==a&&A(s,f,u,l,x,h,w.x,w.y)&&Z(w.prev,w,w.next)>=0)return!1;w=w.nextZ}return!0}function d(e,t,n){var r=e;do{var o=r.prev,i=r.next.next;!M(o,i)&&F(o,r,r.next,i)&&S(o,i)&&S(i,o)&&(t.push(o.i/n|0),t.push(r.i/n|0),t.push(i.i/n|0),z(r),z(r.next),r=e=i),r=r.next}while(r!==e);return l(r)}function y(e,t,n,r,o,i){var a=e;do{for(var s=a.next.next;s!==a.prev;){if(a.i!==s.i&&E(a,s)){var u=U(a,s);return a=l(a,a.next),u=l(u,u.next),h(a,t,n,r,o,i,0),void h(u,t,n,r,o,i,0)}s=s.next}a=a.next}while(a!==e)}function p(e,t){return e.x-t.x}function b(e,t){var n=function(e,t){var n,r=t,o=e.x,i=e.y,a=-1/0;do{if(i<=r.y&&i>=r.next.y&&r.next.y!==r.y){var s=r.x+(i-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(s<=o&&s>a&&(a=s,n=r.x<r.next.x?r:r.next,s===o))return n}r=r.next}while(r!==t);if(!n)return null;var u,x=n,f=n.x,l=n.y,h=1/0;r=n;do{o>=r.x&&r.x>=f&&o!==r.x&&A(i<l?o:a,i,f,l,i<l?a:o,i,r.x,r.y)&&(u=Math.abs(i-r.y)/(o-r.x),S(r,e)&&(u<h||u===h&&(r.x>n.x||r.x===n.x&&m(n,r)))&&(n=r,h=u)),r=r.next}while(r!==x);return n}(e,t);if(!n)return t;var r=U(n,e);return l(r,r.next),l(n,n.next)}function m(e,t){return Z(e.prev,e,t.prev)<0&&Z(t.next,e,e.next)<0}function g(e,t,n,r,o){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-n)*o|0)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-r)*o|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function w(e){var t=e,n=e;do{(t.x<n.x||t.x===n.x&&t.y<n.y)&&(n=t),t=t.next}while(t!==e);return n}function A(e,t,n,r,o,i,a,s){return(o-a)*(t-s)>=(e-a)*(i-s)&&(e-a)*(r-s)>=(n-a)*(t-s)&&(n-a)*(i-s)>=(o-a)*(r-s)}function E(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){var n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&F(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}(e,t)&&(S(e,t)&&S(t,e)&&function(e,t){var n=e,r=!1,o=(e.x+t.x)/2,i=(e.y+t.y)/2;do{n.y>i!=n.next.y>i&&n.next.y!==n.y&&o<(n.next.x-n.x)*(i-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next}while(n!==e);return r}(e,t)&&(Z(e.prev,e,t.prev)||Z(e,t.prev,t))||M(e,t)&&Z(e.prev,e,e.next)>0&&Z(t.prev,t,t.next)>0)}function Z(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function M(e,t){return e.x===t.x&&e.y===t.y}function F(e,t,n,r){var o=I(Z(e,t,n)),i=I(Z(e,t,r)),a=I(Z(n,r,e)),s=I(Z(n,r,t));return o!==i&&a!==s||(!(0!==o||!T(e,n,t))||(!(0!==i||!T(e,r,t))||(!(0!==a||!T(n,e,r))||!(0!==s||!T(n,t,r)))))}function T(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function I(e){return e>0?1:e<0?-1:0}function S(e,t){return Z(e.prev,e,e.next)<0?Z(e,t,e.next)>=0&&Z(e,e.prev,t)>=0:Z(e,t,e.prev)<0||Z(e,e.next,t)<0}function U(e,t){var n=new R(e.i,e.x,e.y),r=new R(t.i,t.x,t.y),o=e.next,i=t.prev;return e.next=t,t.prev=e,n.next=o,o.prev=n,r.next=n,n.prev=r,i.next=r,r.prev=i,r}function k(e,t,n,r){var o=new R(e,t,n);return r?(o.next=r.next,o.prev=r,r.next.prev=o,r.next=o):(o.prev=o,o.next=o),o}function z(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function R(e,t,n){this.i=e,this.x=t,this.y=n,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function B(e,t,n,r){for(var o=0,i=t,a=n-r;i<n;i+=r)o+=(e[a]-e[i])*(e[i+1]+e[a+1]),a=i;return o}u.exports=x,u.exports.default=x,x.deviation=function(e,t,n,r){var o=t&&t.length,i=o?t[0]*n:e.length,a=Math.abs(B(e,0,i,n));if(o)for(var s=0,u=t.length;s<u;s++){var x=t[s]*n,f=s<u-1?t[s+1]*n:e.length;a-=Math.abs(B(e,x,f,n))}var l=0;for(s=0;s<r.length;s+=3){var h=r[s]*n,c=r[s+1]*n,v=r[s+2]*n;l+=Math.abs((e[h]-e[v])*(e[c+1]-e[h+1])-(e[h]-e[c])*(e[v+1]-e[h+1]))}return 0===a&&0===l?0:Math.abs((l-a)/a)},x.flatten=function(e){for(var t=e[0][0].length,n={vertices:[],holes:[],dimensions:t},r=0,o=0;o<e.length;o++){for(var i=0;i<e[o].length;i++)for(var a=0;a<t;a++)n.vertices.push(e[o][i][a]);o>0&&(r+=e[o-1].length,n.holes.push(r))}return n};const N=[],P={vertexPosition:0,indexPosition:0};function C(e,t,n,r,o){e[t+0]=n,e[t+1]=r,e[t+2]=o}function _(e,t,n,r,o,i){const a=3+o,s=e[t+0],u=e[t+1],x=N;x.length=o;for(let n=0;n<x.length;n++)x[n]=e[t+2+n];let f=i?i.vertexPosition:0,l=i?i.indexPosition:0;const h=f/a;return C(n,f,s,u,0),x.length&&n.set(x,f+3),f+=a,C(n,f,s,u,1),x.length&&n.set(x,f+3),f+=a,C(n,f,s,u,2),x.length&&n.set(x,f+3),f+=a,C(n,f,s,u,3),x.length&&n.set(x,f+3),f+=a,r[l++]=h,r[l++]=h+1,r[l++]=h+3,r[l++]=h+1,r[l++]=h+2,r[l++]=h+3,P.vertexPosition=f,P.indexPosition=l,P}function q(e,t,n,r,o,i,s,u,x,f){const l=5+u.length,h=i.length/l,c=[e[t+0],e[t+1]],v=[e[n],e[n+1]],d=a(f,[...c]),y=a(f,[...v]);function p(e,t,n){const r=1e4;return Math.round(1500*t)+Math.round(1500*n)*r+e*r*r}function b(e,t,n){const r=Math.sqrt((t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])),o=[(t[0]-e[0])/r,(t[1]-e[1])/r],i=[-o[1],o[0]],a=Math.sqrt((n[0]-e[0])*(n[0]-e[0])+(n[1]-e[1])*(n[1]-e[1])),s=[(n[0]-e[0])/a,(n[1]-e[1])/a],u=0===r||0===a?0:Math.acos((x=s[0]*o[0]+s[1]*o[1],f=-1,l=1,Math.min(Math.max(x,f),l)));var x,f,l;return s[0]*i[0]+s[1]*i[1]>0?u:2*Math.PI-u}const m=null!==o;let g=0,w=0;if(null!==r){g=b(d,y,a(f,[...[e[r],e[r+1]]]))}if(m){w=b(y,d,a(f,[...[e[o],e[o+1]]]))}i.push(c[0],c[1],v[0],v[1],p(0,g,w)),i.push(...u),i.push(c[0],c[1],v[0],v[1],p(1,g,w)),i.push(...u),i.push(c[0],c[1],v[0],v[1],p(2,g,w)),i.push(...u),i.push(c[0],c[1],v[0],v[1],p(3,g,w)),i.push(...u),s.push(h,h+1,h+2,h+1,h+3,h+2)}function L(e,t,n,r,o){const i=2+o;let a=t;const s=e.slice(a,a+o);a+=o;const x=e[a++];let f=0;const l=new Array(x-1);for(let t=0;t<x;t++)f+=e[a++],t<x-1&&(l[t]=f);const h=e.slice(a,a+2*f),c=u.exports(h,l,2);for(let e=0;e<c.length;e++)r.push(c[e]+n.length/i);for(let e=0;e<h.length;e+=2)n.push(h[e],h[e+1],...s);return a+2*f}const G=self;G.onmessage=r=>{const o=r.data;switch(o.type){case t:{const e=3,t=2,n=o.customAttributesCount,r=t+n,i=new Float32Array(o.renderInstructions),a=i.length/r,s=4*a*(n+e),u=new Uint32Array(6*a),x=new Float32Array(s);let f;for(let e=0;e<i.length;e+=r)f=_(i,e,x,u,n,f);const l=Object.assign({vertexBuffer:x.buffer,indexBuffer:u.buffer,renderInstructions:i.buffer},o);G.postMessage(l,[x.buffer,u.buffer,i.buffer]);break}case n:{const e=[],t=[],n=o.customAttributesCount,r=2,i=new Float32Array(o.renderInstructions);let a=0;const u=o.renderInstructionsTransform,x=[1,0,0,1,0,0];let f,l;for(s(x,u);a<i.length;){l=Array.from(i.slice(a,a+n)),a+=n,f=i[a++];for(let n=0;n<f-1;n++)q(i,a+n*r,a+(n+1)*r,n>0?a+(n-1)*r:null,n<f-2?a+(n+2)*r:null,e,t,l,0,x);a+=f*r}const h=Uint32Array.from(t),c=Float32Array.from(e),v=Object.assign({vertexBuffer:c.buffer,indexBuffer:h.buffer,renderInstructions:i.buffer},o);G.postMessage(v,[c.buffer,h.buffer,i.buffer]);break}case e:{const e=[],t=[],n=o.customAttributesCount,r=new Float32Array(o.renderInstructions);let i=0;for(;i<r.length;)i=L(r,i,e,t,n);const a=Uint32Array.from(t),s=Float32Array.from(e),u=Object.assign({vertexBuffer:s.buffer,indexBuffer:a.buffer,renderInstructions:r.buffer},o);G.postMessage(u,[s.buffer,a.buffer,r.buffer]);break}}};";
3
+ const source = "const e=\"GENERATE_POLYGON_BUFFERS\",t=\"GENERATE_POINT_BUFFERS\",n=\"GENERATE_LINE_STRING_BUFFERS\",r={1:\"The view center is not defined\",2:\"The view resolution is not defined\",3:\"The view rotation is not defined\",4:\"`image` and `src` cannot be provided at the same time\",5:\"`imgSize` must be set when `image` is provided\",7:\"`format` must be set when `url` is set\",8:\"Unknown `serverType` configured\",9:\"`url` must be configured or set using `#setUrl()`\",10:\"The default `geometryFunction` can only handle `Point` geometries\",11:\"`options.featureTypes` must be an Array\",12:\"`options.geometryName` must also be provided when `options.bbox` is set\",13:\"Invalid corner\",14:\"Invalid color\",15:\"Tried to get a value for a key that does not exist in the cache\",16:\"Tried to set a value for a key that is used already\",17:\"`resolutions` must be sorted in descending order\",18:\"Either `origin` or `origins` must be configured, never both\",19:\"Number of `tileSizes` and `resolutions` must be equal\",20:\"Number of `origins` and `resolutions` must be equal\",22:\"Either `tileSize` or `tileSizes` must be configured, never both\",24:\"Invalid extent or geometry provided as `geometry`\",25:\"Cannot fit empty extent provided as `geometry`\",26:\"Features must have an id set\",27:\"Features must have an id set\",28:'`renderMode` must be `\"hybrid\"` or `\"vector\"`',30:\"The passed `feature` was already added to the source\",31:\"Tried to enqueue an `element` that was already added to the queue\",32:\"Transformation matrix cannot be inverted\",33:\"Invalid units\",34:\"Invalid geometry layout\",36:\"Unknown SRS type\",37:\"Unknown geometry type found\",38:\"`styleMapValue` has an unknown type\",39:\"Unknown geometry type\",40:\"Expected `feature` to have a geometry\",41:\"Expected an `ol/style/Style` or an array of `ol/style/Style.js`\",42:\"Question unknown, the answer is 42\",43:\"Expected `layers` to be an array or a `Collection`\",47:\"Expected `controls` to be an array or an `ol/Collection`\",48:\"Expected `interactions` to be an array or an `ol/Collection`\",49:\"Expected `overlays` to be an array or an `ol/Collection`\",50:\"`options.featureTypes` should be an Array\",51:\"Either `url` or `tileJSON` options must be provided\",52:\"Unknown `serverType` configured\",53:\"Unknown `tierSizeCalculation` configured\",55:\"The {-y} placeholder requires a tile grid with extent\",56:\"mapBrowserEvent must originate from a pointer event\",57:\"At least 2 conditions are required\",59:\"Invalid command found in the PBF\",60:\"Missing or invalid `size`\",61:\"Cannot determine IIIF Image API version from provided image information JSON\",62:\"A `WebGLArrayBuffer` must either be of type `ELEMENT_ARRAY_BUFFER` or `ARRAY_BUFFER`\",64:\"Layer opacity must be a number\",66:\"`forEachFeatureAtCoordinate` cannot be used on a WebGL layer if the hit detection logic has not been enabled. This is done by providing adequate shaders using the `hitVertexShader` and `hitFragmentShader` properties of `WebGLPointsLayerRenderer`\",67:\"A layer can only be added to the map once. Use either `layer.setMap()` or `map.addLayer()`, not both\",68:\"A VectorTile source can only be rendered if it has a projection compatible with the view projection\",69:\"`width` or `height` cannot be provided together with `scale`\"};class o extends Error{constructor(e){const t=r[e];super(t),this.code=e,this.name=\"AssertionError\",this.message=t}}var i=o;function a(e,t){const n=t[0],r=t[1];return t[0]=e[0]*n+e[2]*r+e[4],t[1]=e[1]*n+e[3]*r+e[5],t}function s(e,t){const n=(r=t)[0]*r[3]-r[1]*r[2];var r;!function(e,t){if(!e)throw new i(t)}(0!==n,32);const o=t[0],a=t[1],s=t[2],u=t[3],f=t[4],x=t[5];return e[0]=u/n,e[1]=-a/n,e[2]=-s/n,e[3]=o/n,e[4]=(s*x-u*f)/n,e[5]=-(o*x-a*f)/n,e}new Array(6);var u={};function f(e,t,n){n=n||2;var r,o,i,a,s,u,f,l=t&&t.length,c=l?t[0]*n:e.length,v=x(e,0,c,n,!0),d=[];if(!v||v.next===v.prev)return d;if(l&&(v=function(e,t,n,r){var o,i,a,s=[];for(o=0,i=t.length;o<i;o++)(a=x(e,t[o]*r,o<i-1?t[o+1]*r:e.length,r,!1))===a.next&&(a.steiner=!0),s.push(w(a));for(s.sort(p),o=0;o<s.length;o++)n=b(s[o],n);return n}(e,t,v,n)),e.length>80*n){r=i=e[0],o=a=e[1];for(var y=n;y<c;y+=n)(s=e[y])<r&&(r=s),(u=e[y+1])<o&&(o=u),s>i&&(i=s),u>a&&(a=u);f=0!==(f=Math.max(i-r,a-o))?32767/f:0}return h(v,d,n,r,o,f,0),d}function x(e,t,n,r,o){var i,a;if(o===B(e,t,n,r)>0)for(i=t;i<n;i+=r)a=k(i,e[i],e[i+1],a);else for(i=n-r;i>=t;i-=r)a=k(i,e[i],e[i+1],a);return a&&M(a,a.next)&&(z(a),a=a.next),a}function l(e,t){if(!e)return e;t||(t=e);var n,r=e;do{if(n=!1,r.steiner||!M(r,r.next)&&0!==Z(r.prev,r,r.next))r=r.next;else{if(z(r),(r=t=r.prev)===r.next)break;n=!0}}while(n||r!==t);return t}function h(e,t,n,r,o,i,a){if(e){!a&&i&&function(e,t,n,r){var o=e;do{0===o.z&&(o.z=m(o.x,o.y,t,n,r)),o.prevZ=o.prev,o.nextZ=o.next,o=o.next}while(o!==e);o.prevZ.nextZ=null,o.prevZ=null,function(e){var t,n,r,o,i,a,s,u,f=1;do{for(n=e,e=null,i=null,a=0;n;){for(a++,r=n,s=0,t=0;t<f&&(s++,r=r.nextZ);t++);for(u=f;s>0||u>0&&r;)0!==s&&(0===u||!r||n.z<=r.z)?(o=n,n=n.nextZ,s--):(o=r,r=r.nextZ,u--),i?i.nextZ=o:e=o,o.prevZ=i,i=o;n=r}i.nextZ=null,f*=2}while(a>1)}(o)}(e,r,o,i);for(var s,u,f=e;e.prev!==e.next;)if(s=e.prev,u=e.next,i?v(e,r,o,i):c(e))t.push(s.i/n|0),t.push(e.i/n|0),t.push(u.i/n|0),z(e),e=u.next,f=u.next;else if((e=u)===f){a?1===a?h(e=d(l(e),t,n),t,n,r,o,i,2):2===a&&y(e,t,n,r,o,i):h(l(e),t,n,r,o,i,1);break}}}function c(e){var t=e.prev,n=e,r=e.next;if(Z(t,n,r)>=0)return!1;for(var o=t.x,i=n.x,a=r.x,s=t.y,u=n.y,f=r.y,x=o<i?o<a?o:a:i<a?i:a,l=s<u?s<f?s:f:u<f?u:f,h=o>i?o>a?o:a:i>a?i:a,c=s>u?s>f?s:f:u>f?u:f,v=r.next;v!==t;){if(v.x>=x&&v.x<=h&&v.y>=l&&v.y<=c&&A(o,s,i,u,a,f,v.x,v.y)&&Z(v.prev,v,v.next)>=0)return!1;v=v.next}return!0}function v(e,t,n,r){var o=e.prev,i=e,a=e.next;if(Z(o,i,a)>=0)return!1;for(var s=o.x,u=i.x,f=a.x,x=o.y,l=i.y,h=a.y,c=s<u?s<f?s:f:u<f?u:f,v=x<l?x<h?x:h:l<h?l:h,d=s>u?s>f?s:f:u>f?u:f,y=x>l?x>h?x:h:l>h?l:h,p=m(c,v,t,n,r),b=m(d,y,t,n,r),g=e.prevZ,w=e.nextZ;g&&g.z>=p&&w&&w.z<=b;){if(g.x>=c&&g.x<=d&&g.y>=v&&g.y<=y&&g!==o&&g!==a&&A(s,x,u,l,f,h,g.x,g.y)&&Z(g.prev,g,g.next)>=0)return!1;if(g=g.prevZ,w.x>=c&&w.x<=d&&w.y>=v&&w.y<=y&&w!==o&&w!==a&&A(s,x,u,l,f,h,w.x,w.y)&&Z(w.prev,w,w.next)>=0)return!1;w=w.nextZ}for(;g&&g.z>=p;){if(g.x>=c&&g.x<=d&&g.y>=v&&g.y<=y&&g!==o&&g!==a&&A(s,x,u,l,f,h,g.x,g.y)&&Z(g.prev,g,g.next)>=0)return!1;g=g.prevZ}for(;w&&w.z<=b;){if(w.x>=c&&w.x<=d&&w.y>=v&&w.y<=y&&w!==o&&w!==a&&A(s,x,u,l,f,h,w.x,w.y)&&Z(w.prev,w,w.next)>=0)return!1;w=w.nextZ}return!0}function d(e,t,n){var r=e;do{var o=r.prev,i=r.next.next;!M(o,i)&&F(o,r,r.next,i)&&S(o,i)&&S(i,o)&&(t.push(o.i/n|0),t.push(r.i/n|0),t.push(i.i/n|0),z(r),z(r.next),r=e=i),r=r.next}while(r!==e);return l(r)}function y(e,t,n,r,o,i){var a=e;do{for(var s=a.next.next;s!==a.prev;){if(a.i!==s.i&&E(a,s)){var u=U(a,s);return a=l(a,a.next),u=l(u,u.next),h(a,t,n,r,o,i,0),void h(u,t,n,r,o,i,0)}s=s.next}a=a.next}while(a!==e)}function p(e,t){return e.x-t.x}function b(e,t){var n=function(e,t){var n,r=t,o=e.x,i=e.y,a=-1/0;do{if(i<=r.y&&i>=r.next.y&&r.next.y!==r.y){var s=r.x+(i-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(s<=o&&s>a&&(a=s,n=r.x<r.next.x?r:r.next,s===o))return n}r=r.next}while(r!==t);if(!n)return null;var u,f=n,x=n.x,l=n.y,h=1/0;r=n;do{o>=r.x&&r.x>=x&&o!==r.x&&A(i<l?o:a,i,x,l,i<l?a:o,i,r.x,r.y)&&(u=Math.abs(i-r.y)/(o-r.x),S(r,e)&&(u<h||u===h&&(r.x>n.x||r.x===n.x&&g(n,r)))&&(n=r,h=u)),r=r.next}while(r!==f);return n}(e,t);if(!n)return t;var r=U(n,e);return l(r,r.next),l(n,n.next)}function g(e,t){return Z(e.prev,e,t.prev)<0&&Z(t.next,e,e.next)<0}function m(e,t,n,r,o){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-n)*o|0)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-r)*o|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function w(e){var t=e,n=e;do{(t.x<n.x||t.x===n.x&&t.y<n.y)&&(n=t),t=t.next}while(t!==e);return n}function A(e,t,n,r,o,i,a,s){return(o-a)*(t-s)>=(e-a)*(i-s)&&(e-a)*(r-s)>=(n-a)*(t-s)&&(n-a)*(i-s)>=(o-a)*(r-s)}function E(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){var n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&F(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}(e,t)&&(S(e,t)&&S(t,e)&&function(e,t){var n=e,r=!1,o=(e.x+t.x)/2,i=(e.y+t.y)/2;do{n.y>i!=n.next.y>i&&n.next.y!==n.y&&o<(n.next.x-n.x)*(i-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next}while(n!==e);return r}(e,t)&&(Z(e.prev,e,t.prev)||Z(e,t.prev,t))||M(e,t)&&Z(e.prev,e,e.next)>0&&Z(t.prev,t,t.next)>0)}function Z(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function M(e,t){return e.x===t.x&&e.y===t.y}function F(e,t,n,r){var o=I(Z(e,t,n)),i=I(Z(e,t,r)),a=I(Z(n,r,e)),s=I(Z(n,r,t));return o!==i&&a!==s||(!(0!==o||!T(e,n,t))||(!(0!==i||!T(e,r,t))||(!(0!==a||!T(n,e,r))||!(0!==s||!T(n,t,r)))))}function T(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function I(e){return e>0?1:e<0?-1:0}function S(e,t){return Z(e.prev,e,e.next)<0?Z(e,t,e.next)>=0&&Z(e,e.prev,t)>=0:Z(e,t,e.prev)<0||Z(e,e.next,t)<0}function U(e,t){var n=new R(e.i,e.x,e.y),r=new R(t.i,t.x,t.y),o=e.next,i=t.prev;return e.next=t,t.prev=e,n.next=o,o.prev=n,r.next=n,n.prev=r,i.next=r,r.prev=i,r}function k(e,t,n,r){var o=new R(e,t,n);return r?(o.next=r.next,o.prev=r,r.next.prev=o,r.next=o):(o.prev=o,o.next=o),o}function z(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function R(e,t,n){this.i=e,this.x=t,this.y=n,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function B(e,t,n,r){for(var o=0,i=t,a=n-r;i<n;i+=r)o+=(e[a]-e[i])*(e[i+1]+e[a+1]),a=i;return o}({get exports(){return u},set exports(e){u=e}}).exports=f,u.default=f,f.deviation=function(e,t,n,r){var o=t&&t.length,i=o?t[0]*n:e.length,a=Math.abs(B(e,0,i,n));if(o)for(var s=0,u=t.length;s<u;s++){var f=t[s]*n,x=s<u-1?t[s+1]*n:e.length;a-=Math.abs(B(e,f,x,n))}var l=0;for(s=0;s<r.length;s+=3){var h=r[s]*n,c=r[s+1]*n,v=r[s+2]*n;l+=Math.abs((e[h]-e[v])*(e[c+1]-e[h+1])-(e[h]-e[c])*(e[v+1]-e[h+1]))}return 0===a&&0===l?0:Math.abs((l-a)/a)},f.flatten=function(e){for(var t=e[0][0].length,n={vertices:[],holes:[],dimensions:t},r=0,o=0;o<e.length;o++){for(var i=0;i<e[o].length;i++)for(var a=0;a<t;a++)n.vertices.push(e[o][i][a]);o>0&&(r+=e[o-1].length,n.holes.push(r))}return n};const N=[],P={vertexPosition:0,indexPosition:0};function C(e,t,n,r,o){e[t+0]=n,e[t+1]=r,e[t+2]=o}function _(e,t,n,r,o,i){const a=3+o,s=e[t+0],u=e[t+1],f=N;f.length=o;for(let n=0;n<f.length;n++)f[n]=e[t+2+n];let x=i?i.vertexPosition:0,l=i?i.indexPosition:0;const h=x/a;return C(n,x,s,u,0),f.length&&n.set(f,x+3),x+=a,C(n,x,s,u,1),f.length&&n.set(f,x+3),x+=a,C(n,x,s,u,2),f.length&&n.set(f,x+3),x+=a,C(n,x,s,u,3),f.length&&n.set(f,x+3),x+=a,r[l++]=h,r[l++]=h+1,r[l++]=h+3,r[l++]=h+1,r[l++]=h+2,r[l++]=h+3,P.vertexPosition=x,P.indexPosition=l,P}function q(e,t,n,r,o,i,s,u,f,x){const l=5+u.length,h=i.length/l,c=[e[t+0],e[t+1]],v=[e[n],e[n+1]],d=a(x,[...c]),y=a(x,[...v]);function p(e,t,n){const r=1e4;return Math.round(1500*t)+Math.round(1500*n)*r+e*r*r}function b(e,t,n){const r=Math.sqrt((t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])),o=[(t[0]-e[0])/r,(t[1]-e[1])/r],i=[-o[1],o[0]],a=Math.sqrt((n[0]-e[0])*(n[0]-e[0])+(n[1]-e[1])*(n[1]-e[1])),s=[(n[0]-e[0])/a,(n[1]-e[1])/a],u=0===r||0===a?0:Math.acos((f=s[0]*o[0]+s[1]*o[1],x=-1,l=1,Math.min(Math.max(f,x),l)));var f,x,l;return s[0]*i[0]+s[1]*i[1]>0?u:2*Math.PI-u}const g=null!==o;let m=0,w=0;if(null!==r){m=b(d,y,a(x,[...[e[r],e[r+1]]]))}if(g){w=b(y,d,a(x,[...[e[o],e[o+1]]]))}i.push(c[0],c[1],v[0],v[1],p(0,m,w)),i.push(...u),i.push(c[0],c[1],v[0],v[1],p(1,m,w)),i.push(...u),i.push(c[0],c[1],v[0],v[1],p(2,m,w)),i.push(...u),i.push(c[0],c[1],v[0],v[1],p(3,m,w)),i.push(...u),s.push(h,h+1,h+2,h+1,h+3,h+2)}function L(e,t,n,r,o){const i=2+o;let a=t;const s=e.slice(a,a+o);a+=o;const f=e[a++];let x=0;const l=new Array(f-1);for(let t=0;t<f;t++)x+=e[a++],t<f-1&&(l[t]=x);const h=e.slice(a,a+2*x),c=u(h,l,2);for(let e=0;e<c.length;e++)r.push(c[e]+n.length/i);for(let e=0;e<h.length;e+=2)n.push(h[e],h[e+1],...s);return a+2*x}const G=self;G.onmessage=r=>{const o=r.data;switch(o.type){case t:{const e=3,t=2,n=o.customAttributesCount,r=t+n,i=new Float32Array(o.renderInstructions),a=i.length/r,s=4*a*(n+e),u=new Uint32Array(6*a),f=new Float32Array(s);let x;for(let e=0;e<i.length;e+=r)x=_(i,e,f,u,n,x);const l=Object.assign({vertexBuffer:f.buffer,indexBuffer:u.buffer,renderInstructions:i.buffer},o);G.postMessage(l,[f.buffer,u.buffer,i.buffer]);break}case n:{const e=[],t=[],n=o.customAttributesCount,r=2,i=new Float32Array(o.renderInstructions);let a=0;const u=o.renderInstructionsTransform,f=[1,0,0,1,0,0];let x,l;for(s(f,u);a<i.length;){l=Array.from(i.slice(a,a+n)),a+=n,x=i[a++];for(let n=0;n<x-1;n++)q(i,a+n*r,a+(n+1)*r,n>0?a+(n-1)*r:null,n<x-2?a+(n+2)*r:null,e,t,l,0,f);a+=x*r}const h=Uint32Array.from(t),c=Float32Array.from(e),v=Object.assign({vertexBuffer:c.buffer,indexBuffer:h.buffer,renderInstructions:i.buffer},o);G.postMessage(v,[c.buffer,h.buffer,i.buffer]);break}case e:{const e=[],t=[],n=o.customAttributesCount,r=new Float32Array(o.renderInstructions);let i=0;for(;i<r.length;)i=L(r,i,e,t,n);const a=Uint32Array.from(t),s=Float32Array.from(e),u=Object.assign({vertexBuffer:s.buffer,indexBuffer:a.buffer,renderInstructions:r.buffer},o);G.postMessage(u,[s.buffer,a.buffer,r.buffer]);break}}};";
4
4
  return new Worker(typeof Blob === 'undefined'
5
5
  ? 'data:application/javascript;base64,' + Buffer.from(source, 'binary').toString('base64')
6
6
  : URL.createObjectURL(new Blob([source], {type: 'application/javascript'})));
package/layer/STAC.d.ts DELETED
@@ -1,257 +0,0 @@
1
- export default STACLayer;
2
- export type Item = {
3
- /**
4
- * The item type ("Feature").
5
- */
6
- type: string;
7
- /**
8
- * The STAC version.
9
- */
10
- stac_version: string;
11
- /**
12
- * The item identifier.
13
- */
14
- id: string;
15
- /**
16
- * The item footprint.
17
- */
18
- geometry: import("geojson").GeoJSON | null;
19
- /**
20
- * The bounding box (only required if geometry is null).
21
- */
22
- bbox?: number[] | undefined;
23
- /**
24
- * The item properties.
25
- */
26
- properties: any;
27
- /**
28
- * Links to other resources.
29
- */
30
- links: Array<Link>;
31
- /**
32
- * Asset lookup.
33
- */
34
- assets: {
35
- [x: string]: Asset;
36
- };
37
- /**
38
- * The collection id (if the item is part of a collection).
39
- */
40
- collection: string;
41
- };
42
- export type Link = {
43
- /**
44
- * The URL.
45
- */
46
- href: string;
47
- /**
48
- * The link relationship.
49
- */
50
- rel: string;
51
- /**
52
- * The media type.
53
- */
54
- type?: string | undefined;
55
- /**
56
- * The link title.
57
- */
58
- title?: string | undefined;
59
- };
60
- export type Asset = {
61
- /**
62
- * The asset URL.
63
- */
64
- href: string;
65
- /**
66
- * The asset title.
67
- */
68
- title?: string | undefined;
69
- /**
70
- * The asset description.
71
- */
72
- description?: string | undefined;
73
- /**
74
- * The media type.
75
- */
76
- type?: string | undefined;
77
- /**
78
- * The asset roles.
79
- */
80
- roles?: string[] | undefined;
81
- };
82
- export type SourceOptions = import("../source/GeoTIFF.js").Options;
83
- export type AssetSelector = (arg0: {
84
- [x: string]: Asset;
85
- }) => Array<Asset>;
86
- export type Options = {
87
- /**
88
- * The selector for the assets to be rendered. This can be an
89
- * array of strings corresponding to asset keys or a function that returns an array of assets
90
- * given item's asset lookup object.
91
- */
92
- assets?: string[] | AssetSelector | undefined;
93
- /**
94
- * The STAC item URL. One of `url` or `item` must be provided.
95
- */
96
- url?: string | undefined;
97
- /**
98
- * The STAC item metadata. One of `url` or `item` must be provided.
99
- */
100
- item?: any;
101
- /**
102
- * Optional function that can be used to
103
- * configure the underlying source. The function will be called with the STAC Item metadata and the current source options.
104
- * The function can do any additional work and return the completed options or a promise for the same.
105
- */
106
- getSourceOptions?: ((arg0: Item, arg1: SourceOptions) => (SourceOptions | Promise<SourceOptions>)) | undefined;
107
- /**
108
- * Style to apply to the layer.
109
- */
110
- style?: import("./WebGLTile.js").Style | undefined;
111
- /**
112
- * Opacity (0, 1).
113
- */
114
- opacity?: number | undefined;
115
- /**
116
- * Visibility.
117
- */
118
- visible?: boolean | undefined;
119
- /**
120
- * The bounding extent for layer rendering. The layer will not be
121
- * rendered outside of this extent.
122
- */
123
- extent?: import("../extent.js").Extent | undefined;
124
- /**
125
- * The z-index for layer rendering. At rendering time, the layers
126
- * will be ordered, first by Z-index and then by position. When `undefined`, a `zIndex` of 0 is assumed
127
- * for layers that are added to the map's `layers` collection, or `Infinity` when the layer's `setMap()`
128
- * method was used.
129
- */
130
- zIndex?: number | undefined;
131
- /**
132
- * The minimum resolution (inclusive) at which this layer will be
133
- * visible.
134
- */
135
- minResolution?: number | undefined;
136
- /**
137
- * The maximum resolution (exclusive) below which this layer will
138
- * be visible.
139
- */
140
- maxResolution?: number | undefined;
141
- /**
142
- * The minimum view zoom level (exclusive) above which this layer will be
143
- * visible.
144
- */
145
- minZoom?: number | undefined;
146
- /**
147
- * The maximum view zoom level (inclusive) at which this layer will
148
- * be visible.
149
- */
150
- maxZoom?: number | undefined;
151
- /**
152
- * Preload. Load low-resolution tiles up to `preload` levels. `0`
153
- * means no preloading.
154
- */
155
- preload?: number | undefined;
156
- /**
157
- * The internal texture cache size. This needs to be large enough to render
158
- * two zoom levels worth of tiles.
159
- */
160
- cacheSize?: number | undefined;
161
- /**
162
- * A CSS class name to set to the layer element.
163
- */
164
- className?: string | undefined;
165
- };
166
- /**
167
- * @typedef {function(Object<string, Asset>):Array<Asset>} AssetSelector
168
- */
169
- /**
170
- * @typedef {Object} Options
171
- * @property {Array<string>|AssetSelector} [assets] The selector for the assets to be rendered. This can be an
172
- * array of strings corresponding to asset keys or a function that returns an array of assets
173
- * given item's asset lookup object.
174
- * @property {string} [url] The STAC item URL. One of `url` or `item` must be provided.
175
- * @property {Object} [item] The STAC item metadata. One of `url` or `item` must be provided.
176
- * @property {function(Item, SourceOptions):(SourceOptions|Promise<SourceOptions>)} [getSourceOptions] Optional function that can be used to
177
- * configure the underlying source. The function will be called with the STAC Item metadata and the current source options.
178
- * The function can do any additional work and return the completed options or a promise for the same.
179
- * @property {import("./WebGLTile.js").Style} [style] Style to apply to the layer.
180
- * @property {number} [opacity=1] Opacity (0, 1).
181
- * @property {boolean} [visible=true] Visibility.
182
- * @property {import("../extent.js").Extent} [extent] The bounding extent for layer rendering. The layer will not be
183
- * rendered outside of this extent.
184
- * @property {number} [zIndex] The z-index for layer rendering. At rendering time, the layers
185
- * will be ordered, first by Z-index and then by position. When `undefined`, a `zIndex` of 0 is assumed
186
- * for layers that are added to the map's `layers` collection, or `Infinity` when the layer's `setMap()`
187
- * method was used.
188
- * @property {number} [minResolution] The minimum resolution (inclusive) at which this layer will be
189
- * visible.
190
- * @property {number} [maxResolution] The maximum resolution (exclusive) below which this layer will
191
- * be visible.
192
- * @property {number} [minZoom] The minimum view zoom level (exclusive) above which this layer will be
193
- * visible.
194
- * @property {number} [maxZoom] The maximum view zoom level (inclusive) at which this layer will
195
- * be visible.
196
- * @property {number} [preload=0] Preload. Load low-resolution tiles up to `preload` levels. `0`
197
- * means no preloading.
198
- * @property {number} [cacheSize=512] The internal texture cache size. This needs to be large enough to render
199
- * two zoom levels worth of tiles.
200
- * @property {string} [className='ol-layer'] A CSS class name to set to the layer element.
201
- */
202
- /**
203
- * @classdesc
204
- * Renders assets from a STAC Item.
205
- *
206
- * @extends WebGLTileLayer
207
- * @api
208
- */
209
- declare class STACLayer extends WebGLTileLayer {
210
- /**
211
- * @param {Options} options Layer options.
212
- */
213
- constructor(options: Options);
214
- /**
215
- * @type {AssetSelector}
216
- * @private
217
- */
218
- private assetSelector_;
219
- /**
220
- * @type {function(Item, SourceOptions):(SourceOptions|Promise<SourceOptions>)}
221
- * @private
222
- */
223
- private getSourceOptions_;
224
- /**
225
- * @type {Item}
226
- * @private
227
- */
228
- private item_;
229
- /**
230
- * @param {Error} error The error.
231
- * @private
232
- */
233
- private handleError_;
234
- /**
235
- * @param {Item} item The item data.
236
- * @return {Promise} Resolves when complete.
237
- * @private
238
- */
239
- private configure_;
240
- /**
241
- * @param {Array<Asset>} assets The assets to render.
242
- * @private
243
- */
244
- private updateSource_;
245
- /**
246
- * Update the assets to be rendered.
247
- * @param {Array<string>} keys Asset keys.
248
- */
249
- setAssets(keys: Array<string>): void;
250
- /**
251
- * Get the item metadata.
252
- * @return {Item} The item.
253
- */
254
- getItem(): Item;
255
- }
256
- import WebGLTileLayer from "./WebGLTile.js";
257
- //# sourceMappingURL=STAC.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"STAC.d.ts","sourceRoot":"","sources":["STAC.js"],"names":[],"mappings":";;;;;UAYc,MAAM;;;;kBACN,MAAM;;;;QACN,MAAM;;;;cACN,OAAO,SAAS,EAAE,OAAO,GAAC,IAAI;;;;;;;;;;;;WAG9B,MAAM,IAAI,CAAC;;;;;YACJ,MAAM,GAAE,KAAK;;;;;gBACpB,MAAM;;;;;;UAKN,MAAM;;;;SACN,MAAM;;;;;;;;;;;;;;UAON,MAAM;;;;;;;;;;;;;;;;;;4BAQP,OAAO,sBAAsB,EAAE,OAAO;;QA+FtB,MAAM,GAAE,KAAK;MAAG,MAAM,KAAK,CAAC;;;;;;;;;;;;;;;;;;;;;+BAUlC,IAAI,QAAE,aAAa,KAAE,CAAC,aAAa,GAAC,QAAQ,aAAa,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAXlF;;GAEG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH;;;;;;GAMG;AACH;IACE;;OAEG;IACH,qBAFW,OAAO,EAmDjB;IAvCC;;;OAGG;IACH,uBAAmB;IASnB;;;OAGG;IACH,0BAAiD;IAEjD;;;OAGG;IACH,cAAU;IAkBZ;;;OAGG;IACH,qBAGC;IAED;;;;OAIG;IACH,mBAIC;IAED;;;OAGG;IACH,sBAgCC;IAED;;;OAGG;IACH,gBAFW,MAAM,MAAM,CAAC,QAKvB;IAED;;;OAGG;IACH,WAFY,IAAI,CAIf;CACF"}