UNPKG

@itwin/core-backend

Version:
61 lines 3.74 kB
/** @packageDocumentation * @module Elements */ import { RelationshipProps, TextBlock } from "@itwin/core-common"; import { ElementDrivesElement } from "../Relationship"; import { IModelDb } from "../IModelDb"; import { Element } from "../Element"; import { Id64String } from "@itwin/core-bentley"; /** Describes one of potentially many [TextBlock]($common)s hosted by an [[ITextAnnotation]]. * For example, a [[TextAnnotation2d]] hosts only a single text block, but an element representing a table may * host one text block for each cell in the table, in which case it might use the combination of row and column * as the [[id]] for each text block. * @beta */ export interface TextBlockAndId { /** The text block. */ readonly textBlock: TextBlock; /** An opaque identifier that allows the [[ITextAnnotation]] to discern which of its hosted text blocks is being referred to. */ readonly id: unknown; } /** Interface implemented by [[GeometricElement]] subclasses whose schemas declare them to implement the mix-in `BisCore:ITextAnnotation`. * Such elements may host any number of [TextBlock]($common)s. `ITextAnnotation` provides a uniform way to interact with text regardless of * the type of element to which it belongs. * @beta */ export interface ITextAnnotation { /** Obtain a collection of all of the [TextBlock]($common)s hosted by this element. */ getTextBlocks(): Iterable<TextBlockAndId>; /** Update the element to replace the contents of the specified [TextBlock]($common)s. */ updateTextBlocks(textBlocks: TextBlockAndId[]): void; } /** Returns `true` if the specified `element` implements [[ITextAnnotation]]. * @beta */ export declare function isITextAnnotation(element: Element): element is ITextAnnotation & Element; /** A relationship in which the source element hosts one or more properties that are displayed by a target [[ITextAnnotation]] element. * This relationship is used to automatically update the [FieldRun]($common)s contained in the target element when the source element is modified. * An [[ITextAnnotation]] element should invoke [[updateFieldDependencies]] from its [[Element.onInserted]] and [[Element.onUpdated]] functions to * establish or update the relationships required for the [FieldRun]($common)s it contains. * @note This relationship was introduced in version 01.00.22 of the BisCore schema. [FieldRun]($common)s created in iModels that have not been upgraded to * that version or newer will not automatically update. Use [[isSupportedForIModel]] to check. * @beta */ export declare class ElementDrivesTextAnnotation extends ElementDrivesElement { static get className(): string; /** @internal */ static onRootChanged(props: RelationshipProps, iModel: IModelDb): void; /** @internal */ static onDeletedDependency(props: RelationshipProps, iModel: IModelDb): void; /** Returns true if `iModel` contains a version of the BisCore schema new enough to support this relationship. * If not, the schema should be updated before inserting any [FieldRun]($common)s, or those runs will not * update when the source element changes. */ static isSupportedForIModel(iModel: IModelDb): boolean; /** Examines all of the [FieldRun]($common)s within the specified [[ITextAnnotation]] and ensures that the appropriate * `ElementDrivesTextAnnotation` relationships exist between the fields' source elements and this target element. * It also deletes any stale relationships left over from fields that were deleted or whose source elements changed. */ static updateFieldDependencies(annotationElementId: Id64String, iModel: IModelDb): void; } //# sourceMappingURL=ElementDrivesTextAnnotation.d.ts.map