#include <pageres.h>
List of all members.
Detailed Description
Definition at line 656 of file pageres.h.
Constructor & Destructor Documentation
| PAGE_RES_IT::PAGE_RES_IT |
( |
| ) |
[inline] |
| PAGE_RES_IT::PAGE_RES_IT |
( |
PAGE_RES * |
the_page_res | ) |
[inline] |
Member Function Documentation
| BLOCK_RES* PAGE_RES_IT::block |
( |
| ) |
const [inline] |
| int PAGE_RES_IT::cmp |
( |
const PAGE_RES_IT & |
other | ) |
const |
Definition at line 1200 of file pageres.cpp.
{
ASSERT_HOST(page_res == other.page_res);
if (other.block_res == NULL) {
if (block_res == NULL)
return 0;
return -1;
}
if (block_res == NULL) {
return 1;
}
if (block_res == other.block_res) {
if (other.row_res == NULL || row_res == NULL) {
return 0;
}
if (row_res == other.row_res) {
ASSERT_HOST(other.word_res != NULL && word_res != NULL);
if (word_res == other.word_res) {
return 0;
}
WERD_RES_IT word_res_it(&row_res->word_res_list);
for (word_res_it.mark_cycle_pt(); !word_res_it.cycled_list();
word_res_it.forward()) {
if (word_res_it.data() == word_res) {
return -1;
} else if (word_res_it.data() == other.word_res) {
return 1;
}
}
ASSERT_HOST("Error: Incomparable PAGE_RES_ITs" == NULL);
}
ROW_RES_IT row_res_it(&block_res->row_res_list);
for (row_res_it.mark_cycle_pt(); !row_res_it.cycled_list();
row_res_it.forward()) {
if (row_res_it.data() == row_res) {
return -1;
} else if (row_res_it.data() == other.row_res) {
return 1;
}
}
ASSERT_HOST("Error: Incomparable PAGE_RES_ITs" == NULL);
}
BLOCK_RES_IT block_res_it(&page_res->block_res_list);
for (block_res_it.mark_cycle_pt();
!block_res_it.cycled_list(); block_res_it.forward()) {
if (block_res_it.data() == block_res) {
return -1;
} else if (block_res_it.data() == other.block_res) {
return 1;
}
}
ASSERT_HOST("Error: Incomparable PAGE_RES_ITs" == NULL);
return 0;
}
| void PAGE_RES_IT::DeleteCurrentWord |
( |
| ) |
|
Definition at line 1449 of file pageres.cpp.
{
ASSERT_HOST(!word_res->part_of_combo);
if (!word_res->combination) {
WERD_IT w_it(row()->row->word_list());
for (w_it.mark_cycle_pt(); !w_it.cycled_list(); w_it.forward()) {
if (w_it.data() == word_res->word) {
break;
}
}
ASSERT_HOST(!w_it.cycled_list());
delete w_it.extract();
}
WERD_RES_IT wr_it(&row()->word_res_list);
for (wr_it.mark_cycle_pt(); !wr_it.cycled_list(); wr_it.forward()) {
if (wr_it.data() == word_res) {
word_res = NULL;
break;
}
}
ASSERT_HOST(!wr_it.cycled_list());
delete wr_it.extract();
ResetWordIterator();
}
| WERD_RES* PAGE_RES_IT::forward |
( |
| ) |
[inline] |
Definition at line 713 of file pageres.h.
{
return internal_forward(false, false);
}
| WERD_RES * PAGE_RES_IT::forward_block |
( |
| ) |
|
Definition at line 1666 of file pageres.cpp.
{
while (block_res == next_block_res) {
internal_forward(false, true);
}
return internal_forward(false, true);
}
| WERD_RES * PAGE_RES_IT::forward_paragraph |
( |
| ) |
|
Definition at line 1651 of file pageres.cpp.
{
while (block_res == next_block_res &&
(next_row_res != NULL && next_row_res->row != NULL &&
row_res->row->para() == next_row_res->row->para())) {
internal_forward(false, true);
}
return internal_forward(false, true);
}
| WERD_RES* PAGE_RES_IT::forward_with_empties |
( |
| ) |
[inline] |
Definition at line 717 of file pageres.h.
{
return internal_forward(false, true);
}
| void PAGE_RES_IT::MakeCurrentWordFuzzy |
( |
| ) |
|
| BLOCK_RES* PAGE_RES_IT::next_block |
( |
| ) |
const [inline] |
Definition at line 748 of file pageres.h.
{
return next_block_res;
}
| ROW_RES* PAGE_RES_IT::next_row |
( |
| ) |
const [inline] |
| WERD_RES* PAGE_RES_IT::next_word |
( |
| ) |
const [inline] |
Definition at line 742 of file pageres.h.
{
return next_word_res;
}
| bool PAGE_RES_IT::operator!= |
( |
const PAGE_RES_IT & |
other | ) |
const [inline] |
Definition at line 672 of file pageres.h.
{return !(*this == other); }
| bool PAGE_RES_IT::operator== |
( |
const PAGE_RES_IT & |
other | ) |
const |
Definition at line 1194 of file pageres.cpp.
{
return word_res == other.word_res &&
row_res == other.row_res &&
block_res == other.block_res;
}
| BLOCK_RES* PAGE_RES_IT::prev_block |
( |
| ) |
const [inline] |
Definition at line 730 of file pageres.h.
{
return prev_block_res;
}
| ROW_RES* PAGE_RES_IT::prev_row |
( |
| ) |
const [inline] |
| WERD_RES* PAGE_RES_IT::prev_word |
( |
| ) |
const [inline] |
Definition at line 724 of file pageres.h.
{
return prev_word_res;
}
| void PAGE_RES_IT::rej_stat_word |
( |
| ) |
|
Definition at line 1321 of file pageres.cpp.
{
if (words->empty()) {
DeleteCurrentWord();
return;
}
WERD_RES* input_word = word();
if (input_word->word->flag(W_BOL)) {
(*words)[0]->word->set_flag(W_BOL, true);
} else {
(*words)[0]->word->set_blanks(1);
}
words->back()->word->set_flag(W_EOL, input_word->word->flag(W_EOL));
WERD_IT w_it(row()->row->word_list());
if (!input_word->combination) {
for (w_it.mark_cycle_pt(); !w_it.cycled_list(); w_it.forward()) {
WERD* word = w_it.data();
if (word == input_word->word)
break;
}
ASSERT_HOST(!w_it.cycled_list());
}
WERD_RES_IT wr_it(&row()->word_res_list);
for (wr_it.mark_cycle_pt(); !wr_it.cycled_list(); wr_it.forward()) {
WERD_RES* word = wr_it.data();
if (word == input_word)
break;
}
ASSERT_HOST(!wr_it.cycled_list());
C_BLOB_IT src_b_it(input_word->word->cblob_list());
src_b_it.sort(&C_BLOB::SortByXMiddle);
C_BLOB_IT rej_b_it(input_word->word->rej_cblob_list());
rej_b_it.sort(&C_BLOB::SortByXMiddle);
for (int w = 0; w < words->size(); ++w) {
WERD_RES* word_w = (*words)[w];
GenericVector<int> blob_ends;
C_BLOB_LIST* next_word_blobs =
w + 1 < words->size() ? (*words)[w + 1]->word->cblob_list() : NULL;
ComputeBlobEnds(*word_w, next_word_blobs, &blob_ends);
word_w->word->cblob_list()->clear();
C_BLOB_IT dest_it(word_w->word->cblob_list());
tesseract::BoxWord* box_word = new tesseract::BoxWord;
for (int i = 0; i < blob_ends.size(); ++i) {
int end_x = blob_ends[i];
TBOX blob_box;
while (!src_b_it.empty() &&
src_b_it.data()->bounding_box().x_middle() < end_x) {
blob_box += src_b_it.data()->bounding_box();
dest_it.add_after_then_move(src_b_it.extract());
src_b_it.forward();
}
while (!rej_b_it.empty() &&
rej_b_it.data()->bounding_box().x_middle() < end_x) {
blob_box += rej_b_it.data()->bounding_box();
dest_it.add_after_then_move(rej_b_it.extract());
rej_b_it.forward();
}
if (i > 0 && blob_box.left() < blob_ends[i - 1])
blob_box.set_left(blob_ends[i - 1]);
if (blob_box.right() > end_x)
blob_box.set_right(end_x);
box_word->InsertBox(i, blob_box);
}
for (int i = 0; i < box_word->length(); ++i) {
TBOX box = box_word->BlobBox(i);
if (box.null_box()) {
for (dest_it.mark_cycle_pt(); !dest_it.cycled_list();
dest_it.forward()) {
TBOX blob_box = dest_it.data()->bounding_box();
if (blob_box.left() < blob_ends[i] &&
(i == 0 || blob_box.right() >= blob_ends[i - 1])) {
if (i > 0 && blob_box.left() < blob_ends[i - 1])
blob_box.set_left(blob_ends[i - 1]);
if (blob_box.right() > blob_ends[i])
blob_box.set_right(blob_ends[i]);
box_word->ChangeBox(i, blob_box);
break;
}
}
}
}
delete word_w->box_word;
word_w->box_word = box_word;
if (!input_word->combination) {
w_it.add_before_stay_put(word_w->word);
word_w->combination = false;
}
(*words)[w] = NULL;
wr_it.add_before_stay_put(word_w);
}
words->clear();
if (!input_word->combination)
delete w_it.extract();
delete wr_it.extract();
ResetWordIterator();
}
| void PAGE_RES_IT::ResetWordIterator |
( |
| ) |
|
Definition at line 1532 of file pageres.cpp.
{
if (row_res == next_row_res) {
word_res_it.move_to_first();
for (word_res_it.mark_cycle_pt();
!word_res_it.cycled_list() && word_res_it.data() != next_word_res;
word_res_it.forward()) {
if (!word_res_it.data()->part_of_combo) {
if (prev_row_res == row_res) prev_word_res = word_res;
word_res = word_res_it.data();
}
}
ASSERT_HOST(!word_res_it.cycled_list());
word_res_it.forward();
} else {
WERD_RES_IT wr_it(&row_res->word_res_list);
for (wr_it.mark_cycle_pt(); !wr_it.cycled_list(); wr_it.forward()) {
if (!wr_it.data()->part_of_combo) {
if (prev_row_res == row_res) prev_word_res = word_res;
word_res = wr_it.data();
}
}
}
}
| WERD_RES* PAGE_RES_IT::restart_page |
( |
| ) |
[inline] |
| WERD_RES* PAGE_RES_IT::restart_page_with_empties |
( |
| ) |
[inline] |
| ROW_RES* PAGE_RES_IT::row |
( |
| ) |
const [inline] |
| WERD_RES * PAGE_RES_IT::start_page |
( |
bool |
empty_ok | ) |
|
Definition at line 1509 of file pageres.cpp.
{
block_res_it.set_to_list(&page_res->block_res_list);
block_res_it.mark_cycle_pt();
prev_block_res = NULL;
prev_row_res = NULL;
prev_word_res = NULL;
block_res = NULL;
row_res = NULL;
word_res = NULL;
next_block_res = NULL;
next_row_res = NULL;
next_word_res = NULL;
internal_forward(true, empty_ok);
return internal_forward(false, empty_ok);
}
| WERD_RES* PAGE_RES_IT::word |
( |
| ) |
const [inline] |
Member Data Documentation
The documentation for this class was generated from the following files: