#include "mfcpch.h"
#include "werdit.h"
Go to the source code of this file.
#define EXTERN |
* (C) Copyright 1992, Hewlett-Packard Ltd. ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. ** You may obtain a copy of the License at ** http://www.apache.org/licenses/LICENSE-2.0 ** Unless required by applicable law or agreed to in writing, software ** distributed under the License is distributed on an "AS IS" BASIS, ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ** See the License for the specific language governing permissions and ** limitations under the License.
Definition at line 23 of file werdit.cpp.
WERD* make_pseudo_word | ( | BLOCK_LIST * | block_list, | |
BOX & | selection_box, | |||
BLOCK *& | pseudo_block, | |||
ROW *& | pseudo_row | |||
) |
Make all the blobs inside a selection into a single [fake] word.
block_list | blocks to check | |
selection_box | block of selection | |
pseudo_block | ? | |
pseudo_row | row of selection |
Definition at line 128 of file werdit.cpp.
References WERD::blob_list(), ROW::bounding_box(), WERD::bounding_box(), PBLOB::bounding_box(), NULL, BOX::overlap(), WERD::poly_copy(), ROW::word_list(), and ROW::x_height().
Referenced by recog_pseudo_word().
00133 { 00134 BLOCK_IT block_it(block_list); 00135 BLOCK *block; 00136 ROW_IT row_it; 00137 ROW *row; 00138 WERD_IT word_it; 00139 WERD *word; 00140 PBLOB_IT blob_it; 00141 PBLOB *blob; 00142 PBLOB_LIST new_blobs; //list of gathered blobs 00143 //iterator 00144 PBLOB_IT new_blob_it = &new_blobs; 00145 WERD *pseudo_word; //fabricated word 00146 WERD *poly_word; //poly copy of word 00147 // WERD *larc_word; //linearc copy 00148 00149 for (block_it.mark_cycle_pt (); 00150 !block_it.cycled_list (); block_it.forward ()) { 00151 block = block_it.data (); 00152 if (block->bounding_box ().overlap (selection_box)) { 00153 pseudo_block = block; 00154 row_it.set_to_list (block->row_list ()); 00155 for (row_it.mark_cycle_pt (); 00156 !row_it.cycled_list (); row_it.forward ()) { 00157 row = row_it.data (); 00158 if (row->bounding_box ().overlap (selection_box)) { 00159 word_it.set_to_list (row->word_list ()); 00160 for (word_it.mark_cycle_pt (); 00161 !word_it.cycled_list (); word_it.forward ()) { 00162 word = word_it.data (); 00163 if (word->bounding_box ().overlap (selection_box)) { 00164 // if (wordit_linearc && !word->flag(W_POLYGON)) 00165 // { 00166 // larc_word=word->larc_copy(row->x_height()); 00167 // poly_word=larc_word->poly_copy(row->x_height()); 00168 // delete larc_word; 00169 // } 00170 // else 00171 poly_word = word->poly_copy (row->x_height ()); 00172 blob_it.set_to_list (poly_word->blob_list ()); 00173 for (blob_it.mark_cycle_pt (); 00174 !blob_it.cycled_list (); blob_it.forward ()) { 00175 blob = blob_it.data (); 00176 if (blob->bounding_box (). 00177 overlap (selection_box)) { 00178 new_blob_it.add_after_then_move (blob_it.extract ()); 00179 pseudo_row = row; //steal off list 00180 } 00181 } 00182 delete poly_word; //get rid of it 00183 } 00184 } 00185 } 00186 } 00187 } 00188 } 00189 if (!new_blobs.empty ()) { 00190 pseudo_word = new WERD (&new_blobs, 1, NULL); //make new word 00191 } 00192 else 00193 pseudo_word = NULL; 00194 return pseudo_word; 00195 }