From 6802705cf07131bbcc780d7109af300e13338310 Mon Sep 17 00:00:00 2001 From: Sadra Barikbin Date: Thu, 25 Apr 2024 20:37:47 +0330 Subject: [PATCH] Apply the changes --- src/textord/alignedblob.cpp | 4 ++-- src/textord/colfind.cpp | 4 ++-- src/textord/tabfind.cpp | 2 +- src/textord/tablefind.cpp | 30 +++++++++++------------------- 4 files changed, 16 insertions(+), 24 deletions(-) diff --git a/src/textord/alignedblob.cpp b/src/textord/alignedblob.cpp index 4acfc9bc33..781f641841 100644 --- a/src/textord/alignedblob.cpp +++ b/src/textord/alignedblob.cpp @@ -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 gsearch(this); + BlobGridSearch gsearch(this); gsearch.StartFullSearch(); BLOBNBOX *bbox; while ((bbox = gsearch.NextFullSearch()) != nullptr) { @@ -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 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, diff --git a/src/textord/colfind.cpp b/src/textord/colfind.cpp index 3e97c2858e..d64f25dfc4 100644 --- a/src/textord/colfind.cpp +++ b/src/textord/colfind.cpp @@ -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 gsearch(&part_grid_); + ColPartitionGridSearch gsearch(&part_grid_); gsearch.StartFullSearch(); ColPartition *dont_repeat = nullptr; ColPartition *part; @@ -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 gsearch(&part_grid_); + ColPartitionGridSearch gsearch(&part_grid_); gsearch.StartFullSearch(); int prev_grid_y = -1; ColPartition *part; diff --git a/src/textord/tabfind.cpp b/src/textord/tabfind.cpp index 462d0ff9b9..f6ba2b8477 100644 --- a/src/textord/tabfind.cpp +++ b/src/textord/tabfind.cpp @@ -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 gsearch(this); + BlobGridSearch gsearch(this); gsearch.StartFullSearch(); BLOBNBOX *bbox; while ((bbox = gsearch.NextFullSearch()) != nullptr) { diff --git a/src/textord/tablefind.cpp b/src/textord/tablefind.cpp index 843754cbd8..2ed4e495e7 100644 --- a/src/textord/tablefind.cpp +++ b/src/textord/tablefind.cpp @@ -679,8 +679,7 @@ void TableFinder::SetVerticalSpacing(ColPartition *part) { TBOX part_box = part->bounding_box(); // Start a rect search - GridSearch rectsearch( - &clean_part_grid_); + ColPartitionGridSearch rectsearch(&clean_part_grid_); rectsearch.StartRectSearch(box); ColPartition *neighbor; int min_space_above = kMaxVerticalSpacing; @@ -843,8 +842,7 @@ void TableFinder::MarkTablePartitions() { // 4- Partitions with leaders before/after them. void TableFinder::MarkPartitionsUsingLocalInformation() { // Iterate the ColPartitions in the grid. - GridSearch gsearch( - &clean_part_grid_); + ColPartitionGridSearch gsearch(&clean_part_grid_); gsearch.StartFullSearch(); ColPartition *part = nullptr; while ((part = gsearch.NextFullSearch()) != nullptr) { @@ -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 rsearch( - &clean_part_grid_); + ColPartitionGridSearch rsearch(&clean_part_grid_); rsearch.SetUniqueMode(true); rsearch.StartRectSearch(box); ColPartition *part = nullptr; @@ -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 gsearch( - &clean_part_grid_); + ColPartitionGridSearch gsearch(&clean_part_grid_); gsearch.StartFullSearch(); ColPartition *part; while ((part = gsearch.NextFullSearch()) != nullptr) { @@ -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 vsearch( - &clean_part_grid_); + ColPartitionGridSearch vsearch(&clean_part_grid_); vsearch.StartVerticalSearch(box.left(), box.right(), box.bottom()); ColPartition *neighbor = nullptr; bool found_neighbours = false; @@ -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 rectsearch( - &clean_part_grid_); + ColPartitionGridSearch rectsearch(&clean_part_grid_); rectsearch.StartRectSearch(bbox); ColPartition *part = nullptr; while ((part = rectsearch.NextRectSearch()) != nullptr) { @@ -1783,8 +1777,7 @@ void TableFinder::DeleteSingleColumnTables() { table_xprojection[i] = 0; } // Start a rect search on table_box - GridSearch rectsearch( - &clean_part_grid_); + ColPartitionGridSearch rectsearch(&clean_part_grid_); rectsearch.SetUniqueMode(true); rectsearch.StartRectSearch(table_box); ColPartition *part; @@ -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 gsearch(grid); + ColPartitionGridSearch gsearch(grid); gsearch.StartFullSearch(); ColPartition *part = nullptr; while ((part = gsearch.NextFullSearch()) != nullptr) { @@ -2002,7 +1995,7 @@ void TableFinder::DisplayColPartitionConnections(ScrollView *win, ColPartitionGrid *grid, ScrollView::Color color) { // Iterate the ColPartitions in the grid. - GridSearch gsearch(grid); + ColPartitionGridSearch gsearch(grid); gsearch.StartFullSearch(); ColPartition *part = nullptr; while ((part = gsearch.NextFullSearch()) != nullptr) { @@ -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 gsearch(grid); + ColPartitionGridSearch gsearch(grid); gsearch.StartFullSearch(); ColPartition *part = nullptr; @@ -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 rectsearch( - grid); + ColPartitionGridSearch rectsearch(grid); rectsearch.StartRectSearch(table_box); ColPartition *part; ColPartition *table_partition = nullptr;