@cesium/engine 26.0.0 → 26.1.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 (160) hide show
  1. package/Build/Workers/{chunk-EF2QYXGA.js → chunk-2EFYUSUY.js} +14 -14
  2. package/Build/Workers/{chunk-KFSTQKNM.js → chunk-5LSOO2KD.js} +7 -7
  3. package/Build/Workers/{chunk-VQYETPWC.js → chunk-6HK6IXK2.js} +4 -4
  4. package/Build/Workers/{chunk-AYKR4VBR.js → chunk-6YR6JBMY.js} +2 -2
  5. package/Build/Workers/{chunk-DOBXCNC3.js → chunk-76FDC45O.js} +13 -13
  6. package/Build/Workers/{chunk-54I6Y66F.js → chunk-7D2HZKH7.js} +6 -6
  7. package/Build/Workers/{chunk-4MGMYHOO.js → chunk-7KVKHY7O.js} +6 -6
  8. package/Build/Workers/{chunk-IRBKFCEJ.js → chunk-A3O6EDBK.js} +2 -2
  9. package/Build/Workers/{chunk-V7VQKN6N.js → chunk-A6X24AZI.js} +5 -5
  10. package/Build/Workers/{chunk-ZP7JMQV4.js → chunk-AHWAZRBV.js} +6 -2
  11. package/Build/Workers/{chunk-YLY7NKAB.js → chunk-B4CQSLZJ.js} +4 -4
  12. package/Build/Workers/{chunk-J6BWOHUF.js → chunk-C7JQVRLM.js} +3 -3
  13. package/Build/Workers/{chunk-KSSWJIZW.js → chunk-CDJDJ5LK.js} +2 -2
  14. package/Build/Workers/{chunk-G7PXZRVF.js → chunk-CEEZE3YZ.js} +7 -7
  15. package/Build/Workers/{chunk-INUEEEQA.js → chunk-CLCTQVVL.js} +8 -8
  16. package/Build/Workers/{chunk-O3EA5HS7.js → chunk-DBD5WWG2.js} +10 -10
  17. package/Build/Workers/{chunk-E7VQ76KE.js → chunk-DIGUUD6G.js} +6 -6
  18. package/Build/Workers/{chunk-424RNO3D.js → chunk-E7NZJOK7.js} +196 -22
  19. package/Build/Workers/{chunk-ACXQXN46.js → chunk-EHTS2YPT.js} +16 -16
  20. package/Build/Workers/{chunk-VWV2IJRB.js → chunk-ENNFMWDW.js} +11 -11
  21. package/Build/Workers/{chunk-FRQZECAO.js → chunk-FCP2QY4G.js} +5 -5
  22. package/Build/Workers/{chunk-ZZ46LWL6.js → chunk-FDK4K5IA.js} +1 -1
  23. package/Build/Workers/{chunk-C6KNZ7T4.js → chunk-FGQFQHN5.js} +17 -17
  24. package/Build/Workers/{chunk-MYP774IS.js → chunk-GSWMAFTE.js} +8 -8
  25. package/Build/Workers/{chunk-Y5BF6AFU.js → chunk-GXWQZBAI.js} +2 -2
  26. package/Build/Workers/{chunk-DDWSZVMY.js → chunk-HHV3MCGV.js} +5 -5
  27. package/Build/Workers/{chunk-52JDLOEM.js → chunk-HS6AD4P2.js} +14 -14
  28. package/Build/Workers/{chunk-Q3PY526V.js → chunk-IGAZBTFZ.js} +6 -6
  29. package/Build/Workers/{chunk-EBSIOBXY.js → chunk-ILME5BXA.js} +8 -8
  30. package/Build/Workers/{chunk-C6J67V5A.js → chunk-JKXV6PG5.js} +1 -1
  31. package/Build/Workers/{chunk-SMQZZOW6.js → chunk-JW6OZT4R.js} +10 -10
  32. package/Build/Workers/{chunk-F6QDY6HU.js → chunk-KGXSYGBG.js} +13 -13
  33. package/Build/Workers/{chunk-UOOIQ3KX.js → chunk-LD64RPYV.js} +12 -12
  34. package/Build/Workers/{chunk-CFQP6LYM.js → chunk-LGNDTZVX.js} +4 -4
  35. package/Build/Workers/{chunk-U3ZA64U7.js → chunk-LNSQVXFH.js} +2 -2
  36. package/Build/Workers/{chunk-TKKIREQ6.js → chunk-N7CCOFLX.js} +1 -1
  37. package/Build/Workers/{chunk-UA25D5MX.js → chunk-NIWITKQK.js} +10 -10
  38. package/Build/Workers/{chunk-KKOSKAZB.js → chunk-OBEU25PI.js} +17 -17
  39. package/Build/Workers/{chunk-M3B5JKSM.js → chunk-QVLAFFJY.js} +1 -1
  40. package/Build/Workers/{chunk-6YEE6JDR.js → chunk-R4FPNAZ2.js} +6 -6
  41. package/Build/Workers/{chunk-7J2HKPRH.js → chunk-RG4F5R57.js} +9 -9
  42. package/Build/Workers/{chunk-CXOYE2WM.js → chunk-SF6K72D7.js} +5 -5
  43. package/Build/Workers/{chunk-CZEYZU4N.js → chunk-SGRGNDOD.js} +10 -10
  44. package/Build/Workers/{chunk-DBOEKL43.js → chunk-SM2CDCYF.js} +7 -7
  45. package/Build/Workers/{chunk-Y57HREW5.js → chunk-SS5ABQGY.js} +4 -4
  46. package/Build/Workers/{chunk-QRWGUWI6.js → chunk-T5QBPLE3.js} +11 -11
  47. package/Build/Workers/{chunk-ZK3CF7ZD.js → chunk-TVZD72WJ.js} +12 -12
  48. package/Build/Workers/{chunk-IYOUHCZB.js → chunk-UEY73NRN.js} +1 -1
  49. package/Build/Workers/{chunk-7WM2PX4V.js → chunk-UVO6COT2.js} +5 -5
  50. package/Build/Workers/{chunk-P3CK7MCY.js → chunk-VAL7DYNR.js} +4 -4
  51. package/Build/Workers/{chunk-EPYXRCDB.js → chunk-WBSY7HDY.js} +12 -12
  52. package/Build/Workers/{chunk-4S7IE3LB.js → chunk-XDWCTQCZ.js} +2 -2
  53. package/Build/Workers/{chunk-QN67VG36.js → chunk-XLXSDIP5.js} +6 -6
  54. package/Build/Workers/{chunk-S4MCOY6I.js → chunk-XQ3SKCMM.js} +5 -5
  55. package/Build/Workers/{chunk-XZMBNNDX.js → chunk-YKU2Q3A2.js} +9 -9
  56. package/Build/Workers/{chunk-3VFEWOBI.js → chunk-ZMBHFYOX.js} +7 -7
  57. package/Build/Workers/{chunk-MPZHGZU6.js → chunk-ZSGUV73H.js} +4 -4
  58. package/Build/Workers/combineGeometry.js +24 -24
  59. package/Build/Workers/createBoxGeometry.js +18 -18
  60. package/Build/Workers/createBoxOutlineGeometry.js +16 -16
  61. package/Build/Workers/createCircleGeometry.js +26 -26
  62. package/Build/Workers/createCircleOutlineGeometry.js +19 -19
  63. package/Build/Workers/createCoplanarPolygonGeometry.js +33 -33
  64. package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +31 -31
  65. package/Build/Workers/createCorridorGeometry.js +29 -29
  66. package/Build/Workers/createCorridorOutlineGeometry.js +28 -28
  67. package/Build/Workers/createCylinderGeometry.js +20 -20
  68. package/Build/Workers/createCylinderOutlineGeometry.js +18 -18
  69. package/Build/Workers/createEllipseGeometry.js +26 -26
  70. package/Build/Workers/createEllipseOutlineGeometry.js +19 -19
  71. package/Build/Workers/createEllipsoidGeometry.js +19 -19
  72. package/Build/Workers/createEllipsoidOutlineGeometry.js +18 -18
  73. package/Build/Workers/createFrustumGeometry.js +18 -18
  74. package/Build/Workers/createFrustumOutlineGeometry.js +18 -18
  75. package/Build/Workers/createGeometry.js +24 -24
  76. package/Build/Workers/createGroundPolylineGeometry.js +22 -22
  77. package/Build/Workers/createPlaneGeometry.js +16 -16
  78. package/Build/Workers/createPlaneOutlineGeometry.js +15 -15
  79. package/Build/Workers/createPolygonGeometry.js +32 -32
  80. package/Build/Workers/createPolygonOutlineGeometry.js +30 -30
  81. package/Build/Workers/createPolylineGeometry.js +25 -25
  82. package/Build/Workers/createPolylineVolumeGeometry.js +31 -31
  83. package/Build/Workers/createPolylineVolumeOutlineGeometry.js +27 -27
  84. package/Build/Workers/createRectangleGeometry.js +27 -27
  85. package/Build/Workers/createRectangleOutlineGeometry.js +20 -20
  86. package/Build/Workers/createSimplePolylineGeometry.js +23 -23
  87. package/Build/Workers/createSphereGeometry.js +19 -19
  88. package/Build/Workers/createSphereOutlineGeometry.js +18 -18
  89. package/Build/Workers/createTaskProcessorWorker.js +3 -3
  90. package/Build/Workers/createVectorTileClampedPolylines.js +14 -14
  91. package/Build/Workers/createVectorTileGeometries.js +24 -24
  92. package/Build/Workers/createVectorTilePoints.js +13 -13
  93. package/Build/Workers/createVectorTilePolygons.js +22 -22
  94. package/Build/Workers/createVectorTilePolylines.js +14 -14
  95. package/Build/Workers/createVerticesFromCesium3DTilesTerrain.js +25 -25
  96. package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +22 -22
  97. package/Build/Workers/createVerticesFromHeightmap.js +22 -22
  98. package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +20 -20
  99. package/Build/Workers/createWallGeometry.js +24 -24
  100. package/Build/Workers/createWallOutlineGeometry.js +23 -23
  101. package/Build/Workers/decodeDraco.js +10 -10
  102. package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +987 -2320
  103. package/Build/Workers/decodeI3S.js +10 -10
  104. package/Build/Workers/gaussianSplatSorter.js +4 -4
  105. package/Build/Workers/gaussianSplatTextureGenerator.js +4 -4
  106. package/Build/Workers/incrementallyBuildTerrainPicker.js +10 -10
  107. package/Build/Workers/transcodeKTX2.js +6 -6
  108. package/Build/Workers/transferTypedArrayTest.js +1 -1
  109. package/Build/Workers/upsampleQuantizedTerrainMesh.js +22 -22
  110. package/Build/Workers/upsampleVerticesFromCesium3DTilesTerrain.js +25 -25
  111. package/Source/Core/BoundingRectangle.js +6 -8
  112. package/Source/Core/Color.js +1 -0
  113. package/Source/Core/InterpolationAlgorithm.js +57 -50
  114. package/Source/Core/Ion.js +1 -1
  115. package/Source/Core/TerrainMesh.js +3 -3
  116. package/Source/Core/TerrainPicker.js +1 -0
  117. package/Source/Core/writeTextToCanvas.js +1 -0
  118. package/Source/DataSources/CzmlDataSource.js +12 -0
  119. package/Source/DataSources/KmlDataSource.js +528 -555
  120. package/Source/DataSources/PathGraphics.js +8 -1
  121. package/Source/DataSources/PathMode.js +27 -0
  122. package/Source/DataSources/PathVisualizer.js +298 -1
  123. package/Source/Renderer/Texture.js +1 -1
  124. package/Source/Renderer/VertexArray.js +1 -0
  125. package/Source/Scene/ArcGisMapService.js +1 -1
  126. package/Source/Scene/BillboardTexture.js +5 -3
  127. package/Source/Scene/Cesium3DTileOptimizations.js +4 -6
  128. package/Source/Scene/ClippingPlaneCollection.js +2 -2
  129. package/Source/Scene/ClippingPolygon.js +2 -0
  130. package/Source/Scene/ClippingPolygonCollection.js +2 -2
  131. package/Source/Scene/DerivedCommand.js +4 -0
  132. package/Source/Scene/Expression.js +6 -8
  133. package/Source/Scene/GlobeSurfaceShaderSet.js +501 -409
  134. package/Source/Scene/GlobeSurfaceTile.js +540 -401
  135. package/Source/Scene/GlobeSurfaceTileProvider.js +1259 -1146
  136. package/Source/Scene/GltfBufferViewLoader.js +3 -3
  137. package/Source/Scene/GltfLoader.js +1 -0
  138. package/Source/Scene/GltfLoaderUtil.js +20 -4
  139. package/Source/Scene/GltfPipeline/forEachTextureInMaterial.js +10 -0
  140. package/Source/Scene/GltfPipeline/removeUnusedElements.js +21 -11
  141. package/Source/Scene/ImageryLayer.js +2 -2
  142. package/Source/Scene/ImageryLayerCollection.js +2 -2
  143. package/Source/Scene/Material.js +1 -0
  144. package/Source/Scene/Model/Extensions/Gpm/GltfGpmLoader.js +4 -0
  145. package/Source/Scene/Model/Model.js +3 -0
  146. package/Source/Scene/Model/ModelUtility.js +1 -0
  147. package/Source/Scene/Picking.js +5 -0
  148. package/Source/Scene/PntsParser.js +1 -0
  149. package/Source/Scene/QuadtreePrimitive.js +3 -2
  150. package/Source/Scene/ResourceCacheKey.js +5 -5
  151. package/Source/Scene/Scene.js +1 -0
  152. package/Source/Scene/findMeshoptExtension.js +23 -0
  153. package/Source/Scene/renderBufferPointCollection.js +13 -8
  154. package/Source/Scene/renderBufferPolygonCollection.js +9 -13
  155. package/Source/Scene/renderBufferPolylineCollection.js +120 -192
  156. package/Source/Workers/decodeGoogleEarthEnterprisePacket.js +2 -2
  157. package/Source/Workers/incrementallyBuildTerrainPicker.js +2 -0
  158. package/index.d.ts +59 -254
  159. package/index.js +155 -153
  160. package/package.json +4 -4
@@ -191,133 +191,131 @@ const featureTypes = {
191
191
  Tour: processTour,
192
192
  };
193
193
 
194
- function DeferredLoading(dataSource) {
195
- this._dataSource = dataSource;
196
- this._deferred = defer();
197
- this._stack = [];
198
- this._promises = [];
199
- this._timeoutSet = false;
200
- this._used = false;
201
-
202
- this._started = 0;
203
- this._timeThreshold = 1000; // Initial load is 1 second
204
- }
194
+ class DeferredLoading {
195
+ constructor(dataSource) {
196
+ this._dataSource = dataSource;
197
+ this._deferred = defer();
198
+ this._stack = [];
199
+ this._promises = [];
200
+ this._timeoutSet = false;
201
+ this._used = false;
205
202
 
206
- Object.defineProperties(DeferredLoading.prototype, {
207
- dataSource: {
208
- get: function () {
209
- return this._dataSource;
210
- },
211
- },
212
- });
213
-
214
- DeferredLoading.prototype.addNodes = function (nodes, processingData) {
215
- this._stack.push({
216
- nodes: nodes,
217
- index: 0,
218
- processingData: processingData,
219
- });
220
- this._used = true;
221
- };
222
-
223
- DeferredLoading.prototype.addPromise = function (promise) {
224
- this._promises.push(promise);
225
- };
203
+ this._started = 0;
204
+ this._timeThreshold = 1000; // Initial load is 1 second
205
+ }
226
206
 
227
- DeferredLoading.prototype.wait = function () {
228
- // Case where we had a non-document/folder as the root
229
- const deferred = this._deferred;
230
- if (!this._used) {
231
- deferred.resolve();
207
+ get dataSource() {
208
+ return this._dataSource;
232
209
  }
233
210
 
234
- return Promise.all([deferred.promise, Promise.all(this._promises)]);
235
- };
211
+ addNodes(nodes, processingData) {
212
+ this._stack.push({
213
+ nodes: nodes,
214
+ index: 0,
215
+ processingData: processingData,
216
+ });
217
+ this._used = true;
218
+ }
236
219
 
237
- DeferredLoading.prototype.process = function () {
238
- const isFirstCall = this._stack.length === 1;
239
- if (isFirstCall) {
240
- this._started = KmlDataSource._getTimestamp();
220
+ addPromise(promise) {
221
+ this._promises.push(promise);
241
222
  }
242
223
 
243
- return this._process(isFirstCall);
244
- };
224
+ wait() {
225
+ // Case where we had a non-document/folder as the root
226
+ const deferred = this._deferred;
227
+ if (!this._used) {
228
+ deferred.resolve();
229
+ }
245
230
 
246
- DeferredLoading.prototype._giveUpTime = function () {
247
- if (this._timeoutSet) {
248
- // Timeout was already set so just return
249
- return;
231
+ return Promise.all([deferred.promise, Promise.all(this._promises)]);
250
232
  }
251
233
 
252
- this._timeoutSet = true;
253
- this._timeThreshold = 50; // After the first load lower threshold to 0.5 seconds
254
- const that = this;
255
- setTimeout(function () {
256
- that._timeoutSet = false;
257
- that._started = KmlDataSource._getTimestamp();
258
- that._process(true);
259
- }, 0);
260
- };
234
+ process() {
235
+ const isFirstCall = this._stack.length === 1;
236
+ if (isFirstCall) {
237
+ this._started = KmlDataSource._getTimestamp();
238
+ }
261
239
 
262
- DeferredLoading.prototype._nextNode = function () {
263
- const stack = this._stack;
264
- const top = stack[stack.length - 1];
265
- const index = top.index;
266
- const nodes = top.nodes;
267
- if (index === nodes.length) {
268
- return;
240
+ return this._process(isFirstCall);
269
241
  }
270
- ++top.index;
271
242
 
272
- return nodes[index];
273
- };
243
+ _giveUpTime() {
244
+ if (this._timeoutSet) {
245
+ // Timeout was already set so just return
246
+ return;
247
+ }
274
248
 
275
- DeferredLoading.prototype._pop = function () {
276
- const stack = this._stack;
277
- stack.pop();
249
+ this._timeoutSet = true;
250
+ this._timeThreshold = 50; // After the first load lower threshold to 0.5 seconds
251
+ const that = this;
252
+ setTimeout(function () {
253
+ that._timeoutSet = false;
254
+ that._started = KmlDataSource._getTimestamp();
255
+ that._process(true);
256
+ }, 0);
257
+ }
258
+
259
+ _nextNode() {
260
+ const stack = this._stack;
261
+ const top = stack[stack.length - 1];
262
+ const index = top.index;
263
+ const nodes = top.nodes;
264
+ if (index === nodes.length) {
265
+ return;
266
+ }
267
+ ++top.index;
278
268
 
279
- // Return false if we are done
280
- if (stack.length === 0) {
281
- this._deferred.resolve();
282
- return false;
269
+ return nodes[index];
283
270
  }
284
271
 
285
- return true;
286
- };
272
+ _pop() {
273
+ const stack = this._stack;
274
+ stack.pop();
287
275
 
288
- DeferredLoading.prototype._process = function (isFirstCall) {
289
- const dataSource = this.dataSource;
290
- const processingData = this._stack[this._stack.length - 1].processingData;
276
+ // Return false if we are done
277
+ if (stack.length === 0) {
278
+ this._deferred.resolve();
279
+ return false;
280
+ }
291
281
 
292
- let child = this._nextNode();
293
- while (defined(child)) {
294
- const featureProcessor = featureTypes[child.localName];
295
- if (
296
- defined(featureProcessor) &&
297
- (namespaces.kml.indexOf(child.namespaceURI) !== -1 ||
298
- namespaces.gx.indexOf(child.namespaceURI) !== -1)
299
- ) {
300
- featureProcessor(dataSource, child, processingData, this);
282
+ return true;
283
+ }
301
284
 
302
- // Give up time and continue loading later
285
+ _process(isFirstCall) {
286
+ const dataSource = this.dataSource;
287
+ const processingData = this._stack[this._stack.length - 1].processingData;
288
+
289
+ let child = this._nextNode();
290
+ while (defined(child)) {
291
+ const featureProcessor = featureTypes[child.localName];
303
292
  if (
304
- this._timeoutSet ||
305
- KmlDataSource._getTimestamp() > this._started + this._timeThreshold
293
+ defined(featureProcessor) &&
294
+ (namespaces.kml.indexOf(child.namespaceURI) !== -1 ||
295
+ namespaces.gx.indexOf(child.namespaceURI) !== -1)
306
296
  ) {
307
- this._giveUpTime();
308
- return;
297
+ featureProcessor(dataSource, child, processingData, this);
298
+
299
+ // Give up time and continue loading later
300
+ if (
301
+ this._timeoutSet ||
302
+ KmlDataSource._getTimestamp() > this._started + this._timeThreshold
303
+ ) {
304
+ this._giveUpTime();
305
+ return;
306
+ }
309
307
  }
310
- }
311
308
 
312
- child = this._nextNode();
313
- }
309
+ child = this._nextNode();
310
+ }
314
311
 
315
- // If we are a recursive call from a subfolder, just return so the parent folder can continue processing
316
- // If we aren't then make another call to processNodes because there is stuff still left in the queue
317
- if (this._pop() && isFirstCall) {
318
- this._process(true);
312
+ // If we are a recursive call from a subfolder, just return so the parent folder can continue processing
313
+ // If we aren't then make another call to processNodes because there is stuff still left in the queue
314
+ if (this._pop() && isFirstCall) {
315
+ this._process(true);
316
+ }
319
317
  }
320
- };
318
+ }
321
319
 
322
320
  function isZipFile(blob) {
323
321
  const magicBlob = blob.slice(0, Math.min(4, blob.size));
@@ -3510,11 +3508,6 @@ function load(dataSource, entityCollection, data, options) {
3510
3508
  * under the <code>kml</code> property.
3511
3509
  * </p>
3512
3510
  *
3513
- * @alias KmlDataSource
3514
- * @constructor
3515
- *
3516
- * @param {KmlDataSource.ConstructorOptions} [options] Object describing initialization options
3517
- *
3518
3511
  * @see {@link http://www.opengeospatial.org/standards/kml/|Open Geospatial Consortium KML Standard}
3519
3512
  * @see {@link https://developers.google.com/kml/|Google KML Documentation}
3520
3513
  *
@@ -3529,339 +3522,455 @@ function load(dataSource, entityCollection, data, options) {
3529
3522
  * })
3530
3523
  * );
3531
3524
  */
3532
- function KmlDataSource(options) {
3533
- options = options ?? Frozen.EMPTY_OBJECT;
3534
- const camera = options.camera;
3535
- const canvas = options.canvas;
3536
-
3537
- this._changed = new Event();
3538
- this._error = new Event();
3539
- this._loading = new Event();
3540
- this._refresh = new Event();
3541
- this._unsupportedNode = new Event();
3542
-
3543
- this._clock = undefined;
3544
- this._entityCollection = new EntityCollection(this);
3545
- this._name = undefined;
3546
- this._isLoading = false;
3547
- this._pinBuilder = new PinBuilder();
3548
- this._networkLinks = new AssociativeArray();
3549
- this._entityCluster = new EntityCluster();
3550
-
3525
+ class KmlDataSource {
3551
3526
  /**
3552
- * The current size of this Canvas will be used to populate the Link parameters
3553
- * for client height and width.
3554
- *
3555
- * @type {HTMLCanvasElement | undefined}
3527
+ * @param {KmlDataSource.ConstructorOptions} [options] Object describing initialization options
3556
3528
  */
3557
- this.canvas = canvas;
3558
-
3559
- /**
3560
- * The position and orientation of this {@link Camera} will be used to
3561
- * populate various camera parameters when making network requests.
3562
- * Camera movement will determine when to trigger NetworkLink refresh if
3563
- * <code>viewRefreshMode</code> is <code>onStop</code>.
3564
- *
3565
- * @type {Camera | undefined}
3566
- */
3567
- this.camera = camera;
3568
-
3569
- this._lastCameraView = {
3570
- position: defined(camera) ? Cartesian3.clone(camera.positionWC) : undefined,
3571
- direction: defined(camera)
3572
- ? Cartesian3.clone(camera.directionWC)
3573
- : undefined,
3574
- up: defined(camera) ? Cartesian3.clone(camera.upWC) : undefined,
3575
- bbox: defined(camera)
3576
- ? camera.computeViewRectangle()
3577
- : Rectangle.clone(Rectangle.MAX_VALUE),
3578
- };
3529
+ constructor(options) {
3530
+ options = options ?? Frozen.EMPTY_OBJECT;
3531
+ const camera = options.camera;
3532
+ const canvas = options.canvas;
3533
+
3534
+ this._changed = new Event();
3535
+ this._error = new Event();
3536
+ this._loading = new Event();
3537
+ this._refresh = new Event();
3538
+ this._unsupportedNode = new Event();
3539
+
3540
+ this._clock = undefined;
3541
+ this._entityCollection = new EntityCollection(this);
3542
+ this._name = undefined;
3543
+ this._isLoading = false;
3544
+ this._pinBuilder = new PinBuilder();
3545
+ this._networkLinks = new AssociativeArray();
3546
+ this._entityCluster = new EntityCluster();
3547
+
3548
+ /**
3549
+ * The current size of this Canvas will be used to populate the Link parameters
3550
+ * for client height and width.
3551
+ *
3552
+ * @type {HTMLCanvasElement | undefined}
3553
+ */
3554
+ this.canvas = canvas;
3555
+
3556
+ /**
3557
+ * The position and orientation of this {@link Camera} will be used to
3558
+ * populate various camera parameters when making network requests.
3559
+ * Camera movement will determine when to trigger NetworkLink refresh if
3560
+ * <code>viewRefreshMode</code> is <code>onStop</code>.
3561
+ *
3562
+ * @type {Camera | undefined}
3563
+ */
3564
+ this.camera = camera;
3565
+
3566
+ this._lastCameraView = {
3567
+ position: defined(camera)
3568
+ ? Cartesian3.clone(camera.positionWC)
3569
+ : undefined,
3570
+ direction: defined(camera)
3571
+ ? Cartesian3.clone(camera.directionWC)
3572
+ : undefined,
3573
+ up: defined(camera) ? Cartesian3.clone(camera.upWC) : undefined,
3574
+ bbox: defined(camera)
3575
+ ? camera.computeViewRectangle()
3576
+ : Rectangle.clone(Rectangle.MAX_VALUE),
3577
+ };
3579
3578
 
3580
- this._ellipsoid = options.ellipsoid ?? Ellipsoid.default;
3579
+ this._ellipsoid = options.ellipsoid ?? Ellipsoid.default;
3581
3580
 
3582
- // User specified credit
3583
- let credit = options.credit;
3584
- if (typeof credit === "string") {
3585
- credit = new Credit(credit);
3586
- }
3587
- this._credit = credit;
3581
+ // User specified credit
3582
+ let credit = options.credit;
3583
+ if (typeof credit === "string") {
3584
+ credit = new Credit(credit);
3585
+ }
3586
+ this._credit = credit;
3588
3587
 
3589
- // Create a list of Credit's from the resource that the user can't remove
3590
- this._resourceCredits = [];
3588
+ // Create a list of Credit's from the resource that the user can't remove
3589
+ this._resourceCredits = [];
3591
3590
 
3592
- this._kmlTours = [];
3591
+ this._kmlTours = [];
3593
3592
 
3594
- this._screenOverlays = [];
3595
- }
3593
+ this._screenOverlays = [];
3594
+ }
3596
3595
 
3597
- /**
3598
- * Creates a Promise to a new instance loaded with the provided KML data.
3599
- *
3600
- * @param {Resource|string|Document|Blob} data A url, parsed KML document, or Blob containing binary KMZ data or a parsed KML document.
3601
- * @param {KmlDataSource.ConstructorOptions} [options] An object specifying configuration options
3602
- *
3603
- * @returns {Promise<KmlDataSource>} A promise that will resolve to a new KmlDataSource instance once the KML is loaded.
3604
- */
3605
- KmlDataSource.load = function (data, options) {
3606
- options = options ?? Frozen.EMPTY_OBJECT;
3607
- const dataSource = new KmlDataSource(options);
3608
- return dataSource.load(data, options);
3609
- };
3596
+ /**
3597
+ * Creates a Promise to a new instance loaded with the provided KML data.
3598
+ *
3599
+ * @param {Resource|string|Document|Blob} data A url, parsed KML document, or Blob containing binary KMZ data or a parsed KML document.
3600
+ * @param {KmlDataSource.ConstructorOptions} [options] An object specifying configuration options
3601
+ *
3602
+ * @returns {Promise<KmlDataSource>} A promise that will resolve to a new KmlDataSource instance once the KML is loaded.
3603
+ */
3604
+ static load(data, options) {
3605
+ options = options ?? Frozen.EMPTY_OBJECT;
3606
+ const dataSource = new KmlDataSource(options);
3607
+ return dataSource.load(data, options);
3608
+ }
3610
3609
 
3611
- Object.defineProperties(KmlDataSource.prototype, {
3612
3610
  /**
3613
3611
  * Gets or sets a human-readable name for this instance.
3614
3612
  * This will be automatically be set to the KML document name on load.
3615
- * @memberof KmlDataSource.prototype
3616
3613
  * @type {string}
3617
3614
  */
3618
- name: {
3619
- get: function () {
3620
- return this._name;
3621
- },
3622
- set: function (value) {
3623
- if (this._name !== value) {
3624
- this._name = value;
3625
- this._changed.raiseEvent(this);
3626
- }
3627
- },
3628
- },
3615
+ get name() {
3616
+ return this._name;
3617
+ }
3618
+
3619
+ set name(value) {
3620
+ if (this._name !== value) {
3621
+ this._name = value;
3622
+ this._changed.raiseEvent(this);
3623
+ }
3624
+ }
3625
+
3629
3626
  /**
3630
3627
  * Gets the clock settings defined by the loaded KML. This represents the total
3631
3628
  * availability interval for all time-dynamic data. If the KML does not contain
3632
3629
  * time-dynamic data, this value is undefined.
3633
- * @memberof KmlDataSource.prototype
3634
3630
  * @type {DataSourceClock}
3635
3631
  */
3636
- clock: {
3637
- get: function () {
3638
- return this._clock;
3639
- },
3640
- },
3632
+ get clock() {
3633
+ return this._clock;
3634
+ }
3635
+
3641
3636
  /**
3642
3637
  * Gets the collection of {@link Entity} instances.
3643
- * @memberof KmlDataSource.prototype
3644
3638
  * @type {EntityCollection}
3645
3639
  */
3646
- entities: {
3647
- get: function () {
3648
- return this._entityCollection;
3649
- },
3650
- },
3640
+ get entities() {
3641
+ return this._entityCollection;
3642
+ }
3643
+
3651
3644
  /**
3652
3645
  * Gets a value indicating if the data source is currently loading data.
3653
- * @memberof KmlDataSource.prototype
3654
3646
  * @type {boolean}
3655
3647
  */
3656
- isLoading: {
3657
- get: function () {
3658
- return this._isLoading;
3659
- },
3660
- },
3648
+ get isLoading() {
3649
+ return this._isLoading;
3650
+ }
3651
+
3661
3652
  /**
3662
3653
  * Gets an event that will be raised when the underlying data changes.
3663
- * @memberof KmlDataSource.prototype
3664
3654
  * @type {Event}
3665
3655
  */
3666
- changedEvent: {
3667
- get: function () {
3668
- return this._changed;
3669
- },
3670
- },
3656
+ get changedEvent() {
3657
+ return this._changed;
3658
+ }
3659
+
3671
3660
  /**
3672
3661
  * Gets an event that will be raised if an error is encountered during processing.
3673
- * @memberof KmlDataSource.prototype
3674
3662
  * @type {Event}
3675
3663
  */
3676
- errorEvent: {
3677
- get: function () {
3678
- return this._error;
3679
- },
3680
- },
3664
+ get errorEvent() {
3665
+ return this._error;
3666
+ }
3667
+
3681
3668
  /**
3682
3669
  * Gets an event that will be raised when the data source either starts or stops loading.
3683
- * @memberof KmlDataSource.prototype
3684
3670
  * @type {Event}
3685
3671
  */
3686
- loadingEvent: {
3687
- get: function () {
3688
- return this._loading;
3689
- },
3690
- },
3672
+ get loadingEvent() {
3673
+ return this._loading;
3674
+ }
3675
+
3691
3676
  /**
3692
3677
  * Gets an event that will be raised when the data source refreshes a network link.
3693
- * @memberof KmlDataSource.prototype
3694
3678
  * @type {Event}
3695
3679
  */
3696
- refreshEvent: {
3697
- get: function () {
3698
- return this._refresh;
3699
- },
3700
- },
3680
+ get refreshEvent() {
3681
+ return this._refresh;
3682
+ }
3683
+
3701
3684
  /**
3702
3685
  * Gets an event that will be raised when the data source finds an unsupported node type.
3703
- * @memberof KmlDataSource.prototype
3704
3686
  * @type {Event}
3705
3687
  */
3706
- unsupportedNodeEvent: {
3707
- get: function () {
3708
- return this._unsupportedNode;
3709
- },
3710
- },
3688
+ get unsupportedNodeEvent() {
3689
+ return this._unsupportedNode;
3690
+ }
3691
+
3711
3692
  /**
3712
3693
  * Gets whether or not this data source should be displayed.
3713
- * @memberof KmlDataSource.prototype
3714
3694
  * @type {boolean}
3715
3695
  */
3716
- show: {
3717
- get: function () {
3718
- return this._entityCollection.show;
3719
- },
3720
- set: function (value) {
3721
- this._entityCollection.show = value;
3722
- },
3723
- },
3696
+ get show() {
3697
+ return this._entityCollection.show;
3698
+ }
3699
+
3700
+ set show(value) {
3701
+ this._entityCollection.show = value;
3702
+ }
3724
3703
 
3725
3704
  /**
3726
3705
  * Gets or sets the clustering options for this data source. This object can be shared between multiple data sources.
3727
3706
  *
3728
- * @memberof KmlDataSource.prototype
3729
3707
  * @type {EntityCluster}
3730
3708
  */
3731
- clustering: {
3732
- get: function () {
3733
- return this._entityCluster;
3734
- },
3735
- set: function (value) {
3736
- //>>includeStart('debug', pragmas.debug);
3737
- if (!defined(value)) {
3738
- throw new DeveloperError("value must be defined.");
3739
- }
3740
- //>>includeEnd('debug');
3741
- this._entityCluster = value;
3742
- },
3743
- },
3709
+ get clustering() {
3710
+ return this._entityCluster;
3711
+ }
3712
+
3713
+ set clustering(value) {
3714
+ //>>includeStart('debug', pragmas.debug);
3715
+ if (!defined(value)) {
3716
+ throw new DeveloperError("value must be defined.");
3717
+ }
3718
+ //>>includeEnd('debug');
3719
+ this._entityCluster = value;
3720
+ }
3721
+
3744
3722
  /**
3745
3723
  * Gets the credit that will be displayed for the data source
3746
- * @memberof KmlDataSource.prototype
3747
3724
  * @type {Credit}
3748
3725
  */
3749
- credit: {
3750
- get: function () {
3751
- return this._credit;
3752
- },
3753
- },
3726
+ get credit() {
3727
+ return this._credit;
3728
+ }
3729
+
3754
3730
  /**
3755
3731
  * Gets the KML Tours that are used to guide the camera to specified destinations on given time intervals.
3756
- * @memberof KmlDataSource.prototype
3757
3732
  * @type {KmlTour[]}
3758
3733
  */
3759
- kmlTours: {
3760
- get: function () {
3761
- return this._kmlTours;
3762
- },
3763
- },
3764
- });
3765
-
3766
- /**
3767
- * Asynchronously loads the provided KML data, replacing any existing data.
3768
- *
3769
- * @param {Resource|string|Document|Blob} data A url, parsed KML document, or Blob containing binary KMZ data or a parsed KML document.
3770
- * @param {KmlDataSource.LoadOptions} [options] An object specifying configuration options
3771
- *
3772
- * @returns {Promise<KmlDataSource>} A promise that will resolve to this instances once the KML is loaded.
3773
- */
3774
- KmlDataSource.prototype.load = function (data, options) {
3775
- //>>includeStart('debug', pragmas.debug);
3776
- if (!defined(data)) {
3777
- throw new DeveloperError("data is required.");
3734
+ get kmlTours() {
3735
+ return this._kmlTours;
3778
3736
  }
3779
- //>>includeEnd('debug');
3780
3737
 
3781
- options = options ?? Frozen.EMPTY_OBJECT;
3782
- DataSource.setLoading(this, true);
3783
-
3784
- const oldName = this._name;
3785
- this._name = undefined;
3786
- this._clampToGround = options.clampToGround ?? false;
3787
-
3788
- const that = this;
3789
- return load(this, this._entityCollection, data, options)
3790
- .then(function () {
3791
- let clock;
3792
-
3793
- const availability = that._entityCollection.computeAvailability();
3794
-
3795
- let start = availability.start;
3796
- let stop = availability.stop;
3797
- const isMinStart = JulianDate.equals(start, Iso8601.MINIMUM_VALUE);
3798
- const isMaxStop = JulianDate.equals(stop, Iso8601.MAXIMUM_VALUE);
3799
- if (!isMinStart || !isMaxStop) {
3800
- let date;
3801
-
3802
- //If start is min time just start at midnight this morning, local time
3803
- if (isMinStart) {
3804
- date = new Date();
3805
- date.setHours(0, 0, 0, 0);
3806
- start = JulianDate.fromDate(date);
3738
+ /**
3739
+ * Asynchronously loads the provided KML data, replacing any existing data.
3740
+ *
3741
+ * @param {Resource|string|Document|Blob} data A url, parsed KML document, or Blob containing binary KMZ data or a parsed KML document.
3742
+ * @param {KmlDataSource.LoadOptions} [options] An object specifying configuration options
3743
+ *
3744
+ * @returns {Promise<KmlDataSource>} A promise that will resolve to this instances once the KML is loaded.
3745
+ */
3746
+ load(data, options) {
3747
+ //>>includeStart('debug', pragmas.debug);
3748
+ if (!defined(data)) {
3749
+ throw new DeveloperError("data is required.");
3750
+ }
3751
+ //>>includeEnd('debug');
3752
+
3753
+ options = options ?? Frozen.EMPTY_OBJECT;
3754
+ DataSource.setLoading(this, true);
3755
+
3756
+ const oldName = this._name;
3757
+ this._name = undefined;
3758
+ this._clampToGround = options.clampToGround ?? false;
3759
+
3760
+ const that = this;
3761
+ return load(this, this._entityCollection, data, options)
3762
+ .then(function () {
3763
+ let clock;
3764
+
3765
+ const availability = that._entityCollection.computeAvailability();
3766
+
3767
+ let start = availability.start;
3768
+ let stop = availability.stop;
3769
+ const isMinStart = JulianDate.equals(start, Iso8601.MINIMUM_VALUE);
3770
+ const isMaxStop = JulianDate.equals(stop, Iso8601.MAXIMUM_VALUE);
3771
+ if (!isMinStart || !isMaxStop) {
3772
+ let date;
3773
+
3774
+ //If start is min time just start at midnight this morning, local time
3775
+ if (isMinStart) {
3776
+ date = new Date();
3777
+ date.setHours(0, 0, 0, 0);
3778
+ start = JulianDate.fromDate(date);
3779
+ }
3780
+
3781
+ //If stop is max value just stop at midnight tonight, local time
3782
+ if (isMaxStop) {
3783
+ date = new Date();
3784
+ date.setHours(24, 0, 0, 0);
3785
+ stop = JulianDate.fromDate(date);
3786
+ }
3787
+
3788
+ clock = new DataSourceClock();
3789
+ clock.startTime = start;
3790
+ clock.stopTime = stop;
3791
+ clock.currentTime = JulianDate.clone(start);
3792
+ clock.clockRange = ClockRange.LOOP_STOP;
3793
+ clock.clockStep = ClockStep.SYSTEM_CLOCK_MULTIPLIER;
3794
+ clock.multiplier = Math.round(
3795
+ Math.min(
3796
+ Math.max(JulianDate.secondsDifference(stop, start) / 60, 1),
3797
+ 3.15569e7,
3798
+ ),
3799
+ );
3807
3800
  }
3808
3801
 
3809
- //If stop is max value just stop at midnight tonight, local time
3810
- if (isMaxStop) {
3811
- date = new Date();
3812
- date.setHours(24, 0, 0, 0);
3813
- stop = JulianDate.fromDate(date);
3802
+ let changed = false;
3803
+ if (clock !== that._clock) {
3804
+ that._clock = clock;
3805
+ changed = true;
3814
3806
  }
3815
3807
 
3816
- clock = new DataSourceClock();
3817
- clock.startTime = start;
3818
- clock.stopTime = stop;
3819
- clock.currentTime = JulianDate.clone(start);
3820
- clock.clockRange = ClockRange.LOOP_STOP;
3821
- clock.clockStep = ClockStep.SYSTEM_CLOCK_MULTIPLIER;
3822
- clock.multiplier = Math.round(
3823
- Math.min(
3824
- Math.max(JulianDate.secondsDifference(stop, start) / 60, 1),
3825
- 3.15569e7,
3826
- ),
3827
- );
3828
- }
3808
+ if (oldName !== that._name) {
3809
+ changed = true;
3810
+ }
3829
3811
 
3830
- let changed = false;
3831
- if (clock !== that._clock) {
3832
- that._clock = clock;
3833
- changed = true;
3834
- }
3812
+ if (changed) {
3813
+ that._changed.raiseEvent(that);
3814
+ }
3815
+
3816
+ DataSource.setLoading(that, false);
3817
+
3818
+ return that;
3819
+ })
3820
+ .catch(function (error) {
3821
+ DataSource.setLoading(that, false);
3822
+ that._error.raiseEvent(that, error);
3823
+ console.log(error);
3824
+ return Promise.reject(error);
3825
+ });
3826
+ }
3827
+
3828
+ /**
3829
+ * Cleans up any non-entity elements created by the data source. Currently this only affects ScreenOverlay elements.
3830
+ */
3831
+ destroy() {
3832
+ while (this._screenOverlays.length > 0) {
3833
+ const elem = this._screenOverlays.pop();
3834
+ elem.remove();
3835
+ }
3836
+ }
3835
3837
 
3836
- if (oldName !== that._name) {
3837
- changed = true;
3838
+ /**
3839
+ * Updates any NetworkLink that require updating.
3840
+ *
3841
+ * @param {JulianDate} time The simulation time.
3842
+ * @returns {boolean} True if this data source is ready to be displayed at the provided time, false otherwise.
3843
+ */
3844
+ update(time) {
3845
+ const networkLinks = this._networkLinks;
3846
+ if (networkLinks.length === 0) {
3847
+ return true;
3848
+ }
3849
+
3850
+ const now = JulianDate.now();
3851
+ const that = this;
3852
+
3853
+ entitiesToIgnore.removeAll();
3854
+
3855
+ function recurseIgnoreEntities(entity) {
3856
+ const children = entity._children;
3857
+ const count = children.length;
3858
+ for (let i = 0; i < count; ++i) {
3859
+ const child = children[i];
3860
+ entitiesToIgnore.set(child.id, child);
3861
+ recurseIgnoreEntities(child);
3838
3862
  }
3863
+ }
3864
+
3865
+ let cameraViewUpdate = false;
3866
+ const lastCameraView = this._lastCameraView;
3867
+ const camera = this.camera;
3868
+ if (
3869
+ defined(camera) &&
3870
+ !(
3871
+ camera.positionWC.equalsEpsilon(
3872
+ lastCameraView.position,
3873
+ CesiumMath.EPSILON7,
3874
+ ) &&
3875
+ camera.directionWC.equalsEpsilon(
3876
+ lastCameraView.direction,
3877
+ CesiumMath.EPSILON7,
3878
+ ) &&
3879
+ camera.upWC.equalsEpsilon(lastCameraView.up, CesiumMath.EPSILON7)
3880
+ )
3881
+ ) {
3882
+ // Camera has changed so update the last view
3883
+ lastCameraView.position = Cartesian3.clone(camera.positionWC);
3884
+ lastCameraView.direction = Cartesian3.clone(camera.directionWC);
3885
+ lastCameraView.up = Cartesian3.clone(camera.upWC);
3886
+ lastCameraView.bbox = camera.computeViewRectangle();
3887
+ cameraViewUpdate = true;
3888
+ }
3839
3889
 
3840
- if (changed) {
3841
- that._changed.raiseEvent(that);
3890
+ const newNetworkLinks = new AssociativeArray();
3891
+ let changed = false;
3892
+ networkLinks.values.forEach(function (networkLink) {
3893
+ const entity = networkLink.entity;
3894
+ if (entitiesToIgnore.contains(entity.id)) {
3895
+ return;
3842
3896
  }
3843
3897
 
3844
- DataSource.setLoading(that, false);
3898
+ if (!networkLink.updating) {
3899
+ let doUpdate = false;
3900
+ if (networkLink.refreshMode === RefreshMode.INTERVAL) {
3901
+ if (
3902
+ JulianDate.secondsDifference(now, networkLink.lastUpdated) >
3903
+ networkLink.time
3904
+ ) {
3905
+ doUpdate = true;
3906
+ }
3907
+ } else if (networkLink.refreshMode === RefreshMode.EXPIRE) {
3908
+ if (JulianDate.greaterThan(now, networkLink.time)) {
3909
+ doUpdate = true;
3910
+ }
3911
+ } else if (networkLink.refreshMode === RefreshMode.STOP) {
3912
+ if (cameraViewUpdate) {
3913
+ networkLink.needsUpdate = true;
3914
+ networkLink.cameraUpdateTime = now;
3915
+ }
3845
3916
 
3846
- return that;
3847
- })
3848
- .catch(function (error) {
3849
- DataSource.setLoading(that, false);
3850
- that._error.raiseEvent(that, error);
3851
- console.log(error);
3852
- return Promise.reject(error);
3917
+ if (
3918
+ networkLink.needsUpdate &&
3919
+ JulianDate.secondsDifference(now, networkLink.cameraUpdateTime) >=
3920
+ networkLink.time
3921
+ ) {
3922
+ doUpdate = true;
3923
+ }
3924
+ }
3925
+
3926
+ if (doUpdate) {
3927
+ recurseIgnoreEntities(entity);
3928
+ networkLink.updating = true;
3929
+ const newEntityCollection = new EntityCollection();
3930
+ const href = networkLink.href.clone();
3931
+
3932
+ href.setQueryParameters(networkLink.cookie);
3933
+ const ellipsoid = that._ellipsoid ?? Ellipsoid.default;
3934
+ processNetworkLinkQueryString(
3935
+ href,
3936
+ that.camera,
3937
+ that.canvas,
3938
+ networkLink.viewBoundScale,
3939
+ lastCameraView.bbox,
3940
+ ellipsoid,
3941
+ );
3942
+
3943
+ load(that, newEntityCollection, href, {
3944
+ context: entity.id,
3945
+ })
3946
+ .then(
3947
+ getNetworkLinkUpdateCallback(
3948
+ that,
3949
+ networkLink,
3950
+ newEntityCollection,
3951
+ newNetworkLinks,
3952
+ href,
3953
+ ),
3954
+ )
3955
+ .catch(function (error) {
3956
+ const msg = `NetworkLink ${networkLink.href} refresh failed: ${error}`;
3957
+ console.log(msg);
3958
+ that._error.raiseEvent(that, msg);
3959
+ });
3960
+ changed = true;
3961
+ }
3962
+ }
3963
+ newNetworkLinks.set(networkLink.id, networkLink);
3853
3964
  });
3854
- };
3855
3965
 
3856
- /**
3857
- * Cleans up any non-entity elements created by the data source. Currently this only affects ScreenOverlay elements.
3858
- */
3859
- KmlDataSource.prototype.destroy = function () {
3860
- while (this._screenOverlays.length > 0) {
3861
- const elem = this._screenOverlays.pop();
3862
- elem.remove();
3966
+ if (changed) {
3967
+ this._networkLinks = newNetworkLinks;
3968
+ this._changed.raiseEvent(this);
3969
+ }
3970
+
3971
+ return true;
3863
3972
  }
3864
- };
3973
+ }
3865
3974
 
3866
3975
  function mergeAvailabilityWithParent(child) {
3867
3976
  const parent = child.parent;
@@ -4035,211 +4144,75 @@ function getNetworkLinkUpdateCallback(
4035
4144
  const entitiesToIgnore = new AssociativeArray();
4036
4145
 
4037
4146
  /**
4038
- * Updates any NetworkLink that require updating.
4039
- *
4040
- * @param {JulianDate} time The simulation time.
4041
- * @returns {boolean} True if this data source is ready to be displayed at the provided time, false otherwise.
4147
+ * @typedef KmlFeatureData.Author
4148
+ * @type {object}
4149
+ * @property {string} name Gets the name.
4150
+ * @property {string} uri Gets the URI.
4151
+ * @property {number} age Gets the email.
4042
4152
  */
4043
- KmlDataSource.prototype.update = function (time) {
4044
- const networkLinks = this._networkLinks;
4045
- if (networkLinks.length === 0) {
4046
- return true;
4047
- }
4048
-
4049
- const now = JulianDate.now();
4050
- const that = this;
4051
-
4052
- entitiesToIgnore.removeAll();
4053
-
4054
- function recurseIgnoreEntities(entity) {
4055
- const children = entity._children;
4056
- const count = children.length;
4057
- for (let i = 0; i < count; ++i) {
4058
- const child = children[i];
4059
- entitiesToIgnore.set(child.id, child);
4060
- recurseIgnoreEntities(child);
4061
- }
4062
- }
4063
-
4064
- let cameraViewUpdate = false;
4065
- const lastCameraView = this._lastCameraView;
4066
- const camera = this.camera;
4067
- if (
4068
- defined(camera) &&
4069
- !(
4070
- camera.positionWC.equalsEpsilon(
4071
- lastCameraView.position,
4072
- CesiumMath.EPSILON7,
4073
- ) &&
4074
- camera.directionWC.equalsEpsilon(
4075
- lastCameraView.direction,
4076
- CesiumMath.EPSILON7,
4077
- ) &&
4078
- camera.upWC.equalsEpsilon(lastCameraView.up, CesiumMath.EPSILON7)
4079
- )
4080
- ) {
4081
- // Camera has changed so update the last view
4082
- lastCameraView.position = Cartesian3.clone(camera.positionWC);
4083
- lastCameraView.direction = Cartesian3.clone(camera.directionWC);
4084
- lastCameraView.up = Cartesian3.clone(camera.upWC);
4085
- lastCameraView.bbox = camera.computeViewRectangle();
4086
- cameraViewUpdate = true;
4087
- }
4088
-
4089
- const newNetworkLinks = new AssociativeArray();
4090
- let changed = false;
4091
- networkLinks.values.forEach(function (networkLink) {
4092
- const entity = networkLink.entity;
4093
- if (entitiesToIgnore.contains(entity.id)) {
4094
- return;
4095
- }
4096
-
4097
- if (!networkLink.updating) {
4098
- let doUpdate = false;
4099
- if (networkLink.refreshMode === RefreshMode.INTERVAL) {
4100
- if (
4101
- JulianDate.secondsDifference(now, networkLink.lastUpdated) >
4102
- networkLink.time
4103
- ) {
4104
- doUpdate = true;
4105
- }
4106
- } else if (networkLink.refreshMode === RefreshMode.EXPIRE) {
4107
- if (JulianDate.greaterThan(now, networkLink.time)) {
4108
- doUpdate = true;
4109
- }
4110
- } else if (networkLink.refreshMode === RefreshMode.STOP) {
4111
- if (cameraViewUpdate) {
4112
- networkLink.needsUpdate = true;
4113
- networkLink.cameraUpdateTime = now;
4114
- }
4115
-
4116
- if (
4117
- networkLink.needsUpdate &&
4118
- JulianDate.secondsDifference(now, networkLink.cameraUpdateTime) >=
4119
- networkLink.time
4120
- ) {
4121
- doUpdate = true;
4122
- }
4123
- }
4124
-
4125
- if (doUpdate) {
4126
- recurseIgnoreEntities(entity);
4127
- networkLink.updating = true;
4128
- const newEntityCollection = new EntityCollection();
4129
- const href = networkLink.href.clone();
4130
-
4131
- href.setQueryParameters(networkLink.cookie);
4132
- const ellipsoid = that._ellipsoid ?? Ellipsoid.default;
4133
- processNetworkLinkQueryString(
4134
- href,
4135
- that.camera,
4136
- that.canvas,
4137
- networkLink.viewBoundScale,
4138
- lastCameraView.bbox,
4139
- ellipsoid,
4140
- );
4141
-
4142
- load(that, newEntityCollection, href, {
4143
- context: entity.id,
4144
- })
4145
- .then(
4146
- getNetworkLinkUpdateCallback(
4147
- that,
4148
- networkLink,
4149
- newEntityCollection,
4150
- newNetworkLinks,
4151
- href,
4152
- ),
4153
- )
4154
- .catch(function (error) {
4155
- const msg = `NetworkLink ${networkLink.href} refresh failed: ${error}`;
4156
- console.log(msg);
4157
- that._error.raiseEvent(that, msg);
4158
- });
4159
- changed = true;
4160
- }
4161
- }
4162
- newNetworkLinks.set(networkLink.id, networkLink);
4163
- });
4164
-
4165
- if (changed) {
4166
- this._networkLinks = newNetworkLinks;
4167
- this._changed.raiseEvent(this);
4168
- }
4169
-
4170
- return true;
4171
- };
4172
4153
 
4173
4154
  /**
4174
4155
  * Contains KML Feature data loaded into the <code>Entity.kml</code> property by {@link KmlDataSource}.
4175
- * @alias KmlFeatureData
4176
- * @constructor
4177
4156
  */
4178
- function KmlFeatureData() {
4179
- /**
4180
- * @typedef KmlFeatureData.Author
4181
- * @type {object}
4182
- * @property {string} name Gets the name.
4183
- * @property {string} uri Gets the URI.
4184
- * @property {number} age Gets the email.
4185
- */
4186
-
4187
- /**
4188
- * Gets the atom syndication format author field.
4189
- * @type {KmlFeatureData.Author}
4190
- */
4191
- this.author = {
4192
- name: undefined,
4193
- uri: undefined,
4194
- email: undefined,
4195
- };
4196
-
4197
- /**
4198
- * @typedef KmlFeatureData.Link
4199
- * @type {object}
4200
- * @property {string} href Gets the href.
4201
- * @property {string} hreflang Gets the language of the linked resource.
4202
- * @property {string} rel Gets the link relation.
4203
- * @property {string} type Gets the link type.
4204
- * @property {string} title Gets the link title.
4205
- * @property {string} length Gets the link length.
4206
- */
4157
+ class KmlFeatureData {
4158
+ constructor() {
4159
+ /**
4160
+ * Gets the atom syndication format author field.
4161
+ * @type {KmlFeatureData.Author}
4162
+ */
4163
+ this.author = {
4164
+ name: undefined,
4165
+ uri: undefined,
4166
+ email: undefined,
4167
+ };
4207
4168
 
4208
- /**
4209
- * Gets the link.
4210
- * @type {KmlFeatureData.Link}
4211
- */
4212
- this.link = {
4213
- href: undefined,
4214
- hreflang: undefined,
4215
- rel: undefined,
4216
- type: undefined,
4217
- title: undefined,
4218
- length: undefined,
4219
- };
4169
+ /**
4170
+ * @typedef KmlFeatureData.Link
4171
+ * @type {object}
4172
+ * @property {string} href Gets the href.
4173
+ * @property {string} hreflang Gets the language of the linked resource.
4174
+ * @property {string} rel Gets the link relation.
4175
+ * @property {string} type Gets the link type.
4176
+ * @property {string} title Gets the link title.
4177
+ * @property {string} length Gets the link length.
4178
+ */
4179
+
4180
+ /**
4181
+ * Gets the link.
4182
+ * @type {KmlFeatureData.Link}
4183
+ */
4184
+ this.link = {
4185
+ href: undefined,
4186
+ hreflang: undefined,
4187
+ rel: undefined,
4188
+ type: undefined,
4189
+ title: undefined,
4190
+ length: undefined,
4191
+ };
4220
4192
 
4221
- /**
4222
- * Gets the unstructured address field.
4223
- * @type {string}
4224
- */
4225
- this.address = undefined;
4226
- /**
4227
- * Gets the phone number.
4228
- * @type {string}
4229
- */
4230
- this.phoneNumber = undefined;
4231
- /**
4232
- * Gets the snippet.
4233
- * @type {string}
4234
- */
4235
- this.snippet = undefined;
4236
- /**
4237
- * Gets the extended data, parsed into a JSON object.
4238
- * Currently only the <code>Data</code> property is supported.
4239
- * <code>SchemaData</code> and custom data are ignored.
4240
- * @type {string}
4241
- */
4242
- this.extendedData = undefined;
4193
+ /**
4194
+ * Gets the unstructured address field.
4195
+ * @type {string}
4196
+ */
4197
+ this.address = undefined;
4198
+ /**
4199
+ * Gets the phone number.
4200
+ * @type {string}
4201
+ */
4202
+ this.phoneNumber = undefined;
4203
+ /**
4204
+ * Gets the snippet.
4205
+ * @type {string}
4206
+ */
4207
+ this.snippet = undefined;
4208
+ /**
4209
+ * Gets the extended data, parsed into a JSON object.
4210
+ * Currently only the <code>Data</code> property is supported.
4211
+ * <code>SchemaData</code> and custom data are ignored.
4212
+ * @type {string}
4213
+ */
4214
+ this.extendedData = undefined;
4215
+ }
4243
4216
  }
4244
4217
 
4245
4218
  // For testing