00001 #ifndef _DLSEGMENTATION_H_ 00002 #define _DLSEGMENTATION_H_ 00003 00004 #include "DLPage.h" 00005 #include "DLZone.h" 00006 #include "DLTagList.h" 00007 #include "DLConst.h" 00008 #include "DLException.h" 00009 00010 #include <list> 00011 #include <string> 00012 00013 class DLPage; 00014 class DLZone; 00015 00016 using namespace std; 00017 00036 class DLSegmentation 00037 { 00038 friend class DLPage; 00039 00040 public: 00041 00042 string segID; 00043 00044 // list of segmentation attributes 00045 DLTagList segTags; 00046 00047 // list of zones in the segmentation 00048 list <DLZone> segZones; 00049 00053 DLSegmentation(); 00054 00059 DLSegmentation(const string &segmentationID); 00060 00066 DLSegmentation(DLPage *parentPage, const string &segmentationID); 00067 00071 virtual ~DLSegmentation(); 00072 00076 bool operator == (const DLSegmentation &right); 00077 00082 int dlGetPageWidth() const; 00083 00088 int dlGetPageHeight() const; 00089 00094 int dlGetNrOfZones() const { return static_cast<int>(segZones.size()); }; 00095 00100 bool dlHasZones() { return (!segZones.empty()); }; 00101 00106 void dlAppendZone(DLZone &segZone); 00107 00112 void dlAppendZoneList(list <DLZone*> zoneList); 00113 00121 void dlInsertZone(DLZone &segZone, int cursorPosition); 00122 00130 void dlInsertZoneList(list <DLZone*> zoneList, int cursorPosition); 00131 00136 void dlDeleteZone(int cursorPosition); 00137 00142 void dlDeleteZone(DLZone &deletedZone); 00143 00147 void dlClearZones() { segZones.clear(); }; 00148 00153 const DLImage* dlGetPageImage() const; 00154 00159 void dlPropagateSegmentationPointer(); 00160 00165 bool dlCheckPageImageData() const; 00166 00167 protected: 00168 00169 DLPage* segPage; 00170 00175 bool dlCheckSegmentationPointer(); 00176 00183 bool dlIsWithinPageBoundaries(int pageWidth, int pageHeight); 00184 00185 }; //end class 00186 00187 #endif //_DLSEGMENTATION_H_