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

Method MergeWith

deps/tesseract/textord/tabvector.cpp:458–486  ·  view source on GitHub ↗

Eat the other TabVector into this and delete it.

Source from the content-addressed store, hash-verified

456
457// Eat the other TabVector into this and delete it.
458void TabVector::MergeWith(const ICOORD& vertical, TabVector* other) {
459 extended_ymin_ = MIN(extended_ymin_, other->extended_ymin_);
460 extended_ymax_ = MAX(extended_ymax_, other->extended_ymax_);
461 if (other->IsRagged()) {
462 alignment_ = other->alignment_;
463 }
464 // Merge sort the two lists of boxes.
465 BLOBNBOX_C_IT it1(&boxes_);
466 BLOBNBOX_C_IT it2(&other->boxes_);
467 while (!it2.empty()) {
468 BLOBNBOX* bbox2 = it2.extract();
469 it2.forward();
470 TBOX box2 = bbox2->bounding_box();
471 BLOBNBOX* bbox1 = it1.data();
472 TBOX box1 = bbox1->bounding_box();
473 while (box1.bottom() < box2.bottom() && !it1.at_last()) {
474 it1.forward();
475 bbox1 = it1.data();
476 box1 = bbox1->bounding_box();
477 }
478 if (box1.bottom() < box2.bottom()) {
479 it1.add_to_end(bbox2);
480 } else if (bbox1 != bbox2) {
481 it1.add_before_stay_put(bbox2);
482 }
483 }
484 Fit(vertical, true);
485 other->Delete(this);
486}
487
488// Add a new element to the list of partner TabVectors.
489// Partners must be added in order of increasing y coordinate of the text line

Callers 1

Calls 10

IsRaggedMethod · 0.80
dataMethod · 0.80
emptyMethod · 0.45
extractMethod · 0.45
forwardMethod · 0.45
bounding_boxMethod · 0.45
at_lastMethod · 0.45
add_to_endMethod · 0.45
add_before_stay_putMethod · 0.45
DeleteMethod · 0.45

Tested by

no test coverage detected