@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.
- package/Build/Workers/{chunk-EF2QYXGA.js → chunk-2EFYUSUY.js} +14 -14
- package/Build/Workers/{chunk-KFSTQKNM.js → chunk-5LSOO2KD.js} +7 -7
- package/Build/Workers/{chunk-VQYETPWC.js → chunk-6HK6IXK2.js} +4 -4
- package/Build/Workers/{chunk-AYKR4VBR.js → chunk-6YR6JBMY.js} +2 -2
- package/Build/Workers/{chunk-DOBXCNC3.js → chunk-76FDC45O.js} +13 -13
- package/Build/Workers/{chunk-54I6Y66F.js → chunk-7D2HZKH7.js} +6 -6
- package/Build/Workers/{chunk-4MGMYHOO.js → chunk-7KVKHY7O.js} +6 -6
- package/Build/Workers/{chunk-IRBKFCEJ.js → chunk-A3O6EDBK.js} +2 -2
- package/Build/Workers/{chunk-V7VQKN6N.js → chunk-A6X24AZI.js} +5 -5
- package/Build/Workers/{chunk-ZP7JMQV4.js → chunk-AHWAZRBV.js} +6 -2
- package/Build/Workers/{chunk-YLY7NKAB.js → chunk-B4CQSLZJ.js} +4 -4
- package/Build/Workers/{chunk-J6BWOHUF.js → chunk-C7JQVRLM.js} +3 -3
- package/Build/Workers/{chunk-KSSWJIZW.js → chunk-CDJDJ5LK.js} +2 -2
- package/Build/Workers/{chunk-G7PXZRVF.js → chunk-CEEZE3YZ.js} +7 -7
- package/Build/Workers/{chunk-INUEEEQA.js → chunk-CLCTQVVL.js} +8 -8
- package/Build/Workers/{chunk-O3EA5HS7.js → chunk-DBD5WWG2.js} +10 -10
- package/Build/Workers/{chunk-E7VQ76KE.js → chunk-DIGUUD6G.js} +6 -6
- package/Build/Workers/{chunk-424RNO3D.js → chunk-E7NZJOK7.js} +196 -22
- package/Build/Workers/{chunk-ACXQXN46.js → chunk-EHTS2YPT.js} +16 -16
- package/Build/Workers/{chunk-VWV2IJRB.js → chunk-ENNFMWDW.js} +11 -11
- package/Build/Workers/{chunk-FRQZECAO.js → chunk-FCP2QY4G.js} +5 -5
- package/Build/Workers/{chunk-ZZ46LWL6.js → chunk-FDK4K5IA.js} +1 -1
- package/Build/Workers/{chunk-C6KNZ7T4.js → chunk-FGQFQHN5.js} +17 -17
- package/Build/Workers/{chunk-MYP774IS.js → chunk-GSWMAFTE.js} +8 -8
- package/Build/Workers/{chunk-Y5BF6AFU.js → chunk-GXWQZBAI.js} +2 -2
- package/Build/Workers/{chunk-DDWSZVMY.js → chunk-HHV3MCGV.js} +5 -5
- package/Build/Workers/{chunk-52JDLOEM.js → chunk-HS6AD4P2.js} +14 -14
- package/Build/Workers/{chunk-Q3PY526V.js → chunk-IGAZBTFZ.js} +6 -6
- package/Build/Workers/{chunk-EBSIOBXY.js → chunk-ILME5BXA.js} +8 -8
- package/Build/Workers/{chunk-C6J67V5A.js → chunk-JKXV6PG5.js} +1 -1
- package/Build/Workers/{chunk-SMQZZOW6.js → chunk-JW6OZT4R.js} +10 -10
- package/Build/Workers/{chunk-F6QDY6HU.js → chunk-KGXSYGBG.js} +13 -13
- package/Build/Workers/{chunk-UOOIQ3KX.js → chunk-LD64RPYV.js} +12 -12
- package/Build/Workers/{chunk-CFQP6LYM.js → chunk-LGNDTZVX.js} +4 -4
- package/Build/Workers/{chunk-U3ZA64U7.js → chunk-LNSQVXFH.js} +2 -2
- package/Build/Workers/{chunk-TKKIREQ6.js → chunk-N7CCOFLX.js} +1 -1
- package/Build/Workers/{chunk-UA25D5MX.js → chunk-NIWITKQK.js} +10 -10
- package/Build/Workers/{chunk-KKOSKAZB.js → chunk-OBEU25PI.js} +17 -17
- package/Build/Workers/{chunk-M3B5JKSM.js → chunk-QVLAFFJY.js} +1 -1
- package/Build/Workers/{chunk-6YEE6JDR.js → chunk-R4FPNAZ2.js} +6 -6
- package/Build/Workers/{chunk-7J2HKPRH.js → chunk-RG4F5R57.js} +9 -9
- package/Build/Workers/{chunk-CXOYE2WM.js → chunk-SF6K72D7.js} +5 -5
- package/Build/Workers/{chunk-CZEYZU4N.js → chunk-SGRGNDOD.js} +10 -10
- package/Build/Workers/{chunk-DBOEKL43.js → chunk-SM2CDCYF.js} +7 -7
- package/Build/Workers/{chunk-Y57HREW5.js → chunk-SS5ABQGY.js} +4 -4
- package/Build/Workers/{chunk-QRWGUWI6.js → chunk-T5QBPLE3.js} +11 -11
- package/Build/Workers/{chunk-ZK3CF7ZD.js → chunk-TVZD72WJ.js} +12 -12
- package/Build/Workers/{chunk-IYOUHCZB.js → chunk-UEY73NRN.js} +1 -1
- package/Build/Workers/{chunk-7WM2PX4V.js → chunk-UVO6COT2.js} +5 -5
- package/Build/Workers/{chunk-P3CK7MCY.js → chunk-VAL7DYNR.js} +4 -4
- package/Build/Workers/{chunk-EPYXRCDB.js → chunk-WBSY7HDY.js} +12 -12
- package/Build/Workers/{chunk-4S7IE3LB.js → chunk-XDWCTQCZ.js} +2 -2
- package/Build/Workers/{chunk-QN67VG36.js → chunk-XLXSDIP5.js} +6 -6
- package/Build/Workers/{chunk-S4MCOY6I.js → chunk-XQ3SKCMM.js} +5 -5
- package/Build/Workers/{chunk-XZMBNNDX.js → chunk-YKU2Q3A2.js} +9 -9
- package/Build/Workers/{chunk-3VFEWOBI.js → chunk-ZMBHFYOX.js} +7 -7
- package/Build/Workers/{chunk-MPZHGZU6.js → chunk-ZSGUV73H.js} +4 -4
- package/Build/Workers/combineGeometry.js +24 -24
- package/Build/Workers/createBoxGeometry.js +18 -18
- package/Build/Workers/createBoxOutlineGeometry.js +16 -16
- package/Build/Workers/createCircleGeometry.js +26 -26
- package/Build/Workers/createCircleOutlineGeometry.js +19 -19
- package/Build/Workers/createCoplanarPolygonGeometry.js +33 -33
- package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +31 -31
- package/Build/Workers/createCorridorGeometry.js +29 -29
- package/Build/Workers/createCorridorOutlineGeometry.js +28 -28
- package/Build/Workers/createCylinderGeometry.js +20 -20
- package/Build/Workers/createCylinderOutlineGeometry.js +18 -18
- package/Build/Workers/createEllipseGeometry.js +26 -26
- package/Build/Workers/createEllipseOutlineGeometry.js +19 -19
- package/Build/Workers/createEllipsoidGeometry.js +19 -19
- package/Build/Workers/createEllipsoidOutlineGeometry.js +18 -18
- package/Build/Workers/createFrustumGeometry.js +18 -18
- package/Build/Workers/createFrustumOutlineGeometry.js +18 -18
- package/Build/Workers/createGeometry.js +24 -24
- package/Build/Workers/createGroundPolylineGeometry.js +22 -22
- package/Build/Workers/createPlaneGeometry.js +16 -16
- package/Build/Workers/createPlaneOutlineGeometry.js +15 -15
- package/Build/Workers/createPolygonGeometry.js +32 -32
- package/Build/Workers/createPolygonOutlineGeometry.js +30 -30
- package/Build/Workers/createPolylineGeometry.js +25 -25
- package/Build/Workers/createPolylineVolumeGeometry.js +31 -31
- package/Build/Workers/createPolylineVolumeOutlineGeometry.js +27 -27
- package/Build/Workers/createRectangleGeometry.js +27 -27
- package/Build/Workers/createRectangleOutlineGeometry.js +20 -20
- package/Build/Workers/createSimplePolylineGeometry.js +23 -23
- package/Build/Workers/createSphereGeometry.js +19 -19
- package/Build/Workers/createSphereOutlineGeometry.js +18 -18
- package/Build/Workers/createTaskProcessorWorker.js +3 -3
- package/Build/Workers/createVectorTileClampedPolylines.js +14 -14
- package/Build/Workers/createVectorTileGeometries.js +24 -24
- package/Build/Workers/createVectorTilePoints.js +13 -13
- package/Build/Workers/createVectorTilePolygons.js +22 -22
- package/Build/Workers/createVectorTilePolylines.js +14 -14
- package/Build/Workers/createVerticesFromCesium3DTilesTerrain.js +25 -25
- package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +22 -22
- package/Build/Workers/createVerticesFromHeightmap.js +22 -22
- package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +20 -20
- package/Build/Workers/createWallGeometry.js +24 -24
- package/Build/Workers/createWallOutlineGeometry.js +23 -23
- package/Build/Workers/decodeDraco.js +10 -10
- package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +987 -2320
- package/Build/Workers/decodeI3S.js +10 -10
- package/Build/Workers/gaussianSplatSorter.js +4 -4
- package/Build/Workers/gaussianSplatTextureGenerator.js +4 -4
- package/Build/Workers/incrementallyBuildTerrainPicker.js +10 -10
- package/Build/Workers/transcodeKTX2.js +6 -6
- package/Build/Workers/transferTypedArrayTest.js +1 -1
- package/Build/Workers/upsampleQuantizedTerrainMesh.js +22 -22
- package/Build/Workers/upsampleVerticesFromCesium3DTilesTerrain.js +25 -25
- package/Source/Core/BoundingRectangle.js +6 -8
- package/Source/Core/Color.js +1 -0
- package/Source/Core/InterpolationAlgorithm.js +57 -50
- package/Source/Core/Ion.js +1 -1
- package/Source/Core/TerrainMesh.js +3 -3
- package/Source/Core/TerrainPicker.js +1 -0
- package/Source/Core/writeTextToCanvas.js +1 -0
- package/Source/DataSources/CzmlDataSource.js +12 -0
- package/Source/DataSources/KmlDataSource.js +528 -555
- package/Source/DataSources/PathGraphics.js +8 -1
- package/Source/DataSources/PathMode.js +27 -0
- package/Source/DataSources/PathVisualizer.js +298 -1
- package/Source/Renderer/Texture.js +1 -1
- package/Source/Renderer/VertexArray.js +1 -0
- package/Source/Scene/ArcGisMapService.js +1 -1
- package/Source/Scene/BillboardTexture.js +5 -3
- package/Source/Scene/Cesium3DTileOptimizations.js +4 -6
- package/Source/Scene/ClippingPlaneCollection.js +2 -2
- package/Source/Scene/ClippingPolygon.js +2 -0
- package/Source/Scene/ClippingPolygonCollection.js +2 -2
- package/Source/Scene/DerivedCommand.js +4 -0
- package/Source/Scene/Expression.js +6 -8
- package/Source/Scene/GlobeSurfaceShaderSet.js +501 -409
- package/Source/Scene/GlobeSurfaceTile.js +540 -401
- package/Source/Scene/GlobeSurfaceTileProvider.js +1259 -1146
- package/Source/Scene/GltfBufferViewLoader.js +3 -3
- package/Source/Scene/GltfLoader.js +1 -0
- package/Source/Scene/GltfLoaderUtil.js +20 -4
- package/Source/Scene/GltfPipeline/forEachTextureInMaterial.js +10 -0
- package/Source/Scene/GltfPipeline/removeUnusedElements.js +21 -11
- package/Source/Scene/ImageryLayer.js +2 -2
- package/Source/Scene/ImageryLayerCollection.js +2 -2
- package/Source/Scene/Material.js +1 -0
- package/Source/Scene/Model/Extensions/Gpm/GltfGpmLoader.js +4 -0
- package/Source/Scene/Model/Model.js +3 -0
- package/Source/Scene/Model/ModelUtility.js +1 -0
- package/Source/Scene/Picking.js +5 -0
- package/Source/Scene/PntsParser.js +1 -0
- package/Source/Scene/QuadtreePrimitive.js +3 -2
- package/Source/Scene/ResourceCacheKey.js +5 -5
- package/Source/Scene/Scene.js +1 -0
- package/Source/Scene/findMeshoptExtension.js +23 -0
- package/Source/Scene/renderBufferPointCollection.js +13 -8
- package/Source/Scene/renderBufferPolygonCollection.js +9 -13
- package/Source/Scene/renderBufferPolylineCollection.js +120 -192
- package/Source/Workers/decodeGoogleEarthEnterprisePacket.js +2 -2
- package/Source/Workers/incrementallyBuildTerrainPicker.js +2 -0
- package/index.d.ts +59 -254
- package/index.js +155 -153
- package/package.json +4 -4
|
@@ -191,133 +191,131 @@ const featureTypes = {
|
|
|
191
191
|
Tour: processTour,
|
|
192
192
|
};
|
|
193
193
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
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
|
-
|
|
207
|
-
|
|
208
|
-
|
|
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
|
-
|
|
228
|
-
|
|
229
|
-
const deferred = this._deferred;
|
|
230
|
-
if (!this._used) {
|
|
231
|
-
deferred.resolve();
|
|
207
|
+
get dataSource() {
|
|
208
|
+
return this._dataSource;
|
|
232
209
|
}
|
|
233
210
|
|
|
234
|
-
|
|
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
|
-
|
|
238
|
-
|
|
239
|
-
if (isFirstCall) {
|
|
240
|
-
this._started = KmlDataSource._getTimestamp();
|
|
220
|
+
addPromise(promise) {
|
|
221
|
+
this._promises.push(promise);
|
|
241
222
|
}
|
|
242
223
|
|
|
243
|
-
|
|
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
|
-
|
|
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
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
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
|
-
|
|
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
|
-
|
|
273
|
-
|
|
243
|
+
_giveUpTime() {
|
|
244
|
+
if (this._timeoutSet) {
|
|
245
|
+
// Timeout was already set so just return
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
274
248
|
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
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
|
-
|
|
280
|
-
if (stack.length === 0) {
|
|
281
|
-
this._deferred.resolve();
|
|
282
|
-
return false;
|
|
269
|
+
return nodes[index];
|
|
283
270
|
}
|
|
284
271
|
|
|
285
|
-
|
|
286
|
-
|
|
272
|
+
_pop() {
|
|
273
|
+
const stack = this._stack;
|
|
274
|
+
stack.pop();
|
|
287
275
|
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
276
|
+
// Return false if we are done
|
|
277
|
+
if (stack.length === 0) {
|
|
278
|
+
this._deferred.resolve();
|
|
279
|
+
return false;
|
|
280
|
+
}
|
|
291
281
|
|
|
292
|
-
|
|
293
|
-
|
|
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
|
-
|
|
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
|
-
|
|
305
|
-
|
|
293
|
+
defined(featureProcessor) &&
|
|
294
|
+
(namespaces.kml.indexOf(child.namespaceURI) !== -1 ||
|
|
295
|
+
namespaces.gx.indexOf(child.namespaceURI) !== -1)
|
|
306
296
|
) {
|
|
307
|
-
this
|
|
308
|
-
|
|
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
|
-
|
|
313
|
-
|
|
309
|
+
child = this._nextNode();
|
|
310
|
+
}
|
|
314
311
|
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
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
|
-
|
|
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
|
-
*
|
|
3553
|
-
* for client height and width.
|
|
3554
|
-
*
|
|
3555
|
-
* @type {HTMLCanvasElement | undefined}
|
|
3527
|
+
* @param {KmlDataSource.ConstructorOptions} [options] Object describing initialization options
|
|
3556
3528
|
*/
|
|
3557
|
-
|
|
3558
|
-
|
|
3559
|
-
|
|
3560
|
-
|
|
3561
|
-
|
|
3562
|
-
|
|
3563
|
-
|
|
3564
|
-
|
|
3565
|
-
|
|
3566
|
-
|
|
3567
|
-
|
|
3568
|
-
|
|
3569
|
-
|
|
3570
|
-
|
|
3571
|
-
|
|
3572
|
-
|
|
3573
|
-
|
|
3574
|
-
|
|
3575
|
-
|
|
3576
|
-
|
|
3577
|
-
|
|
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
|
-
|
|
3579
|
+
this._ellipsoid = options.ellipsoid ?? Ellipsoid.default;
|
|
3581
3580
|
|
|
3582
|
-
|
|
3583
|
-
|
|
3584
|
-
|
|
3585
|
-
|
|
3586
|
-
|
|
3587
|
-
|
|
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
|
-
|
|
3590
|
-
|
|
3588
|
+
// Create a list of Credit's from the resource that the user can't remove
|
|
3589
|
+
this._resourceCredits = [];
|
|
3591
3590
|
|
|
3592
|
-
|
|
3591
|
+
this._kmlTours = [];
|
|
3593
3592
|
|
|
3594
|
-
|
|
3595
|
-
}
|
|
3593
|
+
this._screenOverlays = [];
|
|
3594
|
+
}
|
|
3596
3595
|
|
|
3597
|
-
/**
|
|
3598
|
-
|
|
3599
|
-
|
|
3600
|
-
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
|
|
3608
|
-
|
|
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
|
-
|
|
3620
|
-
|
|
3621
|
-
|
|
3622
|
-
|
|
3623
|
-
|
|
3624
|
-
|
|
3625
|
-
|
|
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
|
-
|
|
3638
|
-
|
|
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
|
-
|
|
3648
|
-
|
|
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
|
-
|
|
3658
|
-
|
|
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
|
-
|
|
3668
|
-
|
|
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
|
-
|
|
3678
|
-
|
|
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
|
-
|
|
3688
|
-
|
|
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
|
-
|
|
3698
|
-
|
|
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
|
-
|
|
3708
|
-
|
|
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
|
-
|
|
3718
|
-
|
|
3719
|
-
|
|
3720
|
-
|
|
3721
|
-
|
|
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
|
-
|
|
3733
|
-
|
|
3734
|
-
|
|
3735
|
-
|
|
3736
|
-
|
|
3737
|
-
|
|
3738
|
-
|
|
3739
|
-
|
|
3740
|
-
|
|
3741
|
-
|
|
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
|
-
|
|
3751
|
-
|
|
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
|
-
|
|
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
|
-
|
|
3782
|
-
|
|
3783
|
-
|
|
3784
|
-
|
|
3785
|
-
|
|
3786
|
-
|
|
3787
|
-
|
|
3788
|
-
|
|
3789
|
-
|
|
3790
|
-
|
|
3791
|
-
|
|
3792
|
-
|
|
3793
|
-
|
|
3794
|
-
|
|
3795
|
-
|
|
3796
|
-
|
|
3797
|
-
|
|
3798
|
-
|
|
3799
|
-
|
|
3800
|
-
|
|
3801
|
-
|
|
3802
|
-
|
|
3803
|
-
|
|
3804
|
-
|
|
3805
|
-
|
|
3806
|
-
|
|
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
|
-
|
|
3810
|
-
if (
|
|
3811
|
-
|
|
3812
|
-
|
|
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
|
-
|
|
3817
|
-
|
|
3818
|
-
|
|
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
|
-
|
|
3831
|
-
|
|
3832
|
-
|
|
3833
|
-
|
|
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
|
-
|
|
3837
|
-
|
|
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
|
-
|
|
3841
|
-
|
|
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
|
-
|
|
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
|
-
|
|
3847
|
-
|
|
3848
|
-
|
|
3849
|
-
|
|
3850
|
-
|
|
3851
|
-
|
|
3852
|
-
|
|
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
|
-
|
|
3858
|
-
|
|
3859
|
-
|
|
3860
|
-
|
|
3861
|
-
|
|
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
|
-
*
|
|
4039
|
-
*
|
|
4040
|
-
* @
|
|
4041
|
-
* @
|
|
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
|
-
|
|
4179
|
-
|
|
4180
|
-
|
|
4181
|
-
|
|
4182
|
-
|
|
4183
|
-
|
|
4184
|
-
|
|
4185
|
-
|
|
4186
|
-
|
|
4187
|
-
|
|
4188
|
-
|
|
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
|
-
|
|
4210
|
-
|
|
4211
|
-
|
|
4212
|
-
|
|
4213
|
-
|
|
4214
|
-
|
|
4215
|
-
|
|
4216
|
-
|
|
4217
|
-
|
|
4218
|
-
|
|
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
|
-
|
|
4223
|
-
|
|
4224
|
-
|
|
4225
|
-
|
|
4226
|
-
|
|
4227
|
-
|
|
4228
|
-
|
|
4229
|
-
|
|
4230
|
-
|
|
4231
|
-
|
|
4232
|
-
|
|
4233
|
-
|
|
4234
|
-
|
|
4235
|
-
|
|
4236
|
-
|
|
4237
|
-
|
|
4238
|
-
|
|
4239
|
-
|
|
4240
|
-
|
|
4241
|
-
|
|
4242
|
-
|
|
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
|