All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
pgedit.h File Reference
#include "ocrblock.h"
#include "ocrrow.h"
#include "werd.h"
#include "rect.h"
#include "params.h"
#include "tesseractclass.h"

Go to the source code of this file.

Classes

class  PGEventHandler
 

Functions

ScrollViewbln_word_window_handle ()
 
void build_image_window (int width, int height)
 
void display_bln_lines (ScrollView window, ScrollView::Color colour, float scale_factor, float y_offset, float minx, float maxx)
 
void pgeditor_msg (const char *msg)
 
void pgeditor_show_point (SVEvent *event)
 
void show_point (PAGE_RES *page_res, float x, float y)
 

Variables

BLOCK_LIST * current_block_list
 
char * editor_image_win_name = "EditorImage"
 
int editor_image_xpos = 590
 
int editor_image_ypos = 10
 
int editor_image_height = 680
 
int editor_image_width = 655
 
int editor_image_word_bb_color = BLUE
 
int editor_image_blob_bb_color = YELLOW
 
int editor_image_text_color = WHITE
 
char * editor_dbwin_name = "EditorDBWin"
 
int editor_dbwin_xpos = 50
 
int editor_dbwin_ypos = 500
 
int editor_dbwin_height = 24
 
int editor_dbwin_width = 80
 
char * editor_word_name = "BlnWords"
 
int editor_word_xpos = 60
 
int editor_word_ypos = 510
 
int editor_word_height = 240
 
int editor_word_width = 655
 
double editor_smd_scale_factor = 1.0
 

Function Documentation

ScrollView* bln_word_window_handle ( )

bln_word_window_handle()

Returns
a WINDOW for the word window, creating it if necessary

Definition at line 172 of file pgedit.cpp.

172  { // return handle
173  // not opened yet
174  if (bln_word_window == NULL) {
175  pgeditor_msg("Creating BLN word window...");
178  editor_word_height, 4000, 4000, true);
179  BlnEventHandler* a = new BlnEventHandler();
181  pgeditor_msg("Creating BLN word window...Done");
182  }
183  return bln_word_window;
184 }
char * editor_word_name
Definition: pgedit.cpp:149
int editor_word_width
Definition: pgedit.cpp:153
ScrollView * bln_word_window
Definition: pgedit.cpp:114
void AddEventHandler(SVEventHandler *listener)
Add an Event Listener to this ScrollView Window.
Definition: scrollview.cpp:418
void pgeditor_msg(const char *msg)
Definition: pgedit.cpp:373
int editor_word_xpos
Definition: pgedit.cpp:150
int editor_word_ypos
Definition: pgedit.cpp:151
int editor_word_height
Definition: pgedit.cpp:152
#define NULL
Definition: host.h:144
void build_image_window ( int  width,
int  height 
)

build_image_window()

Destroy the existing image window if there is one. Work out how big the new window needs to be. Create it and re-display.

Definition at line 193 of file pgedit.cpp.

193  {
194  if (image_win != NULL) { delete image_win; }
197  width + 1,
198  height + editor_image_menuheight + 1,
199  width,
200  height,
201  true);
202 }
int editor_image_menuheight
Definition: pgedit.cpp:134
ScrollView * image_win
Definition: pgedit.cpp:107
char * editor_image_win_name
Definition: pgedit.cpp:131
int editor_image_xpos
Definition: pgedit.cpp:132
int editor_image_ypos
Definition: pgedit.cpp:133
#define NULL
Definition: host.h:144
void display_bln_lines ( ScrollView  window,
ScrollView::Color  colour,
float  scale_factor,
float  y_offset,
float  minx,
float  maxx 
)
void pgeditor_msg ( const char *  msg)

pgeditor_msg()

Display a message - in the command window if there is one, or to stdout

Definition at line 373 of file pgedit.cpp.

374  {
375  image_win->AddMessage(msg);
376 }
void AddMessage(const char *format,...)
Definition: scrollview.cpp:567
ScrollView * image_win
Definition: pgedit.cpp:107
void pgeditor_show_point ( SVEvent event)

pgeditor_show_point()

Display the coordinates of a point in the command window

Definition at line 384 of file pgedit.cpp.

385  {
386  image_win->AddMessage("Pointing at(%d, %d)", event->x, event->y);
387 }
int y
Definition: scrollview.h:67
void AddMessage(const char *format,...)
Definition: scrollview.cpp:567
ScrollView * image_win
Definition: pgedit.cpp:107
int x
Definition: scrollview.h:66
void show_point ( PAGE_RES page_res,
float  x,
float  y 
)

show_point()

Show coords of point, blob bounding box, word bounding box and offset from row baseline

Definition at line 655 of file pgedit.cpp.

655  {
656  FCOORD pt(x, y);
657  PAGE_RES_IT pr_it(page_res);
658 
659  const int kBufsize = 512;
660  char msg[kBufsize];
661  char *msg_ptr = msg;
662 
663  msg_ptr += sprintf(msg_ptr, "Pt:(%0.3f, %0.3f) ", x, y);
664 
665  for (WERD_RES* word = pr_it.word(); word != NULL; word = pr_it.forward()) {
666  if (pr_it.row() != pr_it.prev_row() &&
667  pr_it.row()->row->bounding_box().contains(pt)) {
668  msg_ptr += sprintf(msg_ptr, "BL(x)=%0.3f ",
669  pr_it.row()->row->base_line(x));
670  }
671  if (word->word->bounding_box().contains(pt)) {
672  TBOX box = word->word->bounding_box();
673  msg_ptr += sprintf(msg_ptr, "Wd(%d, %d)/(%d, %d) ",
674  box.left(), box.bottom(),
675  box.right(), box.top());
676  C_BLOB_IT cblob_it(word->word->cblob_list());
677  for (cblob_it.mark_cycle_pt();
678  !cblob_it.cycled_list();
679  cblob_it.forward()) {
680  C_BLOB* cblob = cblob_it.data();
681  box = cblob->bounding_box();
682  if (box.contains(pt)) {
683  msg_ptr += sprintf(msg_ptr,
684  "CBlb(%d, %d)/(%d, %d) ",
685  box.left(), box.bottom(),
686  box.right(), box.top());
687  }
688  }
689  }
690  }
691  image_win->AddMessage(msg);
692 }
void AddMessage(const char *format,...)
Definition: scrollview.cpp:567
inT16 right() const
Definition: rect.h:75
ScrollView * image_win
Definition: pgedit.cpp:107
inT16 left() const
Definition: rect.h:68
inT16 bottom() const
Definition: rect.h:61
WERD * word
Definition: pageres.h:175
Definition: rect.h:30
bool contains(const FCOORD pt) const
Definition: rect.h:323
TBOX bounding_box() const
Definition: stepblob.cpp:250
#define NULL
Definition: host.h:144
inT16 top() const
Definition: rect.h:54
Definition: points.h:189

Variable Documentation

BLOCK_LIST* current_block_list
int editor_dbwin_height = 24

"Editor debug window height"

Definition at line 146 of file pgedit.cpp.

char* editor_dbwin_name = "EditorDBWin"

"Editor debug window name"

Definition at line 143 of file pgedit.cpp.

int editor_dbwin_width = 80

"Editor debug window width"

Definition at line 147 of file pgedit.cpp.

int editor_dbwin_xpos = 50

"Editor debug window X Pos"

Definition at line 144 of file pgedit.cpp.

int editor_dbwin_ypos = 500

"Editor debug window Y Pos"

Definition at line 145 of file pgedit.cpp.

int editor_image_blob_bb_color = YELLOW

"Blob bounding box colour"

Definition at line 138 of file pgedit.cpp.

int editor_image_height = 680

"Editor image height"

int editor_image_text_color = WHITE

"Correct text colour"

Definition at line 140 of file pgedit.cpp.

int editor_image_width = 655

"Editor image width"

char* editor_image_win_name = "EditorImage"

"Editor image window name"

Definition at line 131 of file pgedit.cpp.

int editor_image_word_bb_color = BLUE

"Word bounding box colour"

Definition at line 136 of file pgedit.cpp.

int editor_image_xpos = 590

"Editor image X Pos"

Definition at line 132 of file pgedit.cpp.

int editor_image_ypos = 10

"Editor image Y Pos"

Definition at line 133 of file pgedit.cpp.

double editor_smd_scale_factor = 1.0

"Scaling for smd image"

int editor_word_height = 240

"Word window height"

Definition at line 152 of file pgedit.cpp.

char* editor_word_name = "BlnWords"

"BL normalised word window"

"BL normalized word window"

Definition at line 149 of file pgedit.cpp.

int editor_word_width = 655

"Word window width"

Definition at line 153 of file pgedit.cpp.

int editor_word_xpos = 60

"Word window X Pos"

Definition at line 150 of file pgedit.cpp.

int editor_word_ypos = 510

"Word window Y Pos"

Definition at line 151 of file pgedit.cpp.