Add a --tilesize option.

The produces tiled output way faster than repeatedly using --geometry
because it only reads the databse once.
This commit is contained in:
Martijn Versteegh
2018-11-14 12:34:52 +01:00
parent c382c2c3ba
commit bd0c140bfc
7 changed files with 164 additions and 25 deletions

View File

@ -29,6 +29,7 @@ void usage()
" --max-y <y>\n"
" --backend <backend>\n"
" --geometry x:y+w+h\n"
" --tilesize wxh\n"
" --extent\n"
" --zoom <zoomlevel>\n"
" --colors <colors.txt>\n"
@ -82,6 +83,7 @@ int main(int argc, char *argv[])
{"noshading", no_argument, 0, 'H'},
{"backend", required_argument, 0, 'd'},
{"geometry", required_argument, 0, 'g'},
{"tilesize", required_argument, 0, 't'},
{"extent", no_argument, 0, 'E'},
{"min-y", required_argument, 0, 'a'},
{"max-y", required_argument, 0, 'c'},
@ -174,6 +176,18 @@ int main(int argc, char *argv[])
generator.setGeometry(x, y, w, h);
}
break;
case 't': {
std::istringstream geometry(optarg);
int w, h;
char c;
geometry >> w >> c >> h;
if (geometry.fail() || c != 'x' || w < 1 || h < 1) {
usage();
exit(1);
}
generator.setTileSize(w, h);
}
break;
case 'f': {
uint flags = 0;
if(strchr(optarg, 't') != NULL)