コード例 #1
0
 /**
  * concatenate tiles to one map
  *
  * @param array $tiles
  * @return Map
  */
 protected function _concatenateTiles($tiles)
 {
     $height = count($tiles) * $this->_tileSource->getTileWidth();
     $width = count($tiles[0]) * $this->_tileSource->getTileHeight();
     $imageHandler = $this->_tileSource->getImageHandler();
     $mapImage = $imageHandler->createImage($width, $height);
     $y = 0;
     $firstTile = $tiles[0][0];
     foreach ($tiles as $rowKey => $row) {
         $x = 0;
         foreach ($row as $tileKey => $tile) {
             imagecopy($mapImage, $tile->getImage(), $x, $y, 0, 0, $this->_tileSource->getTileWidth(), $this->_tileSource->getTileHeight());
             $x += $this->_tileSource->getTileWidth();
         }
         $y += $this->_tileSource->getTileHeight();
     }
     $map = new Map($mapImage);
     $leftUp = $firstTile->getLeftUpCorner();
     $map->setLeftUpCorner($leftUp['lon'], $leftUp['lat']);
     $map->setWorldMap($this->_worldMap);
     $map->setImageHandler($this->_tileSource->getImageHandler());
     return $map;
 }