ccstruct/polyblk.h

Go to the documentation of this file.
00001 
00019 #ifndef           POLYBLK_H
00020 #define           POLYBLK_H
00021 
00022 #include          "rect.h"
00023 #include          "points.h"
00024 #include          "grphics.h"
00025 #include          "elst.h"
00026 
00027 #include          "hpddef.h"     //must be last (handpd.dll)
00028 
00033 enum POLY_TYPE
00034 {
00036   POLY_TEXT,
00038   POLY_PAGE,
00040   POLY_X
00041 };
00042 
00047 class DLLSYM POLY_BLOCK
00048 {
00049 
00050   public:
00051     POLY_BLOCK() { 
00052     }                            //empty constructor
00053     POLY_BLOCK(  //simple constructor
00054                ICOORDELT_LIST *points,
00055                POLY_TYPE t);
00056     ~POLY_BLOCK () {
00057     }                            //destructor
00058 
00059     BOX *bounding_box() {  // access function
00060       return &box;
00061     }
00062 
00063     ICOORDELT_LIST *points() {  // access function
00064       return &vertices;
00065     }
00066 
00067     void compute_bb(); 
00068 
00069     POLY_TYPE isA() { 
00070       return type;
00071     }
00072 
00073     void rotate(  //rotate it
00074                 FCOORD rotation);
00075     void move(                //move it
00076               ICOORD shift);  //vector
00077 
00078     void plot(WINDOW window, COLOUR colour, INT32 num); 
00079 
00080     void fill(WINDOW window, COLOUR colour); 
00081 
00082     BOOL8 contains(  // is poly inside poly
00083                    POLY_BLOCK *poly);
00084 
00085     BOOL8 overlap(  // do polys overlap
00086                   POLY_BLOCK *poly);
00087 
00088     INT16 winding_number(                         // get winding number
00089                          const ICOORD &test_pt);  // around this point
00090 
00091     void prep_serialise() { 
00092       vertices.prep_serialise ();
00093     }
00094 
00095     void dump(FILE *f) { 
00096       vertices.dump (f);
00097     }
00098 
00099     void de_dump(FILE *f) { 
00100       vertices.de_dump (f);
00101     }
00102 
00103                                  //convert to ascii
00104     make_serialise (POLY_BLOCK) void serialise_asc (
00105       FILE * f);
00106     void de_serialise_asc(  //convert from ascii
00107                           FILE *f);
00108 
00109   private:
00111     ICOORDELT_LIST vertices;
00113     BOX box;
00115     POLY_TYPE type;
00116 };
00117 
00122 class DLLSYM PB_LINE_IT
00123 {
00124   public:
00125     PB_LINE_IT(  //constructor
00126                POLY_BLOCK *blkptr) {
00127       block = blkptr;
00128     }
00129 
00130     NEWDELETE2 (PB_LINE_IT) void set_to_block (POLY_BLOCK * blkptr) {
00131       block = blkptr;
00132     }
00133 
00134     ICOORDELT_LIST *get_line(INT16 y); 
00135 
00136   private:
00137     POLY_BLOCK * block;
00138 };
00139 #endif

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