-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathkpmodulewidget.cpp
More file actions
executable file
·74 lines (62 loc) · 1.99 KB
/
kpmodulewidget.cpp
File metadata and controls
executable file
·74 lines (62 loc) · 1.99 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
#include "kpmodulewidget.h"
#include "ui_kpmodulewidget.h"
KPModuleWidget::KPModuleWidget(QWidget *parent) : QWidget(parent), ui{new Ui::KPModuleWidget}
{
ui->setupUi(this);
setWindowTitle(tr("Kruskal - Prim Module Widget"));
setFont(QFont("Ubuntu", 11));
algorithm = "None";
//ui->groupBox_2->hide();
//ui->IODataBox->layout()->setSizeConstraint(QLayout::SetMinimumSize);
//layout()->setSizeConstraint(QLayout::SetFixedSize);
}
void KPModuleWidget::setDataStructure()
{
dataStructure = ui->dataTypes->checkedButton()->text();
}
void KPModuleWidget::setGraphType()
{
graphType = ui->graphTypes->checkedButton()->text();
}
bool KPModuleWidget::loadGraphData()
{
static QString preFilePath{};
static QString preStructure{};
static QString preGraphType{};
if (filePath != preFilePath || dataStructure != preStructure || graphType != preGraphType)
{
if (dataStructure == "Ma trận kề") IOModule::readAdjaMatrix(filePath, matrix, totalNumVertices, mode::spanning_tree);
else if (dataStructure == "Danh sách cạnh cung")
{
if (graphType == "Vô hướng") IOModule::readUGEdgeList(filePath, matrix, totalNumVertices, mode::spanning_tree);
else IOModule::readDGEdgeList(filePath, matrix, totalNumVertices, mode::spanning_tree);
}
preFilePath = filePath;
preStructure = dataStructure;
preGraphType = graphType;
}
return true;
}
void KPModuleWidget::getAnalysisAlgorithm() const
{
}
void KPModuleWidget::getAppsAlgorithm() const
{
}
void KPModuleWidget::getInfoAlgorithm() const
{
}
bool KPModuleWidget::checkInputData() const
{
return true;
}
void KPModuleWidget::openFileDialog()
{
QString fileName{};
filePath = QFileDialog::getOpenFileName(this, "Chọn file chứa thông tin về đô thị", QDir::currentPath(), "Text file(*.txt)");
if (!filePath.isEmpty())
{
fileName = filePath;
emit gotFilePath(filePath);
}
}