/**
  * Renders the marker
  *
  * @param Ivory\GoogleMapBundle\Model\Overlays\Marker $marker
  * @param Ivory\GoogleMapBundle\Model\Map $map
  * @return string HTML output
  */
 public function render(Marker $marker, Map $map)
 {
     $html = array();
     $markerJSONOptions = sprintf('{"map":%s,"position":%s', $map->getJavascriptVariable(), $this->coordinateHelper->render($marker->getPosition()));
     $markerOptions = $marker->getOptions();
     if ($marker->hasAnimation()) {
         $markerJSONOptions .= ', "animation":' . $this->animationHelper->render($marker->getAnimation());
     }
     if ($marker->hasIcon()) {
         $html[] = $this->markerImageHelper->render($marker->getIcon());
         $markerJSONOptions .= ', "icon":' . $marker->getIcon()->getJavascriptVariable();
     }
     if ($marker->hasShadow()) {
         $html[] = $this->markerImageHelper->render($marker->getShadow());
         $markerJSONOptions .= ', "shadow":' . $marker->getShadow()->getJavascriptVariable();
     }
     if ($marker->hasShape()) {
         $html[] = $this->markerShapeHelper->render($marker->getShape());
         $markerJSONOptions .= ', "shape":' . $marker->getShape()->getJavascriptVariable();
     }
     if (!empty($markerOptions)) {
         $markerJSONOptions .= ',' . substr(json_encode($markerOptions), 1);
     } else {
         $markerJSONOptions .= '}';
     }
     $html[] = sprintf('var %s = new google.maps.Marker(%s);' . PHP_EOL, $marker->getJavascriptVariable(), $markerJSONOptions);
     if ($marker->hasInfoWindow()) {
         $html[] = $this->infoWindowHelper->render($marker->getInfoWindow(), false);
         if ($marker->getInfoWindow()->isOpen()) {
             $html[] = $this->infoWindowHelper->renderOpen($marker->getInfoWindow(), $map, $marker);
         }
     }
     return implode('', $html);
 }
 /**
  * Renders the map javascript info window
  *
  * @param Ivory\GoogleMapBundle\Model\Map $map
  * @return string HTML output
  */
 public function renderInfoWindows(Map $map)
 {
     $html = array();
     foreach ($map->getInfoWindows() as $infoWindow) {
         $html[] = $this->infoWindowHelper->render($infoWindow);
         if ($infoWindow->isOpen()) {
             $html[] = $this->infoWindowHelper->renderOpen($infoWindow, $map);
         }
     }
     return implode('', $html);
 }