forked from MTSR/mapserver
mapobject setup
This commit is contained in:
parent
5691ac7560
commit
c969907b7b
@ -5,6 +5,7 @@ import (
|
|||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
"mapserver/app"
|
"mapserver/app"
|
||||||
"mapserver/initialrenderer"
|
"mapserver/initialrenderer"
|
||||||
|
"mapserver/mapobject"
|
||||||
"mapserver/params"
|
"mapserver/params"
|
||||||
"mapserver/tileupdate"
|
"mapserver/tileupdate"
|
||||||
"mapserver/web"
|
"mapserver/web"
|
||||||
@ -57,6 +58,9 @@ func main() {
|
|||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Set up mapobject events
|
||||||
|
mapobject.Setup(ctx)
|
||||||
|
|
||||||
//run initial rendering
|
//run initial rendering
|
||||||
if ctx.Config.EnableInitialRendering && ctx.Config.RenderState.InitialRun {
|
if ctx.Config.EnableInitialRendering && ctx.Config.RenderState.InitialRun {
|
||||||
go initialrenderer.Job(ctx)
|
go initialrenderer.Job(ctx)
|
||||||
@ -68,6 +72,7 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Start http server
|
//Start http server
|
||||||
|
//TODO: defer, may cause race condition
|
||||||
web.Serve(ctx)
|
web.Serve(ctx)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
10
server/mapobject/setup.go
Normal file
10
server/mapobject/setup.go
Normal 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})
|
||||||
|
}
|
@ -31,7 +31,7 @@ func Serve(ctx *app.App) {
|
|||||||
//websocket listener
|
//websocket listener
|
||||||
ctx.BlockAccessor.AddListener(ws)
|
ctx.BlockAccessor.AddListener(ws)
|
||||||
|
|
||||||
//mapbloc endpoint
|
//mapblock endpoint
|
||||||
mux.Handle("/api/mapblock/", &MapblockHandler{ctx: ctx})
|
mux.Handle("/api/mapblock/", &MapblockHandler{ctx: ctx})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user