mapserver/server/mapobject/setup.go
NatureFreshMilk 65197c2a45 map obj stub
2019-01-24 08:26:28 +01:00

28 lines
485 B
Go

package mapobject
import (
"mapserver/app"
"mapserver/mapblockparser"
)
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)
}
}
}
func Setup(ctx *app.App) {
ctx.BlockAccessor.AddListener(&Listener{ctx: ctx})
}