Architecture Notes - Kinovea


0. Overview
1. Kinovea.Root
2. Kinovea.FileBrowser
3. Kinovea.Updater
4. Kinovea.ScreenManager
5. Kinovea.PlayerServer
6. Kinovea.Services
[2008-07-13 - Joan Charmant - infos at kinovea dot org]


Overview


Encapsulation and Hierarchy :

Fig1. Modules Tree

- The top modules call the bottom ones. (Root calls in FileBrowser...)
- No calls are made bottom up.
- No calls are made at same level (except within the same module).
- Each module is responsible for its UI block, its menu extensions, etc.
- Root is responsible for holding the main Window and the program entry point.
- Since the architecture has been simplified in 0.7.x series, there is only 2 levels, Root module and others.


Module Organization, the Facade.


Fig2. Inside A Module

- Each module has a Kernel object that should be the only object directly called from upper modules.
- The Kernels implements an interface that allows the whole module tree to be built at run time.
- The Kernel of a module holds the UI block, menu extension, and sub modules (not represented on image).
- When the Kernel of a module is constructed, it constructs its sub modules and merges the UI blocks of the sub tree in a recursive way.

Command pattern

- Each undoable action is encapsulated in a Command class.
- Commands are then stacked into an history by the CommandManager, which handles undo/redo.

The Delegate Pool
- This is an area of global methods, (which doesn't break encapsulation).
- The delegate pools has a list of "services". Those "services" are affected by the module that expose them, and can be consumed by any module. 
- For exemple the ScreenManager expose a "StopPlaying" service that enable any module to temporarily stop the play back of the video.
- Unlike a direct call, if the service is not there, it doesn't break anything.



1. Kinovea.Root


- Organizes the module tree by loading its sub modules recursively. (In the new architecture, it's the only module to actually have sub modules).
- Its UI is split in two classes : MainWindow and SupervisorUserInterface (Mainly a container for sub modules controls).
- MainWindow contains the main menu, toolbar and status bar that are extended by sub modules.
- Holds the Preferences system.
- Holds the Help System. (Help videos dialog, links to the Manuals)
- Holds the About form.
- Holds the SplashScreen form and logic.


2. Kinovea.FileBrowser

- File Browser Control.
- This will probably be completed in the future.


3. Kinovea.Updater

- Holds the updating dialog.
- Connects to the internet on demand.
- Compares current state with server state through HelpIndex.xml files.
- Three categories of updatable content : software, videos and manuals. (For each supported locale.)


4. Kinovea.ScreenManager

- Supervisor for screens.
- Holds Screens. ( zero, one or two screens)
- Handles synchronization.

Fig3. Under the ScreenManager

PlayerScreen
- Holds the main control for Player screen.
- Playback loop and controls.
- Working Zone selection.
- Analysis mode switch.
- Metadata (Key Images, Drawings, Comments, Tracks) - import, export, display.
- Still Image Exports. (single, rafale, pdf)
- Grid and 3D Plane display.
- Link to PlayerServer for lower level actions (video saving, color adjustments)

CaptureScreen
- Placeholder for future implementation.


5. Kinovea.PlayerServer

- (This module is in C++/CLI).
- Lower level functions.
- Talks to FFMpeg dlls for Video load and save.
- Holds the current image to be displayed by the PlayerScreen.
- Holds the complete list of images for Anlaysis Mode.
- Talks to AForge for Image Adjustment.

6. Kinovea.Services

- Common and Utility classes.
- Can be called from anywhere (no dependencies on other modules).
- Command Manager and Command History logic.
- Preference Manager (import/export).
- Help System Classes.
- Delegates Pool.