2014-09-14 15:28:03 +02:00
|
|
|
// Copyright 2014 by Sascha L. Teichmann
|
|
|
|
// Use of this source code is governed by the MIT license
|
|
|
|
// that can be found in the LICENSE file.
|
|
|
|
|
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"flag"
|
|
|
|
"fmt"
|
|
|
|
"log"
|
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
var (
|
2014-09-14 17:12:28 +02:00
|
|
|
port int
|
|
|
|
host string
|
|
|
|
xMin, zMin int
|
|
|
|
xMax, zMax int
|
|
|
|
colorsFile string
|
|
|
|
outDir string
|
|
|
|
numWorkers int
|
|
|
|
skipBaseLevel bool
|
2014-09-14 15:28:03 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
flag.IntVar(&port, "port", 6379, "port to of mtredisalize server")
|
|
|
|
flag.IntVar(&port, "p", 6379, "port to of mtredisalize server (shorthand)")
|
|
|
|
flag.StringVar(&host, "host", "localhost", "host to mtredisalize server")
|
|
|
|
flag.IntVar(&xMin, "xmin", -1936, "x min of the area to tile")
|
|
|
|
flag.IntVar(&xMax, "xmax", 1920, "x max of the area to tile")
|
|
|
|
flag.IntVar(&zMin, "zmin", -1936, "z min of the area to tile")
|
|
|
|
flag.IntVar(&zMax, "zmax", 1920, "z max of the area to tile")
|
2014-09-14 17:12:28 +02:00
|
|
|
flag.StringVar(&colorsFile, "colors", "colors.txt", "definition of colors")
|
2014-09-14 15:28:03 +02:00
|
|
|
flag.StringVar(&outDir, "output-dir", "map", "directory with the resulting image tree")
|
|
|
|
flag.StringVar(&outDir, "o", "map", "directory with the resulting image tree")
|
|
|
|
flag.IntVar(&numWorkers, "worker", 1, "number of workers")
|
|
|
|
flag.IntVar(&numWorkers, "w", 1, "number of workers (shorthand)")
|
2014-09-14 17:12:28 +02:00
|
|
|
flag.BoolVar(&skipBaseLevel, "skip-base-level", false, "Do not generate baselevel")
|
|
|
|
flag.BoolVar(&skipBaseLevel, "sb", false, "Do not generate baselevel (shorthand)")
|
2014-09-14 15:28:03 +02:00
|
|
|
|
|
|
|
flag.Parse()
|
|
|
|
|
|
|
|
var err error
|
2014-09-14 17:12:28 +02:00
|
|
|
if !skipBaseLevel {
|
|
|
|
address := fmt.Sprintf("%s:%d", host, port)
|
|
|
|
if err = createBaseLevel(
|
|
|
|
address, xMin, zMin, xMax, zMax, colorsFile, outDir, numWorkers); err != nil {
|
|
|
|
log.Fatalf("Creating base level failed: %s", err)
|
2014-09-14 15:28:03 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|