Map Matching
Main Page
Related Pages
Classes
Files
File List
File Members
main.cpp
Go to the documentation of this file.
1
#include <QtGui/QApplication>
2
3
#include <limits.h>
4
#include <math.h>
5
#include <stdio.h>
6
#include <vector>
7
8
#include "
myexception.h
"
9
10
#include "
GUI/controller.h
"
11
#include "
solver.h
"
12
13
#include "
MainWindow.h
"
14
15
#include "
grid.h
"
16
#include "
pointGPS.h
"
17
#include "
track.h
"
18
19
using namespace
std
;
30
void
dev_thread
()
31
{
32
QThread* thread =
new
QThread();
33
Solver
* solver =
new
Solver
();
34
solver->
m_trackFilename
=
"../Data/Seattle/useful_all_track.csv"
;
35
solver->
m_gridFilename
=
"../Data/Seattle/useful_all_network.csv"
;
36
//solver->m_trackFilename = "../Data/Seattle/mini_start_track.csv";
37
//solver->m_gridFilename = "../Data/Seattle/mini_start_network.csv";
38
39
//solver->m_trackFilename = "../Data/France/Zones/Trace_Z5_L93.csv";
40
//solver->m_gridFilename = "../Data/France/Zones/Route_Ready_Z5_L93.csv";
41
42
solver->moveToThread(thread);
43
thread->
start
();
44
Controller
* controller =
new
Controller
();
45
//QMetaObject::invokeMethod(solver, "onSignalStart");
46
controller->
addSolver
(solver);
47
controller->
connectSignals
();
48
controller->
m_qProcessViewer
->resize(500, 500);
49
controller->
m_qProcessViewer
->show();
50
}
51
52
void
dev_grid
()
53
{
54
QString gridFile =
"../Data/Unit_tests_data_set/gridTestPointsHaveNoDuplicate.csv"
;
55
Grid
grid;
56
grid.
readFromCSV
(gridFile);
57
grid.
buildMarkovMatrix
();
58
grid.
outputInfos
();
59
}
60
61
void
dev_gridAndTrack
()
62
{
63
// grid.readFromCSV("../Data/Unit_tests_data_set/gridTestPointsHaveNoDuplicate.csv");
64
QString trackFile =
"../Data/Seattle/mini_start_track.csv"
;
65
QString gridFile =
"../Data/Seattle/mini_start_network.csv"
;
66
int
test = 1;
67
switch
(test) {
68
case
1:
69
trackFile =
"../Data/Seattle/useful_all_track.csv"
;
70
gridFile =
"../Data/Seattle/useful_all_network.csv"
;
71
}
72
73
Track
track;
74
Grid
grid;
75
track.
readFromCSV
(trackFile);
76
track.
outputInfos
();
77
78
grid.
setTrackBoundingBox
(track.
m_xMin
, track.
m_xMax
, track.
m_yMin
, track.
m_yMax
);
79
grid.
readFromCSV
(gridFile);
80
grid.
outputInfos
();
81
grid.
buildMarkovMatrix
();
82
//Solver solver();
83
//grid.getRoads(), grid.getPoints(), track.getPointsAsPointer());
84
//solver.initialize();
85
86
std::cout <<
"The end."
<< std::endl;
87
}
88
89
void
dev_file
()
90
{
91
File
f;
92
f.
selectFilesToOpen
(
"shp"
);
93
cout <<
"File name : "
<< f.
fileName
.at(0).toStdString() <<
", file extension : "
<< f.
fileExtension
.at(0).toStdString() << endl;
94
95
cout << f.
shp2csv
(
"Point"
) << endl;
96
cout <<
"File path : "
<< f.
filePath
.at(0).toStdString() <<
"File name : "
<< f.
fileName
.at(0).toStdString() <<
", file extension : "
<< f.
fileExtension
.at(0).toStdString() << endl;
97
}
98
99
/*void dev_img()
100
{
101
vector<vector<double> > poly;
102
103
for (int i = 0; i <= 1000; i += 150) {
104
double x = i + 25;
105
double y = i * 0.75;
106
vector<double> coordinates;
107
coordinates.push_back(x);
108
coordinates.push_back(y);
109
poly.push_back(coordinates);
110
}
111
112
vector<vector<double> > polyRoad;
113
114
vector<double> coordinates;
115
coordinates.push_back(1000.25);
116
coordinates.push_back(3352.28);
117
polyRoad.push_back(coordinates);
118
119
coordinates.clear();
120
121
coordinates.push_back(2000.0);
122
coordinates.push_back(6000.0);
123
polyRoad.push_back(coordinates);
124
125
Map m(1280, 1024);
126
127
m.scaleCalculator(1000.25, 2000.75, 3352.28, 6000.67);
128
129
m.deltaCalculator(1000.25, 3352.28);
130
131
m.makePolyline(poly, "green");
132
133
m.makePolylineFromRoad(polyRoad, "grey");
134
135
vector<vector<double> > point;
136
137
vector<double> pcoordinates;
138
pcoordinates.push_back(1800.0);
139
pcoordinates.push_back(4800.0);
140
point.push_back(pcoordinates);
141
142
m.makePointFromTrack(point, "orange");
143
144
m.landmarkMaker(200);
145
146
QLabel* myLabel = new QLabel();
147
myLabel->setPixmap(QPixmap::fromImage(m.img));
148
149
myLabel->show();
150
151
m.save("/tmp/test.png");
152
153
cout << "width : " << m.width << endl;
154
cout << "height : " << m.height << endl;
155
cout << "Facteur d'échelle : " << m.scale << endl;
156
}*/
157
158
void
dev_ui
()
159
{
160
//Fenetre non enlevable
161
MainWindow
* w =
new
MainWindow
();
162
w->setWindowTitle(
"Map Matching"
);
163
164
w->resize(500, 700);
165
w->show();
166
}
167
168
/****************************************************************************/
169
/*** Pas de code dans le main, seulement l'appel d'une fonction ci-dessus ***/
170
/****************************************************************************/
171
172
int
main
(
int
argc,
char
* argv[])
173
{
174
QApplication app(argc, argv);
175
176
//dev_img();
177
178
dev_thread
();
179
//dev_ui();
180
181
return
app.exec();
182
//return app.closingDown();
183
}
myexception.h
Grid::buildMarkovMatrix
void buildMarkovMatrix()
buildMarkovMatrix
Definition:
grid.cpp:264
Track::m_xMin
double m_xMin
Definition:
track.h:107
File::fileName
QStringList fileName
Definition:
file.h:54
dev_file
void dev_file()
Definition:
main.cpp:89
File
The File class.
Definition:
file.h:13
Controller::m_qProcessViewer
QProcessViewer * m_qProcessViewer
Definition:
controller.h:18
std
STL namespace.
Solver::m_gridFilename
QString m_gridFilename
Definition:
solver.h:54
dev_grid
void dev_grid()
Definition:
main.cpp:52
Track::readFromCSV
void readFromCSV(QString filename)
Reads a csv file and inserts each point in m_points vector.
Definition:
track.cpp:36
File::filePath
QStringList filePath
Definition:
file.h:53
dev_gridAndTrack
void dev_gridAndTrack()
Definition:
main.cpp:61
File::fileExtension
QStringList fileExtension
Definition:
file.h:55
MainWindow.h
Grid::setTrackBoundingBox
void setTrackBoundingBox(double xMin, double xMax, double yMin, double yMax)
Save data about our area of roads.
Definition:
grid.cpp:34
Solver
Definition:
solver.h:16
File::shp2csv
int shp2csv(QString geometryType)
The function to convert WGS84 ShapeFile(s) to Lambert 93 CSV(s)
Definition:
file.cpp:59
Controller
Definition:
controller.h:9
Grid::outputInfos
void outputInfos()
Definition:
grid.cpp:237
Track
The Track class.
Definition:
track.h:26
Solver::start
void start()
Definition:
solver.cpp:9
Track::m_yMin
double m_yMin
Definition:
track.h:109
Track::outputInfos
void outputInfos()
Print some informations to user in console.
Definition:
track.cpp:303
controller.h
solver.h
grid.h
File::selectFilesToOpen
int selectFilesToOpen(QString extensionFilter)
The UI to select the file's path to open.
Definition:
file.cpp:26
Track::m_yMax
double m_yMax
Definition:
track.h:110
Grid
Grid embedded roads. This describes the network.
Definition:
grid.h:36
MainWindow
Definition:
MainWindow.h:20
dev_thread
void dev_thread()
Definition:
main.cpp:30
Solver::m_trackFilename
QString m_trackFilename
Definition:
solver.h:55
pointGPS.h
main
int main(int argc, char *argv[])
Definition:
main.cpp:172
Track::m_xMax
double m_xMax
Definition:
track.h:108
track.h
The class Track.
Grid::readFromCSV
void readFromCSV(QString filename)
Reads a csv file and inserts info into the corresponding attributs.
Definition:
grid.cpp:42
Controller::addSolver
void addSolver(Solver *solver)
Definition:
controller.cpp:11
dev_ui
void dev_ui()
Definition:
main.cpp:158
Controller::connectSignals
void connectSignals()
Definition:
controller.cpp:16
main.cpp
Generated on Sat Dec 3 2016 18:38:42 for Map Matching by
1.8.11