Пример #1
0
 public function __construct(ImagineInterface $imagine, $zoom, Box $size, LatLng $center, Tiles $tiles, LoaderInterface $loader = null)
 {
     $this->imagine = $imagine;
     $this->zoom = $zoom;
     $this->size = $size;
     $this->center = $center;
     $this->centerPoint = Geo::calculatePoint($this->center, $this->zoom);
     $this->tiles = $tiles;
     if ($loader === null) {
         $loader = new Simple();
     }
     $this->loader = $loader;
     $this->tiles->setLoader($this->loader);
 }
Пример #2
0
 /**
  * Calculate the position of the blip on the map image.
  *
  * @param Point   $center Point on the image.
  * @param Box     $size   Size of the image.
  * @param integer $zoom   Zoom level of the map.
  *
  * @return Point
  */
 public function calculatePosition(Point $center, Box $size, $zoom)
 {
     $topLeft = new Point($center->getX() - $size->getWidth() / 2, $center->getY() - $size->getHeight() / 2);
     $blipPoint = Geo::calculatePoint($this->latLng, $zoom);
     return new Point($blipPoint->getX() - $topLeft->getX() - $this->imageSize[0] / 2, $blipPoint->getY() - $topLeft->getY() - $this->imageSize[1] / 2);
 }