-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshapeobjects.cpp
More file actions
103 lines (99 loc) · 1.97 KB
/
shapeobjects.cpp
File metadata and controls
103 lines (99 loc) · 1.97 KB
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
100
101
102
103
#include "shapeobjects.h"
// This object is moveable object and you can write in it.
ShapeObjects::ShapeObjects(cv::Point center, int radius,std::string objectType,int blue , int red, int green, std::string text)
{
this->center = center;
this->radius = radius;
this->lock = false;
this->scan = true;
this->objectType = objectType;
this->blue = blue;
this->red = red;
this->green = green;
this->text = text;
}
void ShapeObjects::startStartTime()
{
this->start_time = time(nullptr);
}
time_t ShapeObjects::getStartTime()
{
return this->start_time;
}
void ShapeObjects::startCurrentTime()
{
this->current_time= time(nullptr);
}
time_t ShapeObjects::getCurrentTime()
{
return this->current_time;
}
cv::Point ShapeObjects::getCenter()
{
return this->center;
}
void ShapeObjects::setCenter(cv::Point center)
{
this->center = center;
}
int ShapeObjects::getRadius()
{
return this->radius;
}
void ShapeObjects::setRadius(int radius)
{
this->radius = radius;
}
bool ShapeObjects::getLock()
{
return this->lock;
}
void ShapeObjects::setLock(bool lock)
{
this->lock = lock;
}
bool ShapeObjects::getScan()
{
return this->scan;
}
void ShapeObjects::setScan(bool scan)
{
this->scan = scan;
}
std::string ShapeObjects::getObjectType()
{
return this->objectType;
}
void ShapeObjects::setPastFrame(cv::Point pastFrame)
{
this->pastFrame = pastFrame;
}
int ShapeObjects::getBlue()
{
return this->blue;
}
int ShapeObjects::getRed()
{
return this->red;
}
int ShapeObjects::getGreen()
{
return this->green;
}
std::string ShapeObjects::getText()
{
return this->text;
}
// This method locks or unlocks the shape.
void ShapeObjects::unlockShape(cv::Point updatedFrame)
{
if((abs(this->pastFrame.x-updatedFrame.x)<this->radius || abs(this->pastFrame.y-updatedFrame.y)<this->radius) && getScan())
{
setLock(false);
setScan(!getScan());
}
else if(!getScan())
{
setScan(!getScan());
}
}