This branch adds certain base functionalities to ease implementing all aspects which are needed for #214
What this PR implemented
Directly reads from PAGE XML files without skipping validation
Fixes a bug which produced invalid PAGE XML (TextEquiv at non-allowed location) and automatically fixes it in invalid PAGE XML on reading
Reimplements Polygons, Rectangles, Elements, etc. to actually represent their counterpart (e. g. Polygons now solemnly the actual coordinates in the PAGE XML and therefore don't possess an ID). This eases adding Baselines.
Adds certain helper functions / methods to reduce duplicate code fragments (e. g. for custom Polygon creation from PAGE XML)
Removes TextLines in the viewer in case a TextRegion (or subtype) is transformed to a region type which isn't allowed to directly have TextLines as children (e. g. paragraph -> ImageRegion)
Basic reimplementation of writing from frontend PageAnnotation to existing PAGE XML files. Instead of throwing away the existing PAGE XML and writing a brand new one from the PageAnnotation LAREX now tries to merge changes into the PAGE XML. This keeps elements which aren't currently editable and represented by LAREX (e. g. @comments) instead of discarding them. With this base implementation this doesn't apply to all possible transformations (see below).
What still needs to be implemented
Account for splitting / merging segments or textlines and keeping the ID / attributes / (text) content if the users selects this behavior. Switches should be added to the frontend for this. Prototypes for this already exist and will get merged ASAP after some additional local testing.
Currently changing the type of a Segment (this does not apply to adding a subtype to a TextRegion or changing from one subtype to another) leads to the destruction of the segment and the creation of a new one with the correct type. In the long run we should allow keeping all existing information which is also allowed in the new type (this has to be verified).
This PR changes core functionalities of the LAREX backend and therefore probably needs extensive testing. To speed up testing this in combination with other new functionalities and to avoid merge conflicts with upcoming branches of colleagues we decided on a "fast merge" of the PR. A 100% stable dev branch can therefore not be guaranteed (which probably holds true anyways) until it was extensively tested and possibly needed fixes are merged.
This branch adds certain base functionalities to ease implementing all aspects which are needed for #214
What this PR implemented
TextEquiv
at non-allowed location) and automatically fixes it in invalid PAGE XML on readingparagraph
->ImageRegion
)@comments
) instead of discarding them. With this base implementation this doesn't apply to all possible transformations (see below).What still needs to be implemented
This PR changes core functionalities of the LAREX backend and therefore probably needs extensive testing. To speed up testing this in combination with other new functionalities and to avoid merge conflicts with upcoming branches of colleagues we decided on a "fast merge" of the PR. A 100% stable dev branch can therefore not be guaranteed (which probably holds true anyways) until it was extensively tested and possibly needed fixes are merged.