forked from MTSR/mapserver
tile rendered callback
This commit is contained in:
parent
a38d3724db
commit
0c63823eeb
@ -22,6 +22,11 @@ type TileRenderer struct {
|
||||
layers []layer.Layer
|
||||
tdb mapobjectdb.DBAccessor
|
||||
dba db.DBAccessor
|
||||
listeners []TileListener
|
||||
}
|
||||
|
||||
type TileListener interface {
|
||||
OnRenderedTile(tc *coords.TileCoords)
|
||||
}
|
||||
|
||||
func NewTileRenderer(mapblockrenderer *mapblockrenderer.MapBlockRenderer,
|
||||
@ -41,6 +46,10 @@ const (
|
||||
IMG_SIZE = 256
|
||||
)
|
||||
|
||||
func (tr *TileRenderer) AddListener(l TileListener) {
|
||||
tr.listeners = append(tr.listeners, l)
|
||||
}
|
||||
|
||||
func (tr *TileRenderer) Render(tc *coords.TileCoords, recursionDepth int) ([]byte, error) {
|
||||
|
||||
//Check cache
|
||||
@ -243,5 +252,11 @@ func (tr *TileRenderer) RenderImage(tc *coords.TileCoords, recursionDepth int) (
|
||||
}
|
||||
log.WithFields(fields).Debug("Cross stitch")
|
||||
|
||||
|
||||
for _, listener := range tr.listeners {
|
||||
listener.OnRenderedTile(tc)
|
||||
}
|
||||
|
||||
|
||||
return img, buf.Bytes(), nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user