-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathBioTrackerPlugin.cpp
More file actions
73 lines (50 loc) · 2.55 KB
/
BioTrackerPlugin.cpp
File metadata and controls
73 lines (50 loc) · 2.55 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
#include "BioTrackerPlugin.h"
#include "PluginContext.h"
#include "Controller/ControllerTrackingAlgorithm.h"
#include "Controller/ControllerTrackedComponent.h"
#include "Controller/ControllerAreaDescriptor.h"
#include "View/TrackedElementView.h"
BioTrackerPlugin::BioTrackerPlugin() {
}
IView* BioTrackerPlugin::getTrackerParameterWidget() {
return qobject_cast<ControllerTrackingAlgorithm*> (m_TrackerController)->getTrackingParameterWidget();
}
IView *BioTrackerPlugin::getTrackerElementsWidget()
{
return qobject_cast<ControllerTrackedComponent *> (m_ComponentController)->getTrackingElementsWidget();
}
void BioTrackerPlugin::setDataExporter(IModelDataExporter *exporter) {
qobject_cast<ControllerTrackingAlgorithm*> (m_TrackerController)->setDataExporter(exporter);
}
#if QT_VERSION < 0x050000
Q_EXPORT_PLUGIN2(BioTrackerPlugin, BioTrackerPlugin)
#endif // QT_VERSION < 0x050000
void BioTrackerPlugin::createPlugin() {
m_PluginContext = new PluginContext();
m_PluginContext->createApplication();
IController * ctr = m_PluginContext->requestController(ENUMS::CONTROLLERTYPE::COMPONENT);
m_ComponentController = qobject_cast<ControllerTrackedComponent *>(ctr);
IController * ctr2 = m_PluginContext->requestController(ENUMS::CONTROLLERTYPE::TRACKING);
m_TrackerController = qobject_cast<ControllerTrackingAlgorithm *>(ctr2);
IController * ctr3 = m_PluginContext->requestController(ENUMS::CONTROLLERTYPE::AREADESCRIPTOR);
m_AreaDescrController = qobject_cast<ControllerAreaDescriptor *>(ctr3);
connectInterfaces();
}
void BioTrackerPlugin::connectInterfaces() {
ControllerTrackingAlgorithm* ctrAlg = qobject_cast<ControllerTrackingAlgorithm*> (m_TrackerController);
QObject::connect(ctrAlg, &ControllerTrackingAlgorithm::emitCvMat, this, &BioTrackerPlugin::receiveCvMatFromController);
QObject::connect(ctrAlg, &ControllerTrackingAlgorithm::emitTrackingDone, this, &BioTrackerPlugin::receiveTrackingDone);
QObject::connect(ctrAlg, &ControllerTrackingAlgorithm::emitChangeDisplayImage, this, &BioTrackerPlugin::receiveChangeDisplayImage);
}
void BioTrackerPlugin::receiveCurrentFrameFromMainApp(std::shared_ptr<cv::Mat> mat, uint frameNumber) {
qobject_cast<ControllerTrackingAlgorithm*> (m_TrackerController)->doTracking(mat, frameNumber);
}
void BioTrackerPlugin::receiveCvMatFromController(std::shared_ptr<cv::Mat> mat, QString name) {
Q_EMIT emitCvMat(mat, name);
}
void BioTrackerPlugin::receiveTrackingDone() {
Q_EMIT emitTrackingDone();
}
void BioTrackerPlugin::receiveChangeDisplayImage(QString str) {
Q_EMIT emitChangeDisplayImage(str);
}