-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
84 lines (75 loc) · 1.75 KB
/
main.cpp
File metadata and controls
84 lines (75 loc) · 1.75 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
74
75
76
77
78
79
80
81
82
83
84
#include "bgooglemapsmaker.h"
#include <Magick++.h>
#include <iostream>
#include <string.h>
using namespace std;
using namespace Magick;
void printHelp(const char *name)
{
cout << "USEAGE: " << name << " INPUTFILE OUTPUTFOLDER [options]" << endl;
cout << "HINT: you may want to set MAGICK_TMPDIR" << endl;
}
int main(int argc, char** argv)
{
InitializeMagick(*argv);
if (argc < 2)
{
printHelp(argv[0]);
return 0;
}
if (argc < 3)
{
if (!strcmp(argv[1], "--help") || !strcmp(argv[2], "--help"))
{
printHelp(argv[0]);
return 0;
}
cerr << "no output folder given" << endl;
return 1;
}
BGooglemapsMaker builder(argv[1], argv[2]);
for (int i = 3; i < argc; ++i)
{
string option = argv[i];
if (option == "--minlevel")
{
if (argc >= i+1)
{
builder.setMinZoomLevel( atoi(argv[i+1]) );
}
else
{
cerr << "ERROR: no minlevel given" << endl;
return 1;
}
}
else if (option == "--maxlevel")
{
if (argc >= i+1)
{
builder.setMaxZoomLevel( atoi(argv[i+1]) );
}
else
{
cerr << "ERROR: no maxlevel given" << endl;
return 1;
}
}
else if (option == "--help")
{
printHelp(argv[0]);
return 0;
}
}
if (!builder.generateTilesMagick())
{
cerr << "something went wrong..." << endl;
return 1;
}
else
{
cout << "All done, party!" << endl;
builder.printParameters();
}
return 0;
}