1
0
forked from MTSR/mapserver

mapobject setup

This commit is contained in:
NatureFreshMilk 2019-01-23 13:22:47 +01:00
parent 5691ac7560
commit c969907b7b
3 changed files with 16 additions and 1 deletions

View File

@ -5,6 +5,7 @@ import (
"github.com/sirupsen/logrus"
"mapserver/app"
"mapserver/initialrenderer"
"mapserver/mapobject"
"mapserver/params"
"mapserver/tileupdate"
"mapserver/web"
@ -57,6 +58,9 @@ func main() {
panic(err)
}
//Set up mapobject events
mapobject.Setup(ctx)
//run initial rendering
if ctx.Config.EnableInitialRendering && ctx.Config.RenderState.InitialRun {
go initialrenderer.Job(ctx)
@ -68,6 +72,7 @@ func main() {
}
//Start http server
//TODO: defer, may cause race condition
web.Serve(ctx)
}

10
server/mapobject/setup.go Normal file
View File

@ -0,0 +1,10 @@
package mapobject
import (
"mapserver/app"
)
func Setup(ctx *app.App) {
ctx.BlockAccessor.AddListener(&ClearMapData{db: ctx.Objectdb})
ctx.BlockAccessor.AddListener(&POI{db: ctx.Objectdb})
}

View File

@ -31,7 +31,7 @@ func Serve(ctx *app.App) {
//websocket listener
ctx.BlockAccessor.AddListener(ws)
//mapbloc endpoint
//mapblock endpoint
mux.Handle("/api/mapblock/", &MapblockHandler{ctx: ctx})
}