TextAnnotation Class
Represents a formatted block of text positioned in 2d or 3d space. TextAnnotation2d and TextAnnotation3d elements store a single TextAnnotation from which their geometric representation is generated. Other types of elements may store multiple TextAnnotations, positioned relative to one another. The annotation's position and orientation relative to the host element's Placement is determined as follows:
- First, a bounding box is computed enclosing the contents of the [[textBlock].
- Then, an "anchor point" is computed based on the bounding box and the anchor property. The anchor point can be at one of the four corners of the box, in the middle of one of its four edges, or in the center of the box.
- The orientation is applied to rotate the box around the anchor point.
- Finally, the offset is added to the anchor point to apply translation.
@see produceTextAnnotationGeometry to decompose the annotation into a set of geometric primitives suitable for use with appendTextBlock.
Methods
Name | Description | |
---|---|---|
computeAnchorPoint(boundingBox: Range2d): Point3d | Compute the anchor point of this annotation as specified by anchor. | |
computeTransform(boundingBox: Range2d): Transform | Compute the transform that positions and orients this annotation relative to its anchor point, based on the textBlock's computed bounding box. | |
equals(other: TextAnnotation): boolean | Returns true if this annotation is logically equivalent to other . |
|
toJSON(): TextAnnotationProps | Converts this annotation to its JSON representation. | |
create(args?: TextAnnotationCreateArgs): TextAnnotation Static | Creates a new TextAnnotation. | |
fromJSON(props: TextAnnotationProps): TextAnnotation Static | Creates a new TextAnnotation instance from its JSON representation. |
Properties
Name | Type | Description | |
---|---|---|---|
anchor | TextAnnotationAnchor | Describes how to compute the textBlock's anchor point. | |
offset | Point3d | An offset applied to the anchor point that can be used to position annotations within the same geometry stream relative to one another. | |
orientation | YawPitchRollAngles | The rotation of the annotation. | |
textBlock | TextBlock | The formatted document. |
Defined in
Last Updated: 21 November, 2024
Found something wrong, missing, or unclear on this page?Raise an issue in our repo.