Tesseract  3.02
BLOCK_LINE_IT Class Reference

rectangle iterator More...

#include <pdblock.h>

List of all members.

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 164 of file pdblock.h.


Constructor & Destructor Documentation

BLOCK_LINE_IT::BLOCK_LINE_IT ( PDBLK blkptr) [inline]

constructor

Parameters:
blkptrfrom block

Definition at line 169 of file pdblock.h.

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

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.

                               {
  ICOORD bleft;                  //bounding box
  ICOORD tright;                 //of block & rect

                                 //get block box
  block->bounding_box (bleft, tright);
  if (y < bleft.y () || y >= tright.y ()) {
    //              block->print(stderr,FALSE);
    BADBLOCKLINE.error ("BLOCK_LINE_IT::get_line", ABORT, "Y=%d", y);
  }

                                 //get rectangle box
  rect_it.bounding_box (bleft, tright);
                                 //inside rectangle
  if (y >= bleft.y () && y < tright.y ()) {
                                 //width of line
    xext = tright.x () - bleft.x ();
    return bleft.x ();           //start of line
  }
  for (rect_it.start_block (); !rect_it.cycled_rects (); rect_it.forward ()) {
                                 //get rectangle box
    rect_it.bounding_box (bleft, tright);
                                 //inside rectangle
    if (y >= bleft.y () && y < tright.y ()) {
                                 //width of line
      xext = tright.x () - bleft.x ();
      return bleft.x ();         //start of line
    }
  }
  LOSTBLOCKLINE.error ("BLOCK_LINE_IT::get_line", ABORT, "Y=%d", y);
  return 0;                      //dummy to stop warning
}
void BLOCK_LINE_IT::set_to_block ( PDBLK blkptr) [inline]

start (new) block

Parameters:
blkptrblock to start

Definition at line 176 of file pdblock.h.

                                       {
      block = blkptr;            //remember block
                                 //set iterator
      rect_it.set_to_block (blkptr);
    }

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