ccstruct/txtregn.h

Go to the documentation of this file.
00001 
00020 #ifndef           TXTREGN_H
00021 #define           TXTREGN_H
00022 
00023 #include          <stdio.h>
00024 #include          "elst.h"
00025 #include          "hpdsizes.h"
00026 #include          "polyblk.h"
00027 #include          "debugwin.h"
00028 
00029 #include          "hpddef.h"     //must be last (handpd.dll)
00030 
00031 #define REGION_COLOUR CYAN
00032 #define SUBREGION_COLOUR GREEN
00033 
00034 class DLLSYM TEXT_REGION;        //forward decl
00035 
00036 ELISTIZEH_S (TEXT_REGION)
00037 
00038 
00042 class DLLSYM TEXT_REGION:public ELIST_LINK, public POLY_BLOCK
00043 {
00044   public:
00045     TEXT_REGION() { 
00046     }                            //empty constructor
00047     TEXT_REGION(  //simple constructor
00048                 INT32 idno,
00049                 ICOORDELT_LIST *points,
00050                 TEXT_REGION_LIST *child);
00051 
00052     TEXT_REGION(  //simple constructor
00053                 INT32 idno,
00054                 ICOORDELT_LIST *points);
00055 
00056     TEXT_REGION(  //constructor
00057                 INT32 idno,
00058                 ICOORDELT_LIST *points,
00059                 INT8 hor,
00060                 INT8 tex,
00061                 INT8 ser,
00062                 INT8 pro,
00063                 INT8 nor,
00064                 INT8 upr,
00065                 INT8 sol,
00066                 INT8 bla,
00067                 INT8 und,
00068                 INT8 dro);
00069 
00070     ~TEXT_REGION () {            //destructor
00071     }
00072 
00073     void set_id_no(INT32 new_id) { 
00074       id_number = new_id;
00075     }
00076 
00077     INT32 id_no() { 
00078       return id_number;
00079     }
00080 
00081     INT32 nregions() { 
00082       return txt_regions.length ();
00083     }
00084 
00085     BOOL8 is_prop() const {  //test proportional
00086       return !proportional;      //stored negatively
00087     }
00088 
00089     void set_prop(BOOL8 prop) { 
00090       if (prop)
00091         proportional = 0;
00092       else
00093         proportional = 1;
00094     }
00095 
00096     void add_a_region(TEXT_REGION *newchild); 
00097 
00098                                  //get children
00099     TEXT_REGION_LIST *regions() { 
00100       return &txt_regions;
00101     }
00102 
00103     void set_attrs(INT8 hor,
00104                    INT8 tex,
00105                    INT8 ser,
00106                    INT8 pro,
00107                    INT8 nor,
00108                    INT8 upr,
00109                    INT8 sol,
00110                    INT8 bla,
00111                    INT8 und,
00112                    INT8 dro);
00113 
00114     void show_attrs(DEBUG_WIN *f); 
00115 
00116     void rotate(  //rotate it
00117                 FCOORD rotation);
00118     void move(                //move it
00119               ICOORD shift);  //vector
00120 
00121     void prep_serialise() {  //set ptrs to counts
00122       POLY_BLOCK::prep_serialise(); 
00123       txt_regions.prep_serialise ();
00124     }
00125 
00126     void dump(  //write external bits
00127               FILE *f) {
00128       POLY_BLOCK::dump(f); 
00129       txt_regions.dump (f);
00130     }
00131 
00132     void de_dump(  //read external bits
00133                  FILE *f) {
00134       POLY_BLOCK::de_dump(f); 
00135       txt_regions.de_dump (f);
00136     }
00137 
00138                                  //serialise to ascii
00139     make_serialise (TEXT_REGION) void serialise_asc (
00140       FILE * f);
00141     void de_serialise_asc(  //serialise from ascii
00142                           FILE *f);
00143 
00144   private:
00145     INT32 id_number;             //unique id
00146     INT8 horizontal;             //horizontal, vertical, skewed
00147     INT8 text;                   //text, table, form
00148     INT8 serif;                  //serif, sansserif
00149     INT8 proportional;           //proportional, fixed
00150     INT8 normal;                 //normal, bold
00151     INT8 upright;                //upright, italic
00152     INT8 solid;                  //solid, outline
00153     INT8 black;                  //black, coloured, white,
00154     INT8 underlined;             //not underlined, underlined
00155     INT8 dropcaps;               //not dropcaps, dropcaps
00156 
00157     TEXT_REGION_LIST txt_regions;
00158 };
00159 #endif

Generated on Wed Feb 28 19:49:08 2007 for Tesseract by  doxygen 1.5.1