@cesium/engine 0.1.0 → 1.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/{AttributeCompression-4589338a.js → AttributeCompression-b646d393.js} +1 -1
- package/Build/Workers/{AxisAlignedBoundingBox-bfb1234f.js → AxisAlignedBoundingBox-a4321399.js} +1 -1
- package/Build/Workers/{BoundingRectangle-7ffc2153.js → BoundingRectangle-80d8801f.js} +1 -1
- package/Build/Workers/{BoxGeometry-93f344a3.js → BoxGeometry-33c10a4f.js} +1 -1
- package/Build/Workers/{Color-0c5aaf47.js → Color-1bf9a6e0.js} +1 -1
- package/Build/Workers/{CoplanarPolygonGeometryLibrary-6597982a.js → CoplanarPolygonGeometryLibrary-5c5b981b.js} +1 -1
- package/Build/Workers/{CorridorGeometryLibrary-2119580e.js → CorridorGeometryLibrary-7cbae7a0.js} +1 -1
- package/Build/Workers/{CylinderGeometry-f9503c6d.js → CylinderGeometry-42740df0.js} +1 -1
- package/Build/Workers/{EllipseGeometry-fedf72d5.js → EllipseGeometry-49a3ac21.js} +1 -1
- package/Build/Workers/{EllipseGeometryLibrary-4ea68687.js → EllipseGeometryLibrary-b891b2f8.js} +1 -1
- package/Build/Workers/{EllipseOutlineGeometry-e2ae6a35.js → EllipseOutlineGeometry-fbd72e07.js} +1 -1
- package/Build/Workers/{EllipsoidGeodesic-16de63ea.js → EllipsoidGeodesic-98c62a56.js} +1 -1
- package/Build/Workers/{EllipsoidGeometry-95c0330e.js → EllipsoidGeometry-a351dba8.js} +1 -1
- package/Build/Workers/{EllipsoidOutlineGeometry-d6d2ceec.js → EllipsoidOutlineGeometry-3e8779bf.js} +1 -1
- package/Build/Workers/{EllipsoidRhumbLine-ae5e65e0.js → EllipsoidRhumbLine-19756602.js} +1 -1
- package/Build/Workers/{EllipsoidTangentPlane-bfc674bf.js → EllipsoidTangentPlane-cfb50678.js} +1 -1
- package/Build/Workers/{EncodedCartesian3-f473ea18.js → EncodedCartesian3-81f70735.js} +1 -1
- package/Build/Workers/{FrustumGeometry-3bf2e4eb.js → FrustumGeometry-c5754412.js} +1 -1
- package/Build/Workers/{GeometryAttribute-df5f473e.js → GeometryAttribute-0bfd05e8.js} +1 -1
- package/Build/Workers/{GeometryInstance-aa75b4cf.js → GeometryInstance-451dc1cd.js} +1 -1
- package/Build/Workers/{GeometryPipeline-f0e46c42.js → GeometryPipeline-0166905d.js} +1 -1
- package/Build/Workers/{IntersectionTests-9de29d51.js → IntersectionTests-a93d3de9.js} +1 -1
- package/Build/Workers/{Matrix2-ce637455.js → Matrix2-13178034.js} +4 -2
- package/Build/Workers/{Matrix3-4f4df527.js → Matrix3-315394f6.js} +2 -1
- package/Build/Workers/{OrientedBoundingBox-d3ff3d4d.js → OrientedBoundingBox-b450cb61.js} +5 -5
- package/Build/Workers/{Plane-b81241c2.js → Plane-900aa728.js} +1 -1
- package/Build/Workers/{PolygonGeometryLibrary-6f4937bb.js → PolygonGeometryLibrary-f918ac26.js} +1 -1
- package/Build/Workers/PolygonPipeline-f59a8f0a.js +1345 -0
- package/Build/Workers/{PolylinePipeline-2e2b015c.js → PolylinePipeline-d8e6bd9b.js} +1 -1
- package/Build/Workers/{PolylineVolumeGeometryLibrary-7ee1d449.js → PolylineVolumeGeometryLibrary-125d2edf.js} +1 -1
- package/Build/Workers/{PrimitivePipeline-a9b7aae0.js → PrimitivePipeline-0d7b5ed4.js} +1 -1
- package/Build/Workers/{RectangleGeometryLibrary-9aa6c8f6.js → RectangleGeometryLibrary-0768db63.js} +1 -1
- package/Build/Workers/{TerrainEncoding-b52dcfc5.js → TerrainEncoding-06470d7f.js} +1 -1
- package/Build/Workers/{Transforms-2f755df8.js → Transforms-26539bce.js} +97 -83
- package/Build/Workers/{WallGeometryLibrary-ab19a93d.js → WallGeometryLibrary-6167b0fc.js} +1 -1
- package/Build/Workers/{WebMercatorProjection-9f25de49.js → WebMercatorProjection-13a90d41.js} +1 -1
- package/Build/Workers/cesiumWorkerBootstrapper.js +25 -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 +7 -3
- package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +1 -1
- package/Build/Workers/createWallGeometry.js +1 -1
- package/Build/Workers/createWallOutlineGeometry.js +1 -1
- package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +95 -76
- package/Build/Workers/decodeI3S.js +1 -1
- package/Build/Workers/package.js +25 -1
- package/Build/Workers/transferTypedArrayTest.js +25 -1
- package/Build/Workers/upsampleQuantizedTerrainMesh.js +1 -1
- package/README.md +9 -9
- package/Source/Core/EarthOrientationParameters.js +67 -63
- package/Source/Core/Ion.js +1 -1
- package/Source/Core/Matrix2.js +2 -1
- package/Source/Core/Matrix3.js +2 -1
- package/Source/Core/Matrix4.js +1 -0
- package/Source/Core/OrientedBoundingBox.js +4 -4
- package/Source/Core/S2Cell.js +3 -3
- package/Source/Core/Transforms.js +3 -7
- package/Source/DataSources/GpxDataSource.js +4 -6
- package/Source/DataSources/KmlDataSource.js +3 -5
- package/Source/Renderer/Context.js +230 -177
- package/Source/Renderer/Pass.js +3 -2
- package/Source/Scene/Cesium3DTileContentType.js +19 -0
- package/Source/Scene/Cesium3DTilesVoxelProvider.js +482 -0
- package/Source/Scene/Cesium3DTilesetMetadata.js +2 -2
- package/Source/Scene/ContentMetadata.js +2 -2
- package/Source/Scene/DerivedCommand.js +7 -0
- package/Source/Scene/Expression.js +1 -1
- package/Source/Scene/Globe.js +10 -0
- package/Source/Scene/GlobeSurfaceTileProvider.js +7 -0
- package/Source/Scene/GltfImageLoader.js +1 -1
- package/Source/Scene/GltfVertexBufferLoader.js +10 -2
- package/Source/Scene/GroupMetadata.js +2 -2
- package/Source/Scene/I3SDataProvider.js +2 -1
- package/Source/Scene/I3SFeature.js +1 -1
- package/Source/Scene/I3SLayer.js +64 -2
- package/Source/Scene/I3SNode.js +50 -6
- package/Source/Scene/ImplicitMetadataView.js +2 -2
- package/Source/Scene/ImplicitSubtreeCache.js +127 -0
- package/Source/Scene/ImplicitSubtreeMetadata.js +2 -2
- package/Source/Scene/ImplicitTileset.js +3 -2
- package/Source/Scene/KeyframeNode.js +47 -0
- package/Source/Scene/Megatexture.js +490 -0
- package/Source/Scene/MetadataClass.js +60 -25
- package/Source/Scene/MetadataClassProperty.js +132 -68
- package/Source/Scene/MetadataComponentType.js +78 -57
- package/Source/Scene/MetadataEnum.js +59 -23
- package/Source/Scene/MetadataEnumValue.js +49 -15
- package/Source/Scene/MetadataSchema.js +53 -24
- package/Source/Scene/MetadataSchemaLoader.js +2 -2
- package/Source/Scene/MetadataTableProperty.js +2 -2
- package/Source/Scene/MetadataType.js +6 -14
- package/Source/Scene/Model/GeoJsonLoader.js +1 -1
- package/Source/Scene/Model/Model.js +38 -6
- package/Source/Scene/Model/buildDrawCommand.js +19 -11
- package/Source/Scene/PointCloud.js +1 -1
- package/Source/Scene/PropertyAttribute.js +2 -2
- package/Source/Scene/PropertyAttributeProperty.js +2 -2
- package/Source/Scene/PropertyTable.js +2 -2
- package/Source/Scene/PropertyTexture.js +2 -2
- package/Source/Scene/PropertyTextureProperty.js +2 -2
- package/Source/Scene/ResourceCache.js +9 -1
- package/Source/Scene/ResourceCacheKey.js +9 -1
- package/Source/Scene/Scene.js +20 -50
- package/Source/Scene/SpatialNode.js +375 -0
- package/Source/Scene/StructuralMetadata.js +2 -2
- package/Source/Scene/TileMetadata.js +2 -2
- package/Source/Scene/TilesetMetadata.js +2 -2
- package/Source/Scene/VoxelBoxShape.js +527 -0
- package/Source/Scene/VoxelContent.js +169 -0
- package/Source/Scene/VoxelCylinderShape.js +937 -0
- package/Source/Scene/VoxelEllipsoidShape.js +937 -0
- package/Source/Scene/VoxelPrimitive.js +1919 -0
- package/Source/Scene/VoxelProvider.js +255 -0
- package/Source/Scene/VoxelRenderResources.js +224 -0
- package/Source/Scene/VoxelShape.js +152 -0
- package/Source/Scene/VoxelShapeType.js +105 -0
- package/Source/Scene/VoxelTraversal.js +1144 -0
- package/Source/Scene/buildVoxelDrawCommands.js +116 -0
- package/Source/Scene/parseBatchTable.js +18 -2
- package/Source/Scene/preprocess3DTileContent.js +8 -0
- package/Source/Scene/processVoxelProperties.js +455 -0
- package/Source/Shaders/BillboardCollectionVS.glsl +1 -1
- package/Source/Shaders/BillboardCollectionVS.js +1 -1
- package/Source/Shaders/Builtin/Constants/passOverlay.glsl +1 -1
- package/Source/Shaders/Builtin/Constants/passOverlay.js +1 -1
- package/Source/Shaders/Builtin/Constants/passVoxels.glsl +9 -0
- package/Source/Shaders/Builtin/Constants/passVoxels.js +11 -0
- package/Source/Shaders/Builtin/CzmBuiltins.js +2 -0
- package/Source/Shaders/Builtin/Functions/windowToEyeCoordinates.glsl +55 -43
- package/Source/Shaders/Builtin/Functions/windowToEyeCoordinates.js +55 -43
- package/Source/Shaders/GlobeFS.glsl +2 -1
- package/Source/Shaders/GlobeFS.js +2 -1
- package/Source/Shaders/PointPrimitiveCollectionVS.glsl +5 -2
- package/Source/Shaders/PointPrimitiveCollectionVS.js +5 -2
- package/Source/Shaders/Voxels/IntersectBox.glsl +79 -0
- package/Source/Shaders/Voxels/IntersectBox.js +81 -0
- package/Source/Shaders/Voxels/IntersectClippingPlanes.glsl +70 -0
- package/Source/Shaders/Voxels/IntersectClippingPlanes.js +72 -0
- package/Source/Shaders/Voxels/IntersectCylinder.glsl +273 -0
- package/Source/Shaders/Voxels/IntersectCylinder.js +275 -0
- package/Source/Shaders/Voxels/IntersectDepth.glsl +23 -0
- package/Source/Shaders/Voxels/IntersectDepth.js +25 -0
- package/Source/Shaders/Voxels/IntersectEllipsoid.glsl +337 -0
- package/Source/Shaders/Voxels/IntersectEllipsoid.js +339 -0
- package/Source/Shaders/Voxels/Intersection.glsl +54 -0
- package/Source/Shaders/Voxels/Intersection.js +56 -0
- package/Source/Shaders/Voxels/IntersectionUtils.glsl +151 -0
- package/Source/Shaders/Voxels/IntersectionUtils.js +153 -0
- package/Source/Shaders/Voxels/Megatexture.glsl +136 -0
- package/Source/Shaders/Voxels/Megatexture.js +138 -0
- package/Source/Shaders/Voxels/Octree.glsl +221 -0
- package/Source/Shaders/Voxels/Octree.js +223 -0
- package/Source/Shaders/Voxels/VoxelFS.glsl +150 -0
- package/Source/Shaders/Voxels/VoxelFS.js +152 -0
- package/Source/Shaders/Voxels/VoxelVS.glsl +11 -0
- package/Source/Shaders/Voxels/VoxelVS.js +13 -0
- package/Source/Shaders/Voxels/convertUvToBox.glsl +16 -0
- package/Source/Shaders/Voxels/convertUvToBox.js +18 -0
- package/Source/Shaders/Voxels/convertUvToCylinder.glsl +79 -0
- package/Source/Shaders/Voxels/convertUvToCylinder.js +81 -0
- package/Source/Shaders/Voxels/convertUvToEllipsoid.glsl +133 -0
- package/Source/Shaders/Voxels/convertUvToEllipsoid.js +135 -0
- package/Source/ThirdParty/Workers/draco_decoder_nodejs.js +100 -101
- package/Source/ThirdParty/Workers/pako_deflate.min.js +2 -2
- package/Source/ThirdParty/Workers/pako_inflate.min.js +2 -2
- package/Source/ThirdParty/draco_decoder.wasm +0 -0
- package/Source/Widget/CesiumWidget.js +1 -1
- package/index.d.ts +961 -56
- package/index.js +92 -60
- package/package.json +6 -4
- package/Build/ThirdParty/Workers/basis_transcoder.js +0 -2233
- package/Build/ThirdParty/Workers/draco_decoder_nodejs.js +0 -1872
- package/Build/ThirdParty/Workers/package.json +0 -1
- package/Build/ThirdParty/Workers/pako_deflate.min.js +0 -589
- package/Build/ThirdParty/Workers/pako_inflate.min.js +0 -798
- package/Build/ThirdParty/Workers/z-worker-pako.js +0 -503
- package/Build/ThirdParty/basis_transcoder.wasm +0 -0
- package/Build/ThirdParty/draco_decoder.wasm +0 -0
- package/Build/ThirdParty/google-earth-dbroot-parser.js +0 -8019
- package/Build/Widget/CesiumWidget.css +0 -120
- package/Build/Widget/lighter.css +0 -13
- package/Build/Workers/PolygonPipeline-774a8aaf.js +0 -1341
|
@@ -2,6 +2,7 @@ import Cartesian2 from "../Core/Cartesian2.js";
|
|
|
2
2
|
import Cartesian3 from "../Core/Cartesian3.js";
|
|
3
3
|
import Cartesian4 from "../Core/Cartesian4.js";
|
|
4
4
|
import Check from "../Core/Check.js";
|
|
5
|
+
import clone from "../Core/clone.js";
|
|
5
6
|
import defaultValue from "../Core/defaultValue.js";
|
|
6
7
|
import defined from "../Core/defined.js";
|
|
7
8
|
import DeveloperError from "../Core/DeveloperError.js";
|
|
@@ -12,68 +13,87 @@ import MetadataType from "./MetadataType.js";
|
|
|
12
13
|
import MetadataComponentType from "./MetadataComponentType.js";
|
|
13
14
|
|
|
14
15
|
/**
|
|
15
|
-
* A metadata property, as part of a {@link MetadataClass}
|
|
16
|
+
* A metadata property, as part of a {@link MetadataClass}.
|
|
17
|
+
* <p>
|
|
18
|
+
* See the {@link https://github.com/CesiumGS/3d-tiles/tree/main/specification/Metadata|3D Metadata Specification} for 3D Tiles
|
|
19
|
+
* </p>
|
|
16
20
|
*
|
|
17
21
|
* @param {Object} options Object with the following properties:
|
|
18
22
|
* @param {String} options.id The ID of the property.
|
|
19
|
-
* @param {
|
|
20
|
-
* @param {
|
|
23
|
+
* @param {MetadataType} options.type The type of the property such as SCALAR, VEC2, VEC3.
|
|
24
|
+
* @param {MetadataComponentType} [options.componentType] The component type of the property. This includes integer (e.g. INT8 or UINT16), and floating point (FLOAT32 and FLOAT64) values.
|
|
25
|
+
* @param {MetadataEnum} [options.enumType] The enum type of the property. Only defined when type is ENUM.
|
|
26
|
+
* @param {Boolean} [options.isArray=false] True if a property is an array (either fixed length or variable length), false otherwise.
|
|
27
|
+
* @param {Boolean} [options.isVariableLengthArray=false] True if a property is a variable length array, false otherwise.
|
|
28
|
+
* @param {Number} [options.arrayLength] The number of array elements. Only defined for fixed length arrays.
|
|
29
|
+
* @param {Boolean} [options.normalized=false] Whether the property is normalized.
|
|
30
|
+
* @param {Number|Number[]|Number[][]} [options.min] A number or an array of numbers storing the minimum allowable value of this property. Only defined when type is a numeric type.
|
|
31
|
+
* @param {Number|Number[]|Number[][]} [options.max] A number or an array of numbers storing the maximum allowable value of this property. Only defined when type is a numeric type.
|
|
32
|
+
* @param {Number|Number[]|Number[][]} [options.offset] The offset to be added to property values as part of the value transform.
|
|
33
|
+
* @param {Number|Number[]|Number[][]} [options.scale] The scale to be multiplied to property values as part of the value transform.
|
|
34
|
+
* @param {Boolean|Number|String|Array} [options.noData] The no-data sentinel value that represents null values.
|
|
35
|
+
* @param {Boolean|Number|String|Array} [options.default] A default value to use when an entity's property value is not defined.
|
|
36
|
+
* @param {Boolean} [options.required=false] Whether the property is required.
|
|
37
|
+
* @param {String} [options.name] The name of the property.
|
|
38
|
+
* @param {String} [options.description] The description of the property.
|
|
39
|
+
* @param {String} [options.semantic] An identifier that describes how this property should be interpreted.
|
|
40
|
+
* @param {*} [options.extras] Extra user-defined properties.
|
|
41
|
+
* @param {Object} [options.extensions] An object containing extensions.
|
|
21
42
|
*
|
|
22
43
|
* @alias MetadataClassProperty
|
|
23
44
|
* @constructor
|
|
24
|
-
* @private
|
|
25
45
|
* @experimental This feature is using part of the 3D Tiles spec that is not final and is subject to change without Cesium's standard deprecation policy.
|
|
26
46
|
*/
|
|
27
47
|
function MetadataClassProperty(options) {
|
|
28
48
|
options = defaultValue(options, defaultValue.EMPTY_OBJECT);
|
|
29
49
|
const id = options.id;
|
|
30
|
-
const
|
|
50
|
+
const type = options.type;
|
|
31
51
|
|
|
32
52
|
//>>includeStart('debug', pragmas.debug);
|
|
33
53
|
Check.typeOf.string("options.id", id);
|
|
34
|
-
Check.typeOf.
|
|
35
|
-
Check.typeOf.string("options.property.type", property.type);
|
|
54
|
+
Check.typeOf.string("options.type", type);
|
|
36
55
|
//>>includeEnd('debug');
|
|
37
56
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
// extensions.
|
|
41
|
-
const isLegacyExtension = isLegacy(property);
|
|
42
|
-
const parsedType = parseType(property, options.enums);
|
|
43
|
-
const componentType = parsedType.componentType;
|
|
57
|
+
const componentType = options.componentType;
|
|
58
|
+
const enumType = options.enumType;
|
|
44
59
|
|
|
45
60
|
const normalized =
|
|
46
61
|
defined(componentType) &&
|
|
47
62
|
MetadataComponentType.isIntegerType(componentType) &&
|
|
48
|
-
defaultValue(
|
|
63
|
+
defaultValue(options.normalized, false);
|
|
49
64
|
|
|
50
65
|
// Basic information about this property
|
|
51
66
|
this._id = id;
|
|
52
|
-
this._name =
|
|
53
|
-
this._description =
|
|
54
|
-
this._semantic =
|
|
55
|
-
|
|
67
|
+
this._name = options.name;
|
|
68
|
+
this._description = options.description;
|
|
69
|
+
this._semantic = options.semantic;
|
|
70
|
+
|
|
71
|
+
// Only for unit testing purposes, not documented in the API
|
|
72
|
+
this._isLegacyExtension = options.isLegacyExtension;
|
|
56
73
|
|
|
57
74
|
// Details about basic types
|
|
58
|
-
this._type =
|
|
75
|
+
this._type = type;
|
|
59
76
|
this._componentType = componentType;
|
|
60
|
-
this._enumType =
|
|
61
|
-
this._valueType =
|
|
77
|
+
this._enumType = enumType;
|
|
78
|
+
this._valueType = defined(enumType) ? enumType.valueType : componentType;
|
|
62
79
|
|
|
63
80
|
// Details about arrays
|
|
64
|
-
this._isArray =
|
|
65
|
-
this._isVariableLengthArray =
|
|
66
|
-
|
|
81
|
+
this._isArray = defaultValue(options.isArray, false);
|
|
82
|
+
this._isVariableLengthArray = defaultValue(
|
|
83
|
+
options.isVariableLengthArray,
|
|
84
|
+
false
|
|
85
|
+
);
|
|
86
|
+
this._arrayLength = options.arrayLength;
|
|
67
87
|
|
|
68
88
|
// min and max allowed values
|
|
69
|
-
this._min =
|
|
70
|
-
this._max =
|
|
89
|
+
this._min = clone(options.min, true);
|
|
90
|
+
this._max = clone(options.max, true);
|
|
71
91
|
|
|
72
92
|
// properties that adjust the range of metadata values
|
|
73
93
|
this._normalized = normalized;
|
|
74
94
|
|
|
75
|
-
let offset =
|
|
76
|
-
let scale =
|
|
95
|
+
let offset = clone(options.offset, true);
|
|
96
|
+
let scale = clone(options.scale, true);
|
|
77
97
|
const hasValueTransform = defined(offset) || defined(scale);
|
|
78
98
|
|
|
79
99
|
const enableNestedArrays = true;
|
|
@@ -91,9 +111,46 @@ function MetadataClassProperty(options) {
|
|
|
91
111
|
|
|
92
112
|
// sentinel value for missing data, and a default value to use
|
|
93
113
|
// in its place if needed.
|
|
94
|
-
this._noData =
|
|
114
|
+
this._noData = clone(options.noData, true);
|
|
95
115
|
// For vector and array types, this is stored as an array of values.
|
|
96
|
-
this._default =
|
|
116
|
+
this._default = clone(options.default, true);
|
|
117
|
+
|
|
118
|
+
this._required = defaultValue(options.required, true);
|
|
119
|
+
|
|
120
|
+
// extras and extensions
|
|
121
|
+
this._extras = clone(options.extras, true);
|
|
122
|
+
this._extensions = clone(options.extensions, true);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Creates a {@link MetadataClassProperty} from either 3D Tiles 1.1, 3DTILES_metadata, EXT_structural_metadata, or EXT_feature_metadata.
|
|
127
|
+
*
|
|
128
|
+
* @param {Object} options Object with the following properties:
|
|
129
|
+
* @param {String} options.id The ID of the property.
|
|
130
|
+
* @param {Object} options.property The property JSON object.
|
|
131
|
+
* @param {Object.<String, MetadataEnum>} [options.enums] A dictionary of enums.
|
|
132
|
+
*
|
|
133
|
+
* @returns {MetadataClassProperty} The newly created metadata class property.
|
|
134
|
+
*
|
|
135
|
+
* @private
|
|
136
|
+
* @experimental This feature is using part of the 3D Tiles spec that is not final and is subject to change without Cesium's standard deprecation policy.
|
|
137
|
+
*/
|
|
138
|
+
MetadataClassProperty.fromJson = function (options) {
|
|
139
|
+
options = defaultValue(options, defaultValue.EMPTY_OBJECT);
|
|
140
|
+
const id = options.id;
|
|
141
|
+
const property = options.property;
|
|
142
|
+
|
|
143
|
+
//>>includeStart('debug', pragmas.debug);
|
|
144
|
+
Check.typeOf.string("options.id", id);
|
|
145
|
+
Check.typeOf.object("options.property", property);
|
|
146
|
+
Check.typeOf.string("options.property.type", property.type);
|
|
147
|
+
//>>includeEnd('debug');
|
|
148
|
+
|
|
149
|
+
// Try to determine if this is the legacy extension. This is not
|
|
150
|
+
// always possible, as there are some types that are valid in both
|
|
151
|
+
// extensions.
|
|
152
|
+
const isLegacyExtension = isLegacy(property);
|
|
153
|
+
const parsedType = parseType(property, options.enums);
|
|
97
154
|
|
|
98
155
|
// EXT_feature_metadata had an optional flag, while EXT_structural_metadata
|
|
99
156
|
// has a required flag. The defaults are not the same, and there's some cases
|
|
@@ -109,12 +166,31 @@ function MetadataClassProperty(options) {
|
|
|
109
166
|
} else {
|
|
110
167
|
required = defaultValue(property.required, false);
|
|
111
168
|
}
|
|
112
|
-
this._required = required;
|
|
113
169
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
170
|
+
return new MetadataClassProperty({
|
|
171
|
+
id: id,
|
|
172
|
+
type: parsedType.type,
|
|
173
|
+
componentType: parsedType.componentType,
|
|
174
|
+
enumType: parsedType.enumType,
|
|
175
|
+
isArray: parsedType.isArray,
|
|
176
|
+
isVariableLengthArray: parsedType.isVariableLengthArray,
|
|
177
|
+
arrayLength: parsedType.arrayLength,
|
|
178
|
+
normalized: property.normalized,
|
|
179
|
+
min: property.min,
|
|
180
|
+
max: property.max,
|
|
181
|
+
offset: property.offset,
|
|
182
|
+
scale: property.scale,
|
|
183
|
+
noData: property.noData,
|
|
184
|
+
default: property.default,
|
|
185
|
+
required: required,
|
|
186
|
+
name: property.name,
|
|
187
|
+
description: property.description,
|
|
188
|
+
semantic: property.semantic,
|
|
189
|
+
extras: property.extras,
|
|
190
|
+
extensions: property.extensions,
|
|
191
|
+
isLegacyExtension: isLegacyExtension,
|
|
192
|
+
});
|
|
193
|
+
};
|
|
118
194
|
|
|
119
195
|
Object.defineProperties(MetadataClassProperty.prototype, {
|
|
120
196
|
/**
|
|
@@ -123,7 +199,6 @@ Object.defineProperties(MetadataClassProperty.prototype, {
|
|
|
123
199
|
* @memberof MetadataClassProperty.prototype
|
|
124
200
|
* @type {String}
|
|
125
201
|
* @readonly
|
|
126
|
-
* @private
|
|
127
202
|
*/
|
|
128
203
|
id: {
|
|
129
204
|
get: function () {
|
|
@@ -137,7 +212,6 @@ Object.defineProperties(MetadataClassProperty.prototype, {
|
|
|
137
212
|
* @memberof MetadataClassProperty.prototype
|
|
138
213
|
* @type {String}
|
|
139
214
|
* @readonly
|
|
140
|
-
* @private
|
|
141
215
|
*/
|
|
142
216
|
name: {
|
|
143
217
|
get: function () {
|
|
@@ -151,7 +225,6 @@ Object.defineProperties(MetadataClassProperty.prototype, {
|
|
|
151
225
|
* @memberof MetadataClassProperty.prototype
|
|
152
226
|
* @type {String}
|
|
153
227
|
* @readonly
|
|
154
|
-
* @private
|
|
155
228
|
*/
|
|
156
229
|
description: {
|
|
157
230
|
get: function () {
|
|
@@ -162,11 +235,9 @@ Object.defineProperties(MetadataClassProperty.prototype, {
|
|
|
162
235
|
/**
|
|
163
236
|
* The type of the property such as SCALAR, VEC2, VEC3
|
|
164
237
|
*
|
|
165
|
-
*
|
|
166
238
|
* @memberof MetadataClassProperty.prototype
|
|
167
239
|
* @type {MetadataType}
|
|
168
240
|
* @readonly
|
|
169
|
-
* @private
|
|
170
241
|
*/
|
|
171
242
|
type: {
|
|
172
243
|
get: function () {
|
|
@@ -180,7 +251,6 @@ Object.defineProperties(MetadataClassProperty.prototype, {
|
|
|
180
251
|
* @memberof MetadataClassProperty.prototype
|
|
181
252
|
* @type {MetadataEnum}
|
|
182
253
|
* @readonly
|
|
183
|
-
* @private
|
|
184
254
|
*/
|
|
185
255
|
enumType: {
|
|
186
256
|
get: function () {
|
|
@@ -195,7 +265,6 @@ Object.defineProperties(MetadataClassProperty.prototype, {
|
|
|
195
265
|
* @memberof MetadataClassProperty.prototype
|
|
196
266
|
* @type {MetadataComponentType}
|
|
197
267
|
* @readonly
|
|
198
|
-
* @private
|
|
199
268
|
*/
|
|
200
269
|
componentType: {
|
|
201
270
|
get: function () {
|
|
@@ -226,7 +295,6 @@ Object.defineProperties(MetadataClassProperty.prototype, {
|
|
|
226
295
|
* @memberof MetadataClassProperty.prototype
|
|
227
296
|
* @type {Boolean}
|
|
228
297
|
* @readonly
|
|
229
|
-
* @private
|
|
230
298
|
*/
|
|
231
299
|
isArray: {
|
|
232
300
|
get: function () {
|
|
@@ -240,7 +308,6 @@ Object.defineProperties(MetadataClassProperty.prototype, {
|
|
|
240
308
|
* @memberof MetadataClassProperty.prototype
|
|
241
309
|
* @type {Boolean}
|
|
242
310
|
* @readonly
|
|
243
|
-
* @private
|
|
244
311
|
*/
|
|
245
312
|
isVariableLengthArray: {
|
|
246
313
|
get: function () {
|
|
@@ -255,7 +322,6 @@ Object.defineProperties(MetadataClassProperty.prototype, {
|
|
|
255
322
|
* @memberof MetadataClassProperty.prototype
|
|
256
323
|
* @type {Number}
|
|
257
324
|
* @readonly
|
|
258
|
-
* @private
|
|
259
325
|
*/
|
|
260
326
|
arrayLength: {
|
|
261
327
|
get: function () {
|
|
@@ -269,7 +335,6 @@ Object.defineProperties(MetadataClassProperty.prototype, {
|
|
|
269
335
|
* @memberof MetadataClassProperty.prototype
|
|
270
336
|
* @type {Boolean}
|
|
271
337
|
* @readonly
|
|
272
|
-
* @private
|
|
273
338
|
*/
|
|
274
339
|
normalized: {
|
|
275
340
|
get: function () {
|
|
@@ -278,12 +343,11 @@ Object.defineProperties(MetadataClassProperty.prototype, {
|
|
|
278
343
|
},
|
|
279
344
|
|
|
280
345
|
/**
|
|
281
|
-
* A number or an array of numbers storing the maximum allowable value of this property. Only defined when type
|
|
346
|
+
* A number or an array of numbers storing the maximum allowable value of this property. Only defined when type is a numeric type.
|
|
282
347
|
*
|
|
283
348
|
* @memberof MetadataClassProperty.prototype
|
|
284
|
-
* @type {Number|Number[]}
|
|
349
|
+
* @type {Number|Number[]|Number[][]}
|
|
285
350
|
* @readonly
|
|
286
|
-
* @private
|
|
287
351
|
*/
|
|
288
352
|
max: {
|
|
289
353
|
get: function () {
|
|
@@ -292,12 +356,11 @@ Object.defineProperties(MetadataClassProperty.prototype, {
|
|
|
292
356
|
},
|
|
293
357
|
|
|
294
358
|
/**
|
|
295
|
-
* A number or an array of numbers storing the minimum allowable value of this property. Only defined when type
|
|
359
|
+
* A number or an array of numbers storing the minimum allowable value of this property. Only defined when type is a numeric type.
|
|
296
360
|
*
|
|
297
361
|
* @memberof MetadataClassProperty.prototype
|
|
298
|
-
* @type {Number|Number[]}
|
|
362
|
+
* @type {Number|Number[]|Number[][]}
|
|
299
363
|
* @readonly
|
|
300
|
-
* @private
|
|
301
364
|
*/
|
|
302
365
|
min: {
|
|
303
366
|
get: function () {
|
|
@@ -311,7 +374,6 @@ Object.defineProperties(MetadataClassProperty.prototype, {
|
|
|
311
374
|
* @memberof MetadataClassProperty.prototype
|
|
312
375
|
* @type {Boolean|Number|String|Array}
|
|
313
376
|
* @readonly
|
|
314
|
-
* @private
|
|
315
377
|
*/
|
|
316
378
|
noData: {
|
|
317
379
|
get: function () {
|
|
@@ -325,7 +387,6 @@ Object.defineProperties(MetadataClassProperty.prototype, {
|
|
|
325
387
|
* @memberof MetadataClassProperty.prototype
|
|
326
388
|
* @type {Boolean|Number|String|Array}
|
|
327
389
|
* @readonly
|
|
328
|
-
* @private
|
|
329
390
|
*/
|
|
330
391
|
default: {
|
|
331
392
|
get: function () {
|
|
@@ -339,7 +400,6 @@ Object.defineProperties(MetadataClassProperty.prototype, {
|
|
|
339
400
|
* @memberof MetadataClassProperty.prototype
|
|
340
401
|
* @type {Boolean}
|
|
341
402
|
* @readonly
|
|
342
|
-
* @private
|
|
343
403
|
*/
|
|
344
404
|
required: {
|
|
345
405
|
get: function () {
|
|
@@ -353,7 +413,6 @@ Object.defineProperties(MetadataClassProperty.prototype, {
|
|
|
353
413
|
* @memberof MetadataClassProperty.prototype
|
|
354
414
|
* @type {String}
|
|
355
415
|
* @readonly
|
|
356
|
-
* @private
|
|
357
416
|
*/
|
|
358
417
|
semantic: {
|
|
359
418
|
get: function () {
|
|
@@ -382,7 +441,6 @@ Object.defineProperties(MetadataClassProperty.prototype, {
|
|
|
382
441
|
* @memberof MetadataClassProperty.prototype
|
|
383
442
|
* @type {Number|Number[]|Number[][]}
|
|
384
443
|
* @readonly
|
|
385
|
-
* @private
|
|
386
444
|
*/
|
|
387
445
|
offset: {
|
|
388
446
|
get: function () {
|
|
@@ -396,7 +454,6 @@ Object.defineProperties(MetadataClassProperty.prototype, {
|
|
|
396
454
|
* @memberof MetadataClassProperty.prototype
|
|
397
455
|
* @type {Number|Number[]|Number[][]}
|
|
398
456
|
* @readonly
|
|
399
|
-
* @private
|
|
400
457
|
*/
|
|
401
458
|
scale: {
|
|
402
459
|
get: function () {
|
|
@@ -405,12 +462,11 @@ Object.defineProperties(MetadataClassProperty.prototype, {
|
|
|
405
462
|
},
|
|
406
463
|
|
|
407
464
|
/**
|
|
408
|
-
*
|
|
465
|
+
* Extra user-defined properties.
|
|
409
466
|
*
|
|
410
467
|
* @memberof MetadataClassProperty.prototype
|
|
411
468
|
* @type {*}
|
|
412
469
|
* @readonly
|
|
413
|
-
* @private
|
|
414
470
|
*/
|
|
415
471
|
extras: {
|
|
416
472
|
get: function () {
|
|
@@ -419,12 +475,11 @@ Object.defineProperties(MetadataClassProperty.prototype, {
|
|
|
419
475
|
},
|
|
420
476
|
|
|
421
477
|
/**
|
|
422
|
-
*
|
|
478
|
+
* An object containing extensions.
|
|
423
479
|
*
|
|
424
480
|
* @memberof MetadataClassProperty.prototype
|
|
425
481
|
* @type {Object}
|
|
426
482
|
* @readonly
|
|
427
|
-
* @private
|
|
428
483
|
*/
|
|
429
484
|
extensions: {
|
|
430
485
|
get: function () {
|
|
@@ -450,7 +505,7 @@ function isLegacy(property) {
|
|
|
450
505
|
|
|
451
506
|
// EXT_feature_metadata allowed numeric types as a type. Now they are
|
|
452
507
|
// represented as {type: SINGLE, componentType: type}
|
|
453
|
-
if (MetadataComponentType
|
|
508
|
+
if (defined(MetadataComponentType[type])) {
|
|
454
509
|
return true;
|
|
455
510
|
}
|
|
456
511
|
|
|
@@ -585,10 +640,7 @@ function parseType(property, enums) {
|
|
|
585
640
|
|
|
586
641
|
// Both EXT_feature_metadata and EXT_structural_metadata allow numeric types like
|
|
587
642
|
// INT32 or FLOAT64 as a componentType.
|
|
588
|
-
if (
|
|
589
|
-
defined(componentType) &&
|
|
590
|
-
MetadataComponentType.isNumericType(componentType)
|
|
591
|
-
) {
|
|
643
|
+
if (defined(componentType) && defined(MetadataComponentType[componentType])) {
|
|
592
644
|
return {
|
|
593
645
|
type: MetadataType.SCALAR,
|
|
594
646
|
componentType: componentType,
|
|
@@ -602,7 +654,7 @@ function parseType(property, enums) {
|
|
|
602
654
|
|
|
603
655
|
// EXT_feature_metadata: integer and float types were allowed as types,
|
|
604
656
|
// but now these are expressed as {type: SCALAR, componentType: type}
|
|
605
|
-
if (MetadataComponentType
|
|
657
|
+
if (defined(MetadataComponentType[type])) {
|
|
606
658
|
return {
|
|
607
659
|
type: MetadataType.SCALAR,
|
|
608
660
|
componentType: type,
|
|
@@ -687,6 +739,9 @@ MetadataClassProperty.prototype.unnormalize = function (value) {
|
|
|
687
739
|
);
|
|
688
740
|
};
|
|
689
741
|
|
|
742
|
+
/**
|
|
743
|
+
* @private
|
|
744
|
+
*/
|
|
690
745
|
MetadataClassProperty.prototype.applyValueTransform = function (value) {
|
|
691
746
|
// variable length arrays do not have a well-defined offset/scale so this
|
|
692
747
|
// is forbidden by the spec
|
|
@@ -702,6 +757,9 @@ MetadataClassProperty.prototype.applyValueTransform = function (value) {
|
|
|
702
757
|
);
|
|
703
758
|
};
|
|
704
759
|
|
|
760
|
+
/**
|
|
761
|
+
* @private
|
|
762
|
+
*/
|
|
705
763
|
MetadataClassProperty.prototype.unapplyValueTransform = function (value) {
|
|
706
764
|
// variable length arrays do not have a well-defined offset/scale so this
|
|
707
765
|
// is forbidden by the spec
|
|
@@ -717,6 +775,9 @@ MetadataClassProperty.prototype.unapplyValueTransform = function (value) {
|
|
|
717
775
|
);
|
|
718
776
|
};
|
|
719
777
|
|
|
778
|
+
/**
|
|
779
|
+
* @private
|
|
780
|
+
*/
|
|
720
781
|
MetadataClassProperty.prototype.expandConstant = function (
|
|
721
782
|
constant,
|
|
722
783
|
enableNestedArrays
|
|
@@ -1077,6 +1138,9 @@ function normalizeInPlace(values, valueType, normalizeFunction) {
|
|
|
1077
1138
|
return values;
|
|
1078
1139
|
}
|
|
1079
1140
|
|
|
1141
|
+
/**
|
|
1142
|
+
* @private
|
|
1143
|
+
*/
|
|
1080
1144
|
MetadataClassProperty.valueTransformInPlace = function (
|
|
1081
1145
|
values,
|
|
1082
1146
|
offsets,
|