Using Text in Annotation Objects

Show in webframe

Many annotation objects utilize text as part of the annotation.

The IAnnTextObject interface provides a set of properties that are common to text and are utilized by any class of annotation object that utilizes text. This interface is implemented by several of the Annotation Object classes provided by LEADTOOLS. These include:

AnnButtonObject

AnnGroupObject

AnnNoteObject

AnnStampObject

AnnTextObject

AnnTextPointerObject

AnnTextRollupObject

AnnRichTextObject

Each of these classes except for the rich text object(either through the direct implementation of IAnnTextObject or inheritance from the AnnTextObject class which implements the IAnnTextObject interface) accesses properties that control vertical and horizontal alignment, margin width and the actual text. The Alignment and LineAlignment properties control the horizontal and vertical alignment of the text. The EdgeMargin property controls the distance between the text and the bounding rectangle of the text.

Annotation objects from the above-mentioned classes also access the TextImplemented property This is a read-only property that is used internally. The toolkit checks this property to make sure it is true and uses this information to determine which tabs the toolkit should include when displaying property dialogs in automation mode.

If the user creates a custom annotation object by deriving a new class from the AnnObject class and includes text in this new class, the user should implement the TextImplemented property to always return "true".

For an example of user-defined annotation classes, refer to Implement User Defined Object With LEADTOOLS Annotations.

AnnTextObject:

The AnnTextObject class implements the IAnnTextObject interface and accesses the common text properties mentioned above through this implementation. In addition, this class also inherits numerous properties and methods from the Object, AnnObject, AnnDrawable and AnnRectangleObject classes. The AnnTextObject class expands on these inherited classes with several properties and methods. The Clone method makes an exact copy of the AnnTextObject class object that calls it, while the Create method just creates a new AnnTextObject class object. The GetObjectData method gets information required to serialize the annotation object. The HitTestInterior property is a read only property that indicates whether hit testing should be performed inside the annotation object. Finally, the DrawObject method draws the AnnTextObject object to a specific surface.

Like the AnnTextObject class, the AnnGroupObject class implements the IAnnTextObject interface. The AnnButtonObject, AnnNoteObject, AnnStampObject, AnnTextPointerObject, and AnnTextRollupObject classes all inherit the AnnTextObject class and access the common text properties mentioned above through this inheritance.

AnnTextPointerObject

The AnnTextPointerObject class inherits the AnnTextObject and accesses the common text properties mentioned above through this inheritance. This class also inherits numerous properties and methods from the Object, AnnObject, AnnDrawable and AnnRectangleObject classes. In addition, the AnnTextPointerObject class extends the functionality of the AnnTextObject class by providing an extra line that starts from one of the four corners of the bounding rectangle, around the text. The other endpoint of the line can be moved to point to anything on the underlying image. This extra endpoint may or may not be fixed. The bounding rectangle is given in the BoundingRectangle property. The position of this extra endpoint is given in the PointerPosition property. The FixedPointer property indicates whether this endpoint is fixed.

If the endpoint is fixed, then transforming the bounding rectangle of the text will not change the location of this endpoint. If the endpoint is not fixed, then the location of the endpoint will change as the bounding rectangle of the text is transformed. The TransformObjectMode property indicates how the transformation process of the object will be performed.

The AnnTextPointerObject class further expands on these inherited classes with several methods. The Clone method makes an exact copy of the AnnTextPointerObject class object that calls it, while the Create method just creates a new AnnTextPointerObject class object. The GetObjectData method gets information required to serialize the annotation object and the GetGraphicsPath method returns a GraphicsPath representation of the text pointer annotation object.

When transforming a text pointer object, the GetTransformPoints method gets the array of points to be transformed. Once those points have been transformed, they can be set back in the text pointer object by calling the SetTransformPoints method.

AnnTextRollupObject

The AnnTextRollupObject class inherits the AnnTextObject and accesses the common text properties mentioned above through this inheritance. This class also inherits numerous properties and methods from the Object, AnnObject, AnnDrawable and AnnNoteObject classes In addition, the AnnTextRollupObject class extends the functionality of the AnnTextObject class by looking and behaving just like a note object, or being compacted to only display the first line of text. This is done using the Expanded property. If the Expanded property is true, then the text rollup object is expanded, looking and behaving like a Note annotation object. If the Expanded property is false, the text rollup object is compacted, or rolled up, to display only one line of text.

The Bounds property contains the bounding rectangle for the text rollup object. If the text rollup object is expanded, then the Bounds property contains the bounding rectangle of the fully expanded object. If the text rollup object is not expanded, then the Bounds property contains the bounding rectangle of the compact, rolled up object.

The HitTestInterior property is a read only property that indicates whether hit testing should be performed inside this text rollup object.

The AnnTextRollupObject class further expands on the inherited classes with several methods. The Clone method makes an exact copy of the AnnTextRollupObject class object that calls it, while the Create method just creates a new AnnTextRollupObject class object. The GetObjectData method gets information required to serialize the annotation object and the DrawObject method draws the text rollup annotation object on a specific surface.

For more information on rich text objects, refer to AnnRichTextObject.

 

 


Products | Support | Contact Us | Copyright Notices
© 2006-2014 All Rights Reserved. LEAD Technologies, Inc.