/** * Add a ground overlay to the map. * * @param \Ivory\GoogleMapBundle\Model\Overlays\GroupOverlay $groundOverlay The ground overlay to add. */ public function addGroundOverlay(GroundOverlay $groundOverlay) { $this->groundOverlays[] = $groundOverlay; if ($this->autoZoom) { $this->bound->extend($groundOverlay); } }
public function testRenderExtends() { $bound = new Bound(); $bound->setJavascriptVariable('bound'); $circle = $this->getMock('Ivory\\GoogleMap\\Overlays\\Circle'); $circle->expects($this->once())->method('getJavascriptVariable')->will($this->returnValue('circle')); $groundOverlayBound = $this->getMock('Ivory\\GoogleMap\\Base\\Bound'); $groundOverlayBound->expects($this->once())->method('getJavascriptVariable')->will($this->returnValue('groundOverlayBound')); $groundOverlay = $this->getMock('Ivory\\GoogleMap\\Overlays\\GroundOverlay'); $groundOverlay->expects($this->once())->method('getBound')->will($this->returnValue($groundOverlayBound)); $infoWindow = $this->getMock('Ivory\\GoogleMap\\Overlays\\InfoWindow'); $infoWindow->expects($this->once())->method('getJavascriptVariable')->will($this->returnValue('infoWindow')); $marker = $this->getMock('Ivory\\GoogleMap\\Overlays\\Marker'); $marker->expects($this->once())->method('getJavascriptVariable')->will($this->returnValue('marker')); $polygon = $this->getMock('Ivory\\GoogleMap\\Overlays\\Polygon'); $polygon->expects($this->once())->method('getJavascriptVariable')->will($this->returnValue('polygon')); $polyline = $this->getMock('Ivory\\GoogleMap\\Overlays\\Polyline'); $polyline->expects($this->once())->method('getJavascriptVariable')->will($this->returnValue('polyline')); $rectangleBound = $this->getMock('Ivory\\GoogleMap\\Base\\Bound'); $rectangleBound->expects($this->once())->method('getJavascriptVariable')->will($this->returnValue('rectangleBound')); $rectangle = $this->getMock('Ivory\\GoogleMap\\Overlays\\Rectangle'); $rectangle->expects($this->once())->method('getBound')->will($this->returnValue($rectangleBound)); $bound->extend($circle); $bound->extend($groundOverlay); $bound->extend($infoWindow); $bound->extend($marker); $bound->extend($polygon); $bound->extend($polyline); $bound->extend($rectangle); $expected = <<<EOF bound.union(circle.getBounds()); bound.union(groundOverlayBound); bound.extend(infoWindow.getPosition()); bound.extend(marker.getPosition()); polygon.getPath().forEach(function(element){bound.extend(element)}); polyline.getPath().forEach(function(element){bound.extend(element)}); bound.union(rectangleBound); EOF; $this->assertSame($expected, $this->boundHelper->renderExtends($bound)); }