|
18 | 18 | #ifndef CIRCLEOUTLINE_H |
19 | 19 | #define CIRCLEOUTLINE_H |
20 | 20 |
|
21 | | - |
22 | | -#include "boundary.h" |
23 | | -#include "gplus.h" |
24 | | -#include <QVector> |
| 21 | +#include <QJsonObject> |
| 22 | +#include <QPainter> |
25 | 23 | #include <QPointF> |
| 24 | +#include <QVector> |
26 | 25 | #include <opencv2/opencv.hpp> |
27 | | -#include <QJsonObject> |
28 | | -void fillCircle(cv::Mat &m, double cx, double cy, double rad, void *color); |
29 | | -class CircleOutline: public boundary |
30 | | -{ |
31 | | - public: |
32 | | - CircleOutline(); |
33 | | - CircleOutline(QPointF center, double rad); |
34 | | - CircleOutline(QPointF p1, QPointF p2); |
35 | | - CircleOutline(const QJsonObject &obj); |
36 | | - void toJson(QJsonObject &obj); |
37 | 26 |
|
38 | | - virtual ~CircleOutline(); |
39 | | - void draw(QPainter& painter, double scale, double scale2 = -1.); |
40 | | - bool isInside(QPointF& p , int offset = 0); |
41 | | - bool isInside(double x, double y, int offset=0); |
42 | | - void enlarge(int del); |
43 | | - void translate(QPointF del); |
44 | | - void scale(double factor); |
45 | | - QVector<QPointF> makeCircleofPoints(int cnt); |
46 | | - bool isValid(); |
47 | | - QPointF m_center; |
48 | | - double m_radius; |
49 | | - gPlus m_p1; |
50 | | - gPlus m_p2; |
51 | | - protected: |
| 27 | +void fillCircle(cv::Mat &m, double cx, double cy, double rad, void *color); |
52 | 28 |
|
53 | | - private: |
54 | | -}; |
| 29 | +class CircleOutline { |
| 30 | + public: |
| 31 | + CircleOutline(); |
| 32 | + CircleOutline(QPointF center, double rad); |
| 33 | + CircleOutline(QPointF p1, QPointF p2); |
| 34 | + CircleOutline(const QJsonObject &obj); |
| 35 | + ~CircleOutline() = default; |
55 | 36 |
|
56 | | -class ellipseOutline: public boundary |
57 | | -{ |
58 | | -public: |
59 | | - ellipseOutline(); |
60 | | - ellipseOutline(QPointF center, double minorAxis, double majorAxis); |
61 | | - ellipseOutline(QPointF left, QPointF right, double ecc); |
62 | | - bool isInside(QPointF& p , int offset = 0); |
63 | | - void enlarge(int del); |
64 | 37 | void translate(QPointF del); |
65 | 38 | void scale(double factor); |
66 | | - |
67 | | - |
68 | 39 | bool isValid(); |
69 | | - QPointF m_center; |
70 | | - double m_minor; |
71 | | - double m_major; |
72 | | - double m_left; |
73 | | - double m_right; |
74 | | - double e; |
75 | | - gPlus m_p1; |
76 | | - gPlus m_p2; |
77 | | -}; |
78 | | - |
79 | | -class rectangleOutline: public boundary |
80 | | -{ |
81 | | -public: |
82 | | - rectangleOutline(); |
83 | | - rectangleOutline(QPointF upperLeft, QPointF lowerRight); |
84 | | - bool isInside(QPointF& p , int offset = 0); |
| 40 | + void draw(QPainter &painter, double scale, double scale2 = -1.); |
| 41 | + QVector<QPointF> makeCircleofPoints(int cnt); |
85 | 42 | void enlarge(int del); |
86 | | - void translate(QPointF del); |
87 | | - void scale(double factor); |
88 | | - bool isValid(); |
89 | | - QPointF m_upperLeft; |
90 | | - QPointF m_lowerRight; |
91 | | - gPlus m_p1; |
92 | | - gPlus m_p2; |
93 | | -}; |
94 | | -QDataStream & operator<<(QDataStream & stream, const ellipseOutline &outline); |
95 | | -QDataStream & operator<<(QDataStream & stream, const CircleOutline &outline); |
96 | | -QDataStream & operator<<(QDataStream & stream, const rectangleOutline &outline); |
| 43 | + void toJson(QJsonObject &obj); |
97 | 44 |
|
| 45 | + QPointF m_center; |
| 46 | + double m_radius; |
| 47 | + QPointF m_p1; |
| 48 | + QPointF m_p2; |
| 49 | +}; |
98 | 50 |
|
99 | 51 | #endif // CIRCLEOUTLINE_H |
0 commit comments