public function __construct(Map $map, Conf $conf)
 {
     $this->setImageHandler($map->getImageHandler());
     $this->_logoLayout = LogoLayout::factory($conf->get('logo_layout'));
     $this->_logoFiles = $conf->get('logo_files');
     $this->setWorldMap($map->getWorldMap());
     $leftUpCorner = $map->getLeftUpCorner();
     $this->setLeftUpCorner($leftUpCorner['lon'], $leftUpCorner['lat']);
     $rightDownCorner = $map->getRightDownCorner();
     $this->setRightDownCorner($rightDownCorner['lon'], $rightDownCorner['lat']);
     parent::__construct($map->getImage());
 }
 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);*/
 }