Handles a click event in a display window. */
| 402 | |
| 403 | /** Handles a click event in a display window. */ |
| 404 | void StrokeWidth::HandleClick(int x, int y) { |
| 405 | BBGrid<BLOBNBOX, BLOBNBOX_CLIST, BLOBNBOX_C_IT>::HandleClick(x, y); |
| 406 | // Run a radial search for blobs that overlap. |
| 407 | BlobGridSearch radsearch(this); |
| 408 | radsearch.StartRadSearch(x, y, 1); |
| 409 | BLOBNBOX* neighbour; |
| 410 | FCOORD click(static_cast<float>(x), static_cast<float>(y)); |
| 411 | while ((neighbour = radsearch.NextRadSearch()) != NULL) { |
| 412 | TBOX nbox = neighbour->bounding_box(); |
| 413 | if (nbox.contains(click) && neighbour->cblob() != NULL) { |
| 414 | PrintBoxWidths(neighbour); |
| 415 | if (neighbour->neighbour(BND_LEFT) != NULL) |
| 416 | PrintBoxWidths(neighbour->neighbour(BND_LEFT)); |
| 417 | if (neighbour->neighbour(BND_RIGHT) != NULL) |
| 418 | PrintBoxWidths(neighbour->neighbour(BND_RIGHT)); |
| 419 | if (neighbour->neighbour(BND_ABOVE) != NULL) |
| 420 | PrintBoxWidths(neighbour->neighbour(BND_ABOVE)); |
| 421 | if (neighbour->neighbour(BND_BELOW) != NULL) |
| 422 | PrintBoxWidths(neighbour->neighbour(BND_BELOW)); |
| 423 | int gaps[BND_COUNT]; |
| 424 | neighbour->NeighbourGaps(gaps); |
| 425 | tprintf("Left gap=%d, right=%d, above=%d, below=%d, horz=%d, vert=%d\n" |
| 426 | "Good= %d %d %d %d\n", |
| 427 | gaps[BND_LEFT], gaps[BND_RIGHT], |
| 428 | gaps[BND_ABOVE], gaps[BND_BELOW], |
| 429 | neighbour->horz_possible(), |
| 430 | neighbour->vert_possible(), |
| 431 | neighbour->good_stroke_neighbour(BND_LEFT), |
| 432 | neighbour->good_stroke_neighbour(BND_RIGHT), |
| 433 | neighbour->good_stroke_neighbour(BND_ABOVE), |
| 434 | neighbour->good_stroke_neighbour(BND_BELOW)); |
| 435 | break; |
| 436 | } |
| 437 | } |
| 438 | } |
| 439 | |
| 440 | // Detects and marks leader dots/dashes. |
| 441 | // Leaders are horizontal chains of small or noise blobs that look |
nothing calls this directly
no test coverage detected