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

#include <pdblock.h>

Public Member Functions

 BLOCK_RECT_IT (PDBLK *blkptr)
 
void set_to_block (PDBLK *blkptr)
 start (new) block More...
 
void start_block ()
 start iteration More...
 
void forward ()
 next rectangle More...
 
BOOL8 cycled_rects ()
 test end More...
 
void bounding_box (ICOORD &bleft, ICOORD &tright)
 

Detailed Description

Definition at line 124 of file pdblock.h.

Constructor & Destructor Documentation

BLOCK_RECT_IT::BLOCK_RECT_IT ( PDBLK blkptr)

constructor

Parameters
blkptrblock to iterate

Definition at line 290 of file pdblock.cpp.

293  :left_it (&blkptr->leftside), right_it (&blkptr->rightside) {
294  block = blkptr; //remember block
295  //non empty list
296  if (!blkptr->leftside.empty ()) {
297  start_block(); //ready for iteration
298  }
299 }
ICOORDELT_LIST rightside
Definition: pdblock.h:119
void start_block()
start iteration
Definition: pdblock.cpp:325
ICOORDELT_LIST leftside
Definition: pdblock.h:118

Member Function Documentation

void BLOCK_RECT_IT::bounding_box ( ICOORD bleft,
ICOORD tright 
)
inline

current rectangle

Parameters
bleftbottom left
trighttop right

Definition at line 149 of file pdblock.h.

150  {
151  //bottom left
152  bleft = ICOORD (left_it.data ()->x (), ymin);
153  //top right
154  tright = ICOORD (right_it.data ()->x (), ymax);
155  }
integer coordinate
Definition: points.h:30
BOOL8 BLOCK_RECT_IT::cycled_rects ( )
inline

test end

Definition at line 142 of file pdblock.h.

142  {
143  return left_it.cycled_list () && right_it.cycled_list ();
144  }
void BLOCK_RECT_IT::forward ( )

next rectangle

Definition at line 344 of file pdblock.cpp.

344  { //next rectangle
345  if (!left_it.empty ()) { //non-empty list
346  if (left_it.data_relative (1)->y () == ymax)
347  left_it.forward (); //move to meet top
348  if (right_it.data_relative (1)->y () == ymax)
349  right_it.forward ();
350  //last is special
351  if (left_it.at_last () || right_it.at_last ()) {
352  left_it.move_to_first (); //restart
353  right_it.move_to_first ();
354  //now at bottom
355  ymin = left_it.data ()->y ();
356  }
357  else {
358  ymin = ymax; //new bottom
359  }
360  //next point
361  ymax = left_it.data_relative (1)->y ();
362  if (right_it.data_relative (1)->y () < ymax)
363  //least step forward
364  ymax = right_it.data_relative (1)->y ();
365  }
366 }
void BLOCK_RECT_IT::set_to_block ( PDBLK blkptr)

start (new) block

Definition at line 308 of file pdblock.cpp.

309  { //block to start
310  block = blkptr; //remember block
311  //set iterators
312  left_it.set_to_list (&blkptr->leftside);
313  right_it.set_to_list (&blkptr->rightside);
314  if (!blkptr->leftside.empty ())
315  start_block(); //ready for iteration
316 }
ICOORDELT_LIST rightside
Definition: pdblock.h:119
void start_block()
start iteration
Definition: pdblock.cpp:325
ICOORDELT_LIST leftside
Definition: pdblock.h:118
void BLOCK_RECT_IT::start_block ( )

start iteration

Definition at line 325 of file pdblock.cpp.

325  { //start (new) block
326  left_it.move_to_first ();
327  right_it.move_to_first ();
328  left_it.mark_cycle_pt ();
329  right_it.mark_cycle_pt ();
330  ymin = left_it.data ()->y (); //bottom of first box
331  ymax = left_it.data_relative (1)->y ();
332  if (right_it.data_relative (1)->y () < ymax)
333  //smallest step
334  ymax = right_it.data_relative (1)->y ();
335 }

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