Tesseract
3.02
|
#include <tabvector.h>
Public Member Functions | |
TabConstraint () | |
Static Public Member Functions | |
static void | CreateConstraint (TabVector *vector, bool is_top) |
static bool | CompatibleConstraints (TabConstraint_LIST *list1, TabConstraint_LIST *list2) |
static void | MergeConstraints (TabConstraint_LIST *list1, TabConstraint_LIST *list2) |
static void | ApplyConstraints (TabConstraint_LIST *constraints) |
Definition at line 69 of file tabvector.h.
tesseract::TabConstraint::TabConstraint | ( | ) | [inline] |
Definition at line 71 of file tabvector.h.
{ // This empty constructor is here only so that the class can be ELISTIZED. // TODO(rays) change deep_copy in elst.h line 955 to take a callback copier // and eliminate CLASSNAME##_copier. }
void tesseract::TabConstraint::ApplyConstraints | ( | TabConstraint_LIST * | constraints | ) | [static] |
Definition at line 120 of file tabvector.cpp.
{ int y_min = -MAX_INT32; int y_max = MAX_INT32; GetConstraints(constraints, &y_min, &y_max); int y = (y_min + y_max) / 2; TabConstraint_IT it(constraints); for (it.mark_cycle_pt(); !it.cycled_list(); it.forward()) { TabConstraint* constraint = it.data(); TabVector* v = constraint->vector_; if (constraint->is_top_) { v->SetYEnd(y); v->set_top_constraints(NULL); } else { v->SetYStart(y); v->set_bottom_constraints(NULL); } } delete constraints; }
bool tesseract::TabConstraint::CompatibleConstraints | ( | TabConstraint_LIST * | list1, |
TabConstraint_LIST * | list2 | ||
) | [static] |
Definition at line 79 of file tabvector.cpp.
{ if (list1 == list2) return false; int y_min = -MAX_INT32; int y_max = MAX_INT32; if (textord_debug_tabfind > 3) tprintf("Testing constraint compatibility\n"); GetConstraints(list1, &y_min, &y_max); GetConstraints(list2, &y_min, &y_max); if (textord_debug_tabfind > 3) tprintf("Resulting range = [%d,%d]\n", y_min, y_max); return y_max >= y_min; }
void tesseract::TabConstraint::CreateConstraint | ( | TabVector * | vector, |
bool | is_top | ||
) | [static] |
Definition at line 67 of file tabvector.cpp.
{ TabConstraint* constraint = new TabConstraint(vector, is_top); TabConstraint_LIST* constraints = new TabConstraint_LIST; TabConstraint_IT it(constraints); it.add_to_end(constraint); if (is_top) vector->set_top_constraints(constraints); else vector->set_bottom_constraints(constraints); }
void tesseract::TabConstraint::MergeConstraints | ( | TabConstraint_LIST * | list1, |
TabConstraint_LIST * | list2 | ||
) | [static] |
Definition at line 96 of file tabvector.cpp.
{ if (list1 == list2) return; TabConstraint_IT it(list2); if (textord_debug_tabfind > 3) tprintf("Merging constraints\n"); // The vectors of all constraints on list2 are now going to be on list1. for (it.mark_cycle_pt(); !it.cycled_list(); it.forward()) { TabConstraint* constraint = it.data(); if (textord_debug_tabfind> 3) constraint->vector_->Print("Merge"); if (constraint->is_top_) constraint->vector_->set_top_constraints(list1); else constraint->vector_->set_bottom_constraints(list1); } it = list1; it.add_list_before(list2); delete list2; }