Annotations - Guy-Dentelle-Neupre/DiBL GitHub Wiki
DiBL relies on conventions and annotations in a diagram to replace stitches.
First of all a stitch can only be replaced with one that has endpoints at the same position. So a cloth stitch (ctc) oriented as an X can't be replaced with a cloth stitch oriented as a K or with a tctc that is larger.
Annotations define which stitches can be replaced with which. Currently annotations are implemented as XML-attributes `inkscape:label`. These labels appear in the tree view of the XML editor. When selecting an element from the tree, the corresponding element is selected on the canvas and the other way around.
Stitches to be replaced are direct members of a group annotated with "base tile". Possible replacements are direct members of a group annotated with "pile". The stitches in turn are also annotated.
Stitches in the base tile are clones in inkscape terminology or use-elements in SVG terminology. Annotations of these clones correspond to a cell in the matrix of the text file of a pair traversal pattern. Hence a capital letter for the columns (like the common practice for spreadsheets) and a digit for the row. Though other templates are not related to matrices, the application needs the same notation of one capital followed by one digit.
Stitches in the pile have annotations with two parts. The first part is an identifier for the type of stitch, such as tc, tcptc, ctc and tctc. Note that not all of these stitches are available in all templates. The second part matches the orientation, they match the [InputFiles#Nodes_/_Tuples] in the matrix of a text file.
Stitches are replaced by changing the "`xlink:href`" values of the clones in the "`base tile`" with ids of other annotated stitches in the "`pile`". DiBL uses two matrices to construct a diagram from a pair traversal pattern: one with tuples from the text version of a pair traversal pattern, the other with stitch identifiers.
In the following screenshot the blue elipses highlight the annotation conventions. The red elipses illustrate the replacement mechanism.