All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
tesseract::GridBase Class Reference

#include <bbgrid.h>

Inheritance diagram for tesseract::GridBase:
tesseract::BBGrid< BLOBNBOX, BLOBNBOX_CLIST, BLOBNBOX_C_IT > tesseract::BBGrid< ColPartition, ColPartition_CLIST, ColPartition_C_IT > tesseract::BBGrid< ColSegment, ColSegment_CLIST, ColSegment_C_IT > tesseract::BBGrid< BBC, BBC_CLIST, BBC_C_IT > tesseract::IntGrid tesseract::BlobGrid tesseract::ColPartitionGrid tesseract::AlignedBlob tesseract::CCNonTextDetect tesseract::StrokeWidth tesseract::TabFind tesseract::ColumnFinder

Public Member Functions

 GridBase ()
 
 GridBase (int gridsize, const ICOORD &bleft, const ICOORD &tright)
 
virtual ~GridBase ()
 
void Init (int gridsize, const ICOORD &bleft, const ICOORD &tright)
 
int gridsize () const
 
int gridwidth () const
 
int gridheight () const
 
const ICOORDbleft () const
 
const ICOORDtright () const
 
void GridCoords (int x, int y, int *grid_x, int *grid_y) const
 
void ClipGridCoords (int *x, int *y) const
 

Protected Attributes

int gridsize_
 
int gridwidth_
 
int gridheight_
 
int gridbuckets_
 
ICOORD bleft_
 
ICOORD tright_
 

Detailed Description

Definition at line 52 of file bbgrid.h.

Constructor & Destructor Documentation

tesseract::GridBase::GridBase ( )

Definition at line 30 of file bbgrid.cpp.

30  {
31 }
tesseract::GridBase::GridBase ( int  gridsize,
const ICOORD bleft,
const ICOORD tright 
)

Definition at line 33 of file bbgrid.cpp.

33  {
34  Init(gridsize, bleft, tright);
35 }
void Init(int gridsize, const ICOORD &bleft, const ICOORD &tright)
Definition: bbgrid.cpp:42
int gridsize() const
Definition: bbgrid.h:63
tesseract::GridBase::~GridBase ( )
virtual

Definition at line 37 of file bbgrid.cpp.

37  {
38 }

Member Function Documentation

const ICOORD& tesseract::GridBase::bleft ( ) const
inline

Definition at line 72 of file bbgrid.h.

72  {
73  return bleft_;
74  }
void tesseract::GridBase::ClipGridCoords ( int *  x,
int *  y 
) const

Definition at line 61 of file bbgrid.cpp.

61  {
62  *x = ClipToRange(*x, 0, gridwidth_ - 1);
63  *y = ClipToRange(*y, 0, gridheight_ - 1);
64 }
T ClipToRange(const T &x, const T &lower_bound, const T &upper_bound)
Definition: helpers.h:115
void tesseract::GridBase::GridCoords ( int  x,
int  y,
int *  grid_x,
int *  grid_y 
) const

Definition at line 54 of file bbgrid.cpp.

54  {
55  *grid_x = (x - bleft_.x()) / gridsize_;
56  *grid_y = (y - bleft_.y()) / gridsize_;
57  ClipGridCoords(grid_x, grid_y);
58 }
inT16 y() const
access_function
Definition: points.h:56
inT16 x() const
access function
Definition: points.h:52
void ClipGridCoords(int *x, int *y) const
Definition: bbgrid.cpp:61
int tesseract::GridBase::gridheight ( ) const
inline

Definition at line 69 of file bbgrid.h.

69  {
70  return gridheight_;
71  }
int tesseract::GridBase::gridsize ( ) const
inline

Definition at line 63 of file bbgrid.h.

63  {
64  return gridsize_;
65  }
int tesseract::GridBase::gridwidth ( ) const
inline

Definition at line 66 of file bbgrid.h.

66  {
67  return gridwidth_;
68  }
void tesseract::GridBase::Init ( int  gridsize,
const ICOORD bleft,
const ICOORD tright 
)

Definition at line 42 of file bbgrid.cpp.

42  {
44  bleft_ = bleft;
45  tright_ = tright;
46  if (gridsize_ == 0)
47  gridsize_ = 1;
48  gridwidth_ = (tright.x() - bleft.x() + gridsize_ - 1) / gridsize_;
49  gridheight_ = (tright.y() - bleft.y() + gridsize_ - 1) / gridsize_;
51 }
inT16 y() const
access_function
Definition: points.h:56
int gridsize() const
Definition: bbgrid.h:63
const ICOORD & bleft() const
Definition: bbgrid.h:72
inT16 x() const
access function
Definition: points.h:52
const ICOORD & tright() const
Definition: bbgrid.h:75
ICOORD tright_
Definition: bbgrid.h:91
const ICOORD& tesseract::GridBase::tright ( ) const
inline

Definition at line 75 of file bbgrid.h.

75  {
76  return tright_;
77  }
ICOORD tright_
Definition: bbgrid.h:91

Member Data Documentation

ICOORD tesseract::GridBase::bleft_
protected

Definition at line 90 of file bbgrid.h.

int tesseract::GridBase::gridbuckets_
protected

Definition at line 89 of file bbgrid.h.

int tesseract::GridBase::gridheight_
protected

Definition at line 88 of file bbgrid.h.

int tesseract::GridBase::gridsize_
protected

Definition at line 86 of file bbgrid.h.

int tesseract::GridBase::gridwidth_
protected

Definition at line 87 of file bbgrid.h.

ICOORD tesseract::GridBase::tright_
protected

Definition at line 91 of file bbgrid.h.


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