Exemplo n.º 1
0
 public function testRectangleWithoutAutoZoom()
 {
     $rectangle = $this->getMock('Ivory\\GoogleMap\\Overlays\\Rectangle');
     $this->setUpBound();
     $this->map->getBound()->expects($this->never())->method('extend');
     $this->map->addRectangle($rectangle);
     $this->assertSame(array($rectangle), $this->map->getRectangles());
 }
Exemplo n.º 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;
 }