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);*/ }
/** * * * @param Map $map * @param Conf $conf */ public function __construct($map, Conf $conf) { $this->_map = $map; $this->_layout = ScaleBarLayout::factory($conf->get('scale_bar_layout')); }