/** * Renders the bound's extend of a marker * * @param Ivory\GoogleMapBundle\Model\Base\Bound $bound * @return string HTML output */ public function renderExtends(Bound $bound) { $html = array(); foreach ($bound->getExtends() as $extend) { if ($extend instanceof Overlays\Marker || $extend instanceof Overlays\InfoWindow) { $html[] = sprintf('%s.extend(%s.getPosition());' . PHP_EOL, $bound->getJavascriptVariable(), $extend->getJavascriptVariable()); } else { if ($extend instanceof Overlays\Polyline || $extend instanceof Overlays\EncodedPolyline || $extend instanceof Overlays\Polygon) { $html[] = sprintf('%s.getPath().forEach(function(element){%s.extend(element)});' . PHP_EOL, $extend->getJavascriptVariable(), $bound->getJavascriptVariable()); } else { if ($extend instanceof Overlays\Rectangle || $extend instanceof Overlays\GroundOverlay) { $html[] = sprintf('%s.union(%s);' . PHP_EOL, $bound->getJavascriptVariable(), $extend->getBound()->getJavascriptVariable()); } else { if ($extend instanceof Overlays\Circle) { $html[] = sprintf('%s.union(%s.getBounds());' . PHP_EOL, $bound->getJavascriptVariable(), $extend->getJavascriptVariable()); } } } } } return implode('', $html); }