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

Method HandleClick

deps/tesseract/textord/strokewidth.cpp:404–438  ·  view source on GitHub ↗

Handles a click event in a display window. */

Source from the content-addressed store, hash-verified

402
403/** Handles a click event in a display window. */
404void 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

Callers

nothing calls this directly

Calls 11

PrintBoxWidthsFunction · 0.85
StartRadSearchMethod · 0.80
NextRadSearchMethod · 0.80
cblobMethod · 0.80
neighbourMethod · 0.80
NeighbourGapsMethod · 0.80
horz_possibleMethod · 0.80
vert_possibleMethod · 0.80
good_stroke_neighbourMethod · 0.80
bounding_boxMethod · 0.45
containsMethod · 0.45

Tested by

no test coverage detected