-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.cpp
49 lines (41 loc) · 1.95 KB
/
main.cpp
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
#include <iostream>
#include <vector>
#include "readFromFile.hpp"
#include "RouteGraph.h"
#include "Utility.h"
#include "AirportList.hpp"
#include "MapImage.h"
#include "dijkstra.hpp"
int main(int argc, const char * argv[]) {
/* ensures valid arguments are pssed */
if (argc != 7) {
std::cout << "------------------" << std::endl;
std::cout << "ERROR: Please pass in the following arguments" << std::endl;
std::cout << "Argument 1: Airport Dataset File Location" << std::endl;
std::cout << "Argument 2: Routes Dataset File Location" << std::endl;
std::cout << "Argument 3: Airport Source" << std::endl;
std::cout << "Argument 4: Airport Destination" << std::endl;
std::cout << "Argument 5: Image Destination File Name (must end in .png)" << std::endl;
std::cout << "Argument 6: Image Destination File Name (must end in .gif)" << std::endl;
std::cout << "------------------\nPlease make the above changes and run again" << std::endl;
return -1;
}
/* console output to verify inputs */
std::cout << "------------------\nAttempting to find the shortest path between Airport " << argv[3] << " and Airport " << argv[4] << "\n------------------" << std::endl;
/* create the map */
std::cout << "Creating the map..." << std::endl;
MapImage map(argv[1], argv[2]);
/* find the shortest path */
std::cout << "Finding the shortest path..." << std::endl;
map.drawShortestPath(argv[3], argv[4], argv[5]);
/* Optional: You can uncomment the following segment to draw All Routes. Output is found in results/allRoutes.png and results/allRoutes.gif */
// /* Drawing All the Routes */
// std::cout << "Drawing all the Routes..." <<std::endl;
// map.drawAllRoutes();
/* export the files */
std::cout << "Exporting the GIF..." << std::endl;
map.playAnimation(argv[6]);
/* verify success output */
std::cout << "------------------\nSuccess!\nYou can view the full path at results/" << argv[5] << " and the path animation at results/" << argv[6] << std::endl;
return 0;
};