コード例 #1
0
 /**
  * create appropriate MapProcessor
  *
  * @param MapRequest $mapData
  * @return MapProcessor
  */
 public static function factory(MapRequest $mapData)
 {
     $tileSource = new TileSource(DatabaseServer::getServer($mapData->getType()));
     $tileSource->useCache(!$mapData->issetReloadParam());
     if (!is_null($mapData->getCenterPoint()) && !is_null($mapData->getWidth()) && !is_null($mapData->getHeight())) {
         return new MapProcessorFromCenterPoint($mapData, $tileSource);
     } else {
         if (!is_null($mapData->getLeftUpCornerPoint()) && !is_null($mapData->getRightDownCornerPoint()) && !is_null($mapData->getZoom())) {
             return new MapProcessorFromBoundaryBoxZoom($mapData, $tileSource);
         } else {
             if (!is_null($mapData->getLeftUpCornerPoint()) && !is_null($mapData->getRightDownCornerPoint())) {
                 return new MapProcessorFromBoundaryBoxWidthHeight($mapData, $tileSource);
             }
         }
     }
     throw new NoMapProcessorException("No map processor has been choosen");
 }