/** * @param array $params */ public function configure(array $params = array()) { $etag = array(); $mapmode = 'world'; if (isset($params['mapmode'])) { $mapmode = $params['mapmode']; // set coordinate mode early as points are converted to image coords if ($mapmode == 'server') { // 1:1 projection $this->map->getProjection()->setWorldZones(array('grid' => array(array(0, 47520), array(108000, 0)))); } } $mapname = 'atys'; if (isset($params['maptype'])) { $val = $params['maptype']; switch ($val) { case 'atys': $mapname = $val; break; case 'satellite': // @deprecated // @deprecated case 'atys_sp': $mapname = 'atys_sp'; break; default: // invalid, ignore } } $etag[] = $mapmode . $mapname; $this->map->getTileStorage()->setMapMode($mapmode, $mapname); $this->map->setSize(256, 256); $this->map->setMapMode($mapmode); $this->map->setMapName($mapname); // if ryzom ingame browser is used, then set default format to png if (isset($_SERVER['HTTP_USER_AGENT']) && strstr($_SERVER['HTTP_USER_AGENT'], 'Ryzom')) { $this->map->setFormat('png'); } // parse rest of url foreach ($params as $var => $val) { $found = true; switch ($var) { case 'zoom': $this->map->setZoom($val); break; case 'maxzoom': $this->map->setMaxZoom($val); break; case 'center': $center = $this->parseLocation($val); if ($center) { $this->map->setCenter($center); } break; case 'size': $tmp = explode('x', $val); if (!isset($tmp[1])) { $tmp[1] = (int) $tmp[0]; } $width = min((int) $tmp[0], self::MAX_WIDTH); $height = min((int) $tmp[1], self::MAX_HEIGHT); $this->map->setSize($width, $height); // modify value for etag $val = $width . 'x' . $height; break; case 'markers': $markers = $this->parseMarker($val); $this->map->addMarkers($markers); break; case 'path': $polys = $this->parsePolygon($val); $this->map->addPolygons($polys); break; case 'format': $this->map->setFormat($val); break; case 'lang': case 'language': $this->map->setLanguage($val); break; default: $found = false; break; } if ($found) { $etag[] = $val; } } $this->etag = sha1(serialize($etag)); }