@itwin/core-common 5.1.0-dev.47 → 5.1.0-dev.51

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.
@@ -21,22 +21,22 @@ export interface OrbitGtBlobProps {
21
21
  */
22
22
  export declare enum RealityDataProvider {
23
23
  /**
24
- * This is the legacy mode where the access to the 3d tiles is harcoded in ContextRealityModelProps.tilesetUrl property.
25
- * It was use to support RealityMesh3DTiles, Terrain3DTiles, Cesium3DTiles
26
- * You should use other mode when possible
24
+ * This is the legacy mode where the access to the 3d tiles is hardcoded in ContextRealityModelProps.tilesetUrl property.
25
+ * It was used to support RealityMesh3DTiles, Terrain3DTiles, Cesium3DTiles
26
+ * You should use other modes when possible
27
27
  * @see [[RealityDataSource.createKeyFromUrl]] that will try to detect provider from an URL
28
28
  */
29
29
  TilesetUrl = "TilesetUrl",
30
30
  /**
31
- * This is the legacy mode where the access to the 3d tiles is harcoded in ContextRealityModelProps.OrbitGtBlob property.
32
- * It was use to support OrbitPointCloud (OPC) from other server than ContextShare
33
- * You should use other mode when possible
31
+ * This is the legacy mode where the access to the 3d tiles is hardcoded in ContextRealityModelProps.OrbitGtBlob property.
32
+ * It was used to support OrbitPointCloud (OPC) from other server than ContextShare
33
+ * You should use other modes when possible
34
34
  * @see [[RealityDataSource.createKeyFromOrbitGtBlobProps]] that will try to detect provider from an URL
35
35
  */
36
36
  OrbitGtBlob = "OrbitGtBlob",
37
37
  /**
38
- * Will provide access url from realityDataId and iTwinId on contextShare for 3dTile storage format or OPC storage format
39
- * This provider support all type of 3dTile storage fomat and OrbitPointCloud: RealityMesh3DTiles, Terrain3DTiles, Cesium3DTiles, OPC
38
+ * Will provide access url from realityDataId and iTwinId on contextShare for 3dTile storage format or OPC storage format
39
+ * This provider supports all types of 3dTile storage format and OrbitPointCloud: RealityMesh3DTiles, Terrain3DTiles, Cesium3DTiles, OPC
40
40
  * @see [[RealityDataFormat]].
41
41
  */
42
42
  ContextShare = "ContextShare",
@@ -19,22 +19,22 @@ const RealityModelDisplaySettings_1 = require("./RealityModelDisplaySettings");
19
19
  var RealityDataProvider;
20
20
  (function (RealityDataProvider) {
21
21
  /**
22
- * This is the legacy mode where the access to the 3d tiles is harcoded in ContextRealityModelProps.tilesetUrl property.
23
- * It was use to support RealityMesh3DTiles, Terrain3DTiles, Cesium3DTiles
24
- * You should use other mode when possible
22
+ * This is the legacy mode where the access to the 3d tiles is hardcoded in ContextRealityModelProps.tilesetUrl property.
23
+ * It was used to support RealityMesh3DTiles, Terrain3DTiles, Cesium3DTiles
24
+ * You should use other modes when possible
25
25
  * @see [[RealityDataSource.createKeyFromUrl]] that will try to detect provider from an URL
26
26
  */
27
27
  RealityDataProvider["TilesetUrl"] = "TilesetUrl";
28
28
  /**
29
- * This is the legacy mode where the access to the 3d tiles is harcoded in ContextRealityModelProps.OrbitGtBlob property.
30
- * It was use to support OrbitPointCloud (OPC) from other server than ContextShare
31
- * You should use other mode when possible
29
+ * This is the legacy mode where the access to the 3d tiles is hardcoded in ContextRealityModelProps.OrbitGtBlob property.
30
+ * It was used to support OrbitPointCloud (OPC) from other server than ContextShare
31
+ * You should use other modes when possible
32
32
  * @see [[RealityDataSource.createKeyFromOrbitGtBlobProps]] that will try to detect provider from an URL
33
33
  */
34
34
  RealityDataProvider["OrbitGtBlob"] = "OrbitGtBlob";
35
35
  /**
36
- * Will provide access url from realityDataId and iTwinId on contextShare for 3dTile storage format or OPC storage format
37
- * This provider support all type of 3dTile storage fomat and OrbitPointCloud: RealityMesh3DTiles, Terrain3DTiles, Cesium3DTiles, OPC
36
+ * Will provide access url from realityDataId and iTwinId on contextShare for 3dTile storage format or OPC storage format
37
+ * This provider supports all types of 3dTile storage format and OrbitPointCloud: RealityMesh3DTiles, Terrain3DTiles, Cesium3DTiles, OPC
38
38
  * @see [[RealityDataFormat]].
39
39
  */
40
40
  RealityDataProvider["ContextShare"] = "ContextShare";
@@ -1 +1 @@
1
- {"version":3,"file":"ContextRealityModel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BAA4B,EAAE,IAAI,CAAC,CAAC;QACvF,6DAA6D;QAC7D,KAAK,CAAC,kBAAkB,CAAC,cAAc,CAAC,IAAI,CAAC,sBAAsB,EAAE,IAAI,CAAC,CAAC;IAC7E,CAAC;IAEO,2BAA2B,CAAC,IAAwC,EAAE,KAA0B;QACtG,IAAI,CAAC,uBAAuB,CAAC,UAAU,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IACvD,CAAC;IAEO,gCAAgC,CAAC,GAAkC,EAAE,KAA0B;QACrG,IAAI,CAAC,4BAA4B,CAAC,UAAU,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IAC3D,CAAC;IAEO,4BAA4B,CAAC,QAAqC,EAAE,KAA0B;QACpG,IAAI,CAAC,wBAAwB,CAAC,UAAU,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IAC5D,CAAC;IAEO,sBAAsB,CAAC,SAAkB,EAAE,KAA0B;QAC3E,IAAI,CAAC,kBAAkB,CAAC,UAAU,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;IACvD,CAAC;CACF;AAlND,oDAkNC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module DisplayStyles\n */\n\nimport { assert, BeEvent } from \"@itwin/core-bentley\";\nimport { FeatureAppearance, FeatureAppearanceProps } from \"./FeatureSymbology\";\nimport { PlanarClipMaskMode, PlanarClipMaskProps, PlanarClipMaskSettings } from \"./PlanarClipMask\";\nimport { SpatialClassifierProps, SpatialClassifiers, SpatialClassifiersContainer } from \"./SpatialClassification\";\nimport { RealityModelDisplayProps, RealityModelDisplaySettings } from \"./RealityModelDisplaySettings\";\n\n/** JSON representation of the blob properties for an OrbitGt property cloud.\n * @alpha\n */\nexport interface OrbitGtBlobProps {\n rdsUrl?: string;\n containerName: string;\n blobFileName: string;\n sasToken: string;\n accountName: string;\n}\n\n/** Identify the Reality Data service provider\n * @beta\n */\nexport enum RealityDataProvider {\n /**\n * This is the legacy mode where the access to the 3d tiles is harcoded in ContextRealityModelProps.tilesetUrl property.\n * It was use to support RealityMesh3DTiles, Terrain3DTiles, Cesium3DTiles\n * You should use other mode when possible\n * @see [[RealityDataSource.createKeyFromUrl]] that will try to detect provider from an URL\n */\n TilesetUrl = \"TilesetUrl\",\n /**\n * This is the legacy mode where the access to the 3d tiles is harcoded in ContextRealityModelProps.OrbitGtBlob property.\n * It was use to support OrbitPointCloud (OPC) from other server than ContextShare\n * You should use other mode when possible\n * @see [[RealityDataSource.createKeyFromOrbitGtBlobProps]] that will try to detect provider from an URL\n */\n OrbitGtBlob = \"OrbitGtBlob\",\n /**\n * Will provide access url from realityDataId and iTwinId on contextShare for 3dTile storage format or OPC storage format\n * This provider support all type of 3dTile storage fomat and OrbitPointCloud: RealityMesh3DTiles, Terrain3DTiles, Cesium3DTiles, OPC\n * @see [[RealityDataFormat]].\n */\n ContextShare = \"ContextShare\",\n /**\n * Will provide Open Street Map Building (OSM) from Cesium Ion (in 3dTile format)\n */\n CesiumIonAsset = \"CesiumIonAsset\",\n}\n\n/** Identify the Reality Data storage format\n * @beta\n */\nexport enum RealityDataFormat {\n /**\n * 3dTile supported formats; RealityMesh3DTiles, Terrain3DTiles, Cesium3DTiles\n * */\n ThreeDTile = \"ThreeDTile\",\n /**\n * Orbit Point Cloud (OPC) storage format (RealityDataType.OPC)\n */\n OPC = \"OPC\",\n}\n\n/** Utility function for RealityDataFormat\n * @beta\n */\nexport namespace RealityDataFormat {\n /**\n * Try to extract the RealityDataFormat from the url\n * @param tilesetUrl the reality data attachment url\n * @returns the extracted RealityDataFormat or ThreeDTile by default if not found\n */\n export function fromUrl(tilesetUrl: string): RealityDataFormat {\n let format = RealityDataFormat.ThreeDTile;\n if (tilesetUrl.includes(\".opc\"))\n format = RealityDataFormat.OPC;\n return format;\n }\n}\n\n/**\n * Key used by RealityDataSource to identify provider and reality data format\n * This key identify one and only one reality data source on the provider\n * @beta\n */\nexport interface RealityDataSourceKey {\n /**\n * The provider that supplies the access to reality data source for displaying the reality model\n * @see [[RealityDataProvider]] for default supported value;\n */\n provider: string;\n /**\n * The format used by the provider to store the reality data\n * @see [[RealityDataFormat]] for default supported value;\n */\n format: string;\n /** The reality data id that identify a reality data for the provider */\n id: string;\n /** The context id that was used when reality data was attached - if none provided, current session iTwinId will be used */\n iTwinId?: string;\n}\n/**\n * RealityDataSourceKey utility functions\n * @beta */\nexport namespace RealityDataSourceKey {\n /** Utility function to convert a RealityDataSourceKey into its string representation */\n export function convertToString(rdSourceKey: RealityDataSourceKey): string {\n return `${rdSourceKey.provider}:${rdSourceKey.format}:${rdSourceKey.id}:${rdSourceKey?.iTwinId}`;\n }\n /** Utility function to compare two RealityDataSourceKey, we consider it equal even if itwinId is different */\n export function isEqual(key1: RealityDataSourceKey, key2: RealityDataSourceKey): boolean {\n if ((key1.provider === RealityDataProvider.CesiumIonAsset) && key2.provider === RealityDataProvider.CesiumIonAsset)\n return true; // ignore other properties for CesiumIonAsset, id is hidden\n if ((key1.provider === key2.provider) && (key1.format === key2.format) && (key1.id === key2.id)) {\n // && (key1?.iTwinId === key2?.iTwinId)) -> ignore iTwinId, consider it is the same reality data\n return true;\n }\n return false;\n }\n}\n\n/** JSON representation of the reality data reference attachment properties.\n * @beta\n*/\nexport interface RealityDataSourceProps {\n /** The source key that identify a reality data for the provider. */\n sourceKey: RealityDataSourceKey;\n}\n\n/** JSON representation of a [[ContextRealityModel]].\n * @public\n * @extensions\n */\nexport interface ContextRealityModelProps {\n /** See [[ContextRealityModel.rdSourceKey]].\n * @beta\n */\n rdSourceKey?: RealityDataSourceKey;\n /** The URL that supplies the 3d tiles for displaying the reality model. */\n tilesetUrl: string;\n /** See [[ContextRealityModel.orbitGtBlob]].\n * @alpha\n */\n orbitGtBlob?: OrbitGtBlobProps;\n /** See [[ContextRealityModel.realityDataId]]. */\n realityDataId?: string;\n /** An optional, user-friendly name for the reality model suitable for display in a user interface. */\n name?: string;\n /** An optional, user-friendly description of the reality model suitable for display in a user interface. */\n description?: string;\n /** See [[ContextRealityModel.classifiers]]. */\n classifiers?: SpatialClassifierProps[];\n /** See [[ContextRealityModel.planarClipMask]]. */\n planarClipMask?: PlanarClipMaskProps;\n /** See [[ContextRealityModel.appearanceOverrides]]. */\n appearanceOverrides?: FeatureAppearanceProps;\n /** See [[ContextRealityModel.displaySettings]].\n * @beta\n */\n displaySettings?: RealityModelDisplayProps;\n /** See [[ContextRealityModel.invisible]].\n * @beta\n */\n invisible?: boolean;\n}\n\n/** @public */\nexport namespace ContextRealityModelProps {\n /** Produce a deep copy of `input`. */\n export function clone(input: ContextRealityModelProps): ContextRealityModelProps {\n // Spread operator is shallow, and includes `undefined` properties and empty strings.\n // We want to make deep copies, omit undefined properties and empty strings, and require tilesetUrl to be defined.\n const output: ContextRealityModelProps = { tilesetUrl: input.tilesetUrl ?? \"\" };\n\n if (input.rdSourceKey)\n output.rdSourceKey = { ...input.rdSourceKey };\n\n if (input.name)\n output.name = input.name;\n\n if (input.realityDataId)\n output.realityDataId = input.realityDataId;\n\n if (input.description)\n output.description = input.description;\n\n if (input.orbitGtBlob)\n output.orbitGtBlob = { ...input.orbitGtBlob };\n\n if (input.appearanceOverrides) {\n output.appearanceOverrides = { ...input.appearanceOverrides };\n if (input.appearanceOverrides.rgb)\n output.appearanceOverrides.rgb = { ...input.appearanceOverrides.rgb };\n }\n\n if (input.displaySettings) {\n output.displaySettings = { ...input.displaySettings };\n if (input.displaySettings.pointCloud)\n output.displaySettings.pointCloud = { ...output.displaySettings.pointCloud };\n }\n\n if (input.planarClipMask)\n output.planarClipMask = { ...input.planarClipMask };\n\n if (input.classifiers)\n output.classifiers = input.classifiers.map((x) => { return { ...x, flags: { ...x.flags } }; });\n\n if (input.invisible)\n output.invisible = input.invisible;\n\n return output;\n }\n}\n\n/** A reality model not associated with a [GeometricModel]($backend) but instead defined in a [DisplayStyle]($backend) or [DisplayStyleState]($frontend).\n * Such reality models are displayed to provide context to the view and can be freely attached and detached at display time.\n * @see [this interactive example](https://www.itwinjs.org/sample-showcase/?group=Viewer&sample=reality-data-sample)\n * @see [[DisplayStyleSettings.contextRealityModels]] to define context reality models for a display style.\n * @public\n */\nexport class ContextRealityModel {\n /** @internal */\n protected readonly _props: ContextRealityModelProps;\n /**\n * The reality data source key identify the reality data provider and storage format.\n * It takes precedence over tilesetUrl and orbitGtBlob when present and can be use to actually replace these properties.\n * @beta\n */\n public readonly rdSourceKey?: RealityDataSourceKey;\n /** A name suitable for display in a user interface. By default, an empty string. */\n public readonly name: string;\n /** The URL that supplies the 3d tiles for displaying the reality model. */\n public readonly url: string;\n /** A description of the model suitable for display in a user interface. By default, an empty string. */\n public readonly description: string;\n /** An optional identifier that, if present, can be used to elide a request to the reality data service. */\n public readonly realityDataId?: string;\n\n private _invisible: boolean;\n private readonly _classifiers: SpatialClassifiers;\n /** @alpha */\n public readonly orbitGtBlob?: Readonly<OrbitGtBlobProps>;\n protected _appearanceOverrides?: FeatureAppearance;\n /** @beta */\n protected _displaySettings: RealityModelDisplaySettings;\n protected _planarClipMask?: PlanarClipMaskSettings;\n /** Event dispatched just before assignment to [[planarClipMaskSettings]]. */\n public readonly onPlanarClipMaskChanged = new BeEvent<(newSettings: PlanarClipMaskSettings | undefined, model: ContextRealityModel) => void>();\n /** Event dispatched just before assignment to [[appearanceOverrides]]. */\n public readonly onAppearanceOverridesChanged = new BeEvent<(newOverrides: FeatureAppearance | undefined, model: ContextRealityModel) => void>();\n /** Event dispatched just before assignment to [[displaySettings]].\n * @beta\n */\n public readonly onDisplaySettingsChanged = new BeEvent<(newSettings: RealityModelDisplaySettings, model: ContextRealityModel) => void>();\n /** Event dispatched just before a model become invisible\n * @beta\n */\n public readonly onInvisibleChanged = new BeEvent<(invisible: boolean, model: ContextRealityModel) => void>();\n\n /** Construct a new context reality model.\n * @param props JSON representation of the reality model, which will be kept in sync with changes made via the ContextRealityModel's methods.\n * @param options Options to customize how the reality model is created.\n */\n public constructor(props: ContextRealityModelProps, options?: { createClassifiers: (container: SpatialClassifiersContainer) => SpatialClassifiers }) {\n this._props = props;\n this.rdSourceKey = props.rdSourceKey;\n this.name = props.name ?? \"\";\n this.url = props.tilesetUrl ?? \"\";\n this.orbitGtBlob = props.orbitGtBlob;\n this.realityDataId = props.realityDataId;\n this.description = props.description ?? \"\";\n this._invisible = props.invisible ?? false;\n this._appearanceOverrides = props.appearanceOverrides ? FeatureAppearance.fromJSON(props.appearanceOverrides) : undefined;\n this._displaySettings = RealityModelDisplaySettings.fromJSON(props.displaySettings);\n\n if (props.planarClipMask && props.planarClipMask.mode !== PlanarClipMaskMode.None)\n this._planarClipMask = PlanarClipMaskSettings.fromJSON(props.planarClipMask);\n\n if (options?.createClassifiers) {\n this._classifiers = options.createClassifiers(props);\n } else {\n this._classifiers = new SpatialClassifiers(props);\n }\n }\n\n /** A set of [[SpatialClassifier]]s, of which one at any given time can be used to classify the reality model. */\n public get classifiers(): SpatialClassifiers {\n return this._classifiers;\n }\n\n /** Optionally describes how the geometry of the reality model can be masked by other models. */\n public get planarClipMaskSettings(): PlanarClipMaskSettings | undefined {\n return this._planarClipMask;\n }\n public set planarClipMaskSettings(settings: PlanarClipMaskSettings | undefined) {\n this.onPlanarClipMaskChanged.raiseEvent(settings, this);\n if (!settings)\n delete this._props.planarClipMask;\n else\n this._props.planarClipMask = settings.toJSON();\n\n this._planarClipMask = settings;\n }\n\n /** Overrides applied to the appearance of the reality model. Only the rgb, transparency, nonLocatable, and emphasized properties are applicable - the rest are ignored. */\n public get appearanceOverrides(): FeatureAppearance | undefined {\n return this._appearanceOverrides;\n }\n public set appearanceOverrides(overrides: FeatureAppearance | undefined) {\n this.onAppearanceOverridesChanged.raiseEvent(overrides, this);\n if (!overrides)\n delete this._props.appearanceOverrides;\n else\n this._props.appearanceOverrides = overrides.toJSON();\n\n this._appearanceOverrides = overrides;\n }\n\n /** Settings controlling how this reality model is displayed in a [Viewport]($frontend).\n * @beta\n */\n public get displaySettings(): RealityModelDisplaySettings {\n return this._displaySettings;\n }\n public set displaySettings(settings: RealityModelDisplaySettings) {\n this.onDisplaySettingsChanged.raiseEvent(settings, this);\n this._props.displaySettings = settings.toJSON();\n this._displaySettings = settings;\n }\n\n /** If true, reality model is not drawn.\n * @beta\n */\n public get invisible(): boolean {\n return this._invisible;\n }\n public set invisible(invisible: boolean) {\n if (invisible !== this.invisible) {\n this.onInvisibleChanged.raiseEvent(invisible, this);\n }\n\n this._props.invisible = invisible;\n this._invisible = invisible;\n }\n\n /** Convert this model to its JSON representation. */\n public toJSON(): ContextRealityModelProps {\n return ContextRealityModelProps.clone(this._props);\n }\n\n /** Returns true if [[name]] and [[url]] match the specified name and url. */\n public matchesNameAndUrl(name: string, url: string): boolean {\n return this.name === name && this.url === url;\n }\n}\n\n/** An object that can store the JSON representation of a list of [[ContextRealityModel]]s.\n * @see [[ContextRealityModels]].\n * @see [[DisplayStyleSettingsProps.contextRealityModels]].\n * @public\n * @extensions\n */\nexport interface ContextRealityModelsContainer {\n /** The list of reality models. */\n contextRealityModels?: ContextRealityModelProps[];\n /** @internal used for type discrimination with ContextRealityModelsArgs. */\n container?: never;\n}\n\n/** Arguments supplied to the constructor of [[ContextRealityModels]].\n * @public\n */\nexport interface ContextRealityModelsArgs {\n /** The object that holds the JSON representation of the list of context reality models. */\n container: ContextRealityModelsContainer;\n /** Optional function used to instantiate each [[ContextRealityModel]] in the list. */\n createContextRealityModel?: (props: ContextRealityModelProps) => ContextRealityModel;\n /** If true, the list will not be populated by the constructor. Instead, the caller is responsible for calling [[ContextRealityModels.populate]] exactly once after construction.\n * This is chiefly intended for use internally by the [DisplayStyleState]($frontend) constructor.\n */\n deferPopulating?: boolean;\n}\n\n/** A list of [[ContextRealityModel]]s attached to a [[DisplayStyleSettings]]. The list may be presented to the user with the name and description of each model.\n * The list is automatically synchronized with the underlying JSON representation provided by the input [[ContextRealityModelsContainer]].\n * @see [this interactive example](https://www.itwinjs.org/sample-showcase/?group=Viewer&sample=reality-data-sample)\n * @see [[DisplayStyleSettings.contextRealityModels]].\n * @public\n */\nexport class ContextRealityModels {\n private readonly _container: ContextRealityModelsContainer;\n private readonly _createModel: (props: ContextRealityModelProps) => ContextRealityModel;\n private readonly _models: ContextRealityModel[] = [];\n /** Event dispatched just before [[ContextRealityModel.planarClipMaskSettings]] is modified for one of the reality models. */\n public readonly onPlanarClipMaskChanged = new BeEvent<(model: ContextRealityModel, newSettings: PlanarClipMaskSettings | undefined) => void>();\n /** Event dispatched just before [[ContextRealityModel.appearanceOverrides]] is modified for one of the reality models. */\n public readonly onAppearanceOverridesChanged = new BeEvent<(model: ContextRealityModel, newOverrides: FeatureAppearance | undefined) => void>();\n /** Event dispatched just before [[ContextRealityModel.displaySettings]] is modified for one of the reality models.\n * @beta\n */\n public readonly onDisplaySettingsChanged = new BeEvent<(model: ContextRealityModel, newSettings: RealityModelDisplaySettings) => void>();\n /** Event dispatched just before [[ContextRealityModel.invisible]] is modified for one of the reality models.\n * @beta\n */\n public readonly onInvisibleChanged = new BeEvent<(model: ContextRealityModel, invisible: boolean) => void>();\n /** Event dispatched when a model is [[add]]ed, [[delete]]d, [[replace]]d, or [[update]]d. */\n public readonly onChanged = new BeEvent<(previousModel: ContextRealityModel | undefined, newModel: ContextRealityModel | undefined) => void>();\n\n /** Construct a new list of reality models from its JSON representation. The list will be initialized from `container.contextRealityModels` and that JSON representation\n * will be kept in sync with changes made to the list. The caller should not directly modify `container.contextRealityModels` or its contents as that will cause the list\n * to become out of sync with the JSON representation.\n * @param container The object that holds the JSON representation of the list.\n * @param createContextRealityModel Optional function used to instantiate each [[ContextRealityModel]] in the list.\n */\n public constructor(container: ContextRealityModelsContainer, createContextRealityModel?: (props: ContextRealityModelProps) => ContextRealityModel);\n\n /** Construct a new list of reality models from its JSON representation. The list will be initialized from `args.container.contextRealityModels` and that JSON representation\n * will be kept in sync with changes made to the list. The caller should not directly modify `container.contextRealityModels` or its contents as that will cause the list\n * to become out of sync with the JSON representation.\n * @param args Specifies the container and optionally customizes how the list of models is populated.\n */\n public constructor(args: ContextRealityModelsArgs);\n\n /** @internal */\n public constructor(arg0: ContextRealityModelsContainer | ContextRealityModelsArgs, createContextRealityModel?: (props: ContextRealityModelProps) => ContextRealityModel) {\n let container: ContextRealityModelsContainer;\n let defer = false;\n if (arg0.container) {\n container = arg0.container;\n createContextRealityModel = arg0.createContextRealityModel;\n defer = true === arg0.deferPopulating;\n } else {\n container = arg0;\n }\n\n this._container = container;\n this._createModel = createContextRealityModel ?? ((props) => new ContextRealityModel(props));\n\n if (!defer)\n this.populate();\n }\n\n /** @internal needs to be invoked after DisplayStyleSettings constructor by DisplayStyleState constructor.*/\n /** Populate the list of [[models]] from the container that was supplied to the constructor.\n * This should only be invoked once, and only if [[ContextRealityModelsArgs.deferPopulating]] was specified as `true` when calling the constructor.\n * @public\n */\n public populate(): void {\n assert(this._models.length === 0, \"do not call ContextRealityModels.populate more than once\");\n const models = this._container.contextRealityModels;\n if (models)\n for (const model of models)\n this._models.push(this.createModel(model));\n }\n\n /** The read-only list of reality models. */\n public get models(): ReadonlyArray<ContextRealityModel> {\n return this._models;\n }\n\n /** Append a new reality model to the list.\n * @param The JSON representation of the reality model.\n * @returns the newly-added reality model.\n */\n public add(props: ContextRealityModelProps): ContextRealityModel {\n if (!this._container.contextRealityModels)\n this._container.contextRealityModels = [];\n\n props = ContextRealityModelProps.clone(props);\n const model = this.createModel(props);\n\n this.onChanged.raiseEvent(undefined, model);\n\n this._models.push(model);\n this._container.contextRealityModels.push(props);\n\n return model;\n }\n\n /** Remove the specified reality model from the list.\n * @param model The reality model to remove.\n * @returns true if the model was removed, or false if the model was not present in the list.\n */\n public delete(model: ContextRealityModel): boolean {\n const index = this._models.indexOf(model);\n if (-1 === index)\n return false;\n\n assert(undefined !== this._container.contextRealityModels);\n assert(index < this._container.contextRealityModels.length);\n\n this.dropEventListeners(model);\n this.onChanged.raiseEvent(model, undefined);\n\n this._models.splice(index, 1);\n if (this.models.length === 0)\n this._container.contextRealityModels = undefined;\n else\n this._container.contextRealityModels.splice(index, 1);\n\n return true;\n }\n\n /** Remove all reality models from the list. */\n public clear(): void {\n for (const model of this.models) {\n this.dropEventListeners(model);\n this.onChanged.raiseEvent(model, undefined);\n }\n\n this._container.contextRealityModels = undefined;\n this._models.length = 0;\n }\n\n /** Replace a reality model in the list.\n * @param toReplace The reality model to be replaced.\n * @param replaceWith The JSON representation of the replacement reality model.\n * @returns the newly-created reality model that replaced `toReplace`.\n * @throws Error if `toReplace` is not present in the list\n * @note The replacement occupies the same index in the list as `toReplace` did.\n */\n public replace(toReplace: ContextRealityModel, replaceWith: ContextRealityModelProps): ContextRealityModel {\n const index = this._models.indexOf(toReplace);\n if (-1 === index)\n throw new Error(\"ContextRealityModel not present in list.\");\n\n assert(undefined !== this._container.contextRealityModels);\n assert(index < this._container.contextRealityModels.length);\n\n replaceWith = ContextRealityModelProps.clone(replaceWith);\n const model = this.createModel(replaceWith);\n\n this.onChanged.raiseEvent(toReplace, model);\n this.dropEventListeners(toReplace);\n\n this._models[index] = model;\n this._container.contextRealityModels[index] = replaceWith;\n\n return model;\n }\n\n /** Change selected properties of a reality model.\n * @param toUpdate The reality model whose properties are to be modified.\n * @param updateProps The properties to change.\n * @returns The updated reality model, identical to `toUpdate` except for properties explicitly supplied by `updateProps`.\n * @throws Error if `toUpdate` is not present in the list.\n */\n public update(toUpdate: ContextRealityModel, updateProps: Partial<ContextRealityModelProps>): ContextRealityModel {\n const props = {\n ...toUpdate.toJSON(),\n ...updateProps,\n };\n\n // Partial<> makes it possible to pass `undefined` for tilesetUrl...preserve previous URL in that case.\n if (undefined === props.tilesetUrl)\n props.tilesetUrl = toUpdate.url;\n\n return this.replace(toUpdate, props);\n }\n\n private createModel(props: ContextRealityModelProps): ContextRealityModel {\n const model = this._createModel(props);\n // eslint-disable-next-line @typescript-eslint/unbound-method\n model.onPlanarClipMaskChanged.addListener(this.handlePlanarClipMaskChanged, this);\n // eslint-disable-next-line @typescript-eslint/unbound-method\n model.onAppearanceOverridesChanged.addListener(this.handleAppearanceOverridesChanged, this);\n // eslint-disable-next-line @typescript-eslint/unbound-method\n model.onDisplaySettingsChanged.addListener(this.handleDisplaySettingsChanged, this);\n // eslint-disable-next-line @typescript-eslint/unbound-method\n model.onInvisibleChanged.addListener(this.handleInvisibleChanged, this);\n return model;\n }\n\n private dropEventListeners(model: ContextRealityModel): void {\n // eslint-disable-next-line @typescript-eslint/unbound-method\n model.onPlanarClipMaskChanged.removeListener(this.handlePlanarClipMaskChanged, this);\n // eslint-disable-next-line @typescript-eslint/unbound-method\n model.onAppearanceOverridesChanged.removeListener(this.handleAppearanceOverridesChanged, this);\n // eslint-disable-next-line @typescript-eslint/unbound-method\n model.onDisplaySettingsChanged.removeListener(this.handleDisplaySettingsChanged, this);\n // eslint-disable-next-line @typescript-eslint/unbound-method\n model.onInvisibleChanged.removeListener(this.handleInvisibleChanged, this);\n }\n\n private handlePlanarClipMaskChanged(mask: PlanarClipMaskSettings | undefined, model: ContextRealityModel): void {\n this.onPlanarClipMaskChanged.raiseEvent(model, mask);\n }\n\n private handleAppearanceOverridesChanged(app: FeatureAppearance | undefined, model: ContextRealityModel): void {\n this.onAppearanceOverridesChanged.raiseEvent(model, app);\n }\n\n private handleDisplaySettingsChanged(settings: RealityModelDisplaySettings, model: ContextRealityModel): void {\n this.onDisplaySettingsChanged.raiseEvent(model, settings);\n }\n\n private handleInvisibleChanged(invisible: boolean, model: ContextRealityModel): void {\n this.onInvisibleChanged.raiseEvent(model, invisible);\n }\n}\n"]}
1
+ {"version":3,"file":"ContextRealityModel.js","sourceRoot":"","sources":["../../src/ContextRealityModel.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAsD;AACtD,yDAA+E;AAC/E,qDAAmG;AACnG,mEAAkH;AAClH,+EAAsG;AAatG;;GAEG;AACH,IAAY,mBAyBX;AAzBD,WAA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AAC,uBAAuB,CAAC,UAAU,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IACvD,CAAC;IAEO,gCAAgC,CAAC,GAAkC,EAAE,KAA0B;QACrG,IAAI,CAAC,4BAA4B,CAAC,UAAU,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IAC3D,CAAC;IAEO,4BAA4B,CAAC,QAAqC,EAAE,KAA0B;QACpG,IAAI,CAAC,wBAAwB,CAAC,UAAU,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IAC5D,CAAC;IAEO,sBAAsB,CAAC,SAAkB,EAAE,KAA0B;QAC3E,IAAI,CAAC,kBAAkB,CAAC,UAAU,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;IACvD,CAAC;CACF;AAlND,oDAkNC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module DisplayStyles\n */\n\nimport { assert, BeEvent } from \"@itwin/core-bentley\";\nimport { FeatureAppearance, FeatureAppearanceProps } from \"./FeatureSymbology\";\nimport { PlanarClipMaskMode, PlanarClipMaskProps, PlanarClipMaskSettings } from \"./PlanarClipMask\";\nimport { SpatialClassifierProps, SpatialClassifiers, SpatialClassifiersContainer } from \"./SpatialClassification\";\nimport { RealityModelDisplayProps, RealityModelDisplaySettings } from \"./RealityModelDisplaySettings\";\n\n/** JSON representation of the blob properties for an OrbitGt property cloud.\n * @alpha\n */\nexport interface OrbitGtBlobProps {\n rdsUrl?: string;\n containerName: string;\n blobFileName: string;\n sasToken: string;\n accountName: string;\n}\n\n/** Identify the Reality Data service provider\n * @beta\n */\nexport enum RealityDataProvider {\n /**\n * This is the legacy mode where the access to the 3d tiles is hardcoded in ContextRealityModelProps.tilesetUrl property.\n * It was used to support RealityMesh3DTiles, Terrain3DTiles, Cesium3DTiles\n * You should use other modes when possible\n * @see [[RealityDataSource.createKeyFromUrl]] that will try to detect provider from an URL\n */\n TilesetUrl = \"TilesetUrl\",\n /**\n * This is the legacy mode where the access to the 3d tiles is hardcoded in ContextRealityModelProps.OrbitGtBlob property.\n * It was used to support OrbitPointCloud (OPC) from other server than ContextShare\n * You should use other modes when possible\n * @see [[RealityDataSource.createKeyFromOrbitGtBlobProps]] that will try to detect provider from an URL\n */\n OrbitGtBlob = \"OrbitGtBlob\",\n /**\n * Will provide access url from realityDataId and iTwinId on contextShare for 3dTile storage format or OPC storage format\n * This provider supports all types of 3dTile storage format and OrbitPointCloud: RealityMesh3DTiles, Terrain3DTiles, Cesium3DTiles, OPC\n * @see [[RealityDataFormat]].\n */\n ContextShare = \"ContextShare\",\n /**\n * Will provide Open Street Map Building (OSM) from Cesium Ion (in 3dTile format)\n */\n CesiumIonAsset = \"CesiumIonAsset\",\n}\n\n/** Identify the Reality Data storage format\n * @beta\n */\nexport enum RealityDataFormat {\n /**\n * 3dTile supported formats; RealityMesh3DTiles, Terrain3DTiles, Cesium3DTiles\n * */\n ThreeDTile = \"ThreeDTile\",\n /**\n * Orbit Point Cloud (OPC) storage format (RealityDataType.OPC)\n */\n OPC = \"OPC\",\n}\n\n/** Utility function for RealityDataFormat\n * @beta\n */\nexport namespace RealityDataFormat {\n /**\n * Try to extract the RealityDataFormat from the url\n * @param tilesetUrl the reality data attachment url\n * @returns the extracted RealityDataFormat or ThreeDTile by default if not found\n */\n export function fromUrl(tilesetUrl: string): RealityDataFormat {\n let format = RealityDataFormat.ThreeDTile;\n if (tilesetUrl.includes(\".opc\"))\n format = RealityDataFormat.OPC;\n return format;\n }\n}\n\n/**\n * Key used by RealityDataSource to identify provider and reality data format\n * This key identify one and only one reality data source on the provider\n * @beta\n */\nexport interface RealityDataSourceKey {\n /**\n * The provider that supplies the access to reality data source for displaying the reality model\n * @see [[RealityDataProvider]] for default supported value;\n */\n provider: string;\n /**\n * The format used by the provider to store the reality data\n * @see [[RealityDataFormat]] for default supported value;\n */\n format: string;\n /** The reality data id that identify a reality data for the provider */\n id: string;\n /** The context id that was used when reality data was attached - if none provided, current session iTwinId will be used */\n iTwinId?: string;\n}\n/**\n * RealityDataSourceKey utility functions\n * @beta */\nexport namespace RealityDataSourceKey {\n /** Utility function to convert a RealityDataSourceKey into its string representation */\n export function convertToString(rdSourceKey: RealityDataSourceKey): string {\n return `${rdSourceKey.provider}:${rdSourceKey.format}:${rdSourceKey.id}:${rdSourceKey?.iTwinId}`;\n }\n /** Utility function to compare two RealityDataSourceKey, we consider it equal even if itwinId is different */\n export function isEqual(key1: RealityDataSourceKey, key2: RealityDataSourceKey): boolean {\n if ((key1.provider === RealityDataProvider.CesiumIonAsset) && key2.provider === RealityDataProvider.CesiumIonAsset)\n return true; // ignore other properties for CesiumIonAsset, id is hidden\n if ((key1.provider === key2.provider) && (key1.format === key2.format) && (key1.id === key2.id)) {\n // && (key1?.iTwinId === key2?.iTwinId)) -> ignore iTwinId, consider it is the same reality data\n return true;\n }\n return false;\n }\n}\n\n/** JSON representation of the reality data reference attachment properties.\n * @beta\n*/\nexport interface RealityDataSourceProps {\n /** The source key that identify a reality data for the provider. */\n sourceKey: RealityDataSourceKey;\n}\n\n/** JSON representation of a [[ContextRealityModel]].\n * @public\n * @extensions\n */\nexport interface ContextRealityModelProps {\n /** See [[ContextRealityModel.rdSourceKey]].\n * @beta\n */\n rdSourceKey?: RealityDataSourceKey;\n /** The URL that supplies the 3d tiles for displaying the reality model. */\n tilesetUrl: string;\n /** See [[ContextRealityModel.orbitGtBlob]].\n * @alpha\n */\n orbitGtBlob?: OrbitGtBlobProps;\n /** See [[ContextRealityModel.realityDataId]]. */\n realityDataId?: string;\n /** An optional, user-friendly name for the reality model suitable for display in a user interface. */\n name?: string;\n /** An optional, user-friendly description of the reality model suitable for display in a user interface. */\n description?: string;\n /** See [[ContextRealityModel.classifiers]]. */\n classifiers?: SpatialClassifierProps[];\n /** See [[ContextRealityModel.planarClipMask]]. */\n planarClipMask?: PlanarClipMaskProps;\n /** See [[ContextRealityModel.appearanceOverrides]]. */\n appearanceOverrides?: FeatureAppearanceProps;\n /** See [[ContextRealityModel.displaySettings]].\n * @beta\n */\n displaySettings?: RealityModelDisplayProps;\n /** See [[ContextRealityModel.invisible]].\n * @beta\n */\n invisible?: boolean;\n}\n\n/** @public */\nexport namespace ContextRealityModelProps {\n /** Produce a deep copy of `input`. */\n export function clone(input: ContextRealityModelProps): ContextRealityModelProps {\n // Spread operator is shallow, and includes `undefined` properties and empty strings.\n // We want to make deep copies, omit undefined properties and empty strings, and require tilesetUrl to be defined.\n const output: ContextRealityModelProps = { tilesetUrl: input.tilesetUrl ?? \"\" };\n\n if (input.rdSourceKey)\n output.rdSourceKey = { ...input.rdSourceKey };\n\n if (input.name)\n output.name = input.name;\n\n if (input.realityDataId)\n output.realityDataId = input.realityDataId;\n\n if (input.description)\n output.description = input.description;\n\n if (input.orbitGtBlob)\n output.orbitGtBlob = { ...input.orbitGtBlob };\n\n if (input.appearanceOverrides) {\n output.appearanceOverrides = { ...input.appearanceOverrides };\n if (input.appearanceOverrides.rgb)\n output.appearanceOverrides.rgb = { ...input.appearanceOverrides.rgb };\n }\n\n if (input.displaySettings) {\n output.displaySettings = { ...input.displaySettings };\n if (input.displaySettings.pointCloud)\n output.displaySettings.pointCloud = { ...output.displaySettings.pointCloud };\n }\n\n if (input.planarClipMask)\n output.planarClipMask = { ...input.planarClipMask };\n\n if (input.classifiers)\n output.classifiers = input.classifiers.map((x) => { return { ...x, flags: { ...x.flags } }; });\n\n if (input.invisible)\n output.invisible = input.invisible;\n\n return output;\n }\n}\n\n/** A reality model not associated with a [GeometricModel]($backend) but instead defined in a [DisplayStyle]($backend) or [DisplayStyleState]($frontend).\n * Such reality models are displayed to provide context to the view and can be freely attached and detached at display time.\n * @see [this interactive example](https://www.itwinjs.org/sample-showcase/?group=Viewer&sample=reality-data-sample)\n * @see [[DisplayStyleSettings.contextRealityModels]] to define context reality models for a display style.\n * @public\n */\nexport class ContextRealityModel {\n /** @internal */\n protected readonly _props: ContextRealityModelProps;\n /**\n * The reality data source key identify the reality data provider and storage format.\n * It takes precedence over tilesetUrl and orbitGtBlob when present and can be use to actually replace these properties.\n * @beta\n */\n public readonly rdSourceKey?: RealityDataSourceKey;\n /** A name suitable for display in a user interface. By default, an empty string. */\n public readonly name: string;\n /** The URL that supplies the 3d tiles for displaying the reality model. */\n public readonly url: string;\n /** A description of the model suitable for display in a user interface. By default, an empty string. */\n public readonly description: string;\n /** An optional identifier that, if present, can be used to elide a request to the reality data service. */\n public readonly realityDataId?: string;\n\n private _invisible: boolean;\n private readonly _classifiers: SpatialClassifiers;\n /** @alpha */\n public readonly orbitGtBlob?: Readonly<OrbitGtBlobProps>;\n protected _appearanceOverrides?: FeatureAppearance;\n /** @beta */\n protected _displaySettings: RealityModelDisplaySettings;\n protected _planarClipMask?: PlanarClipMaskSettings;\n /** Event dispatched just before assignment to [[planarClipMaskSettings]]. */\n public readonly onPlanarClipMaskChanged = new BeEvent<(newSettings: PlanarClipMaskSettings | undefined, model: ContextRealityModel) => void>();\n /** Event dispatched just before assignment to [[appearanceOverrides]]. */\n public readonly onAppearanceOverridesChanged = new BeEvent<(newOverrides: FeatureAppearance | undefined, model: ContextRealityModel) => void>();\n /** Event dispatched just before assignment to [[displaySettings]].\n * @beta\n */\n public readonly onDisplaySettingsChanged = new BeEvent<(newSettings: RealityModelDisplaySettings, model: ContextRealityModel) => void>();\n /** Event dispatched just before a model become invisible\n * @beta\n */\n public readonly onInvisibleChanged = new BeEvent<(invisible: boolean, model: ContextRealityModel) => void>();\n\n /** Construct a new context reality model.\n * @param props JSON representation of the reality model, which will be kept in sync with changes made via the ContextRealityModel's methods.\n * @param options Options to customize how the reality model is created.\n */\n public constructor(props: ContextRealityModelProps, options?: { createClassifiers: (container: SpatialClassifiersContainer) => SpatialClassifiers }) {\n this._props = props;\n this.rdSourceKey = props.rdSourceKey;\n this.name = props.name ?? \"\";\n this.url = props.tilesetUrl ?? \"\";\n this.orbitGtBlob = props.orbitGtBlob;\n this.realityDataId = props.realityDataId;\n this.description = props.description ?? \"\";\n this._invisible = props.invisible ?? false;\n this._appearanceOverrides = props.appearanceOverrides ? FeatureAppearance.fromJSON(props.appearanceOverrides) : undefined;\n this._displaySettings = RealityModelDisplaySettings.fromJSON(props.displaySettings);\n\n if (props.planarClipMask && props.planarClipMask.mode !== PlanarClipMaskMode.None)\n this._planarClipMask = PlanarClipMaskSettings.fromJSON(props.planarClipMask);\n\n if (options?.createClassifiers) {\n this._classifiers = options.createClassifiers(props);\n } else {\n this._classifiers = new SpatialClassifiers(props);\n }\n }\n\n /** A set of [[SpatialClassifier]]s, of which one at any given time can be used to classify the reality model. */\n public get classifiers(): SpatialClassifiers {\n return this._classifiers;\n }\n\n /** Optionally describes how the geometry of the reality model can be masked by other models. */\n public get planarClipMaskSettings(): PlanarClipMaskSettings | undefined {\n return this._planarClipMask;\n }\n public set planarClipMaskSettings(settings: PlanarClipMaskSettings | undefined) {\n this.onPlanarClipMaskChanged.raiseEvent(settings, this);\n if (!settings)\n delete this._props.planarClipMask;\n else\n this._props.planarClipMask = settings.toJSON();\n\n this._planarClipMask = settings;\n }\n\n /** Overrides applied to the appearance of the reality model. Only the rgb, transparency, nonLocatable, and emphasized properties are applicable - the rest are ignored. */\n public get appearanceOverrides(): FeatureAppearance | undefined {\n return this._appearanceOverrides;\n }\n public set appearanceOverrides(overrides: FeatureAppearance | undefined) {\n this.onAppearanceOverridesChanged.raiseEvent(overrides, this);\n if (!overrides)\n delete this._props.appearanceOverrides;\n else\n this._props.appearanceOverrides = overrides.toJSON();\n\n this._appearanceOverrides = overrides;\n }\n\n /** Settings controlling how this reality model is displayed in a [Viewport]($frontend).\n * @beta\n */\n public get displaySettings(): RealityModelDisplaySettings {\n return this._displaySettings;\n }\n public set displaySettings(settings: RealityModelDisplaySettings) {\n this.onDisplaySettingsChanged.raiseEvent(settings, this);\n this._props.displaySettings = settings.toJSON();\n this._displaySettings = settings;\n }\n\n /** If true, reality model is not drawn.\n * @beta\n */\n public get invisible(): boolean {\n return this._invisible;\n }\n public set invisible(invisible: boolean) {\n if (invisible !== this.invisible) {\n this.onInvisibleChanged.raiseEvent(invisible, this);\n }\n\n this._props.invisible = invisible;\n this._invisible = invisible;\n }\n\n /** Convert this model to its JSON representation. */\n public toJSON(): ContextRealityModelProps {\n return ContextRealityModelProps.clone(this._props);\n }\n\n /** Returns true if [[name]] and [[url]] match the specified name and url. */\n public matchesNameAndUrl(name: string, url: string): boolean {\n return this.name === name && this.url === url;\n }\n}\n\n/** An object that can store the JSON representation of a list of [[ContextRealityModel]]s.\n * @see [[ContextRealityModels]].\n * @see [[DisplayStyleSettingsProps.contextRealityModels]].\n * @public\n * @extensions\n */\nexport interface ContextRealityModelsContainer {\n /** The list of reality models. */\n contextRealityModels?: ContextRealityModelProps[];\n /** @internal used for type discrimination with ContextRealityModelsArgs. */\n container?: never;\n}\n\n/** Arguments supplied to the constructor of [[ContextRealityModels]].\n * @public\n */\nexport interface ContextRealityModelsArgs {\n /** The object that holds the JSON representation of the list of context reality models. */\n container: ContextRealityModelsContainer;\n /** Optional function used to instantiate each [[ContextRealityModel]] in the list. */\n createContextRealityModel?: (props: ContextRealityModelProps) => ContextRealityModel;\n /** If true, the list will not be populated by the constructor. Instead, the caller is responsible for calling [[ContextRealityModels.populate]] exactly once after construction.\n * This is chiefly intended for use internally by the [DisplayStyleState]($frontend) constructor.\n */\n deferPopulating?: boolean;\n}\n\n/** A list of [[ContextRealityModel]]s attached to a [[DisplayStyleSettings]]. The list may be presented to the user with the name and description of each model.\n * The list is automatically synchronized with the underlying JSON representation provided by the input [[ContextRealityModelsContainer]].\n * @see [this interactive example](https://www.itwinjs.org/sample-showcase/?group=Viewer&sample=reality-data-sample)\n * @see [[DisplayStyleSettings.contextRealityModels]].\n * @public\n */\nexport class ContextRealityModels {\n private readonly _container: ContextRealityModelsContainer;\n private readonly _createModel: (props: ContextRealityModelProps) => ContextRealityModel;\n private readonly _models: ContextRealityModel[] = [];\n /** Event dispatched just before [[ContextRealityModel.planarClipMaskSettings]] is modified for one of the reality models. */\n public readonly onPlanarClipMaskChanged = new BeEvent<(model: ContextRealityModel, newSettings: PlanarClipMaskSettings | undefined) => void>();\n /** Event dispatched just before [[ContextRealityModel.appearanceOverrides]] is modified for one of the reality models. */\n public readonly onAppearanceOverridesChanged = new BeEvent<(model: ContextRealityModel, newOverrides: FeatureAppearance | undefined) => void>();\n /** Event dispatched just before [[ContextRealityModel.displaySettings]] is modified for one of the reality models.\n * @beta\n */\n public readonly onDisplaySettingsChanged = new BeEvent<(model: ContextRealityModel, newSettings: RealityModelDisplaySettings) => void>();\n /** Event dispatched just before [[ContextRealityModel.invisible]] is modified for one of the reality models.\n * @beta\n */\n public readonly onInvisibleChanged = new BeEvent<(model: ContextRealityModel, invisible: boolean) => void>();\n /** Event dispatched when a model is [[add]]ed, [[delete]]d, [[replace]]d, or [[update]]d. */\n public readonly onChanged = new BeEvent<(previousModel: ContextRealityModel | undefined, newModel: ContextRealityModel | undefined) => void>();\n\n /** Construct a new list of reality models from its JSON representation. The list will be initialized from `container.contextRealityModels` and that JSON representation\n * will be kept in sync with changes made to the list. The caller should not directly modify `container.contextRealityModels` or its contents as that will cause the list\n * to become out of sync with the JSON representation.\n * @param container The object that holds the JSON representation of the list.\n * @param createContextRealityModel Optional function used to instantiate each [[ContextRealityModel]] in the list.\n */\n public constructor(container: ContextRealityModelsContainer, createContextRealityModel?: (props: ContextRealityModelProps) => ContextRealityModel);\n\n /** Construct a new list of reality models from its JSON representation. The list will be initialized from `args.container.contextRealityModels` and that JSON representation\n * will be kept in sync with changes made to the list. The caller should not directly modify `container.contextRealityModels` or its contents as that will cause the list\n * to become out of sync with the JSON representation.\n * @param args Specifies the container and optionally customizes how the list of models is populated.\n */\n public constructor(args: ContextRealityModelsArgs);\n\n /** @internal */\n public constructor(arg0: ContextRealityModelsContainer | ContextRealityModelsArgs, createContextRealityModel?: (props: ContextRealityModelProps) => ContextRealityModel) {\n let container: ContextRealityModelsContainer;\n let defer = false;\n if (arg0.container) {\n container = arg0.container;\n createContextRealityModel = arg0.createContextRealityModel;\n defer = true === arg0.deferPopulating;\n } else {\n container = arg0;\n }\n\n this._container = container;\n this._createModel = createContextRealityModel ?? ((props) => new ContextRealityModel(props));\n\n if (!defer)\n this.populate();\n }\n\n /** @internal needs to be invoked after DisplayStyleSettings constructor by DisplayStyleState constructor.*/\n /** Populate the list of [[models]] from the container that was supplied to the constructor.\n * This should only be invoked once, and only if [[ContextRealityModelsArgs.deferPopulating]] was specified as `true` when calling the constructor.\n * @public\n */\n public populate(): void {\n assert(this._models.length === 0, \"do not call ContextRealityModels.populate more than once\");\n const models = this._container.contextRealityModels;\n if (models)\n for (const model of models)\n this._models.push(this.createModel(model));\n }\n\n /** The read-only list of reality models. */\n public get models(): ReadonlyArray<ContextRealityModel> {\n return this._models;\n }\n\n /** Append a new reality model to the list.\n * @param The JSON representation of the reality model.\n * @returns the newly-added reality model.\n */\n public add(props: ContextRealityModelProps): ContextRealityModel {\n if (!this._container.contextRealityModels)\n this._container.contextRealityModels = [];\n\n props = ContextRealityModelProps.clone(props);\n const model = this.createModel(props);\n\n this.onChanged.raiseEvent(undefined, model);\n\n this._models.push(model);\n this._container.contextRealityModels.push(props);\n\n return model;\n }\n\n /** Remove the specified reality model from the list.\n * @param model The reality model to remove.\n * @returns true if the model was removed, or false if the model was not present in the list.\n */\n public delete(model: ContextRealityModel): boolean {\n const index = this._models.indexOf(model);\n if (-1 === index)\n return false;\n\n assert(undefined !== this._container.contextRealityModels);\n assert(index < this._container.contextRealityModels.length);\n\n this.dropEventListeners(model);\n this.onChanged.raiseEvent(model, undefined);\n\n this._models.splice(index, 1);\n if (this.models.length === 0)\n this._container.contextRealityModels = undefined;\n else\n this._container.contextRealityModels.splice(index, 1);\n\n return true;\n }\n\n /** Remove all reality models from the list. */\n public clear(): void {\n for (const model of this.models) {\n this.dropEventListeners(model);\n this.onChanged.raiseEvent(model, undefined);\n }\n\n this._container.contextRealityModels = undefined;\n this._models.length = 0;\n }\n\n /** Replace a reality model in the list.\n * @param toReplace The reality model to be replaced.\n * @param replaceWith The JSON representation of the replacement reality model.\n * @returns the newly-created reality model that replaced `toReplace`.\n * @throws Error if `toReplace` is not present in the list\n * @note The replacement occupies the same index in the list as `toReplace` did.\n */\n public replace(toReplace: ContextRealityModel, replaceWith: ContextRealityModelProps): ContextRealityModel {\n const index = this._models.indexOf(toReplace);\n if (-1 === index)\n throw new Error(\"ContextRealityModel not present in list.\");\n\n assert(undefined !== this._container.contextRealityModels);\n assert(index < this._container.contextRealityModels.length);\n\n replaceWith = ContextRealityModelProps.clone(replaceWith);\n const model = this.createModel(replaceWith);\n\n this.onChanged.raiseEvent(toReplace, model);\n this.dropEventListeners(toReplace);\n\n this._models[index] = model;\n this._container.contextRealityModels[index] = replaceWith;\n\n return model;\n }\n\n /** Change selected properties of a reality model.\n * @param toUpdate The reality model whose properties are to be modified.\n * @param updateProps The properties to change.\n * @returns The updated reality model, identical to `toUpdate` except for properties explicitly supplied by `updateProps`.\n * @throws Error if `toUpdate` is not present in the list.\n */\n public update(toUpdate: ContextRealityModel, updateProps: Partial<ContextRealityModelProps>): ContextRealityModel {\n const props = {\n ...toUpdate.toJSON(),\n ...updateProps,\n };\n\n // Partial<> makes it possible to pass `undefined` for tilesetUrl...preserve previous URL in that case.\n if (undefined === props.tilesetUrl)\n props.tilesetUrl = toUpdate.url;\n\n return this.replace(toUpdate, props);\n }\n\n private createModel(props: ContextRealityModelProps): ContextRealityModel {\n const model = this._createModel(props);\n // eslint-disable-next-line @typescript-eslint/unbound-method\n model.onPlanarClipMaskChanged.addListener(this.handlePlanarClipMaskChanged, this);\n // eslint-disable-next-line @typescript-eslint/unbound-method\n model.onAppearanceOverridesChanged.addListener(this.handleAppearanceOverridesChanged, this);\n // eslint-disable-next-line @typescript-eslint/unbound-method\n model.onDisplaySettingsChanged.addListener(this.handleDisplaySettingsChanged, this);\n // eslint-disable-next-line @typescript-eslint/unbound-method\n model.onInvisibleChanged.addListener(this.handleInvisibleChanged, this);\n return model;\n }\n\n private dropEventListeners(model: ContextRealityModel): void {\n // eslint-disable-next-line @typescript-eslint/unbound-method\n model.onPlanarClipMaskChanged.removeListener(this.handlePlanarClipMaskChanged, this);\n // eslint-disable-next-line @typescript-eslint/unbound-method\n model.onAppearanceOverridesChanged.removeListener(this.handleAppearanceOverridesChanged, this);\n // eslint-disable-next-line @typescript-eslint/unbound-method\n model.onDisplaySettingsChanged.removeListener(this.handleDisplaySettingsChanged, this);\n // eslint-disable-next-line @typescript-eslint/unbound-method\n model.onInvisibleChanged.removeListener(this.handleInvisibleChanged, this);\n }\n\n private handlePlanarClipMaskChanged(mask: PlanarClipMaskSettings | undefined, model: ContextRealityModel): void {\n this.onPlanarClipMaskChanged.raiseEvent(model, mask);\n }\n\n private handleAppearanceOverridesChanged(app: FeatureAppearance | undefined, model: ContextRealityModel): void {\n this.onAppearanceOverridesChanged.raiseEvent(model, app);\n }\n\n private handleDisplaySettingsChanged(settings: RealityModelDisplaySettings, model: ContextRealityModel): void {\n this.onDisplaySettingsChanged.raiseEvent(model, settings);\n }\n\n private handleInvisibleChanged(invisible: boolean, model: ContextRealityModel): void {\n this.onInvisibleChanged.raiseEvent(model, invisible);\n }\n}\n"]}
@@ -42,6 +42,10 @@ export interface TextBlockStringifyOptions {
42
42
  * Default: "/"
43
43
  */
44
44
  fractionSeparator?: string;
45
+ /** The number of spaces to use for tabs. If not provided, tabs will be represented by a tab character: "\t".
46
+ * Default: "undefined" - use "\t".
47
+ */
48
+ tabsAsSpaces?: number;
45
49
  }
46
50
  /** Abstract representation of any of the building blocks that make up a [[TextBlock]] document - namely [[Run]]s, [[Paragraph]]s, and [[TextBlock]] itself.
47
51
  * Each component can specify a [[TextStyle]] that formats its contents and optional [[styleOverrides]] to customize that formatting.
@@ -74,6 +78,11 @@ export declare abstract class TextBlockComponent {
74
78
  abstract clone(): TextBlockComponent;
75
79
  /** Compute a string representation of the contents of this component and all of its sub-components. */
76
80
  abstract stringify(options?: TextBlockStringifyOptions): string;
81
+ /**
82
+ * Returns true if the string representation of this component consists only of whitespace characters.
83
+ * Useful for checking if the component is visually empty (producing no graphics) or contains only spaces, tabs, or line breaks.
84
+ */
85
+ get isWhitespace(): boolean;
77
86
  /** Convert this component to its JSON representation. */
78
87
  toJSON(): TextBlockComponentProps;
79
88
  /** Returns true if `this` is equivalent to `other`. */
@@ -82,12 +91,12 @@ export declare abstract class TextBlockComponent {
82
91
  /**
83
92
  * @beta
84
93
  */
85
- export type Run = TextRun | FractionRun | LineBreakRun;
94
+ export type Run = TextRun | FractionRun | TabRun | LineBreakRun;
86
95
  /** The JSON representation of a [[Run]].
87
96
  * Use the `type` field to discriminate between the different kinds of runs.
88
97
  * @beta
89
98
  */
90
- export type RunProps = TextRunProps | FractionRunProps | LineBreakRunProps;
99
+ export type RunProps = TextRunProps | FractionRunProps | TabRunProps | LineBreakRunProps;
91
100
  /** A sequence of characters within a [[Paragraph]] that share a single style. Runs are the leaf nodes of a [[TextBlock]] document. When laid out for display, a single run may span
92
101
  * multiple lines, but it will never contain different styling.
93
102
  * Use the `type` field to discriminate between the different kinds of runs.
@@ -189,6 +198,31 @@ export declare class LineBreakRun extends TextBlockComponent {
189
198
  stringify(options?: TextBlockStringifyOptions): string;
190
199
  equals(other: TextBlockComponent): boolean;
191
200
  }
201
+ /** JSON representation of a [[TabRun]].
202
+ * @beta
203
+ */
204
+ export interface TabRunProps extends TextBlockComponentProps {
205
+ /** Discriminator field for the [[RunProps]] union. */
206
+ readonly type: "tab";
207
+ }
208
+ /** A [[TabRun]] is used to shift the next tab stop.
209
+ * @note Only left-justified tabs are supported at this tab.
210
+ * @beta
211
+ */
212
+ export declare class TabRun extends TextBlockComponent {
213
+ /** Discriminator field for the [[Run]] union. */
214
+ readonly type = "tab";
215
+ toJSON(): TabRunProps;
216
+ clone(): TabRun;
217
+ static create(props: Omit<TabRunProps, "type">): TabRun;
218
+ /**
219
+ * Converts a [[TabRun]] to its string representation.
220
+ * If the `tabsAsSpaces` option is provided, returns a string of spaces of the specified length.
221
+ * Otherwise, returns a tab character ("\t").
222
+ */
223
+ stringify(options?: TextBlockStringifyOptions): string;
224
+ equals(other: TextBlockComponent): boolean;
225
+ }
192
226
  /** JSON representation of a [[Paragraph]].
193
227
  * @beta
194
228
  */
@@ -1 +1 @@
1
- {"version":3,"file":"TextBlock.d.ts","sourceRoot":"","sources":["../../../src/annotation/TextBlock.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAErD;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC;;OAEG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B;;OAEG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,mJAAmJ;IACnJ,SAAS,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,cAAc,CAAC,EAAE,sBAAsB,CAAC;CACzC;AAED;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED;;;GAGG;AACH,8BAAsB,kBAAkB;IACtC,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,eAAe,CAAyB;IAEhD,gBAAgB;IAChB,SAAS,aAAa,KAAK,EAAE,uBAAuB;IAKpD;;;OAGG;IACH,IAAW,SAAS,IAAI,MAAM,CAE7B;IAED,IAAW,SAAS,CAAC,SAAS,EAAE,MAAM,EAErC;IAED;;;OAGG;IACH,IAAW,cAAc,IAAI,sBAAsB,CAElD;IAED,IAAW,cAAc,CAAC,SAAS,EAAE,sBAAsB,EAE1D;IAED,8EAA8E;IACvE,mBAAm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a,EAAE,sBAAsB,CAAC;IAC7C,mCAAmC;IAC5B,OAAO,EAAE,gBAAgB,CAAC;IACjC,0DAA0D;IAC1D,SAAgB,UAAU,EAAE,SAAS,EAAE,CAAC;IAExC,OAAO;IAgBS,MAAM,IAAI,cAAc;IAUxC,wDAAwD;WAC1C,MAAM,CAAC,KAAK,EAAE,cAAc,GAAG,SAAS;IAItD,0FAA0F;WAC5E,WAAW,IAAI,SAAS;IAItC,mEAAmE;IACnE,IAAW,OAAO,IAAI,OAAO,CAE5B;IAEe,KAAK,IAAI,SAAS;IAIlC,kJAAkJ;IAClI,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,qBAAqB,GAAG,IAAI;IASpF,uMAAuM;IAChM,SAAS,CAAC,OAAO,CAAC,EAAE,yBAAyB,GAAG,MAAM;IAI7D;;;OAGG;IACI,eAAe,IAAI,SAAS;IAWnC;;OAEG;IACI,SAAS,CAAC,GAAG,EAAE,GAAG,GAAG,IAAI;IAKhB,MAAM,CAAC,KAAK,EAAE,kBAAkB,GAAG,OAAO;CAiB3D"}
@@ -7,7 +7,7 @@
7
7
  * @module Annotation
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.TextBlock = exports.Paragraph = exports.LineBreakRun = exports.FractionRun = exports.TextRun = exports.Run = exports.TextBlockComponent = void 0;
10
+ exports.TextBlock = exports.Paragraph = exports.TabRun = exports.LineBreakRun = exports.FractionRun = exports.TextRun = exports.Run = exports.TextBlockComponent = void 0;
11
11
  /** Abstract representation of any of the building blocks that make up a [[TextBlock]] document - namely [[Run]]s, [[Paragraph]]s, and [[TextBlock]] itself.
12
12
  * Each component can specify a [[TextStyle]] that formats its contents and optional [[styleOverrides]] to customize that formatting.
13
13
  * @beta
@@ -55,6 +55,14 @@ class TextBlockComponent {
55
55
  get overridesStyle() {
56
56
  return Object.keys(this.styleOverrides).length > 0;
57
57
  }
58
+ /**
59
+ * Returns true if the string representation of this component consists only of whitespace characters.
60
+ * Useful for checking if the component is visually empty (producing no graphics) or contains only spaces, tabs, or line breaks.
61
+ */
62
+ get isWhitespace() {
63
+ return /^\s*$/g.test(this.stringify());
64
+ }
65
+ ;
58
66
  /** Convert this component to its JSON representation. */
59
67
  toJSON() {
60
68
  return {
@@ -93,6 +101,7 @@ var Run;
93
101
  switch (props.type) {
94
102
  case "text": return TextRun.create(props);
95
103
  case "fraction": return FractionRun.create(props);
104
+ case "tab": return TabRun.create(props);
96
105
  case "linebreak": return LineBreakRun.create(props);
97
106
  }
98
107
  }
@@ -206,6 +215,41 @@ class LineBreakRun extends TextBlockComponent {
206
215
  }
207
216
  }
208
217
  exports.LineBreakRun = LineBreakRun;
218
+ /** A [[TabRun]] is used to shift the next tab stop.
219
+ * @note Only left-justified tabs are supported at this tab.
220
+ * @beta
221
+ */
222
+ class TabRun extends TextBlockComponent {
223
+ /** Discriminator field for the [[Run]] union. */
224
+ type = "tab";
225
+ toJSON() {
226
+ return {
227
+ ...super.toJSON(),
228
+ type: "tab",
229
+ };
230
+ }
231
+ clone() {
232
+ return new TabRun(this.toJSON());
233
+ }
234
+ static create(props) {
235
+ return new TabRun(props);
236
+ }
237
+ /**
238
+ * Converts a [[TabRun]] to its string representation.
239
+ * If the `tabsAsSpaces` option is provided, returns a string of spaces of the specified length.
240
+ * Otherwise, returns a tab character ("\t").
241
+ */
242
+ stringify(options) {
243
+ if (options?.tabsAsSpaces) {
244
+ return " ".repeat(options.tabsAsSpaces);
245
+ }
246
+ return "\t";
247
+ }
248
+ equals(other) {
249
+ return other instanceof TabRun && super.equals(other);
250
+ }
251
+ }
252
+ exports.TabRun = TabRun;
209
253
  /** A collection of [[Run]]s within a [[TextBlock]]. Each paragraph within a text block is laid out on a separate line.
210
254
  * @beta
211
255
  */
@@ -1 +1 @@
1
- {"version":3,"file":"TextBlock.js","sourceRoot":"","sources":["../../../src/annotation/TextBlock.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAgDH;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AAC;YAClC,OAAO,KAAK,CAAC;QACf,CAAC;QAED,IAAI,IAAI,CAAC,KAAK,KAAK,KAAK,CAAC,KAAK,IAAI,IAAI,CAAC,aAAa,KAAK,KAAK,CAAC,aAAa,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,KAAK,KAAK,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC;YACnI,OAAO,KAAK,CAAC;QACf,CAAC;QAED,MAAM,eAAe,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAC1E,KAAK,KAAM,KAAK,CAAC,OAAe,CAAC,GAAG,CAAC,CACtC,CAAC;QAEF,IAAI,CAAC,eAAe;YAAE,OAAO,KAAK,CAAC;QAEnC,OAAO,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,SAAS,EAAE,KAAK,EAAE,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAChG,CAAC;CACF;AAjHD,8BAiHC","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 Annotation\n */\n\nimport { TextStyleSettingsProps } from \"./TextStyle\";\n\n/** Options supplied to [[TextBlockComponent.applyStyle]] to control how the style is applied to the component and its child components.\n * @beta\n */\nexport interface ApplyTextStyleOptions {\n /** Controls whether any deviations from the style's settings stored in [[TextBlockComponent.styleOverrides]] are retained.\n * By default, all overrides are cleared.\n */\n preserveOverrides?: boolean;\n /** Controls whether the style should be recursively applied to the [[Paragraph]]s belonging to a [[TextBlock]] and the [[Run]]s belonging to a [[Paragraph]].\n * By default, the style change propagates to child components.\n */\n preventPropagation?: boolean;\n}\n\n/** The JSON representation of a [[TextBlockComponent]].\n * @beta\n */\nexport interface TextBlockComponentProps {\n /** The name of a [[TextStyle]] stored in a [Workspace]($backend) from which the base [[TextStyleSettings]] applied to the component originates. */\n styleName: string;\n /** Deviations from the base [[TextStyleSettings]] defined by the [[TextStyle]] applied to this component.\n * This permits you to, e.g., create a [[TextRun]] using \"Arial\" font and override it to use \"Comic Sans\" instead.\n */\n styleOverrides?: TextStyleSettingsProps;\n}\n\n/** Options supplied to [[TextBlockComponent.stringify]] to control how the content is formatted.\n * @beta\n */\nexport interface TextBlockStringifyOptions {\n /** A string to insert in between each [[Paragraph]].\n * Default: \" \" - a single space.\n */\n paragraphBreak?: string;\n /** A string to insert for each [[LineBreakRun]].\n * Default: \" \" - a single space.\n */\n lineBreak?: string;\n /** A string to insert between the numerator and denominator of each [[FractionRun]].\n * Default: \"/\"\n */\n fractionSeparator?: string;\n}\n\n/** Abstract representation of any of the building blocks that make up a [[TextBlock]] document - namely [[Run]]s, [[Paragraph]]s, and [[TextBlock]] itself.\n * Each component can specify a [[TextStyle]] that formats its contents and optional [[styleOverrides]] to customize that formatting.\n * @beta\n */\nexport abstract class TextBlockComponent {\n private _styleName: string;\n private _styleOverrides: TextStyleSettingsProps;\n\n /** @internal */\n protected constructor(props: TextBlockComponentProps) {\n this._styleName = props.styleName;\n this._styleOverrides = { ...props.styleOverrides };\n }\n\n /** The name of the [[TextStyle]] that provides the base formatting for the contents of this component.\n * @note Assigning to this property is equivalent to calling [[applyStyle]] with default [[ApplyTextStyleOptions]], which propagates the style change to all of\n * the components sub-components and clears any [[styleOverrides]].\n */\n public get styleName(): string {\n return this._styleName;\n }\n\n public set styleName(styleName: string) {\n this.applyStyle(styleName);\n }\n\n /** Deviations in individual properties of the [[TextStyle]] specified by [[styleName]].\n * For example, if the style uses the \"Arial\" font, you can override that by settings `styleOverrides.fontName` to \"Comic Sans\".\n * @see [[clearStyleOverrides]] to reset this to an empty object.\n */\n public get styleOverrides(): TextStyleSettingsProps {\n return this._styleOverrides;\n }\n\n public set styleOverrides(overrides: TextStyleSettingsProps) {\n this._styleOverrides = { ...overrides };\n }\n\n /** Reset any [[styleOverrides]] applied to this component's [[TextStyle]]. */\n public clearStyleOverrides(): void {\n this.styleOverrides = { };\n }\n\n /** Apply the [[TextStyle]] specified by `styleName` to this component, optionally preserving [[styleOverrides]] and/or preventing propagation to sub-components. */\n public applyStyle(styleName: string, options?: ApplyTextStyleOptions): void {\n this._styleName = styleName;\n\n if (!(options?.preserveOverrides)) {\n this.clearStyleOverrides();\n }\n }\n\n /** Returns true if [[styleOverrides]] specifies any deviations from this component's base [[TextStyle]]. */\n public get overridesStyle(): boolean {\n return Object.keys(this.styleOverrides).length > 0;\n }\n\n /** Create a deep copy of this component. */\n public abstract clone(): TextBlockComponent;\n\n /** Compute a string representation of the contents of this component and all of its sub-components. */\n public abstract stringify(options?: TextBlockStringifyOptions): string;\n\n /** Convert this component to its JSON representation. */\n public toJSON(): TextBlockComponentProps {\n return {\n styleName: this.styleName,\n styleOverrides: { ...this.styleOverrides },\n };\n }\n\n /** Returns true if `this` is equivalent to `other`. */\n public equals(other: TextBlockComponent): boolean {\n const myKeys = Object.keys(this.styleOverrides);\n const yrKeys = Object.keys(other._styleOverrides);\n if (this.styleName !== other.styleName || myKeys.length !== yrKeys.length) {\n return false;\n }\n\n for (const name of myKeys) {\n const key = name as keyof TextStyleSettingsProps;\n if (this.styleOverrides[key] !== other.styleOverrides[key]) {\n return false;\n }\n }\n\n return true;\n }\n}\n\n/**\n * @beta\n */\nexport type Run = TextRun | FractionRun | LineBreakRun;\n\n/** The JSON representation of a [[Run]].\n * Use the `type` field to discriminate between the different kinds of runs.\n * @beta\n */\nexport type RunProps = TextRunProps | FractionRunProps | LineBreakRunProps;\n\n/** A sequence of characters within a [[Paragraph]] that share a single style. Runs are the leaf nodes of a [[TextBlock]] document. When laid out for display, a single run may span\n * multiple lines, but it will never contain different styling.\n * Use the `type` field to discriminate between the different kinds of runs.\n * @beta\n */\nexport namespace Run { // eslint-disable-line @typescript-eslint/no-redeclare\n /** Create a run from its JSON representation.\n * @see [[TextRun.create]], [[FractionRun.create]], and [[LineBreakRun.create]] to create a run directly.\n */\n export function fromJSON(props: RunProps): Run {\n switch (props.type) {\n case \"text\": return TextRun.create(props);\n case \"fraction\": return FractionRun.create(props);\n case \"linebreak\": return LineBreakRun.create(props);\n }\n }\n}\n\n/** Describes whether the characters of a [[TextRun]] should be displayed normally, in subscript, or in superscript.\n * [[TextStyleSettings.superScriptScale]], [[TextStyleSettings.subScriptScale]], [[TextStyleSettings.superScriptOffsetFactor]], and [[TextStyleSettings.subScriptOffsetFactor]]\n * affect how the content is rendered.\n * @beta\n */\nexport type BaselineShift = \"subscript\" | \"superscript\" | \"none\";\n\n/** JSON representation of a [[TextRun]].\n * @beta\n */\nexport interface TextRunProps extends TextBlockComponentProps {\n /** Discriminator field for the [[RunProps]] union. */\n readonly type: \"text\";\n /** The characters displayed by the run.\n * Default: an empty string.\n */\n content?: string;\n /** Whether to display [[content]] as a subscript, superscript, or normally.\n * Default: \"none\"\n */\n baselineShift?: BaselineShift;\n}\n\n/** The most common type of [[Run]], containing a sequence of characters to be displayed using a single style.\n * @beta\n */\nexport class TextRun extends TextBlockComponent {\n /** Discriminator field for the [[Run]] union. */\n public readonly type = \"text\";\n /** The sequence of characters to be displayed by the run. */\n public content: string;\n /** Whether to display [[content]] as a subscript, superscript, or normally. */\n public baselineShift: BaselineShift;\n\n private constructor(props: Omit<TextRunProps, \"type\">) {\n super(props);\n this.content = props.content ?? \"\";\n this.baselineShift = props.baselineShift ?? \"none\";\n }\n\n public override clone(): TextRun {\n return new TextRun(this.toJSON());\n }\n\n public override toJSON(): TextRunProps {\n return {\n ...super.toJSON(),\n type: \"text\",\n content: this.content,\n baselineShift: this.baselineShift,\n };\n }\n\n public static create(props: Omit<TextRunProps, \"type\">): TextRun {\n return new TextRun(props);\n }\n\n /** Simply returns [[content]]. */\n public override stringify(): string {\n return this.content;\n }\n\n public override equals(other: TextBlockComponent): boolean {\n return other instanceof TextRun && this.content === other.content && this.baselineShift === other.baselineShift && super.equals(other);\n }\n}\n\n/** JSON representation of a [[FractionRun]].\n * @beta\n */\nexport interface FractionRunProps extends TextBlockComponentProps {\n /** Discriminator field for the [[RunProps]] union. */\n readonly type: \"fraction\";\n /** The text displayed before or above the fraction separator, depending on [[TextStyle.stackedFractionType]]. Default: an empty string. */\n numerator?: string;\n /** The text displayed after or below the fraction separator, depending on [[TextStyle.stackedFractionType]]. Default: an empty string. */\n denominator?: string;\n}\n\n/** A [[Run]] containing a numeric ratio to be displayed as a numerator and denominator separated by a horizontal or diagonal bar.\n * @note The [[numerator]] and [[denominator]] are stored as strings. They are not technically required to contain a numeric representation.\n * @beta\n */\nexport class FractionRun extends TextBlockComponent {\n /** Discriminator field for the [[Run]] union. */\n public readonly type = \"fraction\";\n /** The fraction's numerator. */\n public numerator: string;\n /** The fraction's denominator. */\n public denominator: string;\n\n private constructor(props: Omit<FractionRunProps, \"type\">) {\n super(props);\n this.numerator = props.numerator ?? \"\";\n this.denominator = props.denominator ?? \"\";\n }\n\n public override toJSON(): FractionRunProps {\n return {\n ...super.toJSON(),\n type: \"fraction\",\n numerator: this.numerator,\n denominator: this.denominator,\n };\n }\n\n public override clone(): FractionRun {\n return new FractionRun(this.toJSON());\n }\n\n public static create(props: Omit<FractionRunProps, \"type\">): FractionRun {\n return new FractionRun(props);\n }\n\n /** Formats the fraction as a string with the [[numerator]] and [[denominator]] separated by [[TextBlockStringifyOptions.fractionSeparator]]. */\n public override stringify(options?: TextBlockStringifyOptions): string {\n const sep = options?.fractionSeparator ?? \"/\";\n return `${this.numerator}${sep}${this.denominator}`;\n }\n\n public override equals(other: TextBlockComponent): boolean {\n return other instanceof FractionRun && this.numerator === other.numerator && this.denominator === other.denominator && super.equals(other);\n }\n}\n\n/** JSON representation of a [[LineBreakRun]].\n * @beta\n */\nexport interface LineBreakRunProps extends TextBlockComponentProps {\n /** Discriminator field for the [[RunProps]] union. */\n readonly type: \"linebreak\";\n}\n\n/** A [[Run]] that represents the end of a line of text within a [[Paragraph]]. It contains no content of its own - it simply causes subsequent content to display on a new line.\n * @beta\n */\nexport class LineBreakRun extends TextBlockComponent {\n /** Discriminator field for the [[Run]] union. */\n public readonly type = \"linebreak\";\n\n private constructor(props: TextBlockComponentProps) {\n super(props);\n }\n\n public override toJSON(): LineBreakRunProps {\n return {\n ...super.toJSON(),\n type: \"linebreak\",\n };\n }\n\n public static create(props: TextBlockComponentProps) {\n return new LineBreakRun(props);\n }\n\n public override clone(): LineBreakRun {\n return new LineBreakRun(this.toJSON());\n }\n\n /** Simply returns [[TextBlockStringifyOptions.lineBreak]]. */\n public override stringify(options?: TextBlockStringifyOptions): string {\n return options?.lineBreak ?? \" \";\n }\n\n public override equals(other: TextBlockComponent): boolean {\n return other instanceof LineBreakRun && super.equals(other);\n }\n}\n\n/** JSON representation of a [[Paragraph]].\n * @beta\n */\nexport interface ParagraphProps extends TextBlockComponentProps {\n /** The collection of [[Run]]s within the paragraph.\n * Default: an empty array.\n */\n runs?: RunProps[];\n}\n\n/** A collection of [[Run]]s within a [[TextBlock]]. Each paragraph within a text block is laid out on a separate line.\n * @beta\n */\nexport class Paragraph extends TextBlockComponent {\n /** The runs within the paragraph. You can modify the contents of this array to change the content of the paragraph. */\n public readonly runs: Run[];\n\n private constructor(props: ParagraphProps) {\n super(props);\n this.runs = props.runs?.map((run) => Run.fromJSON(run)) ?? [];\n }\n\n public override toJSON(): ParagraphProps {\n return {\n ...super.toJSON(),\n runs: this.runs.map((run) => run.toJSON()),\n };\n }\n\n /** Create a paragraph from its JSON representation. */\n public static create(props: ParagraphProps): Paragraph {\n return new Paragraph(props);\n }\n\n public override clone(): Paragraph {\n return new Paragraph(this.toJSON());\n }\n\n /** Apply the specified style to this [[Paragraph]], and - unless [[ApplyTextStyleOptions.preventPropagation]] is `true` - to all of its [[runs]]. */\n public override applyStyle(styleName: string, options?: ApplyTextStyleOptions): void {\n super.applyStyle(styleName, options);\n if (!(options?.preventPropagation)) {\n for (const run of this.runs) {\n run.applyStyle(styleName, options);\n }\n }\n }\n\n /** Compute a string representation of this paragraph by concatenating the string representations of all of its [[runs]]. */\n public override stringify(options?: TextBlockStringifyOptions): string {\n return this.runs.map((x) => x.stringify(options)).join(\"\");\n }\n\n public override equals(other: TextBlockComponent): boolean {\n if (!(other instanceof Paragraph)) {\n return false;\n }\n\n if (this.runs.length !== other.runs.length || !super.equals(other)) {\n return false;\n }\n\n return this.runs.every((run, index) => run.equals(other.runs[index]));\n }\n}\n\n/** Describes the relative alignment of the content of a [[TextBlock]].\n * @beta\n */\nexport type TextBlockJustification = \"left\" | \"center\" | \"right\";\n\n/** Describes the margins around the content inside a [[TextBlock]]. It's measured in meters.\n * @beta\n */\nexport interface TextBlockMargins {\n /** The left margin measured in meters. Must be a positive number >= 0. Negative values are disregarded */\n left: number;\n /** The right margin measured in meters. Must be a positive number >= 0. Negative values are disregarded */\n right: number;\n /** The top margin measured in meters. Must be a positive number >= 0. Negative values are disregarded */\n top: number;\n /** The bottom margin measured in meters. Must be a positive number >= 0. Negative values are disregarded */\n bottom: number;\n};\n\n/** JSON representation of a [[TextBlock]].\n * @beta\n */\nexport interface TextBlockProps extends TextBlockComponentProps {\n /** The width of the document in meters. Lines that would exceed this width are instead wrapped around to the next line if possible.\n * A value less than or equal to zero indicates no wrapping is to be applied.\n * Default: 0\n */\n width?: number;\n /** The alignment of the document content. Default: \"left\". */\n justification?: TextBlockJustification;\n /** The margins to surround the document content. Default: 0 margins on all sides */\n margins?: Partial<TextBlockMargins>;\n /** The paragraphs within the text block. Default: an empty array. */\n paragraphs?: ParagraphProps[];\n}\n\n/** Represents a formatted text document consisting of a series of [[Paragraph]]s, each laid out on a separate line and containing their own content in the form of [[Run]]s.\n * You can change the content of the document by directly modifying the contents of its [[paragraphs]], or via [[appendParagraph]] and [[appendRun]].\n * No word-wrapping is applied to the document unless a [[width]] greater than zero is specified.\n * @see [[TextAnnotation]] to position a text block as an annotation in 2d or 3d space.\n * @beta\n */\nexport class TextBlock extends TextBlockComponent {\n /** The width of the document in meters. Lines that would exceed this width are instead wrapped around to the next line if possible.\n * A value less than or equal to zero indicates no wrapping is to be applied.\n * Default: 0\n */\n public width: number;\n /** The alignment of the document's content. */\n public justification: TextBlockJustification;\n /** The margins of the document. */\n public margins: TextBlockMargins;\n /** The ordered list of paragraphs within the document. */\n public readonly paragraphs: Paragraph[];\n\n private constructor(props: TextBlockProps) {\n super(props);\n this.width = props.width ?? 0;\n this.justification = props.justification ?? \"left\";\n\n // Assign default margins if not provided\n this.margins = {\n left: props.margins?.left ?? 0,\n right: props.margins?.right ?? 0,\n top: props.margins?.top ?? 0,\n bottom: props.margins?.bottom ?? 0,\n };\n\n this.paragraphs = props.paragraphs?.map((x) => Paragraph.create(x)) ?? [];\n }\n\n public override toJSON(): TextBlockProps {\n return {\n ...super.toJSON(),\n width: this.width,\n justification: this.justification,\n margins: this.margins,\n paragraphs: this.paragraphs.map((x) => x.toJSON()),\n };\n }\n\n /** Create a text block from its JSON representation. */\n public static create(props: TextBlockProps): TextBlock {\n return new TextBlock(props);\n }\n\n /** Create an empty text block containing no [[paragraphs]] and an empty [[styleName]]. */\n public static createEmpty(): TextBlock {\n return TextBlock.create({ styleName: \"\" });\n }\n\n /** Returns true if every paragraph in this text block is empty. */\n public get isEmpty(): boolean {\n return this.paragraphs.every((p) => p.runs.length === 0);\n }\n\n public override clone(): TextBlock {\n return new TextBlock(this.toJSON());\n }\n\n /** Apply the specified style to this block and - unless [[ApplyTextStyleOptions.preventPropagation]] is `true` - to all of its [[paragraphs]]. */\n public override applyStyle(styleName: string, options?: ApplyTextStyleOptions): void {\n super.applyStyle(styleName, options);\n if (!(options?.preventPropagation)) {\n for (const paragraph of this.paragraphs) {\n paragraph.applyStyle(styleName, options);\n }\n }\n }\n\n /** Compute a string representation of the document's contents by concatenating the string representations of each of its [[paragraphs]], separated by [[TextBlockStringifyOptions.paragraphBreak]]. */\n public stringify(options?: TextBlockStringifyOptions): string {\n return this.paragraphs.map((x) => x.stringify(options)).join(options?.paragraphBreak ?? \" \");\n }\n\n /** Add and return a new paragraph.\n * If [[paragraphs]] is not empty, the style and overrides of the last [[Paragraph]] in the block will be applied to the new paragraph; otherwise,\n * the paragraph will inherit this block's style with no overrides.\n */\n public appendParagraph(): Paragraph {\n const seed = this.paragraphs[0];\n const paragraph = Paragraph.create({\n styleName: seed?.styleName ?? this.styleName,\n styleOverrides: seed?.styleOverrides ?? undefined,\n });\n\n this.paragraphs.push(paragraph);\n return paragraph;\n }\n\n /** Append a run to the last [[Paragraph]] in this block.\n * If the block contains no [[paragraphs]], a new one will first be created using [[appendParagraph]].\n */\n public appendRun(run: Run): void {\n const paragraph = this.paragraphs[this.paragraphs.length - 1] ?? this.appendParagraph();\n paragraph.runs.push(run);\n }\n\n public override equals(other: TextBlockComponent): boolean {\n if (!(other instanceof TextBlock)) {\n return false;\n }\n\n if (this.width !== other.width || this.justification !== other.justification || this.paragraphs.length !== other.paragraphs.length) {\n return false;\n }\n\n const marginsAreEqual = Object.entries(this.margins).every(([key, value]) =>\n value === (other.margins as any)[key]\n );\n\n if (!marginsAreEqual) return false;\n\n return this.paragraphs.every((paragraph, index) => paragraph.equals(other.paragraphs[index]));\n }\n}\n"]}
1
+ {"version":3,"file":"TextBlock.js","sourceRoot":"","sources":["../../../src/annotation/TextBlock.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAoDH;;;GAGG;AACH,MAAsB,kBAAkB;IAC9B,UAAU,CAAS;IACnB,eAAe,CAAyB;IAEhD,gBAAgB;IAChB,YAAsB,KAA8B;QAClD,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC,SAAS,CAAC;QAClC,IAAI,CAAC,eAAe,GAAG,EAAE,GAAG,KAAK,CAAC,cAAc,EAAE,CAAC;IACrD,CAAC;IAED;;;OAGG;IACH,IAAW,SAAS;QAClB,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IAED,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AC,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAChG,CAAC;CACF;AAjHD,8BAiHC","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 Annotation\n */\n\nimport { TextStyleSettingsProps } from \"./TextStyle\";\n\n/** Options supplied to [[TextBlockComponent.applyStyle]] to control how the style is applied to the component and its child components.\n * @beta\n */\nexport interface ApplyTextStyleOptions {\n /** Controls whether any deviations from the style's settings stored in [[TextBlockComponent.styleOverrides]] are retained.\n * By default, all overrides are cleared.\n */\n preserveOverrides?: boolean;\n /** Controls whether the style should be recursively applied to the [[Paragraph]]s belonging to a [[TextBlock]] and the [[Run]]s belonging to a [[Paragraph]].\n * By default, the style change propagates to child components.\n */\n preventPropagation?: boolean;\n}\n\n/** The JSON representation of a [[TextBlockComponent]].\n * @beta\n */\nexport interface TextBlockComponentProps {\n /** The name of a [[TextStyle]] stored in a [Workspace]($backend) from which the base [[TextStyleSettings]] applied to the component originates. */\n styleName: string;\n /** Deviations from the base [[TextStyleSettings]] defined by the [[TextStyle]] applied to this component.\n * This permits you to, e.g., create a [[TextRun]] using \"Arial\" font and override it to use \"Comic Sans\" instead.\n */\n styleOverrides?: TextStyleSettingsProps;\n}\n\n/** Options supplied to [[TextBlockComponent.stringify]] to control how the content is formatted.\n * @beta\n */\nexport interface TextBlockStringifyOptions {\n /** A string to insert in between each [[Paragraph]].\n * Default: \" \" - a single space.\n */\n paragraphBreak?: string;\n /** A string to insert for each [[LineBreakRun]].\n * Default: \" \" - a single space.\n */\n lineBreak?: string;\n /** A string to insert between the numerator and denominator of each [[FractionRun]].\n * Default: \"/\"\n */\n fractionSeparator?: string;\n /** The number of spaces to use for tabs. If not provided, tabs will be represented by a tab character: \"\\t\".\n * Default: \"undefined\" - use \"\\t\".\n */\n tabsAsSpaces?: number;\n}\n\n/** Abstract representation of any of the building blocks that make up a [[TextBlock]] document - namely [[Run]]s, [[Paragraph]]s, and [[TextBlock]] itself.\n * Each component can specify a [[TextStyle]] that formats its contents and optional [[styleOverrides]] to customize that formatting.\n * @beta\n */\nexport abstract class TextBlockComponent {\n private _styleName: string;\n private _styleOverrides: TextStyleSettingsProps;\n\n /** @internal */\n protected constructor(props: TextBlockComponentProps) {\n this._styleName = props.styleName;\n this._styleOverrides = { ...props.styleOverrides };\n }\n\n /** The name of the [[TextStyle]] that provides the base formatting for the contents of this component.\n * @note Assigning to this property is equivalent to calling [[applyStyle]] with default [[ApplyTextStyleOptions]], which propagates the style change to all of\n * the components sub-components and clears any [[styleOverrides]].\n */\n public get styleName(): string {\n return this._styleName;\n }\n\n public set styleName(styleName: string) {\n this.applyStyle(styleName);\n }\n\n /** Deviations in individual properties of the [[TextStyle]] specified by [[styleName]].\n * For example, if the style uses the \"Arial\" font, you can override that by settings `styleOverrides.fontName` to \"Comic Sans\".\n * @see [[clearStyleOverrides]] to reset this to an empty object.\n */\n public get styleOverrides(): TextStyleSettingsProps {\n return this._styleOverrides;\n }\n\n public set styleOverrides(overrides: TextStyleSettingsProps) {\n this._styleOverrides = { ...overrides };\n }\n\n /** Reset any [[styleOverrides]] applied to this component's [[TextStyle]]. */\n public clearStyleOverrides(): void {\n this.styleOverrides = { };\n }\n\n /** Apply the [[TextStyle]] specified by `styleName` to this component, optionally preserving [[styleOverrides]] and/or preventing propagation to sub-components. */\n public applyStyle(styleName: string, options?: ApplyTextStyleOptions): void {\n this._styleName = styleName;\n\n if (!(options?.preserveOverrides)) {\n this.clearStyleOverrides();\n }\n }\n\n /** Returns true if [[styleOverrides]] specifies any deviations from this component's base [[TextStyle]]. */\n public get overridesStyle(): boolean {\n return Object.keys(this.styleOverrides).length > 0;\n }\n\n /** Create a deep copy of this component. */\n public abstract clone(): TextBlockComponent;\n\n /** Compute a string representation of the contents of this component and all of its sub-components. */\n public abstract stringify(options?: TextBlockStringifyOptions): string;\n\n /**\n * Returns true if the string representation of this component consists only of whitespace characters.\n * Useful for checking if the component is visually empty (producing no graphics) or contains only spaces, tabs, or line breaks.\n */\n public get isWhitespace(): boolean {\n return /^\\s*$/g.test(this.stringify());\n };\n\n /** Convert this component to its JSON representation. */\n public toJSON(): TextBlockComponentProps {\n return {\n styleName: this.styleName,\n styleOverrides: { ...this.styleOverrides },\n };\n }\n\n /** Returns true if `this` is equivalent to `other`. */\n public equals(other: TextBlockComponent): boolean {\n const myKeys = Object.keys(this.styleOverrides);\n const yrKeys = Object.keys(other._styleOverrides);\n if (this.styleName !== other.styleName || myKeys.length !== yrKeys.length) {\n return false;\n }\n\n for (const name of myKeys) {\n const key = name as keyof TextStyleSettingsProps;\n if (this.styleOverrides[key] !== other.styleOverrides[key]) {\n return false;\n }\n }\n\n return true;\n }\n}\n\n/**\n * @beta\n */\nexport type Run = TextRun | FractionRun | TabRun | LineBreakRun;\n\n/** The JSON representation of a [[Run]].\n * Use the `type` field to discriminate between the different kinds of runs.\n * @beta\n */\nexport type RunProps = TextRunProps | FractionRunProps | TabRunProps | LineBreakRunProps;\n\n/** A sequence of characters within a [[Paragraph]] that share a single style. Runs are the leaf nodes of a [[TextBlock]] document. When laid out for display, a single run may span\n * multiple lines, but it will never contain different styling.\n * Use the `type` field to discriminate between the different kinds of runs.\n * @beta\n */\nexport namespace Run { // eslint-disable-line @typescript-eslint/no-redeclare\n /** Create a run from its JSON representation.\n * @see [[TextRun.create]], [[FractionRun.create]], and [[LineBreakRun.create]] to create a run directly.\n */\n export function fromJSON(props: RunProps): Run {\n switch (props.type) {\n case \"text\": return TextRun.create(props);\n case \"fraction\": return FractionRun.create(props);\n case \"tab\": return TabRun.create(props);\n case \"linebreak\": return LineBreakRun.create(props);\n }\n }\n}\n\n/** Describes whether the characters of a [[TextRun]] should be displayed normally, in subscript, or in superscript.\n * [[TextStyleSettings.superScriptScale]], [[TextStyleSettings.subScriptScale]], [[TextStyleSettings.superScriptOffsetFactor]], and [[TextStyleSettings.subScriptOffsetFactor]]\n * affect how the content is rendered.\n * @beta\n */\nexport type BaselineShift = \"subscript\" | \"superscript\" | \"none\";\n\n/** JSON representation of a [[TextRun]].\n * @beta\n */\nexport interface TextRunProps extends TextBlockComponentProps {\n /** Discriminator field for the [[RunProps]] union. */\n readonly type: \"text\";\n /** The characters displayed by the run.\n * Default: an empty string.\n */\n content?: string;\n /** Whether to display [[content]] as a subscript, superscript, or normally.\n * Default: \"none\"\n */\n baselineShift?: BaselineShift;\n}\n\n/** The most common type of [[Run]], containing a sequence of characters to be displayed using a single style.\n * @beta\n */\nexport class TextRun extends TextBlockComponent {\n /** Discriminator field for the [[Run]] union. */\n public readonly type = \"text\";\n /** The sequence of characters to be displayed by the run. */\n public content: string;\n /** Whether to display [[content]] as a subscript, superscript, or normally. */\n public baselineShift: BaselineShift;\n\n private constructor(props: Omit<TextRunProps, \"type\">) {\n super(props);\n this.content = props.content ?? \"\";\n this.baselineShift = props.baselineShift ?? \"none\";\n }\n\n public override clone(): TextRun {\n return new TextRun(this.toJSON());\n }\n\n public override toJSON(): TextRunProps {\n return {\n ...super.toJSON(),\n type: \"text\",\n content: this.content,\n baselineShift: this.baselineShift,\n };\n }\n\n public static create(props: Omit<TextRunProps, \"type\">): TextRun {\n return new TextRun(props);\n }\n\n /** Simply returns [[content]]. */\n public override stringify(): string {\n return this.content;\n }\n\n public override equals(other: TextBlockComponent): boolean {\n return other instanceof TextRun && this.content === other.content && this.baselineShift === other.baselineShift && super.equals(other);\n }\n}\n\n/** JSON representation of a [[FractionRun]].\n * @beta\n */\nexport interface FractionRunProps extends TextBlockComponentProps {\n /** Discriminator field for the [[RunProps]] union. */\n readonly type: \"fraction\";\n /** The text displayed before or above the fraction separator, depending on [[TextStyle.stackedFractionType]]. Default: an empty string. */\n numerator?: string;\n /** The text displayed after or below the fraction separator, depending on [[TextStyle.stackedFractionType]]. Default: an empty string. */\n denominator?: string;\n}\n\n/** A [[Run]] containing a numeric ratio to be displayed as a numerator and denominator separated by a horizontal or diagonal bar.\n * @note The [[numerator]] and [[denominator]] are stored as strings. They are not technically required to contain a numeric representation.\n * @beta\n */\nexport class FractionRun extends TextBlockComponent {\n /** Discriminator field for the [[Run]] union. */\n public readonly type = \"fraction\";\n /** The fraction's numerator. */\n public numerator: string;\n /** The fraction's denominator. */\n public denominator: string;\n\n private constructor(props: Omit<FractionRunProps, \"type\">) {\n super(props);\n this.numerator = props.numerator ?? \"\";\n this.denominator = props.denominator ?? \"\";\n }\n\n public override toJSON(): FractionRunProps {\n return {\n ...super.toJSON(),\n type: \"fraction\",\n numerator: this.numerator,\n denominator: this.denominator,\n };\n }\n\n public override clone(): FractionRun {\n return new FractionRun(this.toJSON());\n }\n\n public static create(props: Omit<FractionRunProps, \"type\">): FractionRun {\n return new FractionRun(props);\n }\n\n /** Formats the fraction as a string with the [[numerator]] and [[denominator]] separated by [[TextBlockStringifyOptions.fractionSeparator]]. */\n public override stringify(options?: TextBlockStringifyOptions): string {\n const sep = options?.fractionSeparator ?? \"/\";\n return `${this.numerator}${sep}${this.denominator}`;\n }\n\n public override equals(other: TextBlockComponent): boolean {\n return other instanceof FractionRun && this.numerator === other.numerator && this.denominator === other.denominator && super.equals(other);\n }\n}\n\n/** JSON representation of a [[LineBreakRun]].\n * @beta\n */\nexport interface LineBreakRunProps extends TextBlockComponentProps {\n /** Discriminator field for the [[RunProps]] union. */\n readonly type: \"linebreak\";\n}\n\n/** A [[Run]] that represents the end of a line of text within a [[Paragraph]]. It contains no content of its own - it simply causes subsequent content to display on a new line.\n * @beta\n */\nexport class LineBreakRun extends TextBlockComponent {\n /** Discriminator field for the [[Run]] union. */\n public readonly type = \"linebreak\";\n\n private constructor(props: TextBlockComponentProps) {\n super(props);\n }\n\n public override toJSON(): LineBreakRunProps {\n return {\n ...super.toJSON(),\n type: \"linebreak\",\n };\n }\n\n public static create(props: TextBlockComponentProps) {\n return new LineBreakRun(props);\n }\n\n public override clone(): LineBreakRun {\n return new LineBreakRun(this.toJSON());\n }\n\n /** Simply returns [[TextBlockStringifyOptions.lineBreak]]. */\n public override stringify(options?: TextBlockStringifyOptions): string {\n return options?.lineBreak ?? \" \";\n }\n\n public override equals(other: TextBlockComponent): boolean {\n return other instanceof LineBreakRun && super.equals(other);\n }\n}\n\n/** JSON representation of a [[TabRun]].\n * @beta\n */\nexport interface TabRunProps extends TextBlockComponentProps {\n /** Discriminator field for the [[RunProps]] union. */\n readonly type: \"tab\";\n}\n\n/** A [[TabRun]] is used to shift the next tab stop.\n * @note Only left-justified tabs are supported at this tab.\n * @beta\n */\nexport class TabRun extends TextBlockComponent {\n /** Discriminator field for the [[Run]] union. */\n public readonly type = \"tab\";\n\n public override toJSON(): TabRunProps {\n return {\n ...super.toJSON(),\n type: \"tab\",\n };\n }\n\n public override clone(): TabRun {\n return new TabRun(this.toJSON());\n }\n\n public static create(props: Omit<TabRunProps, \"type\">): TabRun {\n return new TabRun(props);\n }\n\n /**\n * Converts a [[TabRun]] to its string representation.\n * If the `tabsAsSpaces` option is provided, returns a string of spaces of the specified length.\n * Otherwise, returns a tab character (\"\\t\").\n */\n public override stringify(options?: TextBlockStringifyOptions): string {\n if (options?.tabsAsSpaces) {\n return \" \".repeat(options.tabsAsSpaces);\n }\n\n return \"\\t\";\n }\n\n public override equals(other: TextBlockComponent): boolean {\n return other instanceof TabRun && super.equals(other);\n }\n}\n\n/** JSON representation of a [[Paragraph]].\n * @beta\n */\nexport interface ParagraphProps extends TextBlockComponentProps {\n /** The collection of [[Run]]s within the paragraph.\n * Default: an empty array.\n */\n runs?: RunProps[];\n}\n\n/** A collection of [[Run]]s within a [[TextBlock]]. Each paragraph within a text block is laid out on a separate line.\n * @beta\n */\nexport class Paragraph extends TextBlockComponent {\n /** The runs within the paragraph. You can modify the contents of this array to change the content of the paragraph. */\n public readonly runs: Run[];\n\n private constructor(props: ParagraphProps) {\n super(props);\n this.runs = props.runs?.map((run) => Run.fromJSON(run)) ?? [];\n }\n\n public override toJSON(): ParagraphProps {\n return {\n ...super.toJSON(),\n runs: this.runs.map((run) => run.toJSON()),\n };\n }\n\n /** Create a paragraph from its JSON representation. */\n public static create(props: ParagraphProps): Paragraph {\n return new Paragraph(props);\n }\n\n public override clone(): Paragraph {\n return new Paragraph(this.toJSON());\n }\n\n /** Apply the specified style to this [[Paragraph]], and - unless [[ApplyTextStyleOptions.preventPropagation]] is `true` - to all of its [[runs]]. */\n public override applyStyle(styleName: string, options?: ApplyTextStyleOptions): void {\n super.applyStyle(styleName, options);\n if (!(options?.preventPropagation)) {\n for (const run of this.runs) {\n run.applyStyle(styleName, options);\n }\n }\n }\n\n /** Compute a string representation of this paragraph by concatenating the string representations of all of its [[runs]]. */\n public override stringify(options?: TextBlockStringifyOptions): string {\n return this.runs.map((x) => x.stringify(options)).join(\"\");\n }\n\n public override equals(other: TextBlockComponent): boolean {\n if (!(other instanceof Paragraph)) {\n return false;\n }\n\n if (this.runs.length !== other.runs.length || !super.equals(other)) {\n return false;\n }\n\n return this.runs.every((run, index) => run.equals(other.runs[index]));\n }\n}\n\n/** Describes the relative alignment of the content of a [[TextBlock]].\n * @beta\n */\nexport type TextBlockJustification = \"left\" | \"center\" | \"right\";\n\n/** Describes the margins around the content inside a [[TextBlock]]. It's measured in meters.\n * @beta\n */\nexport interface TextBlockMargins {\n /** The left margin measured in meters. Must be a positive number >= 0. Negative values are disregarded */\n left: number;\n /** The right margin measured in meters. Must be a positive number >= 0. Negative values are disregarded */\n right: number;\n /** The top margin measured in meters. Must be a positive number >= 0. Negative values are disregarded */\n top: number;\n /** The bottom margin measured in meters. Must be a positive number >= 0. Negative values are disregarded */\n bottom: number;\n};\n\n/** JSON representation of a [[TextBlock]].\n * @beta\n */\nexport interface TextBlockProps extends TextBlockComponentProps {\n /** The width of the document in meters. Lines that would exceed this width are instead wrapped around to the next line if possible.\n * A value less than or equal to zero indicates no wrapping is to be applied.\n * Default: 0\n */\n width?: number;\n /** The alignment of the document content. Default: \"left\". */\n justification?: TextBlockJustification;\n /** The margins to surround the document content. Default: 0 margins on all sides */\n margins?: Partial<TextBlockMargins>;\n /** The paragraphs within the text block. Default: an empty array. */\n paragraphs?: ParagraphProps[];\n}\n\n/** Represents a formatted text document consisting of a series of [[Paragraph]]s, each laid out on a separate line and containing their own content in the form of [[Run]]s.\n * You can change the content of the document by directly modifying the contents of its [[paragraphs]], or via [[appendParagraph]] and [[appendRun]].\n * No word-wrapping is applied to the document unless a [[width]] greater than zero is specified.\n * @see [[TextAnnotation]] to position a text block as an annotation in 2d or 3d space.\n * @beta\n */\nexport class TextBlock extends TextBlockComponent {\n /** The width of the document in meters. Lines that would exceed this width are instead wrapped around to the next line if possible.\n * A value less than or equal to zero indicates no wrapping is to be applied.\n * Default: 0\n */\n public width: number;\n /** The alignment of the document's content. */\n public justification: TextBlockJustification;\n /** The margins of the document. */\n public margins: TextBlockMargins;\n /** The ordered list of paragraphs within the document. */\n public readonly paragraphs: Paragraph[];\n\n private constructor(props: TextBlockProps) {\n super(props);\n this.width = props.width ?? 0;\n this.justification = props.justification ?? \"left\";\n\n // Assign default margins if not provided\n this.margins = {\n left: props.margins?.left ?? 0,\n right: props.margins?.right ?? 0,\n top: props.margins?.top ?? 0,\n bottom: props.margins?.bottom ?? 0,\n };\n\n this.paragraphs = props.paragraphs?.map((x) => Paragraph.create(x)) ?? [];\n }\n\n public override toJSON(): TextBlockProps {\n return {\n ...super.toJSON(),\n width: this.width,\n justification: this.justification,\n margins: this.margins,\n paragraphs: this.paragraphs.map((x) => x.toJSON()),\n };\n }\n\n /** Create a text block from its JSON representation. */\n public static create(props: TextBlockProps): TextBlock {\n return new TextBlock(props);\n }\n\n /** Create an empty text block containing no [[paragraphs]] and an empty [[styleName]]. */\n public static createEmpty(): TextBlock {\n return TextBlock.create({ styleName: \"\" });\n }\n\n /** Returns true if every paragraph in this text block is empty. */\n public get isEmpty(): boolean {\n return this.paragraphs.every((p) => p.runs.length === 0);\n }\n\n public override clone(): TextBlock {\n return new TextBlock(this.toJSON());\n }\n\n /** Apply the specified style to this block and - unless [[ApplyTextStyleOptions.preventPropagation]] is `true` - to all of its [[paragraphs]]. */\n public override applyStyle(styleName: string, options?: ApplyTextStyleOptions): void {\n super.applyStyle(styleName, options);\n if (!(options?.preventPropagation)) {\n for (const paragraph of this.paragraphs) {\n paragraph.applyStyle(styleName, options);\n }\n }\n }\n\n /** Compute a string representation of the document's contents by concatenating the string representations of each of its [[paragraphs]], separated by [[TextBlockStringifyOptions.paragraphBreak]]. */\n public stringify(options?: TextBlockStringifyOptions): string {\n return this.paragraphs.map((x) => x.stringify(options)).join(options?.paragraphBreak ?? \" \");\n }\n\n /** Add and return a new paragraph.\n * If [[paragraphs]] is not empty, the style and overrides of the last [[Paragraph]] in the block will be applied to the new paragraph; otherwise,\n * the paragraph will inherit this block's style with no overrides.\n */\n public appendParagraph(): Paragraph {\n const seed = this.paragraphs[0];\n const paragraph = Paragraph.create({\n styleName: seed?.styleName ?? this.styleName,\n styleOverrides: seed?.styleOverrides ?? undefined,\n });\n\n this.paragraphs.push(paragraph);\n return paragraph;\n }\n\n /** Append a run to the last [[Paragraph]] in this block.\n * If the block contains no [[paragraphs]], a new one will first be created using [[appendParagraph]].\n */\n public appendRun(run: Run): void {\n const paragraph = this.paragraphs[this.paragraphs.length - 1] ?? this.appendParagraph();\n paragraph.runs.push(run);\n }\n\n public override equals(other: TextBlockComponent): boolean {\n if (!(other instanceof TextBlock)) {\n return false;\n }\n\n if (this.width !== other.width || this.justification !== other.justification || this.paragraphs.length !== other.paragraphs.length) {\n return false;\n }\n\n const marginsAreEqual = Object.entries(this.margins).every(([key, value]) =>\n value === (other.margins as any)[key]\n );\n\n if (!marginsAreEqual) return false;\n\n return this.paragraphs.every((paragraph, index) => paragraph.equals(other.paragraphs[index]));\n }\n}\n"]}
@@ -26,7 +26,7 @@ export interface TextStyleSettingsProps {
26
26
  */
27
27
  fontName?: string;
28
28
  /** The height each line of text, in meters. Many other settings use the line height as the basis for computing their own values.
29
- * For example, the height and offset from baseline of a subscript [[TextRun]] are compuated as lineHeight * [[subScriptScale]] and
29
+ * For example, the height and offset from baseline of a subscript [[TextRun]] are computed as lineHeight * [[subScriptScale]] and
30
30
  * lineHeight * [[subScriptOffsetFactor]], respectively.
31
31
  * Default: 1.0. */
32
32
  lineHeight?: number;
@@ -80,6 +80,11 @@ export interface TextStyleSettingsProps {
80
80
  * Default: 1.0
81
81
  */
82
82
  widthFactor?: number;
83
+ /** The size (in meters) used to calculate the tab stops in a run.
84
+ * These are equally spaced from the left edge of the TextBlock.
85
+ * Default: 4 meters.
86
+ */
87
+ tabInterval?: number;
83
88
  }
84
89
  /** A description of the formatting to be applied to a [[TextBlockComponent]].
85
90
  * Named instances of these settings can be stored as [[TextStyle]]s in a [Workspace]($backend).
@@ -94,7 +99,7 @@ export declare class TextStyleSettings {
94
99
  */
95
100
  readonly fontName: string;
96
101
  /** The height each line of text, in meters. Many other settings use the line height as the basis for computing their own values.
97
- * For example, the height and offset from baseline of a subscript [[TextRun]] are compuated as lineHeight * [[subScriptScale]] and
102
+ * For example, the height and offset from baseline of a subscript [[TextRun]] are computed as lineHeight * [[subScriptScale]] and
98
103
  * lineHeight * [[subScriptOffsetFactor]], respectively.
99
104
  */
100
105
  readonly lineHeight: number;
@@ -132,6 +137,10 @@ export declare class TextStyleSettings {
132
137
  readonly superScriptScale: number;
133
138
  /** Multiplier used to compute the width of each glyph, relative to [[lineHeight]]. */
134
139
  readonly widthFactor: number;
140
+ /** The size (in meters) used to calculate the tab stops in a run.
141
+ * These are equally spaced from the left edge of the TextBlock. Default is 4 meters.
142
+ */
143
+ readonly tabInterval: number;
135
144
  /** A fully-populated JSON representation of the default settings. */
136
145
  static defaultProps: Readonly<Required<TextStyleSettingsProps>>;
137
146
  /** Settings initialized to all default values. */