-
Notifications
You must be signed in to change notification settings - Fork 0
/
feature.cpp
80 lines (66 loc) · 1.51 KB
/
feature.cpp
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
#include "feature.h"
Feature::Feature(QObject *parent) :
QObject(parent)
{
m_tilted = 0;
m_rectanglesList.clear();
m_rectangleFactorsList.clear();
}
Feature::Feature(const Feature &other)
{
m_tilted = other.tilted();
for (int i = 0; i < other.rectangleCount(); i++)
{
m_rectanglesList.append(other.getRectangle(i));
m_rectangleFactorsList.append(other.getRectangleFactor(i));
}
}
Feature& Feature::operator =(const Feature &other)
{
if(this == &other)
return *this;
m_tilted = other.tilted();
for (int i = 0; i < other.rectangleCount(); i++)
{
m_rectanglesList.append(other.getRectangle(i));
m_rectangleFactorsList.append(other.getRectangleFactor(i));
}
return *this;
}
int Feature::tilted() const
{
return m_tilted;
}
void Feature::setTilted(const int tilted)
{
if (m_tilted != tilted)
{
m_tilted = tilted;
}
}
QRect Feature::getRectangle(int index) const
{
if (index < m_rectanglesList.size())
return m_rectanglesList.at(index);
else
return QRect();
}
void Feature::appendRectangle(const QRect &rect)
{
m_rectanglesList.append(rect);
}
int Feature::rectangleCount() const
{
return m_rectanglesList.size();
}
void Feature::appendRectangleFactor(int factor)
{
m_rectangleFactorsList.append(factor);
}
int Feature::getRectangleFactor(int index) const
{
if (index < m_rectangleFactorsList.size())
return m_rectangleFactorsList.at(index);
else
return 0;
}