Tesseract  3.02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
BLOCK_LINE_IT Class Reference

rectangle iterator More...

#include <pdblock.h>

Public Member Functions

 BLOCK_LINE_IT (PDBLK *blkptr)
 
void set_to_block (PDBLK *blkptr)
 
inT16 get_line (inT16 y, inT16 &xext)
 

Detailed Description

rectangle iterator

Definition at line 166 of file pdblock.h.

Constructor & Destructor Documentation

BLOCK_LINE_IT::BLOCK_LINE_IT ( PDBLK blkptr)
inline

constructor

Parameters
blkptrfrom block

Definition at line 171 of file pdblock.h.

172  :rect_it (blkptr) {
173  block = blkptr; //remember block
174  }

Member Function Documentation

inT16 BLOCK_LINE_IT::get_line ( inT16  y,
inT16 xext 
)

get a line

Parameters
yline to get
xextoutput extent

Definition at line 375 of file pdblock.cpp.

378  {
379  ICOORD bleft; //bounding box
380  ICOORD tright; //of block & rect
381 
382  //get block box
383  block->bounding_box (bleft, tright);
384  if (y < bleft.y () || y >= tright.y ()) {
385  // block->print(stderr,FALSE);
386  BADBLOCKLINE.error ("BLOCK_LINE_IT::get_line", ABORT, "Y=%d", y);
387  }
388 
389  //get rectangle box
390  rect_it.bounding_box (bleft, tright);
391  //inside rectangle
392  if (y >= bleft.y () && y < tright.y ()) {
393  //width of line
394  xext = tright.x () - bleft.x ();
395  return bleft.x (); //start of line
396  }
397  for (rect_it.start_block (); !rect_it.cycled_rects (); rect_it.forward ()) {
398  //get rectangle box
399  rect_it.bounding_box (bleft, tright);
400  //inside rectangle
401  if (y >= bleft.y () && y < tright.y ()) {
402  //width of line
403  xext = tright.x () - bleft.x ();
404  return bleft.x (); //start of line
405  }
406  }
407  LOSTBLOCKLINE.error ("BLOCK_LINE_IT::get_line", ABORT, "Y=%d", y);
408  return 0; //dummy to stop warning
409 }
inT16 x() const
access function
Definition: points.h:52
Definition: errcode.h:30
void start_block()
start iteration
Definition: pdblock.cpp:325
inT16 y() const
access_function
Definition: points.h:56
void error(const char *caller, TessErrorLogCode action, const char *format,...) const
Definition: errcode.cpp:41
BOOL8 cycled_rects()
test end
Definition: pdblock.h:142
integer coordinate
Definition: points.h:30
const ERRCODE BADBLOCKLINE
Definition: blckerr.h:25
void bounding_box(ICOORD &bleft, ICOORD &tright)
Definition: pdblock.h:149
const ERRCODE LOSTBLOCKLINE
Definition: blckerr.h:26
void bounding_box(ICOORD &bottom_left, ICOORD &top_right) const
get box
Definition: pdblock.h:70
void forward()
next rectangle
Definition: pdblock.cpp:344
void BLOCK_LINE_IT::set_to_block ( PDBLK blkptr)
inline

start (new) block

Parameters
blkptrblock to start

Definition at line 178 of file pdblock.h.

178  {
179  block = blkptr; //remember block
180  //set iterator
181  rect_it.set_to_block (blkptr);
182  }
void set_to_block(PDBLK *blkptr)
start (new) block
Definition: pdblock.cpp:308

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