Example #1
0
 public function testGroundOverlayWithoutAutoZoom()
 {
     $groundOverlay = $this->getMock('Ivory\\GoogleMap\\Overlays\\GroundOverlay');
     $this->setUpBound();
     $this->map->getBound()->expects($this->never())->method('extend');
     $this->map->addGroundOverlay($groundOverlay);
     $this->assertSame(array($groundOverlay), $this->map->getGroundOverlays());
 }
Example #2
0
 /**
  * Computes the bounds of a map.
  *
  * @param \Ivory\GoogleMap\Map $map The map.
  *
  * @return array The computed bounds.
  */
 protected function computeBounds(Map $map)
 {
     $bounds = array();
     if ($map->isAutoZoom() && !in_array($map->getBound(), $bounds)) {
         $bounds[] = $map->getBound();
     }
     foreach ($map->getGroundOverlays() as $groundOverlay) {
         if (!in_array($groundOverlay->getBound(), $bounds)) {
             $bounds[] = $groundOverlay->getBound();
         }
     }
     foreach ($map->getRectangles() as $rectangle) {
         if (!in_array($rectangle->getBound(), $bounds)) {
             $bounds[] = $rectangle->getBound();
         }
     }
     return $bounds;
 }