page block
More...
#include <pdblock.h>
page block
Definition at line 33 of file pdblock.h.
◆ PDBLK() [1/2]
tesseract::PDBLK::PDBLK |
( |
| ) |
|
|
inline |
empty constructor
Definition at line 39 of file pdblock.h.
int index_
Serial number of this block.
POLY_BLOCK * hand_poly
weird as well
◆ PDBLK() [2/2]
simple constructor
- Parameters
-
xmin | bottom left |
xmax | top right |
Definition at line 44 of file pdblock.cpp.
49 :
box(ICOORD(xmin, ymin), ICOORD(xmax, ymax)) {
58 left_it.add_to_end(
new ICOORDELT(xmin, ymin));
59 left_it.add_to_end(
new ICOORDELT(xmin, ymax));
60 right_it.add_to_end(
new ICOORDELT(xmax, ymin));
61 right_it.add_to_end(
new ICOORDELT(xmax, ymax));
ICOORDELT_LIST rightside
right side vertices
ICOORDELT_LIST leftside
left side vertices
◆ ~PDBLK()
tesseract::PDBLK::~PDBLK |
( |
| ) |
|
|
inline |
◆ bounding_box() [1/2]
const TBOX& tesseract::PDBLK::bounding_box |
( |
| ) |
const |
|
inline |
◆ bounding_box() [2/2]
void tesseract::PDBLK::bounding_box |
( |
ICOORD & |
bottom_left, |
|
|
ICOORD & |
top_right |
|
) |
| const |
|
inline |
get box
Definition at line 67 of file pdblock.h.
const ICOORD & botleft() const
const ICOORD & topright() const
◆ contains()
bool tesseract::PDBLK::contains |
( |
ICOORD |
pt | ) |
|
is pt inside block
Definition at line 93 of file pdblock.cpp.
99 for (it.start_block(); !it.cycled_rects(); it.forward()) {
101 it.bounding_box(bleft, tright);
103 if (pt.x() >= bleft.x() && pt.x() <= tright.x() && pt.y() >= bleft.y() &&
104 pt.y() <= tright.y()) {
friend class BLOCK_RECT_IT
block iterator
◆ index()
int tesseract::PDBLK::index |
( |
| ) |
const |
|
inline |
◆ move()
void tesseract::PDBLK::move |
( |
const ICOORD |
vec | ) |
|
reposition block
Definition at line 117 of file pdblock.cpp.
122 for (it.mark_cycle_pt(); !it.cycled_list(); it.forward()) {
128 for (it.mark_cycle_pt(); !it.cycled_list(); it.forward()) {
void move(const ICOORD vec)
◆ operator=()
PDBLK & tesseract::PDBLK::operator= |
( |
const PDBLK & |
source | ) |
|
assignment
- Parameters
-
Definition at line 245 of file pdblock.cpp.
static ICOORDELT * deep_copy(const ICOORDELT *src)
◆ plot()
draw histogram
- Parameters
-
window | window to draw in |
serial | serial number |
colour | colour to draw in |
Definition at line 185 of file pdblock.cpp.
202 startpt = *(it.data());
206 # if !defined(_WIN32) || defined(__MINGW32__)
207 snprintf(temp_buff,
sizeof(temp_buff),
"%" PRId32, serial);
209 _ultoa(serial, temp_buff, 10);
211 window->Text(startpt.x(), startpt.y(), temp_buff);
213 window->SetCursor(startpt.x(), startpt.y());
215 prevpt = *(it.data());
218 window->DrawTo(prevpt.x(), it.data()->y());
219 window->DrawTo(it.data()->x(), it.data()->y());
220 }
while (!it.at_last());
221 endpt = *(it.data());
224 window->SetCursor(startpt.x(), startpt.y());
227 for (it.mark_cycle_pt(); !it.cycled_list(); it.forward()) {
229 window->DrawTo(prevpt.x(), it.data()->y());
230 window->DrawTo(it.data()->x(), it.data()->y());
231 prevpt = *(it.data());
234 window->DrawTo(endpt.x(), endpt.y());
#define BLOCK_LABEL_HEIGHT
void plot(ScrollView *window, int32_t num)
◆ poly_block()
POLY_BLOCK* tesseract::PDBLK::poly_block |
( |
| ) |
const |
|
inline |
◆ render_mask()
Image tesseract::PDBLK::render_mask |
( |
const FCOORD & |
rerotation, |
|
|
TBOX * |
mask_box |
|
) |
| |
Definition at line 137 of file pdblock.cpp.
139 rotated_box.rotate(rerotation);
140 Image pix = pixCreate(rotated_box.width(), rotated_box.height(), 1);
144 ICOORDELT_LIST polygon;
147 image_block.rotate(rerotation);
150 auto *lines =
new PB_LINE_IT(&image_block);
152 const std::unique_ptr< ICOORDELT_LIST> segments(lines->get_line(y));
153 if (!segments->empty()) {
154 ICOORDELT_IT s_it(segments.get());
157 for (s_it.mark_cycle_pt(); !s_it.cycled_list(); s_it.forward()) {
158 int start = s_it.data()->x();
159 int xext = s_it.data()->y();
161 pixRasterop(pix, start - rotated_box.left(),
162 rotated_box.height() - 1 - (y - rotated_box.bottom()), xext, 1, PIX_SET,
170 pixRasterop(pix, 0, 0, rotated_box.width(), rotated_box.height(), PIX_SET,
nullptr, 0, 0);
172 if (mask_box !=
nullptr) {
173 *mask_box = rotated_box;
PolyBlockType isA() const
ICOORDELT_LIST * points()
TDimension bottom() const
◆ set_index()
void tesseract::PDBLK::set_index |
( |
int |
value | ) |
|
|
inline |
◆ set_poly_block()
void tesseract::PDBLK::set_poly_block |
( |
POLY_BLOCK * |
blk | ) |
|
|
inline |
set the poly block
Definition at line 63 of file pdblock.h.
◆ set_sides()
void tesseract::PDBLK::set_sides |
( |
ICOORDELT_LIST * |
left, |
|
|
ICOORDELT_LIST * |
right |
|
) |
| |
set vertex lists
- Parameters
-
left | list of left vertices |
right | list of right vertices |
Definition at line 71 of file pdblock.cpp.
80 left_it.move_to_first();
81 left_it.add_list_before(left);
83 right_it.move_to_first();
84 right_it.add_list_before(right);
◆ BLOCK
◆ BLOCK_RECT_IT
block iterator
Definition at line 34 of file pdblock.h.
◆ box
TBOX tesseract::PDBLK::box |
|
protected |
◆ hand_poly
◆ index_
int tesseract::PDBLK::index_ |
|
protected |
Serial number of this block.
Definition at line 113 of file pdblock.h.
◆ leftside
ICOORDELT_LIST tesseract::PDBLK::leftside |
|
protected |
left side vertices
Definition at line 110 of file pdblock.h.
◆ rightside
ICOORDELT_LIST tesseract::PDBLK::rightside |
|
protected |
right side vertices
Definition at line 111 of file pdblock.h.
The documentation for this class was generated from the following files: