/** * load all tiles * * @param array $leftUpCorner * @param array $rightDownCorner * @return array */ protected function _getTiles($leftUpCorner, $rightDownCorner) { $tiles = array(); $leftUpTilesNumber = $this->_tileSource->getTileNumbersFromCoordinates($leftUpCorner['lon'], $leftUpCorner['lat'], $this->_worldMap->getZoom()); $rightDownTilesNumber = $this->_tileSource->getTileNumbersFromCoordinates($rightDownCorner['lon'], $rightDownCorner['lat'], $this->_worldMap->getZoom()); $tilesGetter = new TilesGetter($leftUpTilesNumber, $rightDownTilesNumber, $this->_tileSource, $this->_worldMap); $tilesGetter->startLoading(); while (!$tilesGetter->isLoaded()) { //wating for finishing loading } return $tilesGetter->getTiles(); }
private function _createTileGettersTable() { $numberOfTilesToLoad = 0; for ($y = $this->_leftUpTileNumbers['y']; $y <= $this->_rightDownTileNumbers['y']; $y++) { $row = array(); $x = $this->_leftUpTileNumbers['x']; while (true) { $tileGetter = new StandardTileGetter($this->_tileSource, $x, $y, $this->_worldMap->getZoom()); $row[] = $tileGetter; $numberOfTilesToLoad++; if ($x == $this->_rightDownTileNumbers['x']) { break; } $x++; } $this->_tileGetters[] = $row; } if ($numberOfTilesToLoad > self::$limitOfTiles) { throw new WrongMapRequestDataException('Too many tiles to load'); } }
protected function _run() { $this->_tile = $this->_tileSource->getTile($this->_tileNumbers['x'], $this->_tileNumbers['y'], $this->_worldMap->getZoom()); $this->_isLoaded = true; }