Using Rulers in WPF Annotation Objects

Many WPF annotation objects utilize one or more rulers as part of the annotation.

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

AnnCrossProductObject

AnnGroupObject

AnnPolyRulerObject

AnnProtractorObject

AnnRulerObject

Each of these classes (either through the direct implementation of IAnnRuler or inheritance from the AnnRulerObject class which implements the IAnnRuler interface) accesses properties that control what aspects of the ruler are displayed and the unit of measure of the ruler. The MeasurementUnit property contains a value that indicates the unit of measure for the ruler. For each possible value of the MeasurementUnit property there is a corresponding abbreviation for the unit of measure.

At each end of the ruler is a perpendicular line called a gauge. The length of the gauge is set or obtained through the GaugeLength property. The ShowGauge property indicates whether the gauges are displayed when the ruler is drawn. To display the gauges, set the ShowGauge property to true.

Along the length of the ruler are tick marks. The length of these tick marks can be set using the TickMarksLength property. To display the tick marks when the ruler is displayed, set the ShowTickMarks property to true. To display the length of the entire ruler, set the ShowLength property to true. The precision of the value displayed as the length of the ruler can be set using the Precision property. This property contains a value that indicates how many digits to display to the right of the decimal point in the length.

In the automation mode. WPF Annotation objects from the above-mentioned classes also access the IsRulerImplemented 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 a ruler in this new class, the user should implement the IsRulerImplemented property to always return "true".

AnnRulerObject:

The AnnRulerObject class implements the IAnnRuler interface and accesses the common ruler properties mentioned above through this implementation. In addition, this class also inherits numerous properties and methods from the Object, AnnObject and AnnLineObject classes. The AnnRulerObject class expands on these inherited classes with several properties and methods. The Clone method makes an exact copy of the AnnRulerObject class object that calls it, while the Create method just creates a new AnnRulerObject class object. The DefiningGeometry property returns a PathGeometry representation of the ruler annotation object.

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 TransformMode property contains a value that indicates how the transformation method is applied. After the transformation method is applied, the transformed points can be set in the ruler object by calling the SetTransformPoints method.

AnnCrossProductObject:

The AnnCrossProduct Object class also implements the IAnnRuler interface and accesses the common ruler properties mentioned above through this implementation. In addition, this class also inherits numerous properties and methods from the Object, AnnObject classe. The AnnCrossProductObject class expands on these inherited class with several properties and methods.

The cross-product annotation object consists of two rulers intersecting at right angles. These two rulers are defined by the FirstStartPoint and FirstEndPoint properties for the first ruler and the SecondStartPoint and SecondEndPoint properties for the second ruler. The intersection point of these two rulers updates dynamically and can be obtained through the IntersectionPoint property .

The Clone method makes an exact copy of the AnnCrossProductObject class object that calls it, while the Create method just creates a new AnnCrossProductObject class object. The DefiningGeometry property returns a Geometry representation of the ruler annotation object.

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 TransformMode property contains a value that indicates how the transformation method is applied. After the transformation method is applied, the cross product object can have the transformed points set by calling the SetTransformPoints method.

AnnPolyRulerObject:

The AnnPolyRulerObject class also implements the IAnnRuler interface and accesses the common ruler properties mentioned above through this implementation. In addition, this class also inherits numerous properties and methods from the Object, AnnObject, AnnPolylineObject classes. The AnnPolyRulerObject class expands on these inherited classes with several properties and methods.

The polyruler annotation object consists of an array of points that creates a sequence of joined rulers. This array of points is contained in the Points property, which is inherited from the AnnPolylineObject.

The Clone method makes an exact copy of the AnnPolyRulerObject class object that calls it, while the Create method just creates a new AnnPolyRulerObject class object. The DefiningGeometry property returns a Geometry representation of the polyruler annotation object.

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 TransformMode property contains a value that indicates how the transformation method is applied. After the transformation method is applied, the polyruler object can have the transformed points set by calling the SetTransformPoints method. Like the AnnRulerObject class and the other classes mentioned in this section, the AnnGroupObject class implements the IAnnRuler interface. In addition, the AnnProtractorObject class also implements the IAnnRuler interface. For more information on the AnnProtractorObject class, refer to Using Protractors in WPF Annotation Objects.

Help Version 19.0.2017.10.27
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.
LEADTOOLS Imaging, Medical, and Document