コード例 #1
0
 def expand(self, tileset, amount=1):
     """Given a list of tiles, expand the coverage around those tiles"""
     tiles = {}
     tileset = [[int(b) for b in a.split(",")] for a in tileset]
     for tile in tileset:
         (x, y) = tile
         for dx in range(-amount, amount + 1):
             for dy in range(-amount, amount + 1):
                 tiles["%d,%d" % (x + dx, y + dy)] = True
     return tiles.keys()
コード例 #2
0
ファイル: mod_mapData.py プロジェクト: M4rtinK/modrana
 def expand(self, tileset, amount=1):
     """Given a list of tiles, expand the coverage around those tiles"""
     tiles = {}
     tileset = [[int(b) for b in a.split(",")] for a in tileset]
     for tile in tileset:
         (x, y) = tile
         for dx in range(-amount, amount + 1):
             for dy in range(-amount, amount + 1):
                 tiles["%d,%d" % (x + dx, y + dy)] = True
     return tiles.keys()
コード例 #3
0
ファイル: mod_mapData.py プロジェクト: starhawking/modrana
 def listTiles(self, route):
     """List all tiles touched by a polyline"""
     tiles = {}
     for pos in route:
         (lat, lon) = pos
         (tx, ty) = tileXY(lat, lon, 15)
         tile = "%d,%d" % (tx, ty)
         if not tiles.has_key(tile):
             tiles[tile] = True
     return tiles.keys()