Merge close tab vectors of the same side that overlap.
| 359 | |
| 360 | // Merge close tab vectors of the same side that overlap. |
| 361 | void TabVector::MergeSimilarTabVectors(const ICOORD& vertical, |
| 362 | TabVector_LIST* vectors, |
| 363 | BlobGrid* grid) { |
| 364 | TabVector_IT it1(vectors); |
| 365 | for (it1.mark_cycle_pt(); !it1.cycled_list(); it1.forward()) { |
| 366 | TabVector* v1 = it1.data(); |
| 367 | TabVector_IT it2(it1); |
| 368 | for (it2.forward(); !it2.at_first(); it2.forward()) { |
| 369 | TabVector* v2 = it2.data(); |
| 370 | if (v2->SimilarTo(vertical, *v1, grid)) { |
| 371 | // Merge into the forward one, in case the combined vector now |
| 372 | // overlaps one in between. |
| 373 | if (textord_debug_tabfind) { |
| 374 | v2->Print("Merging"); |
| 375 | v1->Print("by deleting"); |
| 376 | } |
| 377 | v2->MergeWith(vertical, it1.extract()); |
| 378 | if (textord_debug_tabfind) { |
| 379 | v2->Print("Producing"); |
| 380 | } |
| 381 | ICOORD merged_vector = v2->endpt(); |
| 382 | merged_vector -= v2->startpt(); |
| 383 | if (textord_debug_tabfind && abs(merged_vector.x()) > 100) { |
| 384 | v2->Print("Garbage result of merge?"); |
| 385 | } |
| 386 | break; |
| 387 | } |
| 388 | } |
| 389 | } |
| 390 | } |
| 391 | |
| 392 | // Return true if this vector is the same side, overlaps, and close |
| 393 | // enough to the other to be merged. |
nothing calls this directly
no test coverage detected