-
Notifications
You must be signed in to change notification settings - Fork 59
/
Circleoutline.h
99 lines (87 loc) · 2.93 KB
/
Circleoutline.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
/******************************************************************************
**
** Copyright 2016 Dale Eason
** This file is part of DFTFringe
** is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation version 3 of the License
** DFTFringe is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with DFTFringe. If not, see <http://www.gnu.org/licenses/>.
****************************************************************************/
#ifndef CIRCLEOUTLINE_H
#define CIRCLEOUTLINE_H
#include "boundary.h"
#include "gplus.h"
#include <QVector>
#include <QPointF>
#include <opencv2/opencv.hpp>
#include <QJsonObject>
void fillCircle(cv::Mat &m, double cx, double cy, double rad, void *color);
class CircleOutline: public boundary
{
public:
CircleOutline();
CircleOutline(QPointF center, double rad);
CircleOutline(QPointF p1, QPointF p2);
CircleOutline(const QJsonObject &obj);
void toJson(QJsonObject &obj);
virtual ~CircleOutline();
void draw(QPainter& painter, double scale, double scale2 = -1.);
bool isInside(QPointF& p , int offset = 0);
bool isInside(double x, double y, int offset=0);
void enlarge(int del);
void translate(QPointF del);
void scale(double factor);
QVector<QPointF> makeCircleofPoints(int cnt);
bool isValid();
QPointF m_center;
double m_radius;
gPlus m_p1;
gPlus m_p2;
protected:
private:
};
class ellipseOutline: public boundary
{
public:
ellipseOutline();
ellipseOutline(QPointF center, double minorAxis, double majorAxis);
ellipseOutline(QPointF left, QPointF right, double ecc);
bool isInside(QPointF& p , int offset = 0);
void enlarge(int del);
void translate(QPointF del);
void scale(double factor);
bool isValid();
QPointF m_center;
double m_minor;
double m_major;
double m_left;
double m_right;
double e;
gPlus m_p1;
gPlus m_p2;
};
class rectangleOutline: public boundary
{
public:
rectangleOutline();
rectangleOutline(QPointF upperLeft, QPointF lowerRight);
bool isInside(QPointF& p , int offset = 0);
void enlarge(int del);
void translate(QPointF del);
void scale(double factor);
bool isValid();
QPointF m_upperLeft;
QPointF m_lowerRight;
gPlus m_p1;
gPlus m_p2;
};
QDataStream & operator<<(QDataStream & stream, const ellipseOutline &outline);
QDataStream & operator<<(QDataStream & stream, const CircleOutline &outline);
QDataStream & operator<<(QDataStream & stream, const rectangleOutline &outline);
#endif // CIRCLEOUTLINE_H