-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathZmqTrackingAlgorithm.cpp
More file actions
107 lines (76 loc) · 2.81 KB
/
ZmqTrackingAlgorithm.cpp
File metadata and controls
107 lines (76 loc) · 2.81 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
104
105
106
107
#include "../ZmqTrackingAlgorithm.h"
#include "biotracker/zmq/ZmqInfoFile.h"
#include "biotracker/zmq/ZmqHelper.h"
#include "biotracker/zmq/ZmqMessageParser.h"
namespace BioTracker {
namespace Core {
namespace Zmq {
/**
* @brief ZmqTrackingAlgorithm::ZmqTrackingAlgorithm
* @param process
* @param settings
*/
ZmqTrackingAlgorithm::ZmqTrackingAlgorithm(std::shared_ptr<ZmqClientProcess> process, Settings &settings) :
TrackingAlgorithm(settings),
m_isTracking(false),
m_tools(std::make_shared<QFrame>()),
m_process(process),
m_events(this) {
// ATTACH EVENTS
QObject::connect(&m_events, &EventHandler::btnClicked, this, &ZmqTrackingAlgorithm::btnClicked);
QObject::connect(&m_events, &EventHandler::sldValueChanged, this, &ZmqTrackingAlgorithm::sldValueChanged);
QObject::connect(&m_events, &EventHandler::notifyGUI, this, &ZmqTrackingAlgorithm::notifyGUI);
QObject::connect(&m_events, &EventHandler::update, this, &ZmqTrackingAlgorithm::update);
QObject::connect(&m_events, &EventHandler::forceTracking, this, &ZmqTrackingAlgorithm::forceTracking);
QObject::connect(&m_events, &EventHandler::pausePlayback, this, &ZmqTrackingAlgorithm::pausePlayback);
QObject::connect(&m_events, &EventHandler::jumpToFrame, this, &ZmqTrackingAlgorithm::jumpToFrame);
}
ZmqTrackingAlgorithm::~ZmqTrackingAlgorithm() {
shutdown();
}
void ZmqTrackingAlgorithm::track(ulong frameNumber, const cv::Mat &frame) {
SendTrackMessage message(frame, frameNumber);
m_process->send(message, m_events);
}
void ZmqTrackingAlgorithm::paint(ProxyMat &m, const View &v) {
SendPaintMessage message(99, v.name, m.getMat());
m_process->send(message, m_events);
}
void ZmqTrackingAlgorithm::paintOverlay(QPainter *p, const View &v) {
SendPaintOverlayMessage message(v.name, p);
m_process->send(message, m_events);
}
std::shared_ptr<QWidget> ZmqTrackingAlgorithm::getToolsWidget() {
std::shared_ptr<QWidget> tools(new QWidget);
SendRequestWidgetsMessage message(tools);
m_process->send(message, m_events);
return tools;
}
void ZmqTrackingAlgorithm::prepareSave() {
}
void ZmqTrackingAlgorithm::postLoad() {
}
void ZmqTrackingAlgorithm::postConnect() {
}
void ZmqTrackingAlgorithm::mouseMoveEvent(QMouseEvent *) {
}
void ZmqTrackingAlgorithm::mousePressEvent(QMouseEvent *) {
}
void ZmqTrackingAlgorithm::mouseWheelEvent(QWheelEvent *) {
}
void ZmqTrackingAlgorithm::keyPressEvent(QKeyEvent *) {
}
void ZmqTrackingAlgorithm::shutdown() {
}
// == EVENTS ==
void ZmqTrackingAlgorithm::btnClicked(const QString widgetId) {
SendButtonClickMessage message(widgetId);
m_process->send(message, m_events);
}
void ZmqTrackingAlgorithm::sldValueChanged(const QString widgetId, int value) {
SendValueChangedMessage message(widgetId, value);
m_process->send(message, m_events);
}
}
}
}