tesseract  5.0.0
tesseract::SharedTest Class Reference
Inheritance diagram for tesseract::SharedTest:
tesseract::StructuredTableTest tesseract::TableRecognizerTest

Protected Member Functions

void SetUp () override
 
void TearDown () override
 
void InsertPartitions ()
 
void InsertPartition (int left, int bottom, int right, int top)
 
void InsertLines ()
 
void InsertHorizontalLine (int left, int right, int y)
 
void InsertVerticalLine (int x, int bottom, int top)
 
void InsertCellsInLines ()
 

Protected Attributes

TBOX line_box_
 
std::unique_ptr< ColPartitionGridtext_grid_
 
std::unique_ptr< ColPartitionGridline_grid_
 
ColPartition_LIST allocated_parts_
 

Detailed Description

Definition at line 67 of file tablerecog_test.cc.

Member Function Documentation

◆ InsertCellsInLines()

void tesseract::SharedTest::InsertCellsInLines ( )
inlineprotected

Definition at line 135 of file tablerecog_test.cc.

135  {
136  for (int y = 10; y <= 50; y += 10) {
137  for (int x = 100; x <= 450; x += 50) {
138  InsertPartition(x + 1, y + 1, x + 49, y + 9);
139  }
140  }
141  }
void InsertPartition(int left, int bottom, int right, int top)

◆ InsertHorizontalLine()

void tesseract::SharedTest::InsertHorizontalLine ( int  left,
int  right,
int  y 
)
inlineprotected

Definition at line 118 of file tablerecog_test.cc.

118  {
119  TBOX box(left, y - line_grid_->gridsize(), right, y + line_grid_->gridsize());
120  ColPartition *part = ColPartition::FakePartition(box, PT_HORZ_LINE, BRT_HLINE, BTFT_NONE);
121  line_grid_->InsertBBox(true, true, part);
122 
123  tesseract::ColPartition_IT add_it(&allocated_parts_);
124  add_it.add_after_stay_put(part);
125  }
@ TBOX
@ BRT_HLINE
Definition: blobbox.h:76
@ BTFT_NONE
Definition: blobbox.h:111
@ PT_HORZ_LINE
Definition: publictypes.h:66
static ColPartition * FakePartition(const TBOX &box, PolyBlockType block_type, BlobRegionType blob_type, BlobTextFlowType flow)
ColPartition_LIST allocated_parts_
std::unique_ptr< ColPartitionGrid > line_grid_

◆ InsertLines()

void tesseract::SharedTest::InsertLines ( )
inlineprotected

Definition at line 103 of file tablerecog_test.cc.

103  {
104  line_box_.set_to_given_coords(100 - line_grid_->gridsize(), 10 - line_grid_->gridsize(),
105  450 + line_grid_->gridsize(), 50 + line_grid_->gridsize());
106  for (int i = 10; i <= 50; i += 10) {
107  InsertHorizontalLine(100, 450, i);
108  }
109  for (int i = 100; i <= 450; i += 50) {
110  InsertVerticalLine(i, 10, 50);
111  }
112 
113  for (int i = 100; i <= 200; i += 20) {
114  InsertHorizontalLine(0, 100, i);
115  }
116  }
void set_to_given_coords(int x_min, int y_min, int x_max, int y_max)
Definition: rect.h:282
void InsertVerticalLine(int x, int bottom, int top)
void InsertHorizontalLine(int left, int right, int y)

◆ InsertPartition()

void tesseract::SharedTest::InsertPartition ( int  left,
int  bottom,
int  right,
int  top 
)
inlineprotected

Definition at line 92 of file tablerecog_test.cc.

92  {
93  TBOX box(left, bottom, right, top);
95  part->set_median_width(3);
96  part->set_median_height(3);
97  text_grid_->InsertBBox(true, true, part);
98 
99  tesseract::ColPartition_IT add_it(&allocated_parts_);
100  add_it.add_after_stay_put(part);
101  }
@ BRT_TEXT
Definition: blobbox.h:82
@ PT_FLOWING_TEXT
Definition: publictypes.h:55
std::unique_ptr< ColPartitionGrid > text_grid_

◆ InsertPartitions()

void tesseract::SharedTest::InsertPartitions ( )
inlineprotected

Definition at line 84 of file tablerecog_test.cc.

84  {
85  for (int row = 0; row < 800; row += 20) {
86  for (int col = 0; col < 500; col += 25) {
87  InsertPartition(col + 1, row + 1, col + 24, row + 19);
88  }
89  }
90  }

◆ InsertVerticalLine()

void tesseract::SharedTest::InsertVerticalLine ( int  x,
int  bottom,
int  top 
)
inlineprotected

Definition at line 126 of file tablerecog_test.cc.

126  {
127  TBOX box(x - line_grid_->gridsize(), bottom, x + line_grid_->gridsize(), top);
128  ColPartition *part = ColPartition::FakePartition(box, PT_VERT_LINE, BRT_VLINE, BTFT_NONE);
129  line_grid_->InsertBBox(true, true, part);
130 
131  tesseract::ColPartition_IT add_it(&allocated_parts_);
132  add_it.add_after_stay_put(part);
133  }
@ BRT_VLINE
Definition: blobbox.h:77
@ PT_VERT_LINE
Definition: publictypes.h:67

◆ SetUp()

void tesseract::SharedTest::SetUp ( )
inlineoverrideprotected

Definition at line 69 of file tablerecog_test.cc.

69  {
70  std::locale::global(std::locale(""));
71  ICOORD bleft(0, 0);
72  ICOORD tright(1000, 1000);
73  text_grid_ = std::make_unique<ColPartitionGrid>(5, bleft, tright);
74  line_grid_ = std::make_unique<ColPartitionGrid>(5, bleft, tright);
75  }

◆ TearDown()

void tesseract::SharedTest::TearDown ( )
inlineoverrideprotected

Definition at line 77 of file tablerecog_test.cc.

77  {
78  tesseract::ColPartition_IT memory(&allocated_parts_);
79  for (memory.mark_cycle_pt(); !memory.cycled_list(); memory.forward()) {
80  memory.data()->DeleteBoxes();
81  }
82  }

Member Data Documentation

◆ allocated_parts_

ColPartition_LIST tesseract::SharedTest::allocated_parts_
protected

Definition at line 146 of file tablerecog_test.cc.

◆ line_box_

TBOX tesseract::SharedTest::line_box_
protected

Definition at line 143 of file tablerecog_test.cc.

◆ line_grid_

std::unique_ptr<ColPartitionGrid> tesseract::SharedTest::line_grid_
protected

Definition at line 145 of file tablerecog_test.cc.

◆ text_grid_

std::unique_ptr<ColPartitionGrid> tesseract::SharedTest::text_grid_
protected

Definition at line 144 of file tablerecog_test.cc.


The documentation for this class was generated from the following file: