コード例 #1
0
 /**
  * Renders a marker.
  *
  * @param Ivory\GoogleMap\Overlays\Marker $marker The marker.
  * @param Ivory\GoogleMap\Map             $map    The map.
  *
  * @return string The JS output.
  */
 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());
 }
コード例 #2
0
 /**
  * @expectedException \Ivory\GoogleMap\Exception\HelperException
  * @expectedExceptionMessage The animation can only be : bounce, drop.
  */
 public function testRenderWithInvalidValue()
 {
     $this->animationHelper->render('foo');
 }