1
0
forked from MTSR/mapserver

tile rendered callback

This commit is contained in:
NatureFreshMilk 2019-01-22 15:25:33 +01:00
parent a38d3724db
commit 0c63823eeb

View File

@ -22,6 +22,11 @@ type TileRenderer struct {
layers []layer.Layer layers []layer.Layer
tdb mapobjectdb.DBAccessor tdb mapobjectdb.DBAccessor
dba db.DBAccessor dba db.DBAccessor
listeners []TileListener
}
type TileListener interface {
OnRenderedTile(tc *coords.TileCoords)
} }
func NewTileRenderer(mapblockrenderer *mapblockrenderer.MapBlockRenderer, func NewTileRenderer(mapblockrenderer *mapblockrenderer.MapBlockRenderer,
@ -41,6 +46,10 @@ const (
IMG_SIZE = 256 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) { func (tr *TileRenderer) Render(tc *coords.TileCoords, recursionDepth int) ([]byte, error) {
//Check cache //Check cache
@ -243,5 +252,11 @@ func (tr *TileRenderer) RenderImage(tc *coords.TileCoords, recursionDepth int) (
} }
log.WithFields(fields).Debug("Cross stitch") log.WithFields(fields).Debug("Cross stitch")
for _, listener := range tr.listeners {
listener.OnRenderedTile(tc)
}
return img, buf.Bytes(), nil return img, buf.Bytes(), nil
} }