Exemplo n.º 1
0
 public function setMapProjection($proj)
 {
     if (!$proj) {
         return;
     }
     parent::setMapProjection($proj);
     //$this->mapProjection = $proj;
     $this->unitsPerMeter = null;
     // arbitrarily set initial bounding box to the center (1/10)^2 of the containing map
     $bbox = $this->wmsParser->getBBoxForProjection($this->mapProjection);
     $xrange = $bbox['xmax'] - $bbox['xmin'];
     $yrange = $bbox['ymax'] - $bbox['ymin'];
     $bbox['xmin'] += 0.4 * $xrange;
     $bbox['xmax'] -= 0.4 * $xrange;
     $bbox['ymin'] += 0.4 * $yrange;
     $bbox['ymax'] -= 0.4 * $yrange;
     $this->bbox = $bbox;
     $this->zoomLevel = oldPixelZoomLevelForScale($this->getCurrentScale());
     $this->center = array('lat' => ($this->bbox['ymin'] + $this->bbox['ymax']) / 2, 'lon' => ($this->bbox['xmin'] + $this->bbox['xmax']) / 2);
 }
Exemplo n.º 2
0
 protected function zoomLevelForScale($scale)
 {
     // not sure if ceil is the right rounding in both cases
     if ($scale == self::NO_PROJECTION) {
         $range = $this->getHorizontalRange();
         return ceil(log(360 / $range, 2));
     } else {
         return oldPixelZoomLevelForScale($scale);
     }
 }