Exemplo n.º 1
0
 /**
  * Renders the javascript container maker images.
  *
  * @param \Ivory\GoogleMap\Map $map The map.
  *
  * @return string The JS output.
  */
 public function renderJsContainerMarkerImages(Map $map)
 {
     $output = array();
     foreach ($this->computeMarkerImages($map) as $markerImage) {
         $output[] = sprintf('%s.marker_images.%s = %s', $this->getJsContainerName($map), $markerImage->getJavascriptVariable(), $this->markerImageHelper->render($markerImage));
     }
     return implode('', $output);
 }
    public function testRender()
    {
        $markerImage = new MarkerImage();
        $markerImage->setJavascriptVariable('markerImage');
        $markerImage->setUrl('url');
        $markerImage->setSize(1, 2);
        $markerImage->getSize()->setJavascriptVariable('size');
        $markerImage->setOrigin(3, 4);
        $markerImage->getOrigin()->setJavascriptVariable('origin');
        $markerImage->setAnchor(5, 6);
        $markerImage->getAnchor()->setJavascriptVariable('anchor');
        $markerImage->setScaledSize(7, 8);
        $markerImage->getScaledSize()->setJavascriptVariable('scaled_size');
        $expected = <<<EOF
markerImage = new google.maps.MarkerImage("url", size, origin, anchor, scaled_size);

EOF;
        $this->assertSame($expected, $this->markerImageHelper->render($markerImage));
    }