RED-8670: add table detection from idp result
* some 'slight' refactoring
This commit is contained in:
parent
59f7c7c6a3
commit
0a4cd759a7
@ -5,7 +5,6 @@ import java.awt.geom.Line2D;
|
|||||||
import java.awt.geom.Point2D;
|
import java.awt.geom.Point2D;
|
||||||
import java.awt.geom.Rectangle2D;
|
import java.awt.geom.Rectangle2D;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
@ -13,6 +12,8 @@ import java.util.stream.Stream;
|
|||||||
|
|
||||||
import com.knecon.fforesight.service.ocr.v1.api.model.QuadPointData;
|
import com.knecon.fforesight.service.ocr.v1.api.model.QuadPointData;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
public final class QuadPoint {
|
public final class QuadPoint {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -21,9 +22,13 @@ public final class QuadPoint {
|
|||||||
A|_____|D
|
A|_____|D
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@Getter
|
||||||
private final Point2D a;
|
private final Point2D a;
|
||||||
|
@Getter
|
||||||
private final Point2D b;
|
private final Point2D b;
|
||||||
|
@Getter
|
||||||
private final Point2D c;
|
private final Point2D c;
|
||||||
|
@Getter
|
||||||
private final Point2D d;
|
private final Point2D d;
|
||||||
|
|
||||||
private Line2D left;
|
private Line2D left;
|
||||||
@ -93,7 +98,7 @@ public final class QuadPoint {
|
|||||||
|
|
||||||
public Stream<Line2D> asLines() {
|
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() {
|
public String toString() {
|
||||||
|
|
||||||
return String.format("A:(%.2f, %.2f) | B:(%.2f, %.2f) | C:(%.2f, %.2f) | D:(%.2f, %.2f)",
|
return String.format("A:(%.2f, %.2f) | B:(%.2f, %.2f) | C:(%.2f, %.2f) | D:(%.2f, %.2f)",
|
||||||
a().getX(),
|
getA().getX(),
|
||||||
a().getY(),
|
getA().getY(),
|
||||||
b().getX(),
|
getB().getX(),
|
||||||
b().getY(),
|
getB().getY(),
|
||||||
c().getX(),
|
getC().getX(),
|
||||||
c().getY(),
|
getC().getY(),
|
||||||
d().getX(),
|
getD().getX(),
|
||||||
d().getY());
|
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
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user