@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
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import Cartesian2 from "../Core/Cartesian2.js";
|
|
2
2
|
import Cartesian4 from "../Core/Cartesian4.js";
|
|
3
|
+
import Check from "../Core/Check.js";
|
|
4
|
+
import createWorldImageryAsync from "../Scene/createWorldImageryAsync.js";
|
|
3
5
|
import defaultValue from "../Core/defaultValue.js";
|
|
4
6
|
import defined from "../Core/defined.js";
|
|
5
7
|
import destroyObject from "../Core/destroyObject.js";
|
|
8
|
+
import deprecationWarning from "../Core/deprecationWarning.js";
|
|
6
9
|
import DeveloperError from "../Core/DeveloperError.js";
|
|
10
|
+
import Event from "../Core/Event.js";
|
|
7
11
|
import FeatureDetection from "../Core/FeatureDetection.js";
|
|
8
12
|
import GeographicProjection from "../Core/GeographicProjection.js";
|
|
9
13
|
import IndexDatatype from "../Core/IndexDatatype.js";
|
|
@@ -37,35 +41,31 @@ import SplitDirection from "./SplitDirection.js";
|
|
|
37
41
|
import TileImagery from "./TileImagery.js";
|
|
38
42
|
|
|
39
43
|
/**
|
|
40
|
-
*
|
|
41
|
-
* on a {@link Globe}.
|
|
44
|
+
* @typedef {Object} ImageryLayer.ConstructorOptions
|
|
42
45
|
*
|
|
43
|
-
*
|
|
44
|
-
* @constructor
|
|
46
|
+
* Initialization options for the ImageryLayer constructor.
|
|
45
47
|
*
|
|
46
|
-
* @
|
|
47
|
-
* @param {object} [options] Object with the following properties:
|
|
48
|
-
* @param {Rectangle} [options.rectangle=imageryProvider.rectangle] The rectangle of the layer. This rectangle
|
|
48
|
+
* @property {Rectangle} [rectangle=imageryProvider.rectangle] The rectangle of the layer. This rectangle
|
|
49
49
|
* can limit the visible portion of the imagery provider.
|
|
50
|
-
* @
|
|
50
|
+
* @property {number|Function} [alpha=1.0] The alpha blending value of this layer, from 0.0 to 1.0.
|
|
51
51
|
* This can either be a simple number or a function with the signature
|
|
52
52
|
* <code>function(frameState, layer, x, y, level)</code>. The function is passed the
|
|
53
53
|
* current frame state, this layer, and the x, y, and level coordinates of the
|
|
54
54
|
* imagery tile for which the alpha is required, and it is expected to return
|
|
55
55
|
* the alpha value to use for the tile.
|
|
56
|
-
* @
|
|
56
|
+
* @property {number|Function} [nightAlpha=1.0] The alpha blending value of this layer on the night side of the globe, from 0.0 to 1.0.
|
|
57
57
|
* This can either be a simple number or a function with the signature
|
|
58
58
|
* <code>function(frameState, layer, x, y, level)</code>. The function is passed the
|
|
59
59
|
* current frame state, this layer, and the x, y, and level coordinates of the
|
|
60
60
|
* imagery tile for which the alpha is required, and it is expected to return
|
|
61
61
|
* the alpha value to use for the tile. This only takes effect when <code>enableLighting</code> is <code>true</code>.
|
|
62
|
-
* @
|
|
62
|
+
* @property {number|Function} [dayAlpha=1.0] The alpha blending value of this layer on the day side of the globe, from 0.0 to 1.0.
|
|
63
63
|
* This can either be a simple number or a function with the signature
|
|
64
64
|
* <code>function(frameState, layer, x, y, level)</code>. The function is passed the
|
|
65
65
|
* current frame state, this layer, and the x, y, and level coordinates of the
|
|
66
66
|
* imagery tile for which the alpha is required, and it is expected to return
|
|
67
67
|
* the alpha value to use for the tile. This only takes effect when <code>enableLighting</code> is <code>true</code>.
|
|
68
|
-
* @
|
|
68
|
+
* @property {number|Function} [brightness=1.0] The brightness of this layer. 1.0 uses the unmodified imagery
|
|
69
69
|
* color. Less than 1.0 makes the imagery darker while greater than 1.0 makes it brighter.
|
|
70
70
|
* This can either be a simple number or a function with the signature
|
|
71
71
|
* <code>function(frameState, layer, x, y, level)</code>. The function is passed the
|
|
@@ -73,7 +73,7 @@ import TileImagery from "./TileImagery.js";
|
|
|
73
73
|
* imagery tile for which the brightness is required, and it is expected to return
|
|
74
74
|
* the brightness value to use for the tile. The function is executed for every
|
|
75
75
|
* frame and for every tile, so it must be fast.
|
|
76
|
-
* @
|
|
76
|
+
* @property {number|Function} [contrast=1.0] The contrast of this layer. 1.0 uses the unmodified imagery color.
|
|
77
77
|
* Less than 1.0 reduces the contrast while greater than 1.0 increases it.
|
|
78
78
|
* This can either be a simple number or a function with the signature
|
|
79
79
|
* <code>function(frameState, layer, x, y, level)</code>. The function is passed the
|
|
@@ -81,14 +81,14 @@ import TileImagery from "./TileImagery.js";
|
|
|
81
81
|
* imagery tile for which the contrast is required, and it is expected to return
|
|
82
82
|
* the contrast value to use for the tile. The function is executed for every
|
|
83
83
|
* frame and for every tile, so it must be fast.
|
|
84
|
-
* @
|
|
84
|
+
* @property {number|Function} [hue=0.0] The hue of this layer. 0.0 uses the unmodified imagery color.
|
|
85
85
|
* This can either be a simple number or a function with the signature
|
|
86
86
|
* <code>function(frameState, layer, x, y, level)</code>. The function is passed the
|
|
87
87
|
* current frame state, this layer, and the x, y, and level coordinates
|
|
88
88
|
* of the imagery tile for which the hue is required, and it is expected to return
|
|
89
89
|
* the contrast value to use for the tile. The function is executed for every
|
|
90
90
|
* frame and for every tile, so it must be fast.
|
|
91
|
-
* @
|
|
91
|
+
* @property {number|Function} [saturation=1.0] The saturation of this layer. 1.0 uses the unmodified imagery color.
|
|
92
92
|
* Less than 1.0 reduces the saturation while greater than 1.0 increases it.
|
|
93
93
|
* This can either be a simple number or a function with the signature
|
|
94
94
|
* <code>function(frameState, layer, x, y, level)</code>. The function is passed the
|
|
@@ -96,39 +96,75 @@ import TileImagery from "./TileImagery.js";
|
|
|
96
96
|
* of the imagery tile for which the saturation is required, and it is expected to return
|
|
97
97
|
* the contrast value to use for the tile. The function is executed for every
|
|
98
98
|
* frame and for every tile, so it must be fast.
|
|
99
|
-
* @
|
|
99
|
+
* @property {number|Function} [gamma=1.0] The gamma correction to apply to this layer. 1.0 uses the unmodified imagery color.
|
|
100
100
|
* This can either be a simple number or a function with the signature
|
|
101
101
|
* <code>function(frameState, layer, x, y, level)</code>. The function is passed the
|
|
102
102
|
* current frame state, this layer, and the x, y, and level coordinates of the
|
|
103
103
|
* imagery tile for which the gamma is required, and it is expected to return
|
|
104
104
|
* the gamma value to use for the tile. The function is executed for every
|
|
105
105
|
* frame and for every tile, so it must be fast.
|
|
106
|
-
* @
|
|
107
|
-
* @
|
|
106
|
+
* @property {SplitDirection|Function} [splitDirection=SplitDirection.NONE] The {@link SplitDirection} split to apply to this layer.
|
|
107
|
+
* @property {TextureMinificationFilter} [minificationFilter=TextureMinificationFilter.LINEAR] The
|
|
108
108
|
* texture minification filter to apply to this layer. Possible values
|
|
109
109
|
* are <code>TextureMinificationFilter.LINEAR</code> and
|
|
110
110
|
* <code>TextureMinificationFilter.NEAREST</code>.
|
|
111
|
-
* @
|
|
111
|
+
* @property {TextureMagnificationFilter} [magnificationFilter=TextureMagnificationFilter.LINEAR] The
|
|
112
112
|
* texture minification filter to apply to this layer. Possible values
|
|
113
113
|
* are <code>TextureMagnificationFilter.LINEAR</code> and
|
|
114
114
|
* <code>TextureMagnificationFilter.NEAREST</code>.
|
|
115
|
-
* @
|
|
116
|
-
* @
|
|
115
|
+
* @property {boolean} [show=true] True if the layer is shown; otherwise, false.
|
|
116
|
+
* @property {number} [maximumAnisotropy=maximum supported] The maximum anisotropy level to use
|
|
117
117
|
* for texture filtering. If this parameter is not specified, the maximum anisotropy supported
|
|
118
118
|
* by the WebGL stack will be used. Larger values make the imagery look better in horizon
|
|
119
119
|
* views.
|
|
120
|
-
* @
|
|
120
|
+
* @property {number} [minimumTerrainLevel] The minimum terrain level-of-detail at which to show this imagery layer,
|
|
121
121
|
* or undefined to show it at all levels. Level zero is the least-detailed level.
|
|
122
|
-
* @
|
|
122
|
+
* @property {number} [maximumTerrainLevel] The maximum terrain level-of-detail at which to show this imagery layer,
|
|
123
123
|
* or undefined to show it at all levels. Level zero is the least-detailed level.
|
|
124
|
-
* @
|
|
125
|
-
* @
|
|
126
|
-
* @
|
|
124
|
+
* @property {Rectangle} [cutoutRectangle] Cartographic rectangle for cutting out a portion of this ImageryLayer.
|
|
125
|
+
* @property {Color} [colorToAlpha] Color to be used as alpha.
|
|
126
|
+
* @property {number} [colorToAlphaThreshold=0.004] Threshold for color-to-alpha.
|
|
127
|
+
*/
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* An imagery layer that displays tiled image data from a single imagery provider
|
|
131
|
+
* on a {@link Globe}.
|
|
132
|
+
*
|
|
133
|
+
* @alias ImageryLayer
|
|
134
|
+
* @constructor
|
|
135
|
+
*
|
|
136
|
+
* @param {ImageryProvider} imageryProvider The imagery provider to use.
|
|
137
|
+
* @param {ImageryLayer.ConstructorOptions} options An object describing initialization options
|
|
138
|
+
*
|
|
139
|
+
* @see ImageryLayer.fromProviderAsync
|
|
140
|
+
* @see ImageryLayer.fromWorldImagery
|
|
141
|
+
*
|
|
142
|
+
* @example
|
|
143
|
+
* // Add an OpenStreetMaps layer
|
|
144
|
+
* const imageryLayer = new Cesium.ImageryLayer(OpenStreetMapImageryProvider({
|
|
145
|
+
* url: "https://a.tile.openstreetmap.org/"
|
|
146
|
+
* })),
|
|
147
|
+
* scene.imageryLayers.add(imageryLayer);
|
|
148
|
+
*
|
|
149
|
+
* @example
|
|
150
|
+
* // Add Cesium ion's default world imagery layer
|
|
151
|
+
* const imageryLayer = Cesium.ImageryLayer.fromWorldImagery();
|
|
152
|
+
* scene.imageryLayers.add(imageryLayer);
|
|
153
|
+
*
|
|
154
|
+
* @example
|
|
155
|
+
* // Add a new transparent layer from Cesium ion
|
|
156
|
+
* const imageryLayer = Cesium.ImageryLayer.fromProviderAsync(Cesium.IonImageryProvider.fromAssetId(3812));
|
|
157
|
+
* imageryLayer.alpha = 0.5;
|
|
158
|
+
* scene.imageryLayers.add(imageryLayer);
|
|
127
159
|
*/
|
|
128
160
|
function ImageryLayer(imageryProvider, options) {
|
|
129
161
|
this._imageryProvider = imageryProvider;
|
|
130
162
|
|
|
163
|
+
this._readyEvent = new Event();
|
|
164
|
+
this._errorEvent = new Event();
|
|
165
|
+
|
|
131
166
|
options = defaultValue(options, defaultValue.EMPTY_OBJECT);
|
|
167
|
+
imageryProvider = defaultValue(imageryProvider, defaultValue.EMPTY_OBJECT);
|
|
132
168
|
|
|
133
169
|
/**
|
|
134
170
|
* The alpha blending value of this layer, with 0.0 representing fully transparent and
|
|
@@ -139,7 +175,7 @@ function ImageryLayer(imageryProvider, options) {
|
|
|
139
175
|
*/
|
|
140
176
|
this.alpha = defaultValue(
|
|
141
177
|
options.alpha,
|
|
142
|
-
defaultValue(imageryProvider.
|
|
178
|
+
defaultValue(imageryProvider._defaultAlpha, 1.0)
|
|
143
179
|
);
|
|
144
180
|
|
|
145
181
|
/**
|
|
@@ -151,7 +187,7 @@ function ImageryLayer(imageryProvider, options) {
|
|
|
151
187
|
*/
|
|
152
188
|
this.nightAlpha = defaultValue(
|
|
153
189
|
options.nightAlpha,
|
|
154
|
-
defaultValue(imageryProvider.
|
|
190
|
+
defaultValue(imageryProvider._defaultNightAlpha, 1.0)
|
|
155
191
|
);
|
|
156
192
|
|
|
157
193
|
/**
|
|
@@ -163,7 +199,7 @@ function ImageryLayer(imageryProvider, options) {
|
|
|
163
199
|
*/
|
|
164
200
|
this.dayAlpha = defaultValue(
|
|
165
201
|
options.dayAlpha,
|
|
166
|
-
defaultValue(imageryProvider.
|
|
202
|
+
defaultValue(imageryProvider._defaultDayAlpha, 1.0)
|
|
167
203
|
);
|
|
168
204
|
|
|
169
205
|
/**
|
|
@@ -176,7 +212,7 @@ function ImageryLayer(imageryProvider, options) {
|
|
|
176
212
|
this.brightness = defaultValue(
|
|
177
213
|
options.brightness,
|
|
178
214
|
defaultValue(
|
|
179
|
-
imageryProvider.
|
|
215
|
+
imageryProvider._defaultBrightness,
|
|
180
216
|
ImageryLayer.DEFAULT_BRIGHTNESS
|
|
181
217
|
)
|
|
182
218
|
);
|
|
@@ -190,7 +226,10 @@ function ImageryLayer(imageryProvider, options) {
|
|
|
190
226
|
*/
|
|
191
227
|
this.contrast = defaultValue(
|
|
192
228
|
options.contrast,
|
|
193
|
-
defaultValue(
|
|
229
|
+
defaultValue(
|
|
230
|
+
imageryProvider._defaultContrast,
|
|
231
|
+
ImageryLayer.DEFAULT_CONTRAST
|
|
232
|
+
)
|
|
194
233
|
);
|
|
195
234
|
|
|
196
235
|
/**
|
|
@@ -201,7 +240,7 @@ function ImageryLayer(imageryProvider, options) {
|
|
|
201
240
|
*/
|
|
202
241
|
this.hue = defaultValue(
|
|
203
242
|
options.hue,
|
|
204
|
-
defaultValue(imageryProvider.
|
|
243
|
+
defaultValue(imageryProvider._defaultHue, ImageryLayer.DEFAULT_HUE)
|
|
205
244
|
);
|
|
206
245
|
|
|
207
246
|
/**
|
|
@@ -214,7 +253,7 @@ function ImageryLayer(imageryProvider, options) {
|
|
|
214
253
|
this.saturation = defaultValue(
|
|
215
254
|
options.saturation,
|
|
216
255
|
defaultValue(
|
|
217
|
-
imageryProvider.
|
|
256
|
+
imageryProvider._defaultSaturation,
|
|
218
257
|
ImageryLayer.DEFAULT_SATURATION
|
|
219
258
|
)
|
|
220
259
|
);
|
|
@@ -227,7 +266,7 @@ function ImageryLayer(imageryProvider, options) {
|
|
|
227
266
|
*/
|
|
228
267
|
this.gamma = defaultValue(
|
|
229
268
|
options.gamma,
|
|
230
|
-
defaultValue(imageryProvider.
|
|
269
|
+
defaultValue(imageryProvider._defaultGamma, ImageryLayer.DEFAULT_GAMMA)
|
|
231
270
|
);
|
|
232
271
|
|
|
233
272
|
/**
|
|
@@ -238,7 +277,7 @@ function ImageryLayer(imageryProvider, options) {
|
|
|
238
277
|
*/
|
|
239
278
|
this.splitDirection = defaultValue(
|
|
240
279
|
options.splitDirection,
|
|
241
|
-
|
|
280
|
+
ImageryLayer.DEFAULT_SPLIT
|
|
242
281
|
);
|
|
243
282
|
|
|
244
283
|
/**
|
|
@@ -255,7 +294,7 @@ function ImageryLayer(imageryProvider, options) {
|
|
|
255
294
|
this.minificationFilter = defaultValue(
|
|
256
295
|
options.minificationFilter,
|
|
257
296
|
defaultValue(
|
|
258
|
-
imageryProvider.
|
|
297
|
+
imageryProvider._defaultMinificationFilter,
|
|
259
298
|
ImageryLayer.DEFAULT_MINIFICATION_FILTER
|
|
260
299
|
)
|
|
261
300
|
);
|
|
@@ -274,7 +313,7 @@ function ImageryLayer(imageryProvider, options) {
|
|
|
274
313
|
this.magnificationFilter = defaultValue(
|
|
275
314
|
options.magnificationFilter,
|
|
276
315
|
defaultValue(
|
|
277
|
-
imageryProvider.
|
|
316
|
+
imageryProvider._defaultMagnificationFilter,
|
|
278
317
|
ImageryLayer.DEFAULT_MAGNIFICATION_FILTER
|
|
279
318
|
)
|
|
280
319
|
);
|
|
@@ -337,7 +376,7 @@ function ImageryLayer(imageryProvider, options) {
|
|
|
337
376
|
|
|
338
377
|
Object.defineProperties(ImageryLayer.prototype, {
|
|
339
378
|
/**
|
|
340
|
-
* Gets the imagery provider for this layer.
|
|
379
|
+
* Gets the imagery provider for this layer. This should not be called before {@link ImageryLayer#ready} returns true.
|
|
341
380
|
* @memberof ImageryLayer.prototype
|
|
342
381
|
* @type {ImageryProvider}
|
|
343
382
|
* @readonly
|
|
@@ -348,6 +387,45 @@ Object.defineProperties(ImageryLayer.prototype, {
|
|
|
348
387
|
},
|
|
349
388
|
},
|
|
350
389
|
|
|
390
|
+
/**
|
|
391
|
+
* Returns true when the terrain provider has been successfully created. Otherwise, returns false.
|
|
392
|
+
* @memberof ImageryLayer.prototype
|
|
393
|
+
* @type {boolean}
|
|
394
|
+
* @readonly
|
|
395
|
+
*/
|
|
396
|
+
ready: {
|
|
397
|
+
get: function () {
|
|
398
|
+
return defined(this._imageryProvider);
|
|
399
|
+
},
|
|
400
|
+
},
|
|
401
|
+
|
|
402
|
+
/**
|
|
403
|
+
* Gets an event that is raised when the imagery provider encounters an asynchronous error. By subscribing
|
|
404
|
+
* to the event, you will be notified of the error and can potentially recover from it. Event listeners
|
|
405
|
+
* are passed an instance of the thrown error.
|
|
406
|
+
* @memberof Imagery.prototype
|
|
407
|
+
* @type {Event<Imagery.ErrorEventCallback>}
|
|
408
|
+
* @readonly
|
|
409
|
+
*/
|
|
410
|
+
errorEvent: {
|
|
411
|
+
get: function () {
|
|
412
|
+
return this._errorEvent;
|
|
413
|
+
},
|
|
414
|
+
},
|
|
415
|
+
|
|
416
|
+
/**
|
|
417
|
+
* Gets an event that is raised when the imagery provider has been successfully created. Event listeners
|
|
418
|
+
* are passed the created instance of {@link ImageryProvider}.
|
|
419
|
+
* @memberof ImageryLayer.prototype
|
|
420
|
+
* @type {Event<ImageryLayer.ReadyEventCallback>}
|
|
421
|
+
* @readonly
|
|
422
|
+
*/
|
|
423
|
+
readyEvent: {
|
|
424
|
+
get: function () {
|
|
425
|
+
return this._readyEvent;
|
|
426
|
+
},
|
|
427
|
+
},
|
|
428
|
+
|
|
351
429
|
/**
|
|
352
430
|
* Gets the rectangle of this layer. If this rectangle is smaller than the rectangle of the
|
|
353
431
|
* {@link ImageryProvider}, only a portion of the imagery provider is shown.
|
|
@@ -430,6 +508,113 @@ ImageryLayer.DEFAULT_MAGNIFICATION_FILTER = TextureMagnificationFilter.LINEAR;
|
|
|
430
508
|
*/
|
|
431
509
|
ImageryLayer.DEFAULT_APPLY_COLOR_TO_ALPHA_THRESHOLD = 0.004;
|
|
432
510
|
|
|
511
|
+
/**
|
|
512
|
+
* Create a new imagery layer from an asynchronous imagery provider. The layer will handle any asynchronous loads or errors, and begin rendering the imagery layer once ready.
|
|
513
|
+
*
|
|
514
|
+
* @param {Promise<ImageryProvider>} imageryProviderPromise A promise which resolves to a imagery provider
|
|
515
|
+
* @param {ImageryLayer.ConstructorOptions} options An object describing initialization options
|
|
516
|
+
* @returns {ImageryLayer} The created imagery layer.
|
|
517
|
+
*
|
|
518
|
+
* @example
|
|
519
|
+
* // Create a new base layer
|
|
520
|
+
* const viewer = new Cesium.Viewer("cesiumContainer", {
|
|
521
|
+
* baseLayer: Cesium.ImageryLayer.fromProviderAsync(Cesium.IonImageryProvider.fromAssetId(3812));
|
|
522
|
+
* });
|
|
523
|
+
*
|
|
524
|
+
* @example
|
|
525
|
+
* // Add a new transparent layer
|
|
526
|
+
* const imageryLayer = Cesium.ImageryLayer.fromProviderAsync(Cesium.IonImageryProvider.fromAssetId(3812));
|
|
527
|
+
* imageryLayer.alpha = 0.5;
|
|
528
|
+
* viewer.imageryLayers.add(imageryLayer);
|
|
529
|
+
*
|
|
530
|
+
* @example
|
|
531
|
+
* // Handle loading events
|
|
532
|
+
* const imageryLayer = Cesium.ImageryLayer.fromProviderAsync(Cesium.IonImageryProvider.fromAssetId(3812));
|
|
533
|
+
* viewer.imageryLayers.add(imageryLayer);
|
|
534
|
+
*
|
|
535
|
+
* imageryLayer.readyEvent.addEventListener(provider => {
|
|
536
|
+
* imageryLayer.provider.errorEvent.addEventListener(error => {
|
|
537
|
+
* alert(`Encountered an error while loading imagery tiles! ${error}`);
|
|
538
|
+
* });
|
|
539
|
+
* });
|
|
540
|
+
*
|
|
541
|
+
* imageryLayer.errorEvent.addEventListener(error => {
|
|
542
|
+
* alert(`Encountered an error while creating an imagery layer! ${error}`);
|
|
543
|
+
* });
|
|
544
|
+
*
|
|
545
|
+
* @see ImageryLayer.errorEvent
|
|
546
|
+
* @see ImageryLayer.readyEvent
|
|
547
|
+
* @see ImageryLayer.provider
|
|
548
|
+
* @see ImageryLayer.fromWorldImagery
|
|
549
|
+
*/
|
|
550
|
+
ImageryLayer.fromProviderAsync = function (imageryProviderPromise, options) {
|
|
551
|
+
//>>includeStart('debug', pragmas.debug);
|
|
552
|
+
Check.typeOf.object("imageryProviderPromise", imageryProviderPromise);
|
|
553
|
+
//>>includeEnd('debug');
|
|
554
|
+
|
|
555
|
+
const layer = new ImageryLayer(undefined, options);
|
|
556
|
+
|
|
557
|
+
handlePromise(layer, Promise.resolve(imageryProviderPromise));
|
|
558
|
+
|
|
559
|
+
return layer;
|
|
560
|
+
};
|
|
561
|
+
|
|
562
|
+
/**
|
|
563
|
+
* @typedef {ImageryLayer.ConstructorOptions} ImageryLayer.WorldImageryConstructorOptions
|
|
564
|
+
*
|
|
565
|
+
* Initialization options for ImageryLayer.fromWorldImagery
|
|
566
|
+
*
|
|
567
|
+
* @property {IonWorldImageryStyle} [options.style=IonWorldImageryStyle] The style of base imagery, only AERIAL, AERIAL_WITH_LABELS, and ROAD are currently supported.
|
|
568
|
+
*/
|
|
569
|
+
|
|
570
|
+
/**
|
|
571
|
+
* Create a new imagery layer for ion's default global base imagery layer, currently Bing Maps. The layer will handle any asynchronous loads or errors, and begin rendering the imagery layer once ready.
|
|
572
|
+
*
|
|
573
|
+
* @param {ImageryLayer.WorldImageryConstructorOptions} options An object describing initialization options
|
|
574
|
+
* @returns {ImageryLayer} The created imagery layer.
|
|
575
|
+
*
|
|
576
|
+
* * @example
|
|
577
|
+
* // Create a new base layer
|
|
578
|
+
* const viewer = new Cesium.Viewer("cesiumContainer", {
|
|
579
|
+
* baseLayer: Cesium.ImageryLayer.fromWorldImagery();
|
|
580
|
+
* });
|
|
581
|
+
*
|
|
582
|
+
* @example
|
|
583
|
+
* // Add a new transparent layer
|
|
584
|
+
* const imageryLayer = Cesium.ImageryLayer.fromWorldImagery();
|
|
585
|
+
* imageryLayer.alpha = 0.5;
|
|
586
|
+
* viewer.imageryLayers.add(imageryLayer);
|
|
587
|
+
*
|
|
588
|
+
* @example
|
|
589
|
+
* // Handle loading events
|
|
590
|
+
* const imageryLayer = Cesium.ImageryLayer.fromWorldImagery();
|
|
591
|
+
* viewer.imageryLayers.add(imageryLayer);
|
|
592
|
+
*
|
|
593
|
+
* imageryLayer.readyEvent.addEventListener(provider => {
|
|
594
|
+
* imageryLayer.provider.errorEvent.addEventListener(error => {
|
|
595
|
+
* alert(`Encountered an error while loading imagery tiles! ${error}`);
|
|
596
|
+
* });
|
|
597
|
+
* });
|
|
598
|
+
*
|
|
599
|
+
* imageryLayer.errorEvent.addEventListener(error => {
|
|
600
|
+
* alert(`Encountered an error while creating an imagery layer! ${error}`);
|
|
601
|
+
* });
|
|
602
|
+
*
|
|
603
|
+
* @see ImageryLayer.errorEvent
|
|
604
|
+
* @see ImageryLayer.readyEvent
|
|
605
|
+
* @see ImageryLayer.provider
|
|
606
|
+
*/
|
|
607
|
+
ImageryLayer.fromWorldImagery = function (options) {
|
|
608
|
+
options = defaultValue(options, defaultValue.EMPTY_OBJECT);
|
|
609
|
+
|
|
610
|
+
return ImageryLayer.fromProviderAsync(
|
|
611
|
+
createWorldImageryAsync({
|
|
612
|
+
style: options.style,
|
|
613
|
+
}),
|
|
614
|
+
options
|
|
615
|
+
);
|
|
616
|
+
};
|
|
617
|
+
|
|
433
618
|
/**
|
|
434
619
|
* Gets a value indicating whether this layer is the base layer in the
|
|
435
620
|
* {@link ImageryLayerCollection}. The base layer is the one that underlies all
|
|
@@ -496,12 +681,37 @@ const terrainRectangleScratch = new Rectangle();
|
|
|
496
681
|
* });
|
|
497
682
|
* });
|
|
498
683
|
*/
|
|
499
|
-
ImageryLayer.prototype.getViewableRectangle = function () {
|
|
684
|
+
ImageryLayer.prototype.getViewableRectangle = async function () {
|
|
685
|
+
deprecationWarning(
|
|
686
|
+
"ImageryLayer.getViewableRectangle",
|
|
687
|
+
"ImageryLayer.getViewableRectangle was deprecated in CesiumJS 1.104. It will be removed in CesiumJS 1.107. Use ImageryLayer.getImageryRectangle instead."
|
|
688
|
+
);
|
|
689
|
+
|
|
500
690
|
const imageryProvider = this._imageryProvider;
|
|
501
691
|
const rectangle = this._rectangle;
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
692
|
+
// readyPromise has been deprecated. This is here for backward compatibility and can be removed with readyPromise.
|
|
693
|
+
await imageryProvider._readyPromise;
|
|
694
|
+
return Rectangle.intersection(imageryProvider.rectangle, rectangle);
|
|
695
|
+
};
|
|
696
|
+
|
|
697
|
+
/**
|
|
698
|
+
* Computes the intersection of this layer's rectangle with the imagery provider's availability rectangle,
|
|
699
|
+
* producing the overall bounds of imagery that can be produced by this layer.
|
|
700
|
+
*
|
|
701
|
+
* @returns {Rectangle} A rectangle which defines the overall bounds of imagery that can be produced by this layer.
|
|
702
|
+
*
|
|
703
|
+
* @example
|
|
704
|
+
* // Zoom to an imagery layer.
|
|
705
|
+
* const imageryRectangle = imageryLayer.getImageryRectangle();
|
|
706
|
+
* scene.camera.flyTo({
|
|
707
|
+
* destination: rectangle
|
|
708
|
+
* });
|
|
709
|
+
*
|
|
710
|
+
*/
|
|
711
|
+
ImageryLayer.prototype.getImageryRectangle = function () {
|
|
712
|
+
const imageryProvider = this._imageryProvider;
|
|
713
|
+
const rectangle = this._rectangle;
|
|
714
|
+
return Rectangle.intersection(imageryProvider.rectangle, rectangle);
|
|
505
715
|
};
|
|
506
716
|
|
|
507
717
|
/**
|
|
@@ -511,7 +721,7 @@ ImageryLayer.prototype.getViewableRectangle = function () {
|
|
|
511
721
|
* @private
|
|
512
722
|
*
|
|
513
723
|
* @param {Tile} tile The terrain tile.
|
|
514
|
-
* @param {TerrainProvider} terrainProvider The terrain provider associated with the terrain tile.
|
|
724
|
+
* @param {TerrainProvider|undefined} terrainProvider The terrain provider associated with the terrain tile.
|
|
515
725
|
* @param {number} insertionPoint The position to insert new skeletons before in the tile's imagery list.
|
|
516
726
|
* @returns {boolean} true if this layer overlaps any portion of the terrain tile; otherwise, false.
|
|
517
727
|
*/
|
|
@@ -523,8 +733,9 @@ ImageryLayer.prototype._createTileImagerySkeletons = function (
|
|
|
523
733
|
const surfaceTile = tile.data;
|
|
524
734
|
|
|
525
735
|
if (
|
|
526
|
-
defined(
|
|
527
|
-
|
|
736
|
+
!defined(terrainProvider) ||
|
|
737
|
+
(defined(this._minimumTerrainLevel) &&
|
|
738
|
+
tile.level < this._minimumTerrainLevel)
|
|
528
739
|
) {
|
|
529
740
|
return false;
|
|
530
741
|
}
|
|
@@ -535,13 +746,13 @@ ImageryLayer.prototype._createTileImagerySkeletons = function (
|
|
|
535
746
|
return false;
|
|
536
747
|
}
|
|
537
748
|
|
|
538
|
-
const imageryProvider = this._imageryProvider;
|
|
539
|
-
|
|
540
749
|
if (!defined(insertionPoint)) {
|
|
541
750
|
insertionPoint = surfaceTile.imagery.length;
|
|
542
751
|
}
|
|
543
752
|
|
|
544
|
-
|
|
753
|
+
const imageryProvider = this._imageryProvider;
|
|
754
|
+
// ready is deprecated. This is here for backwards compatibility
|
|
755
|
+
if (!this.ready || !imageryProvider._ready) {
|
|
545
756
|
// The imagery provider is not ready, so we can't create skeletons, yet.
|
|
546
757
|
// Instead, add a placeholder so that we'll know to create
|
|
547
758
|
// the skeletons once the provider is ready.
|
|
@@ -959,7 +1170,7 @@ ImageryLayer.prototype._requestImagery = function (imagery) {
|
|
|
959
1170
|
return;
|
|
960
1171
|
}
|
|
961
1172
|
|
|
962
|
-
// Initially assume failure.
|
|
1173
|
+
// Initially assume failure. An error handler may retry, in which case the state will
|
|
963
1174
|
// change to TRANSITIONING.
|
|
964
1175
|
imagery.state = ImageryState.FAILED;
|
|
965
1176
|
imagery.request = undefined;
|
|
@@ -1538,4 +1749,44 @@ function getLevelWithMaximumTexelSpacing(
|
|
|
1538
1749
|
const rounded = Math.round(level);
|
|
1539
1750
|
return rounded | 0;
|
|
1540
1751
|
}
|
|
1752
|
+
|
|
1753
|
+
function handleError(errorEvent, error) {
|
|
1754
|
+
if (errorEvent.numberOfListeners > 0) {
|
|
1755
|
+
errorEvent.raiseEvent(error);
|
|
1756
|
+
} else {
|
|
1757
|
+
// Default handler is to log to the console
|
|
1758
|
+
console.error(error);
|
|
1759
|
+
}
|
|
1760
|
+
}
|
|
1761
|
+
|
|
1762
|
+
async function handlePromise(instance, promise) {
|
|
1763
|
+
let provider;
|
|
1764
|
+
try {
|
|
1765
|
+
provider = await Promise.resolve(promise);
|
|
1766
|
+
if (instance.isDestroyed()) {
|
|
1767
|
+
return;
|
|
1768
|
+
}
|
|
1769
|
+
instance._imageryProvider = provider;
|
|
1770
|
+
instance._readyEvent.raiseEvent(provider);
|
|
1771
|
+
} catch (error) {
|
|
1772
|
+
handleError(instance._errorEvent, error);
|
|
1773
|
+
}
|
|
1774
|
+
}
|
|
1775
|
+
|
|
1541
1776
|
export default ImageryLayer;
|
|
1777
|
+
|
|
1778
|
+
/**
|
|
1779
|
+
* A function that is called when an error occurs.
|
|
1780
|
+
* @callback ImageryLayer.ErrorEventCallback
|
|
1781
|
+
*
|
|
1782
|
+
* @this ImageryLayer
|
|
1783
|
+
* @param {Error} err An object holding details about the error that occurred.
|
|
1784
|
+
*/
|
|
1785
|
+
|
|
1786
|
+
/**
|
|
1787
|
+
* A function that is called when the provider has been created
|
|
1788
|
+
* @callback ImageryLayer.ReadyEventCallback
|
|
1789
|
+
*
|
|
1790
|
+
* @this ImageryLayer
|
|
1791
|
+
* @param {ImageryProvider} provider The created imagery provider.
|
|
1792
|
+
*/
|
|
@@ -76,6 +76,14 @@ Object.defineProperties(ImageryLayerCollection.prototype, {
|
|
|
76
76
|
* be added on top of all existing layers.
|
|
77
77
|
*
|
|
78
78
|
* @exception {DeveloperError} index, if supplied, must be greater than or equal to zero and less than or equal to the number of the layers.
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* const imageryLayer = Cesium.ImageryLayer.fromWorldImagery();
|
|
82
|
+
* scene.imageryLayers.add(imageryLayer);
|
|
83
|
+
*
|
|
84
|
+
* @example
|
|
85
|
+
* const imageryLayer = Cesium.ImageryLayer.fromProviderAsync(Cesium.IonImageryProvider.fromAssetId(3812));
|
|
86
|
+
* scene.imageryLayers.add(imageryLayer);
|
|
79
87
|
*/
|
|
80
88
|
ImageryLayerCollection.prototype.add = function (layer, index) {
|
|
81
89
|
const hasIndex = defined(index);
|
|
@@ -104,6 +112,10 @@ ImageryLayerCollection.prototype.add = function (layer, index) {
|
|
|
104
112
|
|
|
105
113
|
this._update();
|
|
106
114
|
this.layerAdded.raiseEvent(layer, index);
|
|
115
|
+
const removeReadyEventListener = layer.readyEvent.addEventListener(() => {
|
|
116
|
+
this.layerShownOrHidden.raiseEvent(layer, layer._layerIndex, layer.show);
|
|
117
|
+
removeReadyEventListener();
|
|
118
|
+
});
|
|
107
119
|
};
|
|
108
120
|
|
|
109
121
|
/**
|
|
@@ -113,6 +125,14 @@ ImageryLayerCollection.prototype.add = function (layer, index) {
|
|
|
113
125
|
* @param {number} [index] the index to add the layer at. If omitted, the layer will
|
|
114
126
|
* added on top of all existing layers.
|
|
115
127
|
* @returns {ImageryLayer} The newly created layer.
|
|
128
|
+
*
|
|
129
|
+
* @example
|
|
130
|
+
* try {
|
|
131
|
+
* const provider = await Cesium.IonImageryProvider.fromAssetId(3812);
|
|
132
|
+
* scene.imageryLayers.addImageryProvider(provider);
|
|
133
|
+
* } catch (error) {
|
|
134
|
+
* console.log(`There was an error creating the imagery layer. ${error}`)
|
|
135
|
+
* }
|
|
116
136
|
*/
|
|
117
137
|
ImageryLayerCollection.prototype.addImageryProvider = function (
|
|
118
138
|
imageryProvider,
|
|
@@ -353,6 +373,9 @@ function pickImageryHelper(scene, pickedLocation, pickFeatures, callback) {
|
|
|
353
373
|
if (!defined(imagery)) {
|
|
354
374
|
continue;
|
|
355
375
|
}
|
|
376
|
+
if (!imagery.imageryLayer.ready) {
|
|
377
|
+
continue;
|
|
378
|
+
}
|
|
356
379
|
const provider = imagery.imageryLayer.imageryProvider;
|
|
357
380
|
if (pickFeatures && !defined(provider.pickFeatures)) {
|
|
358
381
|
continue;
|
|
@@ -476,6 +499,9 @@ ImageryLayerCollection.prototype.pickImageryLayerFeatures = function (
|
|
|
476
499
|
const imageryLayers = [];
|
|
477
500
|
|
|
478
501
|
pickImageryHelper(scene, pickedLocation, true, function (imagery) {
|
|
502
|
+
if (!imagery.imageryLayer.ready) {
|
|
503
|
+
return undefined;
|
|
504
|
+
}
|
|
479
505
|
const provider = imagery.imageryLayer.imageryProvider;
|
|
480
506
|
const promise = provider.pickFeatures(
|
|
481
507
|
imagery.x,
|