BLOCK_RECT_IT Class Reference

#include <pdblock.h>

List of all members.


Detailed Description

Class for dealing with rectangles of PDBLK.

Definition at line 129 of file pdblock.h.

Public Member Functions

Private Attributes


Constructor & Destructor Documentation

BLOCK_RECT_IT::BLOCK_RECT_IT ( PDBLK blkptr  ) 

Iterate rectangles.

Construct a block rectangle iterator.

Definition at line 232 of file pdblock.cpp.

References block, and start_block().

00234  :left_it (&blkptr->leftside), right_it (&blkptr->rightside) {
00235   block = blkptr;                //remember block
00236                                  //non empty list
00237   if (!blkptr->leftside.empty ()) {
00238     start_block();  //ready for iteration
00239   }
00240 }


Member Function Documentation

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

Definition at line 146 of file pdblock.h.

References ymax, and ymin.

Referenced by BLOCK_LINE_IT::get_line().

00148                                       {  // top right
00149       bleft = ICOORD (left_it.data ()->x (), ymin); // bottom left
00150       tright = ICOORD (right_it.data ()->x (), ymax); // top right
00151     }

BOOL8 BLOCK_RECT_IT::cycled_rects (  )  [inline]

Definition at line 142 of file pdblock.h.

Referenced by BLOCK_LINE_IT::get_line().

00142                          {  // test end
00143       return left_it.cycled_list () && right_it.cycled_list ();
00144     }

void BLOCK_RECT_IT::forward (  ) 

Next rectangle.

Move to the next rectangle in the block.

Definition at line 278 of file pdblock.cpp.

References ymax, and ymin.

Referenced by BLOCK_LINE_IT::get_line().

00278                             {  //next rectangle
00279   if (!left_it.empty ()) {       //non-empty list
00280     if (left_it.data_relative (1)->y () == ymax)
00281       left_it.forward ();        //move to meet top
00282     if (right_it.data_relative (1)->y () == ymax)
00283       right_it.forward ();
00284                                  //last is special
00285     if (left_it.at_last () || right_it.at_last ()) {
00286       left_it.move_to_first ();  //restart
00287       right_it.move_to_first ();
00288                                  //now at bottom
00289       ymin = left_it.data ()->y ();
00290     }
00291     else {
00292       ymin = ymax;               //new bottom
00293     }
00294                                  //next point
00295     ymax = left_it.data_relative (1)->y ();
00296     if (right_it.data_relative (1)->y () < ymax)
00297                                  //least step forward
00298       ymax = right_it.data_relative (1)->y ();
00299   }
00300 }

BLOCK_RECT_IT::NEWDELETE2 ( BLOCK_RECT_IT   ) 

void BLOCK_RECT_IT::start_block (  ) 

Restart a block.

Definition at line 260 of file pdblock.cpp.

References ymax, and ymin.

Referenced by BLOCK_RECT_IT(), and BLOCK_LINE_IT::get_line().

00260                                 {  //start (new) block
00261   left_it.move_to_first ();
00262   right_it.move_to_first ();
00263   left_it.mark_cycle_pt ();
00264   right_it.mark_cycle_pt ();
00265   ymin = left_it.data ()->y ();  //bottom of first box
00266   ymax = left_it.data_relative (1)->y ();
00267   if (right_it.data_relative (1)->y () < ymax)
00268                                  //smallest step
00269     ymax = right_it.data_relative (1)->y ();
00270 }


Member Data Documentation

PDBLK* BLOCK_RECT_IT::block [private]

block to iterate

Definition at line 159 of file pdblock.h.

Referenced by BLOCK_RECT_IT().

ICOORDELT_IT BLOCK_RECT_IT::left_it [private]

Left boundary iterator.

Definition at line 161 of file pdblock.h.

ICOORDELT_IT BLOCK_RECT_IT::right_it [private]

Right boundary iterator.

Definition at line 163 of file pdblock.h.

INT16 BLOCK_RECT_IT::ymax [private]

top of rectangle

Definition at line 157 of file pdblock.h.

Referenced by forward(), and start_block().

INT16 BLOCK_RECT_IT::ymin [private]

bottom of rectangle

Definition at line 155 of file pdblock.h.

Referenced by forward(), and start_block().


The documentation for this class was generated from the following files:
Generated on Wed Feb 28 19:49:30 2007 for Tesseract by  doxygen 1.5.1