@cesium/engine 2.1.0 → 2.3.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/{AttributeCompression-8a5a065e.js → AttributeCompression-f9f6c717.js} +1 -1
- package/Build/Workers/{AxisAlignedBoundingBox-a6f9f0e5.js → AxisAlignedBoundingBox-31fadcf0.js} +1 -1
- package/Build/Workers/{BoundingRectangle-b0a68595.js → BoundingRectangle-995f0079.js} +1 -1
- package/Build/Workers/{BoxGeometry-baedd794.js → BoxGeometry-7eb1af60.js} +1 -1
- package/Build/Workers/{Color-f85df1be.js → Color-2dc49658.js} +1 -1
- package/Build/Workers/{CoplanarPolygonGeometryLibrary-30516950.js → CoplanarPolygonGeometryLibrary-d7d972d6.js} +1 -1
- package/Build/Workers/{CorridorGeometryLibrary-5d5d3b3a.js → CorridorGeometryLibrary-1f5ef7b3.js} +1 -1
- package/Build/Workers/{CylinderGeometry-d899ae26.js → CylinderGeometry-23c67a6c.js} +1 -1
- package/Build/Workers/{CylinderGeometryLibrary-135b0858.js → CylinderGeometryLibrary-7bf291b4.js} +1 -1
- package/Build/Workers/{EllipseGeometry-a49f8449.js → EllipseGeometry-37014da4.js} +1 -1
- package/Build/Workers/{EllipseGeometryLibrary-cba7edde.js → EllipseGeometryLibrary-92ab6b1e.js} +1 -1
- package/Build/Workers/{EllipseOutlineGeometry-8095c8cb.js → EllipseOutlineGeometry-12b6fef5.js} +1 -1
- package/Build/Workers/{EllipsoidGeodesic-dcff5cbd.js → EllipsoidGeodesic-5b3623dc.js} +1 -1
- package/Build/Workers/{EllipsoidGeometry-ed93f571.js → EllipsoidGeometry-508da15c.js} +1 -1
- package/Build/Workers/{EllipsoidOutlineGeometry-e4854854.js → EllipsoidOutlineGeometry-40d97455.js} +1 -1
- package/Build/Workers/{EllipsoidRhumbLine-b672d507.js → EllipsoidRhumbLine-ef872433.js} +1 -1
- package/Build/Workers/{EllipsoidTangentPlane-7ae1aa9a.js → EllipsoidTangentPlane-46d4d9c2.js} +1 -1
- package/Build/Workers/{EncodedCartesian3-e8bbca36.js → EncodedCartesian3-57415c8a.js} +1 -1
- package/Build/Workers/{FrustumGeometry-b62db3e3.js → FrustumGeometry-38605e69.js} +32 -4
- package/Build/Workers/{GeometryAttribute-780af4fa.js → GeometryAttribute-a466e9c7.js} +1 -1
- package/Build/Workers/{GeometryInstance-3fb607b7.js → GeometryInstance-34d9e21e.js} +1 -1
- package/Build/Workers/{GeometryPipeline-36b61c99.js → GeometryPipeline-dcf79306.js} +1 -1
- package/Build/Workers/{IndexDatatype-b8f3e09d.js → IndexDatatype-2643aa47.js} +1 -1
- package/Build/Workers/{IntersectionTests-e889fcf0.js → IntersectionTests-88c49b2e.js} +1 -1
- package/Build/Workers/{Math-dad82b4d.js → Math-0a2ac845.js} +12 -2
- package/Build/Workers/{Matrix2-1e403d0e.js → Matrix2-e1298525.js} +1 -1
- package/Build/Workers/{Matrix3-fa806b97.js → Matrix3-41c58dde.js} +1 -1
- package/Build/Workers/{OrientedBoundingBox-43478ac8.js → OrientedBoundingBox-2dd47921.js} +5 -3
- package/Build/Workers/{Plane-c27e1ac6.js → Plane-4c3d403b.js} +1 -1
- package/Build/Workers/{PolygonGeometryLibrary-38a98276.js → PolygonGeometryLibrary-59126025.js} +1 -1
- package/Build/Workers/PolygonPipeline-1fe328c0.js +1344 -0
- package/Build/Workers/{PolylinePipeline-30e4cec9.js → PolylinePipeline-896735cc.js} +1 -1
- package/Build/Workers/{PolylineVolumeGeometryLibrary-90551d26.js → PolylineVolumeGeometryLibrary-9c0639f7.js} +1 -1
- package/Build/Workers/{PrimitivePipeline-558d9cb0.js → PrimitivePipeline-fc1a47ff.js} +1 -1
- package/Build/Workers/{RectangleGeometryLibrary-815c68df.js → RectangleGeometryLibrary-a23c9ebe.js} +1 -1
- package/Build/Workers/{TerrainEncoding-341ead52.js → TerrainEncoding-51b8b33b.js} +1 -1
- package/Build/Workers/Transforms-bc45e707.js +14699 -0
- package/Build/Workers/{WallGeometryLibrary-ccf90976.js → WallGeometryLibrary-007e9883.js} +1 -1
- package/Build/Workers/{WebMercatorProjection-76a3fcc0.js → WebMercatorProjection-13ed1a6e.js} +1 -1
- package/Build/Workers/{arrayRemoveDuplicates-fac118a8.js → arrayRemoveDuplicates-d2061e85.js} +1 -1
- package/Build/Workers/cesiumWorkerBootstrapper.js +1 -1
- package/Build/Workers/combineGeometry.js +1 -1
- package/Build/Workers/createBoxGeometry.js +1 -1
- package/Build/Workers/createBoxOutlineGeometry.js +1 -1
- package/Build/Workers/createCircleGeometry.js +1 -1
- package/Build/Workers/createCircleOutlineGeometry.js +1 -1
- package/Build/Workers/createCoplanarPolygonGeometry.js +1 -1
- package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +1 -1
- package/Build/Workers/createCorridorGeometry.js +1 -1
- package/Build/Workers/createCorridorOutlineGeometry.js +1 -1
- package/Build/Workers/createCylinderGeometry.js +1 -1
- package/Build/Workers/createCylinderOutlineGeometry.js +1 -1
- package/Build/Workers/createEllipseGeometry.js +1 -1
- package/Build/Workers/createEllipseOutlineGeometry.js +1 -1
- package/Build/Workers/createEllipsoidGeometry.js +1 -1
- package/Build/Workers/createEllipsoidOutlineGeometry.js +1 -1
- package/Build/Workers/createFrustumGeometry.js +1 -1
- package/Build/Workers/createFrustumOutlineGeometry.js +1 -1
- package/Build/Workers/createGeometry.js +1 -1
- package/Build/Workers/createGroundPolylineGeometry.js +1 -1
- package/Build/Workers/createPlaneGeometry.js +1 -1
- package/Build/Workers/createPlaneOutlineGeometry.js +1 -1
- package/Build/Workers/createPolygonGeometry.js +1 -1
- package/Build/Workers/createPolygonOutlineGeometry.js +1 -1
- package/Build/Workers/createPolylineGeometry.js +1 -1
- package/Build/Workers/createPolylineVolumeGeometry.js +1 -1
- package/Build/Workers/createPolylineVolumeOutlineGeometry.js +1 -1
- package/Build/Workers/createRectangleGeometry.js +1 -1
- package/Build/Workers/createRectangleOutlineGeometry.js +1 -1
- package/Build/Workers/createSimplePolylineGeometry.js +1 -1
- package/Build/Workers/createSphereGeometry.js +1 -1
- package/Build/Workers/createSphereOutlineGeometry.js +1 -1
- package/Build/Workers/createVectorTileClampedPolylines.js +1 -1
- package/Build/Workers/createVectorTileGeometries.js +1 -1
- package/Build/Workers/createVectorTilePoints.js +1 -1
- package/Build/Workers/createVectorTilePolygons.js +1 -1
- package/Build/Workers/createVectorTilePolylines.js +1 -1
- package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +1 -1
- package/Build/Workers/createVerticesFromHeightmap.js +5 -8
- package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +10 -15
- package/Build/Workers/createWallGeometry.js +1 -1
- package/Build/Workers/createWallOutlineGeometry.js +1 -1
- package/Build/Workers/decodeDraco.js +1 -1
- package/Build/Workers/decodeI3S.js +1 -1
- package/Build/Workers/package.js +1 -1
- package/Build/Workers/transferTypedArrayTest.js +1 -1
- package/Build/Workers/upsampleQuantizedTerrainMesh.js +1 -1
- package/Source/Core/ArcGISTiledElevationTerrainProvider.js +291 -191
- package/Source/Core/BingMapsGeocoderService.js +19 -1
- package/Source/Core/CartographicGeocoderService.js +15 -0
- package/Source/Core/CesiumTerrainProvider.js +571 -434
- package/Source/Core/Credit.js +1 -1
- package/Source/Core/CustomHeightmapTerrainProvider.js +12 -0
- package/Source/Core/EllipsoidTerrainProvider.js +17 -10
- package/Source/Core/FrustumGeometry.js +4 -3
- package/Source/Core/GeocoderService.js +32 -1
- package/Source/Core/GoogleEarthEnterpriseMetadata.js +86 -34
- package/Source/Core/GoogleEarthEnterpriseTerrainProvider.js +119 -82
- package/Source/Core/Ion.js +1 -1
- package/Source/Core/IonGeocoderService.js +17 -2
- package/Source/Core/IonResource.js +14 -3
- package/Source/Core/OpenCageGeocoderService.js +18 -1
- package/Source/Core/OrientedBoundingBox.js +4 -2
- package/Source/Core/OrthographicFrustum.js +13 -0
- package/Source/Core/PeliasGeocoderService.js +14 -1
- package/Source/Core/PerspectiveFrustum.js +14 -0
- package/Source/Core/Request.js +3 -2
- package/Source/Core/RequestScheduler.js +10 -5
- package/Source/Core/Resource.js +230 -236
- package/Source/Core/TerrainProvider.js +9 -14
- package/Source/Core/TileProviderError.js +8 -8
- package/Source/Core/VRTheWorldTerrainProvider.js +193 -124
- package/Source/Core/buildModuleUrl.js +4 -3
- package/Source/Core/createWorldTerrain.js +20 -2
- package/Source/Core/createWorldTerrainAsync.js +48 -0
- package/Source/Core/sampleTerrain.js +9 -10
- package/Source/Core/sampleTerrainMostDetailed.js +66 -72
- package/Source/DataSources/Cesium3DTilesetVisualizer.js +37 -26
- package/Source/DataSources/DataSourceDisplay.js +2 -2
- package/Source/DataSources/Entity.js +6 -1
- package/Source/DataSources/EntityCluster.js +126 -128
- package/Source/DataSources/ModelVisualizer.js +104 -34
- package/Source/DataSources/PolygonGraphics.js +1 -1
- package/Source/Renderer/UniformState.js +3 -2
- package/Source/Renderer/demodernizeShader.js +5 -5
- package/Source/Scene/ArcGisBaseMapType.js +12 -0
- package/Source/Scene/ArcGisMapServerImageryProvider.js +694 -376
- package/Source/Scene/ArcGisMapService.js +83 -0
- package/Source/Scene/BingMapsImageryProvider.js +511 -305
- package/Source/Scene/BufferLoader.js +29 -34
- package/Source/Scene/Camera.js +8 -7
- package/Source/Scene/Cesium3DTile.js +392 -254
- package/Source/Scene/Cesium3DTileBatchTable.js +2 -2
- package/Source/Scene/Cesium3DTileContent.js +16 -0
- package/Source/Scene/Cesium3DTileContentFactory.js +4 -4
- package/Source/Scene/Cesium3DTilePass.js +8 -11
- package/Source/Scene/Cesium3DTileStyleEngine.js +1 -1
- package/Source/Scene/Cesium3DTilesVoxelProvider.js +225 -117
- package/Source/Scene/Cesium3DTileset.js +756 -482
- package/Source/Scene/Cesium3DTilesetBaseTraversal.js +301 -0
- package/Source/Scene/Cesium3DTilesetMostDetailedTraversal.js +33 -46
- package/Source/Scene/Cesium3DTilesetSkipTraversal.js +421 -0
- package/Source/Scene/Cesium3DTilesetTraversal.js +219 -671
- package/Source/Scene/ClassificationPrimitive.js +7 -0
- package/Source/Scene/Composite3DTileContent.js +69 -26
- package/Source/Scene/CreditDisplay.js +132 -20
- package/Source/Scene/DepthPlane.js +1 -1
- package/Source/Scene/Empty3DTileContent.js +31 -1
- package/Source/Scene/Geometry3DTileContent.js +47 -7
- package/Source/Scene/Globe.js +5 -1
- package/Source/Scene/GlobeSurfaceTile.js +2 -1
- package/Source/Scene/GlobeSurfaceTileProvider.js +53 -30
- package/Source/Scene/GltfBufferViewLoader.js +47 -91
- package/Source/Scene/GltfDracoLoader.js +110 -112
- package/Source/Scene/GltfImageLoader.js +71 -78
- package/Source/Scene/GltfIndexBufferLoader.js +108 -121
- package/Source/Scene/GltfJsonLoader.js +87 -74
- package/Source/Scene/GltfLoader.js +381 -300
- package/Source/Scene/GltfStructuralMetadataLoader.js +109 -110
- package/Source/Scene/GltfTextureLoader.js +97 -96
- package/Source/Scene/GltfVertexBufferLoader.js +128 -133
- package/Source/Scene/GoogleEarthEnterpriseImageryProvider.js +353 -225
- package/Source/Scene/GoogleEarthEnterpriseMapsProvider.js +491 -331
- package/Source/Scene/GridImageryProvider.js +267 -104
- package/Source/Scene/GroundPolylinePrimitive.js +12 -1
- package/Source/Scene/GroundPrimitive.js +8 -1
- package/Source/Scene/I3SDataProvider.js +214 -113
- package/Source/Scene/I3SFeature.js +7 -6
- package/Source/Scene/I3SLayer.js +26 -37
- package/Source/Scene/I3SNode.js +59 -66
- package/Source/Scene/Imagery.js +6 -1
- package/Source/Scene/ImageryLayer.js +299 -48
- package/Source/Scene/ImageryLayerCollection.js +26 -0
- package/Source/Scene/ImageryProvider.js +129 -111
- package/Source/Scene/Implicit3DTileContent.js +72 -23
- package/Source/Scene/ImplicitSubtree.js +66 -45
- package/Source/Scene/IonImageryProvider.js +482 -275
- package/Source/Scene/MapboxImageryProvider.js +272 -112
- package/Source/Scene/MapboxStyleImageryProvider.js +270 -111
- package/Source/Scene/MetadataSchemaLoader.js +26 -36
- package/Source/Scene/Model/B3dmLoader.js +42 -46
- package/Source/Scene/Model/GeoJsonLoader.js +8 -32
- package/Source/Scene/Model/I3dmLoader.js +48 -74
- package/Source/Scene/Model/MaterialPipelineStage.js +12 -12
- package/Source/Scene/Model/Model.js +514 -135
- package/Source/Scene/Model/Model3DTileContent.js +83 -31
- package/Source/Scene/Model/ModelAnimationCollection.js +3 -3
- package/Source/Scene/Model/ModelDrawCommand.js +15 -26
- package/Source/Scene/Model/ModelUtility.js +16 -16
- package/Source/Scene/Model/PntsLoader.js +27 -32
- package/Source/Scene/Model/UniformType.js +1 -1
- package/Source/Scene/Multiple3DTileContent.js +134 -115
- package/Source/Scene/Picking.js +3 -2
- package/Source/Scene/PointCloud.js +11 -19
- package/Source/Scene/Primitive.js +20 -0
- package/Source/Scene/QuadtreePrimitive.js +5 -2
- package/Source/Scene/QuadtreeTileProvider.js +4 -8
- package/Source/Scene/ResourceCache.js +47 -105
- package/Source/Scene/ResourceCacheStatistics.js +24 -58
- package/Source/Scene/ResourceLoader.js +5 -17
- package/Source/Scene/ResourceLoaderState.js +12 -4
- package/Source/Scene/Scene.js +65 -0
- package/Source/Scene/SceneTransforms.js +3 -2
- package/Source/Scene/ScreenSpaceCameraController.js +2 -2
- package/Source/Scene/SingleTileImageryProvider.js +382 -209
- package/Source/Scene/Terrain.js +196 -0
- package/Source/Scene/TileCoordinatesImageryProvider.js +267 -104
- package/Source/Scene/TileMapServiceImageryProvider.js +177 -85
- package/Source/Scene/Tileset3DTileContent.js +47 -5
- package/Source/Scene/TimeDynamicPointCloud.js +15 -2
- package/Source/Scene/UrlTemplateImageryProvider.js +343 -215
- package/Source/Scene/Vector3DTileClampedPolylines.js +96 -84
- package/Source/Scene/Vector3DTileContent.js +47 -22
- package/Source/Scene/Vector3DTileGeometry.js +57 -52
- package/Source/Scene/Vector3DTilePoints.js +97 -81
- package/Source/Scene/Vector3DTilePolygons.js +118 -117
- package/Source/Scene/Vector3DTilePolylines.js +86 -82
- package/Source/Scene/Vector3DTilePrimitive.js +0 -1
- package/Source/Scene/VoxelContent.js +61 -63
- package/Source/Scene/VoxelPrimitive.js +39 -91
- package/Source/Scene/VoxelProvider.js +2 -2
- package/Source/Scene/WebMapServiceImageryProvider.js +272 -111
- package/Source/Scene/WebMapTileServiceImageryProvider.js +270 -107
- package/Source/Scene/computeFlyToLocationForRectangle.js +33 -37
- package/Source/Scene/createOsmBuildings.js +6 -0
- package/Source/Scene/createOsmBuildingsAsync.js +82 -0
- package/Source/Scene/createWorldImagery.js +14 -5
- package/Source/Scene/createWorldImageryAsync.js +39 -0
- package/Source/Shaders/AtmosphereCommon.glsl +51 -8
- package/Source/Shaders/AtmosphereCommon.js +51 -8
- package/Source/Shaders/PostProcessStages/AmbientOcclusionGenerate.glsl +1 -1
- package/Source/Shaders/PostProcessStages/AmbientOcclusionGenerate.js +1 -1
- package/Source/Shaders/PostProcessStages/AmbientOcclusionModulate.glsl +3 -3
- package/Source/Shaders/PostProcessStages/AmbientOcclusionModulate.js +3 -3
- package/Source/Widget/CesiumWidget.js +67 -27
- package/index.d.ts +2429 -1475
- package/index.js +324 -315
- package/package.json +4 -4
- package/Build/Workers/PolygonPipeline-d31ff61c.js +0 -1345
- package/Build/Workers/Transforms-9e9df299.js +0 -14714
|
@@ -17,18 +17,16 @@ const scratchCartesian2 = new Cartesian2();
|
|
|
17
17
|
*
|
|
18
18
|
* @example
|
|
19
19
|
* // Query the terrain height of two Cartographic positions
|
|
20
|
-
* const terrainProvider = Cesium.
|
|
20
|
+
* const terrainProvider = await Cesium.createWorldTerrainAsync();
|
|
21
21
|
* const positions = [
|
|
22
22
|
* Cesium.Cartographic.fromDegrees(86.925145, 27.988257),
|
|
23
23
|
* Cesium.Cartographic.fromDegrees(87.0, 28.0)
|
|
24
24
|
* ];
|
|
25
|
-
* const
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
* // updatedPositions is just a reference to positions.
|
|
29
|
-
* });
|
|
25
|
+
* const updatedPositions = await Cesium.sampleTerrainMostDetailed(terrainProvider, positions);
|
|
26
|
+
* // positions[0].height and positions[1].height have been updated.
|
|
27
|
+
* // updatedPositions is just a reference to positions.
|
|
30
28
|
*/
|
|
31
|
-
function sampleTerrainMostDetailed(terrainProvider, positions) {
|
|
29
|
+
async function sampleTerrainMostDetailed(terrainProvider, positions) {
|
|
32
30
|
//>>includeStart('debug', pragmas.debug);
|
|
33
31
|
if (!defined(terrainProvider)) {
|
|
34
32
|
throw new DeveloperError("terrainProvider is required.");
|
|
@@ -38,80 +36,76 @@ function sampleTerrainMostDetailed(terrainProvider, positions) {
|
|
|
38
36
|
}
|
|
39
37
|
//>>includeEnd('debug');
|
|
40
38
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
const maxLevels = [];
|
|
39
|
+
const byLevel = [];
|
|
40
|
+
const maxLevels = [];
|
|
44
41
|
|
|
45
|
-
|
|
42
|
+
// readyPromise has been deprecated; This is here for backwards compatibility
|
|
43
|
+
await terrainProvider._readyPromise;
|
|
46
44
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
45
|
+
const availability = terrainProvider.availability;
|
|
46
|
+
|
|
47
|
+
//>>includeStart('debug', pragmas.debug);
|
|
48
|
+
if (!defined(availability)) {
|
|
49
|
+
throw new DeveloperError(
|
|
50
|
+
"sampleTerrainMostDetailed requires a terrain provider that has tile availability."
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
//>>includeEnd('debug');
|
|
54
|
+
|
|
55
|
+
const promises = [];
|
|
56
|
+
for (let i = 0; i < positions.length; ++i) {
|
|
57
|
+
const position = positions[i];
|
|
58
|
+
const maxLevel = availability.computeMaximumLevelAtPosition(position);
|
|
59
|
+
maxLevels[i] = maxLevel;
|
|
60
|
+
if (maxLevel === 0) {
|
|
61
|
+
// This is a special case where we have a parent terrain and we are requesting
|
|
62
|
+
// heights from an area that isn't covered by the top level terrain at all.
|
|
63
|
+
// This will essentially trigger the loading of the parent terrains root tile
|
|
64
|
+
terrainProvider.tilingScheme.positionToTileXY(
|
|
65
|
+
position,
|
|
66
|
+
1,
|
|
67
|
+
scratchCartesian2
|
|
68
|
+
);
|
|
69
|
+
const promise = terrainProvider.loadTileDataAvailability(
|
|
70
|
+
scratchCartesian2.x,
|
|
71
|
+
scratchCartesian2.y,
|
|
72
|
+
1
|
|
51
73
|
);
|
|
74
|
+
if (defined(promise)) {
|
|
75
|
+
promises.push(promise);
|
|
76
|
+
}
|
|
52
77
|
}
|
|
53
|
-
//>>includeEnd('debug');
|
|
54
78
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
// This is a special case where we have a parent terrain and we are requesting
|
|
62
|
-
// heights from an area that isn't covered by the top level terrain at all.
|
|
63
|
-
// This will essentially trigger the loading of the parent terrains root tile
|
|
64
|
-
terrainProvider.tilingScheme.positionToTileXY(
|
|
65
|
-
position,
|
|
66
|
-
1,
|
|
67
|
-
scratchCartesian2
|
|
68
|
-
);
|
|
69
|
-
const promise = terrainProvider.loadTileDataAvailability(
|
|
70
|
-
scratchCartesian2.x,
|
|
71
|
-
scratchCartesian2.y,
|
|
72
|
-
1
|
|
73
|
-
);
|
|
74
|
-
if (defined(promise)) {
|
|
75
|
-
promises.push(promise);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
79
|
+
let atLevel = byLevel[maxLevel];
|
|
80
|
+
if (!defined(atLevel)) {
|
|
81
|
+
byLevel[maxLevel] = atLevel = [];
|
|
82
|
+
}
|
|
83
|
+
atLevel.push(position);
|
|
84
|
+
}
|
|
78
85
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
86
|
+
await Promise.all(promises);
|
|
87
|
+
await Promise.all(
|
|
88
|
+
byLevel.map(function (positionsAtLevel, index) {
|
|
89
|
+
if (defined(positionsAtLevel)) {
|
|
90
|
+
return sampleTerrain(terrainProvider, index, positionsAtLevel);
|
|
82
91
|
}
|
|
83
|
-
|
|
84
|
-
|
|
92
|
+
})
|
|
93
|
+
);
|
|
94
|
+
const changedPositions = [];
|
|
95
|
+
for (let i = 0; i < positions.length; ++i) {
|
|
96
|
+
const position = positions[i];
|
|
97
|
+
const maxLevel = availability.computeMaximumLevelAtPosition(position);
|
|
85
98
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
return sampleTerrain(terrainProvider, index, positionsAtLevel);
|
|
92
|
-
}
|
|
93
|
-
})
|
|
94
|
-
);
|
|
95
|
-
})
|
|
96
|
-
.then(function () {
|
|
97
|
-
const changedPositions = [];
|
|
98
|
-
for (let i = 0; i < positions.length; ++i) {
|
|
99
|
-
const position = positions[i];
|
|
100
|
-
const maxLevel = availability.computeMaximumLevelAtPosition(position);
|
|
99
|
+
if (maxLevel !== maxLevels[i]) {
|
|
100
|
+
// Now that we loaded the max availability, a higher level has become available
|
|
101
|
+
changedPositions.push(position);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
101
104
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
}
|
|
106
|
-
}
|
|
105
|
+
if (changedPositions.length > 0) {
|
|
106
|
+
await sampleTerrainMostDetailed(terrainProvider, changedPositions);
|
|
107
|
+
}
|
|
107
108
|
|
|
108
|
-
|
|
109
|
-
return sampleTerrainMostDetailed(terrainProvider, changedPositions);
|
|
110
|
-
}
|
|
111
|
-
})
|
|
112
|
-
.then(function () {
|
|
113
|
-
return positions;
|
|
114
|
-
});
|
|
115
|
-
});
|
|
109
|
+
return positions;
|
|
116
110
|
}
|
|
117
111
|
export default sampleTerrainMostDetailed;
|
|
@@ -65,7 +65,7 @@ Cesium3DTilesetVisualizer.prototype.update = function (time) {
|
|
|
65
65
|
const tilesetGraphics = entity._tileset;
|
|
66
66
|
|
|
67
67
|
let resource;
|
|
68
|
-
|
|
68
|
+
const tilesetData = tilesetHash[entity.id];
|
|
69
69
|
const show =
|
|
70
70
|
entity.isShowing &&
|
|
71
71
|
entity.isAvailable(time) &&
|
|
@@ -86,28 +86,21 @@ Cesium3DTilesetVisualizer.prototype.update = function (time) {
|
|
|
86
86
|
continue;
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
-
|
|
89
|
+
const tileset = defined(tilesetData)
|
|
90
90
|
? tilesetData.tilesetPrimitive
|
|
91
91
|
: undefined;
|
|
92
|
-
if (!defined(
|
|
92
|
+
if (!defined(tilesetData) || resource.url !== tilesetData.url) {
|
|
93
93
|
if (defined(tileset)) {
|
|
94
94
|
primitives.removeAndDestroy(tileset);
|
|
95
|
-
delete tilesetHash[entity.id];
|
|
96
95
|
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
url: resource.url,
|
|
106
|
-
loadFail: false,
|
|
107
|
-
};
|
|
108
|
-
tilesetHash[entity.id] = tilesetData;
|
|
109
|
-
|
|
110
|
-
checkLoad(tileset, entity, tilesetHash);
|
|
96
|
+
|
|
97
|
+
delete tilesetHash[entity.id];
|
|
98
|
+
|
|
99
|
+
createTileset(resource, tilesetHash, entity, primitives);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
if (!defined(tileset)) {
|
|
103
|
+
continue;
|
|
111
104
|
}
|
|
112
105
|
|
|
113
106
|
tileset.show = true;
|
|
@@ -180,12 +173,12 @@ Cesium3DTilesetVisualizer.prototype.getBoundingSphere = function (
|
|
|
180
173
|
}
|
|
181
174
|
|
|
182
175
|
const primitive = tilesetData.tilesetPrimitive;
|
|
183
|
-
if (!defined(primitive)
|
|
184
|
-
return BoundingSphereState.
|
|
176
|
+
if (!defined(primitive)) {
|
|
177
|
+
return BoundingSphereState.PENDING;
|
|
185
178
|
}
|
|
186
179
|
|
|
187
|
-
if (!primitive.
|
|
188
|
-
return BoundingSphereState.
|
|
180
|
+
if (!primitive.show) {
|
|
181
|
+
return BoundingSphereState.FAILED;
|
|
189
182
|
}
|
|
190
183
|
|
|
191
184
|
BoundingSphere.clone(primitive.boundingSphere, result);
|
|
@@ -235,15 +228,33 @@ Cesium3DTilesetVisualizer.prototype._onCollectionChanged = function (
|
|
|
235
228
|
function removeTileset(visualizer, entity, tilesetHash, primitives) {
|
|
236
229
|
const tilesetData = tilesetHash[entity.id];
|
|
237
230
|
if (defined(tilesetData)) {
|
|
238
|
-
|
|
231
|
+
if (defined(tilesetData.tilesetPrimitive)) {
|
|
232
|
+
primitives.removeAndDestroy(tilesetData.tilesetPrimitive);
|
|
233
|
+
}
|
|
239
234
|
delete tilesetHash[entity.id];
|
|
240
235
|
}
|
|
241
236
|
}
|
|
242
237
|
|
|
243
|
-
function
|
|
244
|
-
|
|
238
|
+
async function createTileset(resource, tilesetHash, entity, primitives) {
|
|
239
|
+
tilesetHash[entity.id] = {
|
|
240
|
+
url: resource.url,
|
|
241
|
+
loadFail: false,
|
|
242
|
+
};
|
|
243
|
+
|
|
244
|
+
try {
|
|
245
|
+
const tileset = await Cesium3DTileset.fromUrl(resource);
|
|
246
|
+
tileset.id = entity;
|
|
247
|
+
primitives.add(tileset);
|
|
248
|
+
|
|
249
|
+
if (!defined(tilesetHash[entity.id])) {
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
tilesetHash[entity.id].tilesetPrimitive = tileset;
|
|
254
|
+
} catch (error) {
|
|
245
255
|
console.error(error);
|
|
246
256
|
tilesetHash[entity.id].loadFail = true;
|
|
247
|
-
}
|
|
257
|
+
}
|
|
248
258
|
}
|
|
259
|
+
|
|
249
260
|
export default Cesium3DTilesetVisualizer;
|
|
@@ -313,7 +313,7 @@ DataSourceDisplay.prototype._postRender = function () {
|
|
|
313
313
|
|
|
314
314
|
const credit = dataSource.credit;
|
|
315
315
|
if (defined(credit)) {
|
|
316
|
-
frameState.creditDisplay.
|
|
316
|
+
frameState.creditDisplay.addCreditToNextFrame(credit);
|
|
317
317
|
}
|
|
318
318
|
|
|
319
319
|
// Credits from the resource that the user can't remove
|
|
@@ -321,7 +321,7 @@ DataSourceDisplay.prototype._postRender = function () {
|
|
|
321
321
|
if (defined(credits)) {
|
|
322
322
|
const creditCount = credits.length;
|
|
323
323
|
for (let c = 0; c < creditCount; c++) {
|
|
324
|
-
frameState.creditDisplay.
|
|
324
|
+
frameState.creditDisplay.addCreditToNextFrame(credits[c]);
|
|
325
325
|
}
|
|
326
326
|
}
|
|
327
327
|
}
|
|
@@ -597,7 +597,12 @@ Entity.prototype.merge = function (source) {
|
|
|
597
597
|
//While source is required by the API to be an Entity, we internally call this method from the
|
|
598
598
|
//constructor with an options object to configure initial custom properties.
|
|
599
599
|
//So we need to ignore reserved-non-property.
|
|
600
|
-
if (
|
|
600
|
+
if (
|
|
601
|
+
name === "parent" ||
|
|
602
|
+
name === "name" ||
|
|
603
|
+
name === "availability" ||
|
|
604
|
+
name === "children"
|
|
605
|
+
) {
|
|
601
606
|
continue;
|
|
602
607
|
}
|
|
603
608
|
|
|
@@ -76,14 +76,6 @@ function EntityCluster(options) {
|
|
|
76
76
|
this.show = defaultValue(options.show, true);
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
function getX(point) {
|
|
80
|
-
return point.coord.x;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
function getY(point) {
|
|
84
|
-
return point.coord.y;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
79
|
function expandBoundingBox(bbox, pixelRange) {
|
|
88
80
|
bbox.x -= pixelRange;
|
|
89
81
|
bbox.y -= pixelRange;
|
|
@@ -335,153 +327,159 @@ function createDeclutterCallback(entityCluster) {
|
|
|
335
327
|
let collection;
|
|
336
328
|
let collectionIndex;
|
|
337
329
|
|
|
338
|
-
|
|
330
|
+
if (points.length > 0) {
|
|
331
|
+
const index = new KDBush(points.length, 64, Uint32Array);
|
|
332
|
+
for (let p = 0; p < points.length; ++p) {
|
|
333
|
+
index.add(points[p].coord.x, points[p].coord.y);
|
|
334
|
+
}
|
|
335
|
+
index.finish();
|
|
339
336
|
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
337
|
+
if (currentHeight < previousHeight) {
|
|
338
|
+
length = clusters.length;
|
|
339
|
+
for (i = 0; i < length; ++i) {
|
|
340
|
+
const cluster = clusters[i];
|
|
344
341
|
|
|
345
|
-
|
|
346
|
-
|
|
342
|
+
if (!occluder.isPointVisible(cluster.position)) {
|
|
343
|
+
continue;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
const coord = Billboard._computeScreenSpacePosition(
|
|
347
|
+
Matrix4.IDENTITY,
|
|
348
|
+
cluster.position,
|
|
349
|
+
Cartesian3.ZERO,
|
|
350
|
+
Cartesian2.ZERO,
|
|
351
|
+
scene
|
|
352
|
+
);
|
|
353
|
+
if (!defined(coord)) {
|
|
354
|
+
continue;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
const factor = 1.0 - currentHeight / previousHeight;
|
|
358
|
+
let width = (cluster.width = cluster.width * factor);
|
|
359
|
+
let height = (cluster.height = cluster.height * factor);
|
|
360
|
+
|
|
361
|
+
width = Math.max(width, cluster.minimumWidth);
|
|
362
|
+
height = Math.max(height, cluster.minimumHeight);
|
|
363
|
+
|
|
364
|
+
const minX = coord.x - width * 0.5;
|
|
365
|
+
const minY = coord.y - height * 0.5;
|
|
366
|
+
const maxX = coord.x + width;
|
|
367
|
+
const maxY = coord.y + height;
|
|
368
|
+
|
|
369
|
+
neighbors = index.range(minX, minY, maxX, maxY);
|
|
370
|
+
neighborLength = neighbors.length;
|
|
371
|
+
numPoints = 0;
|
|
372
|
+
ids = [];
|
|
373
|
+
|
|
374
|
+
for (j = 0; j < neighborLength; ++j) {
|
|
375
|
+
neighborIndex = neighbors[j];
|
|
376
|
+
neighborPoint = points[neighborIndex];
|
|
377
|
+
if (!neighborPoint.clustered) {
|
|
378
|
+
++numPoints;
|
|
379
|
+
|
|
380
|
+
collection = neighborPoint.collection;
|
|
381
|
+
collectionIndex = neighborPoint.index;
|
|
382
|
+
ids.push(collection.get(collectionIndex).id);
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
if (numPoints >= minimumClusterSize) {
|
|
387
|
+
addCluster(cluster.position, numPoints, ids, entityCluster);
|
|
388
|
+
newClusters.push(cluster);
|
|
389
|
+
|
|
390
|
+
for (j = 0; j < neighborLength; ++j) {
|
|
391
|
+
points[neighbors[j]].clustered = true;
|
|
392
|
+
}
|
|
393
|
+
}
|
|
347
394
|
}
|
|
395
|
+
}
|
|
348
396
|
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
Cartesian2.ZERO,
|
|
354
|
-
scene
|
|
355
|
-
);
|
|
356
|
-
if (!defined(coord)) {
|
|
397
|
+
length = points.length;
|
|
398
|
+
for (i = 0; i < length; ++i) {
|
|
399
|
+
const point = points[i];
|
|
400
|
+
if (point.clustered) {
|
|
357
401
|
continue;
|
|
358
402
|
}
|
|
359
403
|
|
|
360
|
-
|
|
361
|
-
let width = (cluster.width = cluster.width * factor);
|
|
362
|
-
let height = (cluster.height = cluster.height * factor);
|
|
404
|
+
point.clustered = true;
|
|
363
405
|
|
|
364
|
-
|
|
365
|
-
|
|
406
|
+
collection = point.collection;
|
|
407
|
+
collectionIndex = point.index;
|
|
366
408
|
|
|
367
|
-
const
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
409
|
+
const item = collection.get(collectionIndex);
|
|
410
|
+
bbox = getBoundingBox(
|
|
411
|
+
item,
|
|
412
|
+
point.coord,
|
|
413
|
+
pixelRange,
|
|
414
|
+
entityCluster,
|
|
415
|
+
pointBoundinRectangleScratch
|
|
416
|
+
);
|
|
417
|
+
const totalBBox = BoundingRectangle.clone(
|
|
418
|
+
bbox,
|
|
419
|
+
totalBoundingRectangleScratch
|
|
420
|
+
);
|
|
371
421
|
|
|
372
|
-
neighbors = index.range(
|
|
422
|
+
neighbors = index.range(
|
|
423
|
+
bbox.x,
|
|
424
|
+
bbox.y,
|
|
425
|
+
bbox.x + bbox.width,
|
|
426
|
+
bbox.y + bbox.height
|
|
427
|
+
);
|
|
373
428
|
neighborLength = neighbors.length;
|
|
374
|
-
|
|
375
|
-
|
|
429
|
+
|
|
430
|
+
const clusterPosition = Cartesian3.clone(item.position);
|
|
431
|
+
numPoints = 1;
|
|
432
|
+
ids = [item.id];
|
|
376
433
|
|
|
377
434
|
for (j = 0; j < neighborLength; ++j) {
|
|
378
435
|
neighborIndex = neighbors[j];
|
|
379
436
|
neighborPoint = points[neighborIndex];
|
|
380
437
|
if (!neighborPoint.clustered) {
|
|
438
|
+
const neighborItem = neighborPoint.collection.get(
|
|
439
|
+
neighborPoint.index
|
|
440
|
+
);
|
|
441
|
+
const neighborBBox = getBoundingBox(
|
|
442
|
+
neighborItem,
|
|
443
|
+
neighborPoint.coord,
|
|
444
|
+
pixelRange,
|
|
445
|
+
entityCluster,
|
|
446
|
+
neighborBoundingRectangleScratch
|
|
447
|
+
);
|
|
448
|
+
|
|
449
|
+
Cartesian3.add(
|
|
450
|
+
neighborItem.position,
|
|
451
|
+
clusterPosition,
|
|
452
|
+
clusterPosition
|
|
453
|
+
);
|
|
454
|
+
|
|
455
|
+
BoundingRectangle.union(totalBBox, neighborBBox, totalBBox);
|
|
381
456
|
++numPoints;
|
|
382
457
|
|
|
383
|
-
|
|
384
|
-
collectionIndex = neighborPoint.index;
|
|
385
|
-
ids.push(collection.get(collectionIndex).id);
|
|
458
|
+
ids.push(neighborItem.id);
|
|
386
459
|
}
|
|
387
460
|
}
|
|
388
461
|
|
|
389
462
|
if (numPoints >= minimumClusterSize) {
|
|
390
|
-
|
|
391
|
-
newClusters.push(cluster);
|
|
392
|
-
|
|
393
|
-
for (j = 0; j < neighborLength; ++j) {
|
|
394
|
-
points[neighbors[j]].clustered = true;
|
|
395
|
-
}
|
|
396
|
-
}
|
|
397
|
-
}
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
length = points.length;
|
|
401
|
-
for (i = 0; i < length; ++i) {
|
|
402
|
-
const point = points[i];
|
|
403
|
-
if (point.clustered) {
|
|
404
|
-
continue;
|
|
405
|
-
}
|
|
406
|
-
|
|
407
|
-
point.clustered = true;
|
|
408
|
-
|
|
409
|
-
collection = point.collection;
|
|
410
|
-
collectionIndex = point.index;
|
|
411
|
-
|
|
412
|
-
const item = collection.get(collectionIndex);
|
|
413
|
-
bbox = getBoundingBox(
|
|
414
|
-
item,
|
|
415
|
-
point.coord,
|
|
416
|
-
pixelRange,
|
|
417
|
-
entityCluster,
|
|
418
|
-
pointBoundinRectangleScratch
|
|
419
|
-
);
|
|
420
|
-
const totalBBox = BoundingRectangle.clone(
|
|
421
|
-
bbox,
|
|
422
|
-
totalBoundingRectangleScratch
|
|
423
|
-
);
|
|
424
|
-
|
|
425
|
-
neighbors = index.range(
|
|
426
|
-
bbox.x,
|
|
427
|
-
bbox.y,
|
|
428
|
-
bbox.x + bbox.width,
|
|
429
|
-
bbox.y + bbox.height
|
|
430
|
-
);
|
|
431
|
-
neighborLength = neighbors.length;
|
|
432
|
-
|
|
433
|
-
const clusterPosition = Cartesian3.clone(item.position);
|
|
434
|
-
numPoints = 1;
|
|
435
|
-
ids = [item.id];
|
|
436
|
-
|
|
437
|
-
for (j = 0; j < neighborLength; ++j) {
|
|
438
|
-
neighborIndex = neighbors[j];
|
|
439
|
-
neighborPoint = points[neighborIndex];
|
|
440
|
-
if (!neighborPoint.clustered) {
|
|
441
|
-
const neighborItem = neighborPoint.collection.get(
|
|
442
|
-
neighborPoint.index
|
|
443
|
-
);
|
|
444
|
-
const neighborBBox = getBoundingBox(
|
|
445
|
-
neighborItem,
|
|
446
|
-
neighborPoint.coord,
|
|
447
|
-
pixelRange,
|
|
448
|
-
entityCluster,
|
|
449
|
-
neighborBoundingRectangleScratch
|
|
450
|
-
);
|
|
451
|
-
|
|
452
|
-
Cartesian3.add(
|
|
453
|
-
neighborItem.position,
|
|
463
|
+
const position = Cartesian3.multiplyByScalar(
|
|
454
464
|
clusterPosition,
|
|
465
|
+
1.0 / numPoints,
|
|
455
466
|
clusterPosition
|
|
456
467
|
);
|
|
468
|
+
addCluster(position, numPoints, ids, entityCluster);
|
|
469
|
+
newClusters.push({
|
|
470
|
+
position: position,
|
|
471
|
+
width: totalBBox.width,
|
|
472
|
+
height: totalBBox.height,
|
|
473
|
+
minimumWidth: bbox.width,
|
|
474
|
+
minimumHeight: bbox.height,
|
|
475
|
+
});
|
|
457
476
|
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
}
|
|
464
|
-
|
|
465
|
-
if (numPoints >= minimumClusterSize) {
|
|
466
|
-
const position = Cartesian3.multiplyByScalar(
|
|
467
|
-
clusterPosition,
|
|
468
|
-
1.0 / numPoints,
|
|
469
|
-
clusterPosition
|
|
470
|
-
);
|
|
471
|
-
addCluster(position, numPoints, ids, entityCluster);
|
|
472
|
-
newClusters.push({
|
|
473
|
-
position: position,
|
|
474
|
-
width: totalBBox.width,
|
|
475
|
-
height: totalBBox.height,
|
|
476
|
-
minimumWidth: bbox.width,
|
|
477
|
-
minimumHeight: bbox.height,
|
|
478
|
-
});
|
|
479
|
-
|
|
480
|
-
for (j = 0; j < neighborLength; ++j) {
|
|
481
|
-
points[neighbors[j]].clustered = true;
|
|
477
|
+
for (j = 0; j < neighborLength; ++j) {
|
|
478
|
+
points[neighbors[j]].clustered = true;
|
|
479
|
+
}
|
|
480
|
+
} else {
|
|
481
|
+
addNonClusteredItem(item, entityCluster);
|
|
482
482
|
}
|
|
483
|
-
} else {
|
|
484
|
-
addNonClusteredItem(item, entityCluster);
|
|
485
483
|
}
|
|
486
484
|
}
|
|
487
485
|
|