mapserver/server/mapobject/setup.go

28 lines
500 B
Go
Raw Normal View History

2019-01-23 15:22:47 +03:00
package mapobject
import (
"mapserver/app"
2019-01-23 15:41:26 +03:00
"mapserver/mapblockparser"
2019-01-23 15:22:47 +03:00
)
2019-01-23 15:41:26 +03:00
type Listener struct {
ctx *app.App
}
func (this *Listener) OnParsedMapBlock(block *mapblockparser.MapBlock) {
err := this.ctx.Objectdb.RemoveMapData(block.Pos)
if err != nil {
panic(err)
}
for id, name := range block.BlockMapping {
if name == "mapserver:poi" {
onPoiBlock(id, block, this.ctx.Objectdb)
}
}
}
2019-01-23 15:22:47 +03:00
func Setup(ctx *app.App) {
2019-01-23 15:41:26 +03:00
ctx.BlockAccessor.AddListener(&Listener{ctx: ctx})
2019-01-23 15:22:47 +03:00
}