@itwin/core-common 5.0.0-dev.6 → 5.0.0-dev.8
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 +20 -1
- package/lib/cjs/AmbientOcclusion.js.map +1 -1
- 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/BackendTypes.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.js.map +1 -1
- package/lib/cjs/BriefcaseTypes.js.map +1 -1
- package/lib/cjs/Camera.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.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.map +1 -1
- package/lib/cjs/ElementMesh.js.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.js.map +1 -1
- package/lib/cjs/FeatureSymbology.js.map +1 -1
- package/lib/cjs/FeatureTable.js.map +1 -1
- package/lib/cjs/Fonts.d.ts +1 -1
- package/lib/cjs/Fonts.d.ts.map +1 -1
- package/lib/cjs/Fonts.js +2 -2
- 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.js.map +1 -1
- package/lib/cjs/GeometrySummary.js.map +1 -1
- 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.js.map +1 -1
- package/lib/cjs/Hilite.js.map +1 -1
- 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/ITwinError.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.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/Render.js.map +1 -1
- package/lib/cjs/RenderMaterial.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.map +1 -1
- package/lib/cjs/TextureProps.js.map +1 -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.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.js.map +1 -1
- 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.js.map +1 -1
- 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.js.map +1 -1
- package/lib/cjs/geometry/ElementGeometry.js.map +1 -1
- package/lib/cjs/geometry/ElementGeometryFB.js.map +1 -1
- package/lib/cjs/geometry/FrustumPlanes.js.map +1 -1
- package/lib/cjs/geometry/GeodeticDatum.js.map +1 -1
- package/lib/cjs/geometry/GeodeticEllipsoid.js.map +1 -1
- package/lib/cjs/geometry/GeometryStream.js.map +1 -1
- package/lib/cjs/geometry/ImageGraphic.js.map +1 -1
- package/lib/cjs/geometry/LineStyle.js.map +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/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.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.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.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.js.map +1 -1
- package/lib/esm/Atmosphere.js.map +1 -1
- package/lib/esm/AuthorizationClient.js.map +1 -1
- package/lib/esm/BackendTypes.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.js.map +1 -1
- package/lib/esm/BriefcaseTypes.js.map +1 -1
- package/lib/esm/Camera.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.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.map +1 -1
- package/lib/esm/ElementMesh.js.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.js.map +1 -1
- package/lib/esm/FeatureSymbology.js.map +1 -1
- package/lib/esm/FeatureTable.js.map +1 -1
- package/lib/esm/Fonts.d.ts +1 -1
- package/lib/esm/Fonts.d.ts.map +1 -1
- package/lib/esm/Fonts.js +2 -2
- 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.js.map +1 -1
- package/lib/esm/GeometrySummary.js.map +1 -1
- 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.js.map +1 -1
- package/lib/esm/Hilite.js.map +1 -1
- 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/ITwinError.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.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/Render.js.map +1 -1
- package/lib/esm/RenderMaterial.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.map +1 -1
- package/lib/esm/TextureProps.js.map +1 -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.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.js.map +1 -1
- 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.js.map +1 -1
- 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.js.map +1 -1
- package/lib/esm/geometry/ElementGeometry.js.map +1 -1
- package/lib/esm/geometry/ElementGeometryFB.js.map +1 -1
- package/lib/esm/geometry/FrustumPlanes.js.map +1 -1
- package/lib/esm/geometry/GeodeticDatum.js.map +1 -1
- package/lib/esm/geometry/GeodeticEllipsoid.js.map +1 -1
- package/lib/esm/geometry/GeometryStream.js.map +1 -1
- package/lib/esm/geometry/ImageGraphic.js.map +1 -1
- package/lib/esm/geometry/LineStyle.js.map +1 -1
- 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/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.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.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.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 +7 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SpatialClassification.js","sourceRoot":"","sources":["../../src/SpatialClassification.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAc,MAAM,qBAAqB,CAAC;AAGzD;;;;GAIG;AACH,MAAM,CAAN,IAAY,8BAWX;AAXD,WAAY,8BAA8B;IACxC,qCAAqC;IACrC,iFAAO,CAAA;IACP,oDAAoD;IACpD,+EAAM,CAAA;IACN,gCAAgC;IAChC,uFAAU,CAAA;IACV,wEAAwE;IACxE,uFAAU,CAAA;IACV,yEAAyE;IACzE,mGAAgB,CAAA;AAClB,CAAC,EAXW,8BAA8B,KAA9B,8BAA8B,QAWzC;AAED;;;;GAIG;AACH,MAAM,CAAN,IAAY,+BAOX;AAPD,WAAY,+BAA+B;IACzC,qCAAqC;IACrC,mFAAO,CAAA;IACP,oDAAoD;IACpD,iFAAM,CAAA;IACN,gCAAgC;IAChC,yFAAU,CAAA;AACZ,CAAC,EAPW,+BAA+B,KAA/B,+BAA+B,QAO1C;AAeD;;GAEG;AACH,MAAM,OAAO,sBAAsB;IAQjC,2BAA2B;IAC3B,YAAmB,MAAM,GAAG,8BAA8B,CAAC,YAAY,EAAE,OAAO,GAAG,+BAA+B,CAAC,MAAM,EAAE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AC;QAC3C,KAAK,8BAA8B,CAAC,YAAY;YAC9C,OAAO,OAAO,CAAC;QACjB;YACE,OAAO,8BAA8B,CAAC,YAAY,CAAC;IACvD,CAAC;AACH,CAAC;AAED,SAAS,cAAc,CAAC,OAAe;IACrC,QAAQ,OAAO,EAAE,CAAC;QAChB,KAAK,+BAA+B,CAAC,GAAG,CAAC;QACzC,KAAK,+BAA+B,CAAC,EAAE,CAAC;QACxC,KAAK,+BAA+B,CAAC,MAAM;YACzC,OAAO,OAAO,CAAC;QACjB;YACE,OAAO,+BAA+B,CAAC,MAAM,CAAC;IAClD,CAAC;AACH,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 DisplayStyles\r\n */\r\n\r\nimport { assert, Id64String } from \"@itwin/core-bentley\";\r\nimport { ModelMapLayerSettings } from \"./MapLayerSettings\";\r\n\r\n/** Describes how a [[SpatialClassifier]] affects the display of classified geometry - that is, geometry intersecting\r\n * the classifier.\r\n * @public\r\n * @extensions\r\n */\r\nexport enum SpatialClassifierInsideDisplay {\r\n /** The geometry is not displayed. */\r\n Off = 0,\r\n /** The geometry is displayed without alteration. */\r\n On = 1,\r\n /** The geometry is darkened. */\r\n Dimmed = 2,\r\n /** The geometry is tinted by the [Viewport.hilite]($frontend) color. */\r\n Hilite = 3,\r\n /** The geometry is tinted with the colors of the classifier elements. */\r\n ElementColor = 4,\r\n}\r\n\r\n/** Describes how a [[SpatialClassifier]] affects the display of unclassified geometry - that is, geometry not intersecting\r\n * the classifier.\r\n * @public\r\n * @extensions\r\n */\r\nexport enum SpatialClassifierOutsideDisplay {\r\n /** The geometry is not displayed. */\r\n Off = 0,\r\n /** The geometry is displayed without alteration. */\r\n On = 1,\r\n /** The geometry is darkened. */\r\n Dimmed = 2,\r\n}\r\n\r\n/** JSON representation of a [[SpatialClassifierFlags]].\r\n * @public\r\n * @extensions\r\n */\r\nexport interface SpatialClassifierFlagsProps {\r\n /** See [[SpatialClassifierFlags.inside]]. */\r\n inside: SpatialClassifierInsideDisplay;\r\n /** See [[SpatialClassifierFlags.outside]]. */\r\n outside: SpatialClassifierOutsideDisplay;\r\n /** See [[SpatialClassifierFlags.isVolumeClassifier]]. */\r\n isVolumeClassifier?: boolean;\r\n}\r\n\r\n/** Flags affecting how a [[SpatialClassifier]] is applied.\r\n * @public\r\n */\r\nexport class SpatialClassifierFlags {\r\n /** How geometry intersecting the classifier should be displayed. */\r\n public readonly inside: SpatialClassifierInsideDisplay;\r\n /** How geometry not intersecting the classifier should be displayed. */\r\n public readonly outside: SpatialClassifierOutsideDisplay;\r\n /** True for volume classification; false for planar classification. */\r\n public readonly isVolumeClassifier: boolean;\r\n\r\n /** Construct new flags. */\r\n public constructor(inside = SpatialClassifierInsideDisplay.ElementColor, outside = SpatialClassifierOutsideDisplay.Dimmed, isVolumeClassifier = false) {\r\n this.inside = insideDisplay(inside);\r\n this.outside = outsideDisplay(outside);\r\n this.isVolumeClassifier = isVolumeClassifier;\r\n }\r\n\r\n /** Construct from JSON representation. */\r\n public static fromJSON(props: SpatialClassifierFlagsProps): SpatialClassifierFlags {\r\n return new SpatialClassifierFlags(props.inside, props.outside, true === props.isVolumeClassifier);\r\n }\r\n\r\n /** Convert to JSON representation. */\r\n public toJSON(): SpatialClassifierFlagsProps {\r\n const props: SpatialClassifierFlagsProps = {\r\n inside: this.inside,\r\n outside: this.outside,\r\n };\r\n\r\n if (this.isVolumeClassifier)\r\n props.isVolumeClassifier = true;\r\n\r\n return props;\r\n }\r\n\r\n /** Create flags indentical to these ones except for any properties explicitly specified by `changedProps`. */\r\n public clone(changedProps?: Partial<SpatialClassifierFlagsProps>): SpatialClassifierFlags {\r\n if (!changedProps)\r\n return this;\r\n\r\n return SpatialClassifierFlags.fromJSON({ ...this.toJSON(), ...changedProps });\r\n }\r\n\r\n /** Return true if these flags are equivalent to `other`. */\r\n public equals(other: SpatialClassifierFlags): boolean {\r\n if (other === this)\r\n return true;\r\n\r\n return other.inside === this.inside && other.outside === this.outside && other.isVolumeClassifier === this.isVolumeClassifier;\r\n }\r\n\r\n /** Return true if these flags are equivalent to `props`. */\r\n public equalsProps(props: SpatialClassifierFlagsProps): boolean {\r\n return this.inside === props.inside && this.outside === props.outside && this.isVolumeClassifier === (true === props.isVolumeClassifier);\r\n }\r\n}\r\n\r\n/** JSON representation of a [[SpatialClassifier]].\r\n * @public\r\n * @extensions\r\n */\r\nexport interface SpatialClassifierProps {\r\n /** See [[SpatialClassifier.modelId]]. */\r\n modelId: Id64String;\r\n /** See [[SpatialClassifier.expand]]. */\r\n expand: number;\r\n /** See [[SpatialClassifier.flags]]. */\r\n flags: SpatialClassifierFlagsProps;\r\n /** See [[SpatialClassifier.name]]. */\r\n name: string;\r\n /** Records whether this is the active classifier.\r\n * See [[SpatialClassifier.active]].\r\n */\r\n isActive?: boolean;\r\n}\r\n\r\n/** Describes how to use the geometry of one [GeometricModel]($backend) to classify the contents of other models - most typically, reality models.\r\n * Applying a classifier divides the geometry of the classified model into two groups:\r\n * - Classified (intersecting the classifier); and\r\n * - Unclassified (not intersecting the classifier).\r\n * For example, a model containing the building footprints for a city block could be used to classify a reality mesh captured from photographs of the\r\n * real-world block. Then, buildings within the reality mesh can be selected individually, and present the properties of the classifier geometry (e.g.,\r\n * the address of the building). The appearance of the geometry can also be customized based using [[SpatialClassifierInsideDisplay]] and [[SpatialClassifierOutsideDisplay]].\r\n * Two types of classification are supported:\r\n * - Planar classification, in which the geometry of the classifier model is projected onto a plane to classify geometry within a region extruded perpendicular\r\n * the plane (e.g., the building footprints example); and\r\n * - Volume classification, in which closed, non-intersecting volumes within the classifier classify geometry that intersects (i.e. is contained within) those same volumes (e.g., imagine using boxes instead\r\n * of footprints to classify buildings, or floors of buildings).\r\n * @see this (interactive example)[https://www.itwinjs.org/sample-showcase/?group=Viewer+Features&sample=classifier-sample].\r\n * @see [[SpatialClassifiers]] to define a set of classifiers.\r\n * @see [[ContextRealityModel.classifiers]] to classify a context reality model.\r\n * @see [SpatialModelState.classifiers]($frontend) to classify a persistent reality model.\r\n * @public\r\n */\r\nexport class SpatialClassifier {\r\n /** The Id of the [GeometricModel]($backend) whose geometry is used to produce the classifier. */\r\n public readonly modelId: Id64String;\r\n /** A distance in meters by which to expand the classifier geometry. For example, if line strings are used to represent streets,\r\n * you might expand them to the average width of a street.\r\n */\r\n public readonly expand: number;\r\n /** Flags controlling how to apply the classifier. */\r\n public readonly flags: SpatialClassifierFlags;\r\n /** A user-friendly name, useful for identifying individual classifiers within a [[SpatialClassifiers]]. */\r\n public readonly name: string;\r\n\r\n /** Construct a new classifier. */\r\n public constructor(modelId: Id64String, name: string, flags = new SpatialClassifierFlags(), expand = 0) {\r\n this.modelId = modelId;\r\n this.expand = expand;\r\n this.flags = flags;\r\n this.name = name;\r\n }\r\n\r\n /** Construct from JSON representation. */\r\n public static fromJSON(props: SpatialClassifierProps): SpatialClassifier {\r\n return new SpatialClassifier(props.modelId, props.name, SpatialClassifierFlags.fromJSON(props.flags), props.expand);\r\n }\r\n\r\n /** Convert to JSON representation.\r\n * @note This method always sets the [[SpatialClassifierProps.isActive]] property to `false`.\r\n */\r\n public toJSON(): SpatialClassifierProps {\r\n return {\r\n modelId: this.modelId,\r\n expand: this.expand,\r\n flags: this.flags.toJSON(),\r\n name: this.name,\r\n isActive: false,\r\n };\r\n }\r\n\r\n /** Construct from Model Map Layer.\r\n * @beta\r\n */\r\n public static fromModelMapLayer(mapLayer: ModelMapLayerSettings): SpatialClassifier {\r\n const flags = SpatialClassifierFlags.fromJSON({ inside: SpatialClassifierInsideDisplay.Off, outside: SpatialClassifierOutsideDisplay.Off });\r\n\r\n return new SpatialClassifier(mapLayer.modelId, mapLayer.name, flags);\r\n }\r\n\r\n /** Create a classifier identical to this one except for any properties explicitly specified by `changedProps`. */\r\n public clone(changedProps?: Partial<SpatialClassifierProps>): SpatialClassifier {\r\n if (!changedProps)\r\n return this;\r\n\r\n return SpatialClassifier.fromJSON({ ...this.toJSON(), ...changedProps });\r\n }\r\n\r\n /** Return true if this classifier is equivalent to `other`. */\r\n public equals(other: SpatialClassifier): boolean {\r\n if (other === this)\r\n return true;\r\n\r\n return this.modelId === other.modelId && this.expand === other.expand && this.name === other.name && this.flags.equals(other.flags);\r\n }\r\n\r\n /** Return true if this classifier is equivalent to `props`. */\r\n public equalsProps(props: SpatialClassifierProps): boolean {\r\n return this.modelId === props.modelId && this.expand === props.expand && this.name === props.name && this.flags.equalsProps(props.flags);\r\n }\r\n}\r\n\r\n/** An object that can store the JSON representation of a list of [[SpatialClassifier]]s.\r\n * @see [[SpatialClassifiers]].\r\n * @public\r\n * @extensions\r\n */\r\nexport interface SpatialClassifiersContainer {\r\n /** The list of classifiers. */\r\n classifiers?: SpatialClassifierProps[];\r\n}\r\n\r\n/** A set of [[SpatialClassifier]]s for a given reality model. At most one of the classifiers can be actively classifying the model at any given time.\r\n * The set of classifiers can be presented to the user, listed by name, so that the active classifier can be changed.\r\n * The set of classifiers is populated from its JSON representation and that representation is kept in sync as the set of classifiers is modified.\r\n * @see this (interactive example)[https://www.itwinjs.org/sample-showcase/?group=Viewer+Features&sample=classifier-sample].\r\n * @see [[SpatialClassifier]] for details on how spatial classification works.\r\n * @see [[ContextRealityModel.classifiers]] to define classifiers for a context reality model.\r\n * @see [SpatialModelState.classifiers]($frontend) to define classifiers for a persistent reality model.\r\n * @public\r\n */\r\nexport class SpatialClassifiers implements Iterable<SpatialClassifier> {\r\n private readonly _json: SpatialClassifiersContainer;\r\n private readonly _classifiers: SpatialClassifier[] = [];\r\n private _active?: SpatialClassifier;\r\n\r\n /** Construct a new set of classifiers from the JSON representation. The set will be initialized from `container.classifiers` and that JSON representation\r\n * will be kept in sync with changes made to the set. The caller should not directly modify `container.classifiers` or its contents as that will cause the set to become out\r\n * of sync with the JSON representation.\r\n * The [[active]] classifier will be determined by the first [[SpatialClassifierProps]] whose `isActive` property is set to `true`, if any.\r\n */\r\n public constructor(container: SpatialClassifiersContainer) {\r\n this._json = container;\r\n\r\n const json = this._array;\r\n if (!json)\r\n return;\r\n\r\n for (const props of json) {\r\n const classifier = SpatialClassifier.fromJSON(props);\r\n this._classifiers.push(classifier);\r\n if (props.isActive) {\r\n if (!this._active)\r\n this._active = classifier;\r\n else\r\n props.isActive = false;\r\n }\r\n }\r\n }\r\n\r\n /** The classifier currently classifying the target reality model. The classifier passed to the setter must be one obtained from this set, or one equivalent to\r\n * one contained in this set; in the latter case, the equivalent classifier contained in this set becomes active.\r\n */\r\n /** The classifier currently classifying the target reality model, if any.\r\n * @see [[setActive]] to change the active classifier.\r\n */\r\n public get active(): SpatialClassifier | undefined {\r\n return this._active;\r\n }\r\n\r\n /** Change the [[active]] classifier. The input must be a classifier belonging to this set, or equivalent to one in the set.\r\n * If no equivalent classifier exists in the set, the active classifier remains unchanged.\r\n * @param The classifier to set as active, or `undefined` to clear the active classifier.\r\n * @returns the active classifier.\r\n */\r\n public setActive(active: SpatialClassifier | undefined): SpatialClassifier | undefined {\r\n const array = this._array;\r\n if (!array)\r\n return this.active;\r\n\r\n if (active) {\r\n active = this.findEquivalent(active);\r\n if (!active)\r\n return this.active;\r\n }\r\n\r\n if (active === this.active)\r\n return this.active;\r\n\r\n let propsIndex = -1;\r\n if (active) {\r\n propsIndex = array.findIndex((x) => active.equalsProps(x));\r\n if (-1 === propsIndex)\r\n return this.active;\r\n }\r\n\r\n this._active = active;\r\n for (let i = 0; i < array.length; i++)\r\n array[i].isActive = (i === propsIndex);\r\n\r\n return this.active;\r\n }\r\n\r\n /** Obtain an iterator over the classifiers contained in this set. */\r\n public [Symbol.iterator](): Iterator<SpatialClassifier> {\r\n return this._classifiers[Symbol.iterator]();\r\n }\r\n\r\n /** The number of classifiers in this set. */\r\n public get size(): number {\r\n return this._array?.length ?? 0;\r\n }\r\n\r\n /** Returns the first classifier that satisfies `criterion`, or `undefined` if no classifier satisfies it. */\r\n public find(criterion: (classifier: SpatialClassifier) => boolean): SpatialClassifier | undefined {\r\n return this._classifiers.find(criterion);\r\n }\r\n\r\n /** Find the first classifier that is equivalent to the supplied classifier, or `undefined` if no equivalent classifier exists in this set. */\r\n public findEquivalent(classifier: SpatialClassifier): SpatialClassifier | undefined {\r\n return this.find((x) => x.equals(classifier));\r\n }\r\n\r\n /** Return true if the specified classifier or one equivalent to it exists in this set. */\r\n public has(classifier: SpatialClassifier): boolean {\r\n return undefined !== this.findEquivalent(classifier);\r\n }\r\n\r\n /** Add a classifier to this set. If an equivalent classifier already exists, the supplied classifier is not added.\r\n * @param classifier The classifier to add.\r\n * @returns The equivalent pre-existing classifier, if one existed; or the supplied classifier, if it was added to the set.\r\n */\r\n public add(classifier: SpatialClassifier): SpatialClassifier {\r\n const existing = this.findEquivalent(classifier);\r\n if (existing)\r\n return existing;\r\n\r\n let array = this._array;\r\n if (!array)\r\n array = this._json.classifiers = [];\r\n\r\n this._classifiers.push(classifier);\r\n array.push(classifier.toJSON());\r\n return classifier;\r\n }\r\n\r\n /** Replace an existing classifier with a different one.\r\n * @param toReplace The classifier to be replaced.\r\n * @param replacement The classifier to replace `toReplace`.\r\n * @returns true if a classifier equivalent to `toReplace` existed in the set and was replaced by `replacement`.\r\n * @note If `toReplace` was the [[active]] classifier, `replacement` will become active.\r\n */\r\n public replace(toReplace: SpatialClassifier, replacement: SpatialClassifier): boolean {\r\n const list = this._array;\r\n if (!list)\r\n return false;\r\n\r\n const classifierIndex = this._classifiers.findIndex((x) => x.equals(toReplace));\r\n if (-1 === classifierIndex)\r\n return false;\r\n\r\n const propsIndex = list.findIndex((x) => toReplace.equalsProps(x));\r\n assert(propsIndex === classifierIndex);\r\n if (-1 === propsIndex)\r\n return false;\r\n\r\n toReplace = this._classifiers[classifierIndex];\r\n const wasActive = this.active === toReplace;\r\n\r\n this._classifiers[classifierIndex] = replacement;\r\n const props = list[propsIndex] = replacement.toJSON();\r\n\r\n if (wasActive) {\r\n props.isActive = true;\r\n this._active = replacement;\r\n }\r\n\r\n return true;\r\n }\r\n\r\n /** Remove the first classifier equivalent to `classifier` from this set.\r\n * @param classifier The classifier to remove.\r\n * @returns The classifier that was actually removed, or `undefined` if none was removed.\r\n */\r\n public delete(classifier: SpatialClassifier): SpatialClassifier | undefined {\r\n const list = this._array;\r\n if (!list)\r\n return undefined;\r\n\r\n const classifierIndex = this._classifiers.findIndex((x) => x.equals(classifier));\r\n if (-1 === classifierIndex)\r\n return undefined;\r\n\r\n classifier = this._classifiers[classifierIndex];\r\n const propsIndex = list.findIndex((x) => classifier.equalsProps(x));\r\n assert(propsIndex === classifierIndex);\r\n if (-1 === propsIndex)\r\n return undefined;\r\n\r\n list.splice(propsIndex, 1);\r\n this._classifiers.splice(classifierIndex, 1);\r\n if (list.length === 0)\r\n this._json.classifiers = undefined;\r\n\r\n if (classifier === this.active)\r\n this._active = undefined;\r\n\r\n return classifier;\r\n }\r\n\r\n /** Remove all classifiers from this set. */\r\n public clear(): void {\r\n this._classifiers.length = 0;\r\n this._json.classifiers = undefined;\r\n this._active = undefined;\r\n }\r\n\r\n private get _array(): SpatialClassifierProps[] | undefined {\r\n return Array.isArray(this._json.classifiers) ? this._json.classifiers : undefined;\r\n }\r\n}\r\n\r\nfunction insideDisplay(display: number): SpatialClassifierInsideDisplay {\r\n switch (display) {\r\n case SpatialClassifierInsideDisplay.Off:\r\n case SpatialClassifierInsideDisplay.On:\r\n case SpatialClassifierInsideDisplay.Dimmed:\r\n case SpatialClassifierInsideDisplay.Hilite:\r\n case SpatialClassifierInsideDisplay.ElementColor:\r\n return display;\r\n default:\r\n return SpatialClassifierInsideDisplay.ElementColor;\r\n }\r\n}\r\n\r\nfunction outsideDisplay(display: number): SpatialClassifierOutsideDisplay {\r\n switch (display) {\r\n case SpatialClassifierOutsideDisplay.Off:\r\n case SpatialClassifierOutsideDisplay.On:\r\n case SpatialClassifierOutsideDisplay.Dimmed:\r\n return display;\r\n default:\r\n return SpatialClassifierOutsideDisplay.Dimmed;\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"SpatialClassification.js","sourceRoot":"","sources":["../../src/SpatialClassification.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAc,MAAM,qBAAqB,CAAC;AAGzD;;;;GAIG;AACH,MAAM,CAAN,IAAY,8BAWX;AAXD,WAAY,8BAA8B;IACxC,qCAAqC;IACrC,iFAAO,CAAA;IACP,oDAAoD;IACpD,+EAAM,CAAA;IACN,gCAAgC;IAChC,uFAAU,CAAA;IACV,wEAAwE;IACxE,uFAAU,CAAA;IACV,yEAAyE;IACzE,mGAAgB,CAAA;AAClB,CAAC,EAXW,8BAA8B,KAA9B,8BAA8B,QAWzC;AAED;;;;GAIG;AACH,MAAM,CAAN,IAAY,+BAOX;AAPD,WAAY,+BAA+B;IACzC,qCAAqC;IACrC,mFAAO,CAAA;IACP,oDAAoD;IACpD,iFAAM,CAAA;IACN,gCAAgC;IAChC,yFAAU,CAAA;AACZ,CAAC,EAPW,+BAA+B,KAA/B,+BAA+B,QAO1C;AAeD;;GAEG;AACH,MAAM,OAAO,sBAAsB;IAQjC,2BAA2B;IAC3B,YAAmB,MAAM,GAAG,8BAA8B,CAAC,YAAY,EAAE,OAAO,GAAG,+BAA+B,CAAC,MAAM,EAAE,kBAAkB,GAAG,KAAK;QACnJ,IAAI,CAAC,MAAM,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC;QACpC,IAAI,CAAC,OAAO,GAAG,cAAc,CAAC,OAAO,CAAC,CAAC;QACvC,IAAI,CAAC,kBAAkB,GAAG,kBAAkB,CAAC;IAC/C,CAAC;IAED,0CAA0C;IACnC,MAAM,CAAC,QAAQ,CAAC,KAAkC;QACvD,OAAO,IAAI,sBAAsB,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,OAAO,EAAE,IAAI,KAAK,KAAK,CAAC,kBAAkB,CAAC,CAAC;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H,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 DisplayStyles\n */\n\nimport { assert, Id64String } from \"@itwin/core-bentley\";\nimport { ModelMapLayerSettings } from \"./MapLayerSettings\";\n\n/** Describes how a [[SpatialClassifier]] affects the display of classified geometry - that is, geometry intersecting\n * the classifier.\n * @public\n * @extensions\n */\nexport enum SpatialClassifierInsideDisplay {\n /** The geometry is not displayed. */\n Off = 0,\n /** The geometry is displayed without alteration. */\n On = 1,\n /** The geometry is darkened. */\n Dimmed = 2,\n /** The geometry is tinted by the [Viewport.hilite]($frontend) color. */\n Hilite = 3,\n /** The geometry is tinted with the colors of the classifier elements. */\n ElementColor = 4,\n}\n\n/** Describes how a [[SpatialClassifier]] affects the display of unclassified geometry - that is, geometry not intersecting\n * the classifier.\n * @public\n * @extensions\n */\nexport enum SpatialClassifierOutsideDisplay {\n /** The geometry is not displayed. */\n Off = 0,\n /** The geometry is displayed without alteration. */\n On = 1,\n /** The geometry is darkened. */\n Dimmed = 2,\n}\n\n/** JSON representation of a [[SpatialClassifierFlags]].\n * @public\n * @extensions\n */\nexport interface SpatialClassifierFlagsProps {\n /** See [[SpatialClassifierFlags.inside]]. */\n inside: SpatialClassifierInsideDisplay;\n /** See [[SpatialClassifierFlags.outside]]. */\n outside: SpatialClassifierOutsideDisplay;\n /** See [[SpatialClassifierFlags.isVolumeClassifier]]. */\n isVolumeClassifier?: boolean;\n}\n\n/** Flags affecting how a [[SpatialClassifier]] is applied.\n * @public\n */\nexport class SpatialClassifierFlags {\n /** How geometry intersecting the classifier should be displayed. */\n public readonly inside: SpatialClassifierInsideDisplay;\n /** How geometry not intersecting the classifier should be displayed. */\n public readonly outside: SpatialClassifierOutsideDisplay;\n /** True for volume classification; false for planar classification. */\n public readonly isVolumeClassifier: boolean;\n\n /** Construct new flags. */\n public constructor(inside = SpatialClassifierInsideDisplay.ElementColor, outside = SpatialClassifierOutsideDisplay.Dimmed, isVolumeClassifier = false) {\n this.inside = insideDisplay(inside);\n this.outside = outsideDisplay(outside);\n this.isVolumeClassifier = isVolumeClassifier;\n }\n\n /** Construct from JSON representation. */\n public static fromJSON(props: SpatialClassifierFlagsProps): SpatialClassifierFlags {\n return new SpatialClassifierFlags(props.inside, props.outside, true === props.isVolumeClassifier);\n }\n\n /** Convert to JSON representation. */\n public toJSON(): SpatialClassifierFlagsProps {\n const props: SpatialClassifierFlagsProps = {\n inside: this.inside,\n outside: this.outside,\n };\n\n if (this.isVolumeClassifier)\n props.isVolumeClassifier = true;\n\n return props;\n }\n\n /** Create flags indentical to these ones except for any properties explicitly specified by `changedProps`. */\n public clone(changedProps?: Partial<SpatialClassifierFlagsProps>): SpatialClassifierFlags {\n if (!changedProps)\n return this;\n\n return SpatialClassifierFlags.fromJSON({ ...this.toJSON(), ...changedProps });\n }\n\n /** Return true if these flags are equivalent to `other`. */\n public equals(other: SpatialClassifierFlags): boolean {\n if (other === this)\n return true;\n\n return other.inside === this.inside && other.outside === this.outside && other.isVolumeClassifier === this.isVolumeClassifier;\n }\n\n /** Return true if these flags are equivalent to `props`. */\n public equalsProps(props: SpatialClassifierFlagsProps): boolean {\n return this.inside === props.inside && this.outside === props.outside && this.isVolumeClassifier === (true === props.isVolumeClassifier);\n }\n}\n\n/** JSON representation of a [[SpatialClassifier]].\n * @public\n * @extensions\n */\nexport interface SpatialClassifierProps {\n /** See [[SpatialClassifier.modelId]]. */\n modelId: Id64String;\n /** See [[SpatialClassifier.expand]]. */\n expand: number;\n /** See [[SpatialClassifier.flags]]. */\n flags: SpatialClassifierFlagsProps;\n /** See [[SpatialClassifier.name]]. */\n name: string;\n /** Records whether this is the active classifier.\n * See [[SpatialClassifier.active]].\n */\n isActive?: boolean;\n}\n\n/** Describes how to use the geometry of one [GeometricModel]($backend) to classify the contents of other models - most typically, reality models.\n * Applying a classifier divides the geometry of the classified model into two groups:\n * - Classified (intersecting the classifier); and\n * - Unclassified (not intersecting the classifier).\n * For example, a model containing the building footprints for a city block could be used to classify a reality mesh captured from photographs of the\n * real-world block. Then, buildings within the reality mesh can be selected individually, and present the properties of the classifier geometry (e.g.,\n * the address of the building). The appearance of the geometry can also be customized based using [[SpatialClassifierInsideDisplay]] and [[SpatialClassifierOutsideDisplay]].\n * Two types of classification are supported:\n * - Planar classification, in which the geometry of the classifier model is projected onto a plane to classify geometry within a region extruded perpendicular\n * the plane (e.g., the building footprints example); and\n * - Volume classification, in which closed, non-intersecting volumes within the classifier classify geometry that intersects (i.e. is contained within) those same volumes (e.g., imagine using boxes instead\n * of footprints to classify buildings, or floors of buildings).\n * @see this (interactive example)[https://www.itwinjs.org/sample-showcase/?group=Viewer+Features&sample=classifier-sample].\n * @see [[SpatialClassifiers]] to define a set of classifiers.\n * @see [[ContextRealityModel.classifiers]] to classify a context reality model.\n * @see [SpatialModelState.classifiers]($frontend) to classify a persistent reality model.\n * @public\n */\nexport class SpatialClassifier {\n /** The Id of the [GeometricModel]($backend) whose geometry is used to produce the classifier. */\n public readonly modelId: Id64String;\n /** A distance in meters by which to expand the classifier geometry. For example, if line strings are used to represent streets,\n * you might expand them to the average width of a street.\n */\n public readonly expand: number;\n /** Flags controlling how to apply the classifier. */\n public readonly flags: SpatialClassifierFlags;\n /** A user-friendly name, useful for identifying individual classifiers within a [[SpatialClassifiers]]. */\n public readonly name: string;\n\n /** Construct a new classifier. */\n public constructor(modelId: Id64String, name: string, flags = new SpatialClassifierFlags(), expand = 0) {\n this.modelId = modelId;\n this.expand = expand;\n this.flags = flags;\n this.name = name;\n }\n\n /** Construct from JSON representation. */\n public static fromJSON(props: SpatialClassifierProps): SpatialClassifier {\n return new SpatialClassifier(props.modelId, props.name, SpatialClassifierFlags.fromJSON(props.flags), props.expand);\n }\n\n /** Convert to JSON representation.\n * @note This method always sets the [[SpatialClassifierProps.isActive]] property to `false`.\n */\n public toJSON(): SpatialClassifierProps {\n return {\n modelId: this.modelId,\n expand: this.expand,\n flags: this.flags.toJSON(),\n name: this.name,\n isActive: false,\n };\n }\n\n /** Construct from Model Map Layer.\n * @beta\n */\n public static fromModelMapLayer(mapLayer: ModelMapLayerSettings): SpatialClassifier {\n const flags = SpatialClassifierFlags.fromJSON({ inside: SpatialClassifierInsideDisplay.Off, outside: SpatialClassifierOutsideDisplay.Off });\n\n return new SpatialClassifier(mapLayer.modelId, mapLayer.name, flags);\n }\n\n /** Create a classifier identical to this one except for any properties explicitly specified by `changedProps`. */\n public clone(changedProps?: Partial<SpatialClassifierProps>): SpatialClassifier {\n if (!changedProps)\n return this;\n\n return SpatialClassifier.fromJSON({ ...this.toJSON(), ...changedProps });\n }\n\n /** Return true if this classifier is equivalent to `other`. */\n public equals(other: SpatialClassifier): boolean {\n if (other === this)\n return true;\n\n return this.modelId === other.modelId && this.expand === other.expand && this.name === other.name && this.flags.equals(other.flags);\n }\n\n /** Return true if this classifier is equivalent to `props`. */\n public equalsProps(props: SpatialClassifierProps): boolean {\n return this.modelId === props.modelId && this.expand === props.expand && this.name === props.name && this.flags.equalsProps(props.flags);\n }\n}\n\n/** An object that can store the JSON representation of a list of [[SpatialClassifier]]s.\n * @see [[SpatialClassifiers]].\n * @public\n * @extensions\n */\nexport interface SpatialClassifiersContainer {\n /** The list of classifiers. */\n classifiers?: SpatialClassifierProps[];\n}\n\n/** A set of [[SpatialClassifier]]s for a given reality model. At most one of the classifiers can be actively classifying the model at any given time.\n * The set of classifiers can be presented to the user, listed by name, so that the active classifier can be changed.\n * The set of classifiers is populated from its JSON representation and that representation is kept in sync as the set of classifiers is modified.\n * @see this (interactive example)[https://www.itwinjs.org/sample-showcase/?group=Viewer+Features&sample=classifier-sample].\n * @see [[SpatialClassifier]] for details on how spatial classification works.\n * @see [[ContextRealityModel.classifiers]] to define classifiers for a context reality model.\n * @see [SpatialModelState.classifiers]($frontend) to define classifiers for a persistent reality model.\n * @public\n */\nexport class SpatialClassifiers implements Iterable<SpatialClassifier> {\n private readonly _json: SpatialClassifiersContainer;\n private readonly _classifiers: SpatialClassifier[] = [];\n private _active?: SpatialClassifier;\n\n /** Construct a new set of classifiers from the JSON representation. The set will be initialized from `container.classifiers` and that JSON representation\n * will be kept in sync with changes made to the set. The caller should not directly modify `container.classifiers` or its contents as that will cause the set to become out\n * of sync with the JSON representation.\n * The [[active]] classifier will be determined by the first [[SpatialClassifierProps]] whose `isActive` property is set to `true`, if any.\n */\n public constructor(container: SpatialClassifiersContainer) {\n this._json = container;\n\n const json = this._array;\n if (!json)\n return;\n\n for (const props of json) {\n const classifier = SpatialClassifier.fromJSON(props);\n this._classifiers.push(classifier);\n if (props.isActive) {\n if (!this._active)\n this._active = classifier;\n else\n props.isActive = false;\n }\n }\n }\n\n /** The classifier currently classifying the target reality model. The classifier passed to the setter must be one obtained from this set, or one equivalent to\n * one contained in this set; in the latter case, the equivalent classifier contained in this set becomes active.\n */\n /** The classifier currently classifying the target reality model, if any.\n * @see [[setActive]] to change the active classifier.\n */\n public get active(): SpatialClassifier | undefined {\n return this._active;\n }\n\n /** Change the [[active]] classifier. The input must be a classifier belonging to this set, or equivalent to one in the set.\n * If no equivalent classifier exists in the set, the active classifier remains unchanged.\n * @param The classifier to set as active, or `undefined` to clear the active classifier.\n * @returns the active classifier.\n */\n public setActive(active: SpatialClassifier | undefined): SpatialClassifier | undefined {\n const array = this._array;\n if (!array)\n return this.active;\n\n if (active) {\n active = this.findEquivalent(active);\n if (!active)\n return this.active;\n }\n\n if (active === this.active)\n return this.active;\n\n let propsIndex = -1;\n if (active) {\n propsIndex = array.findIndex((x) => active.equalsProps(x));\n if (-1 === propsIndex)\n return this.active;\n }\n\n this._active = active;\n for (let i = 0; i < array.length; i++)\n array[i].isActive = (i === propsIndex);\n\n return this.active;\n }\n\n /** Obtain an iterator over the classifiers contained in this set. */\n public [Symbol.iterator](): Iterator<SpatialClassifier> {\n return this._classifiers[Symbol.iterator]();\n }\n\n /** The number of classifiers in this set. */\n public get size(): number {\n return this._array?.length ?? 0;\n }\n\n /** Returns the first classifier that satisfies `criterion`, or `undefined` if no classifier satisfies it. */\n public find(criterion: (classifier: SpatialClassifier) => boolean): SpatialClassifier | undefined {\n return this._classifiers.find(criterion);\n }\n\n /** Find the first classifier that is equivalent to the supplied classifier, or `undefined` if no equivalent classifier exists in this set. */\n public findEquivalent(classifier: SpatialClassifier): SpatialClassifier | undefined {\n return this.find((x) => x.equals(classifier));\n }\n\n /** Return true if the specified classifier or one equivalent to it exists in this set. */\n public has(classifier: SpatialClassifier): boolean {\n return undefined !== this.findEquivalent(classifier);\n }\n\n /** Add a classifier to this set. If an equivalent classifier already exists, the supplied classifier is not added.\n * @param classifier The classifier to add.\n * @returns The equivalent pre-existing classifier, if one existed; or the supplied classifier, if it was added to the set.\n */\n public add(classifier: SpatialClassifier): SpatialClassifier {\n const existing = this.findEquivalent(classifier);\n if (existing)\n return existing;\n\n let array = this._array;\n if (!array)\n array = this._json.classifiers = [];\n\n this._classifiers.push(classifier);\n array.push(classifier.toJSON());\n return classifier;\n }\n\n /** Replace an existing classifier with a different one.\n * @param toReplace The classifier to be replaced.\n * @param replacement The classifier to replace `toReplace`.\n * @returns true if a classifier equivalent to `toReplace` existed in the set and was replaced by `replacement`.\n * @note If `toReplace` was the [[active]] classifier, `replacement` will become active.\n */\n public replace(toReplace: SpatialClassifier, replacement: SpatialClassifier): boolean {\n const list = this._array;\n if (!list)\n return false;\n\n const classifierIndex = this._classifiers.findIndex((x) => x.equals(toReplace));\n if (-1 === classifierIndex)\n return false;\n\n const propsIndex = list.findIndex((x) => toReplace.equalsProps(x));\n assert(propsIndex === classifierIndex);\n if (-1 === propsIndex)\n return false;\n\n toReplace = this._classifiers[classifierIndex];\n const wasActive = this.active === toReplace;\n\n this._classifiers[classifierIndex] = replacement;\n const props = list[propsIndex] = replacement.toJSON();\n\n if (wasActive) {\n props.isActive = true;\n this._active = replacement;\n }\n\n return true;\n }\n\n /** Remove the first classifier equivalent to `classifier` from this set.\n * @param classifier The classifier to remove.\n * @returns The classifier that was actually removed, or `undefined` if none was removed.\n */\n public delete(classifier: SpatialClassifier): SpatialClassifier | undefined {\n const list = this._array;\n if (!list)\n return undefined;\n\n const classifierIndex = this._classifiers.findIndex((x) => x.equals(classifier));\n if (-1 === classifierIndex)\n return undefined;\n\n classifier = this._classifiers[classifierIndex];\n const propsIndex = list.findIndex((x) => classifier.equalsProps(x));\n assert(propsIndex === classifierIndex);\n if (-1 === propsIndex)\n return undefined;\n\n list.splice(propsIndex, 1);\n this._classifiers.splice(classifierIndex, 1);\n if (list.length === 0)\n this._json.classifiers = undefined;\n\n if (classifier === this.active)\n this._active = undefined;\n\n return classifier;\n }\n\n /** Remove all classifiers from this set. */\n public clear(): void {\n this._classifiers.length = 0;\n this._json.classifiers = undefined;\n this._active = undefined;\n }\n\n private get _array(): SpatialClassifierProps[] | undefined {\n return Array.isArray(this._json.classifiers) ? this._json.classifiers : undefined;\n }\n}\n\nfunction insideDisplay(display: number): SpatialClassifierInsideDisplay {\n switch (display) {\n case SpatialClassifierInsideDisplay.Off:\n case SpatialClassifierInsideDisplay.On:\n case SpatialClassifierInsideDisplay.Dimmed:\n case SpatialClassifierInsideDisplay.Hilite:\n case SpatialClassifierInsideDisplay.ElementColor:\n return display;\n default:\n return SpatialClassifierInsideDisplay.ElementColor;\n }\n}\n\nfunction outsideDisplay(display: number): SpatialClassifierOutsideDisplay {\n switch (display) {\n case SpatialClassifierOutsideDisplay.Off:\n case SpatialClassifierOutsideDisplay.On:\n case SpatialClassifierOutsideDisplay.Dimmed:\n return display;\n default:\n return SpatialClassifierOutsideDisplay.Dimmed;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SubCategoryAppearance.js","sourceRoot":"","sources":["../../src/SubCategoryAppearance.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,IAAI,EAAc,SAAS,EAAE,MAAM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I,IAAI,CAAC,UAAU;YACjB,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC;QAEtC,IAAI,IAAI,CAAC,iBAAiB;YACxB,GAAG,CAAC,UAAU,GAAG,IAAI,CAAC,iBAAiB,CAAC;QAE1C,OAAO,GAAG,CAAC;IACb,CAAC;IAEM,KAAK,KAA4B,OAAO,IAAI,qBAAqB,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC;;AAE5E,8BAAQ,GAAG,IAAI,qBAAqB,EAAE,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 Symbology\r\n */\r\n\r\nimport { Id64, Id64String, JsonUtils } from \"@itwin/core-bentley\";\r\nimport { ColorDef, ColorDefProps } from \"./ColorDef\";\r\n\r\n/** Parameters that define the way geometry on a [[SubCategory]] appears.\r\n * SubCategoryAppearance describes the intrinsic appearance of geometry belonging to that SubCategory, independent of a particular [[ViewState]].\r\n * Aspects of a SubCategory's appearance can be overridden in the context of a particular [[ViewState]] through the use of [[SubCategoryOverride]]s.\r\n * @public\r\n */\r\nexport class SubCategoryAppearance {\r\n /** The color of the geometry.\r\n * @note The transparency component of the color is ignored.\r\n * @see [[SubCategoryAppearance.transparency]].\r\n */\r\n public readonly color: ColorDef;\r\n /** The line width, in pixels.\r\n * @note The renderer will clamp values to the integer range [1, 32].\r\n */\r\n public readonly weight: number;\r\n /** The display priority used to control which geometry draws in front of other geometry within a 2D view.\r\n * The priority is a number in the range [-8388576,8388576].\r\n * Where two pieces of geometry overlap, the one with the larger priority value draws on top of the one with the smaller priority.\r\n * If they have equal priorities, the order in which they draw is undefined, and z-fighting may result.\r\n * @note This property has no effect in 3D views unless [[PlanProjectionSettings]] are in effect.\r\n */\r\n public readonly priority: number;\r\n /** A value in the range [0, 1] indicating the transparency of the geometry where 0.0 means \"fully opaque\" and 1.0 means \"fully transparent\". */\r\n public readonly transparency: number;\r\n /** If true, geometry belonging to this SubCategory is not drawn. */\r\n public readonly invisible: boolean;\r\n /** @internal */\r\n public readonly dontPlot: boolean;\r\n /** @internal */\r\n public readonly dontSnap: boolean;\r\n /** @internal */\r\n public readonly dontLocate: boolean;\r\n /** The element ID of the line style used to draw curves, or an invalid ID if no line style is specified. */\r\n public readonly styleId: Id64String;\r\n /** The element ID of the material applied to surfaces, or an invalid ID if no material is specified. */\r\n public readonly materialId: Id64String;\r\n /** @internal */\r\n protected readonly _fillColor?: ColorDef;\r\n /** @internal */\r\n protected readonly _fillTransparency?: number;\r\n\r\n /** The fill color of geometry marked as being filled.\r\n * @note The transparency component of the fill color is ignored.\r\n * @see [[SubCategoryAppearance.fillTransparency]].\r\n */\r\n public get fillColor(): ColorDef { return (undefined !== this._fillColor ? this._fillColor : this.color); }\r\n /** A value in the range [0, 1] indicating the fill transparency of the geometry where 0.0 means \"fully opaque\" and 1.0 means \"fully transparent\". */\r\n public get fillTransparency(): number { return (undefined !== this._fillTransparency ? this._fillTransparency : this.transparency); }\r\n\r\n constructor(props?: SubCategoryAppearance.Props) {\r\n if (!props) {\r\n this.color = ColorDef.black;\r\n this.weight = 0;\r\n this.priority = 0;\r\n this.transparency = 0;\r\n this.invisible = this.dontPlot = this.dontSnap = this.dontLocate = false;\r\n this.styleId = Id64.invalid;\r\n this.materialId = Id64.invalid;\r\n return;\r\n }\r\n\r\n this.invisible = JsonUtils.asBool(props.invisible);\r\n this.dontSnap = JsonUtils.asBool(props.dontSnap);\r\n this.dontLocate = JsonUtils.asBool(props.dontLocate);\r\n this.dontPlot = JsonUtils.asBool(props.dontPlot);\r\n this.color = ColorDef.fromJSON(props.color);\r\n this.weight = JsonUtils.asInt(props.weight);\r\n this.styleId = Id64.fromJSON(props.style);\r\n this.priority = JsonUtils.asInt(props.priority);\r\n this.materialId = Id64.fromJSON(props.material);\r\n this.transparency = JsonUtils.asDouble(props.transp);\r\n if (props.fill)\r\n this._fillColor = ColorDef.fromJSON(props.fill);\r\n if (props.transpFill)\r\n this._fillTransparency = JsonUtils.asDouble(props.transpFill);\r\n }\r\n\r\n public equals(other: SubCategoryAppearance): boolean {\r\n return this.invisible === other.invisible &&\r\n this.dontPlot === other.dontPlot &&\r\n this.dontSnap === other.dontSnap &&\r\n this.dontLocate === other.dontLocate &&\r\n this.color.equals(other.color) &&\r\n this.weight === other.weight &&\r\n this.priority === other.priority &&\r\n this.styleId === other.styleId &&\r\n this.materialId === other.materialId &&\r\n this.transparency === other.transparency &&\r\n this.fillColor.equals(other.fillColor) &&\r\n this.fillTransparency === other.fillTransparency;\r\n }\r\n\r\n /** @internal */\r\n public toJSON(): SubCategoryAppearance.Props {\r\n const val: SubCategoryAppearance.Props = { color: this.color.toJSON() };\r\n if (this.invisible)\r\n val.invisible = true;\r\n\r\n if (this.dontPlot)\r\n val.dontPlot = true;\r\n\r\n if (this.dontSnap)\r\n val.dontSnap = true;\r\n\r\n if (this.dontLocate)\r\n val.dontLocate = true;\r\n\r\n if (0 !== this.weight)\r\n val.weight = this.weight;\r\n\r\n if (0 !== this.priority)\r\n val.priority = this.priority;\r\n\r\n if (Id64.isValid(this.styleId))\r\n val.style = this.styleId;\r\n\r\n if (Id64.isValid(this.materialId))\r\n val.material = this.materialId;\r\n\r\n if (0.0 !== this.transparency)\r\n val.transp = this.transparency;\r\n\r\n if (this._fillColor)\r\n val.fill = this._fillColor.toJSON();\r\n\r\n if (this._fillTransparency)\r\n val.transpFill = this._fillTransparency;\r\n\r\n return val;\r\n }\r\n\r\n public clone(): SubCategoryAppearance { return new SubCategoryAppearance(this.toJSON()); }\r\n\r\n public static defaults = new SubCategoryAppearance();\r\n}\r\n\r\n/** @public */\r\nexport namespace SubCategoryAppearance {\r\n /** Properties used to create a SubCategoryAppearance\r\n * See [[SubCategoryAppearance]]\r\n */\r\n export interface Props {\r\n /** See [[SubCategoryAppearance.color]]. Defaults to black. */\r\n color?: ColorDefProps;\r\n /** See [[SubCategoryAppearance.fillColor]]. Defaults to [[SubCategoryAppearance.color]]. */\r\n fill?: ColorDefProps;\r\n /** See [[SubCategoryAppearance.invisible]]. Defaults to false. */\r\n invisible?: boolean;\r\n /** @internal */\r\n dontPlot?: boolean;\r\n /** @internal */\r\n dontSnap?: boolean;\r\n /** @internal */\r\n dontLocate?: boolean;\r\n /** See [[SubCategoryAppearance.weight]]. Defaults to 0. */\r\n weight?: number;\r\n /** See [[SubCategoryAppearance.styleId]]. Defaults to an invalid ID indicating \"no line style\". */\r\n style?: Id64String;\r\n /** See [[SubCategoryAppearance.priority]]. Defaults to 0. */\r\n priority?: number;\r\n /** See [[SubCategoryAppearance.materialId]]. Defaults to an invalid ID indicating \"no material\". */\r\n material?: Id64String;\r\n /** See [[SubCategoryAppearance.transparency]]. Defaults to 0. */\r\n transp?: number;\r\n /** See [[SubCategoryAppearance.fillTransparency]]. Defaults to [[SubCategoryAppearance.transparency]]. */\r\n transpFill?: number;\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"SubCategoryAppearance.js","sourceRoot":"","sources":["../../src/SubCategoryAppearance.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,IAAI,EAAc,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAiB,MAAM,YAAY,CAAC;AAErD;;;;GAIG;AACH,MAAM,OAAO,qBAAqB;IAoChC;;;OAGG;IACH,IAAW,SAAS,KAAe,OAAO,CAAC,SAAS,KAAK,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAC3G,qJAAqJ;IACrJ,IAAW,gBAAgB,KAAa,OAAO,CAAC,SAAS,KAAK,IAAI,CAAC,iBAAiB,CAAC,C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------------------------------------------------------------------\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 Symbology\n */\n\nimport { Id64, Id64String, JsonUtils } from \"@itwin/core-bentley\";\nimport { ColorDef, ColorDefProps } from \"./ColorDef\";\n\n/** Parameters that define the way geometry on a [[SubCategory]] appears.\n * SubCategoryAppearance describes the intrinsic appearance of geometry belonging to that SubCategory, independent of a particular [[ViewState]].\n * Aspects of a SubCategory's appearance can be overridden in the context of a particular [[ViewState]] through the use of [[SubCategoryOverride]]s.\n * @public\n */\nexport class SubCategoryAppearance {\n /** The color of the geometry.\n * @note The transparency component of the color is ignored.\n * @see [[SubCategoryAppearance.transparency]].\n */\n public readonly color: ColorDef;\n /** The line width, in pixels.\n * @note The renderer will clamp values to the integer range [1, 32].\n */\n public readonly weight: number;\n /** The display priority used to control which geometry draws in front of other geometry within a 2D view.\n * The priority is a number in the range [-8388576,8388576].\n * Where two pieces of geometry overlap, the one with the larger priority value draws on top of the one with the smaller priority.\n * If they have equal priorities, the order in which they draw is undefined, and z-fighting may result.\n * @note This property has no effect in 3D views unless [[PlanProjectionSettings]] are in effect.\n */\n public readonly priority: number;\n /** A value in the range [0, 1] indicating the transparency of the geometry where 0.0 means \"fully opaque\" and 1.0 means \"fully transparent\". */\n public readonly transparency: number;\n /** If true, geometry belonging to this SubCategory is not drawn. */\n public readonly invisible: boolean;\n /** @internal */\n public readonly dontPlot: boolean;\n /** @internal */\n public readonly dontSnap: boolean;\n /** @internal */\n public readonly dontLocate: boolean;\n /** The element ID of the line style used to draw curves, or an invalid ID if no line style is specified. */\n public readonly styleId: Id64String;\n /** The element ID of the material applied to surfaces, or an invalid ID if no material is specified. */\n public readonly materialId: Id64String;\n /** @internal */\n protected readonly _fillColor?: ColorDef;\n /** @internal */\n protected readonly _fillTransparency?: number;\n\n /** The fill color of geometry marked as being filled.\n * @note The transparency component of the fill color is ignored.\n * @see [[SubCategoryAppearance.fillTransparency]].\n */\n public get fillColor(): ColorDef { return (undefined !== this._fillColor ? this._fillColor : this.color); }\n /** A value in the range [0, 1] indicating the fill transparency of the geometry where 0.0 means \"fully opaque\" and 1.0 means \"fully transparent\". */\n public get fillTransparency(): number { return (undefined !== this._fillTransparency ? this._fillTransparency : this.transparency); }\n\n constructor(props?: SubCategoryAppearance.Props) {\n if (!props) {\n this.color = ColorDef.black;\n this.weight = 0;\n this.priority = 0;\n this.transparency = 0;\n this.invisible = this.dontPlot = this.dontSnap = this.dontLocate = false;\n this.styleId = Id64.invalid;\n this.materialId = Id64.invalid;\n return;\n }\n\n this.invisible = JsonUtils.asBool(props.invisible);\n this.dontSnap = JsonUtils.asBool(props.dontSnap);\n this.dontLocate = JsonUtils.asBool(props.dontLocate);\n this.dontPlot = JsonUtils.asBool(props.dontPlot);\n this.color = ColorDef.fromJSON(props.color);\n this.weight = JsonUtils.asInt(props.weight);\n this.styleId = Id64.fromJSON(props.style);\n this.priority = JsonUtils.asInt(props.priority);\n this.materialId = Id64.fromJSON(props.material);\n this.transparency = JsonUtils.asDouble(props.transp);\n if (props.fill)\n this._fillColor = ColorDef.fromJSON(props.fill);\n if (props.transpFill)\n this._fillTransparency = JsonUtils.asDouble(props.transpFill);\n }\n\n public equals(other: SubCategoryAppearance): boolean {\n return this.invisible === other.invisible &&\n this.dontPlot === other.dontPlot &&\n this.dontSnap === other.dontSnap &&\n this.dontLocate === other.dontLocate &&\n this.color.equals(other.color) &&\n this.weight === other.weight &&\n this.priority === other.priority &&\n this.styleId === other.styleId &&\n this.materialId === other.materialId &&\n this.transparency === other.transparency &&\n this.fillColor.equals(other.fillColor) &&\n this.fillTransparency === other.fillTransparency;\n }\n\n /** @internal */\n public toJSON(): SubCategoryAppearance.Props {\n const val: SubCategoryAppearance.Props = { color: this.color.toJSON() };\n if (this.invisible)\n val.invisible = true;\n\n if (this.dontPlot)\n val.dontPlot = true;\n\n if (this.dontSnap)\n val.dontSnap = true;\n\n if (this.dontLocate)\n val.dontLocate = true;\n\n if (0 !== this.weight)\n val.weight = this.weight;\n\n if (0 !== this.priority)\n val.priority = this.priority;\n\n if (Id64.isValid(this.styleId))\n val.style = this.styleId;\n\n if (Id64.isValid(this.materialId))\n val.material = this.materialId;\n\n if (0.0 !== this.transparency)\n val.transp = this.transparency;\n\n if (this._fillColor)\n val.fill = this._fillColor.toJSON();\n\n if (this._fillTransparency)\n val.transpFill = this._fillTransparency;\n\n return val;\n }\n\n public clone(): SubCategoryAppearance { return new SubCategoryAppearance(this.toJSON()); }\n\n public static defaults = new SubCategoryAppearance();\n}\n\n/** @public */\nexport namespace SubCategoryAppearance {\n /** Properties used to create a SubCategoryAppearance\n * See [[SubCategoryAppearance]]\n */\n export interface Props {\n /** See [[SubCategoryAppearance.color]]. Defaults to black. */\n color?: ColorDefProps;\n /** See [[SubCategoryAppearance.fillColor]]. Defaults to [[SubCategoryAppearance.color]]. */\n fill?: ColorDefProps;\n /** See [[SubCategoryAppearance.invisible]]. Defaults to false. */\n invisible?: boolean;\n /** @internal */\n dontPlot?: boolean;\n /** @internal */\n dontSnap?: boolean;\n /** @internal */\n dontLocate?: boolean;\n /** See [[SubCategoryAppearance.weight]]. Defaults to 0. */\n weight?: number;\n /** See [[SubCategoryAppearance.styleId]]. Defaults to an invalid ID indicating \"no line style\". */\n style?: Id64String;\n /** See [[SubCategoryAppearance.priority]]. Defaults to 0. */\n priority?: number;\n /** See [[SubCategoryAppearance.materialId]]. Defaults to an invalid ID indicating \"no material\". */\n material?: Id64String;\n /** See [[SubCategoryAppearance.transparency]]. Defaults to 0. */\n transp?: number;\n /** See [[SubCategoryAppearance.fillTransparency]]. Defaults to [[SubCategoryAppearance.transparency]]. */\n transpFill?: number;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SubCategoryOverride.js","sourceRoot":"","sources":["../../src/SubCategoryOverride.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;A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AS,KAAK,KAAK,CAAC,QAAQ;YAC9B,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QAChD,IAAI,SAAS,KAAK,KAAK,CAAC,QAAQ;YAC9B,IAAI,CAAC,QAAQ,GAAG,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QAClD,IAAI,SAAS,KAAK,KAAK,CAAC,MAAM;YAC5B,IAAI,CAAC,YAAY,GAAG,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IACzD,CAAC;;AAED,6DAA6D;AAC/C,4BAAQ,GAAG,IAAI,mBAAmB,CAAC,EAAE,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\
|
|
1
|
+
{"version":3,"file":"SubCategoryOverride.js","sourceRoot":"","sources":["../../src/SubCategoryOverride.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,IAAI,EAAc,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAEhE;;;;;;;;GAQG;AACH,MAAM,OAAO,mBAAmB;IAgB9B,yGAAyG;IACzG,IAAW,aAAa;QACtB,OAAO,SAAS,KAAK,IAAI,CAAC,SAAS,IAAI,SAAS,KAAK,IAAI,CAAC,KAAK,IAAI,SAAS,KAAK,IAAI,CAAC,MAAM,IAAI,SAAS,KAAK,IAAI,CAAC,KAAK,IAAI,SAAS,KAAK,IAAI,CAAC,QAAQ,IAAI,SAAS,KAAK,IAAI,CAAC,QAAQ,IAAI,SAAS,KAAK,IAAI,CAAC,YAAY,CAAC;IAC5N,CAAC;IAED,8GAA8G;IACvG,QAAQ,CAAC,UAAiC;QAC/C,IAAI,CAAC,IAAI,CAAC,aAAa;YACrB,OAA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AC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC;IAC5E,CAAC;IAED,YAAoB,KAAkC;QACpD,IAAI,SAAS,KAAK,KAAK,CAAC,SAAS;YAC/B,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;QACrD,IAAI,SAAS,KAAK,KAAK,CAAC,KAAK;YAC3B,IAAI,CAAC,KAAK,GAAG,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAC9C,IAAI,SAAS,KAAK,KAAK,CAAC,MAAM;YAC5B,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QAC9C,IAAI,SAAS,KAAK,KAAK,CAAC,KAAK;YAC3B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAC1C,IAAI,SAAS,KAAK,KAAK,CAAC,QAAQ;YAC9B,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QAChD,IAAI,SAAS,KAAK,KAAK,CAAC,QAAQ;YAC9B,IAAI,CAAC,QAAQ,GAAG,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QAClD,IAAI,SAAS,KAAK,KAAK,CAAC,MAAM;YAC5B,IAAI,CAAC,YAAY,GAAG,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IACzD,CAAC;;AAED,6DAA6D;AAC/C,4BAAQ,GAAG,IAAI,mBAAmB,CAAC,EAAE,CAAC,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 DisplayStyles\n */\n\nimport { Id64, Id64String, JsonUtils } from \"@itwin/core-bentley\";\nimport { ColorDef } from \"./ColorDef\";\nimport { SubCategoryAppearance } from \"./SubCategoryAppearance\";\n\n/** Overrides selected aspects of a [[SubCategoryAppearance]] in the context of a [[DisplayStyleState]].\n * When determining how geometry belonging to a [[SubCategory]] will appear when drawn within a view:\n * 1. The base [[SubCategoryAppearance]] associated with that subcategory is obtained.\n * 2. The [[SubCategoryOverride]] associated with that subcategory in the [[DisplayStyleState]] is obtained.\n * 3. Any aspects of the appearance overridden by the SubCategoryOverride are replaced with the values from the SubCategoryOverride.\n * An aspect is overridden by virtue of not being set to \"undefined\" in the SubCategoryOverride.\n * @see [[DisplayStyleState.overrideSubCategory]]\n * @public\n */\nexport class SubCategoryOverride {\n /** See [[SubCategoryAppearance.color]] */\n public readonly color?: ColorDef;\n /** See [[SubCategoryAppearance.invisible]] */\n public readonly invisible?: boolean;\n /** See [[SubCategoryAppearance.weight]] */\n public readonly weight?: number;\n /** @internal Overriding with arbitrary custom line style is not supported - overriding with LinePixels enum could be. */\n public readonly style?: Id64String;\n /** See [[SubCategoryAppearance.priority]] */\n public readonly priority?: number;\n /** See [[SubCategoryAppearance.materialId]] */\n public readonly material?: Id64String;\n /** See [[SubCategoryAppearance.transparency]] */\n public readonly transparency?: number;\n\n /** Returns true if any aspect of the appearance is overridden (i.e., if any member is not undefined). */\n public get anyOverridden(): boolean {\n return undefined !== this.invisible || undefined !== this.color || undefined !== this.weight || undefined !== this.style || undefined !== this.priority || undefined !== this.material || undefined !== this.transparency;\n }\n\n /** Returns a SubCategoryAppearance overridden to match the properties defined by this SubCategoryOverride. */\n public override(appearance: SubCategoryAppearance): SubCategoryAppearance {\n if (!this.anyOverridden)\n return appearance;\n\n const props = appearance.toJSON();\n const ovrProps = this.toJSON();\n if (undefined !== ovrProps.invisible)\n props.invisible = ovrProps.invisible;\n if (undefined !== ovrProps.weight)\n props.weight = ovrProps.weight;\n if (undefined !== ovrProps.style)\n props.style = ovrProps.style;\n if (undefined !== ovrProps.material)\n props.material = ovrProps.material;\n if (undefined !== ovrProps.priority)\n props.priority = ovrProps.priority;\n if (undefined !== ovrProps.transp)\n props.transp = ovrProps.transp;\n if (undefined !== ovrProps.color)\n props.color = ovrProps.color;\n\n return new SubCategoryAppearance(props);\n }\n\n /** Convert this SubCategoryOverride to a JSON object\n * @internal\n */\n public toJSON(): SubCategoryAppearance.Props {\n const props: SubCategoryAppearance.Props = {};\n if (undefined !== this.invisible)\n props.invisible = this.invisible;\n\n if (undefined !== this.weight)\n props.weight = this.weight;\n\n if (undefined !== this.style)\n props.style = this.style;\n\n if (undefined !== this.material)\n props.material = this.material;\n\n if (undefined !== this.priority)\n props.priority = this.priority;\n\n if (undefined !== this.transparency)\n props.transp = this.transparency;\n\n if (undefined !== this.color)\n props.color = this.color.toJSON();\n\n return props;\n }\n\n /** Perform equality comparison against another SubCategoryOverride. */\n public equals(other: SubCategoryOverride): boolean {\n if (this.invisible !== other.invisible || this.weight !== other.weight || this.style !== other.style\n || this.priority !== other.priority || this.material !== other.material || this.transparency !== other.transparency)\n return false;\n\n if (undefined !== this.color && undefined !== other.color)\n return this.color.tbgr === other.color.tbgr;\n else\n return undefined === this.color && undefined === other.color;\n }\n\n /** Create a new SubCategoryOverride from a JSON object */\n public static fromJSON(json?: SubCategoryAppearance.Props): SubCategoryOverride {\n return undefined !== json ? new SubCategoryOverride(json) : this.defaults;\n }\n\n private constructor(props: SubCategoryAppearance.Props) {\n if (undefined !== props.invisible)\n this.invisible = JsonUtils.asBool(props.invisible);\n if (undefined !== props.color)\n this.color = ColorDef.fromJSON(props.color);\n if (undefined !== props.weight)\n this.weight = JsonUtils.asInt(props.weight);\n if (undefined !== props.style)\n this.style = Id64.fromJSON(props.style);\n if (undefined !== props.material)\n this.material = Id64.fromJSON(props.material);\n if (undefined !== props.priority)\n this.priority = JsonUtils.asInt(props.priority);\n if (undefined !== props.transp)\n this.transparency = JsonUtils.asDouble(props.transp);\n }\n\n /** A default SubCategoryOverride which overrides nothing. */\n public static defaults = new SubCategoryOverride({});\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TerrainSettings.js","sourceRoot":"","sources":["../../src/TerrainSettings.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAYH;;;;;GAKG;AACH,MAAM,CAAN,IAAY,oBAKX;AALD,WAAY,oBAAoB;IAC9B,yGAAyG;IACzG,qCAAa,CAAA;IACb,gJAAgJ;IAChJ,8CAAsB,CAAA;AACxB,CAAC,EALW,oBAAoB,KAApB,oBAAoB,QAK/B;AAiCD;;;;GAIG;AACH,MAAM,CAAN,IAAY,uBAOX;AAPD,WAAY,uBAAuB;IACjC,sHAAsH;IACtH,6EAAY,CAAA;IACZ,0GAA0G;IAC1G,uEAAS,CAAA;IACT,yGAAyG;IACzG,yEAAU,CAAA;AACZ,CAAC,EAPW,uBAAuB,KAAvB,uBAAuB,QAOlC;AAED;;GAEG;AACH,MAAM,OAAO,eAAe;IAoB1B;;;OAGG;IACH,IAAW,YAAY;QACrB,OAAO,IAAI,CAAC,aAAa,CAAC;IAC5B,CAAC;IAOD,gBAAgB;IAChB,YAAY,mBAAsD,EAAE,YAAqB,EAAE,aAAuB,EAAE,YAAqB,EAAE,gBAA0C;QACnL,IAAI,YAAY,CAAC;QACjB,IAAI,UAAU,CAAC;QACf,IAAI,YAAY,CAAC;QACjB,IAAI,OAAO,mBAAmB,KAAK,QAAQ,EAAE,CAAC;YAC5C,YAAY,GAAG,mBAAmB,CAAC;QACrC,CAAC;aAAM,IAAI,mBAAmB,EAAE,CAAC;YAC/B,CAAC,EAAE,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,gBAAgB,EAAE,YAAY,EAAE,GAAG,mBAAmB,CAAC,CAAC;QAClI,CAAC;QAED,IAAI,CAAC,YAAY,GAAG,YAAY,IAAI,oBAAoB,CAAC;QACzD,IAAI,CAAC,UAAU,GAAG,UA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Y,CAAC,aAAa,IAAI,IAAI,CAAC,aAAa;YAC/D,YAAY,EAAE,YAAY,CAAC,YAAY,IAAI,IAAI,CAAC,YAAY;YAC5D,gBAAgB,EAAE,YAAY,CAAC,gBAAgB,IAAI,IAAI,CAAC,gBAAgB;SACzE,CAAC;QAEF,OAAO,eAAe,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACzC,CAAC;CACF","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 DisplayStyles\r\n */\r\n\r\nimport { BackgroundMapProps } from \"./BackgroundMapSettings\";\r\n\r\n/** Identifies a [TerrainProvider]($frontend).\r\n * @see [[TerrainSettings.providerName]] and [[TerrainProps.providerName]].\r\n * @public\r\n * @extensions\r\n * @deprecated in 3.x. Use string instead.\r\n */\r\nexport type TerrainProviderName = string;\r\n\r\n/** Ids of [Cesium ION assets](https://cesium.com/platform/cesium-ion/content/) providing global terrain data.\r\n * These values are appropriate to use with [[TerrainSettings.dataSource]] when [[TerrainSettings.providerName]] is set to \"CesiumWorldTerrain\".\r\n * You may alternatively use the Id of any ION asset to which you have access.\r\n * @see [[TerrainSettings.fromCesiumIonAsset]] to create TerrainSettings that obtain terrain from a specified ION asset.\r\n * @public\r\n */\r\nexport enum CesiumTerrainAssetId {\r\n /** Default [global 3d terrain](https://cesium.com/platform/cesium-ion/content/cesium-world-terrain/). */\r\n Default = \"1\",\r\n /** Global 3d terrain that includes [bathymetry](https://cesium.com/platform/cesium-ion/content/cesium-world-bathymetry/) (seafloor) terrain. */\r\n Bathymetry = \"2426648\",\r\n}\r\n\r\n/** JSON representation of the settings of the terrain applied to background map display by a [[DisplayStyle]].\r\n * @see [[DisplayStyleSettingsProps]]\r\n * @see [[BackgroundMapProps]]\r\n * @public\r\n * @extensions\r\n */\r\nexport interface TerrainProps {\r\n /** Identifies the [TerrainProvider]($frontend) that will supply terrain meshes.\r\n * If omitted, it defaults to \"CesiumWorldTerrain\".\r\n */\r\n providerName?: string;\r\n /** Identifies the specific terrain data source to be supplied by the [TerrainProvider]($frontend) identified by [[providerName]],\r\n * for those providers that support multiple data sources.\r\n * For example, the \"CesiumWorldTerrain\" provider uses this field to store a [[CesiumTerrainAssetId]].\r\n * Default value: an empty string.\r\n */\r\n dataSource?: string;\r\n /** A value greater than one will cause terrain height to be exaggerated/scaled.false (or 1.0) indicate no exaggeration. Default value: 1.0 */\r\n exaggeration?: number;\r\n /** Applying lighting can help to visualize subtle terrain variation. Default value: true */\r\n applyLighting?: boolean;\r\n /** Origin value - height of the IModel origin at the project center as defined by heightOriginMode. Default value: 0.0 */\r\n heightOrigin?: number;\r\n /** Determines how/if the heightOrigin is applied to the terrain height. Default value: Geodetic */\r\n heightOriginMode?: TerrainHeightOriginMode;\r\n /** If true, the terrain will not be locatable. Otherwise, [[BackgroundMapProps.nonLocatable]] will determine whether terrain is locatable.\r\n * @internal use [[BackgroundMapProps.nonLocatable]]. Retained for backwards compatibility only.\r\n */\r\n nonLocatable?: boolean;\r\n}\r\n\r\n/** Correction modes for terrain height\r\n * @see [[TerrainProps]]\r\n * @public\r\n * @extensions\r\n */\r\nexport enum TerrainHeightOriginMode {\r\n /** Height value indicates the geodetic height of the IModel origin (also referred to as ellipsoidal or GPS height) */\r\n Geodetic = 0,\r\n /** Height value indicates the geoidal height of the IModel origin (commonly referred to as sea level). */\r\n Geoid = 1,\r\n /** Height value indicates the height of the IModel origin relative to ground level at project center. */\r\n Ground = 2,\r\n}\r\n\r\n/** Normalized version of [[TerrainProps]] for which provider has been validated and default values of all members are used.\r\n * @public\r\n */\r\nexport class TerrainSettings {\r\n private _nonLocatable: true | undefined;\r\n /** Identifies the [TerrainProvider]($frontend) that will supply terrain meshes.\r\n * Defaults to \"CesiumWorldTerrain\".\r\n */\r\n public readonly providerName: string;\r\n /** Identifies the specific terrain data source to be supplied by the [TerrainProvider]($frontend) identified by [[providerName]],\r\n * for those providers that support multiple data sources.\r\n * For example, the \"CesiumWorldTerrain\" provider uses this field to store a [[CesiumTerrainAssetId]].\r\n * Default value: an empty string.\r\n */\r\n public readonly dataSource: string;\r\n /** A value greater than one will cause terrain height to be exaggerated/scaled. 1.0 indicates no exaggeration. Default value: 1.0 */\r\n public readonly exaggeration: number;\r\n /** Applying lighting can help to visualize subtle terrain variations. Default value: false */\r\n public readonly applyLighting: boolean;\r\n /** Origin value - height of the IModel origin at the project center as defined by heightOriginMode. Default value 0.0 */\r\n public readonly heightOrigin: number;\r\n /** Determines how/if the heightOrigin is applied to the terrain height. Default value: Geodetic */\r\n public readonly heightOriginMode: TerrainHeightOriginMode;\r\n /** Optionally overrides [[BackgroundMapSettings.locatable]]. For backwards compatibility only.\r\n * @see [[TerrainProps.nonLocatable]].\r\n * @internal\r\n */\r\n public get nonLocatable(): true | undefined {\r\n return this._nonLocatable;\r\n }\r\n\r\n /** @deprecated in 4.5.x. Use the overload that takes [[TerrainProps]]. */\r\n constructor(providerName?: string, exaggeration?: number, applyLighting?: boolean, heightOrigin?: number, heightOriginMode?: TerrainHeightOriginMode);\r\n\r\n constructor(props?: TerrainProps);\r\n\r\n /** @internal */\r\n constructor(providerNameOrProps: string | TerrainProps | undefined, exaggeration?: number, applyLighting?: boolean, heightOrigin?: number, heightOriginMode?: TerrainHeightOriginMode) {\r\n let providerName;\r\n let dataSource;\r\n let nonLocatable;\r\n if (typeof providerNameOrProps === \"string\") {\r\n providerName = providerNameOrProps;\r\n } else if (providerNameOrProps) {\r\n ({ providerName, dataSource, exaggeration, applyLighting, heightOrigin, heightOriginMode, nonLocatable } = providerNameOrProps);\r\n }\r\n\r\n this.providerName = providerName ?? \"CesiumWorldTerrain\";\r\n this.dataSource = dataSource ?? \"\";\r\n this.exaggeration = Math.min(100, Math.max(0.1, exaggeration ?? 1.0));\r\n this.applyLighting = applyLighting ?? false;\r\n this.heightOrigin = heightOrigin ?? 0.0;\r\n\r\n if (true === nonLocatable)\r\n this._nonLocatable = true;\r\n\r\n switch (heightOriginMode) {\r\n case TerrainHeightOriginMode.Ground:\r\n case TerrainHeightOriginMode.Geoid:\r\n this.heightOriginMode = heightOriginMode;\r\n break;\r\n default:\r\n this.heightOriginMode = TerrainHeightOriginMode.Geodetic;\r\n break;\r\n }\r\n }\r\n\r\n public static fromJSON(json?: TerrainProps) {\r\n return new TerrainSettings(json);\r\n }\r\n\r\n /** Create settings that obtain terrain from a [Cesium ION asset](https://cesium.com/platform/cesium-ion/content/) such as\r\n * one of those defined by [[CesiumTerrainAssetId]].\r\n * @note You must ensure your Cesium ION account has access to the specified asset.\r\n */\r\n public static fromCesiumIonAsset(assetId: string = CesiumTerrainAssetId.Default, options?: Omit<TerrainProps, \"providerName\" | \"dataSource\">): TerrainSettings {\r\n return TerrainSettings.fromJSON({\r\n ...options,\r\n dataSource: assetId,\r\n });\r\n }\r\n\r\n public toJSON(): TerrainProps {\r\n const props: TerrainProps = { heightOriginMode: this.heightOriginMode };\r\n if (\"CesiumWorldTerrain\" !== this.providerName)\r\n props.providerName = this.providerName;\r\n if (this.dataSource)\r\n props.dataSource = this.dataSource;\r\n if (1 !== this.exaggeration)\r\n props.exaggeration = this.exaggeration;\r\n if (this.nonLocatable)\r\n props.nonLocatable = true;\r\n if (this.applyLighting)\r\n props.applyLighting = true;\r\n if (0 !== this.heightOrigin)\r\n props.heightOrigin = this.heightOrigin;\r\n\r\n return props;\r\n }\r\n\r\n public equals(other: TerrainSettings): boolean {\r\n return this.providerName === other.providerName && this.dataSource === other.dataSource && this.exaggeration === other.exaggeration && this.applyLighting === other.applyLighting\r\n && this.heightOrigin === other.heightOrigin && this.heightOriginMode === other.heightOriginMode && this.nonLocatable === other.nonLocatable;\r\n }\r\n\r\n /** Returns true if these settings are equivalent to the supplied JSON settings. */\r\n public equalsJSON(json?: BackgroundMapProps): boolean {\r\n return this.equals(TerrainSettings.fromJSON(json));\r\n }\r\n\r\n /** Create a copy of this TerrainSettings, optionally modifying some of its properties.\r\n * @param changedProps JSON representation of the properties to change.\r\n * @returns A TerrainSettings with all of its properties set to match those of`this`, except those explicitly defined in `changedProps`.\r\n */\r\n public clone(changedProps?: TerrainProps): TerrainSettings {\r\n if (undefined === changedProps)\r\n return this;\r\n\r\n const props = {\r\n providerName: changedProps.providerName ?? this.providerName,\r\n dataSource: changedProps.dataSource ?? this.dataSource,\r\n exaggeration: changedProps.exaggeration ?? this.exaggeration,\r\n nonLocatable: changedProps.nonLocatable ?? this.nonLocatable,\r\n applyLighting: changedProps.applyLighting ?? this.applyLighting,\r\n heightOrigin: changedProps.heightOrigin ?? this.heightOrigin,\r\n heightOriginMode: changedProps.heightOriginMode ?? this.heightOriginMode,\r\n };\r\n\r\n return TerrainSettings.fromJSON(props);\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"TerrainSettings.js","sourceRoot":"","sources":["../../src/TerrainSettings.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAYH;;;;;GAKG;AACH,MAAM,CAAN,IAAY,oBAKX;AALD,WAAY,oBAAoB;IAC9B,yGAAyG;IACzG,qCAAa,CAAA;IACb,gJAAgJ;IAChJ,8CAAsB,CAAA;AACxB,CAAC,EALW,oBAAoB,KAApB,oBAAoB,QAK/B;AAiCD;;;;GAIG;AACH,MAAM,CAAN,IAAY,uBAOX;AAPD,WAAY,uBAAuB;IACjC,sHAAsH;IACtH,6EAAY,CAAA;IACZ,0GAA0G;IAC1G,uEAAS,CAAA;IACT,yGAAyG;IACzG,yEAAU,CAAA;AACZ,CAAC,EAPW,uBAAuB,KAAvB,uBAAuB,QAOlC;AAED;;GAEG;AACH,MAAM,OAAO,eAAe;IAoB1B;;;OAGG;IACH,IAAW,YAAY;QACrB,OAAO,IAAI,CAAC,aAAa,CAAC;IAC5B,CAAC;IAOD,gBAAgB;IAChB,YAAY,mBAAsD,EAAE,YAAqB,EAAE,aAAuB,EAAE,YA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M,CAAC,eAAe,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;IACrD,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,YAA2B;QACtC,IAAI,SAAS,KAAK,YAAY;YAC5B,OAAO,IAAI,CAAC;QAEd,MAAM,KAAK,GAAG;YACZ,YAAY,EAAE,YAAY,CAAC,YAAY,IAAI,IAAI,CAAC,YAAY;YAC5D,UAAU,EAAE,YAAY,CAAC,UAAU,IAAI,IAAI,CAAC,UAAU;YACtD,YAAY,EAAE,YAAY,CAAC,YAAY,IAAI,IAAI,CAAC,YAAY;YAC5D,YAAY,EAAE,YAAY,CAAC,YAAY,IAAI,IAAI,CAAC,YAAY;YAC5D,aAAa,EAAE,YAAY,CAAC,aAAa,IAAI,IAAI,CAAC,aAAa;YAC/D,YAAY,EAAE,YAAY,CAAC,YAAY,IAAI,IAAI,CAAC,YAAY;YAC5D,gBAAgB,EAAE,YAAY,CAAC,gBAAgB,IAAI,IAAI,CAAC,gBAAgB;SACzE,CAAC;QAEF,OAAO,eAAe,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACzC,CAAC;CACF","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 DisplayStyles\n */\n\nimport { BackgroundMapProps } from \"./BackgroundMapSettings\";\n\n/** Identifies a [TerrainProvider]($frontend).\n * @see [[TerrainSettings.providerName]] and [[TerrainProps.providerName]].\n * @public\n * @extensions\n * @deprecated in 3.x. Use string instead.\n */\nexport type TerrainProviderName = string;\n\n/** Ids of [Cesium ION assets](https://cesium.com/platform/cesium-ion/content/) providing global terrain data.\n * These values are appropriate to use with [[TerrainSettings.dataSource]] when [[TerrainSettings.providerName]] is set to \"CesiumWorldTerrain\".\n * You may alternatively use the Id of any ION asset to which you have access.\n * @see [[TerrainSettings.fromCesiumIonAsset]] to create TerrainSettings that obtain terrain from a specified ION asset.\n * @public\n */\nexport enum CesiumTerrainAssetId {\n /** Default [global 3d terrain](https://cesium.com/platform/cesium-ion/content/cesium-world-terrain/). */\n Default = \"1\",\n /** Global 3d terrain that includes [bathymetry](https://cesium.com/platform/cesium-ion/content/cesium-world-bathymetry/) (seafloor) terrain. */\n Bathymetry = \"2426648\",\n}\n\n/** JSON representation of the settings of the terrain applied to background map display by a [[DisplayStyle]].\n * @see [[DisplayStyleSettingsProps]]\n * @see [[BackgroundMapProps]]\n * @public\n * @extensions\n */\nexport interface TerrainProps {\n /** Identifies the [TerrainProvider]($frontend) that will supply terrain meshes.\n * If omitted, it defaults to \"CesiumWorldTerrain\".\n */\n providerName?: string;\n /** Identifies the specific terrain data source to be supplied by the [TerrainProvider]($frontend) identified by [[providerName]],\n * for those providers that support multiple data sources.\n * For example, the \"CesiumWorldTerrain\" provider uses this field to store a [[CesiumTerrainAssetId]].\n * Default value: an empty string.\n */\n dataSource?: string;\n /** A value greater than one will cause terrain height to be exaggerated/scaled.false (or 1.0) indicate no exaggeration. Default value: 1.0 */\n exaggeration?: number;\n /** Applying lighting can help to visualize subtle terrain variation. Default value: true */\n applyLighting?: boolean;\n /** Origin value - height of the IModel origin at the project center as defined by heightOriginMode. Default value: 0.0 */\n heightOrigin?: number;\n /** Determines how/if the heightOrigin is applied to the terrain height. Default value: Geodetic */\n heightOriginMode?: TerrainHeightOriginMode;\n /** If true, the terrain will not be locatable. Otherwise, [[BackgroundMapProps.nonLocatable]] will determine whether terrain is locatable.\n * @internal use [[BackgroundMapProps.nonLocatable]]. Retained for backwards compatibility only.\n */\n nonLocatable?: boolean;\n}\n\n/** Correction modes for terrain height\n * @see [[TerrainProps]]\n * @public\n * @extensions\n */\nexport enum TerrainHeightOriginMode {\n /** Height value indicates the geodetic height of the IModel origin (also referred to as ellipsoidal or GPS height) */\n Geodetic = 0,\n /** Height value indicates the geoidal height of the IModel origin (commonly referred to as sea level). */\n Geoid = 1,\n /** Height value indicates the height of the IModel origin relative to ground level at project center. */\n Ground = 2,\n}\n\n/** Normalized version of [[TerrainProps]] for which provider has been validated and default values of all members are used.\n * @public\n */\nexport class TerrainSettings {\n private _nonLocatable: true | undefined;\n /** Identifies the [TerrainProvider]($frontend) that will supply terrain meshes.\n * Defaults to \"CesiumWorldTerrain\".\n */\n public readonly providerName: string;\n /** Identifies the specific terrain data source to be supplied by the [TerrainProvider]($frontend) identified by [[providerName]],\n * for those providers that support multiple data sources.\n * For example, the \"CesiumWorldTerrain\" provider uses this field to store a [[CesiumTerrainAssetId]].\n * Default value: an empty string.\n */\n public readonly dataSource: string;\n /** A value greater than one will cause terrain height to be exaggerated/scaled. 1.0 indicates no exaggeration. Default value: 1.0 */\n public readonly exaggeration: number;\n /** Applying lighting can help to visualize subtle terrain variations. Default value: false */\n public readonly applyLighting: boolean;\n /** Origin value - height of the IModel origin at the project center as defined by heightOriginMode. Default value 0.0 */\n public readonly heightOrigin: number;\n /** Determines how/if the heightOrigin is applied to the terrain height. Default value: Geodetic */\n public readonly heightOriginMode: TerrainHeightOriginMode;\n /** Optionally overrides [[BackgroundMapSettings.locatable]]. For backwards compatibility only.\n * @see [[TerrainProps.nonLocatable]].\n * @internal\n */\n public get nonLocatable(): true | undefined {\n return this._nonLocatable;\n }\n\n /** @deprecated in 4.5.x. Use the overload that takes [[TerrainProps]]. */\n constructor(providerName?: string, exaggeration?: number, applyLighting?: boolean, heightOrigin?: number, heightOriginMode?: TerrainHeightOriginMode);\n\n constructor(props?: TerrainProps);\n\n /** @internal */\n constructor(providerNameOrProps: string | TerrainProps | undefined, exaggeration?: number, applyLighting?: boolean, heightOrigin?: number, heightOriginMode?: TerrainHeightOriginMode) {\n let providerName;\n let dataSource;\n let nonLocatable;\n if (typeof providerNameOrProps === \"string\") {\n providerName = providerNameOrProps;\n } else if (providerNameOrProps) {\n ({ providerName, dataSource, exaggeration, applyLighting, heightOrigin, heightOriginMode, nonLocatable } = providerNameOrProps);\n }\n\n this.providerName = providerName ?? \"CesiumWorldTerrain\";\n this.dataSource = dataSource ?? \"\";\n this.exaggeration = Math.min(100, Math.max(0.1, exaggeration ?? 1.0));\n this.applyLighting = applyLighting ?? false;\n this.heightOrigin = heightOrigin ?? 0.0;\n\n if (true === nonLocatable)\n this._nonLocatable = true;\n\n switch (heightOriginMode) {\n case TerrainHeightOriginMode.Ground:\n case TerrainHeightOriginMode.Geoid:\n this.heightOriginMode = heightOriginMode;\n break;\n default:\n this.heightOriginMode = TerrainHeightOriginMode.Geodetic;\n break;\n }\n }\n\n public static fromJSON(json?: TerrainProps) {\n return new TerrainSettings(json);\n }\n\n /** Create settings that obtain terrain from a [Cesium ION asset](https://cesium.com/platform/cesium-ion/content/) such as\n * one of those defined by [[CesiumTerrainAssetId]].\n * @note You must ensure your Cesium ION account has access to the specified asset.\n */\n public static fromCesiumIonAsset(assetId: string = CesiumTerrainAssetId.Default, options?: Omit<TerrainProps, \"providerName\" | \"dataSource\">): TerrainSettings {\n return TerrainSettings.fromJSON({\n ...options,\n dataSource: assetId,\n });\n }\n\n public toJSON(): TerrainProps {\n const props: TerrainProps = { heightOriginMode: this.heightOriginMode };\n if (\"CesiumWorldTerrain\" !== this.providerName)\n props.providerName = this.providerName;\n if (this.dataSource)\n props.dataSource = this.dataSource;\n if (1 !== this.exaggeration)\n props.exaggeration = this.exaggeration;\n if (this.nonLocatable)\n props.nonLocatable = true;\n if (this.applyLighting)\n props.applyLighting = true;\n if (0 !== this.heightOrigin)\n props.heightOrigin = this.heightOrigin;\n\n return props;\n }\n\n public equals(other: TerrainSettings): boolean {\n return this.providerName === other.providerName && this.dataSource === other.dataSource && this.exaggeration === other.exaggeration && this.applyLighting === other.applyLighting\n && this.heightOrigin === other.heightOrigin && this.heightOriginMode === other.heightOriginMode && this.nonLocatable === other.nonLocatable;\n }\n\n /** Returns true if these settings are equivalent to the supplied JSON settings. */\n public equalsJSON(json?: BackgroundMapProps): boolean {\n return this.equals(TerrainSettings.fromJSON(json));\n }\n\n /** Create a copy of this TerrainSettings, optionally modifying some of its properties.\n * @param changedProps JSON representation of the properties to change.\n * @returns A TerrainSettings with all of its properties set to match those of`this`, except those explicitly defined in `changedProps`.\n */\n public clone(changedProps?: TerrainProps): TerrainSettings {\n if (undefined === changedProps)\n return this;\n\n const props = {\n providerName: changedProps.providerName ?? this.providerName,\n dataSource: changedProps.dataSource ?? this.dataSource,\n exaggeration: changedProps.exaggeration ?? this.exaggeration,\n nonLocatable: changedProps.nonLocatable ?? this.nonLocatable,\n applyLighting: changedProps.applyLighting ?? this.applyLighting,\n heightOrigin: changedProps.heightOrigin ?? this.heightOrigin,\n heightOriginMode: changedProps.heightOriginMode ?? this.heightOriginMode,\n };\n\n return TerrainSettings.fromJSON(props);\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextureMapping.js","sourceRoot":"","sources":["../../src/TextureMapping.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAA0B,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAmB,SAAS,EAAE,QAAQ,EAAS,MAAM,sBAAsB,CAAC;AAEvI,OAAO,EAAE,eAAe,EAAE,0BAA0B,EAAE,cAAc,EAAE,yBAAyB,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAkBvJ,SAAS,sBAAsB,CAAC,GAAoB,EAAE,GAAoB;IACxE,OAAO,wBAAwB,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,SAAS,EAAE,GAAG,CAAC,SAAS,CAAC;WACpF,0BAA0B,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,IAAI,yBAAyB,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,KAAK,CAAC;WACvG,0BAA0B,CAAC,GAAG,CAAC,cAAc,EAAE,GAAG,CAAC,cA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AC,CAAC;gBAElD,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC;gBACvC,WAAW,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;YACpD,CAAC;YACD,OAAO,MAAM,CAAC;QAChB,CAAC;KACF;IAtJY,qBAAM,SAsJlB,CAAA;AACH,CAAC,EAjRgB,cAAc,KAAd,cAAc,QAiR9B;AAED,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,QAAQ,CAAC,QAAQ,CAAC,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 Rendering\r\n */\r\n\r\nimport { IndexedPolyfaceVisitor, Matrix3d, Point2d, Point3d, PolyfaceVisitor, Transform, Vector3d, XAndY } from \"@itwin/core-geometry\";\r\nimport { RenderTexture } from \"./RenderTexture\";\r\nimport { compareBooleans, compareBooleansOrUndefined, compareNumbers, compareNumbersOrUndefined, comparePossiblyUndefined } from \"@itwin/core-bentley\";\r\n\r\n/** Defines normal map parameters.\r\n * @beta\r\n */\r\nexport interface NormalMapParams {\r\n /** The texture to use as a normal map. If not present then the pattern map texture will be used as a normal map. */\r\n normalMap?: RenderTexture;\r\n /** True if the Y component stored in the green channel should be negated. By default, positive Y points downward, but some\r\n * normal maps are created with positive Y pointing upward.\r\n */\r\n greenUp?: boolean;\r\n /** Scale factor by which to multiply the components of the normal extracted from [[normalMap]]. */\r\n scale?: number;\r\n /** True if want to use constant LOD texture mapping for the normal map texture. */\r\n useConstantLod?: boolean;\r\n}\r\n\r\nfunction compareNormalMapParams(lhs: NormalMapParams, rhs: NormalMapParams): number {\r\n return comparePossiblyUndefined((lh, rh) => lh.compare(rh), lhs.normalMap, rhs.normalMap)\r\n || compareBooleansOrUndefined(lhs.greenUp, rhs.greenUp) || compareNumbersOrUndefined(lhs.scale, rhs.scale)\r\n || compareBooleansOrUndefined(lhs.useConstantLod, rhs.useConstantLod);\r\n}\r\n\r\n/** Describes how to map a [[RenderTexture]]'s image onto a surface as part of a [[RenderMaterial]].\r\n * @public\r\n */\r\nexport class TextureMapping {\r\n /** The texture to be mapped to the surface. If normalMapParams is present but does not contain a normal map, then texture is used as a normal map rather than a pattern map. */\r\n public readonly texture: RenderTexture;\r\n /** The parameters for normal mapping.\r\n * @beta\r\n */\r\n public normalMapParams?: NormalMapParams;\r\n /** The parameters describing how the textures are mapped to the surface. */\r\n public readonly params: TextureMapping.Params;\r\n\r\n public constructor(tx: RenderTexture, params: TextureMapping.Params) {\r\n this.texture = tx;\r\n this.params = params;\r\n }\r\n\r\n /** @internal */\r\n public computeUVParams(visitor: PolyfaceVisitor, transformToImodel: Transform): Point2d[] | undefined {\r\n return this.params.computeUVParams(visitor as IndexedPolyfaceVisitor, transformToImodel);\r\n }\r\n\r\n /** An [OrderedComparator]($bentley) that compares this mapping against `other`. */\r\n public compare(other: TextureMapping): number {\r\n if (this === other) {\r\n return 0;\r\n }\r\n\r\n return this.texture.compare(other.texture) || this.params.compare(other.params)\r\n || comparePossiblyUndefined((lh, rh) => compareNormalMapParams(lh, rh), this.normalMapParams, other.normalMapParams);\r\n }\r\n}\r\n\r\n/** @public */\r\nexport namespace TextureMapping {\r\n /** Enumerates the possible texture mapping modes. */\r\n export enum Mode {\r\n None = -1,\r\n Parametric = 0,\r\n ElevationDrape = 1,\r\n Planar = 2,\r\n /** @internal */\r\n DirectionalDrape = 3,\r\n /** @internal */\r\n Cubic = 4,\r\n /** @internal */\r\n Spherical = 5,\r\n /** @internal */\r\n Cylindrical = 6,\r\n /** @internal */\r\n Solid = 7,\r\n /** @internal Only valid for lights */\r\n FrontProject = 8,\r\n }\r\n\r\n /** A 2x3 matrix for mapping a texture image to a surface. */\r\n export class Trans2x3 {\r\n /** The 3x4 transform produced from the 2x3 matrix. */\r\n public readonly transform: Transform;\r\n\r\n /** Construct from the two rows of the matrix:\r\n * ```\r\n * | m00 m01 originX |\r\n * | m10 m11 originY |\r\n * ```\r\n * Producing the [Transform]($core-geometry):\r\n * ```\r\n * | m00 m01 0 originX |\r\n * | m10 m11 0 originY |\r\n * | 0 0 1 0 |\r\n * ```\r\n */\r\n public constructor(m00 = 1, m01 = 0, originX = 0, m10 = 0, m11 = 1, originY = 0) {\r\n const origin = new Point3d(originX, originY, 0);\r\n const matrix = Matrix3d.createRowValues(m00, m01, 0, m10, m11, 0, 0, 0, 1);\r\n this.transform = Transform.createRefs(origin, matrix);\r\n }\r\n\r\n /** An immutable 2x3 identity matrix. */\r\n public static readonly identity = new Trans2x3();\r\n\r\n /** An [OrderedComparator]($bentley) that compares this Trans2x3 against `other`. */\r\n public compare(other: Trans2x3): number {\r\n if (this === other) {\r\n return 0;\r\n }\r\n\r\n const originDiff = compareNumbers(this.transform.origin.x, other.transform.origin.x) || compareNumbers(this.transform.origin.y, other.transform.origin.y);\r\n if (originDiff !== 0) {\r\n return originDiff;\r\n }\r\n\r\n for (const i of [0, 1, 3, 4]) {\r\n const matDiff = compareNumbers(this.transform.matrix.coffs[i], other.transform.matrix.coffs[i]);\r\n if (matDiff !== 0) {\r\n return matDiff;\r\n }\r\n }\r\n\r\n return 0;\r\n }\r\n }\r\n\r\n /** Properties used to construct a [[TextureMapping.ConstantLodParams]]. */\r\n export interface ConstantLodParamProps {\r\n /** The number of times the texture is repeated. Increasing this will make the texture pattern appear smaller, decreasing it will make it larger. Defaults to 1. */\r\n repetitions?: number;\r\n /** An offset in world units used to shift the texture. Defaults to (0, 0). */\r\n offset?: XAndY;\r\n /** The minimum distance (from the eye to the surface) at which to clamp the texture. Defaults to 1.*/\r\n minDistClamp?: number;\r\n /** The maximum distance (from the eye to the surface) at which to clamp the texture. Defaults to 2^32. */\r\n maxDistClamp?: number;\r\n }\r\n\r\n /** Parameters to define constant level of detail mapping mode, a mode of texture coordinate generation which dynamically creates\r\n * texture cooprdinates so that the level of detail of the texture in the rendered image remains somewhat constant. */\r\n export interface ConstantLodParams {\r\n /** The number of times the texture is repeated. Increasing this will make the texture pattern appear smaller, decreasing it will make it larger. */\r\n repetitions: number;\r\n /** An offset in world units used to shift the texture. */\r\n offset: XAndY;\r\n /** The minimum distance (from the eye to the surface) at which to clamp the texture. */\r\n minDistClamp: number;\r\n /** The maximum distance (from the eye to the surface) at which to clamp the texture. */\r\n maxDistClamp: number;\r\n }\r\n\r\n function compareConstantLodParams(lhs: ConstantLodParams, rhs: ConstantLodParams): number {\r\n return compareNumbers(lhs.repetitions, rhs.repetitions) || compareNumbers(lhs.offset.x, rhs.offset.x) || compareNumbers(lhs.offset.y, rhs.offset.y)\r\n || compareNumbers(lhs.minDistClamp, rhs.minDistClamp) || compareNumbers(lhs.maxDistClamp, rhs.maxDistClamp);\r\n }\r\n\r\n /** Properties used to construct a [[TextureMapping.Params]]. */\r\n export interface ParamProps {\r\n /** The matrix used to map the image to a surface. */\r\n textureMat2x3?: TextureMapping.Trans2x3;\r\n /** The ratio in [0, 1] with which to mix the color sampled from the texture with the surface's color.\r\n * A value of 0.0 uses only the surface color. A value of 1.0 uses only the texture color. A value of 0.5 uses an even mix of both.\r\n * @note This affects only the red, green, and blue components of the color. The alpha sampled from the texture is always multiplied by the surface color's alpha.\r\n * @note Defaults to 1.0\r\n */\r\n textureWeight?: number;\r\n /** The mode by which to map the image to a surface.\r\n * @note Defaults to [[TextureMapping.Mode.Parametric]].\r\n */\r\n mapMode?: TextureMapping.Mode;\r\n /** @internal */\r\n worldMapping?: boolean;\r\n /** True if want to use constant LOD texture mapping for the surface texture. */\r\n useConstantLod?: boolean;\r\n /** Parameters for constantLod mapping mode. */\r\n constantLodProps?: ConstantLodParamProps;\r\n }\r\n\r\n /** Parameters describing how a [[RenderTexture]]'s image is mapped to a surface. */\r\n export class Params {\r\n /** The matrix used to map the image to a surface. */\r\n public textureMatrix: TextureMapping.Trans2x3;\r\n /** The ratio in [0, 1] with which to mix the color sampled from the texture with the element's color.\r\n * A value of 0.0 uses only the element color. A value of 1.0 uses only the texture color.\r\n */\r\n public weight: number;\r\n /** The mode by which to map the image to a surface. */\r\n public mode: TextureMapping.Mode;\r\n /** @internal */\r\n public worldMapping: boolean;\r\n /** True if want to use constant LOD texture mapping for the surface texture. */\r\n public useConstantLod: boolean;\r\n /** Parameters for constantLod mapping mode. */\r\n public constantLodParams: ConstantLodParams;\r\n\r\n public constructor(props?: TextureMapping.ParamProps) {\r\n this.textureMatrix = props?.textureMat2x3 ?? Trans2x3.identity;\r\n this.weight = props?.textureWeight ?? 1;\r\n this.mode = props?.mapMode ?? Mode.Parametric;\r\n this.worldMapping = props?.worldMapping ?? false;\r\n this.useConstantLod = props?.useConstantLod ?? false;\r\n this.constantLodParams = {\r\n repetitions: props?.constantLodProps?.repetitions ?? 1,\r\n offset: props?.constantLodProps?.offset ?? { x: 0, y: 0 },\r\n minDistClamp: props?.constantLodProps?.minDistClamp ?? 1,\r\n maxDistClamp: props?.constantLodProps?.maxDistClamp ?? 4096 * 1024 * 1024,\r\n };\r\n }\r\n\r\n /** An [OrderedComparator]($bentley) that compares these Params against `other`. */\r\n public compare(other: Params): number {\r\n if (this === other) {\r\n return 0;\r\n }\r\n\r\n return compareNumbers(this.weight, other.weight) || compareNumbers(this.mode, other.mode) || compareBooleans(this.worldMapping, other.worldMapping)\r\n || compareBooleans(this.useConstantLod, other.useConstantLod) || this.textureMatrix.compare(other.textureMatrix)\r\n || compareConstantLodParams(this.constantLodParams, other.constantLodParams);\r\n }\r\n\r\n /**\r\n * Generates UV parameters for textured surfaces. Returns undefined on failure.\r\n * @internal\r\n */\r\n public computeUVParams(visitor: IndexedPolyfaceVisitor, transformToImodel: Transform): Point2d[] | undefined {\r\n switch (this.mode) {\r\n default: // Fall through to parametric in default case\r\n case TextureMapping.Mode.Parametric: {\r\n return this.computeParametricUVParams(visitor, this.textureMatrix.transform, !this.worldMapping);\r\n }\r\n case TextureMapping.Mode.Planar: {\r\n const normalIndices = visitor.normalIndex;\r\n if (!normalIndices)\r\n return undefined;\r\n\r\n // Ignore planar mode unless master or sub units for scaleMode and facet is planar\r\n if (!this.worldMapping || (visitor.normalIndex !== undefined && (normalIndices[0] !== normalIndices[1] || normalIndices[0] !== normalIndices[2]))) {\r\n return this.computeParametricUVParams(visitor, this.textureMatrix.transform, !this.worldMapping);\r\n } else {\r\n return this.computePlanarUVParams(visitor, this.textureMatrix.transform);\r\n }\r\n }\r\n case TextureMapping.Mode.ElevationDrape: {\r\n return this.computeElevationDrapeUVParams(visitor, this.textureMatrix.transform, transformToImodel);\r\n }\r\n }\r\n }\r\n\r\n /** Computes UV parameters given a texture mapping mode of parametric. */\r\n private computeParametricUVParams(visitor: IndexedPolyfaceVisitor, uvTransform: Transform, isRelativeUnits: boolean): Point2d[] {\r\n const params: Point2d[] = [];\r\n for (let i = 0; i < visitor.numEdgesThisFacet; i++) {\r\n let param = Point2d.create();\r\n\r\n if (isRelativeUnits || !visitor.tryGetDistanceParameter(i, param)) {\r\n if (!visitor.tryGetNormalizedParameter(i, param)) {\r\n // If mesh does not have facetFaceData, we still want to use the texture coordinates if they are present\r\n param = visitor.getParam(i)!;\r\n }\r\n }\r\n\r\n params.push(uvTransform.multiplyPoint2d(param));\r\n }\r\n return params;\r\n }\r\n\r\n /** Computes UV parameters given a texture mapping mode of planar. The result is stored in the Point2d array given. */\r\n private computePlanarUVParams(visitor: IndexedPolyfaceVisitor, uvTransform: Transform): Point2d[] | undefined {\r\n const params: Point2d[] = [];\r\n const points = visitor.point;\r\n let normal: Vector3d;\r\n\r\n if (visitor.normal === undefined)\r\n normal = points.getPoint3dAtUncheckedPointIndex(0).crossProductToPoints(points.getPoint3dAtUncheckedPointIndex(1), points.getPoint3dAtUncheckedPointIndex(2));\r\n else\r\n normal = visitor.normal.getVector3dAtCheckedVectorIndex(0)!;\r\n\r\n if (!normal.normalize(normal))\r\n return undefined;\r\n\r\n // adjust U texture coordinate to be a continuous length starting at the\r\n // origin. V coordinate stays the same. This mode assumes Z is up vector\r\n\r\n // Flipping normal puts us in a planar coordinate system consistent with MicroStation's display system\r\n normal.scale(-1.0, normal);\r\n\r\n // pick the first vertex normal\r\n const sideVector = Vector3d.create(normal.y, -normal.x, 0.0);\r\n\r\n // if the magnitude of the normal is near zero, the real normal points\r\n // almost straighten up.. In this case, use Y as the up vector to match QV\r\n\r\n const magnitude = sideVector.magnitude();\r\n sideVector.normalize(sideVector); // won't remain undefined if failed due to following check..\r\n\r\n if (magnitude < 1e-3) {\r\n normal.set(0, 0, -1);\r\n sideVector.set(1, 0, 0);\r\n }\r\n\r\n const upVector = sideVector.crossProduct(normal).normalize();\r\n if (!upVector)\r\n return undefined;\r\n\r\n const numEdges = visitor.numEdgesThisFacet;\r\n for (let i = 0; i < numEdges; i++) {\r\n const vector = Vector3d.createFrom(points.getPoint3dAtUncheckedPointIndex(i));\r\n\r\n params.push(Point2d.create(vector.dotProduct(sideVector), vector.dotProduct(upVector)));\r\n uvTransform.multiplyPoint2d(params[i], params[i]);\r\n }\r\n return params;\r\n }\r\n\r\n /** Computes UV parameters given a texture mapping mode of elevation drape. The result is stored in the Point2d array given. */\r\n private computeElevationDrapeUVParams(visitor: IndexedPolyfaceVisitor, uvTransform: Transform, transformToIModel?: Transform): Point2d[] {\r\n const params: Point2d[] = [];\r\n const numEdges = visitor.numEdgesThisFacet;\r\n for (let i = 0; i < numEdges; i++) {\r\n const point = visitor.point.getPoint3dAtUncheckedPointIndex(i);\r\n\r\n if (transformToIModel !== undefined)\r\n transformToIModel.multiplyPoint3d(point, point);\r\n\r\n params.push(Point2d.createFrom(point));\r\n uvTransform.multiplyPoint2d(params[i], params[i]);\r\n }\r\n return params;\r\n }\r\n }\r\n}\r\n\r\nObject.freeze(TextureMapping.Trans2x3.identity);\r\n"]}
|
|
1
|
+
{"version":3,"file":"TextureMapping.js","sourceRoot":"","sources":["../../src/TextureMapping.ts"],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M,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;gBACxF,WAAW,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;YACpD,CAAC;YACD,OAAO,MAAM,CAAC;QAChB,CAAC;QAED,+HAA+H;QACvH,6BAA6B,CAAC,OAA+B,EAAE,WAAsB,EAAE,iBAA6B;YAC1H,MAAM,MAAM,GAAc,EAAE,CAAC;YAC7B,MAAM,QAAQ,GAAG,OAAO,CAAC,iBAAiB,CAAC;YAC3C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,EAAE,CAAC,EAAE,EAAE,CAAC;gBAClC,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,+BAA+B,CAAC,CAAC,CAAC,CAAC;gBAE/D,IAAI,iBAAiB,KAAK,SAAS;oBACjC,iBAAiB,CAAC,eAAe,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;gBAElD,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC;gBACvC,WAAW,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;YACpD,CAAC;YACD,OAAO,MAAM,CAAC;QAChB,CAAC;KACF;IAtJY,qBAAM,SAsJlB,CAAA;AACH,CAAC,EAjRgB,cAAc,KAAd,cAAc,QAiR9B;AAED,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,QAAQ,CAAC,QAAQ,CAAC,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 Rendering\n */\n\nimport { IndexedPolyfaceVisitor, Matrix3d, Point2d, Point3d, PolyfaceVisitor, Transform, Vector3d, XAndY } from \"@itwin/core-geometry\";\nimport { RenderTexture } from \"./RenderTexture\";\nimport { compareBooleans, compareBooleansOrUndefined, compareNumbers, compareNumbersOrUndefined, comparePossiblyUndefined } from \"@itwin/core-bentley\";\n\n/** Defines normal map parameters.\n * @beta\n */\nexport interface NormalMapParams {\n /** The texture to use as a normal map. If not present then the pattern map texture will be used as a normal map. */\n normalMap?: RenderTexture;\n /** True if the Y component stored in the green channel should be negated. By default, positive Y points downward, but some\n * normal maps are created with positive Y pointing upward.\n */\n greenUp?: boolean;\n /** Scale factor by which to multiply the components of the normal extracted from [[normalMap]]. */\n scale?: number;\n /** True if want to use constant LOD texture mapping for the normal map texture. */\n useConstantLod?: boolean;\n}\n\nfunction compareNormalMapParams(lhs: NormalMapParams, rhs: NormalMapParams): number {\n return comparePossiblyUndefined((lh, rh) => lh.compare(rh), lhs.normalMap, rhs.normalMap)\n || compareBooleansOrUndefined(lhs.greenUp, rhs.greenUp) || compareNumbersOrUndefined(lhs.scale, rhs.scale)\n || compareBooleansOrUndefined(lhs.useConstantLod, rhs.useConstantLod);\n}\n\n/** Describes how to map a [[RenderTexture]]'s image onto a surface as part of a [[RenderMaterial]].\n * @public\n */\nexport class TextureMapping {\n /** The texture to be mapped to the surface. If normalMapParams is present but does not contain a normal map, then texture is used as a normal map rather than a pattern map. */\n public readonly texture: RenderTexture;\n /** The parameters for normal mapping.\n * @beta\n */\n public normalMapParams?: NormalMapParams;\n /** The parameters describing how the textures are mapped to the surface. */\n public readonly params: TextureMapping.Params;\n\n public constructor(tx: RenderTexture, params: TextureMapping.Params) {\n this.texture = tx;\n this.params = params;\n }\n\n /** @internal */\n public computeUVParams(visitor: PolyfaceVisitor, transformToImodel: Transform): Point2d[] | undefined {\n return this.params.computeUVParams(visitor as IndexedPolyfaceVisitor, transformToImodel);\n }\n\n /** An [OrderedComparator]($bentley) that compares this mapping against `other`. */\n public compare(other: TextureMapping): number {\n if (this === other) {\n return 0;\n }\n\n return this.texture.compare(other.texture) || this.params.compare(other.params)\n || comparePossiblyUndefined((lh, rh) => compareNormalMapParams(lh, rh), this.normalMapParams, other.normalMapParams);\n }\n}\n\n/** @public */\nexport namespace TextureMapping {\n /** Enumerates the possible texture mapping modes. */\n export enum Mode {\n None = -1,\n Parametric = 0,\n ElevationDrape = 1,\n Planar = 2,\n /** @internal */\n DirectionalDrape = 3,\n /** @internal */\n Cubic = 4,\n /** @internal */\n Spherical = 5,\n /** @internal */\n Cylindrical = 6,\n /** @internal */\n Solid = 7,\n /** @internal Only valid for lights */\n FrontProject = 8,\n }\n\n /** A 2x3 matrix for mapping a texture image to a surface. */\n export class Trans2x3 {\n /** The 3x4 transform produced from the 2x3 matrix. */\n public readonly transform: Transform;\n\n /** Construct from the two rows of the matrix:\n * ```\n * | m00 m01 originX |\n * | m10 m11 originY |\n * ```\n * Producing the [Transform]($core-geometry):\n * ```\n * | m00 m01 0 originX |\n * | m10 m11 0 originY |\n * | 0 0 1 0 |\n * ```\n */\n public constructor(m00 = 1, m01 = 0, originX = 0, m10 = 0, m11 = 1, originY = 0) {\n const origin = new Point3d(originX, originY, 0);\n const matrix = Matrix3d.createRowValues(m00, m01, 0, m10, m11, 0, 0, 0, 1);\n this.transform = Transform.createRefs(origin, matrix);\n }\n\n /** An immutable 2x3 identity matrix. */\n public static readonly identity = new Trans2x3();\n\n /** An [OrderedComparator]($bentley) that compares this Trans2x3 against `other`. */\n public compare(other: Trans2x3): number {\n if (this === other) {\n return 0;\n }\n\n const originDiff = compareNumbers(this.transform.origin.x, other.transform.origin.x) || compareNumbers(this.transform.origin.y, other.transform.origin.y);\n if (originDiff !== 0) {\n return originDiff;\n }\n\n for (const i of [0, 1, 3, 4]) {\n const matDiff = compareNumbers(this.transform.matrix.coffs[i], other.transform.matrix.coffs[i]);\n if (matDiff !== 0) {\n return matDiff;\n }\n }\n\n return 0;\n }\n }\n\n /** Properties used to construct a [[TextureMapping.ConstantLodParams]]. */\n export interface ConstantLodParamProps {\n /** The number of times the texture is repeated. Increasing this will make the texture pattern appear smaller, decreasing it will make it larger. Defaults to 1. */\n repetitions?: number;\n /** An offset in world units used to shift the texture. Defaults to (0, 0). */\n offset?: XAndY;\n /** The minimum distance (from the eye to the surface) at which to clamp the texture. Defaults to 1.*/\n minDistClamp?: number;\n /** The maximum distance (from the eye to the surface) at which to clamp the texture. Defaults to 2^32. */\n maxDistClamp?: number;\n }\n\n /** Parameters to define constant level of detail mapping mode, a mode of texture coordinate generation which dynamically creates\n * texture cooprdinates so that the level of detail of the texture in the rendered image remains somewhat constant. */\n export interface ConstantLodParams {\n /** The number of times the texture is repeated. Increasing this will make the texture pattern appear smaller, decreasing it will make it larger. */\n repetitions: number;\n /** An offset in world units used to shift the texture. */\n offset: XAndY;\n /** The minimum distance (from the eye to the surface) at which to clamp the texture. */\n minDistClamp: number;\n /** The maximum distance (from the eye to the surface) at which to clamp the texture. */\n maxDistClamp: number;\n }\n\n function compareConstantLodParams(lhs: ConstantLodParams, rhs: ConstantLodParams): number {\n return compareNumbers(lhs.repetitions, rhs.repetitions) || compareNumbers(lhs.offset.x, rhs.offset.x) || compareNumbers(lhs.offset.y, rhs.offset.y)\n || compareNumbers(lhs.minDistClamp, rhs.minDistClamp) || compareNumbers(lhs.maxDistClamp, rhs.maxDistClamp);\n }\n\n /** Properties used to construct a [[TextureMapping.Params]]. */\n export interface ParamProps {\n /** The matrix used to map the image to a surface. */\n textureMat2x3?: TextureMapping.Trans2x3;\n /** The ratio in [0, 1] with which to mix the color sampled from the texture with the surface's color.\n * A value of 0.0 uses only the surface color. A value of 1.0 uses only the texture color. A value of 0.5 uses an even mix of both.\n * @note This affects only the red, green, and blue components of the color. The alpha sampled from the texture is always multiplied by the surface color's alpha.\n * @note Defaults to 1.0\n */\n textureWeight?: number;\n /** The mode by which to map the image to a surface.\n * @note Defaults to [[TextureMapping.Mode.Parametric]].\n */\n mapMode?: TextureMapping.Mode;\n /** @internal */\n worldMapping?: boolean;\n /** True if want to use constant LOD texture mapping for the surface texture. */\n useConstantLod?: boolean;\n /** Parameters for constantLod mapping mode. */\n constantLodProps?: ConstantLodParamProps;\n }\n\n /** Parameters describing how a [[RenderTexture]]'s image is mapped to a surface. */\n export class Params {\n /** The matrix used to map the image to a surface. */\n public textureMatrix: TextureMapping.Trans2x3;\n /** The ratio in [0, 1] with which to mix the color sampled from the texture with the element's color.\n * A value of 0.0 uses only the element color. A value of 1.0 uses only the texture color.\n */\n public weight: number;\n /** The mode by which to map the image to a surface. */\n public mode: TextureMapping.Mode;\n /** @internal */\n public worldMapping: boolean;\n /** True if want to use constant LOD texture mapping for the surface texture. */\n public useConstantLod: boolean;\n /** Parameters for constantLod mapping mode. */\n public constantLodParams: ConstantLodParams;\n\n public constructor(props?: TextureMapping.ParamProps) {\n this.textureMatrix = props?.textureMat2x3 ?? Trans2x3.identity;\n this.weight = props?.textureWeight ?? 1;\n this.mode = props?.mapMode ?? Mode.Parametric;\n this.worldMapping = props?.worldMapping ?? false;\n this.useConstantLod = props?.useConstantLod ?? false;\n this.constantLodParams = {\n repetitions: props?.constantLodProps?.repetitions ?? 1,\n offset: props?.constantLodProps?.offset ?? { x: 0, y: 0 },\n minDistClamp: props?.constantLodProps?.minDistClamp ?? 1,\n maxDistClamp: props?.constantLodProps?.maxDistClamp ?? 4096 * 1024 * 1024,\n };\n }\n\n /** An [OrderedComparator]($bentley) that compares these Params against `other`. */\n public compare(other: Params): number {\n if (this === other) {\n return 0;\n }\n\n return compareNumbers(this.weight, other.weight) || compareNumbers(this.mode, other.mode) || compareBooleans(this.worldMapping, other.worldMapping)\n || compareBooleans(this.useConstantLod, other.useConstantLod) || this.textureMatrix.compare(other.textureMatrix)\n || compareConstantLodParams(this.constantLodParams, other.constantLodParams);\n }\n\n /**\n * Generates UV parameters for textured surfaces. Returns undefined on failure.\n * @internal\n */\n public computeUVParams(visitor: IndexedPolyfaceVisitor, transformToImodel: Transform): Point2d[] | undefined {\n switch (this.mode) {\n default: // Fall through to parametric in default case\n case TextureMapping.Mode.Parametric: {\n return this.computeParametricUVParams(visitor, this.textureMatrix.transform, !this.worldMapping);\n }\n case TextureMapping.Mode.Planar: {\n const normalIndices = visitor.normalIndex;\n if (!normalIndices)\n return undefined;\n\n // Ignore planar mode unless master or sub units for scaleMode and facet is planar\n if (!this.worldMapping || (visitor.normalIndex !== undefined && (normalIndices[0] !== normalIndices[1] || normalIndices[0] !== normalIndices[2]))) {\n return this.computeParametricUVParams(visitor, this.textureMatrix.transform, !this.worldMapping);\n } else {\n return this.computePlanarUVParams(visitor, this.textureMatrix.transform);\n }\n }\n case TextureMapping.Mode.ElevationDrape: {\n return this.computeElevationDrapeUVParams(visitor, this.textureMatrix.transform, transformToImodel);\n }\n }\n }\n\n /** Computes UV parameters given a texture mapping mode of parametric. */\n private computeParametricUVParams(visitor: IndexedPolyfaceVisitor, uvTransform: Transform, isRelativeUnits: boolean): Point2d[] {\n const params: Point2d[] = [];\n for (let i = 0; i < visitor.numEdgesThisFacet; i++) {\n let param = Point2d.create();\n\n if (isRelativeUnits || !visitor.tryGetDistanceParameter(i, param)) {\n if (!visitor.tryGetNormalizedParameter(i, param)) {\n // If mesh does not have facetFaceData, we still want to use the texture coordinates if they are present\n param = visitor.getParam(i)!;\n }\n }\n\n params.push(uvTransform.multiplyPoint2d(param));\n }\n return params;\n }\n\n /** Computes UV parameters given a texture mapping mode of planar. The result is stored in the Point2d array given. */\n private computePlanarUVParams(visitor: IndexedPolyfaceVisitor, uvTransform: Transform): Point2d[] | undefined {\n const params: Point2d[] = [];\n const points = visitor.point;\n let normal: Vector3d;\n\n if (visitor.normal === undefined)\n normal = points.getPoint3dAtUncheckedPointIndex(0).crossProductToPoints(points.getPoint3dAtUncheckedPointIndex(1), points.getPoint3dAtUncheckedPointIndex(2));\n else\n normal = visitor.normal.getVector3dAtCheckedVectorIndex(0)!;\n\n if (!normal.normalize(normal))\n return undefined;\n\n // adjust U texture coordinate to be a continuous length starting at the\n // origin. V coordinate stays the same. This mode assumes Z is up vector\n\n // Flipping normal puts us in a planar coordinate system consistent with MicroStation's display system\n normal.scale(-1.0, normal);\n\n // pick the first vertex normal\n const sideVector = Vector3d.create(normal.y, -normal.x, 0.0);\n\n // if the magnitude of the normal is near zero, the real normal points\n // almost straighten up.. In this case, use Y as the up vector to match QV\n\n const magnitude = sideVector.magnitude();\n sideVector.normalize(sideVector); // won't remain undefined if failed due to following check..\n\n if (magnitude < 1e-3) {\n normal.set(0, 0, -1);\n sideVector.set(1, 0, 0);\n }\n\n const upVector = sideVector.crossProduct(normal).normalize();\n if (!upVector)\n return undefined;\n\n const numEdges = visitor.numEdgesThisFacet;\n for (let i = 0; i < numEdges; i++) {\n const vector = Vector3d.createFrom(points.getPoint3dAtUncheckedPointIndex(i));\n\n params.push(Point2d.create(vector.dotProduct(sideVector), vector.dotProduct(upVector)));\n uvTransform.multiplyPoint2d(params[i], params[i]);\n }\n return params;\n }\n\n /** Computes UV parameters given a texture mapping mode of elevation drape. The result is stored in the Point2d array given. */\n private computeElevationDrapeUVParams(visitor: IndexedPolyfaceVisitor, uvTransform: Transform, transformToIModel?: Transform): Point2d[] {\n const params: Point2d[] = [];\n const numEdges = visitor.numEdgesThisFacet;\n for (let i = 0; i < numEdges; i++) {\n const point = visitor.point.getPoint3dAtUncheckedPointIndex(i);\n\n if (transformToIModel !== undefined)\n transformToIModel.multiplyPoint3d(point, point);\n\n params.push(Point2d.createFrom(point));\n uvTransform.multiplyPoint2d(params[i], params[i]);\n }\n return params;\n }\n }\n}\n\nObject.freeze(TextureMapping.Trans2x3.identity);\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextureProps.js","sourceRoot":"","sources":["../../src/TextureProps.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAkCH;;;;;;GAMG;AACH,MAAM,CAAN,IAAY,mBASX;AATD,WAAY,mBAAmB;IAC7B,kGAAkG;IAClG,iEAAM,CAAA;IACN,mGAAmG;IACnG,2EAAW,CAAA;IACX;;OAEG;IACH,+DAAK,CAAA;AACP,CAAC,EATW,mBAAmB,KAAnB,mBAAmB,QAS9B","sourcesContent":["/*---------------------------------------------------------------------------------------------\
|
|
1
|
+
{"version":3,"file":"TextureProps.js","sourceRoot":"","sources":["../../src/TextureProps.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAkCH;;;;;;GAMG;AACH,MAAM,CAAN,IAAY,mBASX;AATD,WAAY,mBAAmB;IAC7B,kGAAkG;IAClG,iEAAM,CAAA;IACN,mGAAmG;IACnG,2EAAW,CAAA;IACX;;OAEG;IACH,+DAAK,CAAA;AACP,CAAC,EATW,mBAAmB,KAAnB,mBAAmB,QAS9B","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 Entities\n */\n\nimport { Id64String } from \"@itwin/core-bentley\";\nimport { DefinitionElementProps } from \"./ElementProps\";\nimport { ImageSourceFormat } from \"./Image\";\nimport { Base64EncodedString } from \"./Base64EncodedString\";\n\n/** Properties that define a [Texture]($backend) element.\n * @public\n * @extensions\n */\nexport interface TextureProps extends DefinitionElementProps {\n /** Format of the image data. */\n format: ImageSourceFormat;\n /** The image data stored in a Base64-encoded string according to the specified format.\n * @see [[Base64EncodedString.fromUint8Array]] to produce a well-formed base-64-encoded string.\n * @see [[Base64EncodedString.toUint8Array]] to decode the bytes.\n */\n data: Base64EncodedString;\n /** An optional description of the texture. */\n description?: string;\n}\n\n/** Properties that specify what texture should be loaded and how it should be loaded.\n * @public\n * @extensions\n */\nexport interface TextureLoadProps {\n /** A valid Id64 string identifying the texture */\n name: Id64String;\n /** Maximum texture size supported by the client. If specified, the texture will be downsampled so both of its dimensions adhere to this size. */\n maxTextureSize?: number;\n}\n\n/** Describes the type of transparency in the pixels of a [TextureImage]($frontend).\n * Each pixel can be classified as either opaque or translucent.\n * The transparency of the image as a whole is based on the combination of pixel transparencies.\n * If this information is known, it should be supplied when creating a texture for more efficient rendering.\n * @see [TextureImage.transparency]($frontend).\n * @public\n */\nexport enum TextureTransparency {\n /** The image contains only opaque pixels. It should not blend with other objects in the scene. */\n Opaque,\n /** The image contains only translucent pixels. It should blend with other objects in the scene. */\n Translucent,\n /** The image contains both opaque and translucent pixels. The translucent pixels should blend with other objects in the scene, while\n * the opaque pixels should not. Rendering this type of transparency is somewhat more expensive.\n */\n Mixed,\n}\n\n/** Information about [Texture]($backend) data returned by [[IModelReadRpcInterface.queryTextureData]].\n * @public\n * @extensions\n */\nexport interface TextureData {\n /** The width of the image, possibly reduced from the original width based on [[TextureLoadProps.maxTextureSize]]. */\n width: number;\n /** The height of the image, possibly reduced from the original height based on [[TextureLoadProps.maxTextureSize]]. */\n height: number;\n /** The format of the image (Jpeg or Png). */\n format: ImageSourceFormat;\n /** The encoded image bytes. */\n bytes: Uint8Array;\n /** Information about the transparency of the texture image. Default: [[TextureTransparency.Mixed]]. */\n transparency?: TextureTransparency;\n}\n"]}
|