src/textord/colpartitionset.cpp
int ColPartitionSet::UnmatchedWidth(ColPartitionSet *part_set) {
  int total_width = 0;
  ColPartition_IT it(&part_set->parts_);
  for (it.mark_cycle_pt(); !it.cycled_list(); it.forward()) {
    ColPartition *part = it.data();
    if (!BLOBNBOX::IsTextType(part->blob_type())) {
      continue; // Non-text partitions are irrelevant to column compatibility.
    }
    int y = part->MidY();
    BLOBNBOX_C_IT box_it(part->boxes());
    for (box_it.mark_cycle_pt(); !box_it.cycled_list(); box_it.forward()) {
      const TBOX &box = it.data()->bounding_box();
      // Assume that the whole blob is outside any column iff its x-middle
      // is outside.
      int x = (box.left() + box.right()) / 2;
      ColPartition *col = ColumnContaining(x, y);
      if (col == nullptr) {
        total_width += box.width();
      }
    }
  }
  return total_width;
}
// Returns the total width of all blobs in the part_set that do not lie
// within an approved column. Used as a cost measure for using this
// column set over another that might be compatible.
Returns the total width of all blobs in the part_set that do not lie
within an approved column. Used as a cost measure for using this
column set over another that might be compatible.
Returns the total width of all blobs in the part_set that do not lie within an approved column . Used as a cost measure for using this column set over another that might be compatible .
int ColPartitionSet::UnmatchedWidth(ColPartitionSet *part_set) {
  int total_width = 0;
  ColPartition_IT it(&part_set->parts_);
  for (it.mark_cycle_pt(); !it.cycled_list(); it.forward()) {
    ColPartition *part = it.data();
    if (!BLOBNBOX::IsTextType(part->blob_type())) {
      continue; 
    }
    int y = part->MidY();
    BLOBNBOX_C_IT box_it(part->boxes());
    for (box_it.mark_cycle_pt(); !box_it.cycled_list(); box_it.forward()) {
      const TBOX &box = it.data()->bounding_box();
      int x = (box.left() + box.right()) / 2;
      ColPartition *col = ColumnContaining(x, y);
      if (col == nullptr) {
        total_width += box.width();
      }
    }
  }
  return total_width;
}
int ColPartitionSet :: UnmatchedWidth ( ColPartitionSet * part_set ) { int total_width = 0 ; ColPartition_IT it ( & part_set -> parts_ ) ; for ( it . mark_cycle_pt ( ) ; ! it . cycled_list ( ) ; it . forward ( ) ) { ColPartition * part = it . data ( ) ; if ( ! BLOBNBOX :: IsTextType ( part -> blob_type ( ) ) ) { continue ; } int y = part -> MidY ( ) ; BLOBNBOX_C_IT box_it ( part -> boxes ( ) ) ; for ( box_it . mark_cycle_pt ( ) ; ! box_it . cycled_list ( ) ; box_it . forward ( ) ) { const TBOX & box = it . data ( ) -> bounding_box ( ) ; int x = ( box . left ( ) + box . right ( ) ) / 2 ; ColPartition * col = ColumnContaining ( x , y ) ; if ( col == nullptr ) { total_width += box . width ( ) ; } } } return total_width ; }
Returns the total width of all blobs in the part_set that do not lie
within an approved column.
Returns the total width of all blobs in the part_set that do not lie within an approved column .
// Non-text partitions are irrelevant to column compatibility. // Assume that the whole blob is outside any column iff its x-middle // is outside.