Eat the other TabVector into this and delete it.
| 456 | |
| 457 | // Eat the other TabVector into this and delete it. |
| 458 | void 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 |
no test coverage detected