mirror of
https://bitbucket.org/s_l_teichmann/mtsatellite
synced 2025-12-30 19:25:43 +01:00
Implement fetaure request issue #17
mtseeder and mtwebmapper got an option to set the background color where no nodes are generated, yet.
This commit is contained in:
@@ -7,6 +7,7 @@ package main
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"image/color"
|
||||
"log"
|
||||
|
||||
"bitbucket.org/s_l_teichmann/mtsatellite/common"
|
||||
@@ -19,6 +20,7 @@ func main() {
|
||||
xMin, yMin, zMin int
|
||||
xMax, yMax, zMax int
|
||||
colorsFile string
|
||||
bgColor string
|
||||
outDir string
|
||||
numWorkers int
|
||||
skipBaseLevel bool
|
||||
@@ -28,6 +30,8 @@ func main() {
|
||||
version bool
|
||||
)
|
||||
|
||||
defaultBgColor := common.ColorToHex(common.BackgroundColor)
|
||||
|
||||
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")
|
||||
@@ -38,6 +42,8 @@ func main() {
|
||||
flag.IntVar(&zMin, "zmin", -1933, "z min of the area to tile")
|
||||
flag.IntVar(&zMax, "zmax", 1932, "z max of the area to tile")
|
||||
flag.StringVar(&colorsFile, "colors", "colors.txt", "definition of colors")
|
||||
flag.StringVar(&bgColor, "background", defaultBgColor, "background color")
|
||||
flag.StringVar(&bgColor, "bg", defaultBgColor, "background color (shorthand)")
|
||||
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, "workers", 1, "number of workers")
|
||||
@@ -62,6 +68,13 @@ func main() {
|
||||
common.PrintVersionAndExit()
|
||||
}
|
||||
|
||||
var bg color.RGBA
|
||||
var err error
|
||||
if bg, err = common.ParseColor(bgColor); err != nil {
|
||||
log.Printf("WARN: Cannot parse background color '%s': %s\n", bgColor, err)
|
||||
bg = common.BackgroundColor
|
||||
}
|
||||
|
||||
if !skipBaseLevel {
|
||||
td := common.Clamp32f(float32(transparentDim/100.0), 0.0, 1.0)
|
||||
address := fmt.Sprintf("%s:%d", host, port)
|
||||
@@ -69,14 +82,15 @@ func main() {
|
||||
address,
|
||||
xMin, yMin, zMin, xMax, yMax, zMax,
|
||||
transparent, td,
|
||||
colorsFile,
|
||||
colorsFile, bg,
|
||||
outDir,
|
||||
numWorkers); err != nil {
|
||||
log.Fatalf("Creating base level tiles failed: %s", err)
|
||||
}
|
||||
}
|
||||
if !skipPyramid {
|
||||
if err := createPyramid(outDir, numWorkers); err != nil {
|
||||
pc := pyramidCreator{numWorkers: numWorkers, outDir: outDir, bg: bg}
|
||||
if err := pc.create(); err != nil {
|
||||
log.Fatalf("Creating pyramid tiles failed: %s", err)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user