@itwin/core-backend 5.2.0-dev.8 → 5.3.0-dev.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +36 -1
- package/lib/cjs/BackendHubAccess.d.ts +2 -0
- package/lib/cjs/BackendHubAccess.d.ts.map +1 -1
- package/lib/cjs/BackendHubAccess.js.map +1 -1
- package/lib/cjs/BackendLoggerCategory.d.ts +6 -0
- package/lib/cjs/BackendLoggerCategory.d.ts.map +1 -1
- package/lib/cjs/BackendLoggerCategory.js +6 -0
- package/lib/cjs/BackendLoggerCategory.js.map +1 -1
- package/lib/cjs/BriefcaseManager.d.ts +57 -3
- package/lib/cjs/BriefcaseManager.d.ts.map +1 -1
- package/lib/cjs/BriefcaseManager.js +151 -42
- package/lib/cjs/BriefcaseManager.js.map +1 -1
- package/lib/cjs/CloudSqlite.d.ts +4 -0
- package/lib/cjs/CloudSqlite.d.ts.map +1 -1
- package/lib/cjs/CloudSqlite.js.map +1 -1
- package/lib/cjs/ECDb.d.ts +8 -0
- package/lib/cjs/ECDb.d.ts.map +1 -1
- package/lib/cjs/ECDb.js +22 -0
- package/lib/cjs/ECDb.js.map +1 -1
- package/lib/cjs/GeographicCRSServices.d.ts.map +1 -1
- package/lib/cjs/GeographicCRSServices.js +2 -0
- package/lib/cjs/GeographicCRSServices.js.map +1 -1
- package/lib/cjs/IModelDb.d.ts +54 -3
- package/lib/cjs/IModelDb.d.ts.map +1 -1
- package/lib/cjs/IModelDb.js +87 -9
- package/lib/cjs/IModelDb.js.map +1 -1
- package/lib/cjs/IModelHost.d.ts +11 -1
- package/lib/cjs/IModelHost.d.ts.map +1 -1
- package/lib/cjs/IModelHost.js +5 -0
- package/lib/cjs/IModelHost.js.map +1 -1
- package/lib/cjs/IModelIncrementalSchemaLocater.d.ts +1 -5
- package/lib/cjs/IModelIncrementalSchemaLocater.d.ts.map +1 -1
- package/lib/cjs/IModelIncrementalSchemaLocater.js +0 -6
- package/lib/cjs/IModelIncrementalSchemaLocater.js.map +1 -1
- package/lib/cjs/SqliteChangesetReader.d.ts +8 -0
- package/lib/cjs/SqliteChangesetReader.d.ts.map +1 -1
- package/lib/cjs/SqliteChangesetReader.js +11 -0
- package/lib/cjs/SqliteChangesetReader.js.map +1 -1
- package/lib/cjs/StashManager.d.ts +175 -0
- package/lib/cjs/StashManager.d.ts.map +1 -0
- package/lib/cjs/StashManager.js +306 -0
- package/lib/cjs/StashManager.js.map +1 -0
- package/lib/cjs/TxnManager.d.ts +226 -15
- package/lib/cjs/TxnManager.d.ts.map +1 -1
- package/lib/cjs/TxnManager.js +249 -23
- package/lib/cjs/TxnManager.js.map +1 -1
- package/lib/cjs/annotations/ElementDrivesTextAnnotation.d.ts +10 -1
- package/lib/cjs/annotations/ElementDrivesTextAnnotation.d.ts.map +1 -1
- package/lib/cjs/annotations/ElementDrivesTextAnnotation.js +15 -6
- package/lib/cjs/annotations/ElementDrivesTextAnnotation.js.map +1 -1
- package/lib/cjs/annotations/LeaderGeometry.d.ts +3 -2
- package/lib/cjs/annotations/LeaderGeometry.d.ts.map +1 -1
- package/lib/cjs/annotations/LeaderGeometry.js +5 -4
- package/lib/cjs/annotations/LeaderGeometry.js.map +1 -1
- package/lib/cjs/annotations/TextAnnotationElement.d.ts +52 -24
- package/lib/cjs/annotations/TextAnnotationElement.d.ts.map +1 -1
- package/lib/cjs/annotations/TextAnnotationElement.js +49 -59
- package/lib/cjs/annotations/TextAnnotationElement.js.map +1 -1
- package/lib/cjs/annotations/TextAnnotationGeometry.d.ts +2 -0
- package/lib/cjs/annotations/TextAnnotationGeometry.d.ts.map +1 -1
- package/lib/cjs/annotations/TextAnnotationGeometry.js +26 -19
- package/lib/cjs/annotations/TextAnnotationGeometry.js.map +1 -1
- package/lib/cjs/annotations/TextBlockGeometry.d.ts.map +1 -1
- package/lib/cjs/annotations/TextBlockGeometry.js +8 -0
- package/lib/cjs/annotations/TextBlockGeometry.js.map +1 -1
- package/lib/cjs/annotations/TextBlockLayout.d.ts +49 -36
- package/lib/cjs/annotations/TextBlockLayout.d.ts.map +1 -1
- package/lib/cjs/annotations/TextBlockLayout.js +204 -135
- package/lib/cjs/annotations/TextBlockLayout.js.map +1 -1
- package/lib/cjs/internal/ChannelAdmin.js +1 -1
- package/lib/cjs/internal/ChannelAdmin.js.map +1 -1
- package/lib/cjs/internal/Symbols.d.ts +1 -0
- package/lib/cjs/internal/Symbols.d.ts.map +1 -1
- package/lib/cjs/internal/Symbols.js +2 -1
- package/lib/cjs/internal/Symbols.js.map +1 -1
- package/lib/cjs/internal/annotations/fields.d.ts +2 -12
- package/lib/cjs/internal/annotations/fields.d.ts.map +1 -1
- package/lib/cjs/internal/annotations/fields.js +49 -45
- package/lib/cjs/internal/annotations/fields.js.map +1 -1
- package/lib/cjs/workspace/Workspace.d.ts +1 -1
- package/lib/cjs/workspace/Workspace.js.map +1 -1
- package/lib/esm/BackendHubAccess.d.ts +2 -0
- package/lib/esm/BackendHubAccess.d.ts.map +1 -1
- package/lib/esm/BackendHubAccess.js.map +1 -1
- package/lib/esm/BackendLoggerCategory.d.ts +6 -0
- package/lib/esm/BackendLoggerCategory.d.ts.map +1 -1
- package/lib/esm/BackendLoggerCategory.js +6 -0
- package/lib/esm/BackendLoggerCategory.js.map +1 -1
- package/lib/esm/BriefcaseManager.d.ts +57 -3
- package/lib/esm/BriefcaseManager.d.ts.map +1 -1
- package/lib/esm/BriefcaseManager.js +152 -43
- package/lib/esm/BriefcaseManager.js.map +1 -1
- package/lib/esm/CloudSqlite.d.ts +4 -0
- package/lib/esm/CloudSqlite.d.ts.map +1 -1
- package/lib/esm/CloudSqlite.js.map +1 -1
- package/lib/esm/ECDb.d.ts +8 -0
- package/lib/esm/ECDb.d.ts.map +1 -1
- package/lib/esm/ECDb.js +22 -0
- package/lib/esm/ECDb.js.map +1 -1
- package/lib/esm/GeographicCRSServices.d.ts.map +1 -1
- package/lib/esm/GeographicCRSServices.js +2 -0
- package/lib/esm/GeographicCRSServices.js.map +1 -1
- package/lib/esm/IModelDb.d.ts +54 -3
- package/lib/esm/IModelDb.d.ts.map +1 -1
- package/lib/esm/IModelDb.js +88 -10
- package/lib/esm/IModelDb.js.map +1 -1
- package/lib/esm/IModelHost.d.ts +11 -1
- package/lib/esm/IModelHost.d.ts.map +1 -1
- package/lib/esm/IModelHost.js +5 -0
- package/lib/esm/IModelHost.js.map +1 -1
- package/lib/esm/IModelIncrementalSchemaLocater.d.ts +1 -5
- package/lib/esm/IModelIncrementalSchemaLocater.d.ts.map +1 -1
- package/lib/esm/IModelIncrementalSchemaLocater.js +0 -6
- package/lib/esm/IModelIncrementalSchemaLocater.js.map +1 -1
- package/lib/esm/SqliteChangesetReader.d.ts +8 -0
- package/lib/esm/SqliteChangesetReader.d.ts.map +1 -1
- package/lib/esm/SqliteChangesetReader.js +11 -0
- package/lib/esm/SqliteChangesetReader.js.map +1 -1
- package/lib/esm/StashManager.d.ts +175 -0
- package/lib/esm/StashManager.d.ts.map +1 -0
- package/lib/esm/StashManager.js +301 -0
- package/lib/esm/StashManager.js.map +1 -0
- package/lib/esm/TxnManager.d.ts +226 -15
- package/lib/esm/TxnManager.d.ts.map +1 -1
- package/lib/esm/TxnManager.js +247 -21
- package/lib/esm/TxnManager.js.map +1 -1
- package/lib/esm/annotations/ElementDrivesTextAnnotation.d.ts +10 -1
- package/lib/esm/annotations/ElementDrivesTextAnnotation.d.ts.map +1 -1
- package/lib/esm/annotations/ElementDrivesTextAnnotation.js +13 -5
- package/lib/esm/annotations/ElementDrivesTextAnnotation.js.map +1 -1
- package/lib/esm/annotations/LeaderGeometry.d.ts +3 -2
- package/lib/esm/annotations/LeaderGeometry.d.ts.map +1 -1
- package/lib/esm/annotations/LeaderGeometry.js +5 -4
- package/lib/esm/annotations/LeaderGeometry.js.map +1 -1
- package/lib/esm/annotations/TextAnnotationElement.d.ts +52 -24
- package/lib/esm/annotations/TextAnnotationElement.d.ts.map +1 -1
- package/lib/esm/annotations/TextAnnotationElement.js +51 -61
- package/lib/esm/annotations/TextAnnotationElement.js.map +1 -1
- package/lib/esm/annotations/TextAnnotationGeometry.d.ts +2 -0
- package/lib/esm/annotations/TextAnnotationGeometry.d.ts.map +1 -1
- package/lib/esm/annotations/TextAnnotationGeometry.js +26 -19
- package/lib/esm/annotations/TextAnnotationGeometry.js.map +1 -1
- package/lib/esm/annotations/TextBlockGeometry.d.ts.map +1 -1
- package/lib/esm/annotations/TextBlockGeometry.js +8 -0
- package/lib/esm/annotations/TextBlockGeometry.js.map +1 -1
- package/lib/esm/annotations/TextBlockLayout.d.ts +49 -36
- package/lib/esm/annotations/TextBlockLayout.d.ts.map +1 -1
- package/lib/esm/annotations/TextBlockLayout.js +205 -136
- package/lib/esm/annotations/TextBlockLayout.js.map +1 -1
- package/lib/esm/internal/ChannelAdmin.js +1 -1
- package/lib/esm/internal/ChannelAdmin.js.map +1 -1
- package/lib/esm/internal/Symbols.d.ts +1 -0
- package/lib/esm/internal/Symbols.d.ts.map +1 -1
- package/lib/esm/internal/Symbols.js +1 -0
- package/lib/esm/internal/Symbols.js.map +1 -1
- package/lib/esm/internal/annotations/fields.d.ts +2 -12
- package/lib/esm/internal/annotations/fields.d.ts.map +1 -1
- package/lib/esm/internal/annotations/fields.js +51 -47
- package/lib/esm/internal/annotations/fields.js.map +1 -1
- package/lib/esm/test/AnnotationTestUtils.d.ts +5 -1
- package/lib/esm/test/AnnotationTestUtils.d.ts.map +1 -1
- package/lib/esm/test/AnnotationTestUtils.js +6 -1
- package/lib/esm/test/AnnotationTestUtils.js.map +1 -1
- package/lib/esm/test/annotations/Fields.test.js +163 -46
- package/lib/esm/test/annotations/Fields.test.js.map +1 -1
- package/lib/esm/test/annotations/LeaderGeometry.test.js +12 -10
- package/lib/esm/test/annotations/LeaderGeometry.test.js.map +1 -1
- package/lib/esm/test/annotations/TextAnnotation.test.js +299 -43
- package/lib/esm/test/annotations/TextAnnotation.test.js.map +1 -1
- package/lib/esm/test/annotations/TextBlock.test.js +453 -86
- package/lib/esm/test/annotations/TextBlock.test.js.map +1 -1
- package/lib/esm/test/assets/IncrementalSchemaLocater/configs/simple.config.d.ts +46 -0
- package/lib/esm/test/assets/IncrementalSchemaLocater/configs/simple.config.d.ts.map +1 -1
- package/lib/esm/test/assets/IncrementalSchemaLocater/configs/simple.config.js +20 -2
- package/lib/esm/test/assets/IncrementalSchemaLocater/configs/simple.config.js.map +1 -1
- package/lib/esm/test/ecdb/ECDb.test.js +71 -1
- package/lib/esm/test/ecdb/ECDb.test.js.map +1 -1
- package/lib/esm/test/hubaccess/Rebase.test.d.ts +2 -0
- package/lib/esm/test/hubaccess/Rebase.test.d.ts.map +1 -0
- package/lib/esm/test/hubaccess/Rebase.test.js +640 -0
- package/lib/esm/test/hubaccess/Rebase.test.js.map +1 -0
- package/lib/esm/test/incrementalSchemaLocater/ECSqlQueries.test.js +20 -20
- package/lib/esm/test/incrementalSchemaLocater/ECSqlQueries.test.js.map +1 -1
- package/lib/esm/test/incrementalSchemaLocater/IncrementalLoading.test.js +3 -3
- package/lib/esm/test/incrementalSchemaLocater/IncrementalLoading.test.js.map +1 -1
- package/lib/esm/test/incrementalSchemaLocater/utils/TestSqlSchemaLocater.d.ts +16 -1
- package/lib/esm/test/incrementalSchemaLocater/utils/TestSqlSchemaLocater.d.ts.map +1 -1
- package/lib/esm/test/incrementalSchemaLocater/utils/TestSqlSchemaLocater.js +47 -0
- package/lib/esm/test/incrementalSchemaLocater/utils/TestSqlSchemaLocater.js.map +1 -1
- package/lib/esm/test/standalone/ChangeMerge.test.js +15 -19
- package/lib/esm/test/standalone/ChangeMerge.test.js.map +1 -1
- package/lib/esm/test/standalone/ChangesetReader.test.js +131 -1
- package/lib/esm/test/standalone/ChangesetReader.test.js.map +1 -1
- package/lib/esm/test/standalone/MergeConflict.test.js +3 -3
- package/lib/esm/test/standalone/MergeConflict.test.js.map +1 -1
- package/lib/esm/workspace/Workspace.d.ts +1 -1
- package/lib/esm/workspace/Workspace.js.map +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CAAC,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAClC,CAAC;CACF;AApMD,0CAoMC","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 ElementGeometry\n */\n\nimport { BaselineShift, FieldRun, FontId, FontType, FractionRun, LineLayoutResult, Paragraph, Run, RunLayoutResult, TabRun, TextAnnotationLeader, TextBlock, TextBlockLayoutResult, TextBlockMargins, TextRun, TextStyleSettings, TextStyleSettingsProps } from \"@itwin/core-common\";\nimport { Geometry, Range2d } from \"@itwin/core-geometry\";\nimport { IModelDb } from \"../IModelDb\";\nimport { assert, Id64String, NonFunctionPropertiesOf } from \"@itwin/core-bentley\";\nimport * as LineBreaker from \"linebreak\";\nimport { AnnotationTextStyle } from \"./TextAnnotationElement\";\nimport { Drawing } from \"../Element\";\n\n\n/** @internal */\nexport interface TextLayoutRanges {\n layout: Range2d;\n justification: Range2d;\n}\n\n/** Arguments to [[ComputeRangesForTextLayout]].\n * @internal\n */\nexport interface ComputeRangesForTextLayoutArgs {\n chars: string;\n bold: boolean;\n italic: boolean;\n baselineShift: BaselineShift;\n fontId: FontId;\n widthFactor: number;\n lineHeight: number;\n}\n\n/** A function that uses a font to compute the layout and justification ranges of a string of text.\n * @internal\n */\nexport type ComputeRangesForTextLayout = (args: ComputeRangesForTextLayoutArgs) => TextLayoutRanges;\n\n/** A function that looks up the font Id corresponding to a [FontFamilyDescriptor]($common).\n * If no type is provided, the function can return a font of any type matching `name` (there may be more than one, of different types).\n * @internal\n */\nexport type FindFontId = (name: string, type?: FontType) => FontId;\n\n/** @internal chiefly for tests. */\nexport type FindTextStyle = (id: Id64String) => TextStyleSettings;\n\n/** @internal */\nfunction createFindTextStyleImpl(iModel: IModelDb): FindTextStyle {\n return function findTextStyleImpl(id: Id64String): TextStyleSettings {\n const annotationTextStyle = iModel.elements.tryGetElement<AnnotationTextStyle>(id);\n if (annotationTextStyle && annotationTextStyle instanceof AnnotationTextStyle) {\n return annotationTextStyle.settings;\n }\n\n return TextStyleSettings.fromJSON();\n };\n}\n\n/**\n * Arguments supplied to [[computeLayoutTextBlockResult]].\n * @beta\n */\nexport interface LayoutTextBlockArgs {\n /** The text block whose extents are to be computed. */\n textBlock: TextBlock;\n /** The iModel from which to obtain fonts and [[AnnotationTextStyle]]s when laying out glyphs. */\n iModel: IModelDb;\n /** The text style resolver used to resolve effective text styles during layout. */\n textStyleResolver: TextStyleResolver;\n /** @internal chiefly for tests, by default uses IModelJsNative.DgnDb.computeRangesForText. */\n computeTextRange?: ComputeRangesForTextLayout;\n /** @internal chiefly for tests, by default uses IModelDb.fontMap. */\n findFontId?: FindFontId;\n}\n\n/**\n * Lays out the contents of a TextBlock into a series of lines containing runs.\n * Each paragraph is decomposed into a series of lines.\n * Each series of consecutive non-linebreak runs within a paragraph is concatenated into one line.\n * If the document specifies a width > 0, individual lines are split to try to avoid exceeding that width.\n * Individual TextRuns can be split onto multiple lines at word boundaries if necessary. Individual FractionRuns are never split.\n * @see [[computeLayoutTextBlockResult]]\n * @beta\n */\nexport function layoutTextBlock(args: LayoutTextBlockArgs): TextBlockLayout {\n const findFontId = args.findFontId ?? ((name, type) => args.iModel.fonts.findId({ name, type }) ?? 0);\n const computeTextRange = args.computeTextRange ?? ((x) => args.iModel.computeRangesForText(x));\n\n return new TextBlockLayout(args.textBlock, new LayoutContext(args.textStyleResolver, computeTextRange, findFontId));\n}\n\n/**\n * Gets the result of laying out the the contents of a TextBlock into a series of lines containing runs.\n * The visual layout accounts for the [[AnnotationTextStyle]]s, fonts, and [TextBlock.width]($common). It applies word-wrapping if needed.\n * The layout returned matches the visual layout of the geometry produced by [[appendTextAnnotationGeometry]].\n * @beta\n */\nexport function computeLayoutTextBlockResult(args: LayoutTextBlockArgs): TextBlockLayoutResult {\n const layout = layoutTextBlock(args);\n return layout.toResult();\n}\n\n/**\n * Arguments supplied to [[computeGraphemeOffsets]].\n * @beta\n */\nexport interface ComputeGraphemeOffsetsArgs extends LayoutTextBlockArgs {\n /** The index of the [Paragraph]($common) in the text block that contains the run layout result text. */\n paragraphIndex: number;\n /** The run layout result for which grapheme ranges will be computed. */\n runLayoutResult: RunLayoutResult;\n /** An array of starting character indexes for each grapheme. Each entry represents the index of the first character in a grapheme. */\n graphemeCharIndexes: number[];\n};\n\n/**\n * Computes the range from the start of a [RunLayoutResult]($common) to the trailing edge of each grapheme.\n * It is the responsibility of the caller to determine the number and character indexes of the graphemes.\n * @returns If the [RunLayoutResult]($common)'s source is a [TextRun]($common), it returns an array containing the range of each grapheme.\n * Otherwise, it returns and empty array.\n * @beta\n */\nexport function computeGraphemeOffsets(args: ComputeGraphemeOffsetsArgs): Range2d[] {\n const { textBlock, paragraphIndex, runLayoutResult, graphemeCharIndexes, iModel } = args;\n const findFontId = args.findFontId ?? ((name, type) => iModel.fonts.findId({ name, type }) ?? 0);\n const computeTextRange = args.computeTextRange ?? ((x) => iModel.computeRangesForText(x));\n const source = textBlock.paragraphs[paragraphIndex].runs[runLayoutResult.sourceRunIndex];\n\n if (source.type !== \"text\" || runLayoutResult.characterCount === 0) {\n return [];\n }\n\n const style = TextStyleSettings.fromJSON(runLayoutResult.textStyle);\n\n const layoutContext = new LayoutContext(args.textStyleResolver, computeTextRange, findFontId);\n const graphemeRanges: Range2d[] = [];\n\n graphemeCharIndexes.forEach((_, index) => {\n const nextGraphemeCharIndex = graphemeCharIndexes[index + 1] ?? runLayoutResult.characterCount;\n graphemeRanges.push(layoutContext.computeRangeForTextRun(style, source, runLayoutResult.characterOffset, nextGraphemeCharIndex).layout);\n });\n return graphemeRanges;\n}\n\nfunction scaleRange(range: Range2d, scale: number): void {\n range.low.scaleInPlace(scale);\n range.high.scaleInPlace(scale);\n}\n\n/**\n * Applies block level settings (lineSpacingFactor, lineHeight, widthFactor, frame, and leader) to a [TextStyleSettings]($common).\n * These must be set on the block, as they are meaningless on individual paragraphs/runs.\n * However, leaders are a special case and can override the block's leader settings.\n * Setting `isLeader` to `true` makes the [TextBlock]($common) settings not override the leader's settings.\n * @internal\n */\nfunction applyBlockSettings(target: TextStyleSettings, source: TextStyleSettings | TextStyleSettingsProps, isLeader: boolean = false): TextStyleSettings {\n if (source === target) {\n return target;\n }\n\n const lineSpacingFactor = source.lineSpacingFactor ?? target.lineSpacingFactor;\n const lineHeight = source.lineHeight ?? target.lineHeight;\n const widthFactor = source.widthFactor ?? target.widthFactor;\n const frame = source.frame ?? target.frame;\n const leader = source.leader ?? target.leader;\n\n const leaderShouldChange = !isLeader && !target.leaderEquals(leader);\n\n if (lineSpacingFactor !== target.lineSpacingFactor ||\n lineHeight !== target.lineHeight ||\n widthFactor !== target.widthFactor ||\n !target.frameEquals(frame) ||\n leaderShouldChange\n ) {\n const cloneProps: TextStyleSettingsProps = {\n lineSpacingFactor,\n lineHeight,\n widthFactor,\n frame,\n };\n\n if (leaderShouldChange) {\n cloneProps.leader = leader;\n }\n\n target = target.clone(cloneProps);\n }\n\n return target;\n}\n\n/**\n * Arguments used when constructing a [[TextStyleResolver]].\n * @beta\n */\nexport interface TextStyleResolverArgs {\n /** The text block whose styles are being resolved. */\n textBlock: TextBlock;\n /** The iModel from which to obtain [[AnnotationTextStyle]]s when resolving styles. */\n iModel: IModelDb;\n /** The ID of the model containing the text block, used to compute the scale factor. */\n modelId?: Id64String;\n /** @internal chiefly for tests, by default looks up an [[AnnotationTextStyle]] in the iModel by ID. */\n findTextStyle?: FindTextStyle;\n}\n\n/**\n * Resolves the effective style of TextBlockComponents and Leaders, taking into account overrides/style of the instance and its parent(s).\n * @beta\n */\nexport class TextStyleResolver {\n private readonly _textStyles = new Map<Id64String, TextStyleSettings>();\n private readonly _findTextStyle: FindTextStyle;\n /** The resolved style of the TextBlock. */\n public readonly blockSettings: TextStyleSettings;\n /** The scale factor of the model containing the TextBlock. */\n public readonly scaleFactor: number;\n\n public constructor(args: TextStyleResolverArgs) {\n this._findTextStyle = args.findTextStyle ?? createFindTextStyleImpl(args.iModel);\n\n this.scaleFactor = 1;\n if (args.modelId) {\n const element = args.iModel.elements.getElement(args.modelId);\n if (element instanceof Drawing)\n this.scaleFactor = element.scaleFactor;\n }\n\n this.blockSettings = this.findTextStyle(args.textBlock.styleId);\n if (args.textBlock.styleOverrides)\n this.blockSettings = this.blockSettings.clone(args.textBlock.styleOverrides);\n }\n\n private resolveParagraphSettingsImpl(paragraph: Paragraph): TextStyleSettings {\n let settings = this.blockSettings;\n\n if (paragraph.overridesStyle)\n settings = settings.clone(paragraph.styleOverrides);\n\n return settings;\n }\n\n /** Looks up an [[AnnotationTextStyle]] by ID. Uses caching. */\n public findTextStyle(id: Id64String): TextStyleSettings {\n let style = this._textStyles.get(id);\n if (undefined === style) {\n this._textStyles.set(id, style = this._findTextStyle(id));\n }\n\n return style;\n }\n\n /** Resolves the effective style for a [TextAnnotationLeader]($common). The TextAnnotationLeader should be a sibling of the provided TextBlock. */\n public resolveTextAnnotationLeaderSettings(leader: TextAnnotationLeader): TextStyleSettings {\n let settings = this.blockSettings;\n\n if (leader.styleOverrides)\n settings = settings.clone(leader.styleOverrides);\n\n return applyBlockSettings(settings, this.blockSettings, true);\n }\n\n /** Resolves the effective style for a [Paragraph]($common). Paragraph should be child of provided TextBlock. */\n public resolveParagraphSettings(paragraph: Paragraph): TextStyleSettings {\n return applyBlockSettings(this.resolveParagraphSettingsImpl(paragraph), this.blockSettings);\n }\n\n /** Resolves the effective style for a [Run]($common). Run should be child of provided Paragraph and TextBlock. */\n public resolveRunSettings(paragraph: Paragraph, run: Run): TextStyleSettings {\n let settings = this.resolveParagraphSettingsImpl(paragraph);\n\n if (run.overridesStyle)\n settings = settings.clone(run.styleOverrides);\n\n return applyBlockSettings(settings, this.blockSettings);\n }\n}\n\nclass LayoutContext {\n private readonly _fontIds = new Map<string, FontId>();\n\n public constructor(public readonly textStyleResolver: TextStyleResolver, private readonly _computeTextRange: ComputeRangesForTextLayout, private readonly _findFontId: FindFontId) {}\n\n public findFontId(name: string): FontId {\n let fontId = this._fontIds.get(name);\n if (undefined === fontId) {\n this._fontIds.set(name, fontId = this._findFontId(name));\n }\n\n return fontId;\n }\n\n public computeRangeForText(chars: string, style: TextStyleSettings, baselineShift: BaselineShift): TextLayoutRanges {\n if (chars.length === 0) {\n return {\n layout: new Range2d(0, 0, 0, style.lineHeight),\n justification: new Range2d(),\n };\n }\n\n const fontId = this.findFontId(style.fontName);\n const { layout, justification } = this._computeTextRange({\n chars,\n fontId,\n baselineShift,\n bold: style.isBold,\n italic: style.isItalic,\n lineHeight: this.textStyleResolver.blockSettings.lineHeight,\n widthFactor: this.textStyleResolver.blockSettings.widthFactor,\n });\n\n if (\"none\" !== baselineShift) {\n const isSub = \"subscript\" === baselineShift;\n const scale = isSub ? style.subScriptScale : style.superScriptScale;\n const offsetFactor = isSub ? style.subScriptOffsetFactor : style.superScriptOffsetFactor;\n const offset = { x: 0, y: style.lineHeight * offsetFactor };\n\n scaleRange(layout, scale);\n layout.cloneTranslated(offset, layout);\n\n scaleRange(justification, scale);\n justification.cloneTranslated(offset, justification);\n }\n\n return { layout, justification };\n }\n\n public computeRangeForTextRun(style: TextStyleSettings, run: TextRun | FieldRun, charOffset: number, numChars: number): TextLayoutRanges {\n let content: string;\n let baselineShift: BaselineShift;\n\n if (run.type === \"text\") {\n content = run.content;\n baselineShift = run.baselineShift;\n } else {\n content = run.cachedContent;\n baselineShift = \"none\";\n }\n\n return this.computeRangeForText(content.substring(charOffset, charOffset + numChars), style, baselineShift);\n }\n\n public computeRangeForFractionRun(style: TextStyleSettings, source: FractionRun): { layout: Range2d, numerator: Range2d, denominator: Range2d } {\n const numerator = this.computeRangeForText(source.numerator, style, \"none\").layout;\n scaleRange(numerator, style.stackedFractionScale);\n\n const denominator = this.computeRangeForText(source.denominator, style, \"none\").layout;\n scaleRange(denominator, style.stackedFractionScale);\n\n const numLen = numerator.xLength();\n const denomLen = denominator.xLength();\n switch (style.stackedFractionType) {\n case \"horizontal\": {\n if (numLen > denomLen) {\n denominator.cloneTranslated({ x: (numLen - denomLen) / 2, y: 0 }, denominator);\n } else {\n numerator.cloneTranslated({ x: (denomLen - numLen) / 2, y: 0 }, numerator);\n }\n\n numerator.cloneTranslated({ x: 0, y: 1.5 * denominator.yLength() }, numerator);\n break;\n }\n case \"diagonal\": {\n numerator.cloneTranslated({ x: 0, y: denominator.yLength() }, numerator);\n denominator.cloneTranslated({ x: numLen, y: 0 }, denominator);\n break;\n }\n }\n\n const layout = numerator.clone();\n layout.extendRange(denominator);\n return { layout, numerator, denominator };\n }\n\n public computeRangeForTabRun(style: TextStyleSettings, source: TabRun, length: number): Range2d {\n const interval = source.styleOverrides.tabInterval ?? style.tabInterval;\n const tabEndX = interval - length % interval;\n\n const range = new Range2d(0, 0, 0, style.lineHeight);\n range.extendXY(tabEndX, range.low.y);\n\n return range;\n }\n}\n\ninterface Segment {\n segment: string;\n index: number;\n}\n\nfunction split(source: string): Segment[] {\n if (source.length === 0) {\n return [];\n }\n\n let index = 0;\n const segments: Segment[] = [];\n const breaker = new LineBreaker(source);\n for (let brk = breaker.nextBreak(); brk; brk = breaker.nextBreak()) {\n segments.push({\n segment: source.slice(index, brk.position),\n index,\n });\n\n index = brk.position;\n }\n\n return segments;\n}\n\nfunction applyTabShift(run: RunLayout, parent: LineLayout, context: LayoutContext): void {\n if (run.source.type === \"tab\") {\n run.range.setFrom(context.computeRangeForTabRun(run.style, run.source, parent.lengthFromLastTab));\n }\n}\n\n/**\n * Represents the layout of a single run (text, fraction, or line break) within a line of text.\n * Stores information about the run's position, style, and font within the line.\n * Provides utilities for splitting text runs for word wrapping and converting to result objects.\n * @beta\n */\nexport class RunLayout {\n public source: Run;\n public charOffset: number;\n public numChars: number;\n public range: Range2d;\n public justificationRange?: Range2d;\n public denominatorRange?: Range2d;\n public numeratorRange?: Range2d;\n public offsetFromLine: { x: number, y: number };\n public style: TextStyleSettings;\n public fontId: FontId;\n\n private constructor(props: NonFunctionPropertiesOf<RunLayout>) {\n this.source = props.source;\n this.charOffset = props.charOffset;\n this.numChars = props.numChars;\n this.range = props.range;\n this.justificationRange = props.justificationRange;\n this.denominatorRange = props.denominatorRange;\n this.numeratorRange = props.numeratorRange;\n this.offsetFromLine = props.offsetFromLine;\n this.style = props.style;\n this.fontId = props.fontId;\n }\n\n public static create(source: Run, parentParagraph: Paragraph, context: LayoutContext): RunLayout {\n const style = context.textStyleResolver.resolveRunSettings(parentParagraph, source);\n const fontId = context.findFontId(style.fontName);\n const charOffset = 0;\n const offsetFromLine = { x: 0, y: 0 };\n let numChars = 0;\n\n let range, justificationRange, numeratorRange, denominatorRange;\n\n switch (source.type) {\n case \"field\":\n case \"text\": {\n const content = source.type === \"text\" ? source.content : source.cachedContent;\n numChars = content.length;\n const ranges = context.computeRangeForTextRun(style, source, charOffset, numChars);\n range = ranges.layout;\n justificationRange = ranges.justification;\n break;\n }\n case \"fraction\": {\n numChars = 1;\n const ranges = context.computeRangeForFractionRun(style, source);\n range = ranges.layout;\n numeratorRange = ranges.numerator;\n denominatorRange = ranges.denominator;\n break;\n }\n default: { // \"linebreak\" or \"tab\"\n // \"tab\": Tabs rely on the context they are in, so we compute its range later.\n // lineBreak: We do this so that blank lines space correctly without special casing later.\n range = new Range2d(0, 0, 0, style.lineHeight);\n break;\n }\n }\n\n return new RunLayout({ source, charOffset, numChars, range, justificationRange, denominatorRange, numeratorRange, offsetFromLine, style, fontId });\n }\n\n /** Compute a string representation, primarily for debugging purposes. */\n public stringify(): string {\n return this.source.type === \"text\" ? this.source.content.substring(this.charOffset, this.charOffset + this.numChars) : this.source.stringify();\n }\n\n public canWrap(): this is { source: TextRun } {\n return this.source.type === \"text\";\n }\n\n private cloneForWrap(args: { ranges: TextLayoutRanges, charOffset: number, numChars: number }): RunLayout {\n assert(this.canWrap());\n\n return new RunLayout({\n ...this,\n charOffset: args.charOffset,\n numChars: args.numChars,\n range: args.ranges.layout,\n justificationRange: args.ranges.justification,\n offsetFromLine: { ...this.offsetFromLine },\n });\n }\n\n public split(context: LayoutContext): RunLayout[] {\n assert(this.charOffset === 0, \"cannot re-split a run\");\n if (!this.canWrap() || this.charOffset > 0) {\n return [this];\n }\n\n const myText = this.source.content.substring(this.charOffset, this.charOffset + this.numChars);\n const segments = split(myText);\n\n if (segments.length <= 1) {\n return [this];\n }\n\n return segments.map((segment: any) => {\n return this.cloneForWrap({\n ranges: context.computeRangeForText(segment.segment, this.style, this.source.baselineShift),\n charOffset: segment.index,\n numChars: segment.segment.length,\n });\n });\n }\n\n public toResult(paragraph: Paragraph): RunLayoutResult {\n const result: RunLayoutResult = {\n sourceRunIndex: paragraph.runs.indexOf(this.source),\n fontId: this.fontId,\n characterOffset: this.charOffset,\n characterCount: this.numChars,\n range: this.range.toJSON(),\n offsetFromLine: this.offsetFromLine,\n textStyle: this.style.toJSON(),\n };\n\n if (this.justificationRange) {\n result.justificationRange = this.justificationRange.toJSON();\n }\n\n if (this.numeratorRange) {\n result.numeratorRange = this.numeratorRange.toJSON();\n }\n\n if (this.denominatorRange) {\n result.denominatorRange = this.denominatorRange.toJSON();\n }\n\n return result;\n }\n}\n\n/**\n * Represents the layout of a single line within a paragraph of a text block.\n * Contains a sequence of RunLayout objects, the computed range of the line, and its offset from the document origin.\n * Provides utilities for appending runs, computing ranges, and converting to result objects.\n * @beta\n */\nexport class LineLayout {\n public source: Paragraph;\n public range = new Range2d(0, 0, 0, 0);\n public justificationRange = new Range2d(0, 0, 0, 0);\n public offsetFromDocument = { x: 0, y: 0 };\n public lengthFromLastTab = 0; // Used to track the length from the last tab for tab runs.\n private _runs: RunLayout[] = [];\n\n public constructor(source: Paragraph) {\n this.source = source;\n }\n\n /** Compute a string representation, primarily for debugging purposes. */\n public stringify(): string {\n const runs = this._runs.map((run) => run.stringify());\n return `${runs.join(\"\")}`;\n }\n\n public get runs(): ReadonlyArray<RunLayout> { return this._runs; }\n public get isEmpty() { return this._runs.length === 0; }\n public get back(): RunLayout {\n assert(!this.isEmpty);\n return this._runs[this._runs.length - 1];\n }\n\n public append(run: RunLayout): void {\n this._runs.push(run);\n this.computeRanges();\n }\n\n /** Invoked every time a run is appended,. */\n private computeRanges(): void {\n this.range.low.setZero();\n this.range.high.setZero();\n\n // Some runs (fractions) are taller than others.\n // We want to center each run vertically inside the line.\n let lineHeight = 0;\n for (const run of this._runs) {\n lineHeight = Math.max(lineHeight, run.range.yLength());\n }\n\n for (const run of this._runs) {\n const runHeight = run.range.yLength();\n const runOffset = { x: this.range.high.x, y: (lineHeight - runHeight) / 2 };\n run.offsetFromLine = runOffset;\n\n const runLayoutRange = run.range.cloneTranslated(runOffset);\n this.range.extendRange(runLayoutRange);\n\n if (\"linebreak\" !== run.source.type) {\n const runJustificationRange = run.justificationRange?.cloneTranslated(runOffset);\n this.justificationRange.extendRange(runJustificationRange ?? runLayoutRange);\n }\n\n if (run.source.type === \"tab\") {\n this.lengthFromLastTab = 0;\n } else {\n this.lengthFromLastTab += run.range.xLength();\n }\n }\n }\n\n public toResult(textBlock: TextBlock): LineLayoutResult {\n return {\n sourceParagraphIndex: textBlock.paragraphs.indexOf(this.source),\n runs: this.runs.map((x) => x.toResult(this.source)),\n range: this.range.toJSON(),\n justificationRange: this.justificationRange.toJSON(),\n offsetFromDocument: this.offsetFromDocument,\n };\n }\n}\n\n/**\n * Describes the layout of a text block as a collection of lines containing runs.\n * Computes the visual layout of the text block, including word wrapping, justification, and margins.\n * Provides access to the computed lines, ranges, and utilities for converting to result objects.\n * @beta\n */\nexport class TextBlockLayout {\n public source: TextBlock;\n\n /** @internal: This is primarily for debugging purposes. This is the range of text geometry */\n public textRange = new Range2d();\n\n /** The range including margins of the [[TextBlock]]. */\n public range = new Range2d();\n public lines: LineLayout[] = [];\n private _context: LayoutContext;\n\n public constructor(source: TextBlock, context: LayoutContext) {\n this._context = context;\n this.source = source;\n\n if (source.width > 0) {\n this.textRange.low.x = 0;\n this.textRange.high.x = source.width;\n }\n\n this.populateLines(context);\n this.justifyLines();\n this.applyMargins(source.margins);\n }\n\n public toResult(): TextBlockLayoutResult {\n return {\n lines: this.lines.map((x) => x.toResult(this.source)),\n range: this.range.toJSON(),\n };\n }\n\n /** Compute a string representation, primarily for debugging purposes. */\n public stringify(): string {\n return this.lines.map((line) => line.stringify()).join(\"\\n\");\n }\n\n private get _back(): LineLayout {\n assert(this.lines.length > 0);\n return this.lines[this.lines.length - 1];\n }\n\n private populateLines(context: LayoutContext): void {\n const doc = this.source;\n if (doc.paragraphs.length === 0) {\n return;\n }\n\n const doWrap = doc.width > 0;\n let curLine = new LineLayout(doc.paragraphs[0]);\n for (let i = 0; i < doc.paragraphs.length; i++) {\n const paragraph = doc.paragraphs[i];\n if (i > 0) {\n curLine = this.flushLine(context, curLine, paragraph);\n }\n\n let runs = paragraph.runs.map((run) => RunLayout.create(run, paragraph, context));\n if (doWrap) {\n runs = runs.map((run) => run.split(context)).flat();\n }\n\n for (const run of runs) {\n if (\"linebreak\" === run.source.type) {\n curLine.append(run);\n curLine = this.flushLine(context, curLine);\n continue;\n }\n\n // If this is a tab, we need to apply the tab shift first, and then we can treat it like a text run.\n applyTabShift(run, curLine, context);\n\n // If our width is not set (doWrap is false), then we don't have to compute word wrapping, so just append the run, and continue.\n if (!doWrap) {\n curLine.append(run);\n continue;\n }\n\n // Next, determine if we can append this run to the current line without exceeding the document width\n const runWidth = run.range.xLength();\n const lineWidth = curLine.range.xLength();\n\n // If true, then no word wrapping is required, so we can append to the current line.\n if (runWidth + lineWidth < doc.width || Geometry.isAlmostEqualNumber(runWidth + lineWidth, doc.width, Geometry.smallMetricDistance)) {\n curLine.append(run);\n continue;\n }\n\n // Do word wrapping\n if (curLine.runs.length === 0) {\n curLine.append(run);\n\n // Lastly, flush line\n curLine = this.flushLine(context, curLine);\n } else {\n // First, flush line\n curLine = this.flushLine(context, curLine);\n\n // Recompute tab shift if applicable\n applyTabShift(run, curLine, context);\n\n curLine.append(run);\n }\n }\n }\n\n if (curLine.runs.length > 0) {\n this.flushLine(context, curLine);\n }\n }\n\n private justifyLines(): void {\n // We don't want to justify empty text, or a single line of text whose width is 0. By default text is already left justified.\n if (this.lines.length < 1 || (this.lines.length === 1 && this.source.width === 0) || \"left\" === this.source.justification) {\n return;\n }\n\n // This is the minimum width of the document's bounding box.\n const docWidth = this.source.width;\n\n let minOffset = Number.MAX_VALUE;\n for (const line of this.lines) {\n const lineWidth = line.justificationRange.xLength();\n\n let offset = docWidth - lineWidth;\n if (\"center\" === this.source.justification) {\n offset = offset / 2;\n }\n\n line.offsetFromDocument.x += offset;\n minOffset = Math.min(offset, minOffset);\n }\n\n if (minOffset < 0) {\n // Shift left to accommodate lines that exceeded the document's minimum width.\n this.textRange.low.x += minOffset;\n this.textRange.high.x += minOffset;\n }\n }\n\n private flushLine(context: LayoutContext, line: LineLayout, nextParagraph?: Paragraph): LineLayout {\n nextParagraph = nextParagraph ?? line.source;\n\n // We want to guarantee that each layout line has at least one run.\n if (line.runs.length === 0) {\n // If we're empty, there should always be a preceding run, and it should be a line break.\n if (this.lines.length === 0 || this._back.runs.length === 0) {\n return new LineLayout(nextParagraph);\n }\n\n const prevRun = this._back.back.source;\n assert(prevRun.type === \"linebreak\");\n if (prevRun.type !== \"linebreak\") {\n return new LineLayout(nextParagraph);\n }\n\n line.append(RunLayout.create(prevRun.clone(), line.source, context));\n }\n\n // Line origin is its baseline.\n const lineOffset = { x: 0, y: -line.range.yLength() };\n\n // Place it below any existing lines\n if (this.lines.length > 0) {\n lineOffset.y += this._back.offsetFromDocument.y;\n lineOffset.y -= context.textStyleResolver.blockSettings.lineSpacingFactor * context.textStyleResolver.blockSettings.lineHeight;\n }\n\n line.offsetFromDocument = lineOffset;\n\n // Update document range from computed line range and position\n this.textRange.extendRange(line.range.cloneTranslated(lineOffset));\n\n this.lines.push(line);\n return new LineLayout(nextParagraph);\n }\n\n private applyMargins(margins: TextBlockMargins) {\n this.range = this.textRange.clone();\n\n if (this.range.isNull)\n return;\n\n // Disregard negative margins.\n const right = margins.right >= 0 ? margins.right : 0;\n const left = margins.left >= 0 ? margins.left : 0;\n const top = margins.top >= 0 ? margins.top : 0;\n const bottom = margins.bottom >= 0 ? margins.bottom : 0;\n\n const xHigh = this.textRange.high.x + right;\n const yHigh = this.textRange.high.y + top;\n const xLow = this.textRange.low.x - left;\n const yLow = this.textRange.low.y - bottom;\n\n this.range.extendXY(xHigh, yHigh);\n this.range.extendXY(xLow, yLow);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"TextBlockLayout.js","sourceRoot":"","sources":["../../../src/annotations/TextBlockLayout.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAwFH,0CAKC;AAQD,oEAGC;AAsBD,wDAmBC;AA/ID,oDAAsU;AACtU,wDAAwE;AAExE,sDAAkF;AAClF,yCAAyC;AACzC,mEAA8D;AAoC9D,gBAAgB;AAChB,SAAS,uBAAuB,CAAC,MAAgB;IAC/C,OAAO,SAAS,iBAAiB,CAAC,EAAc;QAC9C,MAAM,mBAAmB,GAAG,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAsB,EAAE,CAAC,CAAC;QACnF,IAAI,mBAAmB,IAAI,mBAAmB,YAAY,2CAAmB,EAAE,CAAC;YAC9E,OAAO,mBAAmB,CAAC,QAAQ,CAAC;QACtC,CAAC;QAED,OAAO,+BAAiB,CAAC,QAAQ,EAAE,CAAC;IACtC,CAAC,CAAC;AACJ,CAAC;AA0BD;;;;;;;;GAQG;AACH,SAAgB,eAAe,CAAC,IAAyB;IACvD,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,IAAI,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;IACtG,MAAM,gBAAgB,GAAG,IAAI,CAAC,gBAAgB,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,C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,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QAC/C,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;QAExD,MAAM,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,GAAG,KAAK,CAAC;QAC5C,MAAM,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,GAAG,GAAG,CAAC;QAC1C,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC;QACzC,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC;QAE3C,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;QAClC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAClC,CAAC;CACF;AAjRD,0CAiRC","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 ElementGeometry\n */\n\nimport { BaselineShift, FieldRun, FontId, FontType, FractionRun, getMarkerText, LineLayoutResult, List, Paragraph, Run, RunLayoutResult, StructuralTextBlockComponent, TabRun, TextBlock, TextBlockComponent, TextBlockLayoutResult, TextBlockMargins, TextRun, TextStyleSettings, TextStyleSettingsProps } from \"@itwin/core-common\";\nimport { Geometry, Range2d, WritableXAndY } from \"@itwin/core-geometry\";\nimport { IModelDb } from \"../IModelDb\";\nimport { assert, Id64String, NonFunctionPropertiesOf } from \"@itwin/core-bentley\";\nimport * as LineBreaker from \"linebreak\";\nimport { AnnotationTextStyle } from \"./TextAnnotationElement\";\n\n\n/** @internal */\nexport interface TextLayoutRanges {\n layout: Range2d;\n justification: Range2d;\n}\n\n/** Arguments to [[ComputeRangesForTextLayout]].\n * @internal\n */\nexport interface ComputeRangesForTextLayoutArgs {\n chars: string;\n bold: boolean;\n italic: boolean;\n baselineShift: BaselineShift;\n fontId: FontId;\n widthFactor: number;\n lineHeight: number;\n}\n\n/** A function that uses a font to compute the layout and justification ranges of a string of text.\n * @internal\n */\nexport type ComputeRangesForTextLayout = (args: ComputeRangesForTextLayoutArgs) => TextLayoutRanges;\n\n/** A function that looks up the font Id corresponding to a [FontFamilyDescriptor]($common).\n * If no type is provided, the function can return a font of any type matching `name` (there may be more than one, of different types).\n * @internal\n */\nexport type FindFontId = (name: string, type?: FontType) => FontId;\n\n/** @internal chiefly for tests. */\nexport type FindTextStyle = (id: Id64String) => TextStyleSettings;\n\n/** @internal */\nfunction createFindTextStyleImpl(iModel: IModelDb): FindTextStyle {\n return function findTextStyleImpl(id: Id64String): TextStyleSettings {\n const annotationTextStyle = iModel.elements.tryGetElement<AnnotationTextStyle>(id);\n if (annotationTextStyle && annotationTextStyle instanceof AnnotationTextStyle) {\n return annotationTextStyle.settings;\n }\n\n return TextStyleSettings.fromJSON();\n };\n}\n\n/**\n * Base interface for arguments supplied to [[computeLayoutTextBlockResult]] and [[computeGraphemeOffsets]].\n * @beta\n */\nexport interface LayoutTextArgs {\n /** The iModel from which to obtain fonts and [[AnnotationTextStyle]]s when laying out glyphs. */\n iModel: IModelDb;\n /** The text style resolver used to resolve effective text styles during layout. */\n textStyleResolver: TextStyleResolver;\n /** @internal chiefly for tests, by default uses IModelJsNative.DgnDb.computeRangesForText. */\n computeTextRange?: ComputeRangesForTextLayout;\n /** @internal chiefly for tests, by default uses IModelDb.fontMap. */\n findFontId?: FindFontId;\n}\n\n/**\n * Arguments supplied to [[computeLayoutTextBlockResult]].\n * @beta\n */\nexport interface LayoutTextBlockArgs extends LayoutTextArgs {\n /** The text block whose extents are to be computed. */\n textBlock: TextBlock;\n}\n\n/**\n * Lays out the contents of a TextBlock into a series of lines containing runs.\n * Each paragraph is decomposed into a series of lines.\n * Each series of consecutive non-linebreak runs within a paragraph is concatenated into one line.\n * If the document specifies a width > 0, individual lines are split to try to avoid exceeding that width.\n * Individual TextRuns can be split onto multiple lines at word boundaries if necessary. Individual FractionRuns are never split.\n * @see [[computeLayoutTextBlockResult]]\n * @beta\n */\nexport function layoutTextBlock(args: LayoutTextBlockArgs): TextBlockLayout {\n const findFontId = args.findFontId ?? ((name, type) => args.iModel.fonts.findId({ name, type }) ?? 0);\n const computeTextRange = args.computeTextRange ?? ((x) => args.iModel.computeRangesForText(x));\n\n return new TextBlockLayout(args.textBlock, new LayoutContext(args.textStyleResolver, computeTextRange, findFontId));\n}\n\n/**\n * Gets the result of laying out the the contents of a TextBlock into a series of lines containing runs.\n * The visual layout accounts for the [[AnnotationTextStyle]]s, fonts, and [TextBlock.width]($common). It applies word-wrapping if needed.\n * The layout returned matches the visual layout of the geometry produced by [[appendTextAnnotationGeometry]].\n * @beta\n */\nexport function computeLayoutTextBlockResult(args: LayoutTextBlockArgs): TextBlockLayoutResult {\n const layout = layoutTextBlock(args);\n return layout.toResult();\n}\n\n/**\n * Arguments supplied to [[computeGraphemeOffsets]].\n * @beta\n */\nexport interface ComputeGraphemeOffsetsArgs extends LayoutTextArgs {\n /** The TextBlockComponent for which to compute grapheme offsets. */\n source: TextBlockComponent;\n /** The run layout result for which grapheme ranges will be computed. */\n runLayoutResult: RunLayoutResult;\n /** An array of starting character indexes for each grapheme. Each entry represents the index of the first character in a grapheme. */\n graphemeCharIndexes: number[];\n};\n\n/**\n * Computes the range from the start of a [RunLayoutResult]($common) to the trailing edge of each grapheme.\n * It is the responsibility of the caller to determine the number and character indexes of the graphemes.\n * @returns If the [RunLayoutResult]($common)'s source is a [TextRun]($common), it returns an array containing the range of each grapheme.\n * Otherwise, it returns and empty array.\n * @beta\n */\nexport function computeGraphemeOffsets(args: ComputeGraphemeOffsetsArgs): Range2d[] {\n const { source, runLayoutResult, graphemeCharIndexes, iModel } = args;\n const findFontId = args.findFontId ?? ((name, type) => iModel.fonts.findId({ name, type }) ?? 0);\n const computeTextRange = args.computeTextRange ?? ((x) => iModel.computeRangesForText(x));\n\n if (!(source instanceof TextRun) || runLayoutResult.characterCount === 0) {\n return [];\n }\n\n const style = TextStyleSettings.fromJSON(runLayoutResult.textStyle);\n\n const layoutContext = new LayoutContext(args.textStyleResolver, computeTextRange, findFontId);\n const graphemeRanges: Range2d[] = [];\n\n graphemeCharIndexes.forEach((_, index) => {\n const nextGraphemeCharIndex = graphemeCharIndexes[index + 1] ?? runLayoutResult.characterCount;\n graphemeRanges.push(layoutContext.computeRangeForTextRun(style, source, runLayoutResult.characterOffset, nextGraphemeCharIndex).layout);\n });\n return graphemeRanges;\n}\n\nfunction scaleRange(range: Range2d, scale: number): void {\n range.low.scaleInPlace(scale);\n range.high.scaleInPlace(scale);\n}\n\n/**\n * Applies block level settings (lineSpacingFactor, lineHeight, widthFactor, frame, and leader) to a [TextStyleSettings]($common).\n * These must be set on the block, as they are meaningless on individual paragraphs/runs.\n * However, leaders are a special case and can override the block's leader settings.\n * Setting `isLeader` to `true` makes the [TextBlock]($common) settings not override the leader's settings.\n * @internal\n */\nfunction applyBlockSettings(target: TextStyleSettings, source: TextStyleSettings | TextStyleSettingsProps, isLeader: boolean = false): TextStyleSettings {\n if (source === target) {\n return target;\n }\n\n const lineSpacingFactor = source.lineSpacingFactor ?? target.lineSpacingFactor;\n const lineHeight = source.lineHeight ?? target.lineHeight;\n const widthFactor = source.widthFactor ?? target.widthFactor;\n const frame = source.frame ?? target.frame;\n const leader = source.leader ?? target.leader;\n\n const leaderShouldChange = !isLeader && !target.leaderEquals(leader);\n\n if (lineSpacingFactor !== target.lineSpacingFactor ||\n lineHeight !== target.lineHeight ||\n widthFactor !== target.widthFactor ||\n !target.frameEquals(frame) ||\n leaderShouldChange\n ) {\n const cloneProps: TextStyleSettingsProps = {\n lineSpacingFactor,\n lineHeight,\n widthFactor,\n frame,\n };\n\n if (leaderShouldChange) {\n cloneProps.leader = leader;\n }\n\n target = target.clone(cloneProps);\n }\n\n return target;\n}\n\n/**\n * Arguments used when constructing a [[TextStyleResolver]].\n * @beta\n */\nexport interface TextStyleResolverArgs {\n /** The text block whose styles are being resolved. */\n textBlock: TextBlock;\n /** The ID of the [[AnnotationTextStyle]] to apply. */\n textStyleId: Id64String;\n /** The iModel from which to obtain [[AnnotationTextStyle]]s when resolving styles. */\n iModel: IModelDb;\n /** @internal chiefly for tests, by default looks up an [[AnnotationTextStyle]] in the iModel by ID. */\n findTextStyle?: FindTextStyle;\n}\n\n/**\n * Resolves the effective style of TextBlockComponents and Leaders, taking into account overrides of the instance and its parent(s).\n * @beta\n */\nexport class TextStyleResolver {\n /** The resolved style of the TextBlock. */\n public readonly blockSettings: TextStyleSettings;\n\n public constructor(args: TextStyleResolverArgs) {\n const findTextStyle = args.findTextStyle ?? createFindTextStyleImpl(args.iModel);\n this.blockSettings = findTextStyle(args.textStyleId);\n\n if (args.textBlock.styleOverrides)\n this.blockSettings = this.blockSettings.clone(args.textBlock.styleOverrides);\n }\n\n /**\n * Resolves the effective text style settings for a given TextBlockComponent, applying block-level overrides.\n */\n public resolveSettings(overrides: TextStyleSettingsProps, isLeader: boolean = false): TextStyleSettings {\n let settings = this.blockSettings;\n\n if (overrides)\n settings = settings.clone(overrides);\n\n return applyBlockSettings(settings, this.blockSettings, isLeader);\n }\n\n public resolveMarkerText(overrides: TextStyleSettingsProps, index: number): string {\n const markerSettings = overrides.listMarker ?? this.blockSettings.listMarker;\n return getMarkerText(markerSettings, index);\n }\n\n /**\n * Computes the indentation based on its style and nesting depth.\n */\n public resolveIndentation(styleOverrides: TextStyleSettingsProps, depth: number): number {\n const overrides = this.resolveSettings(styleOverrides);\n const indentation = overrides.indentation;\n const tabInterval = overrides.tabInterval;\n return indentation + tabInterval * depth;\n }\n}\n\nclass LayoutContext {\n private readonly _fontIds = new Map<string, FontId>();\n\n public constructor(public readonly textStyleResolver: TextStyleResolver, private readonly _computeTextRange: ComputeRangesForTextLayout, private readonly _findFontId: FindFontId) { }\n\n public findFontId(name: string): FontId {\n let fontId = this._fontIds.get(name);\n if (undefined === fontId) {\n this._fontIds.set(name, fontId = this._findFontId(name));\n }\n\n return fontId;\n }\n\n public computeRangeForText(chars: string, style: TextStyleSettings, baselineShift: BaselineShift): TextLayoutRanges {\n if (chars.length === 0) {\n return {\n layout: new Range2d(0, 0, 0, style.lineHeight),\n justification: new Range2d(),\n };\n }\n\n const fontId = this.findFontId(style.fontName);\n const { layout, justification } = this._computeTextRange({\n chars,\n fontId,\n baselineShift,\n bold: style.isBold,\n italic: style.isItalic,\n lineHeight: this.textStyleResolver.blockSettings.lineHeight,\n widthFactor: this.textStyleResolver.blockSettings.widthFactor,\n });\n\n if (\"none\" !== baselineShift) {\n const isSub = \"subscript\" === baselineShift;\n const scale = isSub ? style.subScriptScale : style.superScriptScale;\n const offsetFactor = isSub ? style.subScriptOffsetFactor : style.superScriptOffsetFactor;\n const offset = { x: 0, y: style.lineHeight * offsetFactor };\n\n scaleRange(layout, scale);\n layout.cloneTranslated(offset, layout);\n\n scaleRange(justification, scale);\n justification.cloneTranslated(offset, justification);\n }\n\n return { layout, justification };\n }\n\n public computeRangeForTextRun(style: TextStyleSettings, run: TextRun | FieldRun, charOffset: number, numChars: number): TextLayoutRanges {\n let content: string;\n let baselineShift: BaselineShift;\n\n if (run.type === \"text\") {\n content = run.content;\n baselineShift = run.baselineShift;\n } else {\n content = run.cachedContent;\n baselineShift = \"none\";\n }\n\n return this.computeRangeForText(content.substring(charOffset, charOffset + numChars), style, baselineShift);\n }\n\n public computeRangeForFractionRun(style: TextStyleSettings, source: FractionRun): { layout: Range2d, numerator: Range2d, denominator: Range2d } {\n const numerator = this.computeRangeForText(source.numerator, style, \"none\").layout;\n scaleRange(numerator, style.stackedFractionScale);\n\n const denominator = this.computeRangeForText(source.denominator, style, \"none\").layout;\n scaleRange(denominator, style.stackedFractionScale);\n\n const numLen = numerator.xLength();\n const denomLen = denominator.xLength();\n switch (style.stackedFractionType) {\n case \"horizontal\": {\n if (numLen > denomLen) {\n denominator.cloneTranslated({ x: (numLen - denomLen) / 2, y: 0 }, denominator);\n } else {\n numerator.cloneTranslated({ x: (denomLen - numLen) / 2, y: 0 }, numerator);\n }\n\n numerator.cloneTranslated({ x: 0, y: 1.5 * denominator.yLength() }, numerator);\n break;\n }\n case \"diagonal\": {\n numerator.cloneTranslated({ x: 0, y: denominator.yLength() }, numerator);\n denominator.cloneTranslated({ x: numLen, y: 0 }, denominator);\n break;\n }\n }\n\n const layout = numerator.clone();\n layout.extendRange(denominator);\n return { layout, numerator, denominator };\n }\n\n public computeRangeForTabRun(style: TextStyleSettings, source: TabRun, lengthFromLastTab: number): Range2d {\n const interval = source.styleOverrides.tabInterval ?? style.tabInterval;\n const tabEndX = interval - lengthFromLastTab % interval;\n\n const range = new Range2d(0, 0, 0, style.lineHeight);\n range.extendXY(tabEndX, range.low.y);\n\n return range;\n }\n}\n\ninterface Segment {\n segment: string;\n index: number;\n}\n\nfunction split(source: string): Segment[] {\n if (source.length === 0) {\n return [];\n }\n\n let index = 0;\n const segments: Segment[] = [];\n const breaker = new LineBreaker(source);\n for (let brk = breaker.nextBreak(); brk; brk = breaker.nextBreak()) {\n segments.push({\n segment: source.slice(index, brk.position),\n index,\n });\n\n index = brk.position;\n }\n\n return segments;\n}\n\nfunction applyTabShift(run: RunLayout, parent: LineLayout, context: LayoutContext): void {\n if (run.source.type === \"tab\") {\n run.range.setFrom(context.computeRangeForTabRun(run.style, run.source, parent.lengthFromLastTab));\n }\n}\n\n/**\n * Represents the layout of a single run (text, fraction, or line break) within a line of text.\n * Stores information about the run's position, style, and font within the line.\n * Provides utilities for splitting text runs for word wrapping and converting to result objects.\n * @beta\n */\nexport class RunLayout {\n public source: Run;\n public charOffset: number;\n public numChars: number;\n public range: Range2d;\n public justificationRange?: Range2d;\n public denominatorRange?: Range2d;\n public numeratorRange?: Range2d;\n public offsetFromLine: { x: number, y: number };\n public style: TextStyleSettings;\n public fontId: FontId;\n\n private constructor(props: NonFunctionPropertiesOf<RunLayout>) {\n this.source = props.source;\n this.charOffset = props.charOffset;\n this.numChars = props.numChars;\n this.range = props.range;\n this.justificationRange = props.justificationRange;\n this.denominatorRange = props.denominatorRange;\n this.numeratorRange = props.numeratorRange;\n this.offsetFromLine = props.offsetFromLine;\n this.style = props.style;\n this.fontId = props.fontId;\n }\n\n public static create(source: Run, context: LayoutContext, cumulativeOverrides: TextStyleSettingsProps): RunLayout {\n const style = context.textStyleResolver.resolveSettings(cumulativeOverrides);\n const fontId = context.findFontId(style.fontName);\n const charOffset = 0;\n const offsetFromLine = { x: 0, y: 0 };\n let numChars = 0;\n\n let range, justificationRange, numeratorRange, denominatorRange;\n\n switch (source.type) {\n case \"field\":\n case \"text\": {\n const content = source.type === \"text\" ? source.content : source.cachedContent;\n numChars = content.length;\n const ranges = context.computeRangeForTextRun(style, source, charOffset, numChars);\n range = ranges.layout;\n justificationRange = ranges.justification;\n break;\n }\n case \"fraction\": {\n numChars = 1;\n const ranges = context.computeRangeForFractionRun(style, source);\n range = ranges.layout;\n numeratorRange = ranges.numerator;\n denominatorRange = ranges.denominator;\n break;\n }\n default: { // \"linebreak\" or \"tab\"\n // \"tab\": Tabs rely on the context they are in, so we compute its range later.\n // lineBreak: We do this so that blank lines space correctly without special casing later.\n range = new Range2d(0, 0, 0, style.lineHeight);\n break;\n }\n }\n\n return new RunLayout({ source, charOffset, numChars, range, justificationRange, denominatorRange, numeratorRange, offsetFromLine, style, fontId });\n }\n\n /** Compute a string representation, primarily for debugging purposes. */\n public stringify(): string {\n return this.source.type === \"text\" ? this.source.content.substring(this.charOffset, this.charOffset + this.numChars) : this.source.stringify();\n }\n\n public canWrap(): this is { source: TextRun } {\n return this.source.type === \"text\";\n }\n\n private cloneForWrap(args: { ranges: TextLayoutRanges, charOffset: number, numChars: number }): RunLayout {\n assert(this.canWrap());\n\n return new RunLayout({\n ...this,\n charOffset: args.charOffset,\n numChars: args.numChars,\n range: args.ranges.layout,\n justificationRange: args.ranges.justification,\n offsetFromLine: { ...this.offsetFromLine },\n });\n }\n\n public split(context: LayoutContext): RunLayout[] {\n assert(this.charOffset === 0, \"cannot re-split a run\");\n if (!this.canWrap() || this.charOffset > 0) {\n return [this];\n }\n\n const myText = this.source.content.substring(this.charOffset, this.charOffset + this.numChars);\n const segments = split(myText);\n\n if (segments.length <= 1) {\n return [this];\n }\n\n return segments.map((segment: any) => {\n return this.cloneForWrap({\n ranges: context.computeRangeForText(segment.segment, this.style, this.source.baselineShift),\n charOffset: segment.index,\n numChars: segment.segment.length,\n });\n });\n }\n\n public toResult(): RunLayoutResult {\n const result: RunLayoutResult = {\n fontId: this.fontId,\n characterOffset: this.charOffset,\n characterCount: this.numChars,\n range: this.range.toJSON(),\n offsetFromLine: this.offsetFromLine,\n textStyle: this.style.toJSON(),\n };\n\n if (this.justificationRange) {\n result.justificationRange = this.justificationRange.toJSON();\n }\n\n if (this.numeratorRange) {\n result.numeratorRange = this.numeratorRange.toJSON();\n }\n\n if (this.denominatorRange) {\n result.denominatorRange = this.denominatorRange.toJSON();\n }\n\n return result;\n }\n}\n\n/**\n * Represents the layout of a single line within a paragraph of a text block.\n * Contains a sequence of RunLayout objects, the computed range of the line, and its offset from the document origin.\n * Provides utilities for appending runs, computing ranges, and converting to result objects.\n * @beta\n */\nexport class LineLayout {\n public source: List | Run | Paragraph;\n public range = new Range2d(0, 0, 0, 0);\n public runRange = new Range2d(0, 0, 0, 0); // Range of all runs excluding marker.\n public justificationRange = new Range2d(0, 0, 0, 0);\n public offsetFromDocument: WritableXAndY;\n public depth: number;\n public lengthFromLastTab = 0; // Used to track the length from the last tab for tab runs.\n private _runs: RunLayout[] = [];\n private _marker?: RunLayout;\n\n public constructor(source: List | Run | Paragraph, style: TextStyleSettingsProps, context?: LayoutContext, depth: number = 0) {\n this.source = source;\n this.depth = depth;\n this.offsetFromDocument = { x: context?.textStyleResolver.resolveIndentation(style, depth) ?? 0, y: 0 };\n }\n\n /** Compute a string representation, primarily for debugging purposes. */\n public stringify(): string {\n const runs = this._runs.map((run) => run.stringify());\n return `${runs.join(\"\")}`;\n }\n\n /** Gets the array of RunLayout objects contained in this line. */\n public get runs(): ReadonlyArray<RunLayout> { return this._runs; }\n /** Indicates whether this line contains any runs. */\n public get isEmpty() { return this._runs.length === 0; }\n /** Gets the last RunLayout in this line. */\n public get back(): RunLayout {\n assert(!this.isEmpty);\n return this._runs[this._runs.length - 1];\n }\n\n /**\n * Gets or sets the marker RunLayout for this line, used for lists.\n * A marker is the symbol or character that appears before each list item in a list, bullets, numbers, etc.\n * */\n public get marker(): RunLayout | undefined { return this._marker; }\n public set marker(value: RunLayout | undefined) { this._marker = value; }\n\n public append(run: RunLayout): void {\n this._runs.push(run);\n this.computeRanges();\n }\n\n /** Invoked every time a run is appended,. */\n private computeRanges(): void {\n this.runRange.low.setZero();\n this.runRange.high.setZero();\n this.lengthFromLastTab = 0;\n\n // Some runs (fractions) are taller than others.\n // We want to center each run vertically inside the line.\n let lineHeight = 0;\n for (const run of this._runs) {\n lineHeight = Math.max(lineHeight, run.range.yLength());\n }\n\n for (const run of this._runs) {\n const runHeight = run.range.yLength();\n const runOffset = { x: this.runRange.high.x, y: (lineHeight - runHeight) / 2 };\n run.offsetFromLine = runOffset;\n\n const runLayoutRange = run.range.cloneTranslated(runOffset);\n this.runRange.extendRange(runLayoutRange);\n\n if (\"linebreak\" !== run.source.type) {\n const runJustificationRange = run.justificationRange?.cloneTranslated(runOffset);\n this.justificationRange.extendRange(runJustificationRange ?? runLayoutRange);\n }\n\n if (\"tab\" === run.source.type) {\n this.lengthFromLastTab = 0;\n } else {\n this.lengthFromLastTab += run.range.xLength();\n }\n }\n\n this.range.setFrom(this.runRange);\n\n if (this._marker) {\n const indentation = this.range.low.x;\n const x = indentation - (this._marker.style.tabInterval / 2) - this._marker.range.xLength();\n const runHeight = this._marker.range.yLength();\n const runOffset = {\n x,\n y: (lineHeight - runHeight) / 2 // Center the marker vertically in the line.\n };\n\n this._marker.offsetFromLine = runOffset;\n\n const markerRange = this._marker.range.cloneTranslated(this._marker.offsetFromLine);\n this.range.extendRange(markerRange);\n }\n }\n\n public toResult(): LineLayoutResult {\n return {\n runs: this.runs.map((x) => x.toResult()),\n marker: this.marker?.toResult(),\n range: this.range.toJSON(),\n justificationRange: this.justificationRange.toJSON(),\n offsetFromDocument: this.offsetFromDocument,\n };\n }\n}\n\n/**\n * Describes the layout of a text block as a collection of lines containing runs.\n * Computes the visual layout of the text block, including word wrapping, justification, and margins.\n * Provides access to the computed lines, ranges, and utilities for converting to result objects.\n * @beta\n */\nexport class TextBlockLayout {\n public source: TextBlock;\n\n /** @internal: This is primarily for debugging purposes. This is the range of text geometry */\n public textRange = new Range2d();\n\n /** The range including margins of the [[TextBlock]]. */\n public range = new Range2d();\n public lines: LineLayout[] = [];\n private _context: LayoutContext;\n\n public constructor(source: TextBlock, context: LayoutContext) {\n this._context = context;\n this.source = source;\n\n if (source.width > 0) {\n this.textRange.low.x = 0;\n this.textRange.high.x = source.width;\n }\n\n this.populateLines(context);\n this.justifyLines();\n this.applyMargins(source.margins);\n }\n\n public toResult(): TextBlockLayoutResult {\n return {\n lines: this.lines.map((x) => x.toResult()),\n range: this.range.toJSON(),\n };\n }\n\n /** Compute a string representation, primarily for debugging purposes. */\n public stringify(): string {\n return this.lines.map((line) => line.stringify()).join(\"\\n\");\n }\n\n private get _back(): LineLayout {\n assert(this.lines.length > 0);\n return this.lines[this.lines.length - 1];\n }\n\n private populateLines(context: LayoutContext): void {\n const doc = this.source;\n if (!doc.children || doc.children.length === 0) {\n return;\n }\n\n let curLine = new LineLayout(doc.children[0], doc.children[0].styleOverrides, context);\n let childIndex = 0;\n for (const child of doc.children) {\n curLine = this.populateComponent(child, childIndex++, context, doc.width, curLine, doc, doc.styleOverrides);\n }\n\n if (curLine.runs.length > 0) {\n this.flushLine(context, curLine, doc.styleOverrides);\n }\n }\n\n private populateComponent(\n component: Run | Paragraph | List,\n componentIndex: number,\n context: LayoutContext,\n docWidth: number,\n curLine: LineLayout,\n parent: StructuralTextBlockComponent,\n cumulativeOverrides: TextStyleSettingsProps,\n depth: number = 0\n ): LineLayout {\n cumulativeOverrides = { ...cumulativeOverrides, ...component.styleOverrides };\n\n switch (component.type) {\n case \"list\": {\n // If we have any runs in the current line, flush it before starting the list.\n if (curLine.runs.length > 0) {\n curLine = this.flushLine(context, curLine, cumulativeOverrides, component.children[0], true, depth + 1);\n } else {\n // If not, we need to apply the indentation for the list to the first line.\n curLine.offsetFromDocument.x = context.textStyleResolver.resolveIndentation(cumulativeOverrides, depth + 1);\n curLine.depth = depth + 1;\n }\n\n // Iterate through each list item, setting the marker and populating its contents.\n component.children.forEach((child, index) => {\n const markerContent = context.textStyleResolver.resolveMarkerText(cumulativeOverrides, index + 1);\n const markerRun = TextRun.create({ content: markerContent });\n curLine.marker = RunLayout.create(markerRun, context, cumulativeOverrides);\n\n curLine = this.populateComponent(child, index, context, docWidth, curLine, component, cumulativeOverrides, depth + 1);\n });\n\n // Lastly flush the line.\n const nextSibling = parent?.children[componentIndex + 1];\n if (curLine && nextSibling) {\n curLine = this.flushLine(context, curLine, cumulativeOverrides, nextSibling, true, depth);\n }\n break;\n }\n case \"paragraph\": {\n // Iterate through each paragraph child (either a list or a run), populating its contents.\n component.children.forEach((child, index) => {\n curLine = this.populateComponent(child, index, context, docWidth, curLine, component, cumulativeOverrides, depth);\n });\n\n // Lastly flush the line.\n const nextSibling = parent?.children[componentIndex + 1];\n if (curLine && nextSibling) {\n curLine = this.flushLine(context, curLine, cumulativeOverrides, nextSibling, true, depth);\n }\n break;\n }\n case \"text\": {\n const layout = RunLayout.create(component, context, cumulativeOverrides);\n\n // Text can be word-wrapped, so we need to split it into multiple runs if necessary.\n if (docWidth > 0) {\n layout.split(context).forEach(r => { curLine = this.populateRun(curLine, r, context, cumulativeOverrides, docWidth) });\n } else {\n curLine = this.populateRun(curLine, layout, context, cumulativeOverrides, docWidth);\n }\n break;\n }\n case \"fraction\":\n case \"tab\": {\n const layout = RunLayout.create(component, context, cumulativeOverrides);\n curLine = this.populateRun(curLine, layout, context, cumulativeOverrides, docWidth);\n break;\n }\n case \"linebreak\": {\n const layout = RunLayout.create(component, context, cumulativeOverrides);\n\n curLine.append(layout);\n curLine = this.flushLine(context, curLine, cumulativeOverrides, undefined, undefined, depth);\n break;\n }\n default: break;\n }\n\n return curLine;\n };\n\n private populateRun(curLine: LineLayout, run: RunLayout, context: LayoutContext, cumulativeOverrides: TextStyleSettingsProps, docWidth: number): LineLayout {\n // If this is a tab, we need to apply the tab shift first, and then we can treat it like a text run.\n applyTabShift(run, curLine, context);\n\n // If our width is not set, then we don't have to compute word wrapping, so just append the run, and continue.\n if (docWidth <= 0) {\n curLine.append(run);\n return curLine;\n }\n\n // If not, we need to determine if we can append this run to the current line without exceeding the document width or if we need to word wrap.\n const runWidth = run.justificationRange?.xLength() ?? run.range.xLength();\n const lineWidth = curLine.runRange.xLength();\n const newWidth = runWidth + lineWidth + curLine.offsetFromDocument.x;\n\n // If true, then no word wrapping is required, so we can append to the current line.\n if (newWidth < docWidth || Geometry.isAlmostEqualNumber(newWidth, docWidth, Geometry.smallMetricDistance)) {\n curLine.append(run);\n return curLine;\n }\n\n // If not, do word wrapping\n if (curLine.runs.length === 0) {\n curLine.append(run);\n\n // Lastly, flush line\n curLine = this.flushLine(context, curLine, cumulativeOverrides, undefined, undefined, curLine.depth);\n } else {\n // First, flush line\n curLine = this.flushLine(context, curLine, cumulativeOverrides, undefined, undefined, curLine.depth);\n\n // Recompute tab shift if applicable\n applyTabShift(run, curLine, context);\n\n curLine.append(run);\n }\n\n return curLine;\n };\n\n private flushLine(context: LayoutContext, curLine: LineLayout, cumulativeOverrides: TextStyleSettingsProps, next?: List | Run | Paragraph, newParagraph: boolean = false, depth: number = 0): LineLayout {\n next = next ?? curLine.source;\n\n // We want to guarantee that each layout line has at least one run.\n if (curLine.runs.length === 0) {\n if (this.lines.length === 0 || this._back.runs.length === 0) {\n return new LineLayout(next, cumulativeOverrides, context, depth);\n }\n\n if (curLine.source.type !== \"linebreak\") {\n const newLine = new LineLayout(next, cumulativeOverrides, context, depth);\n newLine.offsetFromDocument.y -= context.textStyleResolver.blockSettings.paragraphSpacingFactor * context.textStyleResolver.blockSettings.lineHeight;\n return newLine;\n }\n\n const run = curLine.source.clone();\n curLine.append(RunLayout.create(run, context, cumulativeOverrides));\n }\n\n // Line origin is its baseline.\n const lineOffset = { ...curLine.offsetFromDocument }; // Start with the line's original offset, which includes indentation.\n lineOffset.y -= curLine.range.yLength(); // Shift down the baseline\n\n // Place it below any existing lines\n if (this.lines.length > 0) {\n lineOffset.y += this._back.offsetFromDocument.y;\n lineOffset.y -= context.textStyleResolver.blockSettings.lineSpacingFactor * context.textStyleResolver.blockSettings.lineHeight;\n }\n\n curLine.offsetFromDocument = lineOffset;\n\n // Update document range from computed line range and position\n this.textRange.extendRange(curLine.range.cloneTranslated(lineOffset));\n\n this.lines.push(curLine);\n if (newParagraph) {\n const newLine = new LineLayout(next, cumulativeOverrides, context, depth);\n newLine.offsetFromDocument.y -= context.textStyleResolver.blockSettings.paragraphSpacingFactor * context.textStyleResolver.blockSettings.lineHeight;\n return newLine;\n }\n return new LineLayout(next, cumulativeOverrides, context, depth);\n }\n\n private justifyLines(): void {\n // We don't want to justify empty text, or a single line of text whose width is 0. By default text is already left justified.\n if (this.lines.length < 1 || (this.lines.length === 1 && this.source.width === 0) || \"left\" === this.source.justification) {\n return;\n }\n\n // This is the minimum width of the document's bounding box.\n const docWidth = this.source.width;\n\n let minOffset = Number.MAX_VALUE;\n for (const line of this.lines) {\n const lineWidth = line.justificationRange.xLength() + line.offsetFromDocument.x;\n\n let offset = docWidth - lineWidth;\n if (\"center\" === this.source.justification) {\n offset = offset / 2;\n }\n\n line.offsetFromDocument.x += offset;\n minOffset = Math.min(offset, minOffset);\n }\n\n if (minOffset < 0) {\n // Shift left to accommodate lines that exceeded the document's minimum width.\n this.textRange.low.x += minOffset;\n this.textRange.high.x += minOffset;\n }\n }\n\n private applyMargins(margins: TextBlockMargins) {\n this.range = this.textRange.clone();\n\n if (this.range.isNull)\n return;\n\n // Disregard negative margins.\n const right = margins.right >= 0 ? margins.right : 0;\n const left = margins.left >= 0 ? margins.left : 0;\n const top = margins.top >= 0 ? margins.top : 0;\n const bottom = margins.bottom >= 0 ? margins.bottom : 0;\n\n const xHigh = this.textRange.high.x + right;\n const yHigh = this.textRange.high.y + top;\n const xLow = this.textRange.low.x - left;\n const yLow = this.textRange.low.y - bottom;\n\n this.range.extendXY(xHigh, yHigh);\n this.range.extendXY(xLow, yLow);\n }\n}\n"]}
|
|
@@ -62,7 +62,7 @@ class ChannelAdmin {
|
|
|
62
62
|
}
|
|
63
63
|
[Symbols_1._verifyChannel](modelId) {
|
|
64
64
|
// Note: indirect changes are permitted to change any channel
|
|
65
|
-
if (this._allowedModels.has(modelId) || this._iModel[Symbols_1._nativeDb].
|
|
65
|
+
if (this._allowedModels.has(modelId) || this._iModel[Symbols_1._nativeDb].getTxnMode() === "indirect")
|
|
66
66
|
return;
|
|
67
67
|
const deniedChannel = this._deniedModels.get(modelId);
|
|
68
68
|
if (undefined !== deniedChannel)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChannelAdmin.js","sourceRoot":"","sources":["../../../src/internal/ChannelAdmin.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;AAgIH,oDAEC;AAhID,sDAAyE;AACzE,oDAAsG;AACtG,sDAA+D;AAC/D,wCAAqC;AAErC,8CAA2C;AAC3C,uCAAiF;AAEjF,MAAM,YAAY;IAQW;IAPpB,MAAM,CAAU,gBAAgB,GAAG,uBAAuB,CAAC;IAElD,CAAC,mCAAyB,CAAC,GAAG,SAAS,CAAC;IAChD,gBAAgB,GAAG,IAAI,GA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QACjI,IAAI,CAAC,eAAe,CAAC,EAAE,SAAS,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC;QACjE,OAAO,SAAS,CAAC;IACnB,CAAC;IAEM,gBAAgB,CAAC,UAAsB;QAC5C,IAAI,UAAU,KAAK,+BAAc,CAAC,iBAAiB;YACjD,oEAAoE;YACpE,OAAO,oBAAM,CAAC,aAAa,CAAC;QAE9B,IAAI,CAAC;YACH,4DAA4D;YAC5D,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,qBAAqB,CAAC,0BAA0B,YAAY,CAAC,gBAAgB,gBAAgB,EAAE,CAAC,IAAI,EAAE,EAAE;gBACvI,IAAI,CAAC,UAAU,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC;gBAC/B,OAAO,uBAAQ,CAAC,aAAa,KAAK,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;YACvF,CAAC,CAAC,CAAC;YAEH,OAAO,WAAW,CAAC;QACrB,CAAC;QAAC,MAAM,CAAC;YACP,8HAA8H;YAC9H,+EAA+E;YAC/E,OAAO,SAAS,CAAC;QACnB,CAAC;IAEH,CAAC;;AAGH,SAAgB,oBAAoB,CAAC,MAAgB;IACnD,OAAO,IAAI,YAAY,CAAC,MAAM,CAAC,CAAC;AAClC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Elements\n */\n\nimport { DbResult, Id64String, IModelStatus } from \"@itwin/core-bentley\";\nimport { ChannelControlError, ChannelRootAspectProps, IModel, IModelError } from \"@itwin/core-common\";\nimport { ChannelControl, ChannelKey } from \"../ChannelControl\";\nimport { Subject } from \"../Element\";\nimport { IModelDb } from \"../IModelDb\";\nimport { IModelHost } from \"../IModelHost\";\nimport { _implementationProhibited, _nativeDb, _verifyChannel } from \"./Symbols\";\n\nclass ChannelAdmin implements ChannelControl {\n public static readonly channelClassName = \"bis:ChannelRootAspect\";\n\n public readonly [_implementationProhibited] = undefined;\n private _allowedChannels = new Set<ChannelKey>();\n private _allowedModels = new Set<Id64String>();\n private _deniedModels = new Map<Id64String, ChannelKey>();\n\n public constructor(private _iModel: IModelDb) {\n // for backwards compatibility, allow the shared channel unless explicitly turned off in IModelHostOptions.\n if (IModelHost.configuration?.allowSharedChannel !== false)\n this._allowedChannels.add(ChannelControl.sharedChannelName);\n }\n\n public addAllowedChannel(channelKey: ChannelKey) {\n this._allowedChannels.add(channelKey);\n this._deniedModels.clear();\n }\n\n public removeAllowedChannel(channelKey: ChannelKey) {\n this._allowedChannels.delete(channelKey);\n this._allowedModels.clear();\n }\n\n public getChannelKey(elementId: Id64String): ChannelKey {\n if (elementId === IModel.rootSubjectId)\n return ChannelControl.sharedChannelName;\n\n try {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n const channel = this._iModel.withPreparedStatement(`SELECT Owner FROM ${ChannelAdmin.channelClassName} WHERE Element.Id=?`, (stmt) => {\n stmt.bindId(1, elementId);\n return DbResult.BE_SQLITE_ROW === stmt.step() ? stmt.getValue(0).getString() : undefined;\n });\n\n if (channel !== undefined)\n return channel;\n } catch {\n // Exception happens if the iModel is too old: ChannelRootAspect class not present in the BisCore schema (older than v1.0.10).\n // In that case all data in such iModel is assumed to be in the shared channel.\n return ChannelControl.sharedChannelName;\n }\n\n const parentId = this._iModel.withPreparedSqliteStatement(\"SELECT ParentId,ModelId FROM bis_Element WHERE id=?\", (stmt) => {\n stmt.bindId(1, elementId);\n if (DbResult.BE_SQLITE_ROW !== stmt.step())\n throw new IModelError(IModelStatus.NotFound, \"Element does not exist\");\n return stmt.getValueId(0) ?? stmt.getValueId(1); // if parent is undefined, use modelId\n });\n\n return this.getChannelKey(parentId);\n }\n\n public [_verifyChannel](modelId: Id64String): void {\n // Note: indirect changes are permitted to change any channel\n if (this._allowedModels.has(modelId) || this._iModel[_nativeDb].isIndirectChanges())\n return;\n\n const deniedChannel = this._deniedModels.get(modelId);\n if (undefined !== deniedChannel)\n ChannelControlError.throwError(\"not-allowed\", `Channel ${deniedChannel} is not allowed`, deniedChannel);\n\n const channel = this.getChannelKey(modelId);\n if (this._allowedChannels.has(channel)) {\n this._allowedModels.add(modelId);\n return;\n }\n\n this._deniedModels.set(modelId, channel);\n return this[_verifyChannel](modelId);\n }\n\n public makeChannelRoot(args: { elementId: Id64String, channelKey: ChannelKey }) {\n const channelKey = this.getChannelKey(args.elementId);\n if (ChannelControl.sharedChannelName !== channelKey)\n ChannelControlError.throwError(\"may-not-nest\", `Channel ${channelKey} may not nest`, channelKey);\n\n if (this.queryChannelRoot(args.channelKey) !== undefined)\n ChannelControlError.throwError(\"root-exists\", `Channel ${args.channelKey} root already exist`, channelKey);\n\n const props: ChannelRootAspectProps = { classFullName: ChannelAdmin.channelClassName, element: { id: args.elementId }, owner: args.channelKey };\n this._iModel.elements.insertAspect(props);\n }\n\n public insertChannelSubject(args: { subjectName: string, channelKey: ChannelKey, parentSubjectId?: Id64String, description?: string }): Id64String {\n // Check if channelKey already exists before inserting Subject.\n // makeChannelRoot will check that again, but at that point the new Subject is already inserted.\n // Prefer to check twice instead of deleting the Subject in the latter option.\n if (this.queryChannelRoot(args.channelKey) !== undefined)\n ChannelControlError.throwError(\"root-exists\", `Channel ${args.channelKey} root already exist`, args.channelKey);\n\n const elementId = Subject.insert(this._iModel, args.parentSubjectId ?? IModel.rootSubjectId, args.subjectName, args.description);\n this.makeChannelRoot({ elementId, channelKey: args.channelKey });\n return elementId;\n }\n\n public queryChannelRoot(channelKey: ChannelKey): Id64String | undefined {\n if (channelKey === ChannelControl.sharedChannelName)\n // RootSubject acts as the ChannelRoot element of the shared channel\n return IModel.rootSubjectId;\n\n try {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n const channelRoot = this._iModel.withPreparedStatement(`SELECT Element.Id FROM ${ChannelAdmin.channelClassName} WHERE Owner=?`, (stmt) => {\n stmt.bindString(1, channelKey);\n return DbResult.BE_SQLITE_ROW === stmt.step() ? stmt.getValue(0).getId() : undefined;\n });\n\n return channelRoot;\n } catch {\n // Exception happens if the iModel is too old: ChannelRootAspect class not present in the BisCore schema (older than v1.0.10).\n // In that case all data in such iModel is assumed to be in the shared channel.\n return undefined;\n }\n\n }\n}\n\nexport function createChannelControl(iModel: IModelDb): ChannelAdmin {\n return new ChannelAdmin(iModel);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ChannelAdmin.js","sourceRoot":"","sources":["../../../src/internal/ChannelAdmin.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;AAgIH,oDAEC;AAhID,sDAAyE;AACzE,oDAAsG;AACtG,sDAA+D;AAC/D,wCAAqC;AAErC,8CAA2C;AAC3C,uCAAiF;AAEjF,MAAM,YAAY;IAQW;IAPpB,MAAM,CAAU,gBAAgB,GAAG,uBAAuB,CAAC;IAElD,CAAC,mCAAyB,CAAC,GAAG,SAAS,CAAC;IAChD,gBAAgB,GAAG,IAAI,GAAG,EAAc,CAAC;IACzC,cAAc,GAAG,IAAI,GAAG,EAAc,CAAC;IACvC,aAAa,GAAG,IAAI,GAAG,EAA0B,CAAC;IAE1D,YAA2B,OAAiB;QAAjB,YAAO,GAAP,OAAO,CAAU;QAC1C,2GAA2G;QAC3G,IAAI,uBAAU,CAAC,aAAa,EAAE,kBAAkB,KAAK,KAAK;YACxD,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,+BAAc,CAAC,iBAAiB,CAAC,CAAC;IAChE,CAAC;IAEM,iBAAiB,CAAC,UAAsB;QAC7C,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;QACtC,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,CAAC;IAC7B,CAAC;IAEM,oBAAoB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C,CAAC;gBAC/B,OAAO,uBAAQ,CAAC,aAAa,KAAK,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;YACvF,CAAC,CAAC,CAAC;YAEH,OAAO,WAAW,CAAC;QACrB,CAAC;QAAC,MAAM,CAAC;YACP,8HAA8H;YAC9H,+EAA+E;YAC/E,OAAO,SAAS,CAAC;QACnB,CAAC;IAEH,CAAC;;AAGH,SAAgB,oBAAoB,CAAC,MAAgB;IACnD,OAAO,IAAI,YAAY,CAAC,MAAM,CAAC,CAAC;AAClC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Elements\n */\n\nimport { DbResult, Id64String, IModelStatus } from \"@itwin/core-bentley\";\nimport { ChannelControlError, ChannelRootAspectProps, IModel, IModelError } from \"@itwin/core-common\";\nimport { ChannelControl, ChannelKey } from \"../ChannelControl\";\nimport { Subject } from \"../Element\";\nimport { IModelDb } from \"../IModelDb\";\nimport { IModelHost } from \"../IModelHost\";\nimport { _implementationProhibited, _nativeDb, _verifyChannel } from \"./Symbols\";\n\nclass ChannelAdmin implements ChannelControl {\n public static readonly channelClassName = \"bis:ChannelRootAspect\";\n\n public readonly [_implementationProhibited] = undefined;\n private _allowedChannels = new Set<ChannelKey>();\n private _allowedModels = new Set<Id64String>();\n private _deniedModels = new Map<Id64String, ChannelKey>();\n\n public constructor(private _iModel: IModelDb) {\n // for backwards compatibility, allow the shared channel unless explicitly turned off in IModelHostOptions.\n if (IModelHost.configuration?.allowSharedChannel !== false)\n this._allowedChannels.add(ChannelControl.sharedChannelName);\n }\n\n public addAllowedChannel(channelKey: ChannelKey) {\n this._allowedChannels.add(channelKey);\n this._deniedModels.clear();\n }\n\n public removeAllowedChannel(channelKey: ChannelKey) {\n this._allowedChannels.delete(channelKey);\n this._allowedModels.clear();\n }\n\n public getChannelKey(elementId: Id64String): ChannelKey {\n if (elementId === IModel.rootSubjectId)\n return ChannelControl.sharedChannelName;\n\n try {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n const channel = this._iModel.withPreparedStatement(`SELECT Owner FROM ${ChannelAdmin.channelClassName} WHERE Element.Id=?`, (stmt) => {\n stmt.bindId(1, elementId);\n return DbResult.BE_SQLITE_ROW === stmt.step() ? stmt.getValue(0).getString() : undefined;\n });\n\n if (channel !== undefined)\n return channel;\n } catch {\n // Exception happens if the iModel is too old: ChannelRootAspect class not present in the BisCore schema (older than v1.0.10).\n // In that case all data in such iModel is assumed to be in the shared channel.\n return ChannelControl.sharedChannelName;\n }\n\n const parentId = this._iModel.withPreparedSqliteStatement(\"SELECT ParentId,ModelId FROM bis_Element WHERE id=?\", (stmt) => {\n stmt.bindId(1, elementId);\n if (DbResult.BE_SQLITE_ROW !== stmt.step())\n throw new IModelError(IModelStatus.NotFound, \"Element does not exist\");\n return stmt.getValueId(0) ?? stmt.getValueId(1); // if parent is undefined, use modelId\n });\n\n return this.getChannelKey(parentId);\n }\n\n public [_verifyChannel](modelId: Id64String): void {\n // Note: indirect changes are permitted to change any channel\n if (this._allowedModels.has(modelId) || this._iModel[_nativeDb].getTxnMode() === \"indirect\")\n return;\n\n const deniedChannel = this._deniedModels.get(modelId);\n if (undefined !== deniedChannel)\n ChannelControlError.throwError(\"not-allowed\", `Channel ${deniedChannel} is not allowed`, deniedChannel);\n\n const channel = this.getChannelKey(modelId);\n if (this._allowedChannels.has(channel)) {\n this._allowedModels.add(modelId);\n return;\n }\n\n this._deniedModels.set(modelId, channel);\n return this[_verifyChannel](modelId);\n }\n\n public makeChannelRoot(args: { elementId: Id64String, channelKey: ChannelKey }) {\n const channelKey = this.getChannelKey(args.elementId);\n if (ChannelControl.sharedChannelName !== channelKey)\n ChannelControlError.throwError(\"may-not-nest\", `Channel ${channelKey} may not nest`, channelKey);\n\n if (this.queryChannelRoot(args.channelKey) !== undefined)\n ChannelControlError.throwError(\"root-exists\", `Channel ${args.channelKey} root already exist`, channelKey);\n\n const props: ChannelRootAspectProps = { classFullName: ChannelAdmin.channelClassName, element: { id: args.elementId }, owner: args.channelKey };\n this._iModel.elements.insertAspect(props);\n }\n\n public insertChannelSubject(args: { subjectName: string, channelKey: ChannelKey, parentSubjectId?: Id64String, description?: string }): Id64String {\n // Check if channelKey already exists before inserting Subject.\n // makeChannelRoot will check that again, but at that point the new Subject is already inserted.\n // Prefer to check twice instead of deleting the Subject in the latter option.\n if (this.queryChannelRoot(args.channelKey) !== undefined)\n ChannelControlError.throwError(\"root-exists\", `Channel ${args.channelKey} root already exist`, args.channelKey);\n\n const elementId = Subject.insert(this._iModel, args.parentSubjectId ?? IModel.rootSubjectId, args.subjectName, args.description);\n this.makeChannelRoot({ elementId, channelKey: args.channelKey });\n return elementId;\n }\n\n public queryChannelRoot(channelKey: ChannelKey): Id64String | undefined {\n if (channelKey === ChannelControl.sharedChannelName)\n // RootSubject acts as the ChannelRoot element of the shared channel\n return IModel.rootSubjectId;\n\n try {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n const channelRoot = this._iModel.withPreparedStatement(`SELECT Element.Id FROM ${ChannelAdmin.channelClassName} WHERE Owner=?`, (stmt) => {\n stmt.bindString(1, channelKey);\n return DbResult.BE_SQLITE_ROW === stmt.step() ? stmt.getValue(0).getId() : undefined;\n });\n\n return channelRoot;\n } catch {\n // Exception happens if the iModel is too old: ChannelRootAspect class not present in the BisCore schema (older than v1.0.10).\n // In that case all data in such iModel is assumed to be in the shared channel.\n return undefined;\n }\n\n }\n}\n\nexport function createChannelControl(iModel: IModelDb): ChannelAdmin {\n return new ChannelAdmin(iModel);\n}\n"]}
|
|
@@ -18,4 +18,5 @@ export declare const _getHubAccess: unique symbol;
|
|
|
18
18
|
export declare const _mockCheckpoint: unique symbol;
|
|
19
19
|
export declare const _cache: unique symbol;
|
|
20
20
|
export declare const _instanceKeyCache: unique symbol;
|
|
21
|
+
export declare const _resetIModelDb: unique symbol;
|
|
21
22
|
//# sourceMappingURL=Symbols.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Symbols.d.ts","sourceRoot":"","sources":["../../../src/internal/Symbols.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,eAAO,MAAM,yBAAyB,eAAmG,CAAC;AAM1I,eAAO,MAAM,MAAM,eAA2B,CAAC;AAC/C,eAAO,MAAM,kBAAkB,eAAuC,CAAC;AACvE,eAAO,MAAM,UAAU,eAA+B,CAAC;AACvD,eAAO,MAAM,QAAQ,eAA6B,CAAC;AACnD,eAAO,MAAM,IAAI,eAAyB,CAAC;AAC3C,gBAAgB;AAChB,eAAO,MAAM,SAAS,eAA8B,CAAC;AACrD,eAAO,MAAM,gBAAgB,eAAqC,CAAC;AACnE,eAAO,MAAM,cAAc,eAAmC,CAAC;AAC/D,gBAAgB;AAChB,eAAO,MAAM,UAAU,eAA+B,CAAC;AACvD,eAAO,MAAM,aAAa,eAAkC,CAAC;AAC7D,eAAO,MAAM,aAAa,eAAkC,CAAC;AAC7D,eAAO,MAAM,eAAe,eAAoC,CAAC;AACjE,eAAO,MAAM,MAAM,eAA2B,CAAC;AAC/C,eAAO,MAAM,iBAAiB,eAAsC,CAAC"}
|
|
1
|
+
{"version":3,"file":"Symbols.d.ts","sourceRoot":"","sources":["../../../src/internal/Symbols.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,eAAO,MAAM,yBAAyB,eAAmG,CAAC;AAM1I,eAAO,MAAM,MAAM,eAA2B,CAAC;AAC/C,eAAO,MAAM,kBAAkB,eAAuC,CAAC;AACvE,eAAO,MAAM,UAAU,eAA+B,CAAC;AACvD,eAAO,MAAM,QAAQ,eAA6B,CAAC;AACnD,eAAO,MAAM,IAAI,eAAyB,CAAC;AAC3C,gBAAgB;AAChB,eAAO,MAAM,SAAS,eAA8B,CAAC;AACrD,eAAO,MAAM,gBAAgB,eAAqC,CAAC;AACnE,eAAO,MAAM,cAAc,eAAmC,CAAC;AAC/D,gBAAgB;AAChB,eAAO,MAAM,UAAU,eAA+B,CAAC;AACvD,eAAO,MAAM,aAAa,eAAkC,CAAC;AAC7D,eAAO,MAAM,aAAa,eAAkC,CAAC;AAC7D,eAAO,MAAM,eAAe,eAAoC,CAAC;AACjE,eAAO,MAAM,MAAM,eAA2B,CAAC;AAC/C,eAAO,MAAM,iBAAiB,eAAsC,CAAC;AACrE,eAAO,MAAM,cAAc,eAAmC,CAAC"}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* @module Workspace
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports._instanceKeyCache = exports._cache = exports._mockCheckpoint = exports._getHubAccess = exports._setHubAccess = exports._hubAccess = exports._verifyChannel = exports._releaseAllLocks = exports._nativeDb = exports._key = exports._getData = exports._faceProps = exports._elementWasCreated = exports._close = exports._implementationProhibited = void 0;
|
|
10
|
+
exports._resetIModelDb = exports._instanceKeyCache = exports._cache = exports._mockCheckpoint = exports._getHubAccess = exports._setHubAccess = exports._hubAccess = exports._verifyChannel = exports._releaseAllLocks = exports._nativeDb = exports._key = exports._getData = exports._faceProps = exports._elementWasCreated = exports._close = exports._implementationProhibited = void 0;
|
|
11
11
|
exports._implementationProhibited = Symbol.for("Implementations of this interface can only be obtained from the containing package");
|
|
12
12
|
function sym(name) {
|
|
13
13
|
return `${name}_core-backend_INTERNAL_ONLY_DO_NOT_USE`;
|
|
@@ -28,4 +28,5 @@ exports._getHubAccess = Symbol.for(sym("getHubAccess"));
|
|
|
28
28
|
exports._mockCheckpoint = Symbol.for(sym("mockCheckpoint"));
|
|
29
29
|
exports._cache = Symbol.for(sym("cache"));
|
|
30
30
|
exports._instanceKeyCache = Symbol.for(sym("instanceKeyCache"));
|
|
31
|
+
exports._resetIModelDb = Symbol.for(s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QAAA,aAAa,GAAG,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC,CAAC;AAChD,QAAA,eAAe,GAAG,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC,CAAC;AACpD,QAAA,MAAM,GAAG,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;AAClC,QAAA,iBAAiB,GAAG,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Workspace\n */\n\nexport const _implementationProhibited = Symbol.for(\"Implementations of this interface can only be obtained from the containing package\");\n\nfunction sym(name: string): string {\n return `${name}_core-backend_INTERNAL_ONLY_DO_NOT_USE`;\n}\n\nexport const _close = Symbol.for(sym(\"close\"));\nexport const _elementWasCreated = Symbol.for(sym(\"elementWasCreated\"));\nexport const _faceProps = Symbol.for(sym(\"faceProps\"));\nexport const _getData = Symbol.for(sym(\"getData\"));\nexport const _key = Symbol.for(sym(\"key\"));\n/** @internal */\nexport const _nativeDb = Symbol.for(sym(\"nativeDb\"));\nexport const _releaseAllLocks = Symbol.for(sym(\"releaseAllLocks\"));\nexport const _verifyChannel = Symbol.for(sym(\"verifyChannel\"));\n/** @internal */\nexport const _hubAccess = Symbol.for(sym(\"hubAccess\"));\nexport const _setHubAccess = Symbol.for(sym(\"setHubAccess\"));\nexport const _getHubAccess = Symbol.for(sym(\"getHubAccess\"));\nexport const _mockCheckpoint = Symbol.for(sym(\"mockCheckpoint\"));\nexport const _cache = Symbol.for(sym(\"cache\"));\nexport const _instanceKeyCache = Symbol.for(sym(\"instanceKeyCache\"));\n"]}
|
|
1
|
+
{"version":3,"file":"Symbols.js","sourceRoot":"","sources":["../../../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C,GAAG,CAAC,gBAAgB,CAAC,CAAC,CAAC;AACpD,QAAA,MAAM,GAAG,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;AAClC,QAAA,iBAAiB,GAAG,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC,CAAC;AACxD,QAAA,cAAc,GAAG,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Workspace\n */\n\nexport const _implementationProhibited = Symbol.for(\"Implementations of this interface can only be obtained from the containing package\");\n\nfunction sym(name: string): string {\n return `${name}_core-backend_INTERNAL_ONLY_DO_NOT_USE`;\n}\n\nexport const _close = Symbol.for(sym(\"close\"));\nexport const _elementWasCreated = Symbol.for(sym(\"elementWasCreated\"));\nexport const _faceProps = Symbol.for(sym(\"faceProps\"));\nexport const _getData = Symbol.for(sym(\"getData\"));\nexport const _key = Symbol.for(sym(\"key\"));\n/** @internal */\nexport const _nativeDb = Symbol.for(sym(\"nativeDb\"));\nexport const _releaseAllLocks = Symbol.for(sym(\"releaseAllLocks\"));\nexport const _verifyChannel = Symbol.for(sym(\"verifyChannel\"));\n/** @internal */\nexport const _hubAccess = Symbol.for(sym(\"hubAccess\"));\nexport const _setHubAccess = Symbol.for(sym(\"setHubAccess\"));\nexport const _getHubAccess = Symbol.for(sym(\"getHubAccess\"));\nexport const _mockCheckpoint = Symbol.for(sym(\"mockCheckpoint\"));\nexport const _cache = Symbol.for(sym(\"cache\"));\nexport const _instanceKeyCache = Symbol.for(sym(\"instanceKeyCache\"));\nexport const _resetIModelDb = Symbol.for(sym(\"resetIModelDb\"));\n"]}
|
|
@@ -1,19 +1,9 @@
|
|
|
1
|
-
import { FieldRun, RelationshipProps, TextBlock } from "@itwin/core-common";
|
|
1
|
+
import { FieldRun, FieldValue, RelationshipProps, TextBlock } from "@itwin/core-common";
|
|
2
2
|
import { IModelDb } from "../../IModelDb";
|
|
3
3
|
import { Id64String } from "@itwin/core-bentley";
|
|
4
|
-
import { XAndY, XYAndZ } from "@itwin/core-geometry";
|
|
5
|
-
import { Property } from "@itwin/ecschema-metadata";
|
|
6
|
-
export type FieldPrimitiveValue = boolean | number | string | Date | XAndY | XYAndZ | Uint8Array;
|
|
7
|
-
export interface FieldPropertyMetadata {
|
|
8
|
-
readonly property: Property;
|
|
9
|
-
}
|
|
10
|
-
export interface FieldProperty {
|
|
11
|
-
value: FieldPrimitiveValue;
|
|
12
|
-
metadata: FieldPropertyMetadata;
|
|
13
|
-
}
|
|
14
4
|
export interface UpdateFieldsContext {
|
|
15
5
|
readonly hostElementId: Id64String;
|
|
16
|
-
getProperty(field: FieldRun):
|
|
6
|
+
getProperty(field: FieldRun): FieldValue | undefined;
|
|
17
7
|
}
|
|
18
8
|
export declare function createUpdateContext(hostElementId: string, iModel: IModelDb, deleted: boolean): UpdateFieldsContext;
|
|
19
9
|
export declare function updateField(field: FieldRun, context: UpdateFieldsContext): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fields.d.ts","sourceRoot":"","sources":["../../../../src/internal/annotations/fields.ts"],"names":[],"mappings":"AAKA,OAAO,
|
|
1
|
+
{"version":3,"file":"fields.d.ts","sourceRoot":"","sources":["../../../../src/internal/annotations/fields.ts"],"names":[],"mappings":"AAKA,OAAO,EAA0D,QAAQ,EAAE,UAAU,EAAoB,iBAAiB,EAAE,SAAS,EAA8B,MAAM,oBAAoB,CAAC;AAC9L,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAmC,UAAU,EAAU,MAAM,qBAAqB,CAAC;AA8B1F,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,aAAa,EAAE,UAAU,CAAC;IAEnC,WAAW,CAAC,KAAK,EAAE,QAAQ,GAAG,UAAU,GAAG,SAAS,CAAA;CACrD;AAsLD,wBAAgB,mBAAmB,CAAC,aAAa,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,GAAG,mBAAmB,CAKlH;AAGD,wBAAgB,WAAW,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAsBlF;AAID,wBAAgB,YAAY,CAAC,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,mBAAmB,GAAG,MAAM,CASvF;AAGD,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,iBAAiB,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI,CAmBtG"}
|
|
@@ -14,7 +14,7 @@ const BackendLoggerCategory_1 = require("../../BackendLoggerCategory");
|
|
|
14
14
|
const ElementDrivesTextAnnotation_1 = require("../../annotations/ElementDrivesTextAnnotation");
|
|
15
15
|
const ecschema_metadata_1 = require("@itwin/ecschema-metadata");
|
|
16
16
|
// Resolve the raw primitive value of the property that a field points to.
|
|
17
|
-
function
|
|
17
|
+
function getFieldPropertyValue(field, iModel) {
|
|
18
18
|
const host = field.propertyHost;
|
|
19
19
|
const schemaItem = iModel.schemaContext.getSchemaItemSync(host.schemaName, host.className);
|
|
20
20
|
if (!ecschema_metadata_1.EntityClass.isEntityClass(schemaItem)) {
|
|
@@ -43,7 +43,7 @@ function getFieldProperty(field, iModel) {
|
|
|
43
43
|
case core_common_1.ECSqlValueType.Boolean:
|
|
44
44
|
return { primitive: rootValue.getBoolean() };
|
|
45
45
|
case core_common_1.ECSqlValueType.DateTime:
|
|
46
|
-
return { primitive: rootValue.getDateTime() };
|
|
46
|
+
return { primitive: new Date(rootValue.getDateTime()) };
|
|
47
47
|
case core_common_1.ECSqlValueType.Double:
|
|
48
48
|
return { primitive: rootValue.getDouble() };
|
|
49
49
|
case core_common_1.ECSqlValueType.Guid:
|
|
@@ -133,48 +133,56 @@ function getFieldProperty(field, iModel) {
|
|
|
133
133
|
}
|
|
134
134
|
}
|
|
135
135
|
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
}
|
|
140
|
-
let json = JSON.parse(curValue.primitive);
|
|
141
|
-
for (const accessor of field.propertyPath.jsonAccessors) {
|
|
142
|
-
if (typeof accessor === "number") {
|
|
143
|
-
if (!Array.isArray(json)) {
|
|
144
|
-
return undefined;
|
|
145
|
-
}
|
|
146
|
-
json = json[accessor < 0 ? json.length + accessor : accessor];
|
|
147
|
-
}
|
|
148
|
-
else {
|
|
149
|
-
if (typeof json !== "object" || json === null) {
|
|
150
|
-
return undefined;
|
|
151
|
-
}
|
|
152
|
-
json = json[accessor];
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
switch (typeof json) {
|
|
156
|
-
case "string":
|
|
157
|
-
case "number":
|
|
158
|
-
case "boolean":
|
|
159
|
-
curValue = { primitive: json };
|
|
160
|
-
break;
|
|
161
|
-
default:
|
|
162
|
-
return undefined;
|
|
163
|
-
}
|
|
136
|
+
const propertyType = determineFieldPropertyType(ecProp);
|
|
137
|
+
if (!propertyType) {
|
|
138
|
+
return undefined;
|
|
164
139
|
}
|
|
165
140
|
// The ultimate result must be a primitive value.
|
|
166
141
|
if (undefined === curValue.primitive) {
|
|
167
142
|
return undefined;
|
|
168
143
|
}
|
|
169
|
-
return {
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
144
|
+
return { value: curValue.primitive, type: propertyType };
|
|
145
|
+
}
|
|
146
|
+
function determineFieldPropertyType(prop) {
|
|
147
|
+
if (prop.isEnumeration()) {
|
|
148
|
+
switch (prop.propertyType) {
|
|
149
|
+
case ecschema_metadata_1.PropertyType.Integer_Enumeration:
|
|
150
|
+
return "int-enum";
|
|
151
|
+
case ecschema_metadata_1.PropertyType.String_Enumeration:
|
|
152
|
+
return "string-enum";
|
|
153
|
+
default:
|
|
154
|
+
return undefined;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
if (prop.isPrimitive()) {
|
|
158
|
+
switch (prop.primitiveType) {
|
|
159
|
+
case ecschema_metadata_1.PrimitiveType.Boolean:
|
|
160
|
+
return "boolean";
|
|
161
|
+
case ecschema_metadata_1.PrimitiveType.String:
|
|
162
|
+
return prop.extendedTypeName === "DateTime" ? "datetime" : "string";
|
|
163
|
+
case ecschema_metadata_1.PrimitiveType.DateTime:
|
|
164
|
+
return "datetime";
|
|
165
|
+
case ecschema_metadata_1.PrimitiveType.Double:
|
|
166
|
+
case ecschema_metadata_1.PrimitiveType.Long:
|
|
167
|
+
return "quantity";
|
|
168
|
+
case ecschema_metadata_1.PrimitiveType.Point2d:
|
|
169
|
+
case ecschema_metadata_1.PrimitiveType.Point3d:
|
|
170
|
+
return "coordinate";
|
|
171
|
+
case ecschema_metadata_1.PrimitiveType.Binary:
|
|
172
|
+
return prop.extendedTypeName === "BeGuid" ? "string" : undefined;
|
|
173
|
+
case ecschema_metadata_1.PrimitiveType.Integer:
|
|
174
|
+
case ecschema_metadata_1.PrimitiveType.Long:
|
|
175
|
+
return "string";
|
|
176
|
+
default:
|
|
177
|
+
return undefined;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
return undefined;
|
|
173
181
|
}
|
|
174
182
|
function createUpdateContext(hostElementId, iModel, deleted) {
|
|
175
183
|
return {
|
|
176
184
|
hostElementId,
|
|
177
|
-
getProperty: deleted ? () => undefined : (field) =>
|
|
185
|
+
getProperty: deleted ? () => undefined : (field) => getFieldPropertyValue(field, iModel),
|
|
178
186
|
};
|
|
179
187
|
}
|
|
180
188
|
// Recompute the display value of a single field, return false if it couldn't be evaluated.
|
|
@@ -184,11 +192,9 @@ function updateField(field, context) {
|
|
|
184
192
|
}
|
|
185
193
|
let newContent;
|
|
186
194
|
try {
|
|
187
|
-
const
|
|
188
|
-
if (undefined !==
|
|
189
|
-
|
|
190
|
-
// eslint-disable-next-line @typescript-eslint/no-base-to-string
|
|
191
|
-
newContent = prop.value.toString();
|
|
195
|
+
const propValue = context.getProperty(field);
|
|
196
|
+
if (undefined !== propValue) {
|
|
197
|
+
newContent = (0, core_common_1.formatFieldValue)(propValue, field.formatOptions);
|
|
192
198
|
}
|
|
193
199
|
}
|
|
194
200
|
catch (err) {
|
|
@@ -205,11 +211,9 @@ function updateField(field, context) {
|
|
|
205
211
|
// of fields whose display strings changed as a result.
|
|
206
212
|
function updateFields(textBlock, context) {
|
|
207
213
|
let numUpdated = 0;
|
|
208
|
-
for (const
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
++numUpdated;
|
|
212
|
-
}
|
|
214
|
+
for (const { child } of (0, core_common_1.traverseTextBlockComponent)(textBlock)) {
|
|
215
|
+
if (child.type === "field" && updateField(child, context)) {
|
|
216
|
+
++numUpdated;
|
|
213
217
|
}
|
|
214
218
|
}
|
|
215
219
|
return numUpdated;
|