PaperGraphWidget.cpp
2.38 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
108
109
110
111
112
113
#include "stdafx.h"
#include "PaperGraphWidget.h"
#include "NodeItem.h"
#include "GraphicsView.h"
PaperGraphWidget::PaperGraphWidget(QWidget *parent)
: QWidget(parent)
{
initscene();
View *view = new View("temp view");
view->view()->setScene(scene);
//QVBoxLayout *layout = new QVBoxLayout;
//QComboBox *combo = new QComboBox;
//combo->addItem("conf/iastedCSN/KeimS06");
//combo->addItem("conf/iastedCSN/Mojumdar06");
//combo->addItem("conf/iastedCSN/PourKKI06");
//connect(combo, SIGNAL(currentIndexChanged(int)),
// this, SLOT(handleSelectionChanged(int)));
//layout->addWidget(combo);
QGridLayout *layout = new QGridLayout;
//test
QLabel *testLabel = new QLabel(tr("&Test label"));
testCombo = new QComboBox;
testLabel->setBuddy(testCombo);
layout->addWidget(testLabel, 0, 0);
layout->addWidget(testCombo, 0, 1);
layout->addWidget(view, 1, 0, 1, 2);
setLayout(layout);
setWindowTitle(tr("dblp paper graph visualization"));
}
void PaperGraphWidget::make_graph(const char* filename)
{
if (graphItem)
throw std::exception("graph is already exist");
graphItem = new GraphItem(filename);
graphItem->setPos(0, 0);
scene->addItem(graphItem);
}
void PaperGraphWidget::read_more()
{
qDebug("* PaperGraphWidget::read_more");
graphItem->read_more();
scene->update();
}
void PaperGraphWidget::might_know()
{
graphItem->might_know();
scene->update();
}
void PaperGraphWidget::topk_with_total()
{
//ü TopK highlight
graphItem->topK_highlight_with_total();
scene->update();
}
void PaperGraphWidget::topk_with_target()
{
graphItem->topK_highlight_with_target();
scene->update();
}
void PaperGraphWidget::find_shortest_path()
{
graphItem->find_shortest_path();
scene->update();
}
void PaperGraphWidget::topk_with_pagerank() {
graphItem->topk_with_pagerank();
scene->update();
}
void PaperGraphWidget::reset_color()
{
graphItem->reset_color();
scene->update();
}
void PaperGraphWidget::test()
{
//test
//testCombo->addItem(to_string(rand() % 300).c_str());
//testCombo->addItem(to_string(rand() % 300).c_str());
//testCombo->addItem(to_string(rand() % 300).c_str());
graphItem->test();
scene->update();
}
void PaperGraphWidget::handleSelectionChanged(int idx)
{
QMessageBox::information(this, "QCombobox",
"idx: "+QString::number(idx));
/*if (idx==0) {
} else if (idx==1) {
} else {
}*/
}
void PaperGraphWidget::initscene()
{
scene = new QGraphicsScene(this);
}