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, the width and height of a box enclosing the contents of the textBlock must be computed using computeTextBlockExtents. This yields a box with the top-left corner at (0, 0) and the bottom-right corner at (width, -height).
  • Then, an "anchor point" is computed based on the text box and the anchor property. For example, if the annotation is anchored at the center-left, the anchor point will be (width/2, -height).
  • 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(textBlockDimensions: Readonly<WritableXAndY>): Point3d Compute the anchor point of this annotation as specified by anchor.  
computeTransform(textBlockDimensions: Readonly<WritableXAndY>): 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: 17 May, 2024