VintaSoft Imaging .NET SDK v8.7
In This Topic
    UserInteractionVisualTool class
    In This Topic

    Basic concepts

    UserInteractionVisualTool class is the base class for visual tools that performs interaction between the user and interactive object 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 derived from this class are visual tools, like AnnotationVisualTool, RectangularSelectionTool, CustomSelectionTool.

    Basics concepts of the interactive communication model are:


    Basic working principles of interactive communication model

    There are five basic work steps of this model:
    1. The selected object in the interactive communication tool is counted as active object, the tool gets the interactive communication controller from current object, and this controller is counted as active controller of interactive communication.
    2. Visual tool performs call of UpdateInteractionAreas method from active controller and gets the list of interaction areas through InteractionAreas property of interactive controller. Interaction areas are displayed over other interactive objects in image viewer.
    3. Visual tool of interactive communication 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 events of interactive communication according to the type of interaction area and then are directed to active controller using IinteractionController.OnInteraction(InteractionEventArgs) method.
    4. The interactive communication controller in OnInteraction method performs the logic of communication 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 event of interaction 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 controller changes any property, which varies object's state (e.g. Rotation angle), the object will generate StateChanged event to which is subscribed the tool of interactive communication. The tool will be performing the update of interactive areas in active controller and then the redrawing of interactive object and interactive communication areas.


    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 interactive communication controllers

    Controllers of interactive communication are divided into two 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 controller of interactive communication, can combine the work of several interactive controllers and is used to:

    Hierarchy of interaction areas

    Interaction areas are divided into three groups for convenience:

    The base class for all interaction areas is InteractionArea class.

    Points of object interaction:

    Interaction areas connected with object:

    Interaction areas connected with image viewer: