RED-8825: general layoutparsing improvements

* fix RulingCleaningService
This commit is contained in:
Kilian Schuettler 2024-05-02 23:00:22 +02:00
parent b6f0a21886
commit a3decd292d
2 changed files with 8 additions and 9 deletions

View File

@ -146,7 +146,6 @@ public class TextPositionSequence extends BoundingBox implements CharSequence {
this.pageHeight = textPositions.get(0).getPageHeight();
this.pageWidth = textPositions.get(0).getPageWidth();
setToBBoxOfComponents(getTextPositions());
;
}

View File

@ -103,30 +103,30 @@ public class RulingCleaningService {
private static Rectangle2D getOverlapRectangle(Ruling ruling) {
float top;
float left;
float y;
float x;
float w;
float h;
if (ruling.x1 < ruling.x2) {
left = ruling.x1;
x = ruling.x1;
w = ruling.x2 - ruling.x1;
} else {
left = ruling.x2;
x = ruling.x2;
w = ruling.x1 - ruling.x2;
}
if (ruling.y1 < ruling.y2) {
top = ruling.y1;
y = ruling.y1;
h = ruling.y2 - ruling.y1;
} else {
top = ruling.y2;
y = ruling.y2;
h = ruling.y1 - ruling.y2;
}
if (ruling.isHorizontal()) {
return new Rectangle2D.Double(top - THRESHOLD_Y_HORIZONTAL, left - THRESHOLD_X_HORIZONTAL, w + 2 * THRESHOLD_X_HORIZONTAL, h + 2 * THRESHOLD_Y_HORIZONTAL);
return new Rectangle2D.Double(x - THRESHOLD_Y_HORIZONTAL, y - THRESHOLD_X_HORIZONTAL, w + 2 * THRESHOLD_X_HORIZONTAL, h + 2 * THRESHOLD_Y_HORIZONTAL);
} else {
return new Rectangle2D.Double(top - THRESHOLD_Y_VERTICAL, left - THRESHOLD_X_VERTICAL, w + 2 * THRESHOLD_X_VERTICAL, h + 2 * THRESHOLD_Y_VERTICAL);
return new Rectangle2D.Double(x - THRESHOLD_Y_VERTICAL, y - THRESHOLD_X_VERTICAL, w + 2 * THRESHOLD_X_VERTICAL, h + 2 * THRESHOLD_Y_VERTICAL);
}
}