31 if (partner !=
nullptr) {
34 if (latest_part_ ==
nullptr || partner ==
nullptr) {
36 part_it_.move_to_last();
39 for (part_it_.move_to_first(); !part_it_.at_last() && part_it_.data() != partner;
44 part_it_.add_after_then_move(part);
55 int resolution, ColPartition_LIST *used_parts,
56 BLOCK_LIST *blocks, TO_BLOCK_LIST *to_blocks) {
57 MakeBlocks(bleft, tright, resolution, used_parts);
58 BLOCK_IT block_it(blocks);
59 block_it.move_to_last();
60 block_it.add_list_after(&completed_blocks_);
61 TO_BLOCK_IT to_block_it(to_blocks);
62 to_block_it.move_to_last();
63 to_block_it.add_list_after(&to_blocks_);
69 BLOCK_IT block_it(&completed_blocks_);
70 block_it.add_list_before(blocks);
71 TO_BLOCK_IT to_block_it(&to_blocks_);
72 to_block_it.add_list_before(to_blocks);
78void WorkingPartSet::MakeBlocks(
const ICOORD &bleft,
const ICOORD &tright,
int resolution,
79 ColPartition_LIST *used_parts) {
80 part_it_.move_to_first();
81 while (!part_it_.empty()) {
84 ColPartition_LIST block_parts;
85 ColPartition_IT block_it(&block_parts);
87 bool text_block =
false;
95 block_it.add_after_then_move(part);
97 if (part_it_.empty() || next_part != part_it_.data()) {
103 if (next_part ==
nullptr && !part_it_.empty()) {
104 ColPartition *next_block_part = part_it_.data();
106 const TBOX &next_box = next_block_part->bounding_box();
112 !next_block_part->IsLineType() && next_box.bottom() <= part_box.top() &&
113 (text_block || part_box.bottom() <= next_box.top())) {
114 next_part = next_block_part;
117 }
while (!part_it_.empty() && next_part !=
nullptr);
120 if (to_block !=
nullptr) {
121 TO_BLOCK_IT to_block_it(&to_blocks_);
122 to_block_it.add_to_end(to_block);
123 BLOCK_IT block_it(&completed_blocks_);
124 block_it.add_to_end(to_block->block);
129 &completed_blocks_, &to_blocks_);
132 part_it_.set_to_list(&part_set_);
133 latest_part_ =
nullptr;
134 ASSERT_HOST(completed_blocks_.length() == to_blocks_.length());
static void LineSpacingBlocks(const ICOORD &bleft, const ICOORD &tright, int resolution, ColPartition_LIST *block_parts, ColPartition_LIST *used_parts, BLOCK_LIST *completed_blocks, TO_BLOCK_LIST *to_blocks)
static TO_BLOCK * MakeBlock(const ICOORD &bleft, const ICOORD &tright, ColPartition_LIST *block_parts, ColPartition_LIST *used_parts)
PolyBlockType type() const
void set_working_set(WorkingPartSet *working_set)
BlobRegionType blob_type() const
const TBOX & bounding_box() const
static bool TypesSimilar(PolyBlockType type1, PolyBlockType type2)
ColPartition * SingletonPartner(bool upper)
void AddPartition(ColPartition *part)
void ExtractCompletedBlocks(const ICOORD &bleft, const ICOORD &tright, int resolution, ColPartition_LIST *used_parts, BLOCK_LIST *blocks, TO_BLOCK_LIST *to_blocks)
void InsertCompletedBlocks(BLOCK_LIST *blocks, TO_BLOCK_LIST *to_blocks)