|
Tesseract
3.02
|
#include <pdblock.h>
Public Member Functions | |
| BLOCK_RECT_IT (PDBLK *blkptr) | |
| void | set_to_block (PDBLK *blkptr) |
| start (new) block | |
| void | start_block () |
| start iteration | |
| void | forward () |
| next rectangle | |
| BOOL8 | cycled_rects () |
| test end | |
| void | bounding_box (ICOORD &bleft, ICOORD &tright) |
| BLOCK_RECT_IT::BLOCK_RECT_IT | ( | PDBLK * | blkptr | ) |
constructor
| blkptr | block to iterate |
Definition at line 290 of file pdblock.cpp.
:left_it (&blkptr->leftside), right_it (&blkptr->rightside) { block = blkptr; //remember block //non empty list if (!blkptr->leftside.empty ()) { start_block(); //ready for iteration } }
| BOOL8 BLOCK_RECT_IT::cycled_rects | ( | ) | [inline] |
| void BLOCK_RECT_IT::forward | ( | ) |
next rectangle
Definition at line 344 of file pdblock.cpp.
{ //next rectangle
if (!left_it.empty ()) { //non-empty list
if (left_it.data_relative (1)->y () == ymax)
left_it.forward (); //move to meet top
if (right_it.data_relative (1)->y () == ymax)
right_it.forward ();
//last is special
if (left_it.at_last () || right_it.at_last ()) {
left_it.move_to_first (); //restart
right_it.move_to_first ();
//now at bottom
ymin = left_it.data ()->y ();
}
else {
ymin = ymax; //new bottom
}
//next point
ymax = left_it.data_relative (1)->y ();
if (right_it.data_relative (1)->y () < ymax)
//least step forward
ymax = right_it.data_relative (1)->y ();
}
}
| void BLOCK_RECT_IT::set_to_block | ( | PDBLK * | blkptr | ) |
start (new) block
Definition at line 308 of file pdblock.cpp.
{ //block to start
block = blkptr; //remember block
//set iterators
left_it.set_to_list (&blkptr->leftside);
right_it.set_to_list (&blkptr->rightside);
if (!blkptr->leftside.empty ())
start_block(); //ready for iteration
}
| void BLOCK_RECT_IT::start_block | ( | ) |
start iteration
Definition at line 325 of file pdblock.cpp.
{ //start (new) block
left_it.move_to_first ();
right_it.move_to_first ();
left_it.mark_cycle_pt ();
right_it.mark_cycle_pt ();
ymin = left_it.data ()->y (); //bottom of first box
ymax = left_it.data_relative (1)->y ();
if (right_it.data_relative (1)->y () < ymax)
//smallest step
ymax = right_it.data_relative (1)->y ();
}