Merge branch 'RED-8799' into 'release/0.89.x'
RED-8799: LayoutGrid is wrong draw for some tables See merge request fforesight/layout-parser!127
This commit is contained in:
commit
fbe9a34343
@ -110,11 +110,13 @@ public class LayoutGridService {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (Page page : table.getPages()) {
|
for (Page page : table.getPages()) {
|
||||||
|
|
||||||
Optional<Integer> optionalFirstRowOnPage = table.streamCol(0).filter(tableCell -> tableCell.isOnPage(page.getNumber())).map(TableCell::getRow).findFirst();
|
Optional<Integer> optionalFirstRowOnPage = table.streamCol(0).filter(tableCell -> tableCell.isOnPage(page.getNumber())).map(TableCell::getRow).findFirst();
|
||||||
if (optionalFirstRowOnPage.isEmpty()) {
|
if (optionalFirstRowOnPage.isEmpty()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
int firstRowOnPage = optionalFirstRowOnPage.get();
|
int firstRowOnPage = optionalFirstRowOnPage.get();
|
||||||
|
|
||||||
Stream<Double> xStream = switch (page.getRotation()) {
|
Stream<Double> xStream = switch (page.getRotation()) {
|
||||||
case 90 -> streamBBoxOfCellsOnPage(table.streamCol(0), page).map(RectangularShape::getMinX);
|
case 90 -> streamBBoxOfCellsOnPage(table.streamCol(0), page).map(RectangularShape::getMinX);
|
||||||
case 180 -> streamBBoxOfCellsOnPage(table.streamRow(firstRowOnPage), page).map(RectangularShape::getMaxX);
|
case 180 -> streamBBoxOfCellsOnPage(table.streamRow(firstRowOnPage), page).map(RectangularShape::getMaxX);
|
||||||
@ -123,6 +125,7 @@ public class LayoutGridService {
|
|||||||
};
|
};
|
||||||
List<Double> xs = xStream.collect(Collectors.toList());
|
List<Double> xs = xStream.collect(Collectors.toList());
|
||||||
xs.remove(0);
|
xs.remove(0);
|
||||||
|
|
||||||
Stream<Double> yStream = switch (page.getRotation()) {
|
Stream<Double> yStream = switch (page.getRotation()) {
|
||||||
case 90 -> streamBBoxOfCellsOnPage(table.streamRow(firstRowOnPage), page).map(RectangularShape::getMinY);
|
case 90 -> streamBBoxOfCellsOnPage(table.streamRow(firstRowOnPage), page).map(RectangularShape::getMinY);
|
||||||
case 180 -> streamBBoxOfCellsOnPage(table.streamCol(0), page).map(RectangularShape::getMinY);
|
case 180 -> streamBBoxOfCellsOnPage(table.streamCol(0), page).map(RectangularShape::getMinY);
|
||||||
@ -132,7 +135,7 @@ public class LayoutGridService {
|
|||||||
List<Double> ys = yStream.collect(Collectors.toList());
|
List<Double> ys = yStream.collect(Collectors.toList());
|
||||||
ys.remove(0);
|
ys.remove(0);
|
||||||
|
|
||||||
Rectangle2D tableBBox = table.getBBox().get(table.getFirstPage());
|
Rectangle2D tableBBox = table.getBBox().get(page);
|
||||||
List<ColoredLine> coloredLines = layoutGrid.getVisualizationsPerPages().get(page.getNumber() - 1).getColoredLines();
|
List<ColoredLine> coloredLines = layoutGrid.getVisualizationsPerPages().get(page.getNumber() - 1).getColoredLines();
|
||||||
xs.forEach(x -> {
|
xs.forEach(x -> {
|
||||||
Line2D line = new Line2D.Double(new Point2D.Double(x, tableBBox.getMaxY()), new Point2D.Double(x, tableBBox.getMinY()));
|
Line2D line = new Line2D.Double(new Point2D.Double(x, tableBBox.getMaxY()), new Point2D.Double(x, tableBBox.getMinY()));
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user