33 if (partner !=
nullptr) {
36 if (latest_part_ ==
nullptr || partner ==
nullptr) {
38 part_it_.move_to_last();
39 }
else if (latest_part_->SingletonPartner(
false) != part) {
41 for (part_it_.move_to_first(); !part_it_.at_last() &&
42 part_it_.data() != partner;
45 part_it_.add_after_then_move(part);
58 ColPartition_LIST* used_parts,
60 TO_BLOCK_LIST* to_blocks) {
61 MakeBlocks(bleft, tright, resolution, used_parts);
62 BLOCK_IT block_it(blocks);
63 block_it.move_to_last();
64 block_it.add_list_after(&completed_blocks_);
65 TO_BLOCK_IT to_block_it(to_blocks);
66 to_block_it.move_to_last();
67 to_block_it.add_list_after(&to_blocks_);
73 TO_BLOCK_LIST* to_blocks) {
74 BLOCK_IT block_it(&completed_blocks_);
75 block_it.add_list_before(blocks);
76 TO_BLOCK_IT to_block_it(&to_blocks_);
77 to_block_it.add_list_before(to_blocks);
83 void WorkingPartSet::MakeBlocks(
const ICOORD& bleft,
const ICOORD& tright,
84 int resolution, ColPartition_LIST* used_parts) {
85 part_it_.move_to_first();
86 while (!part_it_.empty()) {
89 ColPartition_LIST block_parts;
90 ColPartition_IT block_it(&block_parts);
92 bool text_block =
false;
100 block_it.add_after_then_move(part);
102 if (part_it_.empty() || next_part != part_it_.data()) {
108 if (next_part ==
nullptr && !part_it_.empty()) {
109 ColPartition* next_block_part = part_it_.data();
111 const TBOX& next_box = next_block_part->bounding_box();
117 !part->
IsLineType() && !next_block_part->IsLineType() &&
119 (text_block || part_box.
bottom() <= next_box.
top()))
120 next_part = next_block_part;
122 }
while (!part_it_.empty() && next_part !=
nullptr);
125 &block_parts, used_parts);
126 if (to_block !=
nullptr) {
127 TO_BLOCK_IT to_block_it(&to_blocks_);
128 to_block_it.add_to_end(to_block);
129 BLOCK_IT block_it(&completed_blocks_);
130 block_it.add_to_end(to_block->
block);
136 &completed_blocks_, &to_blocks_);
139 part_it_.set_to_list(&part_set_);
140 latest_part_ =
nullptr;
141 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)
BlobRegionType blob_type() const
void set_working_set(WorkingPartSet *working_set)
ColPartition * SingletonPartner(bool upper)
static bool TypesSimilar(PolyBlockType type1, PolyBlockType type2)
static TO_BLOCK * MakeBlock(const ICOORD &bleft, const ICOORD &tright, ColPartition_LIST *block_parts, ColPartition_LIST *used_parts)
void InsertCompletedBlocks(BLOCK_LIST *blocks, TO_BLOCK_LIST *to_blocks)
void ExtractCompletedBlocks(const ICOORD &bleft, const ICOORD &tright, int resolution, ColPartition_LIST *used_parts, BLOCK_LIST *blocks, TO_BLOCK_LIST *to_blocks)
#define ELISTIZE(CLASSNAME)
const TBOX & bounding_box() const
PolyBlockType type() const