GraphItem.h
1.06 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
#ifndef GRAPHITEM_H
#define GRAPHITEM_H
#include "stdafx.h"
#include "NodeItem.h"
#include "EdgeItem.h"
using namespace std;
using namespace boost;
class GraphItem
: public QGraphicsItem
{
public:
//GraphItem(ifstream* pFin);
GraphItem(const char* filename);
virtual ~GraphItem();
//io
void read_more();
//overrides
QRectF boundingRect() const override;
QPainterPath shape() const override;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
//methods
void might_know();
void reset_color();
void topK_highlight();
protected:
void mousePressEvent(QGraphicsSceneMouseEvent *event) override;
void mouseMoveEvent(QGraphicsSceneMouseEvent *event) override;
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override;
private:
ifstream fin;
bm_type node_ids;
//vector<pair<string, string>> edges;
//vector<pair<int, int>> edges_indexes;
vector<vertex_descriptor> vdes;
int whole_node_cnt = 0;
Graph *graph = nullptr;
QList<NodeItem *> nodeList;
QList<EdgeItem *> edgeList;
};
#endif // GRAPHITEM_H