Fix annotating single letter entities
This commit is contained in:
parent
8b1574845c
commit
8e5ff31810
@ -130,18 +130,22 @@ public class AnnotationHighlightService {
|
|||||||
private List<Rectangle> getRectanglesPerLine(List<TextPosition> textPositions, int page) {
|
private List<Rectangle> getRectanglesPerLine(List<TextPosition> textPositions, int page) {
|
||||||
|
|
||||||
List<Rectangle> rectangles = new ArrayList<>();
|
List<Rectangle> rectangles = new ArrayList<>();
|
||||||
float y = textPositions.get(0).getYDirAdj();
|
if (textPositions.size() == 1) {
|
||||||
int startIndex = 0;
|
rectangles.add(new TextPositionSequence(textPositions, page).getRectangle());
|
||||||
for (int i = 1; i < textPositions.size(); i++) {
|
} else {
|
||||||
float yDirAdj = textPositions.get(i).getYDirAdj();
|
float y = textPositions.get(0).getYDirAdj();
|
||||||
if (yDirAdj != y) {
|
int startIndex = 0;
|
||||||
rectangles.add(new TextPositionSequence(textPositions.subList(startIndex, i), page).getRectangle());
|
for (int i = 1; i < textPositions.size(); i++) {
|
||||||
y = yDirAdj;
|
float yDirAdj = textPositions.get(i).getYDirAdj();
|
||||||
startIndex = i;
|
if (yDirAdj != y) {
|
||||||
|
rectangles.add(new TextPositionSequence(textPositions.subList(startIndex, i), page).getRectangle());
|
||||||
|
y = yDirAdj;
|
||||||
|
startIndex = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (startIndex != textPositions.size() - 1) {
|
||||||
|
rectangles.add(new TextPositionSequence(textPositions.subList(startIndex, textPositions.size()), page).getRectangle());
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (startIndex != textPositions.size() - 1) {
|
|
||||||
rectangles.add(new TextPositionSequence(textPositions.subList(startIndex, textPositions.size()), page).getRectangle());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return rectangles;
|
return rectangles;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user