Send comments on this topic. | Back to Introduction - All Topics | Help Version 16.5.9.25
Using Protractors in WPF Annotation Objects

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

AnnProtractorObject

AnnGroupObject

Each of these classes implements the IAnnProtractorObject and accesses properties that control the layout of the protractor, what aspects of the protractor are displayed and the unit of measure of the protractor. For more information on the characteristics of the rulers themselves, refer to Using Rulers in WPF Annotation Objects.

The AngularUnit property contains a value that indicates the unit of measure for the angle between the two rulers. For each possible value of the AngularUnit property there is a corresponding abbreviation for the unit of measure. This abbreviation is given in the AngularUnitAbbreviation property. The Acute property indicates whether to draw the inside (acute) angle or the outside angle of the protractor. The ArcRadius property contains the arc radius if the protractor. To display the angle of the protractor, set the ShowAngle property to true. The precision of the value displayed for the angle of the ruler can be set using the AnglePrecision property. This property contains a value that indicates how many digits to display to the right of the decimal point in the angle.

In the automation mode.

Annotation objects from the above-mentioned classes also access the IsProtractorImplemented 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 AnnObjectBase class and includes a protractor in this new class, the user should implement the IsProtractorImplemented property to always return True.

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

AnnProtractorObject:

The AnnProtractorObject class implements the IAnnProtractorObject interface and accesses the common protractor properties mentioned above through this implementation. In addition, this class also inherits numerous properties and methods from the Object, AnnObjectBase class. The AnnProtractorObject class expands on these inherited classes with several properties and methods. The protractor annotation object consists of two rulers, joined at a point to create an angle. The CenterPoint property contains the point at which the two rulers join. The first ruler of the protractor extends from the center point to the end point contained in the FirstPoint property. The second ruler of the protractor extends from the center point to the end point contained in the SecondPoint property. The Clone method makes an exact copy of the AnnProtractorObject class object that calls it, while the Create method just creates a new AnnProtractor Object class object. The GetObjectData method gets information required to serialize the annotation object. The DefiningGeometry property returns a Geometry representation of the protractor annotation object, and the RenderObject method draws the AnnProtractorObject object to a specific surface.

WPF Annotation objects can be transformed by applying any object transformation method. The GetTransformPoints method gets the array of points associated with the object that will be transformed. The TransformObjectMode property contains a value that indicates how the transformation method is applied. After the transformation method is applied, the ruler object can have the transformed points set by calling the SetTransformPoints method.

Like the AnnProtractorObject class, the AnnGroupObject class implements the IAnnProtractorObject interface.