public function testMarker()
 {
     $marker = $this->getMock('Ivory\\GoogleMap\\Overlays\\Marker');
     $this->markerCluster->setMarkers(array($marker));
     $this->assertTrue($this->markerCluster->hasMarkers());
     $this->assertSame(array($marker), $this->markerCluster->getMarkers());
 }
 /**
  * {@inheritdoc}
  */
 public function renderMarkers(MarkerCluster $markerCluster, Map $map)
 {
     $output = array();
     foreach ($markerCluster->getMarkers() as $marker) {
         $output[] = $this->renderMarker($marker, $map);
         if ($marker->hasInfoWindow() && $marker->getInfoWindow()->isAutoOpen()) {
             $this->registerInfoWindowEvent($marker, $map);
         }
     }
     return implode('', $output);
 }
Example #3
0
 /**
  * Add a map marker.
  *
  * @param \Ivory\GoogleMap\Overlays\Marker $marker The marker to add.
  */
 public function addMarker(Marker $marker)
 {
     $this->markerCluster->addMarker($marker);
     if ($this->autoZoom) {
         $this->bound->extend($marker);
     }
 }
 /**
  * {@inheritdoc}
  */
 public function render(MarkerCluster $markerCluster, Map $map)
 {
     $this->jsonBuilder->reset()->setValues($markerCluster->getOptions());
     return sprintf('%s = new MarkerClusterer(%s, %s, %s);' . PHP_EOL, $markerCluster->getJavascriptVariable(), $map->getJavascriptVariable(), sprintf('%s.functions.to_array(%s.markers)', $this->getJsContainerName($map), $this->getJsContainerName($map)), $this->jsonBuilder->build());
 }