VintaSoft Imaging .NET SDK 12.4: Documentation for .NET developer
In This Topic
    Viewing and transforming annotations, interaction with annotations in WPF
    In This Topic
    The visual tool WpfAnnotationVisualTool is intended for viewing, editing and interaction with the annotation collection
    of focused image in viewer.

    WpfAnnotationVisualTool class allows to:


    Programmatically access to the annotations in WPF annotation viewer

    A collection of visual appearances of annotations can be get using WpfAnnotationViewCollection property. Visual appearance of a selected annotation can be get using WpfAnnotationVisualTool.FocusedAnnotationView property.


    Display and interact with annotations in WPF annotation viewer

    WpfAnnotationVisualTool class allows to perform 3 groups of operations with annotation collection of single image:
    1. display annotation collection
    2. implement interaction between user and annotation
      • generate an event when mouse pointer is being moved above annotation
      • generate an event when the user directs mouse pointer at annotation
      • generate an event when the user clicks on an annotation
      • perform the transition on a hyperlink when the user clicks on link annotation
      • perform any other interaction between user and annotation
    3. transform a single annotation or a group of annotations
      • build and add annotation to annotation collection
      • transform annotation
        • relocate
        • resize
        • rotate
        • mirror
        • apply user defined transformation
      • remove annotation from annotation collection


    Use different annotation interaction modes in WPF annotation viewer

    WpfAnnotationVisualTool class allows to choose interaction mode between user and annotations using WpfAnnotationVisualTool.AnnotationInteractionMode property. The following modes are available:

    Below is the diagram that illustrate events occurring in annotation engine:
    Diagram that illustrate events occurring in annotation engine

    Select one or more annotations in WPF annotation viewer

    By default, WpfAnnotationVisualTool class allows to select several annotations. The selected annotation collection can be get using WpfAnnotationVisualTool.SelectedAnnotations property. The ability of multiple annotations selection can be disabled using WpfAnnotationVisualTool.MultiSelect property. The WpfAnnotationVisualTool.AnnotationSelectionPen property allows to specify a pen, which should be used for drawing of annotation selection.

    Single annotation can be selected using WpfAnnotationVisualTool.SetFocusedAnnotationView method programmatically.


    Restrict annotation building/transformation in image region in WPF annotation viewer

    WpfAnnotationVisualTool allows to restrict region where annotation can be built or transformed. This functionality can be enabled using WpfAnnotationVisualTool.IsAnnotationBoundingRectEnabled property. WpfAnnotationVisualTool.AnnotationBoundingRect property allows to set a region on image, where annotation may be built or transformed.


    Build annotation in WPF annotation viewer

    The WpfAnnotationVisualTool.AddAndBuildAnnotation method allows to start the annotation building process, the WpfAnnotationVisualTool.FinishAnnotationBuilding method allows to finish the annotation building process, the WpfAnnotationVisualTool.CancelAnnotationBuilding method allows to cancel the annotation building process.
    WpfAnnotationVisualTool raises the WpfAnnotationVisualTool.AnnotationBuildingStarted event when annotation building process is started, WpfAnnotationVisualTool raises the WpfAnnotationVisualTool.AnnotationBuildingFinished event when annotation building process is finished, WpfAnnotationVisualTool raises the WpfAnnotationVisualTool.AnnotationBuildingCanceled event when annotation building process is canceled.


    Transform annotation in WPF annotation viewer

    The transformation of focused annotation may be started via mouse.
    WpfAnnotationVisualTool raises the WpfAnnotationVisualTool.AnnotationTransformingStarted event when annotation transformation process is started, WpfAnnotationVisualTool raises the WpfAnnotationVisualTool.AnnotationTransformingFinished event when annotation transformation process is finished.

    The visual tool allows to transform a single annotation or a group of annotations. While transforming an annotation group is possible to perform transformation of group in whole or for each annotation separately.


    Use the annotation rotation assistant for rotating annotation in WPF annotation viewer

    WpfAnnotationVisualTool class contains a rotation assistant, which can help when annotation needs to be rotated on a discrete angle. The rotation assistant is accessible using WpfAnnotationVisualTool.RotationAssistant property.
    The rotation assistant works as follows:

    Rotation assistant is enabled in annotation viewer

    Expand existing functionality

    WpfAnnotationVisualTool class has open architecture and allows to change, practically, any functionality in derived classes.