00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef WERD_H
00021 #define WERD_H
00022
00023 #include "params.h"
00024 #include "bits16.h"
00025 #include "elst2.h"
00026 #include "strngs.h"
00027 #include "blckerr.h"
00028 #include "stepblob.h"
00029
00030 enum WERD_FLAGS
00031 {
00032 W_SEGMENTED,
00033 W_ITALIC,
00034 W_BOLD,
00035 W_BOL,
00036 W_EOL,
00037 W_NORMALIZED,
00038 W_SCRIPT_HAS_XHEIGHT,
00039 W_SCRIPT_IS_LATIN,
00040 W_DONT_CHOP,
00041 W_REP_CHAR,
00042 W_FUZZY_SP,
00043 W_FUZZY_NON,
00044 W_INVERSE
00045 };
00046
00047 enum DISPLAY_FLAGS
00048 {
00049
00050 DF_BOX,
00051 DF_TEXT,
00052 DF_POLYGONAL,
00053 DF_EDGE_STEP,
00054 DF_BN_POLYGONAL,
00055 DF_BLAMER
00056 };
00057
00058 class ROW;
00059
00060 class WERD : public ELIST2_LINK {
00061 public:
00062 WERD() {}
00063
00064
00065
00066
00067 WERD(C_BLOB_LIST *blob_list, uinT8 blanks, const char *text);
00068
00069
00070
00071
00072 WERD(C_BLOB_LIST *blob_list, WERD *clone);
00073
00074
00075
00076 WERD* ConstructFromSingleBlob(bool bol, bool eol, C_BLOB* blob);
00077
00078 ~WERD() {
00079 }
00080
00081
00082 WERD & operator= (const WERD &source);
00083
00084
00085
00086
00087
00088
00089
00090
00091 WERD *ConstructWerdWithNewBlobs(C_BLOB_LIST *all_blobs,
00092 C_BLOB_LIST *orphan_blobs);
00093
00094
00095 C_BLOB_LIST *rej_cblob_list() {
00096 return &rej_cblobs;
00097 }
00098
00099
00100 C_BLOB_LIST *cblob_list() {
00101 return &cblobs;
00102 }
00103
00104 uinT8 space() {
00105 return blanks;
00106 }
00107 void set_blanks(uinT8 new_blanks) {
00108 blanks = new_blanks;
00109 }
00110 int script_id() const {
00111 return script_id_;
00112 }
00113 void set_script_id(int id) {
00114 script_id_ = id;
00115 }
00116
00117 TBOX bounding_box();
00118
00119 const char *text() const { return correct.string(); }
00120 void set_text(const char *new_text) { correct = new_text; }
00121
00122 BOOL8 flag(WERD_FLAGS mask) const { return flags.bit(mask); }
00123 void set_flag(WERD_FLAGS mask, BOOL8 value) { flags.set_bit(mask, value); }
00124
00125 BOOL8 display_flag(uinT8 flag) const { return disp_flags.bit(flag); }
00126 void set_display_flag(uinT8 flag, BOOL8 value) {
00127 disp_flags.set_bit(flag, value);
00128 }
00129
00130 WERD *shallow_copy();
00131
00132
00133 void move(const ICOORD vec);
00134
00135
00136 void join_on(WERD* other);
00137
00138
00139 void copy_on(WERD* other);
00140
00141
00142 void print();
00143
00144
00145 void plot(ScrollView *window, ScrollView::Color colour);
00146
00147
00148 static ScrollView::Color NextColor(ScrollView::Color colour);
00149
00150
00151 void plot(ScrollView *window);
00152
00153
00154 void plot_rej_blobs(ScrollView *window);
00155
00156 private:
00157 uinT8 blanks;
00158 uinT8 dummy;
00159 BITS16 flags;
00160 BITS16 disp_flags;
00161 inT16 script_id_;
00162 STRING correct;
00163 C_BLOB_LIST cblobs;
00164 C_BLOB_LIST rej_cblobs;
00165 };
00166
00167 ELIST2IZEH (WERD)
00168 #include "ocrrow.h" // placed here due to
00169
00170 int word_comparator(const void *word1p, const void *word2p);
00171 #endif