-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPointsWidget.h
56 lines (39 loc) · 1.21 KB
/
PointsWidget.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
#ifndef POINTSWIDGET_H
#define POINTSWIDGET_H
#include <QWidget>
#include <QVector>
#include <QPoint>
#include "NearestNeighborsMatcher.h"
class PointsWidget : public QWidget
{
Q_OBJECT
public:
explicit PointsWidget(QWidget* parent = nullptr);
void paintEvent(QPaintEvent* paintEvent);
void mousePressEvent(QMouseEvent* mouseEvent);
void mouseMoveEvent(QMouseEvent* mouseEvent);
void mouseReleaseEvent(QMouseEvent* mouseEvent);
public slots:
void setCurrentCategory(int category);
void setTrainingMode(bool isTraining);
void setNeighborCount(int neighborCount);
void generateDiagram();
void reset();
signals:
private:
void drawGrid(QPainter& painter);
void drawTrainingData(QPainter& painter);
void drawResults(QPainter& painter);
NearestNeighborsMatcher<QPoint> _matcher;
int _internalWidth;
int _internalHeight;
int _currentCategory;
bool _trainingMode;
int _pointRadius;
QPoint _mouseLocation;
QPair<int, QPoint>* _hoveredPoint;
QVector<QPair<int, QPoint>> _points;
QVector<QPair<int, QPoint>> _classifications;
QPixmap _imagePixmap;
};
#endif // POINTSWIDGET_H