-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
50 lines (33 loc) · 1.2 KB
/
main.cpp
File metadata and controls
50 lines (33 loc) · 1.2 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
#include <iostream>
#include <string>
#include <queue>
#include "NavigationInterface.h"
#include "Navigation.h"
using namespace std;
extern void writeImage2File(queue<int> thePath, string _mapName);
// ********************************************
//
// ./navigate [map] [startInd] [endInd]
//
// ********************************************
int main(int argc, char *argv[]) {
// process the inputs from the command line
if (argc < 4) {
cout << "Not enough parameters" << endl;
return 0;
}
string mapName = argv[1];
int startInd = stoi(argv[2]);
int endInd = stoi(argv[3]);
cout << "Solving map " << mapName << " from Node " << startInd << " to Node " << endInd << endl;
// instantiate an instance of the class you create (in Navigation.h and Navigation.cpp)
NavigationInterface *nav = new Navigation();
// make calls to functions in the Navigate class
nav->readNetwork(mapName);
queue<int> thePath = nav->computeShortestPath(startInd, endInd);
nav->printPath(thePath);
// make a call that creats a Map.bmp, which shows the shortest path computed through the road network
writeImage2File(thePath, mapName);
delete nav;
return 0;
}