# User documentation of the annotation interface

## Layout
The interface is used to annotate Arkindex elements creating new sub-elements.
It is divided into two separated parts:
* In the left side, zone an editor allows to drawn and edit shapes over the main element's image.
* In the right side, every drawn zone is linked to a form allowing the creation of a sub-element.
> When initializating, the editor will look for existing annotations and display them as instanciated elements.
## Zone editor
To use the zone editor, tools must be toggled using the buttons bar above the image.
### Drawing
The editor offers two tools for drawing purpose, `RECTANGLE` and `POLYGON`.
* `RECTANGLE`
Allows to draw simple rectangles quickly.
It uses "drag-and-drop" pointing gesture: use the pointer to click on the first rectangle corner, hold down, drag the pointer to the opposite corner then release.
* `POLYGON`
Allows to create complex shapes.
They are created point by point clicking on the image. To close the shape, double click on the last point or click again on the first point.
### Editing
Once created, shapes may be edited.
* `SELECT`
Allows to select an existing shape.
Points composing the shape can be moved. Shape may be deleted, which may cause an, existing sub-element to be detached from its editor shape.
* `DELETE`
Delete a selected zone.
This button is visible when an existing zone is selected and allows to delete a shape in the zone editor only.
⚠️ Deleting a zone will remove the corresponding element creation form only if the annotation has not been created yet (e.g. with the `CREATE` button). Otherwise, a warning will be displayed and annotation will not be deleted.
* `RESET`
Clean all shapes.
It is required not to use it except for a full clean of the zone editor.
⚠️ As for `DELETE` button this will **not** delete existing annotated sub-elements. Therefore they zones will not be visible in zone editor anymore.
## Element editor
Every drawn zone should be linked to a form allowing to create a new annotation (which a sub-element of the current one). The form contains fields corresponding to annotated elements properties and actions buttons.
### Fields
* `Name` (optional)
Annotated element's name. This field is not required as a default name is provided depending on element's type.
* `Type` (mandatory)
This field is required and represents annotated element's type.
* `Class` (optional)
Element class is an optional field but is required to classify the annotated sub-element.
This fields offers automatic lookup to existing annotation classes.
Search terms may match any words in the class name, but only first results are retrieved. Those suggestions are the first matching classes alphabetically ordered.
In case more results are available, it is written at the bottom of suggestions (e.g. `and 12 more classes`). If the correct classification is not part of suggestions it is aadvised to add matching terms.
### Actions
* `CREATE`
Once a zone is drawn, annotation requires to be created to be saved.
This action requires the form to be valid.
* `VIEW ELEMENT`
Go to annotation details page.
This action will leave annotation page to display sub-element details. It may be useful in order to edit element's classes, which is not possible once element is instanciated.
* `UPDATE`
Update annotation.
This action may be triggered after altering the annotation zone or fields values in order to save the annotation.
* `DELETE`
Delete annotation.
This will delete annotated sub-element from Arkindex database.
Zone and creation form will still be visible in annotation interface and could be used to instanciate annotation again.
Once element is deleted, its zone may be removed from zone editor.