public function render(Marker $marker, Map $map = null)
    {
        $this->jsonBuilder
            ->reset()
            ->setValue('[position]', $marker->getPosition()->getJavascriptVariable(), false);

        if ($map !== null) {
            $this->jsonBuilder->setValue('[map]', $map->getJavascriptVariable(), false);
        }

        if ($marker->hasAnimation()) {
            $this->jsonBuilder->setValue('[animation]', $this->animationHelper->render($marker->getAnimation()), false);
        }

        if ($marker->hasIcon()) {
            $this->jsonBuilder->setValue('[icon]', $marker->getIcon()->getJavascriptVariable(), false);
        }

        if ($marker->hasShadow()) {
            $this->jsonBuilder->setValue('[shadow]', $marker->getShadow()->getJavascriptVariable(), false);
        }

        if ($marker->hasShape()) {
            $this->jsonBuilder->setValue('[shape]', $marker->getShape()->getJavascriptVariable(), false);
        }

        $this->jsonBuilder->setValues($marker->getOptions());

        return sprintf(
            '%s = new google.maps.Marker(%s);'.PHP_EOL,
            $marker->getJavascriptVariable(),
            $this->jsonBuilder->build()
        );
    }
public function render(Marker $marker, Map $map = null)
    {
        $this->jsonBuilder
            ->reset()
            ->setValue('[position]', $marker->getPosition()->getJavascriptVariable(), false);

        if ($map !== null) {
            $this->jsonBuilder->setValue('[map]', $map->getJavascriptVariable(), false);
        }

        if ($marker->hasAnimation()) {
            $this->jsonBuilder->setValue('[animation]', $this->animationHelper->render($marker->getAnimation()), false);
        }

        if ($marker->hasIcon()) {
            $this->jsonBuilder->setValue('[icon]', $marker->getIcon()->getJavascriptVariable(), false);
        }

        if ($marker->hasShadow()) {
            $this->jsonBuilder->setValue('[shadow]', $marker->getShadow()->getJavascriptVariable(), false);
        }

        if ($marker->hasShape()) {
            $this->jsonBuilder->setValue('[shape]', $marker->getShape()->getJavascriptVariable(), false);
        }

        $this->jsonBuilder->setValues($marker->getOptions());

        return sprintf(
            '%s = new google.maps.Marker(%s);'.PHP_EOL,
            $marker->getJavascriptVariable(),
            $this->jsonBuilder->build()
        );
    }
public function render ( Marker $ marker , Map $ map = null ) { $ this -> jsonBuilder -> reset ( ) -> setValue ( '[position]' , $ marker -> getPosition ( ) -> getJavascriptVariable ( ) , false ) ; if ( $ map !== null ) { $ this -> jsonBuilder -> setValue ( '[map]' , $ map -> getJavascriptVariable ( ) , false ) ; } if ( $ marker -> hasAnimation ( ) ) { $ this -> jsonBuilder -> setValue ( '[animation]' , $ this -> animationHelper -> render ( $ marker -> getAnimation ( ) ) , false ) ; } if ( $ marker -> hasIcon ( ) ) { $ this -> jsonBuilder -> setValue ( '[icon]' , $ marker -> getIcon ( ) -> getJavascriptVariable ( ) , false ) ; } if ( $ marker -> hasShadow ( ) ) { $ this -> jsonBuilder -> setValue ( '[shadow]' , $ marker -> getShadow ( ) -> getJavascriptVariable ( ) , false ) ; } if ( $ marker -> hasShape ( ) ) { $ this -> jsonBuilder -> setValue ( '[shape]' , $ marker -> getShape ( ) -> getJavascriptVariable ( ) , false ) ; } $ this -> jsonBuilder -> setValues ( $ marker -> getOptions ( ) ) ; return sprintf ( '%s = new google.maps.Marker(%s);' . PHP_EOL , $ marker -> getJavascriptVariable ( ) , $ this -> jsonBuilder -> build ( ) ) ; }
Renders a marker.

@param Ivory\GoogleMap\Overlays\Marker $marker The marker.
@param Ivory\GoogleMap\Map             $map    The map.

@return string The JS output.
Renders a marker .