ccstruct/poutline.h

Go to the documentation of this file.
00001 
00020 #ifndef           POUTLINE_H
00021 #define           POUTLINE_H
00022 
00023 #include          "grphics.h"
00024 #include          "polyvert.h"
00025 #include          "rect.h"
00026 #include          "blckerr.h"
00027 
00028 #define INTERSECTING    MAX_INT16//no winding number
00029 
00030 class OUTLINE;                   //forward declaration
00031 
00032 ELISTIZEH_S (OUTLINE)
00037 class OUTLINE:public ELIST_LINK
00038 {
00039   public:
00040     OUTLINE() {  //empty constructor
00041     }
00042     OUTLINE(                        //constructor
00043             const ICOORD &startpt,  //start point
00044             INT8 *compactloop,      //from Tess format
00045             BOOL8 reverse,          //reverse it
00046             ICOORD bot_left,        //bounding box
00047             ICOORD top_right);
00048     OUTLINE(                      //constructor
00049             POLYPT_IT *poly_it);  //from list of pts
00050 
00051     OUTLINE_LIST *child() {  //get child list
00052       return &children;
00053     }
00054 
00055                                  //access function
00056     const BOX &bounding_box() const { 
00057       return box;
00058     }
00059     void compute_bb();  //set bounding box
00060 
00061                                  //get start position
00062     const ICOORD &start_pos() const { 
00063       return start;
00064     }
00065     float area();  //return area
00066     POLYPT_LIST *polypts() {  //get poly
00067       return &outline;
00068     }
00069 
00070     BOOL8 operator< (            //containment test
00071       OUTLINE & other);
00072     BOOL8 operator> (            //containment test
00073     OUTLINE & other) {
00074       return other < *this;      //use the < to do it
00075     }
00076     INT16 winding_number(                        //get winding number
00077                          const FCOORD &testpt);  //around this point
00078     void reverse();  //reverse it
00079 
00080     void move(                    // reposition outline
00081               const FCOORD vec);  // by FLOAT vector
00082 
00083     void scale(                 // scale outline
00084                const float f);  // by multiplier
00085     void scale(                    // scale outline
00086                const FCOORD vec);  // by FLOAT vector
00087 
00088     void plot(                 //draw one
00089               WINDOW window,   //window to draw in
00090               COLOUR colour);  //colour to draw it
00091 
00092     void prep_serialise() {  //set ptrs to counts
00093       outline.prep_serialise ();
00094       children.prep_serialise ();
00095     }
00096 
00097     void dump(  //write external bits
00098               FILE *f) {
00099       outline.dump (f);
00100       children.dump (f);
00101     }
00102 
00103     void de_dump(  //read external bits
00104                  FILE *f) {
00105       outline.de_dump (f);
00106       children.de_dump (f);
00107     }
00108 
00109                                  //assignment
00110     make_serialise (OUTLINE) OUTLINE & operator= (
00111       const OUTLINE & source);   //from this
00112 
00113   private:
00115     BOX box;
00117     ICOORD start;
00119     POLYPT_LIST outline;
00121     OUTLINE_LIST children;
00122 };
00123 #endif

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