-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ocrd_page: invalidate
AlternativeImage
s automatically…
- whenever overwriting `Border`'s `Coords` or `Coords/@points`, remove all the `Page`'s derived images with `cropped` - whenever overwriting `Region`'s or `TextLine`'s or `Word`'s or `Glyph`'s `Coords` or `Coords/@points`, remove all its derived images - whenever overwriting `Page`'s or `Region`'s `@orientation`, remove all its derived images with `deskewed` - add a warning to the GdsCollector each time
Showing
5 changed files
with
275 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
def set_Coords(self, Coords): | ||
""" | ||
Set coordinate polygon by given object. | ||
Moreover, invalidate self's AlternativeImages | ||
(because they will have been cropped with a bbox | ||
of the previous polygon). | ||
""" | ||
if hasattr(self, 'invalidate_AlternativeImage'): | ||
# RegionType, TextLineType, WordType, GlyphType: | ||
self.invalidate_AlternativeImage() | ||
elif hasattr(self, 'parent_object_') and hasattr(self.parent_object_, 'invalidate_AlternativeImage'): | ||
# BorderType: | ||
self.parent_object_.invalidate_AlternativeImage(feature_selector='cropped') | ||
self.Coords = Coords |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
def set_orientation(self, orientation): | ||
""" | ||
Set deskewing angle to given number. | ||
Moreover, invalidate self's AlternativeImages | ||
(because they will have been rotated and enlarged | ||
with the angle of the previous value). | ||
""" | ||
if hasattr(self, 'invalidate_AlternativeImage'): | ||
# PageType, RegionType: | ||
self.invalidate_AlternativeImage(feature_selector='deskewed') | ||
self.orientation = orientation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
def set_points(self, points): | ||
""" | ||
Set coordinate polygon by given string. | ||
Moreover, invalidate the parent's AlternativeImages | ||
(because they will have been cropped with a bbox | ||
of the previous polygon). | ||
""" | ||
if hasattr(self, 'parent_object_'): | ||
parent = self.parent_object_ | ||
if hasattr(parent, 'invalidate_AlternativeImage'): | ||
# RegionType, TextLineType, WordType, GlyphType: | ||
parent.invalidate_AlternativeImage() | ||
elif hasattr(parent, 'parent_object_') and hasattr(parent.parent_object_, 'invalidate_AlternativeImage'): | ||
# BorderType: | ||
parent.parent_object_.invalidate_AlternativeImage(feature_selector='cropped') | ||
self.points = points |