All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules 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 160 of file pdblock.h.

Constructor & Destructor Documentation

BLOCK_LINE_IT::BLOCK_LINE_IT ( PDBLK blkptr)
inline

constructor

Parameters
blkptrfrom block

Definition at line 165 of file pdblock.h.

166  :rect_it (blkptr) {
167  block = blkptr; //remember block
168  }

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 344 of file pdblock.cpp.

347  {
348  ICOORD bleft; //bounding box
349  ICOORD tright; //of block & rect
350 
351  //get block box
352  block->bounding_box (bleft, tright);
353  if (y < bleft.y () || y >= tright.y ()) {
354  // block->print(stderr,FALSE);
355  BADBLOCKLINE.error ("BLOCK_LINE_IT::get_line", ABORT, "Y=%d", y);
356  }
357 
358  //get rectangle box
359  rect_it.bounding_box (bleft, tright);
360  //inside rectangle
361  if (y >= bleft.y () && y < tright.y ()) {
362  //width of line
363  xext = tright.x () - bleft.x ();
364  return bleft.x (); //start of line
365  }
366  for (rect_it.start_block (); !rect_it.cycled_rects (); rect_it.forward ()) {
367  //get rectangle box
368  rect_it.bounding_box (bleft, tright);
369  //inside rectangle
370  if (y >= bleft.y () && y < tright.y ()) {
371  //width of line
372  xext = tright.x () - bleft.x ();
373  return bleft.x (); //start of line
374  }
375  }
376  LOSTBLOCKLINE.error ("BLOCK_LINE_IT::get_line", ABORT, "Y=%d", y);
377  return 0; //dummy to stop warning
378 }
void forward()
next rectangle
Definition: pdblock.cpp:313
void bounding_box(ICOORD &bleft, ICOORD &tright)
Definition: pdblock.h:143
BOOL8 cycled_rects()
test end
Definition: pdblock.h:136
Definition: errcode.h:30
inT16 y() const
access_function
Definition: points.h:56
const ERRCODE BADBLOCKLINE
Definition: blckerr.h:25
void bounding_box(ICOORD &bottom_left, ICOORD &top_right) const
get box
Definition: pdblock.h:67
const ERRCODE LOSTBLOCKLINE
Definition: blckerr.h:26
void error(const char *caller, TessErrorLogCode action, const char *format,...) const
Definition: errcode.cpp:40
integer coordinate
Definition: points.h:30
void start_block()
start iteration
Definition: pdblock.cpp:294
inT16 x() const
access function
Definition: points.h:52
void BLOCK_LINE_IT::set_to_block ( PDBLK blkptr)
inline

start (new) block

Parameters
blkptrblock to start

Definition at line 172 of file pdblock.h.

172  {
173  block = blkptr; //remember block
174  //set iterator
175  rect_it.set_to_block (blkptr);
176  }
void set_to_block(PDBLK *blkptr)
start (new) block
Definition: pdblock.cpp:277

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