/** * prepare object to create output map * */ protected function _prepareToCreateMap() { $rightDownCorner = $this->_mapData->getRightDownCornerPoint(); $leftUpCorner = $this->_mapData->getLeftUpCornerPoint(); while ($rightDownCorner['lon'] <= $leftUpCorner['lon']) { $rightDownCorner['lon'] += 360; } $this->_mapData->setRightDownCornerPoint($rightDownCorner); $this->_setUpSizeOfTheResultMap(); parent::_prepareToCreateMap(); }
public function execute() { $this->_configure(); try { $mapRequest = new MapRequest($this->_get); $leftUpCorner = $mapRequest->getLeftUpCornerPoint(); $rightDownCorner = $mapRequest->getRightDownCornerPoint(); $mapProcessor = MapProcessor::factory($mapRequest); // create map object $bboxRespons = BboxRespons::factory($mapRequest->getBboxReturnType()); $mapProcessor->getTileSource()->useImages($bboxRespons == null); $map = $mapProcessor->createMap($bboxRespons); if ($bboxRespons != null) { $bboxRespons->setData($map); $bboxRespons->send(); die; } $map->setImageHandler(ImageHandler::factory($mapRequest->getImageType())); $drawHandle = new DrawHandle($map); $drawRequest = new DrawRequest($mapRequest); $drawHandle->draw($drawRequest); $mapWithLogo = new LogoMap($map, $this->_conf); $mapWithLogo->setLogoLayout(LogoLayout::factoryFromUrl($mapRequest->getLogoLayoutName())); $scaleBar = new ScaleBar($mapWithLogo, $this->_conf); $scaleBar->setUnit($mapRequest->getScaleBarUnit()); $scaleBar->putOnMap(ScaleBarLayout::factoryFromUrl($mapRequest->getScaleBarLayoutName())); // send output image $mapWithLogo->send(); die; } catch (NoMapProcessorException $e) { $map = new WrongRequestMap($this->_conf->get('wrong_map_request_file')); $map->send(); die; } catch (WrongMapRequestDataException $e) { $map = new WrongRequestMap($this->_conf->get('wrong_map_request_file')); $map->send(); die; } /* header('Content-Type: image/png'); $img = imagecreatefrompng('http://tile.openstreetmap.org/12/2048/1362.png'); imagepng($img);*/ }
public function __construct(MapRequest $mapData, TileSource $source) { $this->_requestValidator = new RequestValidatorFromCenterPoint($mapData, $source); parent::__construct($mapData, $source); }