MCPcopy Create free account
hub / github.com/creatale/node-dv / SetPartitionType

Method SetPartitionType

deps/tesseract/textord/colpartition.cpp:981–1008  ·  view source on GitHub ↗

Computes and sets the type_ and first_column_, last_column_ and column_set_. resolution refers to the ppi resolution of the image.

Source from the content-addressed store, hash-verified

979// Computes and sets the type_ and first_column_, last_column_ and column_set_.
980// resolution refers to the ppi resolution of the image.
981void ColPartition::SetPartitionType(int resolution, ColPartitionSet* columns) {
982 int first_spanned_col = -1;
983 ColumnSpanningType span_type =
984 columns->SpanningType(resolution,
985 bounding_box_.left(), bounding_box_.right(),
986 MIN(bounding_box_.height(), bounding_box_.width()),
987 MidY(), left_margin_, right_margin_,
988 &first_column_, &last_column_,
989 &first_spanned_col);
990 column_set_ = columns;
991 if (first_column_ < last_column_ && span_type == CST_PULLOUT &&
992 !IsLineType()) {
993 // Unequal columns may indicate that the pullout spans one of the columns
994 // it lies in, so force it to be allocated to just that column.
995 if (first_spanned_col >= 0) {
996 first_column_ = first_spanned_col;
997 last_column_ = first_spanned_col;
998 } else {
999 if ((first_column_ & 1) == 0)
1000 last_column_ = first_column_;
1001 else if ((last_column_ & 1) == 0)
1002 first_column_ = last_column_;
1003 else
1004 first_column_ = last_column_ = (first_column_ + last_column_) / 2;
1005 }
1006 }
1007 type_ = PartitionType(span_type);
1008}
1009
1010// Returns the PartitionType from the current BlobRegionType and a column
1011// flow spanning type ColumnSpanningType, generated by

Callers 3

InsertPartAfterAbsorbMethod · 0.80
SetPartitionTypesMethod · 0.80
MakeTableBlocksMethod · 0.80

Calls 2

SpanningTypeMethod · 0.80
heightMethod · 0.80

Tested by

no test coverage detected