-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
43 lines (32 loc) · 1.05 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
#include "CSVReader.hpp"
#include "BarChart.hpp"
#include "BarChartMap.hpp"
#include "menu.hpp"
int main(int argc, char* argv[])
{
struct menuData * data = menu();
if(data->closed) {
delete data;
return EXIT_SUCCESS;
}
CSVReader csv(data->csv_data);
BaseProject *app;
std::string executablePath = argv[0];
std::string executableDir = executablePath.substr(0, executablePath.find_last_of("\\/"));
std::string shaderDir = executableDir + "/shaders/";
if(data->mode == "barChartMap") {
CSVReader csv_coordinates(data->csv_coordinates);
app = new BarChartMap(data->title, shaderDir, csv, csv_coordinates, data->latitude_column, data->longitude_column, data->up, data->left, data->right, data->down, data->zoom, data->map, data->gridDim);
} else if(data->mode == "barChart") {
app = new BarChart(data->title, shaderDir, csv, data->gridDim);
}
delete data;
try {
app->run();
delete app;
} catch (const std::exception& e) {
std::cerr << e.what() << std::endl;
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}