@itwin/core-common 5.0.0-dev.4 → 5.0.0-dev.40
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 +35 -1
- package/lib/cjs/AmbientOcclusion.js +9 -9
- package/lib/cjs/AmbientOcclusion.js.map +1 -1
- package/lib/cjs/AnalysisStyle.js +1 -1
- package/lib/cjs/AnalysisStyle.js.map +1 -1
- package/lib/cjs/Atmosphere.js +19 -21
- package/lib/cjs/Atmosphere.js.map +1 -1
- package/lib/cjs/BriefcaseTypes.d.ts +2 -2
- package/lib/cjs/BriefcaseTypes.d.ts.map +1 -1
- package/lib/cjs/BriefcaseTypes.js.map +1 -1
- package/lib/cjs/ClipStyle.js +5 -5
- package/lib/cjs/ClipStyle.js.map +1 -1
- package/lib/cjs/ColorDef.js +10 -10
- package/lib/cjs/ColorDef.js.map +1 -1
- package/lib/cjs/ConcurrentQuery.d.ts +5 -1
- package/lib/cjs/ConcurrentQuery.d.ts.map +1 -1
- package/lib/cjs/ConcurrentQuery.js.map +1 -1
- package/lib/cjs/ContourDisplay.js +5 -5
- package/lib/cjs/ContourDisplay.js.map +1 -1
- package/lib/cjs/ECSqlReader.d.ts.map +1 -1
- package/lib/cjs/ECSqlReader.js +3 -1
- package/lib/cjs/ECSqlReader.js.map +1 -1
- package/lib/cjs/ElementProps.d.ts.map +1 -1
- package/lib/cjs/ElementProps.js +3 -3
- package/lib/cjs/ElementProps.js.map +1 -1
- package/lib/cjs/Environment.js +2 -2
- package/lib/cjs/Environment.js.map +1 -1
- package/lib/cjs/FeatureSymbology.js +3 -3
- package/lib/cjs/FeatureSymbology.js.map +1 -1
- package/lib/cjs/Fonts.d.ts +69 -11
- package/lib/cjs/Fonts.d.ts.map +1 -1
- package/lib/cjs/Fonts.js +20 -5
- package/lib/cjs/Fonts.js.map +1 -1
- package/lib/cjs/Gradient.js +9 -9
- package/lib/cjs/Gradient.js.map +1 -1
- package/lib/cjs/GroundPlane.js +2 -2
- package/lib/cjs/GroundPlane.js.map +1 -1
- package/lib/cjs/HiddenLine.js +4 -4
- package/lib/cjs/HiddenLine.js.map +1 -1
- package/lib/cjs/IModel.d.ts +3 -12
- package/lib/cjs/IModel.d.ts.map +1 -1
- package/lib/cjs/IModel.js +6 -6
- package/lib/cjs/IModel.js.map +1 -1
- package/lib/cjs/IModelError.d.ts +0 -2
- package/lib/cjs/IModelError.d.ts.map +1 -1
- package/lib/cjs/IModelError.js +1 -8
- package/lib/cjs/IModelError.js.map +1 -1
- package/lib/cjs/ITwinError.d.ts +1 -1
- package/lib/cjs/ITwinError.d.ts.map +1 -1
- package/lib/cjs/ITwinError.js +1 -1
- package/lib/cjs/ITwinError.js.map +1 -1
- package/lib/cjs/LightSettings.js +1 -1
- package/lib/cjs/LightSettings.js.map +1 -1
- package/lib/cjs/PlanarClipMask.js +2 -2
- package/lib/cjs/PlanarClipMask.js.map +1 -1
- package/lib/cjs/RealityModelDisplaySettings.js +4 -4
- package/lib/cjs/RealityModelDisplaySettings.js.map +1 -1
- package/lib/cjs/RenderMaterial.js +3 -3
- package/lib/cjs/RenderMaterial.js.map +1 -1
- package/lib/cjs/RpcInterface.js +1 -1
- package/lib/cjs/RpcInterface.js.map +1 -1
- package/lib/cjs/SkyBox.js +4 -4
- package/lib/cjs/SkyBox.js.map +1 -1
- package/lib/cjs/SolarShadows.js +1 -1
- package/lib/cjs/SolarShadows.js.map +1 -1
- package/lib/cjs/SubCategoryAppearance.js +1 -1
- package/lib/cjs/SubCategoryAppearance.js.map +1 -1
- package/lib/cjs/SubCategoryOverride.js +2 -2
- package/lib/cjs/SubCategoryOverride.js.map +1 -1
- package/lib/cjs/TextureMapping.js +2 -2
- package/lib/cjs/TextureMapping.js.map +1 -1
- package/lib/cjs/ThematicDisplay.js +2 -2
- package/lib/cjs/ThematicDisplay.js.map +1 -1
- package/lib/cjs/ViewDetails.js +2 -2
- package/lib/cjs/ViewDetails.js.map +1 -1
- package/lib/cjs/ViewFlags.js +2 -2
- package/lib/cjs/ViewFlags.js.map +1 -1
- package/lib/cjs/WhiteOnWhiteReversalSettings.js +2 -2
- package/lib/cjs/WhiteOnWhiteReversalSettings.js.map +1 -1
- package/lib/cjs/annotation/TextStyle.js +19 -19
- package/lib/cjs/annotation/TextStyle.js.map +1 -1
- package/lib/cjs/core-common.d.ts +0 -1
- package/lib/cjs/core-common.d.ts.map +1 -1
- package/lib/cjs/core-common.js +0 -1
- package/lib/cjs/core-common.js.map +1 -1
- package/lib/cjs/geometry/Cartographic.js +13 -13
- package/lib/cjs/geometry/Cartographic.js.map +1 -1
- package/lib/cjs/ipc/IpcWebSocket.js +1 -1
- package/lib/cjs/ipc/IpcWebSocket.js.map +1 -1
- package/lib/cjs/ipc/IpcWebSocketTransport.js +1 -1
- package/lib/cjs/ipc/IpcWebSocketTransport.js.map +1 -1
- package/lib/cjs/rpc/DevToolsRpcInterface.js +6 -6
- package/lib/cjs/rpc/DevToolsRpcInterface.js.map +1 -1
- package/lib/cjs/rpc/IModelReadRpcInterface.js +5 -5
- package/lib/cjs/rpc/IModelReadRpcInterface.js.map +1 -1
- package/lib/cjs/rpc/IModelTileRpcInterface.js +4 -4
- package/lib/cjs/rpc/IModelTileRpcInterface.js.map +1 -1
- package/lib/cjs/rpc/SnapshotIModelRpcInterface.js +4 -4
- package/lib/cjs/rpc/SnapshotIModelRpcInterface.js.map +1 -1
- package/lib/cjs/rpc/core/RpcConfiguration.js +32 -34
- package/lib/cjs/rpc/core/RpcConfiguration.js.map +1 -1
- package/lib/cjs/rpc/core/RpcControl.js +8 -15
- package/lib/cjs/rpc/core/RpcControl.js.map +1 -1
- package/lib/cjs/rpc/core/RpcInvocation.js +3 -5
- package/lib/cjs/rpc/core/RpcInvocation.js.map +1 -1
- package/lib/cjs/rpc/core/RpcMarshaling.d.ts +0 -3
- package/lib/cjs/rpc/core/RpcMarshaling.d.ts.map +1 -1
- package/lib/cjs/rpc/core/RpcMarshaling.js +5 -4
- package/lib/cjs/rpc/core/RpcMarshaling.js.map +1 -1
- package/lib/cjs/rpc/core/RpcOperation.js +2 -2
- package/lib/cjs/rpc/core/RpcOperation.js.map +1 -1
- package/lib/cjs/rpc/core/RpcProtocol.js +4 -4
- package/lib/cjs/rpc/core/RpcProtocol.js.map +1 -1
- package/lib/cjs/rpc/core/RpcPush.js +5 -5
- package/lib/cjs/rpc/core/RpcPush.js.map +1 -1
- package/lib/cjs/rpc/core/RpcRequest.js +5 -5
- package/lib/cjs/rpc/core/RpcRequest.js.map +1 -1
- package/lib/cjs/rpc/core/RpcRoutingToken.js +2 -2
- package/lib/cjs/rpc/core/RpcRoutingToken.js.map +1 -1
- package/lib/cjs/rpc/core/RpcSessionInvocation.js +1 -1
- package/lib/cjs/rpc/core/RpcSessionInvocation.js.map +1 -1
- package/lib/cjs/rpc/web/BentleyCloudRpcManager.js +6 -6
- package/lib/cjs/rpc/web/BentleyCloudRpcManager.js.map +1 -1
- package/lib/cjs/rpc/web/RpcMultipart.d.ts.map +1 -1
- package/lib/cjs/rpc/web/RpcMultipart.js +13 -12
- package/lib/cjs/rpc/web/RpcMultipart.js.map +1 -1
- package/lib/cjs/rpc/web/WebAppRpcRequest.js +17 -19
- package/lib/cjs/rpc/web/WebAppRpcRequest.js.map +1 -1
- package/lib/cjs/tile/IModelTileIO.d.ts +2 -2
- package/lib/cjs/tile/IModelTileIO.js +3 -3
- package/lib/cjs/tile/IModelTileIO.js.map +1 -1
- package/lib/esm/AmbientOcclusion.js +9 -9
- package/lib/esm/AmbientOcclusion.js.map +1 -1
- package/lib/esm/AnalysisStyle.js +1 -1
- package/lib/esm/AnalysisStyle.js.map +1 -1
- package/lib/esm/Atmosphere.js +19 -21
- package/lib/esm/Atmosphere.js.map +1 -1
- package/lib/esm/BriefcaseTypes.d.ts +2 -2
- package/lib/esm/BriefcaseTypes.d.ts.map +1 -1
- package/lib/esm/BriefcaseTypes.js.map +1 -1
- package/lib/esm/ClipStyle.js +5 -5
- package/lib/esm/ClipStyle.js.map +1 -1
- package/lib/esm/ColorDef.js +10 -10
- package/lib/esm/ColorDef.js.map +1 -1
- package/lib/esm/ConcurrentQuery.d.ts +5 -1
- package/lib/esm/ConcurrentQuery.d.ts.map +1 -1
- package/lib/esm/ConcurrentQuery.js.map +1 -1
- package/lib/esm/ContourDisplay.js +5 -5
- package/lib/esm/ContourDisplay.js.map +1 -1
- package/lib/esm/ECSqlReader.d.ts.map +1 -1
- package/lib/esm/ECSqlReader.js +3 -1
- package/lib/esm/ECSqlReader.js.map +1 -1
- package/lib/esm/ElementProps.d.ts.map +1 -1
- package/lib/esm/ElementProps.js +4 -4
- package/lib/esm/ElementProps.js.map +1 -1
- package/lib/esm/Environment.js +2 -2
- package/lib/esm/Environment.js.map +1 -1
- package/lib/esm/FeatureSymbology.js +3 -3
- package/lib/esm/FeatureSymbology.js.map +1 -1
- package/lib/esm/Fonts.d.ts +69 -11
- package/lib/esm/Fonts.d.ts.map +1 -1
- package/lib/esm/Fonts.js +20 -5
- package/lib/esm/Fonts.js.map +1 -1
- package/lib/esm/Gradient.js +9 -9
- package/lib/esm/Gradient.js.map +1 -1
- package/lib/esm/GroundPlane.js +2 -2
- package/lib/esm/GroundPlane.js.map +1 -1
- package/lib/esm/HiddenLine.js +4 -4
- package/lib/esm/HiddenLine.js.map +1 -1
- package/lib/esm/IModel.d.ts +3 -12
- package/lib/esm/IModel.d.ts.map +1 -1
- package/lib/esm/IModel.js +6 -6
- package/lib/esm/IModel.js.map +1 -1
- package/lib/esm/IModelError.d.ts +0 -2
- package/lib/esm/IModelError.d.ts.map +1 -1
- package/lib/esm/IModelError.js +0 -1
- package/lib/esm/IModelError.js.map +1 -1
- package/lib/esm/ITwinError.d.ts +1 -1
- package/lib/esm/ITwinError.d.ts.map +1 -1
- package/lib/esm/ITwinError.js +1 -1
- package/lib/esm/ITwinError.js.map +1 -1
- package/lib/esm/LightSettings.js +1 -1
- package/lib/esm/LightSettings.js.map +1 -1
- package/lib/esm/PlanarClipMask.js +2 -2
- package/lib/esm/PlanarClipMask.js.map +1 -1
- package/lib/esm/RealityModelDisplaySettings.js +4 -4
- package/lib/esm/RealityModelDisplaySettings.js.map +1 -1
- package/lib/esm/RenderMaterial.js +3 -3
- package/lib/esm/RenderMaterial.js.map +1 -1
- package/lib/esm/RpcInterface.js +2 -2
- package/lib/esm/RpcInterface.js.map +1 -1
- package/lib/esm/SkyBox.js +4 -4
- package/lib/esm/SkyBox.js.map +1 -1
- package/lib/esm/SolarShadows.js +1 -1
- package/lib/esm/SolarShadows.js.map +1 -1
- package/lib/esm/SubCategoryAppearance.js +1 -1
- package/lib/esm/SubCategoryAppearance.js.map +1 -1
- package/lib/esm/SubCategoryOverride.js +2 -2
- package/lib/esm/SubCategoryOverride.js.map +1 -1
- package/lib/esm/TextureMapping.js +2 -2
- package/lib/esm/TextureMapping.js.map +1 -1
- package/lib/esm/ThematicDisplay.js +2 -2
- package/lib/esm/ThematicDisplay.js.map +1 -1
- package/lib/esm/ViewDetails.js +2 -2
- package/lib/esm/ViewDetails.js.map +1 -1
- package/lib/esm/ViewFlags.js +2 -2
- package/lib/esm/ViewFlags.js.map +1 -1
- package/lib/esm/WhiteOnWhiteReversalSettings.js +2 -2
- package/lib/esm/WhiteOnWhiteReversalSettings.js.map +1 -1
- package/lib/esm/annotation/TextStyle.js +19 -19
- package/lib/esm/annotation/TextStyle.js.map +1 -1
- package/lib/esm/core-common.d.ts +0 -1
- package/lib/esm/core-common.d.ts.map +1 -1
- package/lib/esm/core-common.js +0 -1
- package/lib/esm/core-common.js.map +1 -1
- package/lib/esm/geometry/Cartographic.js +13 -13
- package/lib/esm/geometry/Cartographic.js.map +1 -1
- package/lib/esm/ipc/IpcWebSocket.js +1 -1
- package/lib/esm/ipc/IpcWebSocket.js.map +1 -1
- package/lib/esm/ipc/IpcWebSocketTransport.js +1 -1
- package/lib/esm/ipc/IpcWebSocketTransport.js.map +1 -1
- package/lib/esm/rpc/DevToolsRpcInterface.js +6 -6
- package/lib/esm/rpc/DevToolsRpcInterface.js.map +1 -1
- package/lib/esm/rpc/IModelReadRpcInterface.js +5 -5
- package/lib/esm/rpc/IModelReadRpcInterface.js.map +1 -1
- package/lib/esm/rpc/IModelTileRpcInterface.js +4 -4
- package/lib/esm/rpc/IModelTileRpcInterface.js.map +1 -1
- package/lib/esm/rpc/SnapshotIModelRpcInterface.js +4 -4
- package/lib/esm/rpc/SnapshotIModelRpcInterface.js.map +1 -1
- package/lib/esm/rpc/core/RpcConfiguration.js +32 -34
- package/lib/esm/rpc/core/RpcConfiguration.js.map +1 -1
- package/lib/esm/rpc/core/RpcControl.js +8 -15
- package/lib/esm/rpc/core/RpcControl.js.map +1 -1
- package/lib/esm/rpc/core/RpcInvocation.js +3 -5
- package/lib/esm/rpc/core/RpcInvocation.js.map +1 -1
- package/lib/esm/rpc/core/RpcMarshaling.d.ts +0 -3
- package/lib/esm/rpc/core/RpcMarshaling.d.ts.map +1 -1
- package/lib/esm/rpc/core/RpcMarshaling.js +2 -1
- package/lib/esm/rpc/core/RpcMarshaling.js.map +1 -1
- package/lib/esm/rpc/core/RpcOperation.js +2 -2
- package/lib/esm/rpc/core/RpcOperation.js.map +1 -1
- package/lib/esm/rpc/core/RpcProtocol.js +4 -4
- package/lib/esm/rpc/core/RpcProtocol.js.map +1 -1
- package/lib/esm/rpc/core/RpcPush.js +5 -5
- package/lib/esm/rpc/core/RpcPush.js.map +1 -1
- package/lib/esm/rpc/core/RpcRequest.js +5 -5
- package/lib/esm/rpc/core/RpcRequest.js.map +1 -1
- package/lib/esm/rpc/core/RpcRoutingToken.js +2 -2
- package/lib/esm/rpc/core/RpcRoutingToken.js.map +1 -1
- package/lib/esm/rpc/core/RpcSessionInvocation.js +1 -1
- package/lib/esm/rpc/core/RpcSessionInvocation.js.map +1 -1
- package/lib/esm/rpc/web/BentleyCloudRpcManager.js +6 -6
- package/lib/esm/rpc/web/BentleyCloudRpcManager.js.map +1 -1
- package/lib/esm/rpc/web/RpcMultipart.d.ts.map +1 -1
- package/lib/esm/rpc/web/RpcMultipart.js +14 -13
- package/lib/esm/rpc/web/RpcMultipart.js.map +1 -1
- package/lib/esm/rpc/web/WebAppRpcRequest.js +17 -19
- package/lib/esm/rpc/web/WebAppRpcRequest.js.map +1 -1
- package/lib/esm/tile/IModelTileIO.d.ts +2 -2
- package/lib/esm/tile/IModelTileIO.js +3 -3
- package/lib/esm/tile/IModelTileIO.js.map +1 -1
- package/package.json +9 -9
- package/lib/cjs/rpc/WipRpcInterface.d.ts +0 -31
- package/lib/cjs/rpc/WipRpcInterface.d.ts.map +0 -1
- package/lib/cjs/rpc/WipRpcInterface.js +0 -42
- package/lib/cjs/rpc/WipRpcInterface.js.map +0 -1
- package/lib/esm/rpc/WipRpcInterface.d.ts +0 -31
- package/lib/esm/rpc/WipRpcInterface.d.ts.map +0 -1
- package/lib/esm/rpc/WipRpcInterface.js +0 -38
- package/lib/esm/rpc/WipRpcInterface.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlanarClipMask.js","sourceRoot":"","sources":["../../src/PlanarClipMask.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAyF;AAEzF;;;GAGG;AACH,IAAY,kBAyBX;AAzBD,WAAY,kBAAkB;IAC5B,kBAAkB;IAClB,2DAAQ,CAAA;IACR;;;;OAIG;IACH,mEAAY,CAAA;IACZ;;OAEG;IACH,+DAAU,CAAA;IACV;;OAEG;IACH,2FAAwB,CAAA;IACxB;;OAEG;IACH,iFAAmB,CAAA;IACnB;;OAEG;IACH,iFAAmB,CAAA;AACrB,CAAC,EAzBW,kBAAkB,kCAAlB,kBAAkB,QAyB7B;AAED;;;;GAIG;AACH,IAAY,sBASX;AATD,WAAY,sBAAsB;IAChC,sBAAsB;IACtB,yFAAqB,CAAA;IACrB,6EAA6E;IAC7E,mGAA0B,CAAA;IAC1B,4CAA4C;IAC5C,mFAAgB,CAAA;IAChB,yDAAyD;IACzD,oFAAk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+BAAQ,GAAG,IAAI,sBAAsB,CAAC,kBAAkB,CAAC,IAAI,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 { CompressedId64Set, Id64String, OrderedId64Iterable } from \"@itwin/core-bentley\";\n\n/** The different modes by which a [[PlanarClipMaskSettings]] collects the geometry used to mask a model.\n * @public\n * @extensions\n */\nexport enum PlanarClipMaskMode {\n /** No masking. */\n None = 0,\n /** Mask based on priority. Different types of models have different default priorities as enumerated by [[PlanarClipMaskPriority]].\n * For example, background maps have the lowest priority, so they are masked by all other types, while design models have the highest priority and are therefore never masked.\n * The priority of a reality model can be overridden by [[PlanarClipMaskSettings.priority]]. This is useful to allow one reality model to mask another overlapping one.\n * Everything visible in the view creates the mask, so turning off models, categories, or elements (via fully transparent overrides) will make things not be in the mask.\n */\n Priority = 1,\n /** Indicates that masks should be produced from the geometry in a set of [GeometricModel]($backend)s, regardless of what model is on or off in the view.\n * However, things that are off from category settings or element feature overrides in the view will not be in the mask for these models.\n */\n Models = 2,\n /** Indicates that masks should be produced from geometry belonging to a set of subcategories.\n * View settings do not affect what is in the mask, unless [[PlanarClipMaskSettings.subCategoryOrElementIds]] is undefined, in which case it behaves like Models mode.\n */\n IncludeSubCategories = 3,\n /** Indicates that masks should be produced from the geometry of a set of [GeometricElement]($backend)s.\n * View settings do not affect what is in the mask, unless [[PlanarClipMaskSettings.subCategoryOrElementIds]] is undefined, in which case it behaves like Models mode.\n */\n IncludeElements = 4,\n /** Indicates that masks should be produced from the geometry of all [GeometricElement]($backend)s in a view, **except** for a specified set of excluded elements.\n * View settings do not affect what is in the mask, unless [[PlanarClipMaskSettings.subCategoryOrElementIds]] is undefined, in which case it behaves like Models mode.\n */\n ExcludeElements = 5,\n}\n\n/** The default priority values for a [[PlanarClipMaskSettings]], based on model type. Models with a lower priority are masked by models with a higher priority.\n * The default can be overridden by [[PlanarClipMaskSettings.priority]].\n * @public\n * @extensions\n */\nexport enum PlanarClipMaskPriority {\n /** Background map. */\n BackgroundMap = -2048,\n /** A reality model that spans the globe - e.g., OpenStreetMaps Buildings. */\n GlobalRealityModel = -1024,\n /** A reality model with a bounded range. */\n RealityModel = 0,\n /** A design model stored in the [IModelDb]($backend). */\n DesignModel = 2048,\n}\n\n/** JSON representation of a [[PlanarClipMaskSettings]].\n * @see [[DisplayStyleSettingsProps.planarClipOvr]] and [[ContextRealityModelProps.planarClipMask]].\n * @public\n * @extensions\n */\nexport interface PlanarClipMaskProps {\n /** Controls how the mask geometry is collected */\n mode: PlanarClipMaskMode;\n /** See [[PlanarClipMaskSettings.modelIds]]. */\n modelIds?: CompressedId64Set;\n /** See [[PlanarClipMaskSettings.subCategoryOrElementIds]]. */\n subCategoryOrElementIds?: CompressedId64Set;\n /** See [[PlanarClipMaskSettings.priority]]. */\n priority?: number;\n /** See [[PlanarClipMaskSettings.transparency]]. */\n transparency?: number;\n /** See PlanarClipMaskSettings.invert */\n invert?: boolean;\n}\n\n/** Basic arguments supplied to [[PlanarClipMaskSettings.create]].\n * @public\n */\nexport interface BasicPlanarClipMaskArgs {\n /** See [[PlanarClipMaskSettings.transparency]]. */\n transparency?: number;\n /** See [[PlanarClipMaskSettings.invert]]. */\n invert?: boolean;\n}\n\n/** Arguments supplied to [[PlanarClipMaskSettings.create]] to create a mask of [[PlanarClipMaskMode.Models]].\n * @public\n */\nexport interface ModelPlanarClipMaskArgs extends BasicPlanarClipMaskArgs {\n /** See [[PlanarClipMaskSettings.modelIds]]. */\n modelIds?: Iterable<Id64String>;\n /** @internal */\n exclude?: never;\n /** @internal */\n elementIds?: never;\n /** @internal */\n subCategoryIds?: never;\n /** @internal */\n priority?: never;\n}\n\n/** Arguments supplied to [[PlanarClipMaskSettings.create]] to create a mask of [[PlanarClipMaskMode.IncludeElements]] or [[PlanarClipMaskMode.ExcludeElements]].\n * @public\n */\nexport interface ElementPlanarClipMaskArgs extends BasicPlanarClipMaskArgs {\n /** See [[PlanarClipMaskSettings.modelIds]]. */\n modelIds?: Iterable<Id64String>;\n /** The elements used by the mask. @see [[PlanarClipMaskSettings.subCategoryOrElementIds]]. */\n elementIds: Iterable<Id64String>;\n /** If true, creates a mask of [[PlanarClipMaskMode.ExcludeElements]]; otherwise, [[PlanarClipMaskMode.IncludeElements]]. */\n exclude?: boolean;\n /** @internal */\n subCategoryIds?: never;\n /** @internal */\n priority?: never;\n}\n\n/** Arguments supplied to [[PlanarClipMaskSettings.create]] to create a mask of [[PlanarClipMaskMode.IncludeSubCategories]].\n * @public\n */\nexport interface SubCategoryPlanarClipMaskArgs extends BasicPlanarClipMaskArgs {\n /** See [[PlanarClipMaskSettings.modelIds]]. */\n modelIds?: Iterable<Id64String>;\n /** The subcategories used by the mask. @see [[PlanarClipMaskSettings.subCategoryOrElementIds]]. */\n subCategoryIds: Iterable<Id64String>;\n /** @internal */\n exclude?: never;\n /** @internal */\n elementIds?: never;\n /** @internal */\n priority?: never;\n}\n\n/** Arguments supplied to [[PlanarClipMaskSettings.create]] to create a mask of [[PlanarClipMaskMode.Priority]].\n * @public\n */\nexport interface PriorityPlanarClipMaskArgs extends BasicPlanarClipMaskArgs {\n /** See [[PlanarClipMaskSettings.priority]]. */\n priority: number;\n /** @internal */\n exclude?: never;\n /** @internal */\n elementIds?: never;\n /** @internal */\n modelIds?: never;\n}\n\n/** Describes how to mask the geometry of one [GeometricModel]($backend) for display. The mask is produced by projecting geometry from any number of other models -\n * optionally filtered by [SubCategory]($backend) or by a set of specific [GeometricElement]($backend)s - onto a plane. Regions of the masked model that intersect the\n * mask are rendered partially or completely transparent. This is useful for, e.g., making subsurface geometry visible below the background map, or clipping out portions\n * of a reality model that intersect a design model.\n * @note Currently reality models (including background maps and terrain) can be masked, but design models can only produce masks.\n * @see [[DisplayStyleSettings.planarClipMasks]] to define clip masks for a [DisplayStyle]($backend).\n * @see [[ContextRealityModel.planarClipMaskSettings]] to apply a clip mask to a context reality model.\n * @public\n */\nexport class PlanarClipMaskSettings {\n /** Specifies how the mask geometry is produced. */\n public readonly mode: PlanarClipMaskMode;\n /** For any mode other than [[PlanarClipMaskMode.Priority]], the Ids of the [GeometricModel]($backend)s containing the geometry used to produce the mask,\n * and if `undefined`, no mask geometry will be created.\n * The mask geometry can be filtered by [[subCategoryOrElementIds]].\n */\n public readonly modelIds?: OrderedId64Iterable;\n /** For [[PlanarClipMaskMode.IncludeElements]] or [[PlanarClipMaskMode.ExcludedElements]], the Ids of the [GeometricElement]($backend)s to include or exclude from masking;\n * for [[PlanarClipMaskMode.IncludeSubCategories]], the Ids of the subcategories whose geometry contributes to the mask.\n * If undefined, Modes IncludeSubCategories, IncludeElements, and ExcludeElements behave like Models mode.\n */\n public readonly subCategoryOrElementIds?: OrderedId64Iterable;\n /** For [[PlanarClipMaskMode.Priority]], the priority value. */\n public readonly priority?: number;\n /** A value between 0 and 1 indicating an override for mask transparency. A transparency of 0 indicates complete masking. 1 is completely transparent (no masking).\n If no transparency is defined then the transparencies of the mask elements are used.\n */\n public readonly transparency?: number;\n /** A value of true indicates that the mask should be inverted and only content within the mask should be displayed, in other words the area inside the mask is displayed rather than outside. */\n public readonly invert: boolean;\n private readonly _modelIds?: CompressedId64Set;\n private readonly _subCategoryOrElementIds?: CompressedId64Set;\n\n /** The compressed representation of [[modelIds]]. */\n public get compressedModelIds(): CompressedId64Set | undefined {\n return this._modelIds;\n }\n\n /** Create a new [[PlanarClipMaskSettings]] object from its JSON representation. */\n public static fromJSON(json?: PlanarClipMaskProps): PlanarClipMaskSettings {\n if (!json || undefined === json.mode)\n return this.defaults;\n\n return new PlanarClipMaskSettings(json.mode, json.transparency, json.modelIds, json.subCategoryOrElementIds, json.priority, json.invert);\n }\n\n /** Create a new PlanarClipMaskSettings. */\n public static create(args: ModelPlanarClipMaskArgs | ElementPlanarClipMaskArgs | SubCategoryPlanarClipMaskArgs | PriorityPlanarClipMaskArgs): PlanarClipMaskSettings {\n const modelIds = args.modelIds ? CompressedId64Set.sortAndCompress(args.modelIds) : undefined;\n if (undefined !== args.priority)\n return new PlanarClipMaskSettings(PlanarClipMaskMode.Priority, args.transparency, undefined, undefined, args.priority, args.invert);\n else if (undefined !== args.subCategoryIds)\n return new PlanarClipMaskSettings(PlanarClipMaskMode.IncludeSubCategories, args.transparency, modelIds, CompressedId64Set.sortAndCompress(args.subCategoryIds), undefined, args.invert);\n else if (undefined !== args.elementIds)\n return new PlanarClipMaskSettings(args.exclude ? PlanarClipMaskMode.ExcludeElements : PlanarClipMaskMode.IncludeElements, args.transparency, modelIds, CompressedId64Set.sortAndCompress(args.elementIds), undefined, args.invert);\n else\n return new PlanarClipMaskSettings(PlanarClipMaskMode.Models, args.transparency, modelIds, undefined, undefined, args.invert);\n }\n\n /** Create JSON object representing this [[PlanarClipMaskSettings]] */\n public toJSON(): PlanarClipMaskProps {\n const props: PlanarClipMaskProps = { mode: this.mode };\n if (undefined !== this._modelIds)\n props.modelIds = this._modelIds;\n\n if (undefined !== this._subCategoryOrElementIds)\n props.subCategoryOrElementIds = this._subCategoryOrElementIds;\n\n if (undefined !== this.priority)\n props.priority = this.priority;\n\n if (undefined !== this.transparency)\n props.transparency = this.transparency;\n\n if (this.invert)\n props.invert = true;\n\n return props;\n }\n\n /** Returns true if masking is enabled. */\n public get isValid(): boolean {\n return this.mode !== PlanarClipMaskMode.None;\n }\n\n public equals(other: PlanarClipMaskSettings): boolean {\n return this.mode === other.mode &&\n this.priority === other.priority &&\n this.transparency === other.transparency &&\n this.invert === other.invert &&\n this._modelIds === other._modelIds &&\n this._subCategoryOrElementIds === other._subCategoryOrElementIds;\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 PlanarClipMaskSettings with all of its properties set to match those of`this`, except those explicitly defined in `changedProps`.\n */\n public clone(changedProps?: PlanarClipMaskProps): PlanarClipMaskSettings {\n if (undefined === changedProps)\n return this;\n\n return PlanarClipMaskSettings.fromJSON({\n ...this.toJSON(),\n ...changedProps,\n });\n }\n\n private constructor(mode: PlanarClipMaskMode, transparency?: number, modelIds?: CompressedId64Set, subCategoryOrElementIds?: CompressedId64Set, priority?: number, invert?: boolean) {\n this.mode = mode;\n this._modelIds = modelIds;\n this._subCategoryOrElementIds = subCategoryOrElementIds;\n this.priority = priority;\n this.invert = true === invert;\n this.transparency = undefined !== transparency ? Math.max(0, Math.min(1, transparency)) : undefined;\n\n if (modelIds)\n this.modelIds = CompressedId64Set.iterable(modelIds);\n\n if (subCategoryOrElementIds)\n this.subCategoryOrElementIds = CompressedId64Set.iterable(subCategoryOrElementIds);\n }\n\n /** A default PlanarClipMask which masks nothing. */\n public static defaults = new PlanarClipMaskSettings(PlanarClipMaskMode.None);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"PlanarClipMask.js","sourceRoot":"","sources":["../../src/PlanarClipMask.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAyF;AAEzF;;;GAGG;AACH,IAAY,kBAyBX;AAzBD,WAAY,kBAAkB;IAC5B,kBAAkB;IAClB,2DAAQ,CAAA;IACR;;;;OAIG;IACH,mEAAY,CAAA;IACZ;;OAEG;IACH,+DAAU,CAAA;IACV;;OAEG;IACH,2FAAwB,CAAA;IACxB;;OAEG;IACH,iFAAmB,CAAA;IACnB;;OAEG;IACH,iFAAmB,CAAA;AACrB,CAAC,EAzBW,kBAAkB,kCAAlB,kBAAkB,QAyB7B;AAED;;;;GAIG;AACH,IAAY,sBASX;AATD,WAAY,sBAAsB;IAChC,sBAAsB;IACtB,yFAAqB,CAAA;IACrB,6EAA6E;IAC7E,mGAA0B,CAAA;IAC1B,4CAA4C;IAC5C,mFAAgB,CAAA;IAChB,yDAAyD;IACzD,oFAAkB,CAAA;AACpB,CAAC,EATW,sBAAsB,sCAAtB,sBAAsB,QASjC;AA8FD;;;;;;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esContent":["/*---------------------------------------------------------------------------------------------\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 { CompressedId64Set, Id64String, OrderedId64Iterable } from \"@itwin/core-bentley\";\n\n/** The different modes by which a [[PlanarClipMaskSettings]] collects the geometry used to mask a model.\n * @public\n * @extensions\n */\nexport enum PlanarClipMaskMode {\n /** No masking. */\n None = 0,\n /** Mask based on priority. Different types of models have different default priorities as enumerated by [[PlanarClipMaskPriority]].\n * For example, background maps have the lowest priority, so they are masked by all other types, while design models have the highest priority and are therefore never masked.\n * The priority of a reality model can be overridden by [[PlanarClipMaskSettings.priority]]. This is useful to allow one reality model to mask another overlapping one.\n * Everything visible in the view creates the mask, so turning off models, categories, or elements (via fully transparent overrides) will make things not be in the mask.\n */\n Priority = 1,\n /** Indicates that masks should be produced from the geometry in a set of [GeometricModel]($backend)s, regardless of what model is on or off in the view.\n * However, things that are off from category settings or element feature overrides in the view will not be in the mask for these models.\n */\n Models = 2,\n /** Indicates that masks should be produced from geometry belonging to a set of subcategories.\n * View settings do not affect what is in the mask, unless [[PlanarClipMaskSettings.subCategoryOrElementIds]] is undefined, in which case it behaves like Models mode.\n */\n IncludeSubCategories = 3,\n /** Indicates that masks should be produced from the geometry of a set of [GeometricElement]($backend)s.\n * View settings do not affect what is in the mask, unless [[PlanarClipMaskSettings.subCategoryOrElementIds]] is undefined, in which case it behaves like Models mode.\n */\n IncludeElements = 4,\n /** Indicates that masks should be produced from the geometry of all [GeometricElement]($backend)s in a view, **except** for a specified set of excluded elements.\n * View settings do not affect what is in the mask, unless [[PlanarClipMaskSettings.subCategoryOrElementIds]] is undefined, in which case it behaves like Models mode.\n */\n ExcludeElements = 5,\n}\n\n/** The default priority values for a [[PlanarClipMaskSettings]], based on model type. Models with a lower priority are masked by models with a higher priority.\n * The default can be overridden by [[PlanarClipMaskSettings.priority]].\n * @public\n * @extensions\n */\nexport enum PlanarClipMaskPriority {\n /** Background map. */\n BackgroundMap = -2048,\n /** A reality model that spans the globe - e.g., OpenStreetMaps Buildings. */\n GlobalRealityModel = -1024,\n /** A reality model with a bounded range. */\n RealityModel = 0,\n /** A design model stored in the [IModelDb]($backend). */\n DesignModel = 2048,\n}\n\n/** JSON representation of a [[PlanarClipMaskSettings]].\n * @see [[DisplayStyleSettingsProps.planarClipOvr]] and [[ContextRealityModelProps.planarClipMask]].\n * @public\n * @extensions\n */\nexport interface PlanarClipMaskProps {\n /** Controls how the mask geometry is collected */\n mode: PlanarClipMaskMode;\n /** See [[PlanarClipMaskSettings.modelIds]]. */\n modelIds?: CompressedId64Set;\n /** See [[PlanarClipMaskSettings.subCategoryOrElementIds]]. */\n subCategoryOrElementIds?: CompressedId64Set;\n /** See [[PlanarClipMaskSettings.priority]]. */\n priority?: number;\n /** See [[PlanarClipMaskSettings.transparency]]. */\n transparency?: number;\n /** See PlanarClipMaskSettings.invert */\n invert?: boolean;\n}\n\n/** Basic arguments supplied to [[PlanarClipMaskSettings.create]].\n * @public\n */\nexport interface BasicPlanarClipMaskArgs {\n /** See [[PlanarClipMaskSettings.transparency]]. */\n transparency?: number;\n /** See [[PlanarClipMaskSettings.invert]]. */\n invert?: boolean;\n}\n\n/** Arguments supplied to [[PlanarClipMaskSettings.create]] to create a mask of [[PlanarClipMaskMode.Models]].\n * @public\n */\nexport interface ModelPlanarClipMaskArgs extends BasicPlanarClipMaskArgs {\n /** See [[PlanarClipMaskSettings.modelIds]]. */\n modelIds?: Iterable<Id64String>;\n /** @internal */\n exclude?: never;\n /** @internal */\n elementIds?: never;\n /** @internal */\n subCategoryIds?: never;\n /** @internal */\n priority?: never;\n}\n\n/** Arguments supplied to [[PlanarClipMaskSettings.create]] to create a mask of [[PlanarClipMaskMode.IncludeElements]] or [[PlanarClipMaskMode.ExcludeElements]].\n * @public\n */\nexport interface ElementPlanarClipMaskArgs extends BasicPlanarClipMaskArgs {\n /** See [[PlanarClipMaskSettings.modelIds]]. */\n modelIds?: Iterable<Id64String>;\n /** The elements used by the mask. @see [[PlanarClipMaskSettings.subCategoryOrElementIds]]. */\n elementIds: Iterable<Id64String>;\n /** If true, creates a mask of [[PlanarClipMaskMode.ExcludeElements]]; otherwise, [[PlanarClipMaskMode.IncludeElements]]. */\n exclude?: boolean;\n /** @internal */\n subCategoryIds?: never;\n /** @internal */\n priority?: never;\n}\n\n/** Arguments supplied to [[PlanarClipMaskSettings.create]] to create a mask of [[PlanarClipMaskMode.IncludeSubCategories]].\n * @public\n */\nexport interface SubCategoryPlanarClipMaskArgs extends BasicPlanarClipMaskArgs {\n /** See [[PlanarClipMaskSettings.modelIds]]. */\n modelIds?: Iterable<Id64String>;\n /** The subcategories used by the mask. @see [[PlanarClipMaskSettings.subCategoryOrElementIds]]. */\n subCategoryIds: Iterable<Id64String>;\n /** @internal */\n exclude?: never;\n /** @internal */\n elementIds?: never;\n /** @internal */\n priority?: never;\n}\n\n/** Arguments supplied to [[PlanarClipMaskSettings.create]] to create a mask of [[PlanarClipMaskMode.Priority]].\n * @public\n */\nexport interface PriorityPlanarClipMaskArgs extends BasicPlanarClipMaskArgs {\n /** See [[PlanarClipMaskSettings.priority]]. */\n priority: number;\n /** @internal */\n exclude?: never;\n /** @internal */\n elementIds?: never;\n /** @internal */\n modelIds?: never;\n}\n\n/** Describes how to mask the geometry of one [GeometricModel]($backend) for display. The mask is produced by projecting geometry from any number of other models -\n * optionally filtered by [SubCategory]($backend) or by a set of specific [GeometricElement]($backend)s - onto a plane. Regions of the masked model that intersect the\n * mask are rendered partially or completely transparent. This is useful for, e.g., making subsurface geometry visible below the background map, or clipping out portions\n * of a reality model that intersect a design model.\n * @note Currently reality models (including background maps and terrain) can be masked, but design models can only produce masks.\n * @see [[DisplayStyleSettings.planarClipMasks]] to define clip masks for a [DisplayStyle]($backend).\n * @see [[ContextRealityModel.planarClipMaskSettings]] to apply a clip mask to a context reality model.\n * @public\n */\nexport class PlanarClipMaskSettings {\n /** Specifies how the mask geometry is produced. */\n public readonly mode: PlanarClipMaskMode;\n /** For any mode other than [[PlanarClipMaskMode.Priority]], the Ids of the [GeometricModel]($backend)s containing the geometry used to produce the mask,\n * and if `undefined`, no mask geometry will be created.\n * The mask geometry can be filtered by [[subCategoryOrElementIds]].\n */\n public readonly modelIds?: OrderedId64Iterable;\n /** For [[PlanarClipMaskMode.IncludeElements]] or [[PlanarClipMaskMode.ExcludedElements]], the Ids of the [GeometricElement]($backend)s to include or exclude from masking;\n * for [[PlanarClipMaskMode.IncludeSubCategories]], the Ids of the subcategories whose geometry contributes to the mask.\n * If undefined, Modes IncludeSubCategories, IncludeElements, and ExcludeElements behave like Models mode.\n */\n public readonly subCategoryOrElementIds?: OrderedId64Iterable;\n /** For [[PlanarClipMaskMode.Priority]], the priority value. */\n public readonly priority?: number;\n /** A value between 0 and 1 indicating an override for mask transparency. A transparency of 0 indicates complete masking. 1 is completely transparent (no masking).\n If no transparency is defined then the transparencies of the mask elements are used.\n */\n public readonly transparency?: number;\n /** A value of true indicates that the mask should be inverted and only content within the mask should be displayed, in other words the area inside the mask is displayed rather than outside. */\n public readonly invert: boolean;\n private readonly _modelIds?: CompressedId64Set;\n private readonly _subCategoryOrElementIds?: CompressedId64Set;\n\n /** The compressed representation of [[modelIds]]. */\n public get compressedModelIds(): CompressedId64Set | undefined {\n return this._modelIds;\n }\n\n /** Create a new [[PlanarClipMaskSettings]] object from its JSON representation. */\n public static fromJSON(json?: PlanarClipMaskProps): PlanarClipMaskSettings {\n if (!json || undefined === json.mode)\n return this.defaults;\n\n return new PlanarClipMaskSettings(json.mode, json.transparency, json.modelIds, json.subCategoryOrElementIds, json.priority, json.invert);\n }\n\n /** Create a new PlanarClipMaskSettings. */\n public static create(args: ModelPlanarClipMaskArgs | ElementPlanarClipMaskArgs | SubCategoryPlanarClipMaskArgs | PriorityPlanarClipMaskArgs): PlanarClipMaskSettings {\n const modelIds = args.modelIds ? CompressedId64Set.sortAndCompress(args.modelIds) : undefined;\n if (undefined !== args.priority)\n return new PlanarClipMaskSettings(PlanarClipMaskMode.Priority, args.transparency, undefined, undefined, args.priority, args.invert);\n else if (undefined !== args.subCategoryIds)\n return new PlanarClipMaskSettings(PlanarClipMaskMode.IncludeSubCategories, args.transparency, modelIds, CompressedId64Set.sortAndCompress(args.subCategoryIds), undefined, args.invert);\n else if (undefined !== args.elementIds)\n return new PlanarClipMaskSettings(args.exclude ? PlanarClipMaskMode.ExcludeElements : PlanarClipMaskMode.IncludeElements, args.transparency, modelIds, CompressedId64Set.sortAndCompress(args.elementIds), undefined, args.invert);\n else\n return new PlanarClipMaskSettings(PlanarClipMaskMode.Models, args.transparency, modelIds, undefined, undefined, args.invert);\n }\n\n /** Create JSON object representing this [[PlanarClipMaskSettings]] */\n public toJSON(): PlanarClipMaskProps {\n const props: PlanarClipMaskProps = { mode: this.mode };\n if (undefined !== this._modelIds)\n props.modelIds = this._modelIds;\n\n if (undefined !== this._subCategoryOrElementIds)\n props.subCategoryOrElementIds = this._subCategoryOrElementIds;\n\n if (undefined !== this.priority)\n props.priority = this.priority;\n\n if (undefined !== this.transparency)\n props.transparency = this.transparency;\n\n if (this.invert)\n props.invert = true;\n\n return props;\n }\n\n /** Returns true if masking is enabled. */\n public get isValid(): boolean {\n return this.mode !== PlanarClipMaskMode.None;\n }\n\n public equals(other: PlanarClipMaskSettings): boolean {\n return this.mode === other.mode &&\n this.priority === other.priority &&\n this.transparency === other.transparency &&\n this.invert === other.invert &&\n this._modelIds === other._modelIds &&\n this._subCategoryOrElementIds === other._subCategoryOrElementIds;\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 PlanarClipMaskSettings with all of its properties set to match those of`this`, except those explicitly defined in `changedProps`.\n */\n public clone(changedProps?: PlanarClipMaskProps): PlanarClipMaskSettings {\n if (undefined === changedProps)\n return this;\n\n return PlanarClipMaskSettings.fromJSON({\n ...this.toJSON(),\n ...changedProps,\n });\n }\n\n private constructor(mode: PlanarClipMaskMode, transparency?: number, modelIds?: CompressedId64Set, subCategoryOrElementIds?: CompressedId64Set, priority?: number, invert?: boolean) {\n this.mode = mode;\n this._modelIds = modelIds;\n this._subCategoryOrElementIds = subCategoryOrElementIds;\n this.priority = priority;\n this.invert = true === invert;\n this.transparency = undefined !== transparency ? Math.max(0, Math.min(1, transparency)) : undefined;\n\n if (modelIds)\n this.modelIds = CompressedId64Set.iterable(modelIds);\n\n if (subCategoryOrElementIds)\n this.subCategoryOrElementIds = CompressedId64Set.iterable(subCategoryOrElementIds);\n }\n\n /** A default PlanarClipMask which masks nothing. */\n public static defaults = new PlanarClipMaskSettings(PlanarClipMaskMode.None);\n}\n"]}
|
|
@@ -18,6 +18,8 @@ exports.RealityModelDisplaySettings = exports.PointCloudDisplaySettings = void 0
|
|
|
18
18
|
* @beta
|
|
19
19
|
*/
|
|
20
20
|
class PointCloudDisplaySettings {
|
|
21
|
+
/** Settings with all properties initialized to their default values. */
|
|
22
|
+
static { this.defaults = new PointCloudDisplaySettings(); }
|
|
21
23
|
constructor(props) {
|
|
22
24
|
this.shape = props?.shape ?? "round";
|
|
23
25
|
this.sizeMode = props?.sizeMode ?? "voxel";
|
|
@@ -91,8 +93,6 @@ class PointCloudDisplaySettings {
|
|
|
91
93
|
}
|
|
92
94
|
}
|
|
93
95
|
exports.PointCloudDisplaySettings = PointCloudDisplaySettings;
|
|
94
|
-
/** Settings with all properties initialized to their default values. */
|
|
95
|
-
PointCloudDisplaySettings.defaults = new PointCloudDisplaySettings();
|
|
96
96
|
/** Settings that control how a reality model - whether a [[ContextRealityModel]] or a persistent reality [Model]($backend) - is displayed within a [Viewport]($frontend).
|
|
97
97
|
* @see [[ContextRealityModel.displaySettings]] to apply these settings to a context reality model.
|
|
98
98
|
* @see [[DisplayStyleSettings.setRealityModelDisplaySettings]] to apply these settings to a persistent reality model.
|
|
@@ -100,6 +100,8 @@ PointCloudDisplaySettings.defaults = new PointCloudDisplaySettings();
|
|
|
100
100
|
* @beta
|
|
101
101
|
*/
|
|
102
102
|
class RealityModelDisplaySettings {
|
|
103
|
+
/** Settings with all properties initialized to their default values. */
|
|
104
|
+
static { this.defaults = new RealityModelDisplaySettings(undefined, PointCloudDisplaySettings.defaults); }
|
|
103
105
|
constructor(overrideColorRatio, pointCloud) {
|
|
104
106
|
this.overrideColorRatio = overrideColorRatio ?? 0.5;
|
|
105
107
|
this.pointCloud = pointCloud;
|
|
@@ -137,6 +139,4 @@ class RealityModelDisplaySettings {
|
|
|
137
139
|
}
|
|
138
140
|
}
|
|
139
141
|
exports.RealityModelDisplaySettings = RealityModelDisplaySettings;
|
|
140
|
-
/** Settings with all properties initialized to their default values. */
|
|
141
|
-
RealityModelDisplaySettings.defaults = new RealityModelDisplaySettings(undefined, PointCloudDisplaySettings.defaults);
|
|
142
142
|
//# sourceMappingURL=RealityModelDisplaySettings.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RealityModelDisplaySettings.js","sourceRoot":"","sources":["../../src/RealityModelDisplaySettings.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAsEH;;;;;;;;GAQG;AACH,MAAa,yBAAyB;IAwEpC,YAAoB,KAA8B;QAChD,IAAI,CAAC,KAAK,GAAG,KAAK,EAAE,KAAK,IAAI,OAAO,CAAC;QACrC,IAAI,CAAC,QAAQ,GAAG,KAAK,EAAE,QAAQ,IAAI,OAAO,CAAC;QAE3C,8EAA8E;QAC9E,IAAI,CAAC,SAAS,GAAG,KAAK,EAAE,SAAS,IAAI,CAAC,CAAC;QACvC,IAAI,CAAC,UAAU,GAAG,KAAK,EAAE,UAAU,IAAI,CAAC,CAAC;QACzC,IAAI,CAAC,iBAAiB,GAAG,KAAK,EAAE,iBAAiB,IAAI,CAAC,CAAC;QACvD,IAAI,CAAC,iBAAiB,GAAG,KAAK,EAAE,iBAAiB,IAAI,EAAE,CAAC;QACxD,IAAI,C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,UAAU,EAAE,UAAU,CAAC,CAAC;IACjE,CAAC;;AA3DH,kEA4DC;AAhDC,wEAAwE;AAC1D,oCAAQ,GAAG,IAAI,2BAA2B,CAAC,SAAS,EAAE,yBAAyB,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 DisplayStyles\n */\n\n/** Specifies how the sizes of the individual points within a point cloud are computed.\n * - \"pixel\": Each point is an exact number of pixels in diameter, as specified by [[PointCloudDisplaySettings.pixelSize]].\n * - \"voxel\": Each point is the size of a \"voxel\" in meters, as specified by the [Tile]($frontend) to which the point belongs.\n * @see [[PointCloudDisplaySettings.sizeMode]].\n * @beta\n */\nexport type PointCloudSizeMode = \"voxel\" | \"pixel\";\n\n/** Specifies the shape drawn for each individual point within a point cloud.\n * - \"round\": Each point is drawn as a circle.\n * - \"square\": Each point is drawn as a square.\n * @see [[PointCloudDisplaySettings.shape]].\n * @beta\n */\nexport type PointCloudShape = \"square\" | \"round\";\n\n/** Specifies the Eye-Dome Lighting mode used for a point cloud.\n * - \"off\": EDL is not calculated\n * - \"on\": EDL is calculated using a single pass.\n * - \"full\" EDL is calculated with full algorithm including optional filtering\n * @see [[PointCloudDisplaySettings.edlMode]].\n * @beta\n */\nexport type PointCloudEDLMode = \"off\" | \"on\" | \"full\";\n\n/** The JSON representation of [[PointCloudDisplaySettings]].\n * @beta\n */\nexport interface PointCloudDisplayProps {\n /** See [[PointCloudDisplaySettings.sizeMode]]. */\n sizeMode?: PointCloudSizeMode;\n /** See [[PointCloudDisplaySettings.voxelScale]]. */\n voxelScale?: number;\n /** See [[PointCloudDisplaySettings.minPixelsPerVoxel]]. */\n minPixelsPerVoxel?: number;\n /** See [[PointCloudDisplaySettings.maxPixelsPerVoxel]]. */\n maxPixelsPerVoxel?: number;\n /** See [[PointCloudDisplaySettings.pixelSize]]. */\n pixelSize?: number;\n /** See [[PointCloudDisplaySettings.shape]]. */\n shape?: PointCloudShape;\n /** See [[PointCloudDisplaySettings.edlMode]]. */\n edlMode?: PointCloudEDLMode;\n /** See [[PointCloudDisplaySettings.edlStrength]]. */\n edlStrength?: number;\n /** See [[PointCloudDisplaySettings.edlRadius]]. */\n edlRadius?: number;\n /** See [[PointCloudDisplaySettings.edlFilter]]. */\n edlFilter?: number;\n /** See [[PointCloudDisplaySettings.edlMixWts1]]. */\n edlMixWts1?: number;\n /** See [[PointCloudDisplaySettings.edlMixWts2]]. */\n edlMixWts2?: number;\n /** See [[PointCloudDisplaySettings.edlMixWts4]]. */\n edlMixWts4?: number;\n}\n\n/** The JSON representation of [[RealityModelDisplaySettings]].\n * @beta\n */\nexport interface RealityModelDisplayProps {\n /** See [[RealityModelDisplaySettings.pointCloud]]. */\n pointCloud?: PointCloudDisplayProps;\n /** See [[RealityModelDisplaySettings.overrideColorRatio]]. */\n overrideColorRatio?: number;\n // ###TODO when we need it: mesh?: RealityMeshDisplayProps;\n}\n\n/** Settings that control how a point cloud reality model is displayed within a [Viewport]($frontend).\n * @note This is an immutable type - to modify its properties, use [[clone]].\n * Eye-Dome Lighting (EDL) is a non-photorealistic, image-based shading technique that was designed to improve depth\n * perception in scientific visualization. It is particularly useful for visualizing monochrome point cloud data, but\n * also can be useful for point clouds with color information.\n * @note EDL mode is ignored (off) if the view is not perspective (camera is off)\n * @see [[RealityModelDisplaySettings.pointCloud]].\n * @beta\n */\nexport class PointCloudDisplaySettings {\n /** The shape drawn for each point in the cloud.\n * Default: \"round\".\n */\n public readonly shape: PointCloudShape;\n /** The method by which the size of each individual point is computed.\n * Default: \"voxel\".\n * @see [[pixelSize]] to configure the size for \"pixel\" mode.\n * @see [[voxelScale]], [[minPixelsPerVoxel]], and [[maxPixelsPerVoxel]] to configure the size for \"voxel\" mode.\n */\n public readonly sizeMode: PointCloudSizeMode;\n /** The radius of each point in pixels, when [[sizeMode]] is \"pixel\".\n * The size is expected to be a positive integer. The maximum size will vary based on the graphics hardware in use, but typically is limited to 32 or 64 pixels.\n * Default: 1\n */\n public readonly pixelSize: number;\n /** A scale factor applied to the size of each point, when [[sizeMode]] is \"voxel\".\n * The scale is expected to be a positive floating point number.\n * Default: 1.0\n */\n public readonly voxelScale: number;\n /** If [[sizeMode]] is \"voxel\", the minimum radius of each point in pixels. It is expected to be a positive integer no greater than [[maxPixelsPerVoxel]].\n * Default: 2\n */\n public readonly minPixelsPerVoxel: number;\n /** If [[sizeMode]] is \"voxel\", the maximum radius of each point in pixels. It is expected to be a positive integer no less than [[minPixelsPerVoxel]].\n * Default: 20.\n */\n public readonly maxPixelsPerVoxel: number;\n /** The mode for the Eye-Dome Lighting (EDL) effect.\n * Default: \"off\"\n * @note EDL mode is ignored (off) if the view is not perspective (camera is off)\n */\n public readonly edlMode: PointCloudEDLMode;\n /** A strength value for the Eye Dome Lighting (EDL) effect.\n * The strength is expected to be a positive floating point number.\n * Default: 5.0\n */\n public readonly edlStrength: number;\n /** A radius value for the Eye Dome Lighting (EDL) effect.\n * The radius is expected to be a positive floating point number\n * It is used to deterimine how far away in pixels to sample for depth change\n * Default: 2.0\n */\n public readonly edlRadius: number;\n /** A flag for whether or not to apply filtering pass in the Eye Dome Lighting (EDL) effect.\n * It only applies if edlMode is \"full\"\n * Default: 1.0\n */\n public readonly edlFilter?: number;\n /** A weighting value to apply to the full image when combining it with the half and quarter sized ones\n * It only applies if edlMode is \"full\"\n * The strength is expected to be a floating point number between 0 and 1 inclusive.\n * Default: 1.0\n */\n public readonly edlMixWts1?: number;\n /** A weighting value to apply to the half sized image when combining it with the full and quarter sized ones\n * It only applies if edlMode is \"full\"\n * The strength is expected to be a floating point number between 0 and 1 inclusive.\n * Default: 0.5\n */\n public readonly edlMixWts2?: number;\n /** A weighting value to apply to the quarter sized image when combining it with the full and half sized ones\n * It only applies if edlMode is \"full\"\n * The strength is expected to be a floating point number between 0 and 1 inclusive.\n * Default: 0.25\n */\n public readonly edlMixWts4?: number;\n\n /** Settings with all properties initialized to their default values. */\n public static defaults = new PointCloudDisplaySettings();\n\n private constructor(props?: PointCloudDisplayProps) {\n this.shape = props?.shape ?? \"round\";\n this.sizeMode = props?.sizeMode ?? \"voxel\";\n\n // No sanity checks here - e.g., min < max, pixelSize and voxelScale > 0, etc.\n this.pixelSize = props?.pixelSize ?? 1;\n this.voxelScale = props?.voxelScale ?? 1;\n this.minPixelsPerVoxel = props?.minPixelsPerVoxel ?? 2;\n this.maxPixelsPerVoxel = props?.maxPixelsPerVoxel ?? 20;\n this.edlMode = props?.edlMode ?? \"off\";\n this.edlStrength = props?.edlStrength ?? 5;\n this.edlRadius = props?.edlRadius ?? 2;\n this.edlFilter = props?.edlFilter ?? 1;\n this.edlMixWts1 = props?.edlMixWts1 ?? 1.0;\n this.edlMixWts2 = props?.edlMixWts2 ?? 0.5;\n this.edlMixWts4 = props?.edlMixWts4 ?? 0.25;\n }\n\n /** Create display settings from their JSON representation. If `props` is `undefined`, the default settings are returned. */\n public static fromJSON(props?: PointCloudDisplayProps): PointCloudDisplaySettings {\n return props ? new PointCloudDisplaySettings(props) : this.defaults;\n }\n\n /** Convert these settings to their JSON representation. */\n public toJSON(): PointCloudDisplayProps | undefined {\n const defs = PointCloudDisplaySettings.defaults;\n if (this.equals(defs))\n return undefined;\n\n const props: PointCloudDisplayProps = { };\n if (this.shape !== defs.shape)\n props.shape = this.shape;\n\n if (this.sizeMode !== defs.sizeMode)\n props.sizeMode = this.sizeMode;\n\n if (this.pixelSize !== defs.pixelSize)\n props.pixelSize = this.pixelSize;\n\n if (this.voxelScale !== defs.voxelScale)\n props.voxelScale = this.voxelScale;\n\n if (this.minPixelsPerVoxel !== defs.minPixelsPerVoxel)\n props.minPixelsPerVoxel = this.minPixelsPerVoxel;\n\n if (this.maxPixelsPerVoxel !== defs.maxPixelsPerVoxel)\n props.maxPixelsPerVoxel = this.maxPixelsPerVoxel;\n\n if (this.edlMode !== defs.edlMode)\n props.edlMode = this.edlMode;\n\n if (this.edlStrength !== defs.edlStrength)\n props.edlStrength = this.edlStrength;\n\n if (this.edlRadius !== defs.edlRadius)\n props.edlRadius = this.edlRadius;\n\n if (this.edlFilter !== defs.edlFilter)\n props.edlFilter = this.edlFilter;\n\n if (this.edlMixWts1 !== defs.edlMixWts1)\n props.edlMixWts1 = this.edlMixWts1;\n\n if (this.edlMixWts2 !== defs.edlMixWts2)\n props.edlMixWts2 = this.edlMixWts2;\n\n if (this.edlMixWts4 !== defs.edlMixWts4)\n props.edlMixWts4 = this.edlMixWts4;\n\n return props;\n }\n\n /** Create a copy of these settings, identical except for any properties explicitly specified by `changedProps`. */\n public clone(changedProps: PointCloudDisplayProps): PointCloudDisplaySettings {\n return PointCloudDisplaySettings.fromJSON({\n ...this.toJSON(),\n ...changedProps,\n });\n }\n\n /** Returns true if these settings are identical to `other`. */\n public equals(other: PointCloudDisplaySettings): boolean {\n if (this === other)\n return true;\n\n return this.shape === other.shape && this.sizeMode === other.sizeMode && this.pixelSize === other.pixelSize\n && this.voxelScale === other.voxelScale && this.minPixelsPerVoxel === other.minPixelsPerVoxel && this.maxPixelsPerVoxel === other.maxPixelsPerVoxel\n && this.edlMode === other.edlMode && this.edlStrength === other.edlStrength && this.edlRadius === other.edlRadius\n && this.edlFilter === other.edlFilter\n && this.edlMixWts1 === other.edlMixWts1 && this.edlMixWts2 === other.edlMixWts2 && this.edlMixWts4 === other.edlMixWts4\n ;\n }\n}\n\n/** Settings that control how a reality model - whether a [[ContextRealityModel]] or a persistent reality [Model]($backend) - is displayed within a [Viewport]($frontend).\n * @see [[ContextRealityModel.displaySettings]] to apply these settings to a context reality model.\n * @see [[DisplayStyleSettings.setRealityModelDisplaySettings]] to apply these settings to a persistent reality model.\n * @note This is an immutable type - to modify its properties, use [[clone]].\n * @beta\n */\nexport class RealityModelDisplaySettings {\n /** If the reality model's color is overridden with another color, a ratio in [0..1] with which to mix the two colors together.\n * A ratio of 0 uses only the reality model's color, a ratio of 1 uses only the override color, and a ratio of 0.5 mixes the two colors equally.\n * The color may be overridden using [[FeatureOverrides]] such as those supplied by a [FeatureOverrideProvider]($frontend), or by applying a [[SpatialClassifier]].\n * Default: 0.5\n */\n public readonly overrideColorRatio: number;\n /** Settings that apply specifically to point cloud reality models.\n * Default: [[PointCloudDisplaySettings.defaults]].\n */\n public readonly pointCloud: PointCloudDisplaySettings;\n\n /** Settings with all properties initialized to their default values. */\n public static defaults = new RealityModelDisplaySettings(undefined, PointCloudDisplaySettings.defaults);\n\n private constructor(overrideColorRatio: number | undefined, pointCloud: PointCloudDisplaySettings) {\n this.overrideColorRatio = overrideColorRatio ?? 0.5;\n this.pointCloud = pointCloud;\n }\n\n /** Create display settings from their JSON representation. If `props` is `undefined`, the default settings are returned. */\n public static fromJSON(props?: RealityModelDisplayProps): RealityModelDisplaySettings {\n if (!props)\n return this.defaults;\n\n return new RealityModelDisplaySettings(props.overrideColorRatio, PointCloudDisplaySettings.fromJSON(props.pointCloud));\n }\n\n /** Convert these settings to their JSON representation, which is `undefined` if all of their properties match the default settings. */\n public toJSON(): RealityModelDisplayProps | undefined {\n const pointCloud = this.pointCloud.toJSON();\n const overrideColorRatio = this.overrideColorRatio === RealityModelDisplaySettings.defaults.overrideColorRatio ? undefined : this.overrideColorRatio;\n\n if (undefined === pointCloud && undefined === overrideColorRatio)\n return undefined;\n\n const props: RealityModelDisplayProps = { };\n if (undefined !== pointCloud)\n props.pointCloud = pointCloud;\n\n if (undefined !== overrideColorRatio)\n props.overrideColorRatio = overrideColorRatio;\n\n return props;\n }\n\n /** Returns true if these settings are identical to `other`. */\n public equals(other: RealityModelDisplaySettings): boolean {\n if (this === other)\n return true;\n\n return this.overrideColorRatio === other.overrideColorRatio && this.pointCloud.equals(other.pointCloud);\n }\n\n /** Create a copy of these settings, identical except for any properties explicitly specified by `changedProps`. */\n public clone(changedProps: RealityModelDisplayProps): RealityModelDisplaySettings {\n const pointCloud = changedProps.pointCloud ? this.pointCloud.clone(changedProps.pointCloud) : this.pointCloud;\n const colorRatio = changedProps.hasOwnProperty(\"overrideColorRatio\") ? changedProps.overrideColorRatio : this.overrideColorRatio;\n return new RealityModelDisplaySettings(colorRatio, pointCloud);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"RealityModelDisplaySettings.js","sourceRoot":"","sources":["../../src/RealityModelDisplaySettings.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAsEH;;;;;;;;GAQG;AACH,MAAa,yBAAyB;IAqEpC,wEAAwE;aAC1D,aAAQ,GAAG,IAAI,yBAAyB,EAAE,CAAC;IAEzD,YAAoB,KAA8B;QAChD,IAAI,CAAC,KAAK,GAAG,KAAK,EAAE,KAAK,IAAI,OAAO,CAAC;QACrC,IAAI,CAAC,QAAQ,GAAG,KAAK,EAAE,QAAQ,IAAI,OAAO,CAAC;QAE3C,8EAA8E;QAC9E,IAAI,CAAC,SAAS,GAAG,KAAK,EAAE,SAAS,IAAI,CAAC,CAAC;QACvC,IAAI,CAAC,UAAU,GAAG,KAAK,EAAE,UAAU,IAAI,CAAC,CAAC;QACzC,IAAI,CAAC,iBAAiB,GAAG,KAAK,EAAE,iBAAiB,IAAI,CAAC,CAAC;QACvD,IAAI,CAAC,iBAAiB,GAAG,KAAK,EAAE,iBAAiB,IAAI,EAAE,CAAC;QACxD,IAAI,CAAC,OAAO,GAAG,KAAK,EAAE,OAAO,IAAI,KAAK,CAAC;QACvC,IAAI,CAAC,WAAW,GAAG,KAAK,EAAE,WAAW,IAAI,CAAC,CAAC;QAC3C,IAAI,CAAC,SAAS,GAAG,KAAK,EAAE,SAAS,IAAI,CAAC,CAAC;QACvC,IAAI,CAAC,SAAS,GAAG,KAAK,EAAE,SAAS,IAAI,CAAC,CAAC;QACvC,IAAI,CAAC,UAAU,GAAG,KAAK,EAAE,UAAU,IAAI,GAAG,CAAC;QAC3C,IAAI,CAAC,UAAU,GAAG,KAAK,EAAE,UAAU,IAAI,GAAG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KAAK,kBAAkB;YAC9D,OAAO,SAAS,CAAC;QAEnB,MAAM,KAAK,GAA6B,EAAG,CAAC;QAC5C,IAAI,SAAS,KAAK,UAAU;YAC1B,KAAK,CAAC,UAAU,GAAG,UAAU,CAAC;QAEhC,IAAI,SAAS,KAAK,kBAAkB;YAClC,KAAK,CAAC,kBAAkB,GAAG,kBAAkB,CAAC;QAEhD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,+DAA+D;IACxD,MAAM,CAAC,KAAkC;QAC9C,IAAI,IAAI,KAAK,KAAK;YAChB,OAAO,IAAI,CAAC;QAEd,OAAO,IAAI,CAAC,kBAAkB,KAAK,KAAK,CAAC,kBAAkB,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;IAC1G,CAAC;IAED,mHAAmH;IAC5G,KAAK,CAAC,YAAsC;QACjD,MAAM,UAAU,GAAG,YAAY,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC;QAC9G,MAAM,UAAU,GAAG,YAAY,CAAC,cAAc,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,kBAAkB,CAAC,CAAC,CAAC,IAAI,CAAC,kBAAkB,CAAC;QACjI,OAAO,IAAI,2BAA2B,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;IACjE,CAAC;;AA3DH,kEA4DC","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\n/** Specifies how the sizes of the individual points within a point cloud are computed.\n * - \"pixel\": Each point is an exact number of pixels in diameter, as specified by [[PointCloudDisplaySettings.pixelSize]].\n * - \"voxel\": Each point is the size of a \"voxel\" in meters, as specified by the [Tile]($frontend) to which the point belongs.\n * @see [[PointCloudDisplaySettings.sizeMode]].\n * @beta\n */\nexport type PointCloudSizeMode = \"voxel\" | \"pixel\";\n\n/** Specifies the shape drawn for each individual point within a point cloud.\n * - \"round\": Each point is drawn as a circle.\n * - \"square\": Each point is drawn as a square.\n * @see [[PointCloudDisplaySettings.shape]].\n * @beta\n */\nexport type PointCloudShape = \"square\" | \"round\";\n\n/** Specifies the Eye-Dome Lighting mode used for a point cloud.\n * - \"off\": EDL is not calculated\n * - \"on\": EDL is calculated using a single pass.\n * - \"full\" EDL is calculated with full algorithm including optional filtering\n * @see [[PointCloudDisplaySettings.edlMode]].\n * @beta\n */\nexport type PointCloudEDLMode = \"off\" | \"on\" | \"full\";\n\n/** The JSON representation of [[PointCloudDisplaySettings]].\n * @beta\n */\nexport interface PointCloudDisplayProps {\n /** See [[PointCloudDisplaySettings.sizeMode]]. */\n sizeMode?: PointCloudSizeMode;\n /** See [[PointCloudDisplaySettings.voxelScale]]. */\n voxelScale?: number;\n /** See [[PointCloudDisplaySettings.minPixelsPerVoxel]]. */\n minPixelsPerVoxel?: number;\n /** See [[PointCloudDisplaySettings.maxPixelsPerVoxel]]. */\n maxPixelsPerVoxel?: number;\n /** See [[PointCloudDisplaySettings.pixelSize]]. */\n pixelSize?: number;\n /** See [[PointCloudDisplaySettings.shape]]. */\n shape?: PointCloudShape;\n /** See [[PointCloudDisplaySettings.edlMode]]. */\n edlMode?: PointCloudEDLMode;\n /** See [[PointCloudDisplaySettings.edlStrength]]. */\n edlStrength?: number;\n /** See [[PointCloudDisplaySettings.edlRadius]]. */\n edlRadius?: number;\n /** See [[PointCloudDisplaySettings.edlFilter]]. */\n edlFilter?: number;\n /** See [[PointCloudDisplaySettings.edlMixWts1]]. */\n edlMixWts1?: number;\n /** See [[PointCloudDisplaySettings.edlMixWts2]]. */\n edlMixWts2?: number;\n /** See [[PointCloudDisplaySettings.edlMixWts4]]. */\n edlMixWts4?: number;\n}\n\n/** The JSON representation of [[RealityModelDisplaySettings]].\n * @beta\n */\nexport interface RealityModelDisplayProps {\n /** See [[RealityModelDisplaySettings.pointCloud]]. */\n pointCloud?: PointCloudDisplayProps;\n /** See [[RealityModelDisplaySettings.overrideColorRatio]]. */\n overrideColorRatio?: number;\n // ###TODO when we need it: mesh?: RealityMeshDisplayProps;\n}\n\n/** Settings that control how a point cloud reality model is displayed within a [Viewport]($frontend).\n * @note This is an immutable type - to modify its properties, use [[clone]].\n * Eye-Dome Lighting (EDL) is a non-photorealistic, image-based shading technique that was designed to improve depth\n * perception in scientific visualization. It is particularly useful for visualizing monochrome point cloud data, but\n * also can be useful for point clouds with color information.\n * @note EDL mode is ignored (off) if the view is not perspective (camera is off)\n * @see [[RealityModelDisplaySettings.pointCloud]].\n * @beta\n */\nexport class PointCloudDisplaySettings {\n /** The shape drawn for each point in the cloud.\n * Default: \"round\".\n */\n public readonly shape: PointCloudShape;\n /** The method by which the size of each individual point is computed.\n * Default: \"voxel\".\n * @see [[pixelSize]] to configure the size for \"pixel\" mode.\n * @see [[voxelScale]], [[minPixelsPerVoxel]], and [[maxPixelsPerVoxel]] to configure the size for \"voxel\" mode.\n */\n public readonly sizeMode: PointCloudSizeMode;\n /** The radius of each point in pixels, when [[sizeMode]] is \"pixel\".\n * The size is expected to be a positive integer. The maximum size will vary based on the graphics hardware in use, but typically is limited to 32 or 64 pixels.\n * Default: 1\n */\n public readonly pixelSize: number;\n /** A scale factor applied to the size of each point, when [[sizeMode]] is \"voxel\".\n * The scale is expected to be a positive floating point number.\n * Default: 1.0\n */\n public readonly voxelScale: number;\n /** If [[sizeMode]] is \"voxel\", the minimum radius of each point in pixels. It is expected to be a positive integer no greater than [[maxPixelsPerVoxel]].\n * Default: 2\n */\n public readonly minPixelsPerVoxel: number;\n /** If [[sizeMode]] is \"voxel\", the maximum radius of each point in pixels. It is expected to be a positive integer no less than [[minPixelsPerVoxel]].\n * Default: 20.\n */\n public readonly maxPixelsPerVoxel: number;\n /** The mode for the Eye-Dome Lighting (EDL) effect.\n * Default: \"off\"\n * @note EDL mode is ignored (off) if the view is not perspective (camera is off)\n */\n public readonly edlMode: PointCloudEDLMode;\n /** A strength value for the Eye Dome Lighting (EDL) effect.\n * The strength is expected to be a positive floating point number.\n * Default: 5.0\n */\n public readonly edlStrength: number;\n /** A radius value for the Eye Dome Lighting (EDL) effect.\n * The radius is expected to be a positive floating point number\n * It is used to deterimine how far away in pixels to sample for depth change\n * Default: 2.0\n */\n public readonly edlRadius: number;\n /** A flag for whether or not to apply filtering pass in the Eye Dome Lighting (EDL) effect.\n * It only applies if edlMode is \"full\"\n * Default: 1.0\n */\n public readonly edlFilter?: number;\n /** A weighting value to apply to the full image when combining it with the half and quarter sized ones\n * It only applies if edlMode is \"full\"\n * The strength is expected to be a floating point number between 0 and 1 inclusive.\n * Default: 1.0\n */\n public readonly edlMixWts1?: number;\n /** A weighting value to apply to the half sized image when combining it with the full and quarter sized ones\n * It only applies if edlMode is \"full\"\n * The strength is expected to be a floating point number between 0 and 1 inclusive.\n * Default: 0.5\n */\n public readonly edlMixWts2?: number;\n /** A weighting value to apply to the quarter sized image when combining it with the full and half sized ones\n * It only applies if edlMode is \"full\"\n * The strength is expected to be a floating point number between 0 and 1 inclusive.\n * Default: 0.25\n */\n public readonly edlMixWts4?: number;\n\n /** Settings with all properties initialized to their default values. */\n public static defaults = new PointCloudDisplaySettings();\n\n private constructor(props?: PointCloudDisplayProps) {\n this.shape = props?.shape ?? \"round\";\n this.sizeMode = props?.sizeMode ?? \"voxel\";\n\n // No sanity checks here - e.g., min < max, pixelSize and voxelScale > 0, etc.\n this.pixelSize = props?.pixelSize ?? 1;\n this.voxelScale = props?.voxelScale ?? 1;\n this.minPixelsPerVoxel = props?.minPixelsPerVoxel ?? 2;\n this.maxPixelsPerVoxel = props?.maxPixelsPerVoxel ?? 20;\n this.edlMode = props?.edlMode ?? \"off\";\n this.edlStrength = props?.edlStrength ?? 5;\n this.edlRadius = props?.edlRadius ?? 2;\n this.edlFilter = props?.edlFilter ?? 1;\n this.edlMixWts1 = props?.edlMixWts1 ?? 1.0;\n this.edlMixWts2 = props?.edlMixWts2 ?? 0.5;\n this.edlMixWts4 = props?.edlMixWts4 ?? 0.25;\n }\n\n /** Create display settings from their JSON representation. If `props` is `undefined`, the default settings are returned. */\n public static fromJSON(props?: PointCloudDisplayProps): PointCloudDisplaySettings {\n return props ? new PointCloudDisplaySettings(props) : this.defaults;\n }\n\n /** Convert these settings to their JSON representation. */\n public toJSON(): PointCloudDisplayProps | undefined {\n const defs = PointCloudDisplaySettings.defaults;\n if (this.equals(defs))\n return undefined;\n\n const props: PointCloudDisplayProps = { };\n if (this.shape !== defs.shape)\n props.shape = this.shape;\n\n if (this.sizeMode !== defs.sizeMode)\n props.sizeMode = this.sizeMode;\n\n if (this.pixelSize !== defs.pixelSize)\n props.pixelSize = this.pixelSize;\n\n if (this.voxelScale !== defs.voxelScale)\n props.voxelScale = this.voxelScale;\n\n if (this.minPixelsPerVoxel !== defs.minPixelsPerVoxel)\n props.minPixelsPerVoxel = this.minPixelsPerVoxel;\n\n if (this.maxPixelsPerVoxel !== defs.maxPixelsPerVoxel)\n props.maxPixelsPerVoxel = this.maxPixelsPerVoxel;\n\n if (this.edlMode !== defs.edlMode)\n props.edlMode = this.edlMode;\n\n if (this.edlStrength !== defs.edlStrength)\n props.edlStrength = this.edlStrength;\n\n if (this.edlRadius !== defs.edlRadius)\n props.edlRadius = this.edlRadius;\n\n if (this.edlFilter !== defs.edlFilter)\n props.edlFilter = this.edlFilter;\n\n if (this.edlMixWts1 !== defs.edlMixWts1)\n props.edlMixWts1 = this.edlMixWts1;\n\n if (this.edlMixWts2 !== defs.edlMixWts2)\n props.edlMixWts2 = this.edlMixWts2;\n\n if (this.edlMixWts4 !== defs.edlMixWts4)\n props.edlMixWts4 = this.edlMixWts4;\n\n return props;\n }\n\n /** Create a copy of these settings, identical except for any properties explicitly specified by `changedProps`. */\n public clone(changedProps: PointCloudDisplayProps): PointCloudDisplaySettings {\n return PointCloudDisplaySettings.fromJSON({\n ...this.toJSON(),\n ...changedProps,\n });\n }\n\n /** Returns true if these settings are identical to `other`. */\n public equals(other: PointCloudDisplaySettings): boolean {\n if (this === other)\n return true;\n\n return this.shape === other.shape && this.sizeMode === other.sizeMode && this.pixelSize === other.pixelSize\n && this.voxelScale === other.voxelScale && this.minPixelsPerVoxel === other.minPixelsPerVoxel && this.maxPixelsPerVoxel === other.maxPixelsPerVoxel\n && this.edlMode === other.edlMode && this.edlStrength === other.edlStrength && this.edlRadius === other.edlRadius\n && this.edlFilter === other.edlFilter\n && this.edlMixWts1 === other.edlMixWts1 && this.edlMixWts2 === other.edlMixWts2 && this.edlMixWts4 === other.edlMixWts4\n ;\n }\n}\n\n/** Settings that control how a reality model - whether a [[ContextRealityModel]] or a persistent reality [Model]($backend) - is displayed within a [Viewport]($frontend).\n * @see [[ContextRealityModel.displaySettings]] to apply these settings to a context reality model.\n * @see [[DisplayStyleSettings.setRealityModelDisplaySettings]] to apply these settings to a persistent reality model.\n * @note This is an immutable type - to modify its properties, use [[clone]].\n * @beta\n */\nexport class RealityModelDisplaySettings {\n /** If the reality model's color is overridden with another color, a ratio in [0..1] with which to mix the two colors together.\n * A ratio of 0 uses only the reality model's color, a ratio of 1 uses only the override color, and a ratio of 0.5 mixes the two colors equally.\n * The color may be overridden using [[FeatureOverrides]] such as those supplied by a [FeatureOverrideProvider]($frontend), or by applying a [[SpatialClassifier]].\n * Default: 0.5\n */\n public readonly overrideColorRatio: number;\n /** Settings that apply specifically to point cloud reality models.\n * Default: [[PointCloudDisplaySettings.defaults]].\n */\n public readonly pointCloud: PointCloudDisplaySettings;\n\n /** Settings with all properties initialized to their default values. */\n public static defaults = new RealityModelDisplaySettings(undefined, PointCloudDisplaySettings.defaults);\n\n private constructor(overrideColorRatio: number | undefined, pointCloud: PointCloudDisplaySettings) {\n this.overrideColorRatio = overrideColorRatio ?? 0.5;\n this.pointCloud = pointCloud;\n }\n\n /** Create display settings from their JSON representation. If `props` is `undefined`, the default settings are returned. */\n public static fromJSON(props?: RealityModelDisplayProps): RealityModelDisplaySettings {\n if (!props)\n return this.defaults;\n\n return new RealityModelDisplaySettings(props.overrideColorRatio, PointCloudDisplaySettings.fromJSON(props.pointCloud));\n }\n\n /** Convert these settings to their JSON representation, which is `undefined` if all of their properties match the default settings. */\n public toJSON(): RealityModelDisplayProps | undefined {\n const pointCloud = this.pointCloud.toJSON();\n const overrideColorRatio = this.overrideColorRatio === RealityModelDisplaySettings.defaults.overrideColorRatio ? undefined : this.overrideColorRatio;\n\n if (undefined === pointCloud && undefined === overrideColorRatio)\n return undefined;\n\n const props: RealityModelDisplayProps = { };\n if (undefined !== pointCloud)\n props.pointCloud = pointCloud;\n\n if (undefined !== overrideColorRatio)\n props.overrideColorRatio = overrideColorRatio;\n\n return props;\n }\n\n /** Returns true if these settings are identical to `other`. */\n public equals(other: RealityModelDisplaySettings): boolean {\n if (this === other)\n return true;\n\n return this.overrideColorRatio === other.overrideColorRatio && this.pointCloud.equals(other.pointCloud);\n }\n\n /** Create a copy of these settings, identical except for any properties explicitly specified by `changedProps`. */\n public clone(changedProps: RealityModelDisplayProps): RealityModelDisplaySettings {\n const pointCloud = changedProps.pointCloud ? this.pointCloud.clone(changedProps.pointCloud) : this.pointCloud;\n const colorRatio = changedProps.hasOwnProperty(\"overrideColorRatio\") ? changedProps.overrideColorRatio : this.overrideColorRatio;\n return new RealityModelDisplaySettings(colorRatio, pointCloud);\n }\n}\n"]}
|
|
@@ -50,6 +50,9 @@ exports.RenderMaterial = RenderMaterial;
|
|
|
50
50
|
this.shadows = true;
|
|
51
51
|
this.key = key;
|
|
52
52
|
}
|
|
53
|
+
/** Obtain an immutable instance of a RenderMaterial with all default properties. */
|
|
54
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
55
|
+
static { this.defaults = new Params(); }
|
|
53
56
|
/** A value from 0.0 (fully-transparent) to 1.0 (fully-opaque) controlling the transparency of surfaces to which this material is applied;
|
|
54
57
|
* or undefined if this material does not override surface transparency.
|
|
55
58
|
*/
|
|
@@ -71,9 +74,6 @@ exports.RenderMaterial = RenderMaterial;
|
|
|
71
74
|
return materialParams;
|
|
72
75
|
}
|
|
73
76
|
}
|
|
74
|
-
/** Obtain an immutable instance of a RenderMaterial with all default properties. */
|
|
75
|
-
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
76
|
-
Params.defaults = new Params();
|
|
77
77
|
RenderMaterial.Params = Params;
|
|
78
78
|
})(RenderMaterial || (exports.RenderMaterial = RenderMaterial = {}));
|
|
79
79
|
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RenderMaterial.js","sourceRoot":"","sources":["../../src/RenderMaterial.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAuE;AAIvE;;GAEG;AACH,MAAsB,cAAc;IAQlC,YAAsB,MAAyD;QAC7E,IAAI,CAAC,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC;QACtB,IAAI,CAAC,cAAc,GAAG,MAAM,CAAC,cAAc,CAAC;QAC5C,IAAI,CAAC,KAAK,GAAG,mBAAI,CAAC,WAAW,EAAE,CAAC;IAClC,CAAC;IAED,IAAW,UAAU;QACnB,OAAO,SAAS,KAAK,IAAI,CAAC,cAAc,EAAE,OAAO,CAAC;IACpD,CAAC;IAED,oFAAoF;IAC7E,OAAO,CAAC,KAAqB;QAClC,OAAO,IAAA,6BAAc,EAAC,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;IACjD,CAAC;CACF;AAtBD,wCAsBC;AAED,cAAc;AACd,WAAiB,cAAc;IAC7B,SAAS,sBAAsB,CAAC,KAAa;QAC3C,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC;IAC7C,CAA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AAM,SAuDlB,CAAA;AACH,CAAC,EA9DgB,cAAc,8BAAd,cAAc,QA8D9B;AAED,4DAA4D;AAC5D,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,MAAM,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 { compareStrings, Guid, GuidString } from \"@itwin/core-bentley\";\nimport { ColorDef } from \"./ColorDef\";\nimport { TextureMapping } from \"./TextureMapping\";\n\n/** Represents a material which can be applied to a surface to control aspects of its appearance such as color, reflectivity, texture, and so on.\n * @public\n */\nexport abstract class RenderMaterial {\n /** If the material originated from a Material element in the [[IModelDb]], the Id of that element. */\n public readonly key?: string;\n /** Describes how to map an image to a surface to which this material is applied. */\n public readonly textureMapping?: TextureMapping;\n /** Used for ordered comparisons, e.g. in DisplayParams.compareForMerge */\n private readonly _guid: GuidString;\n\n protected constructor(params: { key?: string, textureMapping?: TextureMapping }) {\n this.key = params.key;\n this.textureMapping = params.textureMapping;\n this._guid = Guid.createValue();\n }\n\n public get hasTexture(): boolean {\n return undefined !== this.textureMapping?.texture;\n }\n\n /** An [OrderedComparator]($bentley) that compares this material against `other`. */\n public compare(other: RenderMaterial): number {\n return compareStrings(this._guid, other._guid);\n }\n}\n\n/** @public */\nexport namespace RenderMaterial {\n function clampToNormalizedRange(value: number): number {\n return Math.max(0.0, Math.min(1.0, value));\n }\n\n /** @deprecated in 3.x. Use [CreateRenderMaterialArgs]($frontend). */\n export class Params {\n /** If the material originates from a Material element in the [[IModel]], the Id of that element. */\n public key?: string;\n /** Diffuse color, or undefined if this material does not override the surface's own color. */\n public diffuseColor?: ColorDef;\n /** Specular color. Defaults to white if undefined. */\n public specularColor?: ColorDef;\n /** Currently unused. @alpha */\n public emissiveColor?: ColorDef;\n /** Currently unused. @alpha */\n public reflectColor?: ColorDef;\n /** Optional pattern mapping applied to the surface. */\n public textureMapping?: TextureMapping;\n /** Diffuse weight in [0..1] */\n public diffuse: number = 0.6;\n /** Specular weight in [0..1] */\n public specular: number = 0.4;\n public specularExponent: number = 13.5;\n /** Currently unused. @alpha */\n public reflect: number = 0.0;\n /** Currently unused. @alpha */\n public refract: number = 1.0;\n /** Currently unused. @alpha */\n public ambient: number = .3;\n /** Currently unused. @alpha */\n public shadows = true;\n private _alpha?: number;\n\n public constructor(key?: string) { this.key = key; }\n\n /** Obtain an immutable instance of a RenderMaterial with all default properties. */\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n public static readonly defaults = new Params();\n\n /** A value from 0.0 (fully-transparent) to 1.0 (fully-opaque) controlling the transparency of surfaces to which this material is applied;\n * or undefined if this material does not override surface transparency.\n */\n public get alpha(): number | undefined { return this._alpha; }\n public set alpha(alpha: number | undefined) {\n this._alpha = undefined !== alpha ? clampToNormalizedRange(alpha) : undefined;\n }\n\n /** Create a RenderMaterial params object using specified key and ColorDef values, as well as an optional texture mapping. */\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n public static fromColors(key?: string, diffuseColor?: ColorDef, specularColor?: ColorDef, emissiveColor?: ColorDef, reflectColor?: ColorDef, textureMap?: TextureMapping): Params {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n const materialParams = new Params();\n materialParams.key = key;\n materialParams.diffuseColor = diffuseColor;\n materialParams.specularColor = specularColor;\n materialParams.emissiveColor = emissiveColor;\n materialParams.reflectColor = reflectColor;\n materialParams.textureMapping = textureMap;\n return materialParams;\n }\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/no-deprecated\nObject.freeze(RenderMaterial.Params.defaults);\n"]}
|
package/lib/cjs/RpcInterface.js
CHANGED
|
@@ -141,7 +141,7 @@ async function handleNotFound(request, status, dispatch) {
|
|
|
141
141
|
let resubmitted = false;
|
|
142
142
|
RpcRequest_1.RpcRequest.notFoundHandlers.raiseEvent(request, status.responseValue, async () => {
|
|
143
143
|
if (resubmitted) {
|
|
144
|
-
throw new IModelError_1.IModelError(
|
|
144
|
+
throw new IModelError_1.IModelError(core_bentley_1.BentleyStatus.ERROR, `Already resubmitted using this handler.`);
|
|
145
145
|
}
|
|
146
146
|
resubmitted = true;
|
|
147
147
|
try {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RpcInterface.js","sourceRoot":"","sources":["../../src/RpcInterface.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F;;GAEG;AACH,kEAAyF;AACzF,wDAAyD;AACzD,sDAAkE;AAClE,gEAA6D;AAC7D,iDAAqE;AAGrE,+CAA2E;AAC3E,0DAA4E;AAC5E,sDAAiD;AAyBjD;;;GAGG;AACH,MAAsB,YAAY;IAExB,MAAM,CAAC,QAAQ,CAAC,OAAmB,EAAE,QAAoB;QAC/D,OAAO,OAAO,CAAC,KAAK,KAAK,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;YACjD,OAAO,CAAC,KAAK,KAAK,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;gBAC1C,OAAO,CAAC,KAAK,KAAK,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;oBAC1C,OAAO,CAAC,UAAU,KAAK,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC;wBACzD,MAAM,CAAC;IACjB,CAAC;IAEO,MAAM,CAAC,QAAQ,CAAC,OAAe;QACrC,+CAA+C;QAC/C,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QACpC,sDAAsD;QACtD,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAEnC,MAAM,GAAG,GAAe,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,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,CAAC;QAExB,uBAAU,CAAC,gBAAgB,CAAC,UAAU,CAAC,OAAO,EAAE,MAAM,CAAC,aAAoC,EAAE,KAAK,IAAI,EAAE;YACtG,IAAI,WAAW,EAAE,CAAC;gBAChB,MAAM,IAAI,yBAAW,CAAC,2BAAa,CAAC,KAAK,EAAE,yCAAyC,CAAC,CAAC;YACxF,CAAC;YAED,WAAW,GAAG,IAAI,CAAC;YAEnB,IAAI,CAAC;gBACH,MAAM,QAAQ,GAAG,MAAM,QAAQ,EAAE,CAAC;gBAClC,OAAO,CAAC,QAAQ,CAAC,CAAC;YACpB,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,sEAAsE;YACrF,CAAC;QACH,CAAC,EAAE,MAAM,CAAC,CAAC;IACb,CAAC,CAAC,CAAC;AACL,CAAC;AAED,KAAK,UAAU,eAAe;IAC5B,MAAM,IAAI,4BAAc,EAAE,CAAC;AAC7B,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 RpcInterface\n */\nimport { RpcConfiguration, RpcConfigurationSupplier } from \"./rpc/core/RpcConfiguration\";\nimport { CURRENT_REQUEST } from \"./rpc/core/RpcRegistry\";\nimport { aggregateLoad, RpcRequest } from \"./rpc/core/RpcRequest\";\nimport { RpcRoutingToken } from \"./rpc/core/RpcRoutingToken\";\nimport { InterceptedRpcRequest, IpcSession } from \"./ipc/IpcSession\";\nimport { RpcSerializedValue } from \"./rpc/core/RpcMarshaling\";\nimport { RpcManagedStatus } from \"./rpc/core/RpcProtocol\";\nimport { BentleyStatus, IModelError, NoContentError } from \"./IModelError\";\nimport { RpcRequestEvent, RpcRequestStatus } from \"./rpc/core/RpcConstants\";\nimport { BeDuration } from \"@itwin/core-bentley\";\nimport { RpcNotFoundResponse } from \"./rpc/core/RpcControl\";\n\n/* eslint-disable @typescript-eslint/no-deprecated */\n\n/**\n * Specifies the required static properties of an RpcInterface class.\n * These properties are used to identify RPC requests and responses.\n * @beta\n */\nexport interface RpcInterfaceDefinition<T extends RpcInterface = RpcInterface> { prototype: T, interfaceName: string, interfaceVersion: string }\n\n/**\n * A class that implements the operations of an RPC interface.\n * @beta\n */\nexport type RpcInterfaceImplementation<T extends RpcInterface = RpcInterface> = new () => T;\n\ninterface SemverType {\n major: number;\n minor: number;\n patch: number;\n prerelease?: string;\n}\n\n/** An RPC interface is a set of operations exposed by a service that a client can call, using configurable protocols,\n * in a platform-independent way. TheRpcInterface class is the base class for RPC interface definitions and implementations.\n * @public\n */\nexport abstract class RpcInterface {\n\n private static findDiff(backend: SemverType, frontend: SemverType) {\n return backend.major !== frontend.major ? \"major\" :\n backend.minor !== frontend.minor ? \"minor\" :\n backend.patch !== frontend.patch ? \"patch\" :\n backend.prerelease !== frontend.prerelease ? \"prerelease\" :\n \"same\";\n }\n\n private static parseVer(version: string): SemverType {\n // separate the version from the prerelease tag\n const parts = version.split(/[:-]/);\n // Split the major.minor.path into separate components\n const prefix = parts[0].split(\".\");\n\n const ver: SemverType = { major: Number(prefix[0]), minor: Number(prefix[1]), patch: Number(prefix[2]) };\n if (parts.length > 1)\n ver.prerelease = parts[1];\n return ver;\n }\n\n /** Determines whether the backend version of an RPC interface is compatible (according to semantic versioning) with the frontend version of the interface. */\n public static isVersionCompatible(backend: string, frontend: string): boolean {\n if (backend === frontend)\n return true; // most common case, versions are identical\n\n const backendSemver = this.parseVer(backend);\n const frontendSemver = this.parseVer(frontend);\n\n // if either has a prerelease tag, they are not compatible unless version strings are identical\n if (backendSemver.prerelease || frontendSemver.prerelease)\n return false;\n\n const difference = this.findDiff(backendSemver, frontendSemver);\n // If the major versions are different, the versions are not compatible\n if (difference === \"major\")\n return false;\n\n // special case for major version 0. If patch difference, backend patch must be greater than frontend patch\n if (backendSemver.major === 0)\n return (difference === \"patch\" && frontendSemver.patch < backendSemver.patch);\n\n // patch difference is fine. If minor versions differ, compatible as long as backend minor version is greater\n return difference === \"patch\" || (difference === \"minor\" && frontendSemver.minor < backendSemver.minor);\n }\n\n /** The configuration for the RPC interface.\n * @internal\n */\n public readonly configuration: RpcConfiguration;\n\n /** @internal */\n public readonly routing: RpcRoutingToken;\n\n /** @beta */\n public constructor(routing: RpcRoutingToken = RpcRoutingToken.default) {\n this.routing = routing;\n this.configuration = RpcConfiguration.supply(this);\n }\n\n /** Obtains the implementation result for an RPC operation. */\n public async forward<T = any>(parameters: IArguments): Promise<T> {\n const parametersCompat = (arguments.length === 1 && typeof (parameters) === \"object\") ? parameters : arguments;\n const parametersArray = Array.isArray(parametersCompat) ? parametersCompat : Array.prototype.slice.call(parametersCompat);\n const operationName = parametersArray.pop();\n\n const session = IpcSession.active;\n if (session) {\n return intercept(session, this, operationName, parametersArray);\n } else {\n const request = new (this.configuration.protocol.requestType as any)(this, operationName, parametersArray) as RpcRequest;\n request.submit(); // eslint-disable-line @typescript-eslint/no-floating-promises\n (this as any)[CURRENT_REQUEST] = request;\n return request.response;\n }\n }\n\n /** @internal */\n public configurationSupplier: RpcConfigurationSupplier | undefined;\n}\n\nRpcInterface.prototype.configurationSupplier = undefined;\n\nclass InterceptedRequest extends RpcRequest {\n protected override async load(): Promise<RpcSerializedValue> { throw new Error(); }\n protected override async send(): Promise<number> { throw new Error(); }\n protected override setHeader(_name: string, _value: string): void { throw new Error(); }\n}\n\nasync function intercept(session: IpcSession, client: RpcInterface, operation: string, parameters: any[]) {\n const request = new InterceptedRequest(client, operation, []);\n (client as any)[CURRENT_REQUEST] = request;\n\n const context = await client.configuration.protocol.serialize(request);\n request.parameters = parameters;\n\n const info: InterceptedRpcRequest = {\n definition: {\n interfaceName: context.operation.interfaceDefinition,\n interfaceVersion: context.operation.interfaceVersion,\n },\n operation,\n parameters,\n context: {\n applicationId: context.applicationId,\n applicationVersion: context.applicationVersion,\n id: context.id,\n sessionId: context.sessionId,\n protocolVersion: (context.protocolVersion || 0).toString(),\n },\n };\n\n const dispatch = async () => {\n aggregateLoad.lastRequest = new Date().getTime();\n\n const response = await session.handleRpc(info);\n\n aggregateLoad.lastResponse = new Date().getTime();\n\n if (typeof (response) === \"object\" && response.hasOwnProperty(\"iTwinRpcCoreResponse\") && response.hasOwnProperty(\"managedStatus\")) {\n const status: RpcManagedStatus = response;\n\n if (status.managedStatus === \"pending\") {\n return handlePending(request, status, dispatch);\n } else if (status.managedStatus === \"notFound\") {\n return handleNotFound(request, status, dispatch);\n } else if (status.managedStatus === \"noContent\") {\n return handleNoContent();\n }\n } else {\n return response;\n }\n };\n\n return dispatch();\n}\n\nasync function handlePending(request: InterceptedRequest, status: RpcManagedStatus, dispatch: () => Promise<any>) {\n request._status = RpcRequestStatus.Pending;\n request._extendedStatus = (status.responseValue as { message: string }).message;\n RpcRequest.events.raiseEvent(RpcRequestEvent.PendingUpdateReceived, request);\n\n const delay = request.operation.policy.retryInterval(request.client.configuration);\n\n await BeDuration.wait(delay);\n return dispatch();\n}\n\nasync function handleNotFound(request: InterceptedRequest, status: RpcManagedStatus, dispatch: () => Promise<any>) {\n return new Promise((resolve, reject) => {\n let resubmitted = false;\n\n RpcRequest.notFoundHandlers.raiseEvent(request, status.responseValue as RpcNotFoundResponse, async () => {\n if (resubmitted) {\n throw new IModelError(BentleyStatus.ERROR, `Already resubmitted using this handler.`);\n }\n\n resubmitted = true;\n\n try {\n const response = await dispatch();\n resolve(response);\n } catch (err) {\n reject(err); // eslint-disable-line @typescript-eslint/prefer-promise-reject-errors\n }\n }, reject);\n });\n}\n\nasync function handleNoContent() {\n throw new NoContentError();\n}\n"]}
|
|
1
|
+
{"version":3,"file":"RpcInterface.js","sourceRoot":"","sources":["../../src/RpcInterface.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F;;GAEG;AACH,kEAAyF;AACzF,wDAAyD;AACzD,sDAAkE;AAClE,gEAA6D;AAC7D,iDAAqE;AAG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gBACb,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,sEAAsE;YACrF,CAAC;QACH,CAAC,EAAE,MAAM,CAAC,CAAC;IACb,CAAC,CAAC,CAAC;AACL,CAAC;AAED,KAAK,UAAU,eAAe;IAC5B,MAAM,IAAI,4BAAc,EAAE,CAAC;AAC7B,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 RpcInterface\n */\nimport { RpcConfiguration, RpcConfigurationSupplier } from \"./rpc/core/RpcConfiguration\";\nimport { CURRENT_REQUEST } from \"./rpc/core/RpcRegistry\";\nimport { aggregateLoad, RpcRequest } from \"./rpc/core/RpcRequest\";\nimport { RpcRoutingToken } from \"./rpc/core/RpcRoutingToken\";\nimport { InterceptedRpcRequest, IpcSession } from \"./ipc/IpcSession\";\nimport { RpcSerializedValue } from \"./rpc/core/RpcMarshaling\";\nimport { RpcManagedStatus } from \"./rpc/core/RpcProtocol\";\nimport { IModelError, NoContentError } from \"./IModelError\";\nimport { RpcRequestEvent, RpcRequestStatus } from \"./rpc/core/RpcConstants\";\nimport { BeDuration, BentleyStatus } from \"@itwin/core-bentley\";\nimport { RpcNotFoundResponse } from \"./rpc/core/RpcControl\";\n\n/* eslint-disable @typescript-eslint/no-deprecated */\n\n/**\n * Specifies the required static properties of an RpcInterface class.\n * These properties are used to identify RPC requests and responses.\n * @beta\n */\nexport interface RpcInterfaceDefinition<T extends RpcInterface = RpcInterface> { prototype: T, interfaceName: string, interfaceVersion: string }\n\n/**\n * A class that implements the operations of an RPC interface.\n * @beta\n */\nexport type RpcInterfaceImplementation<T extends RpcInterface = RpcInterface> = new () => T;\n\ninterface SemverType {\n major: number;\n minor: number;\n patch: number;\n prerelease?: string;\n}\n\n/** An RPC interface is a set of operations exposed by a service that a client can call, using configurable protocols,\n * in a platform-independent way. TheRpcInterface class is the base class for RPC interface definitions and implementations.\n * @public\n */\nexport abstract class RpcInterface {\n\n private static findDiff(backend: SemverType, frontend: SemverType) {\n return backend.major !== frontend.major ? \"major\" :\n backend.minor !== frontend.minor ? \"minor\" :\n backend.patch !== frontend.patch ? \"patch\" :\n backend.prerelease !== frontend.prerelease ? \"prerelease\" :\n \"same\";\n }\n\n private static parseVer(version: string): SemverType {\n // separate the version from the prerelease tag\n const parts = version.split(/[:-]/);\n // Split the major.minor.path into separate components\n const prefix = parts[0].split(\".\");\n\n const ver: SemverType = { major: Number(prefix[0]), minor: Number(prefix[1]), patch: Number(prefix[2]) };\n if (parts.length > 1)\n ver.prerelease = parts[1];\n return ver;\n }\n\n /** Determines whether the backend version of an RPC interface is compatible (according to semantic versioning) with the frontend version of the interface. */\n public static isVersionCompatible(backend: string, frontend: string): boolean {\n if (backend === frontend)\n return true; // most common case, versions are identical\n\n const backendSemver = this.parseVer(backend);\n const frontendSemver = this.parseVer(frontend);\n\n // if either has a prerelease tag, they are not compatible unless version strings are identical\n if (backendSemver.prerelease || frontendSemver.prerelease)\n return false;\n\n const difference = this.findDiff(backendSemver, frontendSemver);\n // If the major versions are different, the versions are not compatible\n if (difference === \"major\")\n return false;\n\n // special case for major version 0. If patch difference, backend patch must be greater than frontend patch\n if (backendSemver.major === 0)\n return (difference === \"patch\" && frontendSemver.patch < backendSemver.patch);\n\n // patch difference is fine. If minor versions differ, compatible as long as backend minor version is greater\n return difference === \"patch\" || (difference === \"minor\" && frontendSemver.minor < backendSemver.minor);\n }\n\n /** The configuration for the RPC interface.\n * @internal\n */\n public readonly configuration: RpcConfiguration;\n\n /** @internal */\n public readonly routing: RpcRoutingToken;\n\n /** @beta */\n public constructor(routing: RpcRoutingToken = RpcRoutingToken.default) {\n this.routing = routing;\n this.configuration = RpcConfiguration.supply(this);\n }\n\n /** Obtains the implementation result for an RPC operation. */\n public async forward<T = any>(parameters: IArguments): Promise<T> {\n const parametersCompat = (arguments.length === 1 && typeof (parameters) === \"object\") ? parameters : arguments;\n const parametersArray = Array.isArray(parametersCompat) ? parametersCompat : Array.prototype.slice.call(parametersCompat);\n const operationName = parametersArray.pop();\n\n const session = IpcSession.active;\n if (session) {\n return intercept(session, this, operationName, parametersArray);\n } else {\n const request = new (this.configuration.protocol.requestType as any)(this, operationName, parametersArray) as RpcRequest;\n request.submit(); // eslint-disable-line @typescript-eslint/no-floating-promises\n (this as any)[CURRENT_REQUEST] = request;\n return request.response;\n }\n }\n\n /** @internal */\n public configurationSupplier: RpcConfigurationSupplier | undefined;\n}\n\nRpcInterface.prototype.configurationSupplier = undefined;\n\nclass InterceptedRequest extends RpcRequest {\n protected override async load(): Promise<RpcSerializedValue> { throw new Error(); }\n protected override async send(): Promise<number> { throw new Error(); }\n protected override setHeader(_name: string, _value: string): void { throw new Error(); }\n}\n\nasync function intercept(session: IpcSession, client: RpcInterface, operation: string, parameters: any[]) {\n const request = new InterceptedRequest(client, operation, []);\n (client as any)[CURRENT_REQUEST] = request;\n\n const context = await client.configuration.protocol.serialize(request);\n request.parameters = parameters;\n\n const info: InterceptedRpcRequest = {\n definition: {\n interfaceName: context.operation.interfaceDefinition,\n interfaceVersion: context.operation.interfaceVersion,\n },\n operation,\n parameters,\n context: {\n applicationId: context.applicationId,\n applicationVersion: context.applicationVersion,\n id: context.id,\n sessionId: context.sessionId,\n protocolVersion: (context.protocolVersion || 0).toString(),\n },\n };\n\n const dispatch = async () => {\n aggregateLoad.lastRequest = new Date().getTime();\n\n const response = await session.handleRpc(info);\n\n aggregateLoad.lastResponse = new Date().getTime();\n\n if (typeof (response) === \"object\" && response.hasOwnProperty(\"iTwinRpcCoreResponse\") && response.hasOwnProperty(\"managedStatus\")) {\n const status: RpcManagedStatus = response;\n\n if (status.managedStatus === \"pending\") {\n return handlePending(request, status, dispatch);\n } else if (status.managedStatus === \"notFound\") {\n return handleNotFound(request, status, dispatch);\n } else if (status.managedStatus === \"noContent\") {\n return handleNoContent();\n }\n } else {\n return response;\n }\n };\n\n return dispatch();\n}\n\nasync function handlePending(request: InterceptedRequest, status: RpcManagedStatus, dispatch: () => Promise<any>) {\n request._status = RpcRequestStatus.Pending;\n request._extendedStatus = (status.responseValue as { message: string }).message;\n RpcRequest.events.raiseEvent(RpcRequestEvent.PendingUpdateReceived, request);\n\n const delay = request.operation.policy.retryInterval(request.client.configuration);\n\n await BeDuration.wait(delay);\n return dispatch();\n}\n\nasync function handleNotFound(request: InterceptedRequest, status: RpcManagedStatus, dispatch: () => Promise<any>) {\n return new Promise((resolve, reject) => {\n let resubmitted = false;\n\n RpcRequest.notFoundHandlers.raiseEvent(request, status.responseValue as RpcNotFoundResponse, async () => {\n if (resubmitted) {\n throw new IModelError(BentleyStatus.ERROR, `Already resubmitted using this handler.`);\n }\n\n resubmitted = true;\n\n try {\n const response = await dispatch();\n resolve(response);\n } catch (err) {\n reject(err); // eslint-disable-line @typescript-eslint/prefer-promise-reject-errors\n }\n }, reject);\n });\n}\n\nasync function handleNoContent() {\n throw new NoContentError();\n}\n"]}
|
package/lib/cjs/SkyBox.js
CHANGED
|
@@ -52,6 +52,8 @@ class SkyGradient {
|
|
|
52
52
|
this.skyExponent = args.skyExponent ?? defaultExponent;
|
|
53
53
|
this.groundExponent = args.groundExponent ?? defaultExponent;
|
|
54
54
|
}
|
|
55
|
+
/** Default settings for a four-color gradient. */
|
|
56
|
+
static { this.defaults = new SkyGradient({}); }
|
|
55
57
|
/** Create a new gradient. Any properties not specified by `props` are initialized to their default values. */
|
|
56
58
|
static create(props) {
|
|
57
59
|
return props ? new this(props) : this.defaults;
|
|
@@ -101,8 +103,6 @@ class SkyGradient {
|
|
|
101
103
|
}
|
|
102
104
|
}
|
|
103
105
|
exports.SkyGradient = SkyGradient;
|
|
104
|
-
/** Default settings for a four-color gradient. */
|
|
105
|
-
SkyGradient.defaults = new SkyGradient({});
|
|
106
106
|
/** Describes how to draw a representation of a sky, as part of an [[Environment]].
|
|
107
107
|
* @see [[SkyBoxProps]].
|
|
108
108
|
* @public
|
|
@@ -111,6 +111,8 @@ class SkyBox {
|
|
|
111
111
|
constructor(gradient) {
|
|
112
112
|
this.gradient = gradient;
|
|
113
113
|
}
|
|
114
|
+
/** Default settings for a four-color gradient. */
|
|
115
|
+
static { this.defaults = new SkyBox(SkyGradient.defaults); }
|
|
114
116
|
/** Create a skybox that displays the specified gradient, or the default gradient if none is supplied. */
|
|
115
117
|
static createGradient(gradient) {
|
|
116
118
|
return gradient ? new this(gradient) : this.defaults;
|
|
@@ -149,8 +151,6 @@ class SkyBox {
|
|
|
149
151
|
}
|
|
150
152
|
}
|
|
151
153
|
exports.SkyBox = SkyBox;
|
|
152
|
-
/** Default settings for a four-color gradient. */
|
|
153
|
-
SkyBox.defaults = new SkyBox(SkyGradient.defaults);
|
|
154
154
|
/** Describes how to draw a representation of a sky by mapping a single image to the interior of a sphere.
|
|
155
155
|
* @public
|
|
156
156
|
*/
|
package/lib/cjs/SkyBox.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SkyBox.js","sourceRoot":"","sources":["../../src/SkyBox.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAgF;AAChF,yCAAqD;AAGrD;;;;GAIG;AACH,IAAY,eAaX;AAbD,WAAY,eAAe;IACzB,kEAAkE;IAClE,qDAAQ,CAAA;IACR;;OAEG;IACH,+DAAa,CAAA;IACb,kCAAkC;IAClC,mEAAe,CAAA;IACf;;OAEG;IACH,qDAAQ,CAAA;AACV,CAAC,EAbW,eAAe,+BAAf,eAAe,QAa1B;AA4GD,MAAM,kBAAkB,GAAG,mBAAQ,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;AACxD,MAAM,kBAAkB,GAAG,mBAAQ,CAAC,IAAI,CAAC,EAAE,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;AACvD,MAAM,iBAAiB,GAAG,mBAAQ,CAAC,IAAI,CAAC,EAAE,EAAE,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,mBAAI,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAC1D,CAAC;CACF;AA5BD,8BA4BC;AAED;;;GAGG;AACH,MAAa,OAAQ,SAAQ,MAAM;IAIjC;;;OAGG;IACH,YAAmB,MAAoB,EAAE,QAAsB;QAC7D,KAAK,CAAC,QAAQ,IAAI,WAAW,CAAC,QAAQ,CAAC,CAAC;QACxC,IAAI,CAAC,MAAM,GAAG,EAAE,GAAG,MAAM,EAAE,CAAC;IAC9B,CAAC;IAED,6BAA6B;IACb,MAAM,CAAC,OAAiB;QACtC,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QACpC,KAAK,CAAC,KAAK,GAAG;YACZ,IAAI,EAAE,eAAe,CAAC,IAAI;YAC1B,QAAQ,EAAE,EAAE,GAAG,IAAI,CAAC,MAAM,EAAE;SAC7B,CAAC;QAEF,OAAO,KAAK,CAAC;IACf,CAAC;IAED,gBAAgB;IAChB,IAAoB,UAAU;QAC5B,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC;QACzB,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,mBAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;IAClH,CAAC;CACF;AA7BD,0BA6BC","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, NonFunctionPropertiesOf } from \"@itwin/core-bentley\";\nimport { ColorDef, ColorDefProps } from \"./ColorDef\";\nimport { TextureImageSpec } from \"./RenderTexture\";\n\n/** Supported types of [[SkyBox]] images.\n * @see [[SkyBoxImageProps]].\n * @public\n * @extensions\n */\nexport enum SkyBoxImageType {\n /** No image, indicating a [[SkyGradient]] should be displayed. */\n None = 0,\n /** A single image mapped to the surface of a sphere.\n * @see [[SkySphere]].\n */\n Spherical = 1,\n /** @internal not yet supported */\n Cylindrical = 2,\n /** Six images mapped to the faces of a cube.\n * @see [[SkyCube]].\n */\n Cube = 3,\n}\n\n/** JSON representation of the six images used by a [[SkyCube]].\n * Each property specifies the image for a face of the cube as either an image URL, or the Id of a [Texture]($backend) element.\n * Each image must be square and have the same dimensions as all the other images.\n * @public\n * @extensions\n */\nexport interface SkyCubeProps {\n front: TextureImageSpec;\n back: TextureImageSpec;\n top: TextureImageSpec;\n bottom: TextureImageSpec;\n right: TextureImageSpec;\n left: TextureImageSpec;\n}\n\n/** JSON representation of the image used for a [[SkySphere]].\n * @see [[SkyBoxProps.image]].\n * @public\n */\nexport interface SkySphereImageProps {\n type: SkyBoxImageType.Spherical;\n texture: TextureImageSpec;\n /** @internal */\n textures?: never;\n}\n\n/** JSON representation of the images used for a [[SkyCube]].\n * @see [[SkyBoxProps.image]].\n * @public\n */\nexport interface SkyCubeImageProps {\n type: SkyBoxImageType.Cube;\n textures: SkyCubeProps;\n /** @internal */\n texture?: never;\n}\n\n/** JSON representation of the image(s) to be mapped to the surfaces of a [[SkyBox]].\n * @see [[SkyBoxProps.image]].\n * @public\n * @extensions\n */\nexport type SkyBoxImageProps = SkySphereImageProps | SkyCubeImageProps | { type?: SkyBoxImageType, texture?: never, textures?: never };\n\n/** JSON representation of a [[SkyBox]] that can be drawn as the background of a [ViewState3d]($frontend).\n * An object of this type can describe one of several types of sky box:\n * - A cube with a texture image mapped to each face; or\n * - A sphere with a single texture image mapped to its surface; or\n * - A sphere with a two- or four-color vertical [[Gradient]] mapped to its surface.\n *\n * Whether cuboid or spherical, the skybox is drawn as if the viewer and the contents of the view are contained within its interior.\n *\n * For a two-color gradient, the gradient transitions smoothly from the nadir color at the bottom of the sphere to the zenith color at the top of the sphere.\n * The sky and ground colors are unused, as are the sky and ground exponents.\n *\n * For a four-color gradient, a \"horizon\" is produced on the equator of the sphere, where the ground color and sky color meet. The lower half of the sphere transitions\n * smoothly from the ground color at the equator to the nadir color at the bottom, and the upper half transitions from the sky color at the equator to the zenith color at\n * the top of the sphere.\n *\n * The color and exponent properties are unused if one or more texture images are supplied.\n *\n * The skybox is ignored entirely when an atmosphere is displayed.\n *\n * @see [[DisplayStyle3dSettings.environment]] to define the skybox for a display style.\n * @public\n * @extensions\n */\nexport interface SkyBoxProps {\n /** Whether or not the skybox should be displayed.\n * Default: false.\n */\n display?: boolean;\n /** For a [[SkyGradient]], if true, a 2-color gradient skybox is used instead of a 4-color.\n * Default: false.\n */\n twoColor?: boolean;\n /** The color of the sky at the horizon. Unused unless this is a four-color [[SkyGradient]].\n * Default: (143, 205, 255).\n */\n skyColor?: ColorDefProps;\n /** The color of the ground at the horizon. Unused unless this is a four-color [[SkyGradient]].\n * Default: (120, 143, 125).\n */\n groundColor?: ColorDefProps;\n /** The color of the top of the sphere.\n * Default: (54, 117, 255).\n */\n zenithColor?: ColorDefProps;\n /** The color of the bottom of the sphere.\n * Default: (40, 15, 0).\n */\n nadirColor?: ColorDefProps;\n /** For a 4-color [[SkyGradient]], controls speed of change from sky color to zenith color; otherwise unused.\n * Default: 4.0.\n */\n skyExponent?: number;\n /** For a 4-color [[SkyGradient]], controls speed of change from ground color to nadir color; otherwise unused.\n * Default: 4.0.\n */\n groundExponent?: number;\n /** The image(s), if any, to be mapped to the surfaces of the sphere or cube. If undefined, the skybox will be displayed as a gradient instead.\n * Default: undefined.\n */\n image?: SkyBoxImageProps;\n}\n\nconst defaultGroundColor = ColorDef.from(143, 205, 125);\nconst defaultZenithColor = ColorDef.from(54, 117, 255);\nconst defaultNadirColor = ColorDef.from(40, 125, 0);\nconst defaultSkyColor = ColorDef.from(142, 205, 255);\nconst defaultExponent = 4.0;\n\nfunction colorDefFromJson(props?: ColorDefProps): ColorDef | undefined {\n return undefined !== props ? ColorDef.fromJSON(props) : undefined;\n}\n\n/** A type containing all of the properties and none of the methods of [[SkyGradient]] with `readonly` modifiers removed.\n * @see [[SkyGradient.create]] and [[SkyGradient.clone]].\n * @public\n */\nexport type SkyGradientProperties = NonFunctionPropertiesOf<SkyGradient>;\n\n/** Describes how to map a two- or four-color [[Gradient]] to the interior of a sphere to produce a [[SkyBox]].\n * @see [[SkyBox.gradient]].\n * @public\n */\nexport class SkyGradient {\n public readonly twoColor: boolean;\n public readonly skyColor: ColorDef;\n public readonly groundColor: ColorDef;\n public readonly zenithColor: ColorDef;\n public readonly nadirColor: ColorDef;\n public readonly skyExponent: number;\n public readonly groundExponent: number;\n\n private constructor(args: Partial<SkyGradientProperties>) {\n this.twoColor = args.twoColor ?? false;\n this.skyColor = args.skyColor ?? defaultSkyColor;\n this.groundColor = args.groundColor ?? defaultGroundColor;\n this.nadirColor = args.nadirColor ?? defaultNadirColor;\n this.zenithColor = args.zenithColor ?? defaultZenithColor;\n this.skyExponent = args.skyExponent ?? defaultExponent;\n this.groundExponent = args.groundExponent ?? defaultExponent;\n }\n\n /** Default settings for a four-color gradient. */\n public static readonly defaults = new SkyGradient({});\n\n /** Create a new gradient. Any properties not specified by `props` are initialized to their default values. */\n public static create(props?: Partial<SkyGradientProperties>): SkyGradient {\n return props ? new this(props) : this.defaults;\n }\n\n /** Create from JSON representation. */\n public static fromJSON(props?: SkyBoxProps): SkyGradient {\n if (!props)\n return this.defaults;\n\n return new this({\n twoColor: props.twoColor,\n skyExponent: props.skyExponent,\n groundExponent: props.groundExponent,\n skyColor: colorDefFromJson(props.skyColor),\n groundColor: colorDefFromJson(props.groundColor),\n nadirColor: colorDefFromJson(props.nadirColor),\n zenithColor: colorDefFromJson(props.zenithColor),\n });\n }\n\n /** Create ea copy of this gradient, identical except for any properties explicitly specified by `changedProps`.\n * Any properties of `changedProps` explicitly set to `undefined` will be reset to their default values.\n */\n public clone(changedProps: SkyGradientProperties): SkyGradient {\n return new SkyGradient({ ...this, ...changedProps });\n }\n\n /** Convert to JSON representation. */\n public toJSON(): SkyBoxProps {\n const props: SkyBoxProps = {\n skyColor: this.skyColor.toJSON(),\n groundColor: this.groundColor.toJSON(),\n nadirColor: this.nadirColor.toJSON(),\n zenithColor: this.zenithColor.toJSON(),\n };\n\n if (this.groundExponent !== defaultExponent)\n props.groundExponent = this.groundExponent;\n\n if (this.skyExponent !== defaultExponent)\n props.skyExponent = this.skyExponent;\n\n if (this.twoColor)\n props.twoColor = this.twoColor;\n\n return props;\n }\n\n /** Returns true if this gradient is equivalent to the supplied gradient. */\n public equals(other: SkyGradient): boolean {\n if (this === other)\n return true;\n\n return this.twoColor === other.twoColor && this.skyColor.equals(other.skyColor) && this.groundColor.equals(other.groundColor) &&\n this.zenithColor.equals(other.zenithColor) && this.nadirColor.equals(other.nadirColor);\n }\n}\n\n/** Describes how to draw a representation of a sky, as part of an [[Environment]].\n * @see [[SkyBoxProps]].\n * @public\n */\nexport class SkyBox {\n /** The gradient settings, used if no cube or sphere images are supplied, or if the images cannot be loaded. */\n public readonly gradient: SkyGradient;\n\n protected constructor(gradient: SkyGradient) {\n this.gradient = gradient;\n }\n\n /** Default settings for a four-color gradient. */\n public static readonly defaults = new SkyBox(SkyGradient.defaults);\n\n /** Create a skybox that displays the specified gradient, or the default gradient if none is supplied. */\n public static createGradient(gradient?: SkyGradient): SkyBox {\n return gradient ? new this(gradient) : this.defaults;\n }\n\n /** Create from JSON representation. */\n public static fromJSON(props?: SkyBoxProps): SkyBox {\n const gradient = SkyGradient.fromJSON(props);\n\n if (props?.image) {\n switch (props.image.type) {\n case SkyBoxImageType.Spherical:\n if (undefined !== props.image.texture)\n return new SkySphere(props.image.texture, gradient);\n\n break;\n case SkyBoxImageType.Cube: {\n const tx = props.image.textures;\n if (tx && undefined !== tx.top && undefined !== tx.bottom && undefined !== tx.right && undefined !== tx.left && undefined !== tx.front && undefined !== tx.back)\n return new SkyCube(tx, gradient);\n\n break;\n }\n }\n }\n\n return this.createGradient(gradient);\n }\n\n /** Convert to JSON representation.\n * @param display If defined, the value to use for [[SkyBoxProps.display]]; otherwise, that property will be left undefined.\n */\n public toJSON(display?: boolean): SkyBoxProps {\n const props = this.gradient.toJSON();\n if (undefined !== display)\n props.display = display;\n\n return props;\n }\n\n /** @internal */\n public get textureIds(): Iterable<Id64String> {\n return [];\n }\n}\n\n/** Describes how to draw a representation of a sky by mapping a single image to the interior of a sphere.\n * @public\n */\nexport class SkySphere extends SkyBox {\n /** The image to map to the interior of the sphere. */\n public readonly image: TextureImageSpec;\n\n /** Create a new sky sphere using the specified image.\n * @param image The image to map to the interior of the sphere.\n * @param gradient Optionally overrides the default gradient settings used if the image cannot be obtained.\n */\n public constructor(image: TextureImageSpec, gradient?: SkyGradient) {\n super(gradient ?? SkyGradient.defaults);\n this.image = image;\n }\n\n /** See [[SkyBox.toJSON]]. */\n public override toJSON(display?: boolean): SkyBoxProps {\n const props = super.toJSON(display);\n props.image = {\n type: SkyBoxImageType.Spherical,\n texture: this.image,\n };\n\n return props;\n }\n\n /** @internal */\n public override get textureIds(): Iterable<Id64String> {\n return Id64.isValidId64(this.image) ? [this.image] : [];\n }\n}\n\n/** Describes how to draw a representation of a sky by mapping images to the interior faces of a cube.\n * The images are required to be *square*, and each image must have the same dimensions as the other images.\n * @public\n */\nexport class SkyCube extends SkyBox {\n /** The images to map to each face of the cube. */\n public readonly images: SkyCubeProps;\n\n /** Create a new sky cube using the specified images.\n * @param images The images to map to each face of the cube.\n * @param gradient Optionally overrides the default gradient settings used if the images cannot be obtained.\n */\n public constructor(images: SkyCubeProps, gradient?: SkyGradient) {\n super(gradient ?? SkyGradient.defaults);\n this.images = { ...images };\n }\n\n /** See [[SkyBox.toJSON]]. */\n public override toJSON(display?: boolean): SkyBoxProps {\n const props = super.toJSON(display);\n props.image = {\n type: SkyBoxImageType.Cube,\n textures: { ...this.images },\n };\n\n return props;\n }\n\n /** @internal */\n public override get textureIds(): Iterable<Id64String> {\n const imgs = this.images;\n return [imgs.front, imgs.back, imgs.top, imgs.bottom, imgs.left, imgs.right].filter((x) => Id64.isValidId64(x));\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"SkyBox.js","sourceRoot":"","sources":["../../src/SkyBox.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAgF;AAChF,yCAAqD;AAGrD;;;;GAIG;AACH,IAAY,eAaX;AAbD,WAAY,eAAe;IACzB,kEAAkE;IAClE,qDAAQ,CAAA;IACR;;OAEG;IACH,+DAAa,CAAA;IACb,kCAAkC;IAClC,mEAAe,CAAA;IACf;;OAEG;IACH,qDAAQ,CAAA;AACV,CAAC,EAbW,eAAe,+BAAf,eAAe,QAa1B;AA4GD,MAAM,kBAAkB,GAAG,mBAAQ,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;AACxD,MAAM,kBAAkB,GAAG,mBAAQ,CAAC,IAAI,CAAC,EAAE,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;AACvD,MAAM,iBAAiB,GAAG,mBAAQ,CAAC,IAAI,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;AACpD,MAAM,eAAe,GAAG,mBAAQ,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;AACrD,MAAM,eAAe,GAAG,GAAG,CAAC;AAE5B,SAAS,gBAAgB,CAAC,KAAqB;IAC7C,OAAO,SAAS,KAAK,KAAK,CAAC,CAAC,CAAC,mBAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AACpE,CAAC;AAQD;;;GAGG;AACH,MAAa,WAAW;IAStB,YAAoB,IAAoC;QACtD,IAAI,CAAC,QAAQ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MAAM,CAAC,OAAiB;QACtC,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QACpC,KAAK,CAAC,KAAK,GAAG;YACZ,IAAI,EAAE,eAAe,CAAC,IAAI;YAC1B,QAAQ,EAAE,EAAE,GAAG,IAAI,CAAC,MAAM,EAAE;SAC7B,CAAC;QAEF,OAAO,KAAK,CAAC;IACf,CAAC;IAED,gBAAgB;IAChB,IAAoB,UAAU;QAC5B,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC;QACzB,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,mBAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;IAClH,CAAC;CACF;AA7BD,0BA6BC","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, NonFunctionPropertiesOf } from \"@itwin/core-bentley\";\nimport { ColorDef, ColorDefProps } from \"./ColorDef\";\nimport { TextureImageSpec } from \"./RenderTexture\";\n\n/** Supported types of [[SkyBox]] images.\n * @see [[SkyBoxImageProps]].\n * @public\n * @extensions\n */\nexport enum SkyBoxImageType {\n /** No image, indicating a [[SkyGradient]] should be displayed. */\n None = 0,\n /** A single image mapped to the surface of a sphere.\n * @see [[SkySphere]].\n */\n Spherical = 1,\n /** @internal not yet supported */\n Cylindrical = 2,\n /** Six images mapped to the faces of a cube.\n * @see [[SkyCube]].\n */\n Cube = 3,\n}\n\n/** JSON representation of the six images used by a [[SkyCube]].\n * Each property specifies the image for a face of the cube as either an image URL, or the Id of a [Texture]($backend) element.\n * Each image must be square and have the same dimensions as all the other images.\n * @public\n * @extensions\n */\nexport interface SkyCubeProps {\n front: TextureImageSpec;\n back: TextureImageSpec;\n top: TextureImageSpec;\n bottom: TextureImageSpec;\n right: TextureImageSpec;\n left: TextureImageSpec;\n}\n\n/** JSON representation of the image used for a [[SkySphere]].\n * @see [[SkyBoxProps.image]].\n * @public\n */\nexport interface SkySphereImageProps {\n type: SkyBoxImageType.Spherical;\n texture: TextureImageSpec;\n /** @internal */\n textures?: never;\n}\n\n/** JSON representation of the images used for a [[SkyCube]].\n * @see [[SkyBoxProps.image]].\n * @public\n */\nexport interface SkyCubeImageProps {\n type: SkyBoxImageType.Cube;\n textures: SkyCubeProps;\n /** @internal */\n texture?: never;\n}\n\n/** JSON representation of the image(s) to be mapped to the surfaces of a [[SkyBox]].\n * @see [[SkyBoxProps.image]].\n * @public\n * @extensions\n */\nexport type SkyBoxImageProps = SkySphereImageProps | SkyCubeImageProps | { type?: SkyBoxImageType, texture?: never, textures?: never };\n\n/** JSON representation of a [[SkyBox]] that can be drawn as the background of a [ViewState3d]($frontend).\n * An object of this type can describe one of several types of sky box:\n * - A cube with a texture image mapped to each face; or\n * - A sphere with a single texture image mapped to its surface; or\n * - A sphere with a two- or four-color vertical [[Gradient]] mapped to its surface.\n *\n * Whether cuboid or spherical, the skybox is drawn as if the viewer and the contents of the view are contained within its interior.\n *\n * For a two-color gradient, the gradient transitions smoothly from the nadir color at the bottom of the sphere to the zenith color at the top of the sphere.\n * The sky and ground colors are unused, as are the sky and ground exponents.\n *\n * For a four-color gradient, a \"horizon\" is produced on the equator of the sphere, where the ground color and sky color meet. The lower half of the sphere transitions\n * smoothly from the ground color at the equator to the nadir color at the bottom, and the upper half transitions from the sky color at the equator to the zenith color at\n * the top of the sphere.\n *\n * The color and exponent properties are unused if one or more texture images are supplied.\n *\n * The skybox is ignored entirely when an atmosphere is displayed.\n *\n * @see [[DisplayStyle3dSettings.environment]] to define the skybox for a display style.\n * @public\n * @extensions\n */\nexport interface SkyBoxProps {\n /** Whether or not the skybox should be displayed.\n * Default: false.\n */\n display?: boolean;\n /** For a [[SkyGradient]], if true, a 2-color gradient skybox is used instead of a 4-color.\n * Default: false.\n */\n twoColor?: boolean;\n /** The color of the sky at the horizon. Unused unless this is a four-color [[SkyGradient]].\n * Default: (143, 205, 255).\n */\n skyColor?: ColorDefProps;\n /** The color of the ground at the horizon. Unused unless this is a four-color [[SkyGradient]].\n * Default: (120, 143, 125).\n */\n groundColor?: ColorDefProps;\n /** The color of the top of the sphere.\n * Default: (54, 117, 255).\n */\n zenithColor?: ColorDefProps;\n /** The color of the bottom of the sphere.\n * Default: (40, 15, 0).\n */\n nadirColor?: ColorDefProps;\n /** For a 4-color [[SkyGradient]], controls speed of change from sky color to zenith color; otherwise unused.\n * Default: 4.0.\n */\n skyExponent?: number;\n /** For a 4-color [[SkyGradient]], controls speed of change from ground color to nadir color; otherwise unused.\n * Default: 4.0.\n */\n groundExponent?: number;\n /** The image(s), if any, to be mapped to the surfaces of the sphere or cube. If undefined, the skybox will be displayed as a gradient instead.\n * Default: undefined.\n */\n image?: SkyBoxImageProps;\n}\n\nconst defaultGroundColor = ColorDef.from(143, 205, 125);\nconst defaultZenithColor = ColorDef.from(54, 117, 255);\nconst defaultNadirColor = ColorDef.from(40, 125, 0);\nconst defaultSkyColor = ColorDef.from(142, 205, 255);\nconst defaultExponent = 4.0;\n\nfunction colorDefFromJson(props?: ColorDefProps): ColorDef | undefined {\n return undefined !== props ? ColorDef.fromJSON(props) : undefined;\n}\n\n/** A type containing all of the properties and none of the methods of [[SkyGradient]] with `readonly` modifiers removed.\n * @see [[SkyGradient.create]] and [[SkyGradient.clone]].\n * @public\n */\nexport type SkyGradientProperties = NonFunctionPropertiesOf<SkyGradient>;\n\n/** Describes how to map a two- or four-color [[Gradient]] to the interior of a sphere to produce a [[SkyBox]].\n * @see [[SkyBox.gradient]].\n * @public\n */\nexport class SkyGradient {\n public readonly twoColor: boolean;\n public readonly skyColor: ColorDef;\n public readonly groundColor: ColorDef;\n public readonly zenithColor: ColorDef;\n public readonly nadirColor: ColorDef;\n public readonly skyExponent: number;\n public readonly groundExponent: number;\n\n private constructor(args: Partial<SkyGradientProperties>) {\n this.twoColor = args.twoColor ?? false;\n this.skyColor = args.skyColor ?? defaultSkyColor;\n this.groundColor = args.groundColor ?? defaultGroundColor;\n this.nadirColor = args.nadirColor ?? defaultNadirColor;\n this.zenithColor = args.zenithColor ?? defaultZenithColor;\n this.skyExponent = args.skyExponent ?? defaultExponent;\n this.groundExponent = args.groundExponent ?? defaultExponent;\n }\n\n /** Default settings for a four-color gradient. */\n public static readonly defaults = new SkyGradient({});\n\n /** Create a new gradient. Any properties not specified by `props` are initialized to their default values. */\n public static create(props?: Partial<SkyGradientProperties>): SkyGradient {\n return props ? new this(props) : this.defaults;\n }\n\n /** Create from JSON representation. */\n public static fromJSON(props?: SkyBoxProps): SkyGradient {\n if (!props)\n return this.defaults;\n\n return new this({\n twoColor: props.twoColor,\n skyExponent: props.skyExponent,\n groundExponent: props.groundExponent,\n skyColor: colorDefFromJson(props.skyColor),\n groundColor: colorDefFromJson(props.groundColor),\n nadirColor: colorDefFromJson(props.nadirColor),\n zenithColor: colorDefFromJson(props.zenithColor),\n });\n }\n\n /** Create ea copy of this gradient, identical except for any properties explicitly specified by `changedProps`.\n * Any properties of `changedProps` explicitly set to `undefined` will be reset to their default values.\n */\n public clone(changedProps: SkyGradientProperties): SkyGradient {\n return new SkyGradient({ ...this, ...changedProps });\n }\n\n /** Convert to JSON representation. */\n public toJSON(): SkyBoxProps {\n const props: SkyBoxProps = {\n skyColor: this.skyColor.toJSON(),\n groundColor: this.groundColor.toJSON(),\n nadirColor: this.nadirColor.toJSON(),\n zenithColor: this.zenithColor.toJSON(),\n };\n\n if (this.groundExponent !== defaultExponent)\n props.groundExponent = this.groundExponent;\n\n if (this.skyExponent !== defaultExponent)\n props.skyExponent = this.skyExponent;\n\n if (this.twoColor)\n props.twoColor = this.twoColor;\n\n return props;\n }\n\n /** Returns true if this gradient is equivalent to the supplied gradient. */\n public equals(other: SkyGradient): boolean {\n if (this === other)\n return true;\n\n return this.twoColor === other.twoColor && this.skyColor.equals(other.skyColor) && this.groundColor.equals(other.groundColor) &&\n this.zenithColor.equals(other.zenithColor) && this.nadirColor.equals(other.nadirColor);\n }\n}\n\n/** Describes how to draw a representation of a sky, as part of an [[Environment]].\n * @see [[SkyBoxProps]].\n * @public\n */\nexport class SkyBox {\n /** The gradient settings, used if no cube or sphere images are supplied, or if the images cannot be loaded. */\n public readonly gradient: SkyGradient;\n\n protected constructor(gradient: SkyGradient) {\n this.gradient = gradient;\n }\n\n /** Default settings for a four-color gradient. */\n public static readonly defaults = new SkyBox(SkyGradient.defaults);\n\n /** Create a skybox that displays the specified gradient, or the default gradient if none is supplied. */\n public static createGradient(gradient?: SkyGradient): SkyBox {\n return gradient ? new this(gradient) : this.defaults;\n }\n\n /** Create from JSON representation. */\n public static fromJSON(props?: SkyBoxProps): SkyBox {\n const gradient = SkyGradient.fromJSON(props);\n\n if (props?.image) {\n switch (props.image.type) {\n case SkyBoxImageType.Spherical:\n if (undefined !== props.image.texture)\n return new SkySphere(props.image.texture, gradient);\n\n break;\n case SkyBoxImageType.Cube: {\n const tx = props.image.textures;\n if (tx && undefined !== tx.top && undefined !== tx.bottom && undefined !== tx.right && undefined !== tx.left && undefined !== tx.front && undefined !== tx.back)\n return new SkyCube(tx, gradient);\n\n break;\n }\n }\n }\n\n return this.createGradient(gradient);\n }\n\n /** Convert to JSON representation.\n * @param display If defined, the value to use for [[SkyBoxProps.display]]; otherwise, that property will be left undefined.\n */\n public toJSON(display?: boolean): SkyBoxProps {\n const props = this.gradient.toJSON();\n if (undefined !== display)\n props.display = display;\n\n return props;\n }\n\n /** @internal */\n public get textureIds(): Iterable<Id64String> {\n return [];\n }\n}\n\n/** Describes how to draw a representation of a sky by mapping a single image to the interior of a sphere.\n * @public\n */\nexport class SkySphere extends SkyBox {\n /** The image to map to the interior of the sphere. */\n public readonly image: TextureImageSpec;\n\n /** Create a new sky sphere using the specified image.\n * @param image The image to map to the interior of the sphere.\n * @param gradient Optionally overrides the default gradient settings used if the image cannot be obtained.\n */\n public constructor(image: TextureImageSpec, gradient?: SkyGradient) {\n super(gradient ?? SkyGradient.defaults);\n this.image = image;\n }\n\n /** See [[SkyBox.toJSON]]. */\n public override toJSON(display?: boolean): SkyBoxProps {\n const props = super.toJSON(display);\n props.image = {\n type: SkyBoxImageType.Spherical,\n texture: this.image,\n };\n\n return props;\n }\n\n /** @internal */\n public override get textureIds(): Iterable<Id64String> {\n return Id64.isValidId64(this.image) ? [this.image] : [];\n }\n}\n\n/** Describes how to draw a representation of a sky by mapping images to the interior faces of a cube.\n * The images are required to be *square*, and each image must have the same dimensions as the other images.\n * @public\n */\nexport class SkyCube extends SkyBox {\n /** The images to map to each face of the cube. */\n public readonly images: SkyCubeProps;\n\n /** Create a new sky cube using the specified images.\n * @param images The images to map to each face of the cube.\n * @param gradient Optionally overrides the default gradient settings used if the images cannot be obtained.\n */\n public constructor(images: SkyCubeProps, gradient?: SkyGradient) {\n super(gradient ?? SkyGradient.defaults);\n this.images = { ...images };\n }\n\n /** See [[SkyBox.toJSON]]. */\n public override toJSON(display?: boolean): SkyBoxProps {\n const props = super.toJSON(display);\n props.image = {\n type: SkyBoxImageType.Cube,\n textures: { ...this.images },\n };\n\n return props;\n }\n\n /** @internal */\n public override get textureIds(): Iterable<Id64String> {\n const imgs = this.images;\n return [imgs.front, imgs.back, imgs.top, imgs.bottom, imgs.left, imgs.right].filter((x) => Id64.isValidId64(x));\n }\n}\n"]}
|
package/lib/cjs/SolarShadows.js
CHANGED
|
@@ -25,6 +25,7 @@ class SolarShadowSettings {
|
|
|
25
25
|
else
|
|
26
26
|
this.color = RgbColor_1.RgbColor.fromColorDef(ColorDef_1.ColorDef.fromJSON(props.color));
|
|
27
27
|
}
|
|
28
|
+
static { this.defaults = new SolarShadowSettings({}); }
|
|
28
29
|
static fromJSON(props) {
|
|
29
30
|
return props ? new SolarShadowSettings(props) : this.defaults;
|
|
30
31
|
}
|
|
@@ -58,5 +59,4 @@ class SolarShadowSettings {
|
|
|
58
59
|
}
|
|
59
60
|
}
|
|
60
61
|
exports.SolarShadowSettings = SolarShadowSettings;
|
|
61
|
-
SolarShadowSettings.defaults = new SolarShadowSettings({});
|
|
62
62
|
//# sourceMappingURL=SolarShadows.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SolarShadows.js","sourceRoot":"","sources":["../../src/SolarShadows.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAgD;AAChD,+CAA4C;AAC5C,yCAAqD;AACrD,yCAAsC;AAatC,MAAM,YAAY,GAAG,mBAAQ,CAAC,YAAY,CAAC,mBAAQ,CAAC,QAAQ,CAAC,yBAAW,CAAC,IAAI,CAAC,CAAC,CAAC;AAEhF;;;GAGG;AACH,MAAa,mBAAmB;IAM9B,YAAoB,KAA+B;QACjD,IAAI,CAAC,IAAI,GAAG,wBAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QAClD,IAAI,SAAS,KAAK,KAAK,CAAC,KAAK,IAAI,IAAI,KAAK,KAAK,CAAC,KAAK;YACnD,IAAI,CAAC,KAAK,GAAG,YAAY,CAAC;;YAE1B,IAAI,CAAC,KAAK,GAAG,mBAAQ,CAAC,YAAY,CAAC,mBAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;IACvE,CAAC;
|
|
1
|
+
{"version":3,"file":"SolarShadows.js","sourceRoot":"","sources":["../../src/SolarShadows.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAgD;AAChD,+CAA4C;AAC5C,yCAAqD;AACrD,yCAAsC;AAatC,MAAM,YAAY,GAAG,mBAAQ,CAAC,YAAY,CAA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IAAI,CAAC,IAAI,KAAK,GAAG,CAAC,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAChE,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,YAAuC;QAClD,IAAI,CAAC,YAAY;YACf,OAAO,IAAI,CAAC;QAEd,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC;QAClC,IAAI,YAAY,CAAC,KAAK;YACpB,KAAK,CAAC,KAAK,GAAG,YAAY,CAAC,KAAK,CAAC;QAEnC,IAAI,SAAS,KAAK,YAAY,CAAC,IAAI;YACjC,KAAK,CAAC,IAAI,GAAG,YAAY,CAAC,IAAI,CAAC;QAEjC,OAAO,mBAAmB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC7C,CAAC;;AAvDH,kDAwDC","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 { JsonUtils } from \"@itwin/core-bentley\";\nimport { ColorByName } from \"./ColorByName\";\nimport { ColorDef, ColorDefProps } from \"./ColorDef\";\nimport { RgbColor } from \"./RgbColor\";\n\n/** JSON representation of [[SolarShadowSettings]].\n * @public\n * @extensions\n */\nexport interface SolarShadowSettingsProps {\n /** Shadow color. Default: [[ColorByName.grey]]. */\n color?: ColorDefProps;\n /** @internal */\n bias?: number;\n}\n\nconst defaultColor = RgbColor.fromColorDef(ColorDef.fromTbgr(ColorByName.grey));\n\n/** Settings controlling display of solar shadows for a [[DisplayStyle3dSettings]].\n * Solar shadows are imposed as a color scaling on geometry occluded from solar lighting.\n * @public\n */\nexport class SolarShadowSettings {\n /** Shadow color. */\n public readonly color: RgbColor;\n /** @internal */\n public readonly bias: number;\n\n private constructor(props: SolarShadowSettingsProps) {\n this.bias = JsonUtils.asDouble(props.bias, 0.001);\n if (undefined === props.color || null === props.color)\n this.color = defaultColor;\n else\n this.color = RgbColor.fromColorDef(ColorDef.fromJSON(props.color));\n }\n\n public static defaults = new SolarShadowSettings({});\n\n public static fromJSON(props?: SolarShadowSettingsProps): SolarShadowSettings {\n return props ? new SolarShadowSettings(props) : this.defaults;\n }\n\n public toJSON(): SolarShadowSettingsProps | undefined {\n const defaults = SolarShadowSettings.defaults;\n if (this.equals(defaults))\n return undefined;\n\n const props: SolarShadowSettingsProps = {};\n if (!this.color.equals(defaults.color))\n props.color = this.color.toColorDef().toJSON();\n\n if (this.bias !== defaults.bias)\n props.bias = this.bias;\n\n return props;\n }\n\n public equals(rhs: SolarShadowSettings): boolean {\n return this.bias === rhs.bias && this.color.equals(rhs.color);\n }\n\n /** Create a copy of these settings.\n * @param changedProps Any property explicitly defined will be overridden in the copy.\n * @returns A settings object equivalent to this one except for any properties explicitly overridden by `changedProps`.\n */\n public clone(changedProps?: SolarShadowSettingsProps): SolarShadowSettings {\n if (!changedProps)\n return this;\n\n const props = this.toJSON() ?? {};\n if (changedProps.color)\n props.color = changedProps.color;\n\n if (undefined !== changedProps.bias)\n props.bias = changedProps.bias;\n\n return SolarShadowSettings.fromJSON(props);\n }\n}\n"]}
|
|
@@ -91,7 +91,7 @@ class SubCategoryAppearance {
|
|
|
91
91
|
return val;
|
|
92
92
|
}
|
|
93
93
|
clone() { return new SubCategoryAppearance(this.toJSON()); }
|
|
94
|
+
static { this.defaults = new SubCategoryAppearance(); }
|
|
94
95
|
}
|
|
95
96
|
exports.SubCategoryAppearance = SubCategoryAppearance;
|
|
96
|
-
SubCategoryAppearance.defaults = new SubCategoryAppearance();
|
|
97
97
|
//# sourceMappingURL=SubCategoryAppearance.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SubCategoryAppearance.js","sourceRoot":"","sources":["../../src/SubCategoryAppearance.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;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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;;AA9H5F,sDAiIC;AADe,8BAAQ,GAAG,IAAI,qBAAqB,EAAE,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 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
|
+
{"version":3,"file":"SubCategoryAppearance.js","sourceRoot":"","sources":["../../src/SubCategoryAppearance.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAkE;AAClE,yCAAqD;AAErD;;;;GAIG;AACH,MAAa,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,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;IAErI,YAAY,KAAmC;QAC7C,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,IAAI,CAAC,KAAK,GAAG,mBAAQ,CAAC,KAAK,CAAC;YAC5B,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;YAChB,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC;YAClB,IAAI,CAAC,YAAY,GAAG,CAAC,CAAC;YACtB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;YACzE,IAAI,CAAC,OAAO,GAAG,mBAAI,CAAC,OAAO,CAAC;YAC5B,IAAI,C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,CAAC;QAE/B,IAAI,mBAAI,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC;YAC5B,GAAG,CAAC,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC;QAE3B,IAAI,mBAAI,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC;YAC/B,GAAG,CAAC,QAAQ,GAAG,IAAI,CAAC,UAAU,CAAC;QAEjC,IAAI,GAAG,KAAK,IAAI,CAAC,YAAY;YAC3B,GAAG,CAAC,MAAM,GAAG,IAAI,CAAC,YAAY,CAAC;QAEjC,IAAI,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,aAAQ,GAAG,IAAI,qBAAqB,EAAE,CAAC;;AAhIvD,sDAiIC","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 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"]}
|