Example #1
0
 /**
  * Generate the static map image and add blips to it if any are found
  *
  * @return ImageInterface The resulting image
  *
  * @return void
  */
 public function generate()
 {
     $box = Geo::calculateBox($this->size, $this->centerPoint);
     $this->resultImage = $this->imagine->create($box['base']);
     $jj = 0;
     $xStart = $box['tiles']['start']->getX();
     $xStop = $box['tiles']['stop']->getX();
     $yStart = $box['tiles']['start']->getY();
     $yStop = $box['tiles']['stop']->getY();
     for ($i = $yStart - 1; $i < $yStop; $i++) {
         $ii = 0;
         for ($j = $xStart - 1; $j < $xStop; $j++) {
             $this->addTile($this->tiles->getTile($j, $i), new Point($ii * Geo::TILE_SIZE, $jj * Geo::TILE_SIZE));
             $ii++;
         }
         $jj++;
     }
     $this->loader->run();
     $this->resultImage->crop($box['crop'], $this->size);
     foreach ($this->blips as $blip) {
         $this->drawBlip($blip);
     }
     $this->loader->run();
     return $this->resultImage;
 }