poi impl
This commit is contained in:
parent
ccd5c4096b
commit
f132363342
@ -55,6 +55,10 @@ func NewMetadata() *Metadata {
|
||||
return &md
|
||||
}
|
||||
|
||||
func (md *Metadata) GetMetadata(x, y, z int) map[string]string {
|
||||
return md.GetPairsMap(getNodePos(x, y, z))
|
||||
}
|
||||
|
||||
func (md *Metadata) GetPairsMap(pos int) map[string]string {
|
||||
pairsMap := md.Pairs[pos]
|
||||
if pairsMap == nil {
|
||||
|
@ -7,19 +7,23 @@ import (
|
||||
|
||||
func onPoiBlock(id int, block *mapblockparser.MapBlock, odb mapobjectdb.DBAccessor) {
|
||||
|
||||
for x:=0; x<16; x++ {
|
||||
for y:=0; y<16; y++ {
|
||||
for z:=0; z<16; z++ {
|
||||
name := block.GetNodeName(x,y,z)
|
||||
for x := 0; x < 16; x++ {
|
||||
for y := 0; y < 16; y++ {
|
||||
for z := 0; z < 16; z++ {
|
||||
name := block.GetNodeName(x, y, z)
|
||||
if name == "mapserver:poi" {
|
||||
md := block.Metadata.GetMetadata(x, y, z)
|
||||
|
||||
o := mapobjectdb.NewMapObject(&block.Pos, x, y, z, "poi")
|
||||
o.Attributes["name"] = "test"
|
||||
o.Attributes["name"] = md["name"]
|
||||
o.Attributes["category"] = md["category"]
|
||||
o.Attributes["url"] = md["url"]
|
||||
o.Attributes["active"] = md["active"]
|
||||
o.Attributes["owner"] = md["owner"]
|
||||
|
||||
odb.AddMapData(o)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
panic("OK") //XXX
|
||||
}
|
||||
|
@ -31,12 +31,12 @@ type MapObject struct {
|
||||
|
||||
func NewMapObject(MBPos *coords.MapBlockCoords, x int, y int, z int, _type string) *MapObject {
|
||||
o := MapObject{
|
||||
MBPos: MBPos,
|
||||
Type: _type,
|
||||
X: MBPos.X + x,
|
||||
Y: MBPos.Y + y,
|
||||
Z: MBPos.Z + z,
|
||||
Mtime: time.Now().Unix(),
|
||||
MBPos: MBPos,
|
||||
Type: _type,
|
||||
X: MBPos.X + x,
|
||||
Y: MBPos.Y + y,
|
||||
Z: MBPos.Z + z,
|
||||
Mtime: time.Now().Unix(),
|
||||
Attributes: make(map[string]string),
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user