TEXT_BLOCK Class Reference

#include <pageblk.h>

Inheritance diagram for TEXT_BLOCK:

PAGE_BLOCK List of all members.

Detailed Description

Class for dealing with text block.

Blocks contains text/words

Definition at line 156 of file pageblk.h.

Public Member Functions

Private Attributes


Constructor & Destructor Documentation

TEXT_BLOCK::TEXT_BLOCK (  )  [inline]

Definition at line 159 of file pageblk.h.

00159                  { 
00160     }                            //empty constructor

TEXT_BLOCK::TEXT_BLOCK ( ICOORDELT_LIST *  points  ) 

TEXT_BLOCK::TEXT_BLOCK ( ICOORDELT_LIST *  points,
BOOL8  backg[NUM_BACKGROUNDS] 
)

Init a BLAH, where BLAH is TEXT_BLOCK.

Definition at line 467 of file pageblk.cpp.

References background, BITS16::set_bit(), and text_regions.

00467                                                                             :PAGE_BLOCK (points,
00468 PB_TEXT) {
00469   int
00470     i;
00471 
00472   for (i = 0; i < NUM_BACKGROUNDS; i++)
00473     background.set_bit (i, backg[i]);
00474 
00475   text_regions.clear ();
00476 }


Member Function Documentation

void TEXT_BLOCK::add_a_region ( TEXT_REGION newchild  ) 

Add a TEXT_BLOCK (same as region?).

Definition at line 491 of file pageblk.cpp.

References text_regions.

00491                                                    { 
00492   TEXT_REGION_IT c;
00493 
00494   c.set_to_list (&text_regions);
00495 
00496   c.move_to_first ();
00497   c.add_to_end (newchild);
00498 }

void TEXT_BLOCK::de_dump ( FILE *  f  )  [inline]

Definition at line 201 of file pageblk.h.

00202                           {
00203       PAGE_BLOCK::de_dump(f); 
00204       text_regions.de_dump (f);
00205     }

void TEXT_BLOCK::de_serialise_asc ( FILE *  f  ) 

Convert BLAH from ascii file, where BLAH is TEXT_BLOCK.

Definition at line 552 of file pageblk.cpp.

References background, de_serialise_INT32(), text_regions, and BITS16::val.

00554                                    {
00555   ((PAGE_BLOCK *) this)->de_serialise_asc (f);
00556   background.val = de_serialise_INT32 (f);
00557   text_regions.de_serialise_asc (f);
00558 }

void TEXT_BLOCK::dump ( FILE *  f  )  [inline]

Definition at line 195 of file pageblk.h.

00196                        {
00197       PAGE_BLOCK::dump(f); 
00198       text_regions.dump (f);
00199     }

TEXT_BLOCK::make_serialise ( TEXT_BLOCK   ) 

void TEXT_BLOCK::move ( ICOORD  shift  ) 

Move the TEXT_BLOCK and its children.

Definition at line 522 of file pageblk.cpp.

References POLY_BLOCK::move(), and text_regions.

00523                        {
00524                                  //sub block iterator
00525   TEXT_REGION_IT child_it = &text_regions;
00526   TEXT_REGION *child;            //child block
00527 
00528   for (child_it.mark_cycle_pt (); !child_it.cycled_list ();
00529   child_it.forward ()) {
00530     child = child_it.data ();
00531     child->move (shift);
00532   }
00533   POLY_BLOCK::move(shift); 
00534 }

INT32 TEXT_BLOCK::nregions (  )  [inline]

Definition at line 170 of file pageblk.h.

00170                      { 
00171       return text_regions.length ();
00172     }

void TEXT_BLOCK::plot ( WINDOW  window,
COLOUR  colour,
COLOUR  region_colour,
COLOUR  subregion_colour 
)

Plot BLAH, where BLAH is TEXT_BLOCK.

Definition at line 565 of file pageblk.cpp.

References text_regions.

00568                                                {
00569   TEXT_REGION_IT t = &text_regions, tc;
00570 
00571   PAGE_BLOCK::basic_plot(window, colour); 
00572 
00573   if (!t.empty ())
00574   for (t.mark_cycle_pt (); !t.cycled_list (); t.forward ()) {
00575     t.data ()->plot (window, region_colour, t.data ()->id_no ());
00576     tc.set_to_list (t.data ()->regions ());
00577     if (!tc.empty ())
00578       for (tc.mark_cycle_pt (); !tc.cycled_list (); tc.forward ())
00579         tc.data ()->plot (window, subregion_colour, -1);
00580   }
00581 }

void TEXT_BLOCK::prep_serialise (  )  [inline]

Definition at line 190 of file pageblk.h.

00190                           {  //set ptrs to counts
00191       PAGE_BLOCK::prep_serialise(); 
00192       text_regions.prep_serialise ();
00193     }

TEXT_REGION_LIST* TEXT_BLOCK::regions (  )  [inline]

Definition at line 166 of file pageblk.h.

Referenced by delete_all_tr_in(), scan_hpd_blocks(), and show_all_tr_in().

00166                                 { 
00167       return &text_regions;
00168     }

void TEXT_BLOCK::rotate ( FCOORD  rotation  ) 

Rotate the TEXT_BLOCK and its children.

Definition at line 504 of file pageblk.cpp.

References POLY_BLOCK::rotate(), rotation, and text_regions.

00505                                          {
00506                                  //sub block iterator
00507   TEXT_REGION_IT child_it = &text_regions;
00508   TEXT_REGION *child;            //child block
00509 
00510   for (child_it.mark_cycle_pt (); !child_it.cycled_list ();
00511   child_it.forward ()) {
00512     child = child_it.data ();
00513     child->rotate (rotation);
00514   }
00515   POLY_BLOCK::rotate(rotation); 
00516 }

void TEXT_BLOCK::set_attrs ( BOOL8  backg[NUM_BACKGROUNDS]  ) 

Definition at line 480 of file pageblk.cpp.

References background, and BITS16::set_bit().

00480                                                    {
00481   int i;
00482 
00483   for (i = 0; i < NUM_BACKGROUNDS; i++)
00484     background.set_bit (i, backg[i]);
00485 }

void TEXT_BLOCK::show_attrs ( DEBUG_WIN debug  ) 

Print info about BLAH, where BLAH is TEXT_BLOCK.

Definition at line 588 of file pageblk.cpp.

References background, f, print_background(), and text_regions.

00588                                         { 
00589   TEXT_REGION_IT it;
00590 
00591   f->dprintf ("TEXT BLOCK\n");
00592   print_background(f, background); 
00593   if (!text_regions.empty ()) {
00594     f->dprintf ("containing text regions:\n");
00595     it.set_to_list (&text_regions);
00596     for (it.mark_cycle_pt (); !it.cycled_list (); it.forward ())
00597       it.data ()->show_attrs (f);
00598     f->dprintf ("end of regions\n");
00599   }
00600 }


Member Data Documentation

BITS16 TEXT_BLOCK::background [private]

FIX:.

Definition at line 215 of file pageblk.h.

Referenced by de_serialise_asc(), set_attrs(), show_attrs(), and TEXT_BLOCK().

TEXT_REGION_LIST TEXT_BLOCK::text_regions [private]

FIX:.

Definition at line 217 of file pageblk.h.

Referenced by add_a_region(), de_serialise_asc(), move(), plot(), rotate(), show_attrs(), and TEXT_BLOCK().


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