@itwin/core-backend
Version:
iTwin.js backend components
204 lines (203 loc) • 9.89 kB
TypeScript
/** @packageDocumentation
* @module Elements
*/
import { AnnotationTextStyleProps, Code, CodeProps, CodeScopeProps, EntityReferenceSet, Placement2dProps, Placement3dProps, TextAnnotation, TextAnnotation2dProps, TextAnnotation3dProps, TextAnnotationProps, TextStyleSettings, TextStyleSettingsProps } from "@itwin/core-common";
import { IModelDb } from "../IModelDb";
import { AnnotationElement2d, DefinitionElement, GraphicalElement3d, OnElementIdArg, OnElementPropsArg } from "../Element";
import { Id64String } from "@itwin/core-bentley";
import { TextBlockAndId } from "./ElementDrivesTextAnnotation";
/** An element that displays textual content within a 2d model.
* The text is stored as a [TextAnnotation]($common) from which the element's [geometry]($docs/learning/common/GeometryStream.md) and [Placement]($common) are computed.
* @see [[setAnnotation]] to change the textual content.
* @public @preview
*/
export declare class TextAnnotation2d extends AnnotationElement2d {
/** @internal */
static get className(): string;
/** Optional string containing the data associated with the text annotation. */
private _textAnnotationData?;
/** Extract the textual content, if present.
* @see [[setAnnotation]] to change it.
*/
getAnnotation(): TextAnnotation | undefined;
/** Change the textual content of the `TextAnnotation2d`.
* @see [[getAnnotation]] to extract the current annotation.
* @param annotation The new annotation
*/
setAnnotation(annotation: TextAnnotation): void;
protected constructor(props: TextAnnotation2dProps, iModel: IModelDb);
/** Creates a new instance of `TextAnnotation2d` from its JSON representation. */
static fromJSON(props: TextAnnotation2dProps, iModel: IModelDb): TextAnnotation2d;
/**
* Converts the current `TextAnnotation2d` instance to its JSON representation.
* It also computes the `elementGeometryBuilderParams` property used to create the GeometryStream.
* @inheritdoc
*/
toJSON(): TextAnnotation2dProps;
/** Creates a new `TextAnnotation2d` instance with the specified properties.
* @param iModelDb The iModel.
* @param category The category ID for the annotation.
* @param model The model ID where the annotation will be placed.
* @param placement The placement properties for the annotation.
* @param textAnnotationData Optional [[TextAnnotation]] JSON representation used to create the `TextAnnotation2d`. Essentially an empty element if not provided.
* @param code Optional code for the element.
*/
static create(iModelDb: IModelDb, category: Id64String, model: Id64String, placement: Placement2dProps, textAnnotationData?: TextAnnotationProps, code?: CodeProps): TextAnnotation2d;
/**
* Updates the geometry of the TextAnnotation2d on insert.
* @inheritdoc
* @beta
*/
protected static onInsert(arg: OnElementPropsArg): void;
/**
* Updates the geometry of the TextAnnotation2d on update.
* @inheritdoc
* @beta
*/
protected static onUpdate(arg: OnElementPropsArg): void;
/**
* Populates the `elementGeometryBuilderParams` property in the [TextAnnotation2dProps]($common).
* It only does this if the `elementGeometryBuilderParams` is not already set and if there is actually a text annotation to produce geometry for.
*/
protected static updateGeometry(iModelDb: IModelDb, props: TextAnnotation2dProps): void;
/**
* Collects reference IDs used by this `TextAnnotation2d`.
* @inheritdoc
*/
protected collectReferenceIds(ids: EntityReferenceSet): void;
/** @internal */
getTextBlocks(): Iterable<TextBlockAndId>;
/** @internal */
updateTextBlocks(textBlocks: TextBlockAndId[]): void;
/** @internal */
static onInserted(arg: OnElementIdArg): void;
/** @internal */
static onUpdated(arg: OnElementIdArg): void;
}
/** An element that displays textual content within a 3d model.
* The text is stored as a [TextAnnotation]($common) from which the element's [geometry]($docs/learning/common/GeometryStream.md) and [Placement]($common) are computed.
* @see [[setAnnotation]] to change the textual content.
* @public @preview
*/
export declare class TextAnnotation3d extends GraphicalElement3d {
/** @internal */
static get className(): string;
/** Optional string containing the data associated with the text annotation. */
private _textAnnotationData?;
/** Extract the textual content, if present.
* @see [[setAnnotation]] to change it.
*/
getAnnotation(): TextAnnotation | undefined;
/** Change the textual content of the `TextAnnotation3d`.
* @see [[getAnnotation]] to extract the current annotation.
* @param annotation The new annotation
*/
setAnnotation(annotation: TextAnnotation): void;
protected constructor(props: TextAnnotation3dProps, iModel: IModelDb);
/** Creates a new instance of `TextAnnotation3d` from its JSON representation. */
static fromJSON(props: TextAnnotation3dProps, iModel: IModelDb): TextAnnotation3d;
/**
* Converts the current `TextAnnotation3d` instance to its JSON representation.
* It also computes the `elementGeometryBuilderParams` property used to create the GeometryStream.
* @inheritdoc
*/
toJSON(): TextAnnotation3dProps;
/** Creates a new `TextAnnotation3d` instance with the specified properties.
* @param iModelDb The iModel.
* @param category The category ID for the annotation.
* @param model The model ID where the annotation will be placed.
* @param placement The placement properties for the annotation.
* @param textAnnotationData Optional [[TextAnnotation]] JSON representation used to create the `TextAnnotation3d`. Essentially an empty element if not provided.
* @param code Optional code for the element.
*/
static create(iModelDb: IModelDb, category: Id64String, model: Id64String, placement: Placement3dProps, textAnnotationData?: TextAnnotationProps, code?: CodeProps): TextAnnotation3d;
/**
* Updates the geometry of the TextAnnotation3d on insert.
* @inheritdoc
* @beta
*/
protected static onInsert(arg: OnElementPropsArg): void;
/**
* Updates the geometry of the TextAnnotation3d on update.
* @inheritdoc
* @beta
*/
protected static onUpdate(arg: OnElementPropsArg): void;
/**
* Populates the `elementGeometryBuilderParams` property in the [TextAnnotation3dProps]($common).
* It only does this if the `elementGeometryBuilderParams` is not already set and if there is actually a text annotation to produce geometry for.
*/
protected static updateGeometry(iModelDb: IModelDb, props: TextAnnotation3dProps): void;
/**
* Collects reference IDs used by this `TextAnnotation3d`.
* @inheritdoc
*/
protected collectReferenceIds(ids: EntityReferenceSet): void;
/** @internal */
getTextBlocks(): Iterable<TextBlockAndId>;
/** @internal */
updateTextBlocks(textBlocks: TextBlockAndId[]): void;
/** @internal */
static onInserted(arg: OnElementIdArg): void;
/** @internal */
static onUpdated(arg: OnElementIdArg): void;
}
/**
* The definition element that holds text style information.
* The style is stored as a [TextStyleSettings]($common).
* @beta
*/
export declare class AnnotationTextStyle extends DefinitionElement {
/** @internal */
static get className(): string;
/**
* Optional text describing the `AnnotationTextStyle`.
*/
description?: string;
/**
* The text style settings for the `AnnotationTextStyle`.
* @see [[TextStyleSettings]] for more information.
*/
settings: TextStyleSettings;
protected constructor(props: AnnotationTextStyleProps, iModel: IModelDb);
/**
* Creates a Code for an `AnnotationTextStyle` given a name that is meant to be unique within the scope of the specified DefinitionModel.
*
* @param iModel - The IModelDb.
* @param definitionModelId - The ID of the DefinitionModel that contains the AnnotationTextStyle and provides the scope for its name.
* @param name - The AnnotationTextStyle name.
*/
static createCode(iModel: IModelDb, definitionModelId: CodeScopeProps, name: string): Code;
/**
* Creates a new instance of `AnnotationTextStyle` with the specified properties.
*
* @param iModelDb - The iModelDb.
* @param definitionModelId - The ID of the [[DefinitionModel]].
* @param name - The name to assign to the `AnnotationTextStyle`.
* @param settings - Optional text style settings used to create the `AnnotationTextStyle`. Default settings will be used if not provided.
* @param description - Optional description for the `AnnotationTextStyle`.
*/
static create(iModelDb: IModelDb, definitionModelId: Id64String, name: string, settings?: TextStyleSettingsProps, description?: string): AnnotationTextStyle;
/**
* Converts the current `AnnotationTextStyle` instance to its JSON representation.
* @inheritdoc
*/
toJSON(): AnnotationTextStyleProps;
/** Creates a new instance of `AnnotationTextStyle` from its JSON representation. */
static fromJSON(props: AnnotationTextStyleProps, iModel: IModelDb): AnnotationTextStyle;
/**
* Validates that the AnnotationTextStyle's settings are valid before insert.
* @inheritdoc
* @beta
*/
protected static onInsert(arg: OnElementPropsArg): void;
/**
* Validates that the AnnotationTextStyle's settings are valid before update.
* @inheritdoc
* @beta
*/
protected static onUpdate(arg: OnElementPropsArg): void;
private static validateSettings;
private static parseTextStyleSettings;
}
//# sourceMappingURL=TextAnnotationElement.d.ts.map