RED-8670: add table detection from idp result

* some 'slight' refactoring
This commit is contained in:
Kilian Schuettler 2025-01-09 11:35:07 +01:00
parent 36c7bdd317
commit 9adbd2bdbf

View File

@ -5,7 +5,6 @@ import java.awt.geom.Line2D;
import java.awt.geom.Point2D;
import java.awt.geom.Rectangle2D;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Objects;
@ -13,6 +12,8 @@ import java.util.stream.Stream;
import com.knecon.fforesight.service.ocr.v1.api.model.QuadPointData;
import lombok.Getter;
public final class QuadPoint {
/*
@ -21,9 +22,13 @@ public final class QuadPoint {
A|_____|D
*/
@Getter
private final Point2D a;
@Getter
private final Point2D b;
@Getter
private final Point2D c;
@Getter
private final Point2D d;
private Line2D left;
@ -93,7 +98,7 @@ public final class QuadPoint {
public Stream<Line2D> asLines() {
return Stream.of(new Line2D.Double(a(), b()), new Line2D.Double(b(), c()), new Line2D.Double(c(), d()), new Line2D.Double(d(), a()));
return Stream.of(new Line2D.Double(getA(), getB()), new Line2D.Double(getB(), getC()), new Line2D.Double(getC(), getD()), new Line2D.Double(getD(), getA()));
}
@ -238,14 +243,14 @@ public final class QuadPoint {
public String toString() {
return String.format("A:(%.2f, %.2f) | B:(%.2f, %.2f) | C:(%.2f, %.2f) | D:(%.2f, %.2f)",
a().getX(),
a().getY(),
b().getX(),
b().getY(),
c().getX(),
c().getY(),
d().getX(),
d().getY());
getA().getX(),
getA().getY(),
getB().getX(),
getB().getY(),
getC().getX(),
getC().getY(),
getD().getX(),
getD().getY());
}
@ -263,18 +268,6 @@ public final class QuadPoint {
}
public Point2D a() {return a;}
public Point2D b() {return b;}
public Point2D c() {return c;}
public Point2D d() {return d;}
@Override
public boolean equals(Object obj) {