mirror of
https://bitbucket.org/s_l_teichmann/mtsatellite
synced 2024-12-23 16:50:18 +01:00
mtwebmapper: Some code cleanup in sub baseline rendering.
This commit is contained in:
parent
ed9e37e892
commit
617a3081b2
@ -61,19 +61,6 @@ func (sb *subBaseLine) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
}
|
||||
img := common.LoadPNG(baseTile)
|
||||
|
||||
type subImage interface {
|
||||
SubImage(image.Rectangle) image.Image
|
||||
}
|
||||
var si subImage
|
||||
var ok bool
|
||||
if si, ok = img.(subImage); !ok {
|
||||
// Should not happen.
|
||||
http.Error(rw,
|
||||
http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
|
||||
rx := x & ^(^uint(0) << (z - 8))
|
||||
ry := y & ^(^uint(0) << (z - 8))
|
||||
@ -83,23 +70,27 @@ func (sb *subBaseLine) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
||||
w := uint(256) / parts
|
||||
xo := w * rx
|
||||
yo := w * (parts - 1 - ry)
|
||||
//fmt.Printf("x %d\n", x)
|
||||
//fmt.Printf("y %d\n", y)
|
||||
//fmt.Printf("z %d\n", z)
|
||||
//fmt.Printf("z %d\n", z)
|
||||
//fmt.Printf("parts %d\n", parts)
|
||||
//fmt.Printf("w %d\n", w)
|
||||
//fmt.Printf("xo %d\n", xo)
|
||||
//fmt.Printf("yo %d\n", yo)
|
||||
//fmt.Printf("rx %d\n", rx)
|
||||
//fmt.Printf("ry %d\n", ry)
|
||||
|
||||
img = si.SubImage(image.Rect(int(xo), int(yo), int(xo+w), int(yo+w)))
|
||||
img := common.LoadPNG(baseTile)
|
||||
|
||||
type subImage interface {
|
||||
SubImage(image.Rectangle) image.Image
|
||||
}
|
||||
|
||||
if si, ok := img.(subImage); ok {
|
||||
img = si.SubImage(image.Rect(int(xo), int(yo), int(xo+w), int(yo+w)))
|
||||
} else {
|
||||
// Should not happen.
|
||||
http.Error(rw,
|
||||
http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)
|
||||
}
|
||||
|
||||
img = blowUp(img)
|
||||
|
||||
rw.Header().Set("Content-Type", "image/png")
|
||||
if etag == "" {
|
||||
if etag, err = createETag(baseTile); err != nil {
|
||||
// Unlikely
|
||||
log.Printf("Cannot create ETag: %s", baseTile)
|
||||
} else {
|
||||
rw.Header().Set("ETag", etag)
|
||||
|
Loading…
Reference in New Issue
Block a user