Ejemplo n.º 1
0
 def testTilesEquals(self):
     tile1 = Tile(1, 1, 15)
     tile2 = Tile(1, 1, 15)
     tile3 = Tile(1, 2, 15)
     tile4 = Tile(1, 1, 12)
     self.assertEqual(tile1, tile2)
     self.assertNotEqual(tile1, tile3)
     self.assertNotEqual(tile1, tile4)
Ejemplo n.º 2
0
 def testTileHashEquals(self):
     tile1 = Tile(1, 1, 15)
     tile2 = Tile(1, 1, 15)
     tile3 = Tile(1, 2, 15)
     tile4 = Tile(1, 1, 12)
     self.assertEqual(tile1.__hash__(), tile2.__hash__())
     self.assertNotEqual(tile1.__hash__(), tile3.__hash__())
     self.assertNotEqual(tile1.__hash__(), tile4.__hash__())
Ejemplo n.º 3
0
 def testQTileEquals(self):
     tile1 = QTile(Tile(1, 1, 15))
     tile2 = QTile(Tile(1, 1, 15))
     tile3 = QTile(Tile(1, 2, 15))
     tile4 = QTile(Tile(1, 1, 12))
     self.assertEqual(tile1, tile2)
     self.assertNotEqual(tile1, tile3)
     self.assertNotEqual(tile1, tile4)
Ejemplo n.º 4
0
 def draw(self, painter: "QPainter"):
     for x in range(self.map_rect.left(), self.map_rect.right()):
         for y in range(self.map_rect.top(), self.map_rect.bottom()):
             tile = QTile(Tile(x, y, self.zoom),
                          (x - self.map_rect.left()) * TILE_SIZE,
                          (y - self.map_rect.top()) * TILE_SIZE)
             self.draw_tile(painter, tile)
Ejemplo n.º 5
0
 def testRemoveOutsideTiles(self):
     widget = MapWidget()
     for row in range(2):
         for column in range(2):
             qtile = QTile(Tile(0.0000, 0.0000, 15))
             qtile.map_x = column * 256
             qtile.map_y = row * 256
             widget.drawn_tiles.append(qtile)
Ejemplo n.º 6
0
 def download(self):
     self.drawn.clear()
     for x in range(self.map_rect.left(), self.map_rect.right()):
         for y in range(self.map_rect.top(), self.map_rect.bottom()):
             tile = Tile(x, y, self.zoom)
             if not self.osm.exist_tile((tile.x, tile.y)):
                 self.osm.download_tile(tile)
                 return
Ejemplo n.º 7
0
 def testTileInSet(self):
     tile1 = QTile(Tile(1, 1, 15))
     tile2 = QTile(Tile(3, 3, 15))
     seq = {QTile(Tile(1, 1, 15)), QTile(Tile(1, 2, 15)),
            QTile(Tile(2, 1, 15)), QTile(Tile(2, 2, 15))}
     self.assertTrue(tile1 in seq)
     self.assertFalse(tile2 in seq)
Ejemplo n.º 8
0
 def testQTilesInSequences(self):
     tile1 = QTile(Tile(1, 1, 15))
     tile2 = QTile(Tile(3, 3, 15))
     seq = [QTile(Tile(1, 1, 15)), QTile(Tile(1, 2, 15)),
            QTile(Tile(2, 1, 15)), QTile(Tile(2, 2, 15))]
     self.assertTrue(tile1 in seq)
     self.assertFalse(tile2 in seq)
Ejemplo n.º 9
0
 def testTilesInSequences(self):
     tile1 = Tile(1, 1, 15)
     tile2 = Tile(3, 3, 15)
     seq = [Tile(1, 1, 15), Tile(1, 2, 15), Tile(2, 1, 15), Tile(2, 2, 15)]
     self.assertTrue(tile1 in seq)
     self.assertFalse(tile2 in seq)