mirror of
https://bitbucket.org/s_l_teichmann/mtsatellite
synced 2024-12-23 16:50: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,
|
||||
strconv.Itoa(int(z)),
|
||||
strconv.Itoa(int(x)),
|
||||
fmt.Sprintf("%d.png", y)))
|
||||
strconv.Itoa(int(y))+".png"))
|
||||
return
|
||||
}
|
||||
|
||||
@ -52,7 +52,10 @@ func (sb *subBaseLine) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
||||
ty := y >> (z - 8)
|
||||
|
||||
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 fi os.FileInfo
|
||||
@ -61,11 +64,7 @@ func (sb *subBaseLine) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
if checkLastModified(rw, r, fi.ModTime()) {
|
||||
return
|
||||
}
|
||||
|
||||
if checkETag(rw, r, fi) {
|
||||
if checkLastModified(rw, r, fi.ModTime()) || checkETag(rw, r, fi) {
|
||||
return
|
||||
}
|
||||
|
||||
@ -99,7 +98,6 @@ func (sb *subBaseLine) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
||||
rw.Header().Set("Content-Type", "image/png")
|
||||
if err = png.Encode(rw, img); err != nil {
|
||||
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,
|
||||
strconv.Itoa(level+1),
|
||||
strconv.Itoa(bx+o[0]),
|
||||
fmt.Sprintf("%d.png", bz+o[1]))
|
||||
strconv.Itoa(bz+o[1])+".png")
|
||||
img := common.LoadPNG(path)
|
||||
img = resize.Resize(128, 128, img, resize.Lanczos3)
|
||||
sr := img.Bounds()
|
||||
|
Loading…
Reference in New Issue
Block a user