RSS-265: Fixed problem in sorting positions across pages
This commit is contained in:
parent
0d353f99cd
commit
b0fc3c3d71
@ -222,14 +222,10 @@ public class SearchableText {
|
|||||||
var quickSorted = new ArrayList<>(sequences);
|
var quickSorted = new ArrayList<>(sequences);
|
||||||
QuickSort.sort(quickSorted, new TextPositionSequenceComparator());
|
QuickSort.sort(quickSorted, new TextPositionSequenceComparator());
|
||||||
|
|
||||||
var sorted = quickSorted.stream()
|
|
||||||
.sorted(Comparator.comparing(a -> a.getPage()))
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
|
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
|
|
||||||
TextPositionSequence previous = null;
|
TextPositionSequence previous = null;
|
||||||
for (TextPositionSequence word : sorted) {
|
for (TextPositionSequence word : quickSorted) {
|
||||||
|
|
||||||
if (previous != null) {
|
if (previous != null) {
|
||||||
if (Math.abs(previous.getMaxYDirAdj() - word.getMaxYDirAdj()) > word.getTextHeight()) {
|
if (Math.abs(previous.getMaxYDirAdj() - word.getMaxYDirAdj()) > word.getTextHeight()) {
|
||||||
|
|||||||
@ -14,6 +14,11 @@ public class TextPositionSequenceComparator implements Comparator<TextPositionSe
|
|||||||
return cmp1;
|
return cmp1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int page = Integer.compare(pos1.getPage(), pos2.getPage());
|
||||||
|
if (page != 0){
|
||||||
|
return page;
|
||||||
|
}
|
||||||
|
|
||||||
// get the text direction adjusted coordinates
|
// get the text direction adjusted coordinates
|
||||||
float x1 = pos1.getMinXDirAdj();
|
float x1 = pos1.getMinXDirAdj();
|
||||||
float x2 = pos2.getMinXDirAdj();
|
float x2 = pos2.getMinXDirAdj();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user