-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathtagpainter.h
67 lines (48 loc) · 1.37 KB
/
tagpainter.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#ifndef TAGPAINTER_H
#define TAGPAINTER_H
#include <QPainter>
enum TagFamilyName {
TAG36H11 = 0,
TAG36H9 = 1,
TAG25H9 = 2,
TAG25H7 = 3,
TAG16H5 = 4,
};
class TagPainter
{
public:
TagPainter(TagFamilyName tag_family, unsigned long start_id, int border,
int corner_box, int padding, int cols, int rows, int unit_pixels);
void PaintTagAt(QPainter &painter, unsigned long id, int x, int y);
void PaintTagGrid(QPainter &painter);
void PaintCornerGrid(QPainter &painter);
void PaintTagBoard(QPainter& painter);
void PaintDrillHoles(QPainter& painter);
void PaintLabel(QPainter& painter);
void PaintCorrdinate(QPainter& painter);
int total_width() { return total_width_; }
int total_height() { return total_height_; }
int pixel_count_width() {
return total_width_ * unit_pixels_ + 2 * padding_pixels_;
}
int pixel_count_height() {
return total_height_ * unit_pixels_ + 2 * padding_pixels_;
}
int pixel_count_tag_size() { return tag_size_ * unit_pixels_; }
int pixel_count_corner_box_size() { return corner_box_ * unit_pixels_; }
private:
// input parameters
unsigned long start_id_;
int border_;
int corner_box_;
int padding_pixels_;
int cols_;
int rows_;
int unit_pixels_;
// calculated parameters
int total_width_;
int total_height_;
int codes_size_;
int tag_size_;
};
#endif // TAGPAINTER_H