mirror of
https://bitbucket.org/s_l_teichmann/mtsatellite
synced 2024-12-24 01:00:18 +01:00
Some minor code cleanups in mtwebmapper.
This commit is contained in:
parent
1baf9f9dee
commit
5172e02380
@ -41,7 +41,7 @@ func (sb *subBaseLine) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
|||||||
http.ServeFile(rw, r, filepath.Join(sb.mapDir,
|
http.ServeFile(rw, r, filepath.Join(sb.mapDir,
|
||||||
strconv.Itoa(int(z)),
|
strconv.Itoa(int(z)),
|
||||||
strconv.Itoa(int(x)),
|
strconv.Itoa(int(x)),
|
||||||
fmt.Sprintf("%d.png", y)))
|
strconv.Itoa(int(y))+".png"))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,7 +52,10 @@ func (sb *subBaseLine) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
|||||||
ty := y >> (z - 8)
|
ty := y >> (z - 8)
|
||||||
|
|
||||||
baseTile := filepath.Join(
|
baseTile := filepath.Join(
|
||||||
sb.mapDir, "8", strconv.Itoa(int(tx)), fmt.Sprintf("%d.png", ty))
|
sb.mapDir,
|
||||||
|
"8",
|
||||||
|
strconv.Itoa(int(tx)),
|
||||||
|
strconv.Itoa(int(ty))+".png")
|
||||||
|
|
||||||
var err error
|
var err error
|
||||||
var fi os.FileInfo
|
var fi os.FileInfo
|
||||||
@ -61,11 +64,7 @@ func (sb *subBaseLine) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if checkLastModified(rw, r, fi.ModTime()) {
|
if checkLastModified(rw, r, fi.ModTime()) || checkETag(rw, r, fi) {
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if checkETag(rw, r, fi) {
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -99,7 +98,6 @@ func (sb *subBaseLine) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
|||||||
rw.Header().Set("Content-Type", "image/png")
|
rw.Header().Set("Content-Type", "image/png")
|
||||||
if err = png.Encode(rw, img); err != nil {
|
if err = png.Encode(rw, img); err != nil {
|
||||||
log.Printf("WARN: encoding image failed: %s", err)
|
log.Printf("WARN: encoding image failed: %s", err)
|
||||||
return
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -255,7 +255,7 @@ func updatePyramidTile(scratch *image.RGBA, level int, baseDir string, j xzm) er
|
|||||||
baseDir,
|
baseDir,
|
||||||
strconv.Itoa(level+1),
|
strconv.Itoa(level+1),
|
||||||
strconv.Itoa(bx+o[0]),
|
strconv.Itoa(bx+o[0]),
|
||||||
fmt.Sprintf("%d.png", bz+o[1]))
|
strconv.Itoa(bz+o[1])+".png")
|
||||||
img := common.LoadPNG(path)
|
img := common.LoadPNG(path)
|
||||||
img = resize.Resize(128, 128, img, resize.Lanczos3)
|
img = resize.Resize(128, 128, img, resize.Lanczos3)
|
||||||
sr := img.Bounds()
|
sr := img.Bounds()
|
||||||
|
Loading…
Reference in New Issue
Block a user