@@ -146,6 +146,63 @@ INT_VAR(editor_word_width, 655, "Word window width");
146
146
147
147
STRING_VAR (editor_debug_config_file, " " , " Config file to apply to single words" );
148
148
149
+ /* *
150
+ * show_point()
151
+ *
152
+ * Show coords of point, blob bounding box, word bounding box and offset from
153
+ * row baseline
154
+ */
155
+
156
+ static void show_point (PAGE_RES* page_res, float x, float y) {
157
+ FCOORD pt (x, y);
158
+ PAGE_RES_IT pr_it (page_res);
159
+
160
+ const int kBufsize = 512 ;
161
+ char msg[kBufsize ];
162
+ char *msg_ptr = msg;
163
+
164
+ msg_ptr += sprintf (msg_ptr, " Pt:(%0.3f, %0.3f) " , x, y);
165
+
166
+ for (WERD_RES* word = pr_it.word (); word != nullptr ; word = pr_it.forward ()) {
167
+ if (pr_it.row () != pr_it.prev_row () &&
168
+ pr_it.row ()->row ->bounding_box ().contains (pt)) {
169
+ msg_ptr += sprintf (msg_ptr, " BL(x)=%0.3f " ,
170
+ pr_it.row ()->row ->base_line (x));
171
+ }
172
+ if (word->word ->bounding_box ().contains (pt)) {
173
+ TBOX box = word->word ->bounding_box ();
174
+ msg_ptr += sprintf (msg_ptr, " Wd(%d, %d)/(%d, %d) " ,
175
+ box.left (), box.bottom (),
176
+ box.right (), box.top ());
177
+ C_BLOB_IT cblob_it (word->word ->cblob_list ());
178
+ for (cblob_it.mark_cycle_pt ();
179
+ !cblob_it.cycled_list ();
180
+ cblob_it.forward ()) {
181
+ C_BLOB* cblob = cblob_it.data ();
182
+ box = cblob->bounding_box ();
183
+ if (box.contains (pt)) {
184
+ msg_ptr += sprintf (msg_ptr,
185
+ " CBlb(%d, %d)/(%d, %d) " ,
186
+ box.left (), box.bottom (),
187
+ box.right (), box.top ());
188
+ }
189
+ }
190
+ }
191
+ }
192
+ image_win->AddMessage (msg);
193
+ }
194
+
195
+ /* *
196
+ * pgeditor_msg()
197
+ *
198
+ * Display a message - in the command window if there is one, or to stdout
199
+ */
200
+
201
+ static void pgeditor_msg ( // message display
202
+ const char *msg) {
203
+ image_win->AddMessage (msg);
204
+ }
205
+
149
206
class BlnEventHandler : public SVEventHandler {
150
207
public:
151
208
void Notify (const SVEvent* sv_event) override {
@@ -161,7 +218,7 @@ class BlnEventHandler : public SVEventHandler {
161
218
*
162
219
* @return a WINDOW for the word window, creating it if necessary
163
220
*/
164
- ScrollView* bln_word_window_handle () { // return handle
221
+ static ScrollView* bln_word_window_handle () { // return handle
165
222
// not opened yet
166
223
if (bln_word_window == nullptr ) {
167
224
pgeditor_msg (" Creating BLN word window..." );
@@ -182,7 +239,7 @@ ScrollView* bln_word_window_handle() { // return handle
182
239
* new window needs to be. Create it and re-display.
183
240
*/
184
241
185
- void build_image_window (int width, int height) {
242
+ static void build_image_window (int width, int height) {
186
243
delete image_win;
187
244
image_win = new ScrollView (editor_image_win_name.string (),
188
245
editor_image_xpos, editor_image_ypos,
@@ -352,29 +409,6 @@ void Tesseract::pgeditor_main(int width, int height, PAGE_RES *page_res) {
352
409
}
353
410
} // namespace tesseract
354
411
355
-
356
- /* *
357
- * pgeditor_msg()
358
- *
359
- * Display a message - in the command window if there is one, or to stdout
360
- */
361
-
362
- void pgeditor_msg ( // message display
363
- const char *msg) {
364
- image_win->AddMessage (msg);
365
- }
366
-
367
- /* *
368
- * pgeditor_show_point()
369
- *
370
- * Display the coordinates of a point in the command window
371
- */
372
-
373
- void pgeditor_show_point ( // display coords
374
- SVEvent *event) {
375
- image_win->AddMessage (" Pointing at(%d, %d)" , event->x , event->y );
376
- }
377
-
378
412
/* *
379
413
* process_cmd_win_event()
380
414
*
@@ -642,53 +676,6 @@ void Tesseract::debug_word(PAGE_RES* page_res, const TBOX &selection_box) {
642
676
} // namespace tesseract
643
677
644
678
645
- /* *
646
- * show_point()
647
- *
648
- * Show coords of point, blob bounding box, word bounding box and offset from
649
- * row baseline
650
- */
651
-
652
- void show_point (PAGE_RES* page_res, float x, float y) {
653
- FCOORD pt (x, y);
654
- PAGE_RES_IT pr_it (page_res);
655
-
656
- const int kBufsize = 512 ;
657
- char msg[kBufsize ];
658
- char *msg_ptr = msg;
659
-
660
- msg_ptr += sprintf (msg_ptr, " Pt:(%0.3f, %0.3f) " , x, y);
661
-
662
- for (WERD_RES* word = pr_it.word (); word != nullptr ; word = pr_it.forward ()) {
663
- if (pr_it.row () != pr_it.prev_row () &&
664
- pr_it.row ()->row ->bounding_box ().contains (pt)) {
665
- msg_ptr += sprintf (msg_ptr, " BL(x)=%0.3f " ,
666
- pr_it.row ()->row ->base_line (x));
667
- }
668
- if (word->word ->bounding_box ().contains (pt)) {
669
- TBOX box = word->word ->bounding_box ();
670
- msg_ptr += sprintf (msg_ptr, " Wd(%d, %d)/(%d, %d) " ,
671
- box.left (), box.bottom (),
672
- box.right (), box.top ());
673
- C_BLOB_IT cblob_it (word->word ->cblob_list ());
674
- for (cblob_it.mark_cycle_pt ();
675
- !cblob_it.cycled_list ();
676
- cblob_it.forward ()) {
677
- C_BLOB* cblob = cblob_it.data ();
678
- box = cblob->bounding_box ();
679
- if (box.contains (pt)) {
680
- msg_ptr += sprintf (msg_ptr,
681
- " CBlb(%d, %d)/(%d, %d) " ,
682
- box.left (), box.bottom (),
683
- box.right (), box.top ());
684
- }
685
- }
686
- }
687
- }
688
- image_win->AddMessage (msg);
689
- }
690
-
691
-
692
679
/* *********************************************************************
693
680
* WERD PROCESSOR FUNCTIONS
694
681
* ========================
0 commit comments