/** * Iterator for all tiles in the given level. Returns (column, row) of a tile. * * @param int $level * * @return array */ public function tiles($level) { list($columns, $rows) = $this->_descriptor->getNumTiles($level); $yield = array(); foreach (range(0, $columns - 1) as $column) { foreach (range(0, $rows - 1) as $row) { $yield[] = array($column, $row); } } return $yield; }
/** * Tests Oz_Deepzoom_Descriptor->getNumTiles() */ public function testInvalidGetNumTiles() { try { $this->_descriptor->getNumTiles(-1); } catch (Oz_Deepzoom_Exception $e) { $this->assertTrue('Invalid pyramid level (NumTiles)' === $e->getMessage()); return; } $this->fail(); return; }