@itwin/core-common 5.2.0-dev.3 → 5.2.0-dev.30
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/CHANGELOG.md +63 -1
- package/lib/cjs/AmbientOcclusion.js.map +1 -1
- package/lib/cjs/AnalysisStyle.d.ts.map +1 -1
- package/lib/cjs/AnalysisStyle.js +2 -0
- package/lib/cjs/AnalysisStyle.js.map +1 -1
- package/lib/cjs/Atmosphere.js.map +1 -1
- package/lib/cjs/AuthorizationClient.js.map +1 -1
- package/lib/cjs/BackgroundMapProvider.js.map +1 -1
- package/lib/cjs/BackgroundMapSettings.js.map +1 -1
- package/lib/cjs/Base64EncodedString.js.map +1 -1
- package/lib/cjs/BlobReader.d.ts.map +1 -1
- package/lib/cjs/BlobReader.js +10 -2
- package/lib/cjs/BlobReader.js.map +1 -1
- package/lib/cjs/BriefcaseTypes.js.map +1 -1
- package/lib/cjs/Camera.js.map +1 -1
- package/lib/cjs/CatalogIModel.js.map +1 -1
- package/lib/cjs/CesiumIonAssets.js.map +1 -1
- package/lib/cjs/ChangedElements.js.map +1 -1
- package/lib/cjs/ChangedEntities.js.map +1 -1
- package/lib/cjs/ChangesetProps.js.map +1 -1
- package/lib/cjs/ClipStyle.js.map +1 -1
- package/lib/cjs/Code.js.map +1 -1
- package/lib/cjs/ColorByName.js.map +1 -1
- package/lib/cjs/ColorDef.js.map +1 -1
- package/lib/cjs/CommonLoggerCategory.js.map +1 -1
- package/lib/cjs/ConcurrentQuery.js.map +1 -1
- package/lib/cjs/ContextRealityModel.js.map +1 -1
- package/lib/cjs/ContourDisplay.js.map +1 -1
- package/lib/cjs/DisplayStyleSettings.d.ts.map +1 -1
- package/lib/cjs/DisplayStyleSettings.js +1 -1
- package/lib/cjs/DisplayStyleSettings.js.map +1 -1
- package/lib/cjs/ECSchemaProps.js.map +1 -1
- package/lib/cjs/ECSqlReader.js.map +1 -1
- package/lib/cjs/ECSqlTypes.js +1 -1
- package/lib/cjs/ECSqlTypes.js.map +1 -1
- package/lib/cjs/ElementMesh.js.map +1 -1
- package/lib/cjs/ElementProps.d.ts +8 -0
- package/lib/cjs/ElementProps.d.ts.map +1 -1
- package/lib/cjs/ElementProps.js.map +1 -1
- package/lib/cjs/EmphasizeElementsProps.js.map +1 -1
- package/lib/cjs/EntityProps.js.map +1 -1
- package/lib/cjs/EntityReference.js.map +1 -1
- package/lib/cjs/Environment.js.map +1 -1
- package/lib/cjs/FeatureIndex.d.ts.map +1 -1
- package/lib/cjs/FeatureIndex.js +2 -1
- package/lib/cjs/FeatureIndex.js.map +1 -1
- package/lib/cjs/FeatureSymbology.d.ts.map +1 -1
- package/lib/cjs/FeatureSymbology.js +0 -2
- package/lib/cjs/FeatureSymbology.js.map +1 -1
- package/lib/cjs/FeatureTable.js.map +1 -1
- package/lib/cjs/Fonts.js.map +1 -1
- package/lib/cjs/Frustum.js.map +1 -1
- package/lib/cjs/GenericInstanceFilter.js.map +1 -1
- package/lib/cjs/GeoCoordinateServices.js.map +1 -1
- package/lib/cjs/GeometryContainment.js.map +1 -1
- package/lib/cjs/GeometryParams.d.ts.map +1 -1
- package/lib/cjs/GeometryParams.js +6 -0
- package/lib/cjs/GeometryParams.js.map +1 -1
- package/lib/cjs/GeometrySummary.js.map +1 -1
- package/lib/cjs/Gradient.d.ts.map +1 -1
- package/lib/cjs/Gradient.js +5 -0
- package/lib/cjs/Gradient.js.map +1 -1
- package/lib/cjs/GraphicParams.js.map +1 -1
- package/lib/cjs/GroundPlane.js.map +1 -1
- package/lib/cjs/HSLColor.js.map +1 -1
- package/lib/cjs/HSVColor.js.map +1 -1
- package/lib/cjs/HiddenLine.d.ts.map +1 -1
- package/lib/cjs/HiddenLine.js +4 -1
- package/lib/cjs/HiddenLine.js.map +1 -1
- package/lib/cjs/Hilite.js.map +1 -1
- package/lib/cjs/IModel.d.ts.map +1 -1
- package/lib/cjs/IModel.js +7 -7
- package/lib/cjs/IModel.js.map +1 -1
- package/lib/cjs/IModelError.js.map +1 -1
- package/lib/cjs/IModelVersion.js.map +1 -1
- package/lib/cjs/ITwinCoreErrors.js.map +1 -1
- package/lib/cjs/Image.js.map +1 -1
- package/lib/cjs/IpcAppProps.js.map +1 -1
- package/lib/cjs/LightSettings.js.map +1 -1
- package/lib/cjs/LinePixels.js.map +1 -1
- package/lib/cjs/Localization.d.ts.map +1 -1
- package/lib/cjs/Localization.js +3 -0
- package/lib/cjs/Localization.js.map +1 -1
- package/lib/cjs/MapImagerySettings.js.map +1 -1
- package/lib/cjs/MapLayerSettings.js.map +1 -1
- package/lib/cjs/MassProperties.js.map +1 -1
- package/lib/cjs/MaterialProps.js.map +1 -1
- package/lib/cjs/ModelClipGroup.js.map +1 -1
- package/lib/cjs/ModelGeometryChanges.js.map +1 -1
- package/lib/cjs/ModelProps.js.map +1 -1
- package/lib/cjs/NativeAppProps.js.map +1 -1
- package/lib/cjs/OctEncodedNormal.js.map +1 -1
- package/lib/cjs/PlanProjectionSettings.js.map +1 -1
- package/lib/cjs/PlanarClipMask.js.map +1 -1
- package/lib/cjs/QPoint.js.map +1 -1
- package/lib/cjs/RealityDataAccessProps.js.map +1 -1
- package/lib/cjs/RealityModelDisplaySettings.js.map +1 -1
- package/lib/cjs/RenderMaterial.js.map +1 -1
- package/lib/cjs/RenderPolyline.js.map +1 -1
- package/lib/cjs/RenderTexture.js.map +1 -1
- package/lib/cjs/RgbColor.js.map +1 -1
- package/lib/cjs/RpcInterface.js.map +1 -1
- package/lib/cjs/RpcManager.js.map +1 -1
- package/lib/cjs/SessionProps.js.map +1 -1
- package/lib/cjs/SkyBox.js.map +1 -1
- package/lib/cjs/SolarCalculate.js.map +1 -1
- package/lib/cjs/SolarShadows.js.map +1 -1
- package/lib/cjs/SpatialClassification.js.map +1 -1
- package/lib/cjs/SubCategoryAppearance.js.map +1 -1
- package/lib/cjs/SubCategoryOverride.js.map +1 -1
- package/lib/cjs/TerrainSettings.js.map +1 -1
- package/lib/cjs/TextureMapping.js +2 -2
- package/lib/cjs/TextureMapping.js.map +1 -1
- package/lib/cjs/TextureProps.js.map +1 -1
- package/lib/cjs/ThematicDisplay.d.ts.map +1 -1
- package/lib/cjs/ThematicDisplay.js +3 -1
- package/lib/cjs/ThematicDisplay.js.map +1 -1
- package/lib/cjs/Thumbnail.js.map +1 -1
- package/lib/cjs/TileProps.js.map +1 -1
- package/lib/cjs/Tween.d.ts +1 -1
- package/lib/cjs/Tween.d.ts.map +1 -1
- package/lib/cjs/Tween.js +4 -2
- package/lib/cjs/Tween.js.map +1 -1
- package/lib/cjs/TxnAction.js.map +1 -1
- package/lib/cjs/ViewDetails.js.map +1 -1
- package/lib/cjs/ViewFlags.js.map +1 -1
- package/lib/cjs/ViewProps.js.map +1 -1
- package/lib/cjs/WhiteOnWhiteReversalSettings.js.map +1 -1
- package/lib/cjs/annotation/TextAnnotation.d.ts +1 -1
- package/lib/cjs/annotation/TextAnnotation.d.ts.map +1 -1
- package/lib/cjs/annotation/TextAnnotation.js +1 -1
- package/lib/cjs/annotation/TextAnnotation.js.map +1 -1
- package/lib/cjs/annotation/TextBlock.d.ts +2 -11
- package/lib/cjs/annotation/TextBlock.d.ts.map +1 -1
- package/lib/cjs/annotation/TextBlock.js +2 -16
- package/lib/cjs/annotation/TextBlock.js.map +1 -1
- package/lib/cjs/annotation/TextBlockGeometryProps.js.map +1 -1
- package/lib/cjs/annotation/TextBlockLayoutResult.js.map +1 -1
- package/lib/cjs/annotation/TextStyle.js.map +1 -1
- package/lib/cjs/core-common.js.map +1 -1
- package/lib/cjs/domains/FunctionalElementProps.js.map +1 -1
- package/lib/cjs/domains/GenericElementProps.js.map +1 -1
- package/lib/cjs/geometry/AdditionalTransform.d.ts.map +1 -1
- package/lib/cjs/geometry/AdditionalTransform.js +1 -0
- package/lib/cjs/geometry/AdditionalTransform.js.map +1 -1
- package/lib/cjs/geometry/AreaPattern.d.ts.map +1 -1
- package/lib/cjs/geometry/AreaPattern.js +13 -0
- package/lib/cjs/geometry/AreaPattern.js.map +1 -1
- package/lib/cjs/geometry/BoundingSphere.js.map +1 -1
- package/lib/cjs/geometry/Cartographic.js.map +1 -1
- package/lib/cjs/geometry/CoordinateReferenceSystem.d.ts.map +1 -1
- package/lib/cjs/geometry/CoordinateReferenceSystem.js +7 -0
- package/lib/cjs/geometry/CoordinateReferenceSystem.js.map +1 -1
- package/lib/cjs/geometry/ElementGeometry.d.ts.map +1 -1
- package/lib/cjs/geometry/ElementGeometry.js +19 -10
- package/lib/cjs/geometry/ElementGeometry.js.map +1 -1
- package/lib/cjs/geometry/ElementGeometryFB.d.ts.map +1 -1
- package/lib/cjs/geometry/ElementGeometryFB.js +1 -0
- package/lib/cjs/geometry/ElementGeometryFB.js.map +1 -1
- package/lib/cjs/geometry/FrustumPlanes.js.map +1 -1
- package/lib/cjs/geometry/GeodeticDatum.d.ts.map +1 -1
- package/lib/cjs/geometry/GeodeticDatum.js +7 -0
- package/lib/cjs/geometry/GeodeticDatum.js.map +1 -1
- package/lib/cjs/geometry/GeodeticEllipsoid.js.map +1 -1
- package/lib/cjs/geometry/GeometryStream.d.ts.map +1 -1
- package/lib/cjs/geometry/GeometryStream.js +2 -2
- package/lib/cjs/geometry/GeometryStream.js.map +1 -1
- package/lib/cjs/geometry/ImageGraphic.js.map +1 -1
- package/lib/cjs/geometry/LineStyle.d.ts.map +1 -1
- package/lib/cjs/geometry/LineStyle.js +3 -0
- package/lib/cjs/geometry/LineStyle.js.map +1 -1
- package/lib/cjs/geometry/Placement.d.ts.map +1 -1
- package/lib/cjs/geometry/Placement.js +1 -1
- package/lib/cjs/geometry/Placement.js.map +1 -1
- package/lib/cjs/geometry/Projection.js.map +1 -1
- package/lib/cjs/geometry/TextString.js.map +1 -1
- package/lib/cjs/internal/BackendTypes.js.map +1 -1
- package/lib/cjs/internal/PackedFeatureTable.d.ts.map +1 -1
- package/lib/cjs/internal/PackedFeatureTable.js +1 -1
- package/lib/cjs/internal/PackedFeatureTable.js.map +1 -1
- package/lib/cjs/internal/RenderMaterialParams.js.map +1 -1
- package/lib/cjs/internal/RenderMesh.js.map +1 -1
- package/lib/cjs/internal/RenderTextureParams.js.map +1 -1
- package/lib/cjs/internal/Snapping.js.map +1 -1
- package/lib/cjs/internal/cross-package.js.map +1 -1
- package/lib/cjs/ipc/IpcSession.js.map +1 -1
- package/lib/cjs/ipc/IpcSocket.js.map +1 -1
- package/lib/cjs/ipc/IpcWebSocket.js.map +1 -1
- package/lib/cjs/ipc/IpcWebSocketTransport.js.map +1 -1
- package/lib/cjs/rpc/DevToolsRpcInterface.js.map +1 -1
- package/lib/cjs/rpc/IModelReadRpcInterface.js.map +1 -1
- package/lib/cjs/rpc/IModelTileRpcInterface.js.map +1 -1
- package/lib/cjs/rpc/SnapshotIModelRpcInterface.js.map +1 -1
- package/lib/cjs/rpc/TestRpcManager.js.map +1 -1
- package/lib/cjs/rpc/core/RpcConfiguration.d.ts +0 -3
- package/lib/cjs/rpc/core/RpcConfiguration.d.ts.map +1 -1
- package/lib/cjs/rpc/core/RpcConfiguration.js +10 -2
- package/lib/cjs/rpc/core/RpcConfiguration.js.map +1 -1
- package/lib/cjs/rpc/core/RpcConstants.js.map +1 -1
- package/lib/cjs/rpc/core/RpcControl.js.map +1 -1
- package/lib/cjs/rpc/core/RpcInvocation.js.map +1 -1
- package/lib/cjs/rpc/core/RpcMarshaling.js.map +1 -1
- package/lib/cjs/rpc/core/RpcOperation.js.map +1 -1
- package/lib/cjs/rpc/core/RpcPendingQueue.js.map +1 -1
- package/lib/cjs/rpc/core/RpcProtocol.js.map +1 -1
- package/lib/cjs/rpc/core/RpcPush.js.map +1 -1
- package/lib/cjs/rpc/core/RpcRegistry.js.map +1 -1
- package/lib/cjs/rpc/core/RpcRequest.js.map +1 -1
- package/lib/cjs/rpc/core/RpcRequestContext.js.map +1 -1
- package/lib/cjs/rpc/core/RpcRoutingToken.js.map +1 -1
- package/lib/cjs/rpc/core/RpcSessionInvocation.js.map +1 -1
- package/lib/cjs/rpc/web/BentleyCloudRpcManager.js.map +1 -1
- package/lib/cjs/rpc/web/BentleyCloudRpcProtocol.js +1 -1
- package/lib/cjs/rpc/web/BentleyCloudRpcProtocol.js.map +1 -1
- package/lib/cjs/rpc/web/OpenAPI.js.map +1 -1
- package/lib/cjs/rpc/web/RpcMultipart.js.map +1 -1
- package/lib/cjs/rpc/web/WebAppRpcLogging.js.map +1 -1
- package/lib/cjs/rpc/web/WebAppRpcProtocol.js.map +1 -1
- package/lib/cjs/rpc/web/WebAppRpcRequest.js +1 -1
- package/lib/cjs/rpc/web/WebAppRpcRequest.js.map +1 -1
- package/lib/cjs/rpc/web/multipart/RpcMultipartParser.js.map +1 -1
- package/lib/cjs/tile/B3dmTileIO.js.map +1 -1
- package/lib/cjs/tile/CompositeTileIO.js.map +1 -1
- package/lib/cjs/tile/ElementGraphics.js.map +1 -1
- package/lib/cjs/tile/GltfTileIO.js.map +1 -1
- package/lib/cjs/tile/I3dmTileIO.js.map +1 -1
- package/lib/cjs/tile/IModelTileIO.js.map +1 -1
- package/lib/cjs/tile/PntsTileIO.js.map +1 -1
- package/lib/cjs/tile/TileIO.js.map +1 -1
- package/lib/cjs/tile/TileMetadata.js.map +1 -1
- package/lib/cjs/tile/Tileset3dSchema.js.map +1 -1
- package/lib/esm/AmbientOcclusion.js.map +1 -1
- package/lib/esm/AnalysisStyle.d.ts.map +1 -1
- package/lib/esm/AnalysisStyle.js +2 -0
- package/lib/esm/AnalysisStyle.js.map +1 -1
- package/lib/esm/Atmosphere.js.map +1 -1
- package/lib/esm/AuthorizationClient.js.map +1 -1
- package/lib/esm/BackgroundMapProvider.js.map +1 -1
- package/lib/esm/BackgroundMapSettings.js.map +1 -1
- package/lib/esm/Base64EncodedString.js.map +1 -1
- package/lib/esm/BlobReader.d.ts.map +1 -1
- package/lib/esm/BlobReader.js +10 -2
- package/lib/esm/BlobReader.js.map +1 -1
- package/lib/esm/BriefcaseTypes.js.map +1 -1
- package/lib/esm/Camera.js.map +1 -1
- package/lib/esm/CatalogIModel.js.map +1 -1
- package/lib/esm/CesiumIonAssets.js.map +1 -1
- package/lib/esm/ChangedElements.js.map +1 -1
- package/lib/esm/ChangedEntities.js.map +1 -1
- package/lib/esm/ChangesetProps.js.map +1 -1
- package/lib/esm/ClipStyle.js.map +1 -1
- package/lib/esm/Code.js.map +1 -1
- package/lib/esm/ColorByName.js.map +1 -1
- package/lib/esm/ColorDef.js.map +1 -1
- package/lib/esm/CommonLoggerCategory.js.map +1 -1
- package/lib/esm/ConcurrentQuery.js.map +1 -1
- package/lib/esm/ContextRealityModel.js.map +1 -1
- package/lib/esm/ContourDisplay.js.map +1 -1
- package/lib/esm/DisplayStyleSettings.d.ts.map +1 -1
- package/lib/esm/DisplayStyleSettings.js +2 -2
- package/lib/esm/DisplayStyleSettings.js.map +1 -1
- package/lib/esm/ECSchemaProps.js.map +1 -1
- package/lib/esm/ECSqlReader.js.map +1 -1
- package/lib/esm/ECSqlTypes.js +1 -1
- package/lib/esm/ECSqlTypes.js.map +1 -1
- package/lib/esm/ElementMesh.js.map +1 -1
- package/lib/esm/ElementProps.d.ts +8 -0
- package/lib/esm/ElementProps.d.ts.map +1 -1
- package/lib/esm/ElementProps.js.map +1 -1
- package/lib/esm/EmphasizeElementsProps.js.map +1 -1
- package/lib/esm/EntityProps.js.map +1 -1
- package/lib/esm/EntityReference.js.map +1 -1
- package/lib/esm/Environment.js.map +1 -1
- package/lib/esm/FeatureIndex.d.ts.map +1 -1
- package/lib/esm/FeatureIndex.js +2 -1
- package/lib/esm/FeatureIndex.js.map +1 -1
- package/lib/esm/FeatureSymbology.d.ts.map +1 -1
- package/lib/esm/FeatureSymbology.js +0 -2
- package/lib/esm/FeatureSymbology.js.map +1 -1
- package/lib/esm/FeatureTable.js.map +1 -1
- package/lib/esm/Fonts.js.map +1 -1
- package/lib/esm/Frustum.js.map +1 -1
- package/lib/esm/GenericInstanceFilter.js.map +1 -1
- package/lib/esm/GeoCoordinateServices.js.map +1 -1
- package/lib/esm/GeometryContainment.js.map +1 -1
- package/lib/esm/GeometryParams.d.ts.map +1 -1
- package/lib/esm/GeometryParams.js +6 -0
- package/lib/esm/GeometryParams.js.map +1 -1
- package/lib/esm/GeometrySummary.js.map +1 -1
- package/lib/esm/Gradient.d.ts.map +1 -1
- package/lib/esm/Gradient.js +5 -0
- package/lib/esm/Gradient.js.map +1 -1
- package/lib/esm/GraphicParams.js.map +1 -1
- package/lib/esm/GroundPlane.js.map +1 -1
- package/lib/esm/HSLColor.js.map +1 -1
- package/lib/esm/HSVColor.js.map +1 -1
- package/lib/esm/HiddenLine.d.ts.map +1 -1
- package/lib/esm/HiddenLine.js +4 -1
- package/lib/esm/HiddenLine.js.map +1 -1
- package/lib/esm/Hilite.js.map +1 -1
- package/lib/esm/IModel.d.ts.map +1 -1
- package/lib/esm/IModel.js +8 -8
- package/lib/esm/IModel.js.map +1 -1
- package/lib/esm/IModelError.js.map +1 -1
- package/lib/esm/IModelVersion.js.map +1 -1
- package/lib/esm/ITwinCoreErrors.js.map +1 -1
- package/lib/esm/Image.js.map +1 -1
- package/lib/esm/IpcAppProps.js.map +1 -1
- package/lib/esm/LightSettings.js.map +1 -1
- package/lib/esm/LinePixels.js.map +1 -1
- package/lib/esm/Localization.d.ts.map +1 -1
- package/lib/esm/Localization.js +3 -0
- package/lib/esm/Localization.js.map +1 -1
- package/lib/esm/MapImagerySettings.js.map +1 -1
- package/lib/esm/MapLayerSettings.js.map +1 -1
- package/lib/esm/MassProperties.js.map +1 -1
- package/lib/esm/MaterialProps.js.map +1 -1
- package/lib/esm/ModelClipGroup.js.map +1 -1
- package/lib/esm/ModelGeometryChanges.js.map +1 -1
- package/lib/esm/ModelProps.js.map +1 -1
- package/lib/esm/NativeAppProps.js.map +1 -1
- package/lib/esm/OctEncodedNormal.js.map +1 -1
- package/lib/esm/PlanProjectionSettings.js.map +1 -1
- package/lib/esm/PlanarClipMask.js.map +1 -1
- package/lib/esm/QPoint.js.map +1 -1
- package/lib/esm/RealityDataAccessProps.js.map +1 -1
- package/lib/esm/RealityModelDisplaySettings.js.map +1 -1
- package/lib/esm/RenderMaterial.js.map +1 -1
- package/lib/esm/RenderPolyline.js.map +1 -1
- package/lib/esm/RenderTexture.js.map +1 -1
- package/lib/esm/RgbColor.js.map +1 -1
- package/lib/esm/RpcInterface.js.map +1 -1
- package/lib/esm/RpcManager.js.map +1 -1
- package/lib/esm/SessionProps.js.map +1 -1
- package/lib/esm/SkyBox.js.map +1 -1
- package/lib/esm/SolarCalculate.js.map +1 -1
- package/lib/esm/SolarShadows.js.map +1 -1
- package/lib/esm/SpatialClassification.js.map +1 -1
- package/lib/esm/SubCategoryAppearance.js.map +1 -1
- package/lib/esm/SubCategoryOverride.js.map +1 -1
- package/lib/esm/TerrainSettings.js.map +1 -1
- package/lib/esm/TextureMapping.js +3 -3
- package/lib/esm/TextureMapping.js.map +1 -1
- package/lib/esm/TextureProps.js.map +1 -1
- package/lib/esm/ThematicDisplay.d.ts.map +1 -1
- package/lib/esm/ThematicDisplay.js +3 -1
- package/lib/esm/ThematicDisplay.js.map +1 -1
- package/lib/esm/Thumbnail.js.map +1 -1
- package/lib/esm/TileProps.js.map +1 -1
- package/lib/esm/Tween.d.ts +1 -1
- package/lib/esm/Tween.d.ts.map +1 -1
- package/lib/esm/Tween.js +4 -2
- package/lib/esm/Tween.js.map +1 -1
- package/lib/esm/TxnAction.js.map +1 -1
- package/lib/esm/ViewDetails.js.map +1 -1
- package/lib/esm/ViewFlags.js.map +1 -1
- package/lib/esm/ViewProps.js.map +1 -1
- package/lib/esm/WhiteOnWhiteReversalSettings.js.map +1 -1
- package/lib/esm/annotation/TextAnnotation.d.ts +1 -1
- package/lib/esm/annotation/TextAnnotation.d.ts.map +1 -1
- package/lib/esm/annotation/TextAnnotation.js +1 -1
- package/lib/esm/annotation/TextAnnotation.js.map +1 -1
- package/lib/esm/annotation/TextBlock.d.ts +2 -11
- package/lib/esm/annotation/TextBlock.d.ts.map +1 -1
- package/lib/esm/annotation/TextBlock.js +2 -16
- package/lib/esm/annotation/TextBlock.js.map +1 -1
- package/lib/esm/annotation/TextBlockGeometryProps.js.map +1 -1
- package/lib/esm/annotation/TextBlockLayoutResult.js.map +1 -1
- package/lib/esm/annotation/TextStyle.js.map +1 -1
- package/lib/esm/core-common.js.map +1 -1
- package/lib/esm/domains/FunctionalElementProps.js.map +1 -1
- package/lib/esm/domains/GenericElementProps.js.map +1 -1
- package/lib/esm/geometry/AdditionalTransform.d.ts.map +1 -1
- package/lib/esm/geometry/AdditionalTransform.js +1 -0
- package/lib/esm/geometry/AdditionalTransform.js.map +1 -1
- package/lib/esm/geometry/AreaPattern.d.ts.map +1 -1
- package/lib/esm/geometry/AreaPattern.js +13 -0
- package/lib/esm/geometry/AreaPattern.js.map +1 -1
- package/lib/esm/geometry/BoundingSphere.js.map +1 -1
- package/lib/esm/geometry/Cartographic.js.map +1 -1
- package/lib/esm/geometry/CoordinateReferenceSystem.d.ts.map +1 -1
- package/lib/esm/geometry/CoordinateReferenceSystem.js +7 -0
- package/lib/esm/geometry/CoordinateReferenceSystem.js.map +1 -1
- package/lib/esm/geometry/ElementGeometry.d.ts.map +1 -1
- package/lib/esm/geometry/ElementGeometry.js +20 -11
- package/lib/esm/geometry/ElementGeometry.js.map +1 -1
- package/lib/esm/geometry/ElementGeometryFB.d.ts.map +1 -1
- package/lib/esm/geometry/ElementGeometryFB.js +1 -0
- package/lib/esm/geometry/ElementGeometryFB.js.map +1 -1
- package/lib/esm/geometry/FrustumPlanes.js.map +1 -1
- package/lib/esm/geometry/GeodeticDatum.d.ts.map +1 -1
- package/lib/esm/geometry/GeodeticDatum.js +7 -0
- package/lib/esm/geometry/GeodeticDatum.js.map +1 -1
- package/lib/esm/geometry/GeodeticEllipsoid.js.map +1 -1
- package/lib/esm/geometry/GeometryStream.d.ts.map +1 -1
- package/lib/esm/geometry/GeometryStream.js +3 -3
- package/lib/esm/geometry/GeometryStream.js.map +1 -1
- package/lib/esm/geometry/ImageGraphic.js.map +1 -1
- package/lib/esm/geometry/LineStyle.d.ts.map +1 -1
- package/lib/esm/geometry/LineStyle.js +3 -0
- package/lib/esm/geometry/LineStyle.js.map +1 -1
- package/lib/esm/geometry/Placement.d.ts.map +1 -1
- package/lib/esm/geometry/Placement.js +2 -2
- package/lib/esm/geometry/Placement.js.map +1 -1
- package/lib/esm/geometry/Projection.js.map +1 -1
- package/lib/esm/geometry/TextString.js.map +1 -1
- package/lib/esm/internal/BackendTypes.js.map +1 -1
- package/lib/esm/internal/PackedFeatureTable.d.ts.map +1 -1
- package/lib/esm/internal/PackedFeatureTable.js +2 -2
- package/lib/esm/internal/PackedFeatureTable.js.map +1 -1
- package/lib/esm/internal/RenderMaterialParams.js.map +1 -1
- package/lib/esm/internal/RenderMesh.js.map +1 -1
- package/lib/esm/internal/RenderTextureParams.js.map +1 -1
- package/lib/esm/internal/Snapping.js.map +1 -1
- package/lib/esm/internal/cross-package.js.map +1 -1
- package/lib/esm/ipc/IpcSession.js.map +1 -1
- package/lib/esm/ipc/IpcSocket.js.map +1 -1
- package/lib/esm/ipc/IpcWebSocket.js.map +1 -1
- package/lib/esm/ipc/IpcWebSocketTransport.js.map +1 -1
- package/lib/esm/rpc/DevToolsRpcInterface.js.map +1 -1
- package/lib/esm/rpc/IModelReadRpcInterface.js.map +1 -1
- package/lib/esm/rpc/IModelTileRpcInterface.js.map +1 -1
- package/lib/esm/rpc/SnapshotIModelRpcInterface.js.map +1 -1
- package/lib/esm/rpc/TestRpcManager.js.map +1 -1
- package/lib/esm/rpc/core/RpcConfiguration.d.ts +0 -3
- package/lib/esm/rpc/core/RpcConfiguration.d.ts.map +1 -1
- package/lib/esm/rpc/core/RpcConfiguration.js +10 -2
- package/lib/esm/rpc/core/RpcConfiguration.js.map +1 -1
- package/lib/esm/rpc/core/RpcConstants.js.map +1 -1
- package/lib/esm/rpc/core/RpcControl.js.map +1 -1
- package/lib/esm/rpc/core/RpcInvocation.js.map +1 -1
- package/lib/esm/rpc/core/RpcMarshaling.js.map +1 -1
- package/lib/esm/rpc/core/RpcOperation.js.map +1 -1
- package/lib/esm/rpc/core/RpcPendingQueue.js.map +1 -1
- package/lib/esm/rpc/core/RpcProtocol.js.map +1 -1
- package/lib/esm/rpc/core/RpcPush.js.map +1 -1
- package/lib/esm/rpc/core/RpcRegistry.js.map +1 -1
- package/lib/esm/rpc/core/RpcRequest.js.map +1 -1
- package/lib/esm/rpc/core/RpcRequestContext.js.map +1 -1
- package/lib/esm/rpc/core/RpcRoutingToken.js.map +1 -1
- package/lib/esm/rpc/core/RpcSessionInvocation.js.map +1 -1
- package/lib/esm/rpc/web/BentleyCloudRpcManager.js.map +1 -1
- package/lib/esm/rpc/web/BentleyCloudRpcProtocol.js +1 -1
- package/lib/esm/rpc/web/BentleyCloudRpcProtocol.js.map +1 -1
- package/lib/esm/rpc/web/OpenAPI.js.map +1 -1
- package/lib/esm/rpc/web/RpcMultipart.js.map +1 -1
- package/lib/esm/rpc/web/WebAppRpcLogging.js.map +1 -1
- package/lib/esm/rpc/web/WebAppRpcProtocol.js.map +1 -1
- package/lib/esm/rpc/web/WebAppRpcRequest.js +2 -2
- package/lib/esm/rpc/web/WebAppRpcRequest.js.map +1 -1
- package/lib/esm/rpc/web/multipart/RpcMultipartParser.js.map +1 -1
- package/lib/esm/tile/B3dmTileIO.js.map +1 -1
- package/lib/esm/tile/CompositeTileIO.js.map +1 -1
- package/lib/esm/tile/ElementGraphics.js.map +1 -1
- package/lib/esm/tile/GltfTileIO.js.map +1 -1
- package/lib/esm/tile/I3dmTileIO.js.map +1 -1
- package/lib/esm/tile/IModelTileIO.js.map +1 -1
- package/lib/esm/tile/PntsTileIO.js.map +1 -1
- package/lib/esm/tile/TileIO.js.map +1 -1
- package/lib/esm/tile/TileMetadata.js.map +1 -1
- package/lib/esm/tile/Tileset3dSchema.js.map +1 -1
- package/package.json +6 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebAppRpcRequest.js","sourceRoot":"","sources":["../../../../src/rp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BAC/D,IAAI,CAAC,QAAQ,CAAC,MAAM,GAAG,KAAK,CAAC;gBAC7B,IAAI,CAAC,QAAQ,CAAC,IAAI,GAAG,SAAS,CAAC;gBAC/B,OAAO,IAAI,CAAC,QAAQ,CAAC,gCAAiB,CAAC,OAAO,CAAC,CAAC;gBAChD,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;gBAC/B,OAAO;YACT,CAAC;QACH,CAAC;QAED,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC;QACtB,IAAI,CAAC,QAAQ,CAAC,gCAAiB,CAAC,OAAO,CAAC,GAAG,gCAAiB,CAAC,IAAI,CAAC;QAClE,IAAI,CAAC,QAAQ,CAAC,MAAM,GAAG,MAAM,CAAC;QAC9B,IAAI,CAAC,QAAQ,CAAC,IAAI,GAAG,UAAU,CAAC,OAAO,CAAC;IAC1C,CAAC;IAED,gBAAgB;IACT,MAAM,CAAC,OAAO,GAAG;QACtB,YAAY,EAAE,KAAK,EAAE,SAA4B,EAAE,QAA8B,EAAE,YAAmC,EAAE,IAAuB,EAAE,IAAwB,EAAiB,EAAE;YAC1L,MAAM,IAAI,yBAAW,CAAC,4BAAa,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC;QAC3D,CAAC;QACD,YAAY,EAAE,KAAK,EAAE,SAA4B,EAAE,IAAuB,EAAiC,EAAE;YAC3G,MAAM,IAAI,yBAAW,CAAC,4BAAa,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC;QAC3D,CAAC;KACF,CAAC;;AAxPJ,4CAyPC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module RpcInterface\n */\n\nimport { BentleyStatus } from \"@itwin/core-bentley\";\nimport { IModelError, ServerError, ServerTimeoutError } from \"../../IModelError\";\nimport { RpcInterface } from \"../../RpcInterface\";\nimport { RpcContentType, RpcProtocolEvent, WEB_RPC_CONSTANTS } from \"../core/RpcConstants\";\nimport { MarshalingBinaryMarker, RpcSerializedValue } from \"../core/RpcMarshaling\";\nimport { RpcRequestFulfillment, SerializedRpcRequest } from \"../core/RpcProtocol\";\nimport { RpcRequest } from \"../core/RpcRequest\";\nimport { RpcMultipartParser } from \"./multipart/RpcMultipartParser\";\nimport { RpcMultipart } from \"./RpcMultipart\";\nimport { HttpServerRequest, HttpServerResponse, WebAppRpcProtocol } from \"./WebAppRpcProtocol\";\n\n/* eslint-disable @typescript-eslint/no-deprecated */\ndeclare const location: any;\n\n/** @internal */\nexport type HttpMethod_T = \"get\" | \"put\" | \"post\" | \"delete\" | \"options\" | \"head\" | \"patch\" | \"trace\"; // eslint-disable-line @typescript-eslint/naming-convention\n\n/** A web application RPC request.\n * @internal\n */\nexport class WebAppRpcRequest extends RpcRequest {\n private _loading: boolean = false;\n private _request: RequestInit = {};\n private _pathSuffix: string = \"\";\n private get _headers() { return this._request.headers as { [key: string]: string }; }\n\n /** The maximum size permitted for an encoded component in a URL.\n * Note that some backends limit the total cumulative request size. Our current node backends accept requests with a max size of 16 kb.\n * In addition to the url size, an authorization header may also add considerably to the request size.\n * @note This is used for features like encoding the payload of a cacheable request in the URL.\n */\n public static maxUrlComponentSize = 1024 * 8;\n\n /** The HTTP method for this request. */\n public override method: HttpMethod_T;\n\n /** Convenience access to the protocol of this request. */\n public override readonly protocol: WebAppRpcProtocol = this.client.configuration.protocol as any;\n\n /** Standardized access to metadata about the request (useful for purposes such as logging). */\n public metadata = { status: 0, message: \"\" };\n\n /** Parses a request. */\n public static async parseRequest(protocol: WebAppRpcProtocol, req: HttpServerRequest): Promise<SerializedRpcRequest> {\n return this.backend.parseRequest(protocol, req);\n }\n\n /** Sends the response for a web request. */\n public static async sendResponse(\n protocol: WebAppRpcProtocol,\n request: SerializedRpcRequest,\n fulfillment: RpcRequestFulfillment,\n req: HttpServerRequest,\n res: HttpServerResponse,\n ): Promise<void> {\n return this.backend.sendResponse(protocol, request, fulfillment, req, res);\n }\n\n /** Determines the most efficient transport type for an RPC value. */\n public static computeTransportType(value: RpcSerializedValue, source: any): RpcContentType {\n if (source instanceof Uint8Array || (Array.isArray(source) && source[0] instanceof Uint8Array)) {\n return RpcContentType.Binary;\n } else if (value.data.length > 0) {\n return RpcContentType.Multipart;\n } else if (value.stream) {\n return RpcContentType.Stream;\n } else {\n return RpcContentType.Text;\n }\n }\n\n /** Constructs a web application request. */\n public constructor(client: RpcInterface, operation: string, parameters: any[]) {\n super(client, operation, parameters);\n this.path = this.protocol.supplyPathForOperation(this.operation, this);\n this.method = \"head\";\n this._request.headers = {};\n }\n\n /** Sets request header values. */\n protected setHeader(name: string, value: string): void {\n this._headers[name] = value;\n }\n\n /** Sends the request. */\n protected async send(): Promise<number> {\n this._loading = true;\n await this.setupTransport();\n\n return new Promise<number>(async (resolve, reject) => {\n try {\n resolve(await this.performFetch());\n } catch (reason) {\n reject(new ServerError(-1, typeof (reason) === \"string\" ? reason : \"Server connection error.\"));\n }\n });\n }\n\n protected override computeRetryAfter(attempts: number): number {\n const retryAfter = this._response && this._response.headers.get(\"Retry-After\");\n if (retryAfter) {\n this.resetTransientFaultCount();\n\n const r = Number(retryAfter);\n if (Number.isFinite(r)) {\n return r * 1000;\n }\n\n const d = Date.parse(retryAfter);\n if (!Number.isNaN(d)) {\n return d - Date.now();\n }\n } else {\n this.recordTransientFault();\n }\n\n return super.computeRetryAfter(attempts);\n }\n\n protected override handleUnknownResponse(code: number) {\n if (this.protocol.isTimeout(code)) {\n this.reject(new ServerTimeoutError(\"Request timeout.\"));\n } else {\n this.reject(new ServerError(code, \"Unknown server response code.\"));\n }\n }\n\n protected async load(): Promise<RpcSerializedValue> {\n return new Promise<RpcSerializedValue>(async (resolve, reject) => {\n try {\n if (!this._loading)\n return;\n\n const response = this._response;\n if (!response) {\n reject(new IModelError(BentleyStatus.ERROR, \"Invalid state.\"));\n return;\n }\n\n if (this.protocol.protocolVersionHeaderName) {\n const version = response.headers.get(this.protocol.protocolVersionHeaderName);\n if (version) {\n this.responseProtocolVersion = parseInt(version, 10);\n }\n }\n\n const contentType = response.headers.get(WEB_RPC_CONSTANTS.CONTENT);\n const responseType = WebAppRpcProtocol.computeContentType(contentType);\n\n if (responseType === RpcContentType.Binary) {\n resolve(await this.loadBinary(response));\n } else if (responseType === RpcContentType.Multipart) {\n resolve(await this.loadMultipart(response, contentType!));\n } else {\n resolve(await this.loadText(response));\n }\n\n this._loading = false;\n this.setLastUpdatedTime();\n this.protocol.events.raiseEvent(RpcProtocolEvent.ResponseLoaded, this);\n } catch (reason) {\n if (!this._loading)\n return;\n\n this._loading = false;\n reject(new ServerError(this.metadata.status, typeof (reason) === \"string\" ? reason : \"Unknown server response error.\"));\n }\n });\n }\n\n /** Override to supply an alternate fetch function. */\n protected supplyFetch(): typeof fetch {\n return fetch;\n }\n\n /** Override to supply an alternate Request function. */\n protected supplyRequest(): typeof Request {\n return Request;\n }\n\n private async performFetch(): Promise<number> {\n const requestClass = this.supplyRequest();\n const fetchFunction = this.supplyFetch();\n\n const path = new URL(this.path, typeof location !== \"undefined\" ? location.origin : undefined);\n if (this._pathSuffix) {\n const params = new URLSearchParams();\n params.set(\"parameters\", this._pathSuffix);\n path.search = `?${params.toString()}`;\n }\n\n const request = new requestClass(path.toString(), this._request);\n const response = await fetchFunction(request);\n this._response = response;\n this.metadata.status = response.status;\n return response.status;\n }\n\n private async loadText(response: Response) {\n const value = await response.text();\n this.metadata.message = value;\n return RpcSerializedValue.create(value);\n }\n\n private async loadBinary(response: Response) {\n const value = new Uint8Array(await response.arrayBuffer());\n const objects = JSON.stringify(MarshalingBinaryMarker.createDefault());\n return RpcSerializedValue.create(objects, [value]);\n }\n\n private async loadMultipart(response: Response, contentType: string) {\n const data = await response.arrayBuffer();\n const value = new RpcMultipartParser(contentType, new Uint8Array(data)).parse();\n return value;\n }\n\n private async setupTransport(): Promise<void> {\n const parameters = (await this.protocol.serialize(this)).parameters;\n const transportType = WebAppRpcRequest.computeTransportType(parameters, this.parameters);\n\n if (transportType === RpcContentType.Binary) {\n this.setupBinaryTransport(parameters);\n } else if (transportType === RpcContentType.Multipart) {\n this.setupMultipartTransport(parameters);\n } else {\n this.setupTextTransport(parameters);\n }\n }\n\n private setupBinaryTransport(parameters: RpcSerializedValue) {\n this._headers[WEB_RPC_CONSTANTS.CONTENT] = WEB_RPC_CONSTANTS.BINARY;\n this._request.method = \"post\";\n this._request.body = parameters.data[0];\n }\n\n private setupMultipartTransport(parameters: RpcSerializedValue) {\n // IMPORTANT: do not set a multipart Content-Type header value. The browser does this automatically!\n delete this._headers[WEB_RPC_CONSTANTS.CONTENT];\n this._request.method = \"post\";\n this._request.body = RpcMultipart.createForm(parameters);\n }\n\n private setupTextTransport(parameters: RpcSerializedValue) {\n if (this.operation.policy.allowResponseCaching(this)) {\n const encodedBody = btoa(parameters.objects);\n if (encodedBody.length <= WebAppRpcRequest.maxUrlComponentSize) {\n this._request.method = \"get\";\n this._request.body = undefined;\n delete this._headers[WEB_RPC_CONSTANTS.CONTENT];\n this._pathSuffix = encodedBody;\n return;\n }\n }\n\n this._pathSuffix = \"\";\n this._headers[WEB_RPC_CONSTANTS.CONTENT] = WEB_RPC_CONSTANTS.TEXT;\n this._request.method = \"post\";\n this._request.body = parameters.objects;\n }\n\n /** @internal */\n public static backend = {\n sendResponse: async (_protocol: WebAppRpcProtocol, _request: SerializedRpcRequest, _fulfillment: RpcRequestFulfillment, _req: HttpServerRequest, _res: HttpServerResponse): Promise<void> => {\n throw new IModelError(BentleyStatus.ERROR, \"Not bound.\");\n },\n parseRequest: async (_protocol: WebAppRpcProtocol, _req: HttpServerRequest): Promise<SerializedRpcRequest> => {\n throw new IModelError(BentleyStatus.ERROR, \"Not bound.\");\n },\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"WebAppRpcRequest.js","sourceRoot":"","sources":["../../../../src/rpc/web/WebAppRpcRequest.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;A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AC,MAAM,GAAG,KAAK,CAAC;gBAC7B,IAAI,CAAC,QAAQ,CAAC,IAAI,GAAG,SAAS,CAAC;gBAC/B,OAAO,IAAI,CAAC,QAAQ,CAAC,gCAAiB,CAAC,OAAO,CAAC,CAAC;gBAChD,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;gBAC/B,OAAO;YACT,CAAC;QACH,CAAC;QAED,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC;QACtB,IAAI,CAAC,QAAQ,CAAC,gCAAiB,CAAC,OAAO,CAAC,GAAG,gCAAiB,CAAC,IAAI,CAAC;QAClE,IAAI,CAAC,QAAQ,CAAC,MAAM,GAAG,MAAM,CAAC;QAC9B,IAAI,CAAC,QAAQ,CAAC,IAAI,GAAG,UAAU,CAAC,OAAO,CAAC;IAC1C,CAAC;IAED,gBAAgB;IACT,MAAM,CAAC,OAAO,GAAG;QACtB,YAAY,EAAE,KAAK,EAAE,SAA4B,EAAE,QAA8B,EAAE,YAAmC,EAAE,IAAuB,EAAE,IAAwB,EAAiB,EAAE;YAC1L,MAAM,IAAI,yBAAW,CAAC,4BAAa,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC;QAC3D,CAAC;QACD,YAAY,EAAE,KAAK,EAAE,SAA4B,EAAE,IAAuB,EAAiC,EAAE;YAC3G,MAAM,IAAI,yBAAW,CAAC,4BAAa,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC;QAC3D,CAAC;KACF,CAAC;;AAxPJ,4CAyPC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module RpcInterface\r\n */\r\n\r\nimport { BentleyStatus, expectNotNull } from \"@itwin/core-bentley\";\r\nimport { IModelError, ServerError, ServerTimeoutError } from \"../../IModelError\";\r\nimport { RpcInterface } from \"../../RpcInterface\";\r\nimport { RpcContentType, RpcProtocolEvent, WEB_RPC_CONSTANTS } from \"../core/RpcConstants\";\r\nimport { MarshalingBinaryMarker, RpcSerializedValue } from \"../core/RpcMarshaling\";\r\nimport { RpcRequestFulfillment, SerializedRpcRequest } from \"../core/RpcProtocol\";\r\nimport { RpcRequest } from \"../core/RpcRequest\";\r\nimport { RpcMultipartParser } from \"./multipart/RpcMultipartParser\";\r\nimport { RpcMultipart } from \"./RpcMultipart\";\r\nimport { HttpServerRequest, HttpServerResponse, WebAppRpcProtocol } from \"./WebAppRpcProtocol\";\r\n\r\n/* eslint-disable @typescript-eslint/no-deprecated */\r\ndeclare const location: any;\r\n\r\n/** @internal */\r\nexport type HttpMethod_T = \"get\" | \"put\" | \"post\" | \"delete\" | \"options\" | \"head\" | \"patch\" | \"trace\"; // eslint-disable-line @typescript-eslint/naming-convention\r\n\r\n/** A web application RPC request.\r\n * @internal\r\n */\r\nexport class WebAppRpcRequest extends RpcRequest {\r\n private _loading: boolean = false;\r\n private _request: RequestInit = {};\r\n private _pathSuffix: string = \"\";\r\n private get _headers() { return this._request.headers as { [key: string]: string }; }\r\n\r\n /** The maximum size permitted for an encoded component in a URL.\r\n * Note that some backends limit the total cumulative request size. Our current node backends accept requests with a max size of 16 kb.\r\n * In addition to the url size, an authorization header may also add considerably to the request size.\r\n * @note This is used for features like encoding the payload of a cacheable request in the URL.\r\n */\r\n public static maxUrlComponentSize = 1024 * 8;\r\n\r\n /** The HTTP method for this request. */\r\n public override method: HttpMethod_T;\r\n\r\n /** Convenience access to the protocol of this request. */\r\n public override readonly protocol: WebAppRpcProtocol = this.client.configuration.protocol as any;\r\n\r\n /** Standardized access to metadata about the request (useful for purposes such as logging). */\r\n public metadata = { status: 0, message: \"\" };\r\n\r\n /** Parses a request. */\r\n public static async parseRequest(protocol: WebAppRpcProtocol, req: HttpServerRequest): Promise<SerializedRpcRequest> {\r\n return this.backend.parseRequest(protocol, req);\r\n }\r\n\r\n /** Sends the response for a web request. */\r\n public static async sendResponse(\r\n protocol: WebAppRpcProtocol,\r\n request: SerializedRpcRequest,\r\n fulfillment: RpcRequestFulfillment,\r\n req: HttpServerRequest,\r\n res: HttpServerResponse,\r\n ): Promise<void> {\r\n return this.backend.sendResponse(protocol, request, fulfillment, req, res);\r\n }\r\n\r\n /** Determines the most efficient transport type for an RPC value. */\r\n public static computeTransportType(value: RpcSerializedValue, source: any): RpcContentType {\r\n if (source instanceof Uint8Array || (Array.isArray(source) && source[0] instanceof Uint8Array)) {\r\n return RpcContentType.Binary;\r\n } else if (value.data.length > 0) {\r\n return RpcContentType.Multipart;\r\n } else if (value.stream) {\r\n return RpcContentType.Stream;\r\n } else {\r\n return RpcContentType.Text;\r\n }\r\n }\r\n\r\n /** Constructs a web application request. */\r\n public constructor(client: RpcInterface, operation: string, parameters: any[]) {\r\n super(client, operation, parameters);\r\n this.path = this.protocol.supplyPathForOperation(this.operation, this);\r\n this.method = \"head\";\r\n this._request.headers = {};\r\n }\r\n\r\n /** Sets request header values. */\r\n protected setHeader(name: string, value: string): void {\r\n this._headers[name] = value;\r\n }\r\n\r\n /** Sends the request. */\r\n protected async send(): Promise<number> {\r\n this._loading = true;\r\n await this.setupTransport();\r\n\r\n return new Promise<number>(async (resolve, reject) => {\r\n try {\r\n resolve(await this.performFetch());\r\n } catch (reason) {\r\n reject(new ServerError(-1, typeof (reason) === \"string\" ? reason : \"Server connection error.\"));\r\n }\r\n });\r\n }\r\n\r\n protected override computeRetryAfter(attempts: number): number {\r\n const retryAfter = this._response && this._response.headers.get(\"Retry-After\");\r\n if (retryAfter) {\r\n this.resetTransientFaultCount();\r\n\r\n const r = Number(retryAfter);\r\n if (Number.isFinite(r)) {\r\n return r * 1000;\r\n }\r\n\r\n const d = Date.parse(retryAfter);\r\n if (!Number.isNaN(d)) {\r\n return d - Date.now();\r\n }\r\n } else {\r\n this.recordTransientFault();\r\n }\r\n\r\n return super.computeRetryAfter(attempts);\r\n }\r\n\r\n protected override handleUnknownResponse(code: number) {\r\n if (this.protocol.isTimeout(code)) {\r\n this.reject(new ServerTimeoutError(\"Request timeout.\"));\r\n } else {\r\n this.reject(new ServerError(code, \"Unknown server response code.\"));\r\n }\r\n }\r\n\r\n protected async load(): Promise<RpcSerializedValue> {\r\n return new Promise<RpcSerializedValue>(async (resolve, reject) => {\r\n try {\r\n if (!this._loading)\r\n return;\r\n\r\n const response = this._response;\r\n if (!response) {\r\n reject(new IModelError(BentleyStatus.ERROR, \"Invalid state.\"));\r\n return;\r\n }\r\n\r\n if (this.protocol.protocolVersionHeaderName) {\r\n const version = response.headers.get(this.protocol.protocolVersionHeaderName);\r\n if (version) {\r\n this.responseProtocolVersion = parseInt(version, 10);\r\n }\r\n }\r\n\r\n const contentType = response.headers.get(WEB_RPC_CONSTANTS.CONTENT);\r\n const responseType = WebAppRpcProtocol.computeContentType(contentType);\r\n\r\n if (responseType === RpcContentType.Binary) {\r\n resolve(await this.loadBinary(response));\r\n } else if (responseType === RpcContentType.Multipart) {\r\n resolve(await this.loadMultipart(response, expectNotNull(contentType)));\r\n } else {\r\n resolve(await this.loadText(response));\r\n }\r\n\r\n this._loading = false;\r\n this.setLastUpdatedTime();\r\n this.protocol.events.raiseEvent(RpcProtocolEvent.ResponseLoaded, this);\r\n } catch (reason) {\r\n if (!this._loading)\r\n return;\r\n\r\n this._loading = false;\r\n reject(new ServerError(this.metadata.status, typeof (reason) === \"string\" ? reason : \"Unknown server response error.\"));\r\n }\r\n });\r\n }\r\n\r\n /** Override to supply an alternate fetch function. */\r\n protected supplyFetch(): typeof fetch {\r\n return fetch;\r\n }\r\n\r\n /** Override to supply an alternate Request function. */\r\n protected supplyRequest(): typeof Request {\r\n return Request;\r\n }\r\n\r\n private async performFetch(): Promise<number> {\r\n const requestClass = this.supplyRequest();\r\n const fetchFunction = this.supplyFetch();\r\n\r\n const path = new URL(this.path, typeof location !== \"undefined\" ? location.origin : undefined);\r\n if (this._pathSuffix) {\r\n const params = new URLSearchParams();\r\n params.set(\"parameters\", this._pathSuffix);\r\n path.search = `?${params.toString()}`;\r\n }\r\n\r\n const request = new requestClass(path.toString(), this._request);\r\n const response = await fetchFunction(request);\r\n this._response = response;\r\n this.metadata.status = response.status;\r\n return response.status;\r\n }\r\n\r\n private async loadText(response: Response) {\r\n const value = await response.text();\r\n this.metadata.message = value;\r\n return RpcSerializedValue.create(value);\r\n }\r\n\r\n private async loadBinary(response: Response) {\r\n const value = new Uint8Array(await response.arrayBuffer());\r\n const objects = JSON.stringify(MarshalingBinaryMarker.createDefault());\r\n return RpcSerializedValue.create(objects, [value]);\r\n }\r\n\r\n private async loadMultipart(response: Response, contentType: string) {\r\n const data = await response.arrayBuffer();\r\n const value = new RpcMultipartParser(contentType, new Uint8Array(data)).parse();\r\n return value;\r\n }\r\n\r\n private async setupTransport(): Promise<void> {\r\n const parameters = (await this.protocol.serialize(this)).parameters;\r\n const transportType = WebAppRpcRequest.computeTransportType(parameters, this.parameters);\r\n\r\n if (transportType === RpcContentType.Binary) {\r\n this.setupBinaryTransport(parameters);\r\n } else if (transportType === RpcContentType.Multipart) {\r\n this.setupMultipartTransport(parameters);\r\n } else {\r\n this.setupTextTransport(parameters);\r\n }\r\n }\r\n\r\n private setupBinaryTransport(parameters: RpcSerializedValue) {\r\n this._headers[WEB_RPC_CONSTANTS.CONTENT] = WEB_RPC_CONSTANTS.BINARY;\r\n this._request.method = \"post\";\r\n this._request.body = parameters.data[0];\r\n }\r\n\r\n private setupMultipartTransport(parameters: RpcSerializedValue) {\r\n // IMPORTANT: do not set a multipart Content-Type header value. The browser does this automatically!\r\n delete this._headers[WEB_RPC_CONSTANTS.CONTENT];\r\n this._request.method = \"post\";\r\n this._request.body = RpcMultipart.createForm(parameters);\r\n }\r\n\r\n private setupTextTransport(parameters: RpcSerializedValue) {\r\n if (this.operation.policy.allowResponseCaching(this)) {\r\n const encodedBody = btoa(parameters.objects);\r\n if (encodedBody.length <= WebAppRpcRequest.maxUrlComponentSize) {\r\n this._request.method = \"get\";\r\n this._request.body = undefined;\r\n delete this._headers[WEB_RPC_CONSTANTS.CONTENT];\r\n this._pathSuffix = encodedBody;\r\n return;\r\n }\r\n }\r\n\r\n this._pathSuffix = \"\";\r\n this._headers[WEB_RPC_CONSTANTS.CONTENT] = WEB_RPC_CONSTANTS.TEXT;\r\n this._request.method = \"post\";\r\n this._request.body = parameters.objects;\r\n }\r\n\r\n /** @internal */\r\n public static backend = {\r\n sendResponse: async (_protocol: WebAppRpcProtocol, _request: SerializedRpcRequest, _fulfillment: RpcRequestFulfillment, _req: HttpServerRequest, _res: HttpServerResponse): Promise<void> => {\r\n throw new IModelError(BentleyStatus.ERROR, \"Not bound.\");\r\n },\r\n parseRequest: async (_protocol: WebAppRpcProtocol, _req: HttpServerRequest): Promise<SerializedRpcRequest> => {\r\n throw new IModelError(BentleyStatus.ERROR, \"Not bound.\");\r\n },\r\n };\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RpcMultipartParser.js","sourceRoot":"","sources":["../../../../../src/rpc/web/multipart/RpcMultipartParser.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;EA0BE;AACF,4DAA8D;AAE9D,MAAM,KAAK,GAAG,CAAC,CAAC;AAChB,MAAM,cAAc,GAAG,CAAC,CAAC;AACzB,MAAM,kBAAkB,GAAG,CAAC,CAAC;AAC7B,MAAM,YAAY,GAAG,CAAC,CAAC;AACvB,MAAM,kBAAkB,GAAG,CAAC,CAAC;AAC7B,MAAM,YAAY,GAAG,CAAC,CAAC;AACvB,MAAM,wBAAwB,GAAG,CAAC,CAAC;AACnC,MAAM,mBAAmB,GAAG,CAAC,CAAC;AAC9B,MAAM,eAAe,GAAG,CAAC,CAAC;AAC1B,MAAM,SAAS,GAAG,CAAC,CAAC;AACpB,MAAM,cAAc,GAAG,EAAE,CAAC;AAC1B,MAAM,GAAG,GAAG,EAAE,CAAC;AAEf,MAAM,EAAE,GAAG,EAA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;IAClB,CAAC;IAEO,eAAe;QACrB,MAAM,SAAS,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC;QAE5F,IAAI,IAAI,CAAC,SAAS,KAAK,SAAS,EAAE,CAAC;YACjC,MAAM,WAAW,GAAG,IAAI,WAAW,EAAE,CAAC;YACtC,IAAI,CAAC,MAAM,CAAC,OAAO,GAAG,WAAW,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QACtD,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACnC,CAAC;QAED,IAAI,CAAC,cAAc,EAAE,CAAC;IACxB,CAAC;IAEO,kBAAkB,CAAC,OAAe;IAC1C,CAAC;CACF;AAlWD,gDAkWC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module RpcInterface\n */\n\n/*\nAdapted from https://github.com/pillarjs/multiparty. Multiparty license as follows:\n(The MIT License)\n\nCopyright (c) 2013 Felix Geisendörfer\nCopyright (c) 2014 Andrew Kelley\nCopyright (c) 2014 Douglas Christopher Wilson\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n*/\nimport { RpcSerializedValue } from \"../../core/RpcMarshaling\";\n\nconst START = 0;\nconst START_BOUNDARY = 1;\nconst HEADER_FIELD_START = 2;\nconst HEADER_FIELD = 3;\nconst HEADER_VALUE_START = 4;\nconst HEADER_VALUE = 5;\nconst HEADER_VALUE_ALMOST_DONE = 6;\nconst HEADERS_ALMOST_DONE = 7;\nconst PART_DATA_START = 8;\nconst PART_DATA = 9;\nconst CLOSE_BOUNDARY = 10;\nconst END = 11;\n\nconst LF = 10;\nconst CR = 13;\nconst SPACE = 32;\nconst HYPHEN = 45;\nconst COLON = 58;\nconst A = 97;\nconst Z = 122;\n\nconst CONTENT_TYPE_RE = /^multipart\\/(?:form-data|related)(?:;|$)/i;\nconst CONTENT_TYPE_PARAM_RE = /;\\s*([^=]+)=(?:\"([^\"]+)\"|([^;]+))/gi;\n\n/** @internal */\nexport class RpcMultipartParser {\n private _headerFieldMark: number | null;\n private _headerValueMark: number | null;\n private _partDataMark: number | null;\n private _partBoundaryFlag: boolean;\n private _headerField: string;\n private _partHeaders: { [index: string]: string };\n private _partName: string | null;\n private _partChunks: Uint8Array[];\n private _headerValue: string;\n private _boundary: string;\n private _buffer: Uint8Array;\n private _value: RpcSerializedValue;\n\n public constructor(contentType: string, buffer: Uint8Array) {\n let m = CONTENT_TYPE_RE.exec(contentType);\n if (!m) {\n throw new Error(\"unsupported content-type\");\n }\n\n let boundary = \"\";\n CONTENT_TYPE_PARAM_RE.lastIndex = m.index + m[0].length - 1;\n while ((m = CONTENT_TYPE_PARAM_RE.exec(contentType))) {\n if (m[1].toLowerCase() !== \"boundary\")\n continue;\n\n boundary = m[2] || m[3];\n break;\n }\n\n if (!boundary) {\n throw new Error(\"content-type missing boundary\");\n }\n\n this._headerField = \"\";\n this._partHeaders = {};\n this._partName = null;\n this._partChunks = [];\n this._headerValue = \"\";\n\n this._headerFieldMark = null;\n this._headerValueMark = null;\n this._partDataMark = null;\n this._partBoundaryFlag = false;\n\n this._boundary = boundary;\n this._buffer = buffer;\n this._value = RpcSerializedValue.create();\n }\n\n public parse(): RpcSerializedValue {\n let i = 0;\n const len = this._buffer.length;\n let prevIndex = 0;\n let index = 0;\n let state = START;\n\n const boundary = new Uint8Array(this._boundary.length + 4);\n const boundaryEncoder = new TextEncoder(); // encodes utf8 only\n boundaryEncoder.encodeInto(\"\\r\\n--\", boundary.subarray(0));\n boundaryEncoder.encodeInto(this._boundary, boundary.subarray(4));\n\n const boundaryChars: { [index: number]: boolean } = {};\n for (const char of boundary) {\n boundaryChars[char] = true;\n }\n\n const boundaryLength = boundary.length;\n const boundaryEnd = boundaryLength - 1;\n const bufferLength = this._buffer.length;\n const lookbehind = new Uint8Array(boundaryLength + 8);\n\n let c;\n let cl;\n\n for (i = 0; i < len; i++) {\n c = this._buffer[i];\n switch (state) {\n case START:\n index = 0;\n state = START_BOUNDARY;\n /* falls through */\n case START_BOUNDARY:\n if (index === boundaryLength - 2 && c === HYPHEN) {\n index = 1;\n state = CLOSE_BOUNDARY;\n break;\n } else if (index === boundaryLength - 2) {\n if (c !== CR)\n throw new Error(`Expected CR Received ${c}`);\n\n index++;\n break;\n } else if (index === boundaryLength - 1) {\n if (c !== LF)\n throw new Error(`Expected LF Received ${c}`);\n\n index = 0;\n this._onParsePartBegin();\n state = HEADER_FIELD_START;\n break;\n }\n\n if (c !== boundary[index + 2])\n index = -2;\n\n if (c === boundary[index + 2])\n index++;\n\n break;\n case HEADER_FIELD_START:\n state = HEADER_FIELD;\n this._headerFieldMark = i;\n index = 0;\n /* falls through */\n case HEADER_FIELD:\n if (c === CR) {\n this._headerFieldMark = null;\n state = HEADERS_ALMOST_DONE;\n break;\n }\n\n index++;\n if (c === HYPHEN)\n break;\n\n if (c === COLON) {\n if (index === 1) {\n // empty header field\n throw new Error(\"Empty header field\");\n }\n this._onParseHeaderField(this._buffer.subarray(this._headerFieldMark as number, i));\n this._headerFieldMark = null;\n state = HEADER_VALUE_START;\n break;\n }\n\n cl = c | 0x20;\n if (cl < A || cl > Z) {\n throw new Error(`Expected alphabetic character, received ${c}`);\n }\n break;\n case HEADER_VALUE_START:\n if (c === SPACE)\n break;\n\n this._headerValueMark = i;\n state = HEADER_VALUE;\n /* falls through */\n case HEADER_VALUE:\n if (c === CR) {\n this._onParseHeaderValue(this._buffer.subarray(this._headerValueMark as number, i));\n this._headerValueMark = null;\n this._onParseHeaderEnd();\n state = HEADER_VALUE_ALMOST_DONE;\n }\n break;\n case HEADER_VALUE_ALMOST_DONE:\n if (c !== LF)\n throw new Error(`Expected LF Received ${c}`);\n\n state = HEADER_FIELD_START;\n break;\n case HEADERS_ALMOST_DONE:\n if (c !== LF)\n throw new Error(`Expected LF Received ${c}`);\n\n const err: any = this._onParseHeadersEnd(i + 1);\n if (err)\n throw err;\n\n state = PART_DATA_START;\n break;\n case PART_DATA_START:\n state = PART_DATA;\n this._partDataMark = i;\n /* falls through */\n case PART_DATA:\n prevIndex = index;\n\n if (index === 0) {\n // boyer-moore derived algorithm to safely skip non-boundary data\n i += boundaryEnd;\n while (i < bufferLength && !(this._buffer[i] in boundaryChars)) {\n i += boundaryLength;\n }\n i -= boundaryEnd;\n c = this._buffer[i];\n }\n\n if (index < boundaryLength) {\n if (boundary[index] === c) {\n if (index === 0) {\n this._onParsePartData(this._buffer.subarray(this._partDataMark as number, i));\n this._partDataMark = null;\n }\n index++;\n } else {\n index = 0;\n }\n } else if (index === boundaryLength) {\n index++;\n if (c === CR) {\n // CR = part boundary\n this._partBoundaryFlag = true;\n } else if (c === HYPHEN) {\n index = 1;\n state = CLOSE_BOUNDARY;\n break;\n } else {\n index = 0;\n }\n } else if (index - 1 === boundaryLength) {\n if (this._partBoundaryFlag) {\n index = 0;\n if (c === LF) {\n this._partBoundaryFlag = false;\n this._onParsePartEnd();\n this._onParsePartBegin();\n state = HEADER_FIELD_START;\n break;\n }\n } else {\n index = 0;\n }\n }\n\n if (index > 0) {\n // when matching a possible boundary, keep a lookbehind reference\n // in case it turns out to be a false lead\n lookbehind[index - 1] = c;\n } else if (prevIndex > 0) {\n // if our boundary turned out to be rubbish, the captured lookbehind\n // belongs to partData\n this._onParsePartData(lookbehind.subarray(0, prevIndex));\n prevIndex = 0;\n this._partDataMark = i;\n\n // reconsider the current character even so it interrupted the sequence\n // it could be the beginning of a new sequence\n i--;\n }\n\n break;\n case CLOSE_BOUNDARY:\n if (c !== HYPHEN)\n throw new Error(`Expected HYPHEN Received ${c}`);\n\n if (index === 1) {\n this._onParsePartEnd();\n state = END;\n } else if (index > 1) {\n throw new Error(\"Parser has invalid state.\");\n }\n index++;\n break;\n case END:\n break;\n default:\n throw new Error(\"Parser has invalid state.\");\n }\n }\n\n if (this._headerFieldMark != null) {\n this._onParseHeaderField(this._buffer.subarray(this._headerFieldMark));\n this._headerFieldMark = 0;\n }\n if (this._headerValueMark != null) {\n this._onParseHeaderValue(this._buffer.subarray(this._headerValueMark));\n this._headerValueMark = 0;\n }\n if (this._partDataMark != null) {\n this._onParsePartData(this._buffer.subarray(this._partDataMark));\n this._partDataMark = 0;\n }\n\n return this._value;\n }\n\n private _onParsePartBegin() {\n this._clearPartVars();\n }\n\n private _clearPartVars() {\n this._partHeaders = {};\n this._partName = null;\n this._partChunks.length = 0;\n\n this._headerField = \"\";\n this._headerValue = \"\";\n }\n\n private _onParseHeaderField(b: Uint8Array) {\n this._headerField += new TextDecoder(\"utf8\").decode(b);\n }\n\n private _onParseHeaderValue(b: Uint8Array) {\n this._headerValue += new TextDecoder(\"utf8\").decode(b);\n }\n\n private _onParseHeaderEnd() {\n this._headerField = this._headerField.toLowerCase();\n this._partHeaders[this._headerField] = this._headerValue;\n\n let m: RegExpMatchArray | null;\n if (this._headerField === \"content-disposition\") {\n if (m = this._headerValue.match(/\\bname=\"([^\"]+)\"/i)) {\n this._partName = m[1];\n }\n // this._partFilename = parseFilename(this._headerValue);\n } else if (this._headerField === \"content-transfer-encoding\") {\n // this._partTransferEncoding = this._headerValue.toLowerCase();\n }\n\n this._headerField = \"\";\n this._headerValue = \"\";\n }\n\n private _onParsePartData(b: Uint8Array) {\n this._partChunks.push(b);\n }\n\n private _concatParts() {\n let totalSize = 0;\n for (const chunk of this._partChunks) {\n totalSize += chunk.length;\n }\n\n const combined = new Uint8Array(totalSize);\n\n let offset = 0;\n for (const chunk of this._partChunks) {\n combined.set(chunk, offset);\n offset += chunk.length;\n }\n\n return combined;\n }\n\n private _onParsePartEnd() {\n const partValue = this._partChunks.length === 1 ? this._partChunks[0] : this._concatParts();\n\n if (this._partName === \"objects\") {\n const partDecoder = new TextDecoder();\n this._value.objects = partDecoder.decode(partValue);\n } else {\n this._value.data.push(partValue);\n }\n\n this._clearPartVars();\n }\n\n private _onParseHeadersEnd(_offset: number) {\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"RpcMultipartParser.js","sourceRoot":"","sources":["../../../../../src/rpc/web/multipart/RpcMultipartParser.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;EA0BE;AACF,4DAA8D;AAE9D,MAAM,KAAK,GAAG,CAAC,CAAC;AAChB,MAAM,cAAc,GAAG,CAAC,CAAC;AACzB,MAAM,kBAAkB,GAAG,CAAC,CAAC;AAC7B,MAAM,YAAY,GAAG,CAAC,CAAC;AACvB,MAAM,kBAAkB,GAAG,CAAC,CAAC;AAC7B,MAAM,YAAY,GAAG,CAAC,CAAC;AACvB,MAAM,wBAAwB,GAAG,CAAC,CAAC;AACnC,MAAM,mBAAmB,GAAG,CAAC,CAAC;AAC9B,MA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I,CAAC,WAAW,EAAE,CAAC;YACrC,QAAQ,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;YAC5B,MAAM,IAAI,KAAK,CAAC,MAAM,CAAC;QACzB,CAAC;QAED,OAAO,QAAQ,CAAC;IAClB,CAAC;IAEO,eAAe;QACrB,MAAM,SAAS,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC;QAE5F,IAAI,IAAI,CAAC,SAAS,KAAK,SAAS,EAAE,CAAC;YACjC,MAAM,WAAW,GAAG,IAAI,WAAW,EAAE,CAAC;YACtC,IAAI,CAAC,MAAM,CAAC,OAAO,GAAG,WAAW,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QACtD,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACnC,CAAC;QAED,IAAI,CAAC,cAAc,EAAE,CAAC;IACxB,CAAC;IAEO,kBAAkB,CAAC,OAAe;IAC1C,CAAC;CACF;AAlWD,gDAkWC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module RpcInterface\r\n */\r\n\r\n/*\r\nAdapted from https://github.com/pillarjs/multiparty. Multiparty license as follows:\r\n(The MIT License)\r\n\r\nCopyright (c) 2013 Felix Geisendörfer\r\nCopyright (c) 2014 Andrew Kelley\r\nCopyright (c) 2014 Douglas Christopher Wilson\r\n\r\nPermission is hereby granted, free of charge, to any person obtaining\r\na copy of this software and associated documentation files (the\r\n'Software'), to deal in the Software without restriction, including\r\nwithout limitation the rights to use, copy, modify, merge, publish,\r\ndistribute, sublicense, and/or sell copies of the Software, and to\r\npermit persons to whom the Software is furnished to do so, subject to\r\nthe following conditions:\r\n\r\nThe above copyright notice and this permission notice shall be\r\nincluded in all copies or substantial portions of the Software.\r\n\r\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\r\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\r\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\r\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\r\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\r\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n*/\r\nimport { RpcSerializedValue } from \"../../core/RpcMarshaling\";\r\n\r\nconst START = 0;\r\nconst START_BOUNDARY = 1;\r\nconst HEADER_FIELD_START = 2;\r\nconst HEADER_FIELD = 3;\r\nconst HEADER_VALUE_START = 4;\r\nconst HEADER_VALUE = 5;\r\nconst HEADER_VALUE_ALMOST_DONE = 6;\r\nconst HEADERS_ALMOST_DONE = 7;\r\nconst PART_DATA_START = 8;\r\nconst PART_DATA = 9;\r\nconst CLOSE_BOUNDARY = 10;\r\nconst END = 11;\r\n\r\nconst LF = 10;\r\nconst CR = 13;\r\nconst SPACE = 32;\r\nconst HYPHEN = 45;\r\nconst COLON = 58;\r\nconst A = 97;\r\nconst Z = 122;\r\n\r\nconst CONTENT_TYPE_RE = /^multipart\\/(?:form-data|related)(?:;|$)/i;\r\nconst CONTENT_TYPE_PARAM_RE = /;\\s*([^=]+)=(?:\"([^\"]+)\"|([^;]+))/gi;\r\n\r\n/** @internal */\r\nexport class RpcMultipartParser {\r\n private _headerFieldMark: number | null;\r\n private _headerValueMark: number | null;\r\n private _partDataMark: number | null;\r\n private _partBoundaryFlag: boolean;\r\n private _headerField: string;\r\n private _partHeaders: { [index: string]: string };\r\n private _partName: string | null;\r\n private _partChunks: Uint8Array[];\r\n private _headerValue: string;\r\n private _boundary: string;\r\n private _buffer: Uint8Array;\r\n private _value: RpcSerializedValue;\r\n\r\n public constructor(contentType: string, buffer: Uint8Array) {\r\n let m = CONTENT_TYPE_RE.exec(contentType);\r\n if (!m) {\r\n throw new Error(\"unsupported content-type\");\r\n }\r\n\r\n let boundary = \"\";\r\n CONTENT_TYPE_PARAM_RE.lastIndex = m.index + m[0].length - 1;\r\n while ((m = CONTENT_TYPE_PARAM_RE.exec(contentType))) {\r\n if (m[1].toLowerCase() !== \"boundary\")\r\n continue;\r\n\r\n boundary = m[2] || m[3];\r\n break;\r\n }\r\n\r\n if (!boundary) {\r\n throw new Error(\"content-type missing boundary\");\r\n }\r\n\r\n this._headerField = \"\";\r\n this._partHeaders = {};\r\n this._partName = null;\r\n this._partChunks = [];\r\n this._headerValue = \"\";\r\n\r\n this._headerFieldMark = null;\r\n this._headerValueMark = null;\r\n this._partDataMark = null;\r\n this._partBoundaryFlag = false;\r\n\r\n this._boundary = boundary;\r\n this._buffer = buffer;\r\n this._value = RpcSerializedValue.create();\r\n }\r\n\r\n public parse(): RpcSerializedValue {\r\n let i = 0;\r\n const len = this._buffer.length;\r\n let prevIndex = 0;\r\n let index = 0;\r\n let state = START;\r\n\r\n const boundary = new Uint8Array(this._boundary.length + 4);\r\n const boundaryEncoder = new TextEncoder(); // encodes utf8 only\r\n boundaryEncoder.encodeInto(\"\\r\\n--\", boundary.subarray(0));\r\n boundaryEncoder.encodeInto(this._boundary, boundary.subarray(4));\r\n\r\n const boundaryChars: { [index: number]: boolean } = {};\r\n for (const char of boundary) {\r\n boundaryChars[char] = true;\r\n }\r\n\r\n const boundaryLength = boundary.length;\r\n const boundaryEnd = boundaryLength - 1;\r\n const bufferLength = this._buffer.length;\r\n const lookbehind = new Uint8Array(boundaryLength + 8);\r\n\r\n let c;\r\n let cl;\r\n\r\n for (i = 0; i < len; i++) {\r\n c = this._buffer[i];\r\n switch (state) {\r\n case START:\r\n index = 0;\r\n state = START_BOUNDARY;\r\n /* falls through */\r\n case START_BOUNDARY:\r\n if (index === boundaryLength - 2 && c === HYPHEN) {\r\n index = 1;\r\n state = CLOSE_BOUNDARY;\r\n break;\r\n } else if (index === boundaryLength - 2) {\r\n if (c !== CR)\r\n throw new Error(`Expected CR Received ${c}`);\r\n\r\n index++;\r\n break;\r\n } else if (index === boundaryLength - 1) {\r\n if (c !== LF)\r\n throw new Error(`Expected LF Received ${c}`);\r\n\r\n index = 0;\r\n this._onParsePartBegin();\r\n state = HEADER_FIELD_START;\r\n break;\r\n }\r\n\r\n if (c !== boundary[index + 2])\r\n index = -2;\r\n\r\n if (c === boundary[index + 2])\r\n index++;\r\n\r\n break;\r\n case HEADER_FIELD_START:\r\n state = HEADER_FIELD;\r\n this._headerFieldMark = i;\r\n index = 0;\r\n /* falls through */\r\n case HEADER_FIELD:\r\n if (c === CR) {\r\n this._headerFieldMark = null;\r\n state = HEADERS_ALMOST_DONE;\r\n break;\r\n }\r\n\r\n index++;\r\n if (c === HYPHEN)\r\n break;\r\n\r\n if (c === COLON) {\r\n if (index === 1) {\r\n // empty header field\r\n throw new Error(\"Empty header field\");\r\n }\r\n this._onParseHeaderField(this._buffer.subarray(this._headerFieldMark as number, i));\r\n this._headerFieldMark = null;\r\n state = HEADER_VALUE_START;\r\n break;\r\n }\r\n\r\n cl = c | 0x20;\r\n if (cl < A || cl > Z) {\r\n throw new Error(`Expected alphabetic character, received ${c}`);\r\n }\r\n break;\r\n case HEADER_VALUE_START:\r\n if (c === SPACE)\r\n break;\r\n\r\n this._headerValueMark = i;\r\n state = HEADER_VALUE;\r\n /* falls through */\r\n case HEADER_VALUE:\r\n if (c === CR) {\r\n this._onParseHeaderValue(this._buffer.subarray(this._headerValueMark as number, i));\r\n this._headerValueMark = null;\r\n this._onParseHeaderEnd();\r\n state = HEADER_VALUE_ALMOST_DONE;\r\n }\r\n break;\r\n case HEADER_VALUE_ALMOST_DONE:\r\n if (c !== LF)\r\n throw new Error(`Expected LF Received ${c}`);\r\n\r\n state = HEADER_FIELD_START;\r\n break;\r\n case HEADERS_ALMOST_DONE:\r\n if (c !== LF)\r\n throw new Error(`Expected LF Received ${c}`);\r\n\r\n const err: any = this._onParseHeadersEnd(i + 1);\r\n if (err)\r\n throw err;\r\n\r\n state = PART_DATA_START;\r\n break;\r\n case PART_DATA_START:\r\n state = PART_DATA;\r\n this._partDataMark = i;\r\n /* falls through */\r\n case PART_DATA:\r\n prevIndex = index;\r\n\r\n if (index === 0) {\r\n // boyer-moore derived algorithm to safely skip non-boundary data\r\n i += boundaryEnd;\r\n while (i < bufferLength && !(this._buffer[i] in boundaryChars)) {\r\n i += boundaryLength;\r\n }\r\n i -= boundaryEnd;\r\n c = this._buffer[i];\r\n }\r\n\r\n if (index < boundaryLength) {\r\n if (boundary[index] === c) {\r\n if (index === 0) {\r\n this._onParsePartData(this._buffer.subarray(this._partDataMark as number, i));\r\n this._partDataMark = null;\r\n }\r\n index++;\r\n } else {\r\n index = 0;\r\n }\r\n } else if (index === boundaryLength) {\r\n index++;\r\n if (c === CR) {\r\n // CR = part boundary\r\n this._partBoundaryFlag = true;\r\n } else if (c === HYPHEN) {\r\n index = 1;\r\n state = CLOSE_BOUNDARY;\r\n break;\r\n } else {\r\n index = 0;\r\n }\r\n } else if (index - 1 === boundaryLength) {\r\n if (this._partBoundaryFlag) {\r\n index = 0;\r\n if (c === LF) {\r\n this._partBoundaryFlag = false;\r\n this._onParsePartEnd();\r\n this._onParsePartBegin();\r\n state = HEADER_FIELD_START;\r\n break;\r\n }\r\n } else {\r\n index = 0;\r\n }\r\n }\r\n\r\n if (index > 0) {\r\n // when matching a possible boundary, keep a lookbehind reference\r\n // in case it turns out to be a false lead\r\n lookbehind[index - 1] = c;\r\n } else if (prevIndex > 0) {\r\n // if our boundary turned out to be rubbish, the captured lookbehind\r\n // belongs to partData\r\n this._onParsePartData(lookbehind.subarray(0, prevIndex));\r\n prevIndex = 0;\r\n this._partDataMark = i;\r\n\r\n // reconsider the current character even so it interrupted the sequence\r\n // it could be the beginning of a new sequence\r\n i--;\r\n }\r\n\r\n break;\r\n case CLOSE_BOUNDARY:\r\n if (c !== HYPHEN)\r\n throw new Error(`Expected HYPHEN Received ${c}`);\r\n\r\n if (index === 1) {\r\n this._onParsePartEnd();\r\n state = END;\r\n } else if (index > 1) {\r\n throw new Error(\"Parser has invalid state.\");\r\n }\r\n index++;\r\n break;\r\n case END:\r\n break;\r\n default:\r\n throw new Error(\"Parser has invalid state.\");\r\n }\r\n }\r\n\r\n if (this._headerFieldMark != null) {\r\n this._onParseHeaderField(this._buffer.subarray(this._headerFieldMark));\r\n this._headerFieldMark = 0;\r\n }\r\n if (this._headerValueMark != null) {\r\n this._onParseHeaderValue(this._buffer.subarray(this._headerValueMark));\r\n this._headerValueMark = 0;\r\n }\r\n if (this._partDataMark != null) {\r\n this._onParsePartData(this._buffer.subarray(this._partDataMark));\r\n this._partDataMark = 0;\r\n }\r\n\r\n return this._value;\r\n }\r\n\r\n private _onParsePartBegin() {\r\n this._clearPartVars();\r\n }\r\n\r\n private _clearPartVars() {\r\n this._partHeaders = {};\r\n this._partName = null;\r\n this._partChunks.length = 0;\r\n\r\n this._headerField = \"\";\r\n this._headerValue = \"\";\r\n }\r\n\r\n private _onParseHeaderField(b: Uint8Array) {\r\n this._headerField += new TextDecoder(\"utf8\").decode(b);\r\n }\r\n\r\n private _onParseHeaderValue(b: Uint8Array) {\r\n this._headerValue += new TextDecoder(\"utf8\").decode(b);\r\n }\r\n\r\n private _onParseHeaderEnd() {\r\n this._headerField = this._headerField.toLowerCase();\r\n this._partHeaders[this._headerField] = this._headerValue;\r\n\r\n let m: RegExpMatchArray | null;\r\n if (this._headerField === \"content-disposition\") {\r\n if (m = this._headerValue.match(/\\bname=\"([^\"]+)\"/i)) {\r\n this._partName = m[1];\r\n }\r\n // this._partFilename = parseFilename(this._headerValue);\r\n } else if (this._headerField === \"content-transfer-encoding\") {\r\n // this._partTransferEncoding = this._headerValue.toLowerCase();\r\n }\r\n\r\n this._headerField = \"\";\r\n this._headerValue = \"\";\r\n }\r\n\r\n private _onParsePartData(b: Uint8Array) {\r\n this._partChunks.push(b);\r\n }\r\n\r\n private _concatParts() {\r\n let totalSize = 0;\r\n for (const chunk of this._partChunks) {\r\n totalSize += chunk.length;\r\n }\r\n\r\n const combined = new Uint8Array(totalSize);\r\n\r\n let offset = 0;\r\n for (const chunk of this._partChunks) {\r\n combined.set(chunk, offset);\r\n offset += chunk.length;\r\n }\r\n\r\n return combined;\r\n }\r\n\r\n private _onParsePartEnd() {\r\n const partValue = this._partChunks.length === 1 ? this._partChunks[0] : this._concatParts();\r\n\r\n if (this._partName === \"objects\") {\r\n const partDecoder = new TextDecoder();\r\n this._value.objects = partDecoder.decode(partValue);\r\n } else {\r\n this._value.data.push(partValue);\r\n }\r\n\r\n this._clearPartVars();\r\n }\r\n\r\n private _onParseHeadersEnd(_offset: number) {\r\n }\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"B3dmTileIO.js","sourceRoot":"","sources":["../../../src/tile/B3dmTileIO.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA+D;AAC/D,qCAAkD;AAElD;;GAEG;AACH,MAAa,UAAW,SAAQ,mBAAU;IACxB,MAAM,CAAS;IACf,sBAAsB,CAAS;IAC/B,wBAAwB,CAAS;IACjC,oBAAoB,CAAS;IAC7B,sBAAsB,CAAS;IAC/B,gBAAgB,CAAM;IACtB,cAAc,CAAM;IACpC,IAAW,OAAO,KAAc,OAAO,mBAAU,CAAC,IAAI,KAAK,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;IAEzE,YAAmB,MAAkB;QACnC,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC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BACV,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QACjD,CAAC;QAED,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC;QAC9C,IAAI,CAAC,KAAK,IAAI,CAAC,oBAAoB,EAAE,CAAC;YACpC,MAAM,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;YACjE,MAAM,QAAQ,GAAG,IAAA,2BAAY,EAAC,YAAY,CAAC,CAAC;YAC5C,IAAI,QAAQ;gBACV,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QAC/C,CAAC;QAED,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;QAE5C,IAAI,MAAM,CAAC,YAAY;YACrB,IAAI,CAAC,UAAU,EAAE,CAAC;IACtB,CAAC;CACF;AA7DD,gCA6DC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Tile\n */\n\nimport { ByteStream, utf8ToString } from \"@itwin/core-bentley\";\nimport { TileFormat, TileHeader } from \"./TileIO\";\n\n/** Header preceding tile content in [b3dm](https://github.com/AnalyticalGraphicsInc/3d-tiles/tree/master/specification/TileFormats/Batched3DModel) format.\n * @internal\n */\nexport class B3dmHeader extends TileHeader {\n public readonly length: number;\n public readonly featureTableJsonLength: number;\n public readonly featureTableBinaryLength: number;\n public readonly batchTableJsonLength: number;\n public readonly batchTableBinaryLength: number;\n public readonly featureTableJson: any;\n public readonly batchTableJson: any;\n public get isValid(): boolean { return TileFormat.B3dm === this.format; }\n\n public constructor(stream: ByteStream) {\n super(stream);\n this.length = stream.readUint32();\n this.featureTableJsonLength = stream.readUint32();\n this.featureTableBinaryLength = stream.readUint32();\n this.batchTableJsonLength = stream.readUint32();\n this.batchTableBinaryLength = stream.readUint32();\n\n // Keep this legacy check in for now since a lot of tilesets are still using the old header.\n // Legacy header #1: [batchLength] [batchTableByteLength]\n // Legacy header #2: [batchTableJsonByteLength] [batchTableBinaryByteLength] [batchLength]\n // Current header: [featureTableJsonByteLength] [featureTableBinaryByteLength] [batchTableJsonByteLength] [batchTableBinaryByteLength]\n // If the header is in the first legacy format 'batchTableJsonByteLength' will be the start of the JSON string (a quotation mark) or the glTF magic.\n // Accordingly its first byte will be either 0x22 or 0x67, and so the minimum uint32 expected is 0x22000000 = 570425344 = 570MB. It is unlikely that the feature table Json will exceed this length.\n // The check for the second legacy format is similar, except it checks 'batchTableBinaryByteLength' instead\n if (this.batchTableJsonLength >= 570425344) {\n // First legacy check\n stream.curPos = 20;\n this.batchTableJsonLength = this.featureTableBinaryLength;\n this.batchTableBinaryLength = 0;\n this.featureTableJsonLength = 0;\n this.featureTableBinaryLength = 0;\n } else if (this.batchTableBinaryLength >= 570425344) {\n // Second legacy check\n stream.curPos = 24;\n this.batchTableJsonLength = this.featureTableJsonLength;\n this.batchTableBinaryLength = this.featureTableBinaryLength;\n this.featureTableJsonLength = 0;\n this.featureTableBinaryLength = 0;\n }\n\n if (0 !== this.featureTableJsonLength) {\n const sceneStrData = stream.nextBytes(this.featureTableJsonLength);\n const sceneStr = utf8ToString(sceneStrData);\n if (sceneStr)\n this.featureTableJson = JSON.parse(sceneStr);\n }\n\n stream.advance(this.featureTableBinaryLength);\n if (0 !== this.batchTableJsonLength) {\n const batchStrData = stream.nextBytes(this.batchTableJsonLength);\n const batchStr = utf8ToString(batchStrData);\n if (batchStr)\n this.batchTableJson = JSON.parse(batchStr);\n }\n\n stream.advance(this.batchTableBinaryLength);\n\n if (stream.isPastTheEnd)\n this.invalidate();\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"B3dmTileIO.js","sourceRoot":"","sources":["../../../src/tile/B3dmTileIO.ts"],"names":[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MAAM,GAAG,EAAE,CAAC;YACnB,IAAI,CAAC,oBAAoB,GAAG,IAAI,CAAC,sBAAsB,CAAC;YACxD,IAAI,CAAC,sBAAsB,GAAG,IAAI,CAAC,wBAAwB,CAAC;YAC5D,IAAI,CAAC,sBAAsB,GAAG,CAAC,CAAC;YAChC,IAAI,CAAC,wBAAwB,GAAG,CAAC,CAAC;QACpC,CAAC;QAED,IAAI,CAAC,KAAK,IAAI,CAAC,sBAAsB,EAAE,CAAC;YACtC,MAAM,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;YACnE,MAAM,QAAQ,GAAG,IAAA,2BAAY,EAAC,YAAY,CAAC,CAAC;YAC5C,IAAI,QAAQ;gBACV,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QACjD,CAAC;QAED,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC;QAC9C,IAAI,CAAC,KAAK,IAAI,CAAC,oBAAoB,EAAE,CAAC;YACpC,MAAM,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;YACjE,MAAM,QAAQ,GAAG,IAAA,2BAAY,EAAC,YAAY,CAAC,CAAC;YAC5C,IAAI,QAAQ;gBACV,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QAC/C,CAAC;QAED,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;QAE5C,IAAI,MAAM,CAAC,YAAY;YACrB,IAAI,CAAC,UAAU,EAAE,CAAC;IACtB,CAAC;CACF;AA7DD,gCA6DC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Tile\r\n */\r\n\r\nimport { ByteStream, utf8ToString } from \"@itwin/core-bentley\";\r\nimport { TileFormat, TileHeader } from \"./TileIO\";\r\n\r\n/** Header preceding tile content in [b3dm](https://github.com/AnalyticalGraphicsInc/3d-tiles/tree/master/specification/TileFormats/Batched3DModel) format.\r\n * @internal\r\n */\r\nexport class B3dmHeader extends TileHeader {\r\n public readonly length: number;\r\n public readonly featureTableJsonLength: number;\r\n public readonly featureTableBinaryLength: number;\r\n public readonly batchTableJsonLength: number;\r\n public readonly batchTableBinaryLength: number;\r\n public readonly featureTableJson: any;\r\n public readonly batchTableJson: any;\r\n public get isValid(): boolean { return TileFormat.B3dm === this.format; }\r\n\r\n public constructor(stream: ByteStream) {\r\n super(stream);\r\n this.length = stream.readUint32();\r\n this.featureTableJsonLength = stream.readUint32();\r\n this.featureTableBinaryLength = stream.readUint32();\r\n this.batchTableJsonLength = stream.readUint32();\r\n this.batchTableBinaryLength = stream.readUint32();\r\n\r\n // Keep this legacy check in for now since a lot of tilesets are still using the old header.\r\n // Legacy header #1: [batchLength] [batchTableByteLength]\r\n // Legacy header #2: [batchTableJsonByteLength] [batchTableBinaryByteLength] [batchLength]\r\n // Current header: [featureTableJsonByteLength] [featureTableBinaryByteLength] [batchTableJsonByteLength] [batchTableBinaryByteLength]\r\n // If the header is in the first legacy format 'batchTableJsonByteLength' will be the start of the JSON string (a quotation mark) or the glTF magic.\r\n // Accordingly its first byte will be either 0x22 or 0x67, and so the minimum uint32 expected is 0x22000000 = 570425344 = 570MB. It is unlikely that the feature table Json will exceed this length.\r\n // The check for the second legacy format is similar, except it checks 'batchTableBinaryByteLength' instead\r\n if (this.batchTableJsonLength >= 570425344) {\r\n // First legacy check\r\n stream.curPos = 20;\r\n this.batchTableJsonLength = this.featureTableBinaryLength;\r\n this.batchTableBinaryLength = 0;\r\n this.featureTableJsonLength = 0;\r\n this.featureTableBinaryLength = 0;\r\n } else if (this.batchTableBinaryLength >= 570425344) {\r\n // Second legacy check\r\n stream.curPos = 24;\r\n this.batchTableJsonLength = this.featureTableJsonLength;\r\n this.batchTableBinaryLength = this.featureTableBinaryLength;\r\n this.featureTableJsonLength = 0;\r\n this.featureTableBinaryLength = 0;\r\n }\r\n\r\n if (0 !== this.featureTableJsonLength) {\r\n const sceneStrData = stream.nextBytes(this.featureTableJsonLength);\r\n const sceneStr = utf8ToString(sceneStrData);\r\n if (sceneStr)\r\n this.featureTableJson = JSON.parse(sceneStr);\r\n }\r\n\r\n stream.advance(this.featureTableBinaryLength);\r\n if (0 !== this.batchTableJsonLength) {\r\n const batchStrData = stream.nextBytes(this.batchTableJsonLength);\r\n const batchStr = utf8ToString(batchStrData);\r\n if (batchStr)\r\n this.batchTableJson = JSON.parse(batchStr);\r\n }\r\n\r\n stream.advance(this.batchTableBinaryLength);\r\n\r\n if (stream.isPastTheEnd)\r\n this.invalidate();\r\n }\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CompositeTileIO.js","sourceRoot":"","sources":["../../../src/tile/CompositeTileIO.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAGH,qCAAkD;AAElD;;GAEG;AACH,MAAa,mBAAoB,SAAQ,mBAAU;IACjC,MAAM,CAAS;IACf,SAAS,CAAS;IAClB,YAAY,CAAS;IAErC,IAAW,OAAO,KAAc,OAAO,mBAAU,CAAC,IAAI,KAAK,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;IAEzE,YAAmB,MAAkB;QACnC,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC;QAClC,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC;QACrC,IAAI,CAAC,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC;QAElC,IAAI,MAAM,CAAC,YAAY;YACrB,IAAI,CAAC,UAAU,EAAE,CAAC;IACtB,CAAC;CACF;AAhBD,kDAgBC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Tile\n */\n\nimport { ByteStream } from \"@itwin/core-bentley\";\nimport { TileFormat, TileHeader } from \"./TileIO\";\n\n/** Header preceding tile content in [composite](https://github.com/AnalyticalGraphicsInc/3d-tiles/tree/master/specification/TileFormats/Composite) format, containing any number of tiles in other standard 3D tile formats.\n * @internal\n */\nexport class CompositeTileHeader extends TileHeader {\n public readonly length: number;\n public readonly tileCount: number;\n public readonly tilePosition: number;\n\n public get isValid(): boolean { return TileFormat.Cmpt === this.format; }\n\n public constructor(stream: ByteStream) {\n super(stream);\n this.length = stream.readUint32();\n this.tileCount = stream.readUint32();\n this.tilePosition = stream.curPos;\n\n if (stream.isPastTheEnd)\n this.invalidate();\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"CompositeTileIO.js","sourceRoot":"","sources":["../../../src/tile/CompositeTileIO.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAGH,qCAAkD;AAElD;;GAEG;AACH,MAAa,mBAAoB,SAAQ,mBAAU;IACjC,MAAM,CAAS;IACf,SAAS,CAAS;IAClB,YAAY,CAAS;IAErC,IAAW,OAAO,KAAc,OAAO,mBAAU,CAAC,IAAI,KAAK,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;IAEzE,YAAmB,MAAkB;QACnC,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC;QAClC,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC;QACrC,IAAI,CAAC,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC;QAElC,IAAI,MAAM,CAAC,YAAY;YACrB,IAAI,CAAC,UAAU,EAAE,CAAC;IACtB,CAAC;CACF;AAhBD,kDAgBC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Tile\r\n */\r\n\r\nimport { ByteStream } from \"@itwin/core-bentley\";\r\nimport { TileFormat, TileHeader } from \"./TileIO\";\r\n\r\n/** Header preceding tile content in [composite](https://github.com/AnalyticalGraphicsInc/3d-tiles/tree/master/specification/TileFormats/Composite) format, containing any number of tiles in other standard 3D tile formats.\r\n * @internal\r\n */\r\nexport class CompositeTileHeader extends TileHeader {\r\n public readonly length: number;\r\n public readonly tileCount: number;\r\n public readonly tilePosition: number;\r\n\r\n public get isValid(): boolean { return TileFormat.Cmpt === this.format; }\r\n\r\n public constructor(stream: ByteStream) {\r\n super(stream);\r\n this.length = stream.readUint32();\r\n this.tileCount = stream.readUint32();\r\n this.tilePosition = stream.curPos;\r\n\r\n if (stream.isPastTheEnd)\r\n this.invalidate();\r\n }\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ElementGraphics.js","sourceRoot":"","sources":["../../../src/tile/ElementGraphics.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Tile\n */\n\nimport { Id64String } from \"@itwin/core-bentley\";\nimport { TransformProps } from \"@itwin/core-geometry\";\nimport { Placement2dProps, Placement3dProps } from \"../ElementProps\";\nimport { ElementGeometryDataEntry } from \"../geometry/ElementGeometry\";\nimport { GeometryStreamProps } from \"../geometry/GeometryStream\";\nimport { ContentFlags, TreeFlags } from \"../tile/TileMetadata\";\n\n/** Wire format describing properties common to [[PersistentGraphicsRequestProps]] and [[DynamicGraphicsRequestProps]].\n * @see [[ElementGraphicsRequestProps]] for more details.\n * @public\n * @extensions\n */\nexport interface GraphicsRequestProps {\n /** Uniquely identifies this request among all [[ElementGraphicsRequestProps]] for a given [[IModel]]. */\n readonly id: string;\n /** Log10 of the chord tolerance with which to stroke the element's geometry. e.g., for a chord tolerance of 0.01 (10^-2) meters, supply -2. */\n readonly toleranceLog10: number;\n /** The major version of the \"iMdl\" format to use when producing the iMdl representation of the element's geometry.\n * If omitted, the most recent version known to the backend will be used.\n * @alpha\n */\n readonly formatVersion?: number;\n /** Optional flags. [[TreeFlags.UseProjectExtents]] has no effect. [[TreeFlags.EnforceDisplayPriority]] is not yet implemented. @alpha */\n readonly treeFlags?: TreeFlags;\n /** Optional flags. [[ContentFlags.ImprovedElision]] has no effect. @alpha */\n readonly contentFlags?: ContentFlags;\n /** Transform from element graphics to world coordinates. Defaults to identity. */\n readonly location?: TransformProps;\n /** If true, surface edges will be omitted from the graphics. */\n readonly omitEdges?: boolean;\n /** If omitEdges is false, specifies the type of edges to produce. Generally determined by TileAdmin.requestElementGraphics.\n * @note This uses the deleted EdgeType enum where 1 indicates non-indexed edges and 2 indicates indexed edges, to avoid breaking the RPC API.\n * @internal\n */\n readonly edgeType?: 1 | 2;\n /** If true, and omitEdges is false, a polyface with no edge visibility info will display edges for all faces;\n * if false, edges will be inferred from the polyface's topology.\n * @internal\n */\n readonly smoothPolyfaceEdges?: boolean;\n /** If true, the element's graphics will be clipped against the iModel's project extents. */\n readonly clipToProjectExtents?: boolean;\n /** If defined, the compact string representation of a [ClipVector]($core-geometry) to be applied to the geometry to produce section-cut\n * geometry at the intersections with the clip planes. Any geometry *not* intersecting the clip planes is omitted from the tiles.\n * @see [ClipVector.toCompactString]($core-geometry) to produce the string representation.\n */\n readonly sectionCut?: string;\n /** If true, vertex positions will be quantized to [[QPoint3d]]s to conserve space; otherwise, vertex positions will use 32-bit float precision.\n * Quantization may produce perceptible inaccuracies when producing graphics for large and/or highly-detailed elements. It is not generally recommended.\n * Note that 32-bit precision is also susceptible to inaccuracies, to a lesser extent; see [[useAbsolutePositions]] to mitigate them.\n * Default: false.\n */\n quantizePositions?: boolean;\n /** Determines whether unquantized positions are specified in relative or absolute coordinates.\n * Coordinates very far from the origin can produce precision errors resulting in visual artifacts. If `useAbsolutePositions` is `false`, then\n * these precision errors are mitigated by applying a translation to the vertex positions to move them closer to the origin, and then applying the inverse\n * translation (using 64-bit precision) when drawing the graphics.\n * Using absolute positions is not generally recommended.\n * Default: false.\n * @note This property has no effect if [[quantizePositions]] is `true`.\n */\n useAbsolutePositions?: boolean;\n}\n\n/** Wire format describing a request to produce graphics in \"iMdl\" format for a single element.\n * @see [[ElementGraphicsRequestProps]] for more details.\n * @public\n * @extensions\n */\nexport interface PersistentGraphicsRequestProps extends GraphicsRequestProps {\n /** The element whose geometry is to be used to generate the graphics. */\n readonly elementId: Id64String;\n}\n\n/** As part of a [[DynamicGraphicsRequestProps]], specifies the geometry from which to generate the graphics in JSON format.\n * @public\n * @extensions\n */\nexport interface JsonGeometryStream {\n /** Discriminator for [[DynamicGraphicsRequestProps.geometry]]. */\n format: \"json\";\n /** The geometry stream in JSON format. */\n data: GeometryStreamProps;\n}\n\n/** As part of a [[DynamicGraphicsRequestProps]], specifies the geometry from which to generate the graphics in binary flatbuffer-encoded format.\n * @public\n * @extensions\n */\nexport interface FlatBufferGeometryStream {\n /** Discriminator for [[DynamicGraphicsRequestProps.geometry]]. */\n format: \"flatbuffer\";\n /** The geometry stream in flatbuffer format. */\n data: ElementGeometryDataEntry[];\n}\n\n/** Wire format describing a request to produce graphics in \"iMdl\" format for a single geometry stream.\n * @see [[DynamicGraphicsRequest2dProps]] and [[DynamicGraphicsRequest3dProps]].\n * @see [[ElementGraphicsRequestProps]] for more details.\n * @public\n * @extensions\n */\nexport interface DynamicGraphicsRequestProps extends GraphicsRequestProps {\n /** The geometry from which to generate the graphics. */\n readonly geometry: JsonGeometryStream | FlatBufferGeometryStream;\n /** The category to which the geometry belongs. This is required to identify a persistent [SpatialCategory]($backend) for 3d geometry or\n * [DrawingCategory]($backend) for 2d geometry.\n */\n readonly categoryId: Id64String;\n /** If specified, tools will recognize the generated graphics as being associated with this element. */\n readonly elementId?: Id64String;\n /** If specified, tools will recognize the generated graphics as being associated with this model.\n * It should identify a 3d model for 3d geometry or a 2d model for 2d geometry.\n * It needn't identify a persistent model - it can be a transient Id.\n */\n readonly modelId?: Id64String;\n}\n\n/** Wire format describing a request to produce graphics in \"iMdl\" format for a 2d geometry stream.\n * @see [[ElementGraphicsRequestProps]] for more details.\n * @public\n * @extensions\n */\nexport interface DynamicGraphicsRequest2dProps extends DynamicGraphicsRequestProps {\n /** Specifies the geometry is 2d. */\n readonly type: \"2d\";\n /** The origin and rotation of the geometry. */\n readonly placement: Omit<Placement2dProps, \"bbox\">;\n}\n\n/** Wire format describing a request to produce graphics in \"iMdl\" format for a 3d geometry stream.\n * @see [[ElementGraphicsRequestProps]] for more details.\n * @public\n * @extensions\n */\nexport interface DynamicGraphicsRequest3dProps extends DynamicGraphicsRequestProps {\n /** Specifies the geometry is 3d. */\n readonly type: \"3d\";\n /** The origin and rotation of the geometry. */\n readonly placement: Omit<Placement3dProps, \"bbox\">;\n}\n\n/** Wire format describing a request to produce graphics in \"iMdl\" format for a single element or geometry stream.\n * @note Every request must have an `id` that is unique amongst all extant requests for a given [[IModel]].\n * @see [TileAdmin.requestElementGraphics]($frontend) and [IModelDb.generateElementGraphics]($backend) to fulfill such a request.\n * @see [readElementGraphics]($frontend) to convert the result of a request to a [RenderGraphic]($frontend) for display.\n * @public\n * @extensions\n */\nexport type ElementGraphicsRequestProps = PersistentGraphicsRequestProps | DynamicGraphicsRequest2dProps | DynamicGraphicsRequest3dProps;\n"]}
|
|
1
|
+
{"version":3,"file":"ElementGraphics.js","sourceRoot":"","sources":["../../../src/tile/ElementGraphics.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Tile\r\n */\r\n\r\nimport { Id64String } from \"@itwin/core-bentley\";\r\nimport { TransformProps } from \"@itwin/core-geometry\";\r\nimport { Placement2dProps, Placement3dProps } from \"../ElementProps\";\r\nimport { ElementGeometryDataEntry } from \"../geometry/ElementGeometry\";\r\nimport { GeometryStreamProps } from \"../geometry/GeometryStream\";\r\nimport { ContentFlags, TreeFlags } from \"../tile/TileMetadata\";\r\n\r\n/** Wire format describing properties common to [[PersistentGraphicsRequestProps]] and [[DynamicGraphicsRequestProps]].\r\n * @see [[ElementGraphicsRequestProps]] for more details.\r\n * @public\r\n * @extensions\r\n */\r\nexport interface GraphicsRequestProps {\r\n /** Uniquely identifies this request among all [[ElementGraphicsRequestProps]] for a given [[IModel]]. */\r\n readonly id: string;\r\n /** Log10 of the chord tolerance with which to stroke the element's geometry. e.g., for a chord tolerance of 0.01 (10^-2) meters, supply -2. */\r\n readonly toleranceLog10: number;\r\n /** The major version of the \"iMdl\" format to use when producing the iMdl representation of the element's geometry.\r\n * If omitted, the most recent version known to the backend will be used.\r\n * @alpha\r\n */\r\n readonly formatVersion?: number;\r\n /** Optional flags. [[TreeFlags.UseProjectExtents]] has no effect. [[TreeFlags.EnforceDisplayPriority]] is not yet implemented. @alpha */\r\n readonly treeFlags?: TreeFlags;\r\n /** Optional flags. [[ContentFlags.ImprovedElision]] has no effect. @alpha */\r\n readonly contentFlags?: ContentFlags;\r\n /** Transform from element graphics to world coordinates. Defaults to identity. */\r\n readonly location?: TransformProps;\r\n /** If true, surface edges will be omitted from the graphics. */\r\n readonly omitEdges?: boolean;\r\n /** If omitEdges is false, specifies the type of edges to produce. Generally determined by TileAdmin.requestElementGraphics.\r\n * @note This uses the deleted EdgeType enum where 1 indicates non-indexed edges and 2 indicates indexed edges, to avoid breaking the RPC API.\r\n * @internal\r\n */\r\n readonly edgeType?: 1 | 2;\r\n /** If true, and omitEdges is false, a polyface with no edge visibility info will display edges for all faces;\r\n * if false, edges will be inferred from the polyface's topology.\r\n * @internal\r\n */\r\n readonly smoothPolyfaceEdges?: boolean;\r\n /** If true, the element's graphics will be clipped against the iModel's project extents. */\r\n readonly clipToProjectExtents?: boolean;\r\n /** If defined, the compact string representation of a [ClipVector]($core-geometry) to be applied to the geometry to produce section-cut\r\n * geometry at the intersections with the clip planes. Any geometry *not* intersecting the clip planes is omitted from the tiles.\r\n * @see [ClipVector.toCompactString]($core-geometry) to produce the string representation.\r\n */\r\n readonly sectionCut?: string;\r\n /** If true, vertex positions will be quantized to [[QPoint3d]]s to conserve space; otherwise, vertex positions will use 32-bit float precision.\r\n * Quantization may produce perceptible inaccuracies when producing graphics for large and/or highly-detailed elements. It is not generally recommended.\r\n * Note that 32-bit precision is also susceptible to inaccuracies, to a lesser extent; see [[useAbsolutePositions]] to mitigate them.\r\n * Default: false.\r\n */\r\n quantizePositions?: boolean;\r\n /** Determines whether unquantized positions are specified in relative or absolute coordinates.\r\n * Coordinates very far from the origin can produce precision errors resulting in visual artifacts. If `useAbsolutePositions` is `false`, then\r\n * these precision errors are mitigated by applying a translation to the vertex positions to move them closer to the origin, and then applying the inverse\r\n * translation (using 64-bit precision) when drawing the graphics.\r\n * Using absolute positions is not generally recommended.\r\n * Default: false.\r\n * @note This property has no effect if [[quantizePositions]] is `true`.\r\n */\r\n useAbsolutePositions?: boolean;\r\n}\r\n\r\n/** Wire format describing a request to produce graphics in \"iMdl\" format for a single element.\r\n * @see [[ElementGraphicsRequestProps]] for more details.\r\n * @public\r\n * @extensions\r\n */\r\nexport interface PersistentGraphicsRequestProps extends GraphicsRequestProps {\r\n /** The element whose geometry is to be used to generate the graphics. */\r\n readonly elementId: Id64String;\r\n}\r\n\r\n/** As part of a [[DynamicGraphicsRequestProps]], specifies the geometry from which to generate the graphics in JSON format.\r\n * @public\r\n * @extensions\r\n */\r\nexport interface JsonGeometryStream {\r\n /** Discriminator for [[DynamicGraphicsRequestProps.geometry]]. */\r\n format: \"json\";\r\n /** The geometry stream in JSON format. */\r\n data: GeometryStreamProps;\r\n}\r\n\r\n/** As part of a [[DynamicGraphicsRequestProps]], specifies the geometry from which to generate the graphics in binary flatbuffer-encoded format.\r\n * @public\r\n * @extensions\r\n */\r\nexport interface FlatBufferGeometryStream {\r\n /** Discriminator for [[DynamicGraphicsRequestProps.geometry]]. */\r\n format: \"flatbuffer\";\r\n /** The geometry stream in flatbuffer format. */\r\n data: ElementGeometryDataEntry[];\r\n}\r\n\r\n/** Wire format describing a request to produce graphics in \"iMdl\" format for a single geometry stream.\r\n * @see [[DynamicGraphicsRequest2dProps]] and [[DynamicGraphicsRequest3dProps]].\r\n * @see [[ElementGraphicsRequestProps]] for more details.\r\n * @public\r\n * @extensions\r\n */\r\nexport interface DynamicGraphicsRequestProps extends GraphicsRequestProps {\r\n /** The geometry from which to generate the graphics. */\r\n readonly geometry: JsonGeometryStream | FlatBufferGeometryStream;\r\n /** The category to which the geometry belongs. This is required to identify a persistent [SpatialCategory]($backend) for 3d geometry or\r\n * [DrawingCategory]($backend) for 2d geometry.\r\n */\r\n readonly categoryId: Id64String;\r\n /** If specified, tools will recognize the generated graphics as being associated with this element. */\r\n readonly elementId?: Id64String;\r\n /** If specified, tools will recognize the generated graphics as being associated with this model.\r\n * It should identify a 3d model for 3d geometry or a 2d model for 2d geometry.\r\n * It needn't identify a persistent model - it can be a transient Id.\r\n */\r\n readonly modelId?: Id64String;\r\n}\r\n\r\n/** Wire format describing a request to produce graphics in \"iMdl\" format for a 2d geometry stream.\r\n * @see [[ElementGraphicsRequestProps]] for more details.\r\n * @public\r\n * @extensions\r\n */\r\nexport interface DynamicGraphicsRequest2dProps extends DynamicGraphicsRequestProps {\r\n /** Specifies the geometry is 2d. */\r\n readonly type: \"2d\";\r\n /** The origin and rotation of the geometry. */\r\n readonly placement: Omit<Placement2dProps, \"bbox\">;\r\n}\r\n\r\n/** Wire format describing a request to produce graphics in \"iMdl\" format for a 3d geometry stream.\r\n * @see [[ElementGraphicsRequestProps]] for more details.\r\n * @public\r\n * @extensions\r\n */\r\nexport interface DynamicGraphicsRequest3dProps extends DynamicGraphicsRequestProps {\r\n /** Specifies the geometry is 3d. */\r\n readonly type: \"3d\";\r\n /** The origin and rotation of the geometry. */\r\n readonly placement: Omit<Placement3dProps, \"bbox\">;\r\n}\r\n\r\n/** Wire format describing a request to produce graphics in \"iMdl\" format for a single element or geometry stream.\r\n * @note Every request must have an `id` that is unique amongst all extant requests for a given [[IModel]].\r\n * @see [TileAdmin.requestElementGraphics]($frontend) and [IModelDb.generateElementGraphics]($backend) to fulfill such a request.\r\n * @see [readElementGraphics]($frontend) to convert the result of a request to a [RenderGraphic]($frontend) for display.\r\n * @public\r\n * @extensions\r\n */\r\nexport type ElementGraphicsRequestProps = PersistentGraphicsRequestProps | DynamicGraphicsRequest2dProps | DynamicGraphicsRequest3dProps;\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GltfTileIO.js","sourceRoot":"","sources":["../../../src/tile/GltfTileIO.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAyD;AACzD,qCAAkD;AAElD;;GAEG;AACH,IAAY,YAKX;AALD,WAAY,YAAY;IACtB,uDAAY,CAAA;IACZ,uDAAY,CAAA;IACZ,mEAAyB,CAAA;IACzB,uEAAoB,CAAA;AACtB,CAAC,EALW,YAAY,4BAAZ,YAAY,QAKvB;AAED,gBAAgB;AAChB,IAAY,gBAGX;AAHD,WAAY,gBAAgB;IAC1B,gEAAiB,CAAA;IACjB,iEAAmB,CAAA;AACrB,CAAC,EAHW,gBAAgB,gCAAhB,gBAAgB,QAG3B;AAmBD,SAAS,gBAAgB,CAAC,MAAkB;IAC1C,IAAI,MAAM,CAAC,UAAU;QACnB,OAAO,SAAS,CAAC;IAEnB,MAAM,MA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AClE,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;4BAClC,MAAM;oBACV,CAAC;gBACH,CAAC;gBAED,IAAI,KAAK,KAAK,KAAK,EAAE,CAAC;oBACpB,IAAI,CAAC,UAAU,EAAE,CAAC;oBAClB,OAAO;gBACT,CAAC;gBAED,IAAA,qBAAM,EAAC,SAAS,KAAK,KAAK,CAAC,CAAC;gBAC5B,IAAA,qBAAM,EAAC,MAAM,CAAC,UAAU,CAAC,CAAC;gBAC1B,MAAM;YACR;gBACE,IAAI,CAAC,UAAU,EAAE,CAAC;gBAClB,MAAM;QACV,CAAC;IACH,CAAC;CACF;AAjFD,8BAiFC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Tile\n */\n\nimport { assert, ByteStream } from \"@itwin/core-bentley\";\nimport { TileFormat, TileHeader } from \"./TileIO\";\n\n/** Known version of the [glTF format](https://www.khronos.org/gltf/).\n * @internal\n */\nexport enum GltfVersions {\n Version1 = 1,\n Version2 = 2,\n CurrentVersion = Version1,\n Gltf1SceneFormat = 0,\n}\n\n/** @internal */\nexport enum GltfV2ChunkTypes {\n JSON = 0x4E4F534a,\n Binary = 0x004E4942,\n}\n\n/** A chunk of a glb file.\n * @internal\n */\nexport interface GltfChunk {\n /** Offset of the first byte of the chunk's data relative to the beginning of the glb data.\n * This excludes the 8-byte chunk header containing the length and type fields.\n */\n offset: number;\n /** The number of bytes in the chunk's data. */\n length: number;\n}\n\n/** Describes a glTF chunk's data along with its type.\n * @internal\n */\nexport type TypedGltfChunk = GltfChunk & { type: number };\n\nfunction consumeNextChunk(stream: ByteStream): TypedGltfChunk | undefined | false {\n if (stream.isAtTheEnd)\n return undefined;\n\n const offset = stream.curPos + 8;\n\n const length = stream.readUint32();\n if (stream.isAtTheEnd)\n return undefined;\n\n const type = stream.readUint32();\n stream.advance(length);\n return stream.isPastTheEnd ? false : { offset, length, type };\n}\n\n/** @internal */\nexport class GlbHeader extends TileHeader {\n public readonly gltfLength: number = 0;\n public readonly jsonChunk: GltfChunk = { offset: 0, length: 0 };\n public readonly binaryChunk?: GltfChunk;\n public readonly additionalChunks: TypedGltfChunk[] = [];\n\n public get isValid(): boolean {\n return TileFormat.Gltf === this.format;\n }\n\n public constructor(stream: ByteStream) {\n super(stream);\n this.gltfLength = stream.readUint32();\n\n const jsonLength = stream.readUint32();\n const word5 = stream.readUint32();\n\n // Early versions of the reality data tile publisher incorrectly put version 2 into header - handle these old tiles\n // validating the chunk type.\n if (this.version === GltfVersions.Version2 && word5 === GltfVersions.Gltf1SceneFormat)\n this.version = GltfVersions.Version1;\n\n this.jsonChunk = { offset: stream.curPos, length: jsonLength };\n switch (this.version) {\n case GltfVersions.Version1:\n if (GltfVersions.Gltf1SceneFormat !== word5) {\n this.invalidate();\n return;\n }\n\n const binaryOffset = stream.curPos + jsonLength;\n this.binaryChunk = { offset: binaryOffset, length: this.gltfLength - binaryOffset };\n break;\n case GltfVersions.Version2:\n if (word5 !== GltfV2ChunkTypes.JSON) {\n this.invalidate();\n return;\n }\n\n stream.advance(jsonLength);\n if (stream.isPastTheEnd) {\n this.invalidate();\n return;\n }\n\n let chunk;\n while (chunk = consumeNextChunk(stream)) {\n switch (chunk.type) {\n case GltfV2ChunkTypes.JSON:\n // Only one JSON chunk permitted and it must be the first.\n this.invalidate();\n return;\n case GltfV2ChunkTypes.Binary:\n // At most one binary chunk permitted and it must be the second if present.\n if (this.binaryChunk || this.additionalChunks.length) {\n this.invalidate();\n return;\n }\n\n this.binaryChunk = { offset: chunk.offset, length: chunk.length };\n break;\n default:\n // Any other chunk type should be ignored - for use by extensions.\n this.additionalChunks.push(chunk);\n break;\n }\n }\n\n if (false === chunk) {\n this.invalidate();\n return;\n }\n\n assert(undefined === chunk);\n assert(stream.isAtTheEnd);\n break;\n default:\n this.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oBAClB,OAAO;gBACT,CAAC;gBAED,IAAI,KAAK,CAAC;gBACV,OAAO,KAAK,GAAG,gBAAgB,CAAC,MAAM,CAAC,EAAE,CAAC;oBACxC,QAAQ,KAAK,CAAC,IAAI,EAAE,CAAC;wBACnB,KAAK,gBAAgB,CAAC,IAAI;4BACxB,0DAA0D;4BAC1D,IAAI,CAAC,UAAU,EAAE,CAAC;4BAClB,OAAO;wBACT,KAAK,gBAAgB,CAAC,MAAM;4BAC1B,2EAA2E;4BAC3E,IAAI,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,gBAAgB,CAAC,MAAM,EAAE,CAAC;gCACrD,IAAI,CAAC,UAAU,EAAE,CAAC;gCAClB,OAAO;4BACT,CAAC;4BAED,IAAI,CAAC,WAAW,GAAG,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC;4BAClE,MAAM;wBACR;4BACE,kEAAkE;4BAClE,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;4BAClC,MAAM;oBACV,CAAC;gBACH,CAAC;gBAED,IAAI,KAAK,KAAK,KAAK,EAAE,CAAC;oBACpB,IAAI,CAAC,UAAU,EAAE,CAAC;oBAClB,OAAO;gBACT,CAAC;gBAED,IAAA,qBAAM,EAAC,SAAS,KAAK,KAAK,CAAC,CAAC;gBAC5B,IAAA,qBAAM,EAAC,MAAM,CAAC,UAAU,CAAC,CAAC;gBAC1B,MAAM;YACR;gBACE,IAAI,CAAC,UAAU,EAAE,CAAC;gBAClB,MAAM;QACV,CAAC;IACH,CAAC;CACF;AAjFD,8BAiFC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Tile\r\n */\r\n\r\nimport { assert, ByteStream } from \"@itwin/core-bentley\";\r\nimport { TileFormat, TileHeader } from \"./TileIO\";\r\n\r\n/** Known version of the [glTF format](https://www.khronos.org/gltf/).\r\n * @internal\r\n */\r\nexport enum GltfVersions {\r\n Version1 = 1,\r\n Version2 = 2,\r\n CurrentVersion = Version1,\r\n Gltf1SceneFormat = 0,\r\n}\r\n\r\n/** @internal */\r\nexport enum GltfV2ChunkTypes {\r\n JSON = 0x4E4F534a,\r\n Binary = 0x004E4942,\r\n}\r\n\r\n/** A chunk of a glb file.\r\n * @internal\r\n */\r\nexport interface GltfChunk {\r\n /** Offset of the first byte of the chunk's data relative to the beginning of the glb data.\r\n * This excludes the 8-byte chunk header containing the length and type fields.\r\n */\r\n offset: number;\r\n /** The number of bytes in the chunk's data. */\r\n length: number;\r\n}\r\n\r\n/** Describes a glTF chunk's data along with its type.\r\n * @internal\r\n */\r\nexport type TypedGltfChunk = GltfChunk & { type: number };\r\n\r\nfunction consumeNextChunk(stream: ByteStream): TypedGltfChunk | undefined | false {\r\n if (stream.isAtTheEnd)\r\n return undefined;\r\n\r\n const offset = stream.curPos + 8;\r\n\r\n const length = stream.readUint32();\r\n if (stream.isAtTheEnd)\r\n return undefined;\r\n\r\n const type = stream.readUint32();\r\n stream.advance(length);\r\n return stream.isPastTheEnd ? false : { offset, length, type };\r\n}\r\n\r\n/** @internal */\r\nexport class GlbHeader extends TileHeader {\r\n public readonly gltfLength: number = 0;\r\n public readonly jsonChunk: GltfChunk = { offset: 0, length: 0 };\r\n public readonly binaryChunk?: GltfChunk;\r\n public readonly additionalChunks: TypedGltfChunk[] = [];\r\n\r\n public get isValid(): boolean {\r\n return TileFormat.Gltf === this.format;\r\n }\r\n\r\n public constructor(stream: ByteStream) {\r\n super(stream);\r\n this.gltfLength = stream.readUint32();\r\n\r\n const jsonLength = stream.readUint32();\r\n const word5 = stream.readUint32();\r\n\r\n // Early versions of the reality data tile publisher incorrectly put version 2 into header - handle these old tiles\r\n // validating the chunk type.\r\n if (this.version === GltfVersions.Version2 && word5 === GltfVersions.Gltf1SceneFormat)\r\n this.version = GltfVersions.Version1;\r\n\r\n this.jsonChunk = { offset: stream.curPos, length: jsonLength };\r\n switch (this.version) {\r\n case GltfVersions.Version1:\r\n if (GltfVersions.Gltf1SceneFormat !== word5) {\r\n this.invalidate();\r\n return;\r\n }\r\n\r\n const binaryOffset = stream.curPos + jsonLength;\r\n this.binaryChunk = { offset: binaryOffset, length: this.gltfLength - binaryOffset };\r\n break;\r\n case GltfVersions.Version2:\r\n if (word5 !== GltfV2ChunkTypes.JSON) {\r\n this.invalidate();\r\n return;\r\n }\r\n\r\n stream.advance(jsonLength);\r\n if (stream.isPastTheEnd) {\r\n this.invalidate();\r\n return;\r\n }\r\n\r\n let chunk;\r\n while (chunk = consumeNextChunk(stream)) {\r\n switch (chunk.type) {\r\n case GltfV2ChunkTypes.JSON:\r\n // Only one JSON chunk permitted and it must be the first.\r\n this.invalidate();\r\n return;\r\n case GltfV2ChunkTypes.Binary:\r\n // At most one binary chunk permitted and it must be the second if present.\r\n if (this.binaryChunk || this.additionalChunks.length) {\r\n this.invalidate();\r\n return;\r\n }\r\n\r\n this.binaryChunk = { offset: chunk.offset, length: chunk.length };\r\n break;\r\n default:\r\n // Any other chunk type should be ignored - for use by extensions.\r\n this.additionalChunks.push(chunk);\r\n break;\r\n }\r\n }\r\n\r\n if (false === chunk) {\r\n this.invalidate();\r\n return;\r\n }\r\n\r\n assert(undefined === chunk);\r\n assert(stream.isAtTheEnd);\r\n break;\r\n default:\r\n this.invalidate();\r\n break;\r\n }\r\n }\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"I3dmTileIO.js","sourceRoot":"","sources":["../../../src/tile/I3dmTileIO.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA+D;AAC/D,qCAAkD;AAElD;;GAEG;AACH,MAAa,UAAW,SAAQ,mBAAU;IACxB,MAAM,CAAS;IACf,wBAAwB,CAAS;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AAI,CAAC,UAAU,EAAE,CAAC;IACtB,CAAC;CACF;AAjCD,gCAiCC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Tile\n */\n\nimport { ByteStream, utf8ToString } from \"@itwin/core-bentley\";\nimport { TileFormat, TileHeader } from \"./TileIO\";\n\n/** Header preceding tile content in [i3dm](https://github.com/AnalyticalGraphicsInc/3d-tiles/tree/master/specification/TileFormats/Instanced3DModel) format.\n * @internal\n */\nexport class I3dmHeader extends TileHeader {\n public readonly length: number;\n public readonly featureTableJsonPosition: number;\n public readonly featureTableJsonLength: number;\n public readonly featureTableBinaryLength: number;\n public readonly batchTableJsonLength: number;\n public readonly batchTableBinaryLength: number;\n public readonly gltfVersion: number;\n public readonly batchTableJson: any;\n public get isValid(): boolean { return TileFormat.I3dm === this.format; }\n\n public constructor(stream: ByteStream) {\n super(stream);\n this.length = stream.readUint32();\n this.featureTableJsonLength = stream.readUint32();\n this.featureTableBinaryLength = stream.readUint32();\n this.batchTableJsonLength = stream.readUint32();\n this.batchTableBinaryLength = stream.readUint32();\n this.gltfVersion = stream.readUint32();\n this.featureTableJsonPosition = stream.curPos;\n stream.advance(this.featureTableJsonLength);\n stream.advance(this.featureTableBinaryLength);\n if (0 !== this.batchTableJsonLength) {\n const batchStrData = stream.nextBytes(this.batchTableJsonLength);\n const batchStr = utf8ToString(batchStrData);\n if (batchStr)\n this.batchTableJson = JSON.parse(batchStr);\n }\n stream.advance(this.batchTableBinaryLength);\n\n if (stream.isPastTheEnd)\n this.invalidate();\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"I3dmTileIO.js","sourceRoot":"","sources":["../../../src/tile/I3dmTileIO.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA+D;AAC/D,qCAAkD;AAElD;;GAEG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AAI,CAAC,sBAAsB,CAAC,CAAC;QAE5C,IAAI,MAAM,CAAC,YAAY;YACrB,IAAI,CAAC,UAAU,EAAE,CAAC;IACtB,CAAC;CACF;AAjCD,gCAiCC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Tile\r\n */\r\n\r\nimport { ByteStream, utf8ToString } from \"@itwin/core-bentley\";\r\nimport { TileFormat, TileHeader } from \"./TileIO\";\r\n\r\n/** Header preceding tile content in [i3dm](https://github.com/AnalyticalGraphicsInc/3d-tiles/tree/master/specification/TileFormats/Instanced3DModel) format.\r\n * @internal\r\n */\r\nexport class I3dmHeader extends TileHeader {\r\n public readonly length: number;\r\n public readonly featureTableJsonPosition: number;\r\n public readonly featureTableJsonLength: number;\r\n public readonly featureTableBinaryLength: number;\r\n public readonly batchTableJsonLength: number;\r\n public readonly batchTableBinaryLength: number;\r\n public readonly gltfVersion: number;\r\n public readonly batchTableJson: any;\r\n public get isValid(): boolean { return TileFormat.I3dm === this.format; }\r\n\r\n public constructor(stream: ByteStream) {\r\n super(stream);\r\n this.length = stream.readUint32();\r\n this.featureTableJsonLength = stream.readUint32();\r\n this.featureTableBinaryLength = stream.readUint32();\r\n this.batchTableJsonLength = stream.readUint32();\r\n this.batchTableBinaryLength = stream.readUint32();\r\n this.gltfVersion = stream.readUint32();\r\n this.featureTableJsonPosition = stream.curPos;\r\n stream.advance(this.featureTableJsonLength);\r\n stream.advance(this.featureTableBinaryLength);\r\n if (0 !== this.batchTableJsonLength) {\r\n const batchStrData = stream.nextBytes(this.batchTableJsonLength);\r\n const batchStr = utf8ToString(batchStrData);\r\n if (batchStr)\r\n this.batchTableJson = JSON.parse(batchStr);\r\n }\r\n stream.advance(this.batchTableBinaryLength);\r\n\r\n if (stream.isPastTheEnd)\r\n this.invalidate();\r\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AAED;;GAEG;AACH,MAAa,kBAAkB;IAC7B,iDAAiD;IACjC,MAAM,CAAS;IAC/B,4CAA4C;IAC5C,wIAAwI;IACxH,gBAAgB,CAAS;IACzC,uCAAuC;IACvB,KAAK,CAAS;IAEvB,MAAM,CAAC,QAAQ,CAAC,MAAkB;QACvC,MAAM,MAAM,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC;QACnC,MAAM,WAAW,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC;QACxC,MAAM,KAAK,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC;QAClC,OAAO,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,kBAAkB,CAAC,MAAM,EAAE,WAAW,EAAE,KAAK,CAAC,CAAC;IAC9F,CAAC;IAEM,MAAM,CAAC,WAAW,GAAG,EAAE,CAAC;IAE/B,YAAoB,MAAc,EAAE,gBAAwB,EAAE,KAAa;QACzE,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;QACzC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;;AAtBH,gDAuBC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Tile\n */\n\nimport { assert, ByteStream } from \"@itwin/core-bentley\";\nimport { Range3d } from \"@itwin/core-geometry\";\nimport { ElementAlignedBox3d } from \"../geometry/Placement\";\nimport { nextPoint3d64FromByteStream, TileFormat, TileHeader } from \"./TileIO\";\n\n/** Flags describing the geometry contained within a tile in iMdl format.\n * @internal\n */\nexport enum ImdlFlags {\n /** No special flags */\n None = 0,\n /** The tile contains some curved geometry */\n ContainsCurves = 1 << 0,\n /** Some geometry within the tile range was omitted based on its size */\n Incomplete = 1 << 2,\n /** The tile must be refined by sub-division, not magnification. */\n DisallowMagnification = 1 << 3,\n /** The tile's feature table contains features from multiple models. */\n MultiModelFeatureTable = 1 << 4,\n}\n\n/** Describes the maximum major and minor version of the iMdl tile format supported by this version of this package.\n * @internal\n */\nexport enum CurrentImdlVersion {\n /** The unsigned 16-bit major version number. If the major version specified in the tile header is greater than this value, then this\n * front-end is not capable of reading the tile content. Otherwise, this front-end can read the tile content even if the header specifies a\n * greater minor version than CurrentVersion.Minor, although some data may be skipped.\n */\n Major = 37,\n /** The unsigned 16-bit minor version number. If the major version in the tile header is equal to CurrentVersion.Major, then this package can\n * read the tile content even if the minor version in the tile header is greater than this value, although some data may be skipped.\n */\n Minor = 0,\n /** The unsigned 32-bit version number derived from the 16-bit major and minor version numbers. */\n Combined = (Major << 0x10) | Minor,\n}\n\n/** Header embedded at the beginning of binary tile data in iMdl format describing its contents.\n * @internal\n */\nexport class ImdlHeader extends TileHeader {\n /** The size of this header in bytes. */\n public readonly headerLength: number;\n /** Flags describing the geometry contained within the tile */\n public readonly flags: ImdlFlags;\n /** A bounding box no larger than the tile's range, tightly enclosing the tile's geometry; or a null range if the tile is empty */\n public readonly contentRange: ElementAlignedBox3d;\n /** The chord tolerance in meters at which the tile's geometry was faceted */\n public readonly tolerance: number;\n /** The number of elements which contributed at least some geometry to the tile content */\n public readonly numElementsIncluded: number;\n /** The number of elements within the tile range which contributed no geometry to the tile content */\n public readonly numElementsExcluded: number;\n /** The total number of bytes in the binary tile data, including this header */\n public readonly tileLength: number;\n /** A bitfield wherein each set bit indicates an empty sub-volume. */\n public readonly emptySubRanges: number;\n\n public get versionMajor(): number { return this.version >>> 0x10; }\n public get versionMinor(): number { return (this.version & 0xffff) >>> 0; }\n\n public get isValid(): boolean { return TileFormat.IModel === this.format; }\n public get isReadableVersion(): boolean { return this.versionMajor <= CurrentImdlVersion.Major; }\n\n /** Deserialize a header from the binary data at the stream's current position.\n * If the binary data does not contain a valid header, the Header will be marked 'invalid'.\n */\n public constructor(stream: ByteStream) {\n super(stream);\n this.headerLength = stream.readUint32();\n this.flags = stream.readUint32();\n\n this.contentRange = new Range3d();\n nextPoint3d64FromByteStream(stream, this.contentRange.low);\n nextPoint3d64FromByteStream(stream, this.contentRange.high);\n\n this.tolerance = stream.readFloat64();\n this.numElementsIncluded = stream.readUint32();\n this.numElementsExcluded = stream.readUint32();\n this.tileLength = stream.readUint32();\n\n // empty sub-volume bit field introduced in format v02.00\n this.emptySubRanges = this.versionMajor >= 2 ? stream.readUint32() : 0;\n\n // Skip any unprocessed bytes in header\n const remainingHeaderBytes = this.headerLength - stream.curPos;\n assert(remainingHeaderBytes >= 0);\n stream.advance(remainingHeaderBytes);\n\n if (stream.isPastTheEnd)\n this.invalidate();\n }\n}\n\n/** Header preceding the feature table embedded in an iMdl tile's content.\n * @internal\n */\nexport class FeatureTableHeader {\n // The number of bytes the entire table occupies.\n public readonly length: number;\n // The number of subcategories in the table.\n // NOTE: This used to be \"max features\" which was useless and unused. It is only accurate if ImdlFlags.HasMultiModelFeatureTable is set.\n public readonly numSubCategories: number;\n // The number of features in the table.\n public readonly count: number;\n\n public static readFrom(stream: ByteStream) {\n const length = stream.readUint32();\n const maxFeatures = stream.readUint32();\n const count = stream.readUint32();\n return stream.isPastTheEnd ? undefined : new FeatureTableHeader(length, maxFeatures, count);\n }\n\n public static sizeInBytes = 12;\n\n private constructor(length: number, numSubCategories: number, count: number) {\n this.length = length;\n this.numSubCategories = numSubCategories;\n this.count = count;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"IModelTileIO.js","sourceRoot":"","sources":["../../../src/tile/IModelTileIO.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAyD;AACzD,wDAA+C;AAE/C,qCAA+E;AAE/E;;GAEG;AACH,IAAY,SAWX;AAXD,WAAY,SAAS;IACnB,uBAAuB;IACvB,yCAAQ,CAAA;IACR,6CAA6C;IAC7C,6DAAuB,CAAA;IACvB,wEAAwE;IACxE,qDA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;QAClC,OAAO,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,kBAAkB,CAAC,MAAM,EAAE,WAAW,EAAE,KAAK,CAAC,CAAC;IAC9F,CAAC;IAEM,MAAM,CAAC,WAAW,GAAG,EAAE,CAAC;IAE/B,YAAoB,MAAc,EAAE,gBAAwB,EAAE,KAAa;QACzE,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;QACzC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;;AAtBH,gDAuBC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Tile\r\n */\r\n\r\nimport { assert, ByteStream } from \"@itwin/core-bentley\";\r\nimport { Range3d } from \"@itwin/core-geometry\";\r\nimport { ElementAlignedBox3d } from \"../geometry/Placement\";\r\nimport { nextPoint3d64FromByteStream, TileFormat, TileHeader } from \"./TileIO\";\r\n\r\n/** Flags describing the geometry contained within a tile in iMdl format.\r\n * @internal\r\n */\r\nexport enum ImdlFlags {\r\n /** No special flags */\r\n None = 0,\r\n /** The tile contains some curved geometry */\r\n ContainsCurves = 1 << 0,\r\n /** Some geometry within the tile range was omitted based on its size */\r\n Incomplete = 1 << 2,\r\n /** The tile must be refined by sub-division, not magnification. */\r\n DisallowMagnification = 1 << 3,\r\n /** The tile's feature table contains features from multiple models. */\r\n MultiModelFeatureTable = 1 << 4,\r\n}\r\n\r\n/** Describes the maximum major and minor version of the iMdl tile format supported by this version of this package.\r\n * @internal\r\n */\r\nexport enum CurrentImdlVersion {\r\n /** The unsigned 16-bit major version number. If the major version specified in the tile header is greater than this value, then this\r\n * front-end is not capable of reading the tile content. Otherwise, this front-end can read the tile content even if the header specifies a\r\n * greater minor version than CurrentVersion.Minor, although some data may be skipped.\r\n */\r\n Major = 37,\r\n /** The unsigned 16-bit minor version number. If the major version in the tile header is equal to CurrentVersion.Major, then this package can\r\n * read the tile content even if the minor version in the tile header is greater than this value, although some data may be skipped.\r\n */\r\n Minor = 0,\r\n /** The unsigned 32-bit version number derived from the 16-bit major and minor version numbers. */\r\n Combined = (Major << 0x10) | Minor,\r\n}\r\n\r\n/** Header embedded at the beginning of binary tile data in iMdl format describing its contents.\r\n * @internal\r\n */\r\nexport class ImdlHeader extends TileHeader {\r\n /** The size of this header in bytes. */\r\n public readonly headerLength: number;\r\n /** Flags describing the geometry contained within the tile */\r\n public readonly flags: ImdlFlags;\r\n /** A bounding box no larger than the tile's range, tightly enclosing the tile's geometry; or a null range if the tile is empty */\r\n public readonly contentRange: ElementAlignedBox3d;\r\n /** The chord tolerance in meters at which the tile's geometry was faceted */\r\n public readonly tolerance: number;\r\n /** The number of elements which contributed at least some geometry to the tile content */\r\n public readonly numElementsIncluded: number;\r\n /** The number of elements within the tile range which contributed no geometry to the tile content */\r\n public readonly numElementsExcluded: number;\r\n /** The total number of bytes in the binary tile data, including this header */\r\n public readonly tileLength: number;\r\n /** A bitfield wherein each set bit indicates an empty sub-volume. */\r\n public readonly emptySubRanges: number;\r\n\r\n public get versionMajor(): number { return this.version >>> 0x10; }\r\n public get versionMinor(): number { return (this.version & 0xffff) >>> 0; }\r\n\r\n public get isValid(): boolean { return TileFormat.IModel === this.format; }\r\n public get isReadableVersion(): boolean { return this.versionMajor <= CurrentImdlVersion.Major; }\r\n\r\n /** Deserialize a header from the binary data at the stream's current position.\r\n * If the binary data does not contain a valid header, the Header will be marked 'invalid'.\r\n */\r\n public constructor(stream: ByteStream) {\r\n super(stream);\r\n this.headerLength = stream.readUint32();\r\n this.flags = stream.readUint32();\r\n\r\n this.contentRange = new Range3d();\r\n nextPoint3d64FromByteStream(stream, this.contentRange.low);\r\n nextPoint3d64FromByteStream(stream, this.contentRange.high);\r\n\r\n this.tolerance = stream.readFloat64();\r\n this.numElementsIncluded = stream.readUint32();\r\n this.numElementsExcluded = stream.readUint32();\r\n this.tileLength = stream.readUint32();\r\n\r\n // empty sub-volume bit field introduced in format v02.00\r\n this.emptySubRanges = this.versionMajor >= 2 ? stream.readUint32() : 0;\r\n\r\n // Skip any unprocessed bytes in header\r\n const remainingHeaderBytes = this.headerLength - stream.curPos;\r\n assert(remainingHeaderBytes >= 0);\r\n stream.advance(remainingHeaderBytes);\r\n\r\n if (stream.isPastTheEnd)\r\n this.invalidate();\r\n }\r\n}\r\n\r\n/** Header preceding the feature table embedded in an iMdl tile's content.\r\n * @internal\r\n */\r\nexport class FeatureTableHeader {\r\n // The number of bytes the entire table occupies.\r\n public readonly length: number;\r\n // The number of subcategories in the table.\r\n // NOTE: This used to be \"max features\" which was useless and unused. It is only accurate if ImdlFlags.HasMultiModelFeatureTable is set.\r\n public readonly numSubCategories: number;\r\n // The number of features in the table.\r\n public readonly count: number;\r\n\r\n public static readFrom(stream: ByteStream) {\r\n const length = stream.readUint32();\r\n const maxFeatures = stream.readUint32();\r\n const count = stream.readUint32();\r\n return stream.isPastTheEnd ? undefined : new FeatureTableHeader(length, maxFeatures, count);\r\n }\r\n\r\n public static sizeInBytes = 12;\r\n\r\n private constructor(length: number, numSubCategories: number, count: number) {\r\n this.length = length;\r\n this.numSubCategories = numSubCategories;\r\n this.count = count;\r\n }\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PntsTileIO.js","sourceRoot":"","sources":["../../../src/tile/PntsTileIO.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAGH,qCAAkD;AAElD;;GAEG;AACH,MAAa,UAAW,SAAQ,mBAAU;IACxB,MAAM,CAAS;IACf,sBAAsB,CAAS;IAC/B,wBAAwB,CAAS;IACjC,oBAAoB,CAAS;IAC7B,sBAAsB,CAAS;IAC/C,IAAW,OAAO,KAAc,OAAO,mBAAU,CAAC,IAAI,KAAK,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;IAEzE,YAAmB,MAAkB;QACnC,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC;QAClC,IAAI,CAAC,sBAAsB,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC;QAClD,IAAI,CAAC,wBAAwB,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC;QACpD,IAAI,CAAC,oBAAoB,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC;QAChD,IAAI,CAAC,sBAAsB,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC;IACpD,CAAC;CACF;AAhBD,gCAgBC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Tile\n */\n\nimport { ByteStream } from \"@itwin/core-bentley\";\nimport { TileFormat, TileHeader } from \"./TileIO\";\n\n/** Header preceding tile content in [pnts](https://github.com/AnalyticalGraphicsInc/3d-tiles/tree/master/specification/TileFormats/PointCloud) format.\n * @internal\n */\nexport class PntsHeader extends TileHeader {\n public readonly length: number;\n public readonly featureTableJsonLength: number;\n public readonly featureTableBinaryLength: number;\n public readonly batchTableJsonLength: number;\n public readonly batchTableBinaryLength: number;\n public get isValid(): boolean { return TileFormat.Pnts === this.format; }\n\n public constructor(stream: ByteStream) {\n super(stream);\n this.length = stream.readUint32();\n this.featureTableJsonLength = stream.readUint32();\n this.featureTableBinaryLength = stream.readUint32();\n this.batchTableJsonLength = stream.readUint32();\n this.batchTableBinaryLength = stream.readUint32();\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"PntsTileIO.js","sourceRoot":"","sources":["../../../src/tile/PntsTileIO.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAGH,qCAAkD;AAElD;;GAEG;AACH,MAAa,UAAW,SAAQ,mBAAU;IACxB,MAAM,CAAS;IACf,sBAAsB,CAAS;IAC/B,wBAAwB,CAAS;IACjC,oBAAoB,CAAS;IAC7B,sBAAsB,CAAS;IAC/C,IAAW,OAAO,KAAc,OAAO,mBAAU,CAAC,IAAI,KAAK,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;IAEzE,YAAmB,MAAkB;QACnC,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC;QAClC,IAAI,CAAC,sBAAsB,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC;QAClD,IAAI,CAAC,wBAAwB,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC;QACpD,IAAI,CAAC,oBAAoB,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC;QAChD,IAAI,CAAC,sBAAsB,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC;IACpD,CAAC;CACF;AAhBD,gCAgBC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Tile\r\n */\r\n\r\nimport { ByteStream } from \"@itwin/core-bentley\";\r\nimport { TileFormat, TileHeader } from \"./TileIO\";\r\n\r\n/** Header preceding tile content in [pnts](https://github.com/AnalyticalGraphicsInc/3d-tiles/tree/master/specification/TileFormats/PointCloud) format.\r\n * @internal\r\n */\r\nexport class PntsHeader extends TileHeader {\r\n public readonly length: number;\r\n public readonly featureTableJsonLength: number;\r\n public readonly featureTableBinaryLength: number;\r\n public readonly batchTableJsonLength: number;\r\n public readonly batchTableBinaryLength: number;\r\n public get isValid(): boolean { return TileFormat.Pnts === this.format; }\r\n\r\n public constructor(stream: ByteStream) {\r\n super(stream);\r\n this.length = stream.readUint32();\r\n this.featureTableJsonLength = stream.readUint32();\r\n this.featureTableBinaryLength = stream.readUint32();\r\n this.batchTableJsonLength = stream.readUint32();\r\n this.batchTableBinaryLength = stream.readUint32();\r\n }\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TileIO.js","sourceRoot":"","sources":["../../../src/tile/TileIO.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAsBH,8CAcC;AAKD,oDAGC;AAsED,kEAUC;AA1HD,sDAA+D;AAC/D,wDAA+C;AAE/C;;GAEG;AACH,IAAY,UASX;AATD,WAAY,UAAU;IACpB,iDAAW,CAAA;IACX,oDAAiB,CAAA;IACjB,oDAAiB,CAAA;IACjB,oDAAiB,CAAA;IACjB,wDAAmB,CAAA;IACnB,oDAAiB,CAAA;IACjB,oDAAiB,CAAA;IACjB,+CAAc,CAAA;AAChB,CAAC,EATW,UAAU,0BAAV,UAAU,QASrB;AAED;;GAEG;AACH,SAAgB,iBAAiB,CAAC,MAAc;IAC9C,QAAQ,MAAM,EAAE,CAAC;QACf,KAAK,UAAU,CAAC,OAAO,CAAC;QACxB,KAAK,UAAU,CAAC,IAAI,CAAC;QACrB,KAAK,UAAU,CAAC,IAAI,CAAC;QACrB,KAAK,UAAU,CAAC,MAAM,CAAC;QACvB,KAAK,UAAU,CAAC,IAAI,CAAC;QACrB,KAAK,UAAU,CAAC,IAAI,CAAC;QACrB,KAAK,UAAU,CAAC,IAAI,CAAC;QACrB,KAAK,UAAU,CAAC,GAAG;YACjB,OAAO,IAAI,CAAC;QACd;YACE,OAAO,KAAK,CAAC;IACjB,CAAC;AACH,CAAC;AAED;;GAEG;AACH,SAAgB,oBAAoB,CAAC,YAAoB;IACvD,MAAM,MAAM,GAAG,YAA0B,CAAC;IAC1C,OAAO,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,OAAO,CAAC;AACjE,CAAC;AAED;;GAEG;AACH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WAAW,EAAE,EAC5B,CAAC,GAAG,MAAM,CAAC,WAAW,EAAE,EACxB,CAAC,GAAG,MAAM,CAAC,WAAW,EAAE,CAAC;IAE3B,IAAI,SAAS,KAAK,MAAM;QACtB,OAAO,IAAI,uBAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IAE9B,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IACpB,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Tile\n */\n\nimport { BentleyError, ByteStream } from \"@itwin/core-bentley\";\nimport { Point3d } from \"@itwin/core-geometry\";\n\n/** Type codes for various tile formats. Often these are embedded as 32-bit 'magic numbers' in a binary stream to indicate the format.\n * @internal\n */\nexport enum TileFormat {\n Unknown = 0,\n B3dm = 0x6d643362, // \"b3dm\"\n Gltf = 0x46546c67, // \"glTF\"\n Pnts = 0x73746e70, // \"pnts\"\n IModel = 0x6c644d69, // \"iMdl\"\n Cmpt = 0x74706d63, // cmpt\n I3dm = 0x6d643369, // i3dm\n A3x = 0x583341, // A3X0 (numeric 0 not char '0')\n}\n\n/** Given a magic number, return whether it identifies a known tile format.\n * @internal\n */\nexport function isKnownTileFormat(format: number) {\n switch (format) {\n case TileFormat.Unknown:\n case TileFormat.B3dm:\n case TileFormat.Gltf:\n case TileFormat.IModel:\n case TileFormat.Pnts:\n case TileFormat.Cmpt:\n case TileFormat.I3dm:\n case TileFormat.A3x:\n return true;\n default:\n return false;\n }\n}\n\n/** Given a magic number, attempt to convert it to a known TileFormat.\n * @internal\n */\nexport function tileFormatFromNumber(formatNumber: number): TileFormat {\n const format = formatNumber as TileFormat;\n return isKnownTileFormat(format) ? format : TileFormat.Unknown;\n}\n\n/** Status codes for tile reading operations\n * @internal\n */\nexport enum TileReadStatus {\n Success = 0,\n InvalidTileData,\n InvalidHeader,\n InvalidBatchTable,\n InvalidScene,\n InvalidFeatureTable,\n NewerMajorVersion,\n Canceled,\n}\n\nconst readStatusMessages = [\n \"Success\",\n \"Invalid tile data\",\n \"Invalid tile header\",\n \"Invalid batch table\",\n \"Invalid scene\",\n \"Invalid feature table\",\n \"Major version too new\",\n \"Canceled\",\n];\n\n/** Exception thrown by functions that deserialize tiles.\n * @internal\n */\nexport class TileReadError extends BentleyError {\n public constructor(status: TileReadStatus, message?: string) {\n if (undefined === message)\n message = readStatusMessages[status];\n\n super(status, message);\n }\n\n public get wasCanceled(): boolean { return TileReadStatus.Canceled === this.errorNumber; }\n}\n\n/** The base header preceding tile data of most formats, identifying the tile format and version of that format.\n * Specific tile formats may define their own headers as sub-types of this Header, appending\n * additional format-specific data.\n * @internal\n */\nexport abstract class TileHeader {\n private _format: TileFormat;\n public version: number;\n\n /** Construct a Header from the binary data at the supplied stream's current read position */\n public constructor(stream: ByteStream) {\n this._format = tileFormatFromNumber(stream.readUint32());\n this.version = stream.readUint32();\n }\n\n public get format(): TileFormat { return this._format; }\n\n /** Returns whether the header represents valid data */\n public abstract get isValid(): boolean;\n\n /** Mark the header as representing invalid data */\n protected invalidate(): void {\n this._format = TileFormat.Unknown;\n }\n}\n\n/** Read 3 64-bit floating point numbers at the byte stream's current read position, advance by 24 bytes, and return a Point3d constructed from the 3 numbers.\n * @internal\n */\nexport function nextPoint3d64FromByteStream(stream: ByteStream, result?: Point3d): Point3d {\n const x = stream.readFloat64(),\n y = stream.readFloat64(),\n z = stream.readFloat64();\n\n if (undefined === result)\n return new Point3d(x, y, z);\n\n result.set(x, y, z);\n return result;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"TileIO.js","sourceRoot":"","sources":["../../../src/tile/TileIO.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAsBH,8CAcC;AAKD,oDAGC;AAsED,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AAM,CAAC;AAChB,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Tile\r\n */\r\n\r\nimport { BentleyError, ByteStream } from \"@itwin/core-bentley\";\r\nimport { Point3d } from \"@itwin/core-geometry\";\r\n\r\n/** Type codes for various tile formats. Often these are embedded as 32-bit 'magic numbers' in a binary stream to indicate the format.\r\n * @internal\r\n */\r\nexport enum TileFormat {\r\n Unknown = 0,\r\n B3dm = 0x6d643362, // \"b3dm\"\r\n Gltf = 0x46546c67, // \"glTF\"\r\n Pnts = 0x73746e70, // \"pnts\"\r\n IModel = 0x6c644d69, // \"iMdl\"\r\n Cmpt = 0x74706d63, // cmpt\r\n I3dm = 0x6d643369, // i3dm\r\n A3x = 0x583341, // A3X0 (numeric 0 not char '0')\r\n}\r\n\r\n/** Given a magic number, return whether it identifies a known tile format.\r\n * @internal\r\n */\r\nexport function isKnownTileFormat(format: number) {\r\n switch (format) {\r\n case TileFormat.Unknown:\r\n case TileFormat.B3dm:\r\n case TileFormat.Gltf:\r\n case TileFormat.IModel:\r\n case TileFormat.Pnts:\r\n case TileFormat.Cmpt:\r\n case TileFormat.I3dm:\r\n case TileFormat.A3x:\r\n return true;\r\n default:\r\n return false;\r\n }\r\n}\r\n\r\n/** Given a magic number, attempt to convert it to a known TileFormat.\r\n * @internal\r\n */\r\nexport function tileFormatFromNumber(formatNumber: number): TileFormat {\r\n const format = formatNumber as TileFormat;\r\n return isKnownTileFormat(format) ? format : TileFormat.Unknown;\r\n}\r\n\r\n/** Status codes for tile reading operations\r\n * @internal\r\n */\r\nexport enum TileReadStatus {\r\n Success = 0,\r\n InvalidTileData,\r\n InvalidHeader,\r\n InvalidBatchTable,\r\n InvalidScene,\r\n InvalidFeatureTable,\r\n NewerMajorVersion,\r\n Canceled,\r\n}\r\n\r\nconst readStatusMessages = [\r\n \"Success\",\r\n \"Invalid tile data\",\r\n \"Invalid tile header\",\r\n \"Invalid batch table\",\r\n \"Invalid scene\",\r\n \"Invalid feature table\",\r\n \"Major version too new\",\r\n \"Canceled\",\r\n];\r\n\r\n/** Exception thrown by functions that deserialize tiles.\r\n * @internal\r\n */\r\nexport class TileReadError extends BentleyError {\r\n public constructor(status: TileReadStatus, message?: string) {\r\n if (undefined === message)\r\n message = readStatusMessages[status];\r\n\r\n super(status, message);\r\n }\r\n\r\n public get wasCanceled(): boolean { return TileReadStatus.Canceled === this.errorNumber; }\r\n}\r\n\r\n/** The base header preceding tile data of most formats, identifying the tile format and version of that format.\r\n * Specific tile formats may define their own headers as sub-types of this Header, appending\r\n * additional format-specific data.\r\n * @internal\r\n */\r\nexport abstract class TileHeader {\r\n private _format: TileFormat;\r\n public version: number;\r\n\r\n /** Construct a Header from the binary data at the supplied stream's current read position */\r\n public constructor(stream: ByteStream) {\r\n this._format = tileFormatFromNumber(stream.readUint32());\r\n this.version = stream.readUint32();\r\n }\r\n\r\n public get format(): TileFormat { return this._format; }\r\n\r\n /** Returns whether the header represents valid data */\r\n public abstract get isValid(): boolean;\r\n\r\n /** Mark the header as representing invalid data */\r\n protected invalidate(): void {\r\n this._format = TileFormat.Unknown;\r\n }\r\n}\r\n\r\n/** Read 3 64-bit floating point numbers at the byte stream's current read position, advance by 24 bytes, and return a Point3d constructed from the 3 numbers.\r\n * @internal\r\n */\r\nexport function nextPoint3d64FromByteStream(stream: ByteStream, result?: Point3d): Point3d {\r\n const x = stream.readFloat64(),\r\n y = stream.readFloat64(),\r\n z = stream.readFloat64();\r\n\r\n if (undefined === result)\r\n return new Point3d(x, y, z);\r\n\r\n result.set(x, y, z);\r\n return result;\r\n}\r\n"]}
|