本文整理汇总了C++中ColPartition::type方法的典型用法代码示例。如果您正苦于以下问题:C++ ColPartition::type方法的具体用法?C++ ColPartition::type怎么用?C++ ColPartition::type使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ColPartition
的用法示例。
在下文中一共展示了ColPartition::type方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MakeBlocks
// Make a block using lines parallel to the given vector that fit between
// the min and max coordinates specified by the ColPartitions.
// Construct a block from the given list of partitions.
void WorkingPartSet::MakeBlocks(const ICOORD& bleft, const ICOORD& tright,
int resolution, ColPartition_LIST* used_parts) {
part_it_.move_to_first();
while (!part_it_.empty()) {
// Gather a list of ColPartitions in block_parts that will be split
// by linespacing into smaller blocks.
ColPartition_LIST block_parts;
ColPartition_IT block_it(&block_parts);
ColPartition* next_part = NULL;
bool text_block = false;
do {
ColPartition* part = part_it_.extract();
if (part->blob_type() == BRT_UNKNOWN || part->blob_type() == BRT_TEXT)
text_block = true;
part->set_working_set(NULL);
part_it_.forward();
block_it.add_after_then_move(part);
next_part = part->SingletonPartner(false);
if (part_it_.empty() || next_part != part_it_.data()) {
// Sequences of partitions can get split by titles.
next_part = NULL;
}
// Merge adjacent blocks that are of the same type and let the
// linespacing determine the real boundaries.
if (next_part == NULL && !part_it_.empty()) {
ColPartition* next_block_part = part_it_.data();
const TBOX& part_box = part->bounding_box();
const TBOX& next_box = next_block_part->bounding_box();
// In addition to the same type, the next box must not be above the
// current box, nor (if image) too far below.
PolyBlockType type = part->type(), next_type = next_block_part->type();
if (ColPartition::TypesSimilar(type, next_type) &&
next_box.bottom() <= part_box.top() &&
(text_block ||
part_box.bottom() - next_box.top() < part_box.height()))
next_part = next_block_part;
}
} while (!part_it_.empty() && next_part != NULL);
if (!text_block) {
TO_BLOCK* to_block = ColPartition::MakeBlock(bleft, tright,
&block_parts, used_parts);
if (to_block != NULL) {
TO_BLOCK_IT to_block_it(&to_blocks_);
to_block_it.add_to_end(to_block);
BLOCK_IT block_it(&completed_blocks_);
block_it.add_to_end(to_block->block);
}
} else {
// Further sub-divide text blocks where linespacing changes.
ColPartition::LineSpacingBlocks(bleft, tright, resolution, &block_parts,
used_parts,
&completed_blocks_, &to_blocks_);
}
}
part_it_.set_to_list(&part_set_);
latest_part_ = NULL;
ASSERT_HOST(completed_blocks_.length() == to_blocks_.length());
}