ccstruct/ocrrow.h

Go to the documentation of this file.
00001 
00020 #ifndef           OCRROW_H
00021 #define           OCRROW_H
00022 
00023 #include          <stdio.h>
00024 #include          "quspline.h"
00025 #include          "werd.h"
00026 
00027 class TO_ROW;
00028 
00033 class ROW:public ELIST_LINK
00034 {
00035   friend void tweak_row_baseline(ROW *); 
00036   public:
00037     ROW() { 
00038     }                            //empty constructor
00039     ROW(                    //constructor
00040         INT32 spline_size,  //no of segments
00041         INT32 *xstarts,     //segment boundaries
00042         double *coeffs,     //coefficients //ascender size
00043         float x_height,
00044         float ascenders,
00045         float descenders,   //descender size
00046         INT16 kern,         //char gap
00047         INT16 space);       //word gap
00048     ROW(               //constructor
00049         TO_ROW *row,   //textord row
00050         INT16 kern,    //char gap
00051         INT16 space);  //word gap
00052 
00053     WERD_LIST *word_list() {  //get words
00054       return &words;
00055     }
00056 
00057     float base_line(                     //compute baseline
00058                     float xpos) const {  //at the position
00059                                  //get spline value
00060       return (float) baseline.y (xpos);
00061     }
00062     float x_height() const {  //return x height
00063       return xheight;
00064     }
00065     INT32 kern() const {  //return kerning
00066       return kerning;
00067     }
00068     INT32 space() const {  //return spacing
00069       return spacing;
00070     }
00071     float ascenders() const {  //return size
00072       return ascrise;
00073     }
00074     float descenders() const {  //return size
00075       return descdrop;
00076     }
00077     BOX bounding_box() const {  //return bounding box
00078       return bound_box;
00079     }
00080 
00081     void recalc_bounding_box();  //recalculate BB
00082 
00083     void move(                    // reposition row
00084               const ICOORD vec);  // by vector move()
00085 
00086     void print(            //print
00087                FILE *fp);  //file to print on
00088 
00089     void plot(                 //draw one
00090               WINDOW window,   //window to draw in
00091               COLOUR colour);  //uniform colour
00092     void plot(                 //draw one
00093               WINDOW window);  //in rainbow colours
00094 
00095 #ifndef GRAPHICS_DISABLED
00096     void plot_baseline(                  //draw the baseline
00097                        WINDOW window,    //window to draw in
00098                        COLOUR colour) {  //colour to draw
00099                                  //draw it
00100       baseline.plot (window, colour);
00101     }
00102 #endif
00103 
00104     void prep_serialise() {  //set ptrs to counts
00105       words.prep_serialise ();
00106       baseline.prep_serialise ();
00107     }
00108 
00109     void dump(  //write external bits
00110               FILE *f) {
00111       words.dump (f);
00112       baseline.dump (f);
00113     }
00114 
00115     void de_dump(  //read external bits
00116                  FILE *f) {
00117       words.de_dump (f);
00118       baseline.de_dump (f);
00119     }
00120 
00121                                  //assignment
00122     make_serialise (ROW) ROW & operator= (
00123       const ROW & source);       //from this
00124 
00125   private:
00126     INT32 kerning;               //inter char gap
00127     INT32 spacing;               //inter word gap
00128     BOX bound_box;               //bounding box
00129     float xheight;               //height of line
00130     float ascrise;               //size of ascenders
00131     float descdrop;              //-size of descenders
00132     WERD_LIST words;             //words
00133     QSPLINE baseline;            //baseline spline
00134 };
00135 
00136 ELISTIZEH_S (ROW)
00137 #endif

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