VintaSoft Imaging .NET SDK 12.4: Documentation for .NET developer
In This Topic
    UserInteractionVisualTool class
    In This Topic

    Basic concepts

    UserInteractionVisualTool is the base class for visual tools, which perform interaction between the user and interactive object in ImageViewer using input devices (like keyboard, mouse, etc). The class allows to implement custom (user-defined) logic of interaction between a collection of interactive objects and the user. The classes, which are derived from this class, are visual tools, like AnnotationVisualTool, RectangularSelectionTool, CustomSelectionTool.

    Basics concepts of the interactive communication model are:


    Basic working principles of interaction model

    The interaction model work can be divided into 5 steps:
    1. The interaction visual tool gets the selected object and counted it as active object, the interaction visual tool gets the interaction controller from active object and counted it as active interaction controller.
    2. The interaction visual tool performs call of UpdateInteractionAreas method for active interaction controller and gets a list of interaction areas using InteractionAreas property of interaction controller. The interaction visual tool displays interaction areas over other interactive objects in image viewer.
    3. The interaction visual tool analyzes events coming from input devices (e.g. mouse button clicking, mouse pointer relocation) and determines the interaction area the user is working with. Events from input devices are converted to the interaction events according to the type of interaction area and then are directed to the active interaction controller using IInteractionController.OnInteraction(InteractionEventArgs) method.
    4. The interaction controller in OnInteraction method performs the logic of interaction between interaction area and interactive object. For example: Interactive object supports rotation by implementing the interface of interactive object in which exist RotationAngle property. After the controller receives the interaction event with rotation point (rotation point - interaction area) it will calculate rotation angle on which is necessary to rotate the object and will change object's RotationAngle property for necessary angle.
    5. When the interaction controller changes any property, which varies object's state (e.g. Rotation angle), the object will generate StateChanged event to which is subscribed the interaction visual tool. The interaction visual tool will be performing the update of interactive areas in active interaction controller and then redrawing of interactive object and interactive areas in image viewer.


    Hierarchy of interactive objects interfaces

    IInteractiveObject - the base interface, which defines general characteristics of all interactive objects.

    IRectangularInteractiveObject - defines the rectangular object, which supports rotation.

    IPointBasedInteractiveObject - defines the object, which consists from set of points.

    Note: the fact that properties of interactive objects are described by hierarchy of interfaces, made possible to create interactive objects, which could implement at once several interactive objects interfaces. For example, an object may support overpatching of its base points (IPointBasedInteractiveObject) as well as overpatching of its shape (stretching, compaction, rotation) using rectangular object interface (IRectangularInteractiveObject).



    Hierarchy of interaction controllers

    The interaction controllers are divided into 2 groups for convenience:

    IInteractionController - the base interface, which defines general characteristics of all interactive communication controllers.

    RectangularObjectBuilder - builder of objects implementing IRectangularInteractiveObject interface.

    RectangularObjectTransformer - transformer of objects implementing IRectangularInteractiveObject interface. Provides the ability to relocate, stretch, compress, rotate object.

    PointBasedObjectPointBuilder - builder of objects implementing IPointBasedInteractiveObject interface. Provides the ability to construct an object by adding to it new points by mouse click.

    PointBasedObjectFreehandBuilder - builder of objects implementing IPointBasedInteractiveObject interface. Provides the ability to construct an object by adding to it new points by mouse movement.

    PointBasedObjectLineBuilder - builder of objects implementing IPointBasedInteractiveObject interface. Provides the ability to construct an object which consists from two points (line).

    PointBasedObjectRectangularBuilder - builder of objects implementing IPointBasedInteractiveObject interface. Provides the ability to construct an object by scaling all its points.

    PointBasedObjectPointTransformer - transformer of objects implementing IPointBasedInteractiveObject interface. Provides the ability to mark, relocate, remove, add object's points.

    PointBasedObjectRectangularTransformer - transformer of objects implementing IPointBasedInteractiveObject interface. Provides the ability to relocate, stretch, compress, rotate object.

    PointBasedObjectDistortionTransformer - transformer of objects implementing [IPointBasedInteractiveObject interface. Provides the ability to apply distortion and skew.

    CompositeInteractionController - the composite interaction controller, which can combine the work of multiple interaction controllers and is used to:

    Hierarchy of interaction areas

    The base class for all interaction areas is InteractionArea class.

    Interaction areas are divided into 3 groups for convenience: