public function render(Polyline $polyline, Map $map)
    {
        $this->jsonBuilder
            ->reset()
            ->setValue('[map]', $map->getJavascriptVariable(), false)
            ->setValue('[path]', array());

        foreach ($polyline->getCoordinates() as $index => $coordinate) {
            $this->jsonBuilder->setValue(sprintf('[path][%d]', $index), $coordinate->getJavascriptVariable(), false);
        }

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

        return sprintf(
            '%s = new google.maps.Polyline(%s);'.PHP_EOL,
            $polyline->getJavascriptVariable(),
            $this->jsonBuilder->build()
        );
    }
public function render(Polyline $polyline, Map $map)
    {
        $this->jsonBuilder
            ->reset()
            ->setValue('[map]', $map->getJavascriptVariable(), false)
            ->setValue('[path]', array());

        foreach ($polyline->getCoordinates() as $index => $coordinate) {
            $this->jsonBuilder->setValue(sprintf('[path][%d]', $index), $coordinate->getJavascriptVariable(), false);
        }

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

        return sprintf(
            '%s = new google.maps.Polyline(%s);'.PHP_EOL,
            $polyline->getJavascriptVariable(),
            $this->jsonBuilder->build()
        );
    }
public function render ( Polyline $ polyline , Map $ map ) { $ this -> jsonBuilder -> reset ( ) -> setValue ( '[map]' , $ map -> getJavascriptVariable ( ) , false ) -> setValue ( '[path]' , array ( ) ) ; foreach ( $ polyline -> getCoordinates ( ) as $ index => $ coordinate ) { $ this -> jsonBuilder -> setValue ( sprintf ( '[path][%d]' , $ index ) , $ coordinate -> getJavascriptVariable ( ) , false ) ; } $ this -> jsonBuilder -> setValues ( $ polyline -> getOptions ( ) ) ; return sprintf ( '%s = new google.maps.Polyline(%s);' . PHP_EOL , $ polyline -> getJavascriptVariable ( ) , $ this -> jsonBuilder -> build ( ) ) ; }
Renders a polyline.

@param \Ivory\GoogleMap\Overlays\Polyline $polyline The polyline.
@param \Ivory\GoogleMap\Map               $map      The map.

@return string The JS output.
Renders a polyline .