1
0
forked from MTSR/mapserver

onUpdate(mapblock)

This commit is contained in:
NatureFreshMilk 2019-01-21 14:42:38 +01:00
parent 563ea61e67
commit 5f14300005
3 changed files with 7 additions and 9 deletions

View File

@ -19,7 +19,7 @@ type MapBlockAccessor struct {
} }
type MapBlockListener interface { type MapBlockListener interface {
OnParsedMapBlock(block *mapblockparser.MapBlock, pos coords.MapBlockCoords) OnParsedMapBlock(block *mapblockparser.MapBlock)
} }
func getKey(pos coords.MapBlockCoords) string { func getKey(pos coords.MapBlockCoords) string {
@ -82,7 +82,7 @@ func (a *MapBlockAccessor) FindLegacyMapBlocks(lastpos coords.MapBlockCoords, li
} }
for _, listener := range a.listeners { for _, listener := range a.listeners {
listener.OnParsedMapBlock(mapblock, block.Pos) listener.OnParsedMapBlock(mapblock)
} }
a.c.Set(key, mapblock, cache.DefaultExpiration) a.c.Set(key, mapblock, cache.DefaultExpiration)
@ -130,7 +130,7 @@ func (a *MapBlockAccessor) FindLatestMapBlocks(mintime int64, limit int, layerfi
} }
for _, listener := range a.listeners { for _, listener := range a.listeners {
listener.OnParsedMapBlock(mapblock, block.Pos) listener.OnParsedMapBlock(mapblock)
} }
a.c.Set(key, mapblock, cache.DefaultExpiration) a.c.Set(key, mapblock, cache.DefaultExpiration)
@ -163,7 +163,7 @@ func (a *MapBlockAccessor) GetMapBlock(pos coords.MapBlockCoords) (*mapblockpars
} }
for _, listener := range a.listeners { for _, listener := range a.listeners {
listener.OnParsedMapBlock(mapblock, pos) listener.OnParsedMapBlock(mapblock)
} }
a.c.Set(key, mapblock, cache.DefaultExpiration) a.c.Set(key, mapblock, cache.DefaultExpiration)

View File

@ -1,7 +1,6 @@
package mapobject package mapobject
import ( import (
"mapserver/coords"
"mapserver/mapblockparser" "mapserver/mapblockparser"
"mapserver/mapobjectdb" "mapserver/mapobjectdb"
) )
@ -10,8 +9,8 @@ type ClearMapData struct {
db mapobjectdb.DBAccessor db mapobjectdb.DBAccessor
} }
func (this *ClearMapData) OnParsedMapBlock(block *mapblockparser.MapBlock, pos coords.MapBlockCoords) { func (this *ClearMapData) OnParsedMapBlock(block *mapblockparser.MapBlock) {
err := this.db.RemoveMapData(pos) err := this.db.RemoveMapData(block.Pos)
if err != nil { if err != nil {
panic(err) panic(err)
} }

View File

@ -1,7 +1,6 @@
package mapobject package mapobject
import ( import (
"mapserver/coords"
"mapserver/mapblockparser" "mapserver/mapblockparser"
"mapserver/mapobjectdb" "mapserver/mapobjectdb"
) )
@ -10,7 +9,7 @@ type POI struct {
db mapobjectdb.DBAccessor db mapobjectdb.DBAccessor
} }
func (this *POI) OnParsedMapBlock(block *mapblockparser.MapBlock, pos coords.MapBlockCoords) { func (this *POI) OnParsedMapBlock(block *mapblockparser.MapBlock) {
var found bool var found bool
for _, v := range block.BlockMapping { for _, v := range block.BlockMapping {
if v == "mapserver:poi" { if v == "mapserver:poi" {