Line.h

00001 # ifndef Line_h
00002 # define Line_h Line_h
00003 
00004 // Dependencies
00005 #include "Element.h" // parent
00006 
00007 // Declaration
00008 namespace Conjecture {
00009 
00010     /*******************************************************************
00011      * \class Line
00012      *
00013      * \brief A sub-region of a Page (or Region) containing
00014      * Glyphs or Words containing Glyphs.
00015      *
00016      * NOTE: Whether a Page is segmented into Glyphs first, then into
00017      * Lines, or Lines first, then Glyphs, depends on the particular
00018      * segmentation/identification/formatting algorithms used.
00019      *
00020      *******************************************************************/
00021 
00022     class Line : public Element {
00023       public:
00024         // Constructors/Destructors
00025         Line(Element* parent, const Coord& topleft, const Coord& bottomright, u2 bottom, u2 base, u2 mid, u2 top);
00026         
00027         // Accessors
00028         inline const u2 &      topY() const { return this->_topY; }
00029         inline const u2 &      midY() const { return this->_midY; }
00030         inline const u2 &      baseY() const { return this->_baseY; }
00031         inline const u2 &      bottomY() const { return this->_bottomY; }
00032         virtual int type() const { return Type; }
00033 
00039         virtual Line*   asLine()   { return this; }
00040         virtual const Line*   asLine() const { return this; }
00041 
00049         virtual void printSummary(std::ostream& os = std::cerr, const std::string& indent = "", int index = -1) const;
00050 
00060         static void test(int argc = 0, const char* argv[] = NULL);
00061 
00066         virtual void writeText(std::ostream& os) const;
00067         
00068       protected:
00069         // Accessors
00070         inline void            topYIs(const u2 & topY) { this->_topY = topY; }
00071         inline void            midYIs(const u2 & midY) { this->_midY = midY; }
00072         inline void            baseYIs(const u2 & baseY) { this->_baseY = baseY; }
00073         inline void            bottomYIs(const u2 & bottomY) { this->_bottomY = bottomY; }
00074         
00075         // Methods
00076 
00077       private:
00078         // Accessors
00079         inline u2 &            topYRef() { return this->_topY; }
00080         inline u2 &            midYRef() { return this->_midY; }
00081         inline u2 &            baseYRef() { return this->_baseY; }
00082         inline u2 &            bottomYRef() { return this->_bottomY; }
00083         
00084         // Methods
00085         
00086         // State
00087 
00094         u2              _topY;
00095 
00102         u2              _midY;
00103 
00110         u2              _baseY;
00111 
00118         u2              _bottomY;
00119         static const ElementType Type = ELEMENT_LINE;
00120     };
00121 };
00122 
00123 # endif // Line_h
00124 

Generated on Wed Jun 14 15:08:02 2006 for Conjecture by  doxygen 1.4.6