/** * Renders the bound * * @param Ivory\GoogleMapBundle\Model\Base\Bound $bound * @return string HTML output */ public function render(Bound $bound) { $html = array(); if ($bound->hasExtends() || !$bound->hasCoordinates()) { $html[] = sprintf('var %s = new google.maps.LatLngBounds();' . PHP_EOL, $bound->getJavascriptVariable()); if ($bound->hasExtends()) { $html[] = $this->renderExtends($bound); } } else { $html[] = sprintf('var %s = new google.maps.LatLngBounds(%s, %s);' . PHP_EOL, $bound->getJavascriptVariable(), $this->coordinateHelper->render($bound->getSouthWest()), $this->coordinateHelper->render($bound->getNorthEast())); } return implode('', $html); }
/** * Renders the map javascript center * * @param Ivory\GoogleMapBundle\Model\Map $map * @return string HTML output */ public function renderCenter(Map $map) { return sprintf('%s.setCenter(%s);' . PHP_EOL, $map->getJavascriptVariable(), $this->coordinateHelper->render($map->getCenter())); }