/** * Renders the map javascript circle * * @param Ivory\GoogleMapBundle\Model\Overlays\Circle $circle * @param Ivory\GoogleMapBundle\Model\Map $map */ public function render(Circle $circle, Map $map) { $circleOptions = array_merge(array('radius' => $circle->getRadius()), $circle->getOptions()); $circleJSONOptions = sprintf('{"map":%s,"center":%s,', $map->getJavascriptVariable(), $this->coordinateHelper->render($circle->getCenter())); $circleJSONOptions .= substr(json_encode($circleOptions), 1); return sprintf('var %s = new google.maps.Circle(%s);' . PHP_EOL, $circle->getJavascriptVariable(), $circleJSONOptions); }