コード例 #1
0
 /**
  * method checks if height of the t
  *
  * @return bool
  */
 protected function _checkHeight()
 {
     $height = $this->_mapData->getHeight();
     if (is_null($height) || !is_numeric($height) || $height <= 0) {
         return false;
     }
     return true;
 }
コード例 #2
0
 /**
  * return array of MarkPoints objects
  *
  * @return array
  */
 public function getMarkPoints()
 {
     $points = array();
     $string = $this->_mapRequest->getMarkPoints();
     if (is_null($string)) {
         return array();
     }
     $pointsString = explode(self::$drawObjectDelimeter, $string);
     foreach ($pointsString as $pointString) {
         $coordinates = explode(self::$paramDelimeter, $pointString);
         $i = 0;
         foreach ($coordinates as $value) {
             if ($i == 0 && is_numeric($value)) {
                 $lon = $value;
                 $i++;
             } else {
                 if (is_numeric($value)) {
                     $addPoint = new DrawMarkPoint($lon, $value);
                     $points[] = $addPoint;
                     $i = 0;
                 } else {
                     if (isset($addPoint)) {
                         $param = ParamFactory::create($value);
                         $addPoint->setParam($param);
                     }
                 }
             }
         }
     }
     return $points;
 }
コード例 #3
0
 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);*/
 }
コード例 #4
0
 /**
  * create output map from the temoporary one
  *
  * @param Map $map
  */
 private function _prepareOutputMap($map)
 {
     $image = $map->getImage();
     $outputMapLeftUpInPixels = $this->_getLeftUpCornerForCutingResultMap($map);
     $resultMap = new Map($this->_createResultMapImage($image, $outputMapLeftUpInPixels['x'], $outputMapLeftUpInPixels['y'], $this->_mapData->getWidth(), $this->_mapData->getHeight()));
     $this->_setUpResultMapCorners($resultMap);
     $resultMap->setWorldMap($this->_worldMap);
     $resultMap->setImageHandler($this->_tileSource->getImageHandler());
     return $resultMap;
 }