@cesium/engine 20.0.2-ion.0 → 21.0.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 (182) hide show
  1. package/Build/ThirdParty/Workers/zip-web-worker.js +637 -0
  2. package/Build/Workers/{chunk-WZKTQZUW.js → chunk-2T4WAVWX.js} +6 -6
  3. package/Build/Workers/{chunk-6LULWCX3.js → chunk-3G5XEUPY.js} +1 -1
  4. package/Build/Workers/{chunk-OIMV4OE5.js → chunk-3MSNTCHW.js} +9 -9
  5. package/Build/Workers/{chunk-VZNF2GT7.js → chunk-3OPG2FGI.js} +4 -4
  6. package/Build/Workers/{chunk-MTBXKKSQ.js → chunk-3PUG3T2H.js} +12 -12
  7. package/Build/Workers/{chunk-XWRUYDF6.js → chunk-4PH27XAL.js} +2 -2
  8. package/Build/Workers/{chunk-P2V7PVDH.js → chunk-4VJYMLR6.js} +8 -8
  9. package/Build/Workers/{chunk-MFXTB5I4.js → chunk-5B3PGBQW.js} +11 -11
  10. package/Build/Workers/{chunk-USK6ZAY2.js → chunk-5GHCWGC4.js} +1 -1
  11. package/Build/Workers/{chunk-AHFTST3Q.js → chunk-5PEQUMCB.js} +12 -12
  12. package/Build/Workers/{chunk-23B3EYUM.js → chunk-64WSG7AT.js} +4 -4
  13. package/Build/Workers/{chunk-CEA3L7M7.js → chunk-6J6WGCWP.js} +4 -4
  14. package/Build/Workers/{chunk-VSMKMGX4.js → chunk-75B34CC6.js} +5 -5
  15. package/Build/Workers/{chunk-IS5FETN7.js → chunk-7PLX65MV.js} +5 -5
  16. package/Build/Workers/{chunk-FNUSHLOY.js → chunk-AR2FUSG6.js} +1 -1
  17. package/Build/Workers/{chunk-VLGVUVJY.js → chunk-ARYRHDEB.js} +6 -6
  18. package/Build/Workers/{chunk-FHLPYFIW.js → chunk-B7INTBBB.js} +13 -13
  19. package/Build/Workers/{chunk-BHAATGZA.js → chunk-BDPSQXLX.js} +5 -5
  20. package/Build/Workers/{chunk-QZGZIAK2.js → chunk-BU4CGMHO.js} +6 -6
  21. package/Build/Workers/{chunk-YNPZU55A.js → chunk-BUBVUXDO.js} +6 -6
  22. package/Build/Workers/{chunk-LS63ERFB.js → chunk-CF72FAKC.js} +4 -4
  23. package/Build/Workers/{chunk-D4XRQNUO.js → chunk-DJ4ROETJ.js} +5 -5
  24. package/Build/Workers/{chunk-ABTG74AR.js → chunk-E5XCZVIY.js} +1 -1
  25. package/Build/Workers/{chunk-AFKNTEMH.js → chunk-EAYW4CFP.js} +16 -16
  26. package/Build/Workers/{chunk-YXTWHLJA.js → chunk-EHFMZFVC.js} +4 -4
  27. package/Build/Workers/{chunk-H7HFDM3G.js → chunk-FFCKCQPK.js} +5 -5
  28. package/Build/Workers/{chunk-V6ZGOX4I.js → chunk-GKCZ2G36.js} +7 -7
  29. package/Build/Workers/{chunk-VODCZKV2.js → chunk-HJ7IZBEI.js} +4 -4
  30. package/Build/Workers/{chunk-66MGJQFZ.js → chunk-JJZWDROM.js} +2 -2
  31. package/Build/Workers/{chunk-F4PS6RFF.js → chunk-JUOEBO4F.js} +10 -10
  32. package/Build/Workers/{chunk-WORBFT5H.js → chunk-K4IDXMIZ.js} +9 -9
  33. package/Build/Workers/{chunk-Q3OWKSC5.js → chunk-LL6HN3W4.js} +10 -10
  34. package/Build/Workers/{chunk-YUHWFX5H.js → chunk-LNTUIO55.js} +2 -2
  35. package/Build/Workers/{chunk-VA7LWA5Q.js → chunk-LWOCFJEH.js} +9 -9
  36. package/Build/Workers/{chunk-5DF5RVIO.js → chunk-MMUISYW4.js} +16 -16
  37. package/Build/Workers/{chunk-K6THSIDU.js → chunk-MXYW4BQ3.js} +2 -2
  38. package/Build/Workers/{chunk-X55ZOYMS.js → chunk-N6DVKXZD.js} +12 -12
  39. package/Build/Workers/{chunk-NKKNQMEH.js → chunk-NP46ZIBY.js} +3 -3
  40. package/Build/Workers/{chunk-QID3DXQA.js → chunk-OW6F6CPZ.js} +7 -7
  41. package/Build/Workers/{chunk-CYC7JX3P.js → chunk-P6OAOFBU.js} +8 -8
  42. package/Build/Workers/{chunk-FYYP46TF.js → chunk-PXDMWXO5.js} +2 -2
  43. package/Build/Workers/{chunk-TZDR2BAP.js → chunk-QS7623NH.js} +6 -6
  44. package/Build/Workers/{chunk-D5X2LOJ2.js → chunk-ROH45IXJ.js} +7 -7
  45. package/Build/Workers/{chunk-UR36KLNW.js → chunk-S2P6LCIB.js} +4 -4
  46. package/Build/Workers/{chunk-Z2W7ZIGV.js → chunk-S4NZVXU6.js} +2 -2
  47. package/Build/Workers/{chunk-YSDOO7AG.js → chunk-SGGO5WVA.js} +5 -5
  48. package/Build/Workers/{chunk-H5IQLAJP.js → chunk-TG7N7TPY.js} +47 -50
  49. package/Build/Workers/{chunk-XIDMFHR4.js → chunk-TUZQG4RW.js} +14 -14
  50. package/Build/Workers/{chunk-JVG6T2WE.js → chunk-UHVE7V65.js} +12 -12
  51. package/Build/Workers/{chunk-FAQ2XNFV.js → chunk-UY2HVPDL.js} +5 -5
  52. package/Build/Workers/{chunk-CUU3WGXJ.js → chunk-YNLPRFUQ.js} +6 -6
  53. package/Build/Workers/{chunk-X6GXYB3M.js → chunk-ZYOHBCCE.js} +1 -1
  54. package/Build/Workers/combineGeometry.js +21 -21
  55. package/Build/Workers/createBoxGeometry.js +15 -15
  56. package/Build/Workers/createBoxOutlineGeometry.js +13 -13
  57. package/Build/Workers/createCircleGeometry.js +23 -23
  58. package/Build/Workers/createCircleOutlineGeometry.js +16 -16
  59. package/Build/Workers/createCoplanarPolygonGeometry.js +30 -30
  60. package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +28 -28
  61. package/Build/Workers/createCorridorGeometry.js +26 -26
  62. package/Build/Workers/createCorridorOutlineGeometry.js +25 -25
  63. package/Build/Workers/createCylinderGeometry.js +17 -17
  64. package/Build/Workers/createCylinderOutlineGeometry.js +15 -15
  65. package/Build/Workers/createEllipseGeometry.js +23 -23
  66. package/Build/Workers/createEllipseOutlineGeometry.js +16 -16
  67. package/Build/Workers/createEllipsoidGeometry.js +16 -16
  68. package/Build/Workers/createEllipsoidOutlineGeometry.js +15 -15
  69. package/Build/Workers/createFrustumGeometry.js +15 -15
  70. package/Build/Workers/createFrustumOutlineGeometry.js +15 -15
  71. package/Build/Workers/createGeometry.js +21 -21
  72. package/Build/Workers/createGroundPolylineGeometry.js +19 -19
  73. package/Build/Workers/createPlaneGeometry.js +13 -13
  74. package/Build/Workers/createPlaneOutlineGeometry.js +12 -12
  75. package/Build/Workers/createPolygonGeometry.js +29 -29
  76. package/Build/Workers/createPolygonOutlineGeometry.js +27 -27
  77. package/Build/Workers/createPolylineGeometry.js +22 -22
  78. package/Build/Workers/createPolylineVolumeGeometry.js +28 -28
  79. package/Build/Workers/createPolylineVolumeOutlineGeometry.js +24 -24
  80. package/Build/Workers/createRectangleGeometry.js +24 -24
  81. package/Build/Workers/createRectangleOutlineGeometry.js +17 -17
  82. package/Build/Workers/createSimplePolylineGeometry.js +20 -20
  83. package/Build/Workers/createSphereGeometry.js +16 -16
  84. package/Build/Workers/createSphereOutlineGeometry.js +15 -15
  85. package/Build/Workers/createTaskProcessorWorker.js +3 -3
  86. package/Build/Workers/createVectorTileClampedPolylines.js +12 -12
  87. package/Build/Workers/createVectorTileGeometries.js +21 -21
  88. package/Build/Workers/createVectorTilePoints.js +11 -11
  89. package/Build/Workers/createVectorTilePolygons.js +19 -19
  90. package/Build/Workers/createVectorTilePolylines.js +12 -12
  91. package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +19 -19
  92. package/Build/Workers/createVerticesFromHeightmap.js +19 -19
  93. package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +16 -16
  94. package/Build/Workers/createWallGeometry.js +21 -21
  95. package/Build/Workers/createWallOutlineGeometry.js +20 -20
  96. package/Build/Workers/decodeDraco.js +10 -10
  97. package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +5 -5
  98. package/Build/Workers/decodeI3S.js +9 -9
  99. package/Build/Workers/gaussianSplatSorter.js +4 -4
  100. package/Build/Workers/gaussianSplatTextureGenerator.js +4 -4
  101. package/Build/Workers/transcodeKTX2.js +6 -6
  102. package/Build/Workers/transferTypedArrayTest.js +1 -1
  103. package/Build/Workers/upsampleQuantizedTerrainMesh.js +19 -19
  104. package/Source/Core/Event.js +41 -49
  105. package/Source/Core/GoogleMaps.js +2 -2
  106. package/Source/Core/Ion.js +1 -1
  107. package/Source/Core/IonResource.js +30 -4
  108. package/Source/Core/Resource.js +5 -1
  109. package/Source/DataSources/KmlDataSource.js +62 -63
  110. package/Source/DataSources/exportKml.js +27 -30
  111. package/Source/Scene/ArcGisMapService.js +1 -1
  112. package/Source/Scene/Azure2DImageryProvider.js +308 -0
  113. package/Source/Scene/Billboard.js +4 -0
  114. package/Source/Scene/BillboardCollection.js +9 -2
  115. package/Source/Scene/ClippingPlaneCollection.js +3 -3
  116. package/Source/Scene/ClippingPolygon.js +91 -2
  117. package/Source/Scene/CreditDisplay.js +1 -1
  118. package/Source/Scene/GaussianSplat3DTileContent.js +54 -9
  119. package/Source/Scene/GaussianSplatPrimitive.js +49 -50
  120. package/Source/Scene/Google2DImageryProvider.js +614 -0
  121. package/Source/Scene/IonImageryProvider.js +22 -1
  122. package/Source/Scene/LabelCollection.js +1 -0
  123. package/Source/Scene/Material.js +248 -80
  124. package/Source/Scene/Primitive.js +6 -0
  125. package/Source/Scene/PrimitiveState.js +123 -0
  126. package/Source/Scene/Scene.js +2 -2
  127. package/Source/Scene/VoxelBoundsCollection.js +494 -0
  128. package/Source/Scene/VoxelBoxShape.js +236 -101
  129. package/Source/Scene/VoxelCylinderShape.js +315 -204
  130. package/Source/Scene/VoxelEllipsoidShape.js +402 -119
  131. package/Source/Scene/VoxelPrimitive.js +119 -84
  132. package/Source/Scene/VoxelRenderResources.js +17 -10
  133. package/Source/Scene/VoxelShape.js +21 -6
  134. package/Source/Scene/buildVoxelDrawCommands.js +61 -20
  135. package/Source/Scene/createGooglePhotorealistic3DTileset.js +1 -1
  136. package/Source/Scene/getClippingFunction.js +79 -88
  137. package/Source/Shaders/BillboardCollectionVS.glsl +2 -0
  138. package/Source/Shaders/BillboardCollectionVS.js +2 -0
  139. package/Source/Shaders/Voxels/IntersectBox.glsl +20 -33
  140. package/Source/Shaders/Voxels/IntersectBox.js +20 -33
  141. package/Source/Shaders/Voxels/IntersectCylinder.glsl +28 -32
  142. package/Source/Shaders/Voxels/IntersectCylinder.js +28 -32
  143. package/Source/Shaders/Voxels/IntersectDepth.glsl +1 -4
  144. package/Source/Shaders/Voxels/IntersectDepth.js +1 -4
  145. package/Source/Shaders/Voxels/IntersectEllipsoid.glsl +12 -20
  146. package/Source/Shaders/Voxels/IntersectEllipsoid.js +12 -20
  147. package/Source/Shaders/Voxels/IntersectLongitude.glsl +21 -9
  148. package/Source/Shaders/Voxels/IntersectLongitude.js +21 -9
  149. package/Source/Shaders/Voxels/{IntersectClippingPlanes.glsl → IntersectPlane.glsl} +5 -3
  150. package/Source/Shaders/Voxels/{IntersectClippingPlanes.js → IntersectPlane.js} +5 -3
  151. package/Source/Shaders/Voxels/Intersection.glsl +3 -3
  152. package/Source/Shaders/Voxels/Intersection.js +3 -3
  153. package/Source/Shaders/Voxels/Octree.glsl +46 -51
  154. package/Source/Shaders/Voxels/Octree.js +46 -51
  155. package/Source/Shaders/Voxels/VoxelFS.glsl +50 -48
  156. package/Source/Shaders/Voxels/VoxelFS.js +50 -48
  157. package/Source/Shaders/Voxels/VoxelUtils.glsl +0 -19
  158. package/Source/Shaders/Voxels/VoxelUtils.js +0 -19
  159. package/Source/Shaders/Voxels/convertLocalToBoxUv.glsl +30 -0
  160. package/Source/Shaders/Voxels/convertLocalToBoxUv.js +32 -0
  161. package/Source/Shaders/Voxels/convertLocalToCylinderUv.glsl +97 -0
  162. package/Source/Shaders/Voxels/convertLocalToCylinderUv.js +99 -0
  163. package/Source/Shaders/Voxels/convertLocalToEllipsoidUv.glsl +193 -0
  164. package/Source/Shaders/Voxels/convertLocalToEllipsoidUv.js +195 -0
  165. package/Source/ThirdParty/Workers/zip-web-worker.js +1 -0
  166. package/Source/ThirdParty/zip-module.wasm +0 -0
  167. package/index.d.ts +317 -14
  168. package/index.js +141 -139
  169. package/package.json +2 -2
  170. package/Build/ThirdParty/Workers/pako_deflate.min.js +0 -503
  171. package/Build/ThirdParty/Workers/pako_inflate.min.js +0 -698
  172. package/Build/ThirdParty/Workers/z-worker-pako.js +0 -601
  173. package/Source/Core/defaultValue.js +0 -48
  174. package/Source/Shaders/Voxels/convertUvToBox.glsl +0 -45
  175. package/Source/Shaders/Voxels/convertUvToBox.js +0 -46
  176. package/Source/Shaders/Voxels/convertUvToCylinder.glsl +0 -99
  177. package/Source/Shaders/Voxels/convertUvToCylinder.js +0 -101
  178. package/Source/Shaders/Voxels/convertUvToEllipsoid.glsl +0 -139
  179. package/Source/Shaders/Voxels/convertUvToEllipsoid.js +0 -141
  180. package/Source/ThirdParty/Workers/pako_deflate.min.js +0 -2
  181. package/Source/ThirdParty/Workers/pako_inflate.min.js +0 -2
  182. package/Source/ThirdParty/Workers/z-worker-pako.js +0 -1
@@ -42,7 +42,13 @@ import LabelStyle from "../Scene/LabelStyle.js";
42
42
  import SceneMode from "../Scene/SceneMode.js";
43
43
  import Autolinker from "autolinker";
44
44
  import Uri from "urijs";
45
- import * as zip from "@zip.js/zip.js/lib/zip-no-worker.js";
45
+ import {
46
+ configure,
47
+ BlobReader,
48
+ Data64URIWriter,
49
+ TextWriter,
50
+ ZipReader,
51
+ } from "@zip.js/zip.js/lib/zip-core.js";
46
52
  import getElement from "./getElement.js";
47
53
  import BillboardGraphics from "./BillboardGraphics.js";
48
54
  import CompositePositionProperty from "./CompositePositionProperty.js";
@@ -390,24 +396,18 @@ function removeDuplicateNamespaces(text) {
390
396
  return text;
391
397
  }
392
398
 
393
- function loadXmlFromZip(entry, uriResolver) {
394
- return Promise.resolve(entry.getData(new zip.TextWriter())).then(
395
- function (text) {
396
- text = insertNamespaces(text);
397
- text = removeDuplicateNamespaces(text);
398
- uriResolver.kml = parser.parseFromString(text, "application/xml");
399
- },
400
- );
399
+ async function loadXmlFromZip(entry, uriResolver) {
400
+ let text = await entry.getData(new TextWriter());
401
+ text = insertNamespaces(text);
402
+ text = removeDuplicateNamespaces(text);
403
+ uriResolver.kml = parser.parseFromString(text, "application/xml");
401
404
  }
402
405
 
403
- function loadDataUriFromZip(entry, uriResolver) {
406
+ async function loadDataUriFromZip(entry, uriResolver) {
404
407
  const mimeType =
405
408
  MimeTypes.detectFromFilename(entry.filename) ?? "application/octet-stream";
406
- return Promise.resolve(entry.getData(new zip.Data64URIWriter(mimeType))).then(
407
- function (dataUri) {
408
- uriResolver[entry.filename] = dataUri;
409
- },
410
- );
409
+ const dataUri = await entry.getData(new Data64URIWriter(mimeType));
410
+ uriResolver[entry.filename] = dataUri;
411
411
  }
412
412
 
413
413
  function embedDataUris(div, elementType, attributeName, uriResolver) {
@@ -3287,69 +3287,68 @@ function loadKml(
3287
3287
  });
3288
3288
  }
3289
3289
 
3290
- function loadKmz(
3290
+ async function loadKmz(
3291
3291
  dataSource,
3292
3292
  entityCollection,
3293
3293
  blob,
3294
3294
  sourceResource,
3295
3295
  screenOverlayContainer,
3296
3296
  ) {
3297
- const zWorkerUrl = buildModuleUrl("ThirdParty/Workers/z-worker-pako.js");
3298
- zip.configure({
3299
- workerScripts: {
3300
- deflate: [zWorkerUrl, "./pako_deflate.min.js"],
3301
- inflate: [zWorkerUrl, "./pako_inflate.min.js"],
3302
- },
3297
+ const zWorkerUri = buildModuleUrl("ThirdParty/Workers/zip-web-worker.js");
3298
+ const zWasmUri = buildModuleUrl("ThirdParty/zip-module.wasm");
3299
+ configure({
3300
+ workerURI: zWorkerUri,
3301
+ wasmURI: zWasmUri,
3303
3302
  });
3304
3303
 
3305
- const reader = new zip.ZipReader(new zip.BlobReader(blob));
3306
- return Promise.resolve(reader.getEntries()).then(function (entries) {
3307
- const promises = [];
3308
- const uriResolver = {};
3309
- let docEntry;
3310
- for (let i = 0; i < entries.length; i++) {
3311
- const entry = entries[i];
3312
- if (!entry.directory) {
3313
- if (/\.kml$/i.test(entry.filename)) {
3314
- // We use the first KML document we come across
3315
- // https://developers.google.com/kml/documentation/kmzarchives
3316
- // Unless we come across a .kml file at the root of the archive because GE does this
3317
- if (!defined(docEntry) || !/\//i.test(entry.filename)) {
3318
- if (defined(docEntry)) {
3319
- // We found one at the root so load the initial kml as a data uri
3320
- promises.push(loadDataUriFromZip(docEntry, uriResolver));
3321
- }
3322
- docEntry = entry;
3323
- } else {
3324
- // Wasn't the first kml and wasn't at the root
3325
- promises.push(loadDataUriFromZip(entry, uriResolver));
3304
+ const reader = new ZipReader(new BlobReader(blob));
3305
+ const entries = await reader.getEntries();
3306
+
3307
+ const promises = [];
3308
+ const uriResolver = {};
3309
+ let docEntry;
3310
+ for (let i = 0; i < entries.length; i++) {
3311
+ const entry = entries[i];
3312
+ if (!entry.directory) {
3313
+ if (/\.kml$/i.test(entry.filename)) {
3314
+ // We use the first KML document we come across
3315
+ // https://developers.google.com/kml/documentation/kmzarchives
3316
+ // Unless we come across a .kml file at the root of the archive because GE does this
3317
+ if (!defined(docEntry) || !/\//i.test(entry.filename)) {
3318
+ if (defined(docEntry)) {
3319
+ // We found one at the root so load the initial kml as a data uri
3320
+ promises.push(loadDataUriFromZip(docEntry, uriResolver));
3326
3321
  }
3322
+ docEntry = entry;
3327
3323
  } else {
3324
+ // Wasn't the first kml and wasn't at the root
3328
3325
  promises.push(loadDataUriFromZip(entry, uriResolver));
3329
3326
  }
3327
+ } else {
3328
+ promises.push(loadDataUriFromZip(entry, uriResolver));
3330
3329
  }
3331
3330
  }
3331
+ }
3332
3332
 
3333
- // Now load the root KML document
3334
- if (defined(docEntry)) {
3335
- promises.push(loadXmlFromZip(docEntry, uriResolver));
3336
- }
3337
- return Promise.all(promises).then(function () {
3338
- reader.close();
3339
- if (!defined(uriResolver.kml)) {
3340
- throw new RuntimeError("KMZ file does not contain a KML document.");
3341
- }
3342
- uriResolver.keys = Object.keys(uriResolver);
3343
- return loadKml(
3344
- dataSource,
3345
- entityCollection,
3346
- uriResolver.kml,
3347
- sourceResource,
3348
- uriResolver,
3349
- screenOverlayContainer,
3350
- );
3351
- });
3352
- });
3333
+ // Now load the root KML document
3334
+ if (defined(docEntry)) {
3335
+ promises.push(loadXmlFromZip(docEntry, uriResolver));
3336
+ }
3337
+ await Promise.all(promises);
3338
+ reader.close();
3339
+ if (!defined(uriResolver.kml)) {
3340
+ throw new RuntimeError("KMZ file does not contain a KML document.");
3341
+ }
3342
+ uriResolver.keys = Object.keys(uriResolver);
3343
+
3344
+ return loadKml(
3345
+ dataSource,
3346
+ entityCollection,
3347
+ uriResolver.kml,
3348
+ sourceResource,
3349
+ uriResolver,
3350
+ screenOverlayContainer,
3351
+ );
3353
3352
  }
3354
3353
 
3355
3354
  function load(dataSource, entityCollection, data, options) {
@@ -20,7 +20,13 @@ import TimeIntervalCollection from "../Core/TimeIntervalCollection.js";
20
20
  import HeightReference from "../Scene/HeightReference.js";
21
21
  import HorizontalOrigin from "../Scene/HorizontalOrigin.js";
22
22
  import VerticalOrigin from "../Scene/VerticalOrigin.js";
23
- import * as zip from "@zip.js/zip.js/lib/zip-no-worker.js";
23
+ import {
24
+ configure,
25
+ BlobReader,
26
+ BlobWriter,
27
+ TextReader,
28
+ ZipWriter,
29
+ } from "@zip.js/zip.js/lib/zip-core.js";
24
30
  import BillboardGraphics from "./BillboardGraphics.js";
25
31
  import CompositePositionProperty from "./CompositePositionProperty.js";
26
32
  import ModelGraphics from "./ModelGraphics.js";
@@ -322,43 +328,34 @@ function exportKml(options) {
322
328
  });
323
329
  }
324
330
 
325
- function createKmz(kmlString, externalFiles) {
326
- const zWorkerUrl = buildModuleUrl("ThirdParty/Workers/z-worker-pako.js");
327
- zip.configure({
328
- workerScripts: {
329
- deflate: [zWorkerUrl, "./pako_deflate.min.js"],
330
- inflate: [zWorkerUrl, "./pako_inflate.min.js"],
331
- },
331
+ async function createKmz(kmlString, externalFiles) {
332
+ const zWorkerUri = buildModuleUrl("ThirdParty/Workers/zip-web-worker.js");
333
+ const zWasmUri = buildModuleUrl("ThirdParty/zip-module.wasm");
334
+ configure({
335
+ workerURI: zWorkerUri,
336
+ wasmURI: zWasmUri,
332
337
  });
333
- const blobWriter = new zip.BlobWriter();
334
- const writer = new zip.ZipWriter(blobWriter);
338
+ const blobWriter = new BlobWriter("application/vnd.google-earth.kmz");
339
+ const writer = new ZipWriter(blobWriter);
340
+
335
341
  // We need to only write one file at a time so the zip doesn't get corrupted
336
- return writer
337
- .add("doc.kml", new zip.TextReader(kmlString))
338
- .then(function () {
339
- const keys = Object.keys(externalFiles);
340
- return addExternalFilesToZip(writer, keys, externalFiles, 0);
341
- })
342
- .then(function () {
343
- return writer.close();
344
- })
345
- .then(function (blob) {
346
- return {
347
- kmz: blob,
348
- };
349
- });
342
+ await writer.add("doc.kml", new TextReader(kmlString));
343
+ const keys = Object.keys(externalFiles);
344
+ await addExternalFilesToZip(writer, keys, externalFiles, 0);
345
+ await writer.close();
346
+ const blob = await blobWriter.getData();
347
+ return {
348
+ kmz: blob,
349
+ };
350
350
  }
351
351
 
352
- function addExternalFilesToZip(writer, keys, externalFiles, index) {
352
+ async function addExternalFilesToZip(writer, keys, externalFiles, index) {
353
353
  if (keys.length === index) {
354
354
  return;
355
355
  }
356
356
  const filename = keys[index];
357
- return writer
358
- .add(filename, new zip.BlobReader(externalFiles[filename]))
359
- .then(function () {
360
- return addExternalFilesToZip(writer, keys, externalFiles, index + 1);
361
- });
357
+ await writer.add(filename, new BlobReader(externalFiles[filename]));
358
+ return addExternalFilesToZip(writer, keys, externalFiles, index + 1);
362
359
  }
363
360
 
364
361
  exportKml._createState = function (options) {
@@ -4,7 +4,7 @@ import Resource from "../Core/Resource.js";
4
4
 
5
5
  let defaultTokenCredit;
6
6
  const defaultAccessToken =
7
- "AAPTxy8BH1VEsoebNVZXo8HurEOF051kAEKlhkOhBEc9BmRXcPUeuOd6ZTh-Z86vRv6teqZdBYLUWIxB6HTYajPhFtAlXhMdqTg07UwlBQ59KbiReC5wCeOF4LzLTW4oaSPp-t4pEcJHnFePlnFcIPXM7R565gTy6f6fMuZAXPvUEuZSMf8dvTqHyV9-Zd9eZGWokDzKC4uEtHME7OeAk3oyZ7vzkjEo8fpuIfFw0sH8vQU.AT1_PLgWE6Lc";
7
+ "AAPTxy8BH1VEsoebNVZXo8HurEOF051kAEKlhkOhBEc9BmQqEeLjCLZBBnNm_y_K-Cs-tuPcsgUmlxDWvPdTmGIEhrihfZMTG77j2nmCeqeYCPAenHGG1YfJqJaeRLuy5YjARJcFLP2I_judomiDS-8A_LVZxWUObwIQNE5wcsQKxJl7RHiKm-81XRDuUJZXGqy9B4PwPxWkS-N9PZ7NmTT-sP6BOGn5ouiAN8dkxwNx3tA.AT1_BU0Co4D8";
8
8
  /**
9
9
  * Default options for accessing the ArcGIS image tile service.
10
10
  *
@@ -0,0 +1,308 @@
1
+ import Check from "../Core/Check.js";
2
+ import Credit from "../Core/Credit.js";
3
+ import defined from "../Core/defined.js";
4
+ import Resource from "../Core/Resource.js";
5
+ import IonResource from "../Core/IonResource.js";
6
+ import UrlTemplateImageryProvider from "./UrlTemplateImageryProvider.js";
7
+
8
+ const trailingSlashRegex = /\/$/;
9
+
10
+ /**
11
+ * @typedef {object} Azure2DImageryProvider.ConstructorOptions
12
+ *
13
+ * Initialization options for the Azure2DImageryProvider constructor
14
+ *
15
+ * @property {object} options Object with the following properties:
16
+ * @property {string} [options.url="https://atlas.microsoft.com/"] The Azure server url.
17
+ * @property {string} [options.tilesetId="microsoft.imagery"] The Azure tileset ID. Valid options are {@link microsoft.imagery}, {@link microsoft.base.road}, and {@link microsoft.base.labels.road}
18
+ * @property {string} options.subscriptionKey The public subscription key for the imagery.
19
+ * @property {Ellipsoid} [options.ellipsoid=Ellipsoid.default] The ellipsoid. If not specified, the default ellipsoid is used.
20
+ * @property {number} [options.minimumLevel=0] The minimum level-of-detail supported by the imagery provider. Take care when specifying
21
+ * this that the number of tiles at the minimum level is small, such as four or less. A larger number is likely
22
+ * to result in rendering problems.
23
+ * @property {number} [options.maximumLevel=22] The maximum level-of-detail supported by the imagery provider.
24
+ * @property {Rectangle} [options.rectangle=Rectangle.MAX_VALUE] The rectangle, in radians, covered by the image.
25
+ */
26
+
27
+ /**
28
+ * Provides 2D image tiles from Azure.
29
+ *
30
+ * @alias Azure2DImageryProvider
31
+ * @constructor
32
+ * @private
33
+ * @param {Azure2DImageryProvider.ConstructorOptions} options Object describing initialization options
34
+ *
35
+ * @example
36
+ * // Azure 2D imagery provider
37
+ * const azureImageryProvider = new Cesium.Azure2DImageryProvider({
38
+ * subscriptionKey: "subscription-key",
39
+ * tilesetId: "microsoft.base.road"
40
+ * });
41
+ */
42
+ function Azure2DImageryProvider(options) {
43
+ options = options ?? {};
44
+ options.maximumLevel = options.maximumLevel ?? 22;
45
+ options.minimumLevel = options.minimumLevel ?? 0;
46
+
47
+ const subscriptionKey =
48
+ options.subscriptionKey ?? options["subscription-key"];
49
+ //>>includeStart('debug', pragmas.debug);
50
+ Check.defined("options.tilesetId", options.tilesetId);
51
+ Check.defined("options.subscriptionKey", subscriptionKey);
52
+ //>>includeEnd('debug');
53
+
54
+ const resource =
55
+ options.url instanceof IonResource
56
+ ? options.url
57
+ : Resource.createIfNeeded(options.url ?? "https://atlas.microsoft.com/");
58
+
59
+ let templateUrl = resource.getUrlComponent();
60
+ if (!trailingSlashRegex.test(templateUrl)) {
61
+ templateUrl += "/";
62
+ }
63
+ templateUrl += `map/tile`;
64
+
65
+ resource.url = templateUrl;
66
+
67
+ resource.setQueryParameters({
68
+ "api-version": "2024-04-01",
69
+ tilesetId: options.tilesetId,
70
+ zoom: `{z}`,
71
+ x: `{x}`,
72
+ y: `{y}`,
73
+ "subscription-key": subscriptionKey,
74
+ });
75
+
76
+ let credit;
77
+ if (defined(options.credit)) {
78
+ credit = options.credit;
79
+ if (typeof credit === "string") {
80
+ credit = new Credit(credit);
81
+ }
82
+ }
83
+
84
+ const provider = new UrlTemplateImageryProvider({
85
+ ...options,
86
+ url: resource,
87
+ credit: credit,
88
+ });
89
+ provider._resource = resource;
90
+ this._imageryProvider = provider;
91
+
92
+ // This will be defined for ion resources
93
+ this._tileCredits = resource.credits;
94
+ }
95
+
96
+ Object.defineProperties(Azure2DImageryProvider.prototype, {
97
+ /**
98
+ * Gets the URL of the Azure 2D Imagery server.
99
+ * @memberof Azure2DImageryProvider.prototype
100
+ * @type {string}
101
+ * @readonly
102
+ */
103
+ url: {
104
+ get: function () {
105
+ return this._imageryProvider.url;
106
+ },
107
+ },
108
+
109
+ /**
110
+ * Gets the rectangle, in radians, of the imagery provided by the instance.
111
+ * @memberof Azure2DImageryProvider.prototype
112
+ * @type {Rectangle}
113
+ * @readonly
114
+ */
115
+ rectangle: {
116
+ get: function () {
117
+ return this._imageryProvider.rectangle;
118
+ },
119
+ },
120
+
121
+ /**
122
+ * Gets the width of each tile, in pixels.
123
+ * @memberof Azure2DImageryProvider.prototype
124
+ * @type {number}
125
+ * @readonly
126
+ */
127
+ tileWidth: {
128
+ get: function () {
129
+ return this._imageryProvider.tileWidth;
130
+ },
131
+ },
132
+
133
+ /**
134
+ * Gets the height of each tile, in pixels.
135
+ * @memberof Azure2DImageryProvider.prototype
136
+ * @type {number}
137
+ * @readonly
138
+ */
139
+ tileHeight: {
140
+ get: function () {
141
+ return this._imageryProvider.tileHeight;
142
+ },
143
+ },
144
+
145
+ /**
146
+ * Gets the maximum level-of-detail that can be requested.
147
+ * @memberof Azure2DImageryProvider.prototype
148
+ * @type {number|undefined}
149
+ * @readonly
150
+ */
151
+ maximumLevel: {
152
+ get: function () {
153
+ return this._imageryProvider.maximumLevel;
154
+ },
155
+ },
156
+
157
+ /**
158
+ * Gets the minimum level-of-detail that can be requested. Generally,
159
+ * a minimum level should only be used when the rectangle of the imagery is small
160
+ * enough that the number of tiles at the minimum level is small. An imagery
161
+ * provider with more than a few tiles at the minimum level will lead to
162
+ * rendering problems.
163
+ * @memberof Azure2DImageryProvider.prototype
164
+ * @type {number}
165
+ * @readonly
166
+ */
167
+ minimumLevel: {
168
+ get: function () {
169
+ return this._imageryProvider.minimumLevel;
170
+ },
171
+ },
172
+
173
+ /**
174
+ * Gets the tiling scheme used by the provider.
175
+ * @memberof Azure2DImageryProvider.prototype
176
+ * @type {TilingScheme}
177
+ * @readonly
178
+ */
179
+ tilingScheme: {
180
+ get: function () {
181
+ return this._imageryProvider.tilingScheme;
182
+ },
183
+ },
184
+
185
+ /**
186
+ * Gets the tile discard policy. If not undefined, the discard policy is responsible
187
+ * for filtering out "missing" tiles via its shouldDiscardImage function. If this function
188
+ * returns undefined, no tiles are filtered.
189
+ * @memberof Azure2DImageryProvider.prototype
190
+ * @type {TileDiscardPolicy}
191
+ * @readonly
192
+ */
193
+ tileDiscardPolicy: {
194
+ get: function () {
195
+ return this._imageryProvider.tileDiscardPolicy;
196
+ },
197
+ },
198
+
199
+ /**
200
+ * Gets an event that is raised when the imagery provider encounters an asynchronous error.. By subscribing
201
+ * to the event, you will be notified of the error and can potentially recover from it. Event listeners
202
+ * are passed an instance of {@link TileProviderError}.
203
+ * @memberof Azure2DImageryProvider.prototype
204
+ * @type {Event}
205
+ * @readonly
206
+ */
207
+ errorEvent: {
208
+ get: function () {
209
+ return this._imageryProvider.errorEvent;
210
+ },
211
+ },
212
+
213
+ /**
214
+ * Gets the credit to display when this imagery provider is active. Typically this is used to credit
215
+ * the source of the imagery.
216
+ * @memberof Azure2DImageryProvider.prototype
217
+ * @type {Credit}
218
+ * @readonly
219
+ */
220
+ credit: {
221
+ get: function () {
222
+ return this._imageryProvider.credit;
223
+ },
224
+ },
225
+
226
+ /**
227
+ * Gets the proxy used by this provider.
228
+ * @memberof Azure2DImageryProvider.prototype
229
+ * @type {Proxy}
230
+ * @readonly
231
+ */
232
+ proxy: {
233
+ get: function () {
234
+ return this._imageryProvider.proxy;
235
+ },
236
+ },
237
+
238
+ /**
239
+ * Gets a value indicating whether or not the images provided by this imagery provider
240
+ * include an alpha channel. If this property is false, an alpha channel, if present, will
241
+ * be ignored. If this property is true, any images without an alpha channel will be treated
242
+ * as if their alpha is 1.0 everywhere. When this property is false, memory usage
243
+ * and texture upload time are reduced.
244
+ * @memberof Azure2DImageryProvider.prototype
245
+ * @type {boolean}
246
+ * @readonly
247
+ */
248
+ hasAlphaChannel: {
249
+ get: function () {
250
+ return this._imageryProvider.hasAlphaChannel;
251
+ },
252
+ },
253
+ });
254
+
255
+ /**
256
+ * Gets the credits to be displayed when a given tile is displayed.
257
+ *
258
+ * @param {number} x The tile X coordinate.
259
+ * @param {number} y The tile Y coordinate.
260
+ * @param {number} level The tile level;
261
+ * @returns {Credit[]|undefined} The credits to be displayed when the tile is displayed.
262
+ */
263
+ Azure2DImageryProvider.prototype.getTileCredits = function (x, y, level) {
264
+ return this._imageryProvider.getTileCredits(x, y, level);
265
+ };
266
+
267
+ /**
268
+ * Requests the image for a given tile.
269
+ *
270
+ * @param {number} x The tile X coordinate.
271
+ * @param {number} y The tile Y coordinate.
272
+ * @param {number} level The tile level.
273
+ * @param {Request} [request] The request object. Intended for internal use only.
274
+ * @returns {Promise<ImageryTypes>|undefined} A promise for the image that will resolve when the image is available, or
275
+ * undefined if there are too many active requests to the server, and the request should be retried later.
276
+ */
277
+ Azure2DImageryProvider.prototype.requestImage = function (
278
+ x,
279
+ y,
280
+ level,
281
+ request,
282
+ ) {
283
+ return this._imageryProvider.requestImage(x, y, level, request);
284
+ };
285
+
286
+ /**
287
+ * Picking features is not currently supported by this imagery provider, so this function simply returns
288
+ * undefined.
289
+ *
290
+ * @param {number} x The tile X coordinate.
291
+ * @param {number} y The tile Y coordinate.
292
+ * @param {number} level The tile level.
293
+ * @param {number} longitude The longitude at which to pick features.
294
+ * @param {number} latitude The latitude at which to pick features.
295
+ * @return {undefined} Undefined since picking is not supported.
296
+ */
297
+ Azure2DImageryProvider.prototype.pickFeatures = function (
298
+ x,
299
+ y,
300
+ level,
301
+ longitude,
302
+ latitude,
303
+ ) {
304
+ return undefined;
305
+ };
306
+
307
+ // Exposed for tests
308
+ export default Azure2DImageryProvider;
@@ -227,6 +227,9 @@ function Billboard(options, billboardCollection) {
227
227
  this._updateClamping();
228
228
 
229
229
  this._splitDirection = options.splitDirection ?? SplitDirection.NONE;
230
+ // Primarily used by labels to indicate that the position is derived from the parent.
231
+ // and expensive operations like clamping can be skipped.
232
+ this._positionFromParent = false;
230
233
  }
231
234
 
232
235
  const SHOW_INDEX = (Billboard.SHOW_INDEX = 0);
@@ -1147,6 +1150,7 @@ Billboard._updateClamping = function (collection, owner) {
1147
1150
 
1148
1151
  if (
1149
1152
  owner._heightReference === HeightReference.NONE ||
1153
+ owner._positionFromParent ||
1150
1154
  !defined(owner._position)
1151
1155
  ) {
1152
1156
  return;
@@ -1020,13 +1020,20 @@ function writeCompressedAttrib0(
1020
1020
  Math.floor(
1021
1021
  CesiumMath.clamp(pixelOffsetY, -UPPER_BOUND, UPPER_BOUND) + UPPER_BOUND,
1022
1022
  ) * LEFT_SHIFT8;
1023
+
1024
+ // We scale `translate` by LEFT_SHIFT2 before encoding it (and unscale after decoding in the shader)
1025
+ // to preserve some subpixel precision (1 / 4 = 0.25 pixels). This mitigates rounding errors in aligning glyphs.
1026
+ // The cost of increasing this scaling factor is that it decreases the range of representable `translate` values
1027
+ // by the same scaling factor. Value must be kept in sync with the shader.
1023
1028
  let compressed2 =
1024
1029
  Math.floor(
1025
- CesiumMath.clamp(translateX, -UPPER_BOUND, UPPER_BOUND) + UPPER_BOUND,
1030
+ CesiumMath.clamp(translateX * LEFT_SHIFT2, -UPPER_BOUND, UPPER_BOUND) +
1031
+ UPPER_BOUND,
1026
1032
  ) * LEFT_SHIFT8;
1027
1033
 
1028
1034
  const tempTanslateY =
1029
- (CesiumMath.clamp(translateY, -UPPER_BOUND, UPPER_BOUND) + UPPER_BOUND) *
1035
+ (CesiumMath.clamp(translateY * LEFT_SHIFT2, -UPPER_BOUND, UPPER_BOUND) +
1036
+ UPPER_BOUND) *
1030
1037
  RIGHT_SHIFT8;
1031
1038
  const upperTranslateY = Math.floor(tempTanslateY);
1032
1039
  const lowerTranslateY = Math.floor(
@@ -106,7 +106,7 @@ function ClippingPlaneCollection(options) {
106
106
  * An event triggered when a new clipping plane is added to the collection. Event handlers
107
107
  * are passed the new plane and the index at which it was added.
108
108
  * @type {Event}
109
- * @default Event()
109
+ * @readonly
110
110
  */
111
111
  this.planeAdded = new Event();
112
112
 
@@ -114,7 +114,7 @@ function ClippingPlaneCollection(options) {
114
114
  * An event triggered when a new clipping plane is removed from the collection. Event handlers
115
115
  * are passed the new plane and the index from which it was removed.
116
116
  * @type {Event}
117
- * @default Event()
117
+ * @readonly
118
118
  */
119
119
  this.planeRemoved = new Event();
120
120
 
@@ -472,7 +472,7 @@ ClippingPlaneCollection.prototype.update = function (frameState) {
472
472
  // Compute texture requirements for current planes
473
473
  // In RGBA FLOAT, A plane is 4 floats packed to a RGBA.
474
474
  // In RGBA UNSIGNED_BYTE, A plane is a float in [0, 1) packed to RGBA and an Oct32 quantized normal,
475
- // so 8 bits or 2 pixels in RGBA.
475
+ // so 8 bytes or 2 pixels in RGBA.
476
476
  const pixelsNeeded = useFloatTexture ? this.length : this.length * 2;
477
477
 
478
478
  if (defined(clippingPlanesTexture)) {