-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgraphglwidget.h
76 lines (62 loc) · 1.91 KB
/
graphglwidget.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#ifndef GRAPHGLWIDGET_H
#define GRAPHGLWIDGET_H
#include <QGLWidget>
#include "Hypergraph.h"
#include "GraphWidgetCtrl.h"
#include <vector>
using namespace std;
class GraphGLWidget : public QGLWidget
{
Q_OBJECT
public:
GraphGLWidget(QWidget *parent);
~GraphGLWidget();
enum MouseMove {MOUSE_CLICK, MOUSE_DRAG};
private:
int _widgetWidth;
int _widgetHeight;
Hypergraph * _graph;
int _pressX, _pressY;
int _moveX, _moveY;
MouseMove _mouseMove;
bool _bPicking;
Gesture _gesture;
SelectionMode _selMode;
GraphWidgetCtrl*_ctrlWidget;
vector<int> _selectedIdx;
GraphDispMode _dispMode;
protected:
void initializeGL();
void resizeGL(int width, int height);
void paintGL ();
void mousePressEvent(QMouseEvent *e);
void mouseMoveEvent(QMouseEvent *e);
void mouseReleaseEvent(QMouseEvent *e);
private:
void connectCtrlWidget ();
void drawSelectionArea ();
public:
void setGraph (Hypergraph *graph) {_graph = graph;}
vector<int> pick (int x, int y);
vector<int> pick (int pressX, int pressY, int moveX, int moveY);
vector<int> pick (const vector<int> &clickBuf);
void startPicking (const int bufSize, GLuint selectBuf[], GLdouble pickArea [4]);
void startPicking (const int bufSize, GLuint selectBuf[]);
int stopPicking();
void setProjMatrix ();
vector<int> processHits(int hits, GLuint selectBuf[]);
signals:
void selectionChanged (const vector<bool> &selectionBuf);
void clustersChanged (const vector<int> &clusters);
void clustersAssigned (int clusterIdx);
public slots:
void handleSelectionChanged (const vector<bool> &selectionBuf);
void handleSetGesture (int g);
void handleInSelectLinkage (bool f);
void handleSetSelMode (int m);
void handleAssignCluster (bool f);
void handleGraphUpdated (Hypergraph *g);
void handleSetDispMode (int d);
void handleClustersChanged (const vector<int> &clusters);
};
#endif // GRAPHGLWIDGET_H