/** * check if map zoom is given coorect * * @return bool */ protected function _checkZoom() { $zoom = $this->_mapData->getZoom(); $minZoom = $this->_tileSource->getMinZoom(); $maxZoom = $this->_tileSource->getMaxZoom(); if (is_null($zoom) || !is_numeric($zoom) || $zoom < $minZoom || $zoom > $maxZoom) { return false; } return true; }
/** * create result image from given temporary image * * @param resource $image * @param int $leftUpX x-coordinate of the left up corner of the new image * @param int $leftUpY y-coordinate of the left up corner of the new image * @param int $width width of the new image * @param int $height of the new image * @return resource */ protected function _createResultMapImage($image, $leftUpX, $leftUpY, $width, $height) { if ($leftUpY < 0) { $height += $leftUpY; $leftUpY = 0; } $imageWidth = imagesx($image); $imageHeight = imagesy($image); if ($leftUpY + $height > $imageHeight) { $height = $imageHeight - $leftUpY; } $newImage = $this->_tileSource->getImageHandler()->createImage($width, $height); imagecopy($newImage, $image, 0, 0, $leftUpX, $leftUpY, $width, $height); return $newImage; }
protected function _run() { $this->_tile = $this->_tileSource->getTile($this->_tileNumbers['x'], $this->_tileNumbers['y'], $this->_worldMap->getZoom()); $this->_isLoaded = true; }
/** * it starts loading the tile image * */ public function start() { $this->_tile = $this->_tileSource->getTile($this->_tileData['x'], $this->_tileData['y'], $this->_tileData['zoom']); $this->_isLoaded = true; }