tesseract  5.0.0-alpha-619-ge9db
tesseract::ColSegment Class Reference

#include <tablefind.h>

Inheritance diagram for tesseract::ColSegment:
ELIST_LINK

Public Member Functions

 ColSegment ()
 
 ~ColSegment ()=default
 
const TBOXbounding_box () const
 
void set_top (int y)
 
void set_bottom (int y)
 
void set_left (int x)
 
void set_right (int x)
 
void set_bounding_box (const TBOX &other)
 
int get_num_table_cells () const
 
void set_num_table_cells (int n)
 
int get_num_text_cells () const
 
void set_num_text_cells (int n)
 
ColSegType type () const
 
void set_type ()
 
ScrollView::Color BoxColor () const
 
void InsertBox (const TBOX &other)
 
- Public Member Functions inherited from ELIST_LINK
 ELIST_LINK ()
 
 ELIST_LINK (const ELIST_LINK &)
 
void operator= (const ELIST_LINK &)
 

Detailed Description

Definition at line 45 of file tablefind.h.

Constructor & Destructor Documentation

◆ ColSegment()

tesseract::ColSegment::ColSegment ( )

Definition at line 2062 of file tablefind.cpp.

2063  : ELIST_LINK(),
2064  num_table_cells_(0),
2065  num_text_cells_(0),
2066  type_(COL_UNKNOWN) {
2067 }

◆ ~ColSegment()

tesseract::ColSegment::~ColSegment ( )
default

Member Function Documentation

◆ bounding_box()

const TBOX& tesseract::ColSegment::bounding_box ( ) const
inline

Definition at line 51 of file tablefind.h.

51  {
52  return bounding_box_;
53  }

◆ BoxColor()

ScrollView::Color tesseract::ColSegment::BoxColor ( ) const

Definition at line 2070 of file tablefind.cpp.

2070  {
2071  const ScrollView::Color kBoxColors[PT_COUNT] = {
2076  };
2077  return kBoxColors[type_];
2078 }

◆ get_num_table_cells()

int tesseract::ColSegment::get_num_table_cells ( ) const
inline

Definition at line 75 of file tablefind.h.

75  {
76  return num_table_cells_;
77  }

◆ get_num_text_cells()

int tesseract::ColSegment::get_num_text_cells ( ) const
inline

Definition at line 84 of file tablefind.h.

84  {
85  return num_text_cells_;
86  }

◆ InsertBox()

void tesseract::ColSegment::InsertBox ( const TBOX other)

Definition at line 2081 of file tablefind.cpp.

2081  {
2082  bounding_box_ = bounding_box_.bounding_union(other);
2083 }

◆ set_bottom()

void tesseract::ColSegment::set_bottom ( int  y)
inline

Definition at line 59 of file tablefind.h.

59  {
60  bounding_box_.set_bottom(y);
61  }

◆ set_bounding_box()

void tesseract::ColSegment::set_bounding_box ( const TBOX other)
inline

Definition at line 71 of file tablefind.h.

71  {
72  bounding_box_ = other;
73  }

◆ set_left()

void tesseract::ColSegment::set_left ( int  x)
inline

Definition at line 63 of file tablefind.h.

63  {
64  bounding_box_.set_left(x);
65  }

◆ set_num_table_cells()

void tesseract::ColSegment::set_num_table_cells ( int  n)
inline

Definition at line 80 of file tablefind.h.

80  {
81  num_table_cells_ = n;
82  }

◆ set_num_text_cells()

void tesseract::ColSegment::set_num_text_cells ( int  n)
inline

Definition at line 89 of file tablefind.h.

89  {
90  num_text_cells_ = n;
91  }

◆ set_right()

void tesseract::ColSegment::set_right ( int  x)
inline

Definition at line 67 of file tablefind.h.

67  {
68  bounding_box_.set_right(x);
69  }

◆ set_top()

void tesseract::ColSegment::set_top ( int  y)
inline

Definition at line 55 of file tablefind.h.

55  {
56  bounding_box_.set_top(y);
57  }

◆ set_type()

void tesseract::ColSegment::set_type ( )

Definition at line 2087 of file tablefind.cpp.

2087  {
2088  if (num_table_cells_ > kTableColumnThreshold * num_text_cells_)
2089  type_ = COL_TABLE;
2090  else if (num_text_cells_ > num_table_cells_)
2091  type_ = COL_TEXT;
2092  else
2093  type_ = COL_MIXED;
2094 }

◆ type()

ColSegType tesseract::ColSegment::type ( ) const
inline

Definition at line 93 of file tablefind.h.

93  {
94  return type_;
95  }

The documentation for this class was generated from the following files:
ELIST_LINK::ELIST_LINK
ELIST_LINK()
Definition: elst.h:125
tesseract::COL_TEXT
Definition: tablefind.h:31
tesseract::kTableColumnThreshold
const double kTableColumnThreshold
Definition: tablefind.cpp:88
TBOX::bounding_union
TBOX bounding_union(const TBOX &box) const
Definition: rect.cpp:124
TBOX::set_top
void set_top(int y)
Definition: rect.h:60
ScrollView::BLUE
Definition: scrollview.h:108
PT_COUNT
Definition: capi.h:123
TBOX::set_right
void set_right(int x)
Definition: rect.h:81
tesseract::COL_TABLE
Definition: tablefind.h:32
ScrollView::MAGENTA
Definition: scrollview.h:109
ScrollView::YELLOW
Definition: scrollview.h:105
tesseract::COL_MIXED
Definition: tablefind.h:33
tesseract::COL_UNKNOWN
Definition: tablefind.h:30
TBOX::set_bottom
void set_bottom(int y)
Definition: rect.h:67
ScrollView::Color
Color
Definition: scrollview.h:100
TBOX::set_left
void set_left(int x)
Definition: rect.h:74