Skip to content

Commit

Permalink
Apply the changes
Browse files Browse the repository at this point in the history
  • Loading branch information
sadra-barikbin authored and stweil committed Apr 26, 2024
1 parent d6f0073 commit 6802705
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 24 deletions.
4 changes: 2 additions & 2 deletions src/textord/alignedblob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ ScrollView *AlignedBlob::DisplayTabs(const char *window_name, ScrollView *tab_wi
tab_win = MakeWindow(0, 50, window_name);
}
// For every tab in the grid, display it.
GridSearch<BLOBNBOX, BLOBNBOX_CLIST, BLOBNBOX_C_IT> gsearch(this);
BlobGridSearch gsearch(this);
gsearch.StartFullSearch();
BLOBNBOX *bbox;
while ((bbox = gsearch.NextFullSearch()) != nullptr) {
Expand Down Expand Up @@ -409,7 +409,7 @@ BLOBNBOX *AlignedBlob::FindAlignedBlob(const AlignedBlobParams &p, bool top_to_b
xmin -= p.min_gutter;
}
// Setup a vertical search for an aligned blob.
GridSearch<BLOBNBOX, BLOBNBOX_CLIST, BLOBNBOX_C_IT> vsearch(this);
BlobGridSearch vsearch(this);
if (WithinTestRegion(2, x_start, start_y)) {
tprintf("Starting %s %s search at %d-%d,%d, search_size=%d, gutter=%d\n",
p.ragged ? "Ragged" : "Aligned", p.right_tab ? "Right" : "Left", xmin, xmax, start_y,
Expand Down
4 changes: 2 additions & 2 deletions src/textord/colfind.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -971,7 +971,7 @@ void ColumnFinder::ReleaseBlobsAndCleanupUnused(TO_BLOCK *block) {
// Splits partitions that cross columns where they have nothing in the gap.
void ColumnFinder::GridSplitPartitions() {
// Iterate the ColPartitions in the grid.
GridSearch<ColPartition, ColPartition_CLIST, ColPartition_C_IT> gsearch(&part_grid_);
ColPartitionGridSearch gsearch(&part_grid_);
gsearch.StartFullSearch();
ColPartition *dont_repeat = nullptr;
ColPartition *part;
Expand Down Expand Up @@ -1438,7 +1438,7 @@ void ColumnFinder::TransformToBlocks(BLOCK_LIST *blocks, TO_BLOCK_LIST *to_block
// like horizontal lines going before the text lines above them.
ColPartition_CLIST temp_part_list;
// Iterate the ColPartitions in the grid. It starts at the top
GridSearch<ColPartition, ColPartition_CLIST, ColPartition_C_IT> gsearch(&part_grid_);
ColPartitionGridSearch gsearch(&part_grid_);
gsearch.StartFullSearch();
int prev_grid_y = -1;
ColPartition *part;
Expand Down
2 changes: 1 addition & 1 deletion src/textord/tabfind.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,7 @@ ScrollView *TabFind::FindTabBoxes(int min_gutter_width, double tabfind_aligned_g
left_tab_boxes_.clear();
right_tab_boxes_.clear();
// For every bbox in the grid, determine whether it uses a tab on an edge.
GridSearch<BLOBNBOX, BLOBNBOX_CLIST, BLOBNBOX_C_IT> gsearch(this);
BlobGridSearch gsearch(this);
gsearch.StartFullSearch();
BLOBNBOX *bbox;
while ((bbox = gsearch.NextFullSearch()) != nullptr) {
Expand Down
30 changes: 11 additions & 19 deletions src/textord/tablefind.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -679,8 +679,7 @@ void TableFinder::SetVerticalSpacing(ColPartition *part) {

TBOX part_box = part->bounding_box();
// Start a rect search
GridSearch<ColPartition, ColPartition_CLIST, ColPartition_C_IT> rectsearch(
&clean_part_grid_);
ColPartitionGridSearch rectsearch(&clean_part_grid_);
rectsearch.StartRectSearch(box);
ColPartition *neighbor;
int min_space_above = kMaxVerticalSpacing;
Expand Down Expand Up @@ -843,8 +842,7 @@ void TableFinder::MarkTablePartitions() {
// 4- Partitions with leaders before/after them.
void TableFinder::MarkPartitionsUsingLocalInformation() {
// Iterate the ColPartitions in the grid.
GridSearch<ColPartition, ColPartition_CLIST, ColPartition_C_IT> gsearch(
&clean_part_grid_);
ColPartitionGridSearch gsearch(&clean_part_grid_);
gsearch.StartFullSearch();
ColPartition *part = nullptr;
while ((part = gsearch.NextFullSearch()) != nullptr) {
Expand Down Expand Up @@ -1190,8 +1188,7 @@ void TableFinder::SetColumnsType(ColSegment_LIST *column_blocks) {
TBOX box = seg->bounding_box();
int num_table_cells = 0;
int num_text_cells = 0;
GridSearch<ColPartition, ColPartition_CLIST, ColPartition_C_IT> rsearch(
&clean_part_grid_);
ColPartitionGridSearch rsearch(&clean_part_grid_);
rsearch.SetUniqueMode(true);
rsearch.StartRectSearch(box);
ColPartition *part = nullptr;
Expand Down Expand Up @@ -1320,8 +1317,7 @@ void TableFinder::GridMergeColumnBlocks() {
void TableFinder::GetTableColumns(ColSegment_LIST *table_columns) {
ColSegment_IT it(table_columns);
// Iterate the ColPartitions in the grid.
GridSearch<ColPartition, ColPartition_CLIST, ColPartition_C_IT> gsearch(
&clean_part_grid_);
ColPartitionGridSearch gsearch(&clean_part_grid_);
gsearch.StartFullSearch();
ColPartition *part;
while ((part = gsearch.NextFullSearch()) != nullptr) {
Expand All @@ -1335,8 +1331,7 @@ void TableFinder::GetTableColumns(ColSegment_LIST *table_columns) {
// Start a search below the current cell to find bottom neighbours
// Note: a full search will always process things above it first, so
// this should be starting at the highest cell and working its way down.
GridSearch<ColPartition, ColPartition_CLIST, ColPartition_C_IT> vsearch(
&clean_part_grid_);
ColPartitionGridSearch vsearch(&clean_part_grid_);
vsearch.StartVerticalSearch(box.left(), box.right(), box.bottom());
ColPartition *neighbor = nullptr;
bool found_neighbours = false;
Expand Down Expand Up @@ -1503,8 +1498,7 @@ bool TableFinder::BelongToOneTable(const TBOX &box1, const TBOX &box2) {
// Check for ColPartitions spanning both table regions
TBOX bbox = box1.bounding_union(box2);
// Start a rect search on bbox
GridSearch<ColPartition, ColPartition_CLIST, ColPartition_C_IT> rectsearch(
&clean_part_grid_);
ColPartitionGridSearch rectsearch(&clean_part_grid_);
rectsearch.StartRectSearch(bbox);
ColPartition *part = nullptr;
while ((part = rectsearch.NextRectSearch()) != nullptr) {
Expand Down Expand Up @@ -1783,8 +1777,7 @@ void TableFinder::DeleteSingleColumnTables() {
table_xprojection[i] = 0;
}
// Start a rect search on table_box
GridSearch<ColPartition, ColPartition_CLIST, ColPartition_C_IT> rectsearch(
&clean_part_grid_);
ColPartitionGridSearch rectsearch(&clean_part_grid_);
rectsearch.SetUniqueMode(true);
rectsearch.StartRectSearch(table_box);
ColPartition *part;
Expand Down Expand Up @@ -1972,7 +1965,7 @@ void TableFinder::DisplayColPartitions(ScrollView *win, ColPartitionGrid *grid,
ScrollView::Color table_color) {
ScrollView::Color color = default_color;
// Iterate the ColPartitions in the grid.
GridSearch<ColPartition, ColPartition_CLIST, ColPartition_C_IT> gsearch(grid);
ColPartitionGridSearch gsearch(grid);
gsearch.StartFullSearch();
ColPartition *part = nullptr;
while ((part = gsearch.NextFullSearch()) != nullptr) {
Expand Down Expand Up @@ -2002,7 +1995,7 @@ void TableFinder::DisplayColPartitionConnections(ScrollView *win,
ColPartitionGrid *grid,
ScrollView::Color color) {
// Iterate the ColPartitions in the grid.
GridSearch<ColPartition, ColPartition_CLIST, ColPartition_C_IT> gsearch(grid);
ColPartitionGridSearch gsearch(grid);
gsearch.StartFullSearch();
ColPartition *part = nullptr;
while ((part = gsearch.NextFullSearch()) != nullptr) {
Expand Down Expand Up @@ -2048,7 +2041,7 @@ void TableFinder::MakeTableBlocks(ColPartitionGrid *grid,
const WidthCallback &width_cb) {
// Since we have table blocks already, remove table tags from all
// colpartitions
GridSearch<ColPartition, ColPartition_CLIST, ColPartition_C_IT> gsearch(grid);
ColPartitionGridSearch gsearch(grid);
gsearch.StartFullSearch();
ColPartition *part = nullptr;

Expand All @@ -2066,8 +2059,7 @@ void TableFinder::MakeTableBlocks(ColPartitionGrid *grid,
while ((table = table_search.NextFullSearch()) != nullptr) {
const TBOX &table_box = table->bounding_box();
// Start a rect search on table_box
GridSearch<ColPartition, ColPartition_CLIST, ColPartition_C_IT> rectsearch(
grid);
ColPartitionGridSearch rectsearch(grid);
rectsearch.StartRectSearch(table_box);
ColPartition *part;
ColPartition *table_partition = nullptr;
Expand Down

0 comments on commit 6802705

Please sign in to comment.