예제 #1
0
 /**
  * @inheritdoc
  */
 public function renderAfter(Map $map)
 {
     // Obtengo todos los marcadores del mapa
     $markers = $map->getMarkers();
     $mapVar = $map->getJavaScriptVariable();
     $polylines = $map->getPolylines();
     $polyVars = array();
     // Obtengo las variables (String) de cada uno de los marcadores y se almacenan en un array.
     $variables = array();
     foreach ($markers as $mark) {
         $variable = $mark->getJavaScriptVariable();
         array_push($variables, $variable);
     }
     // Obtengo las variables de las polylines.
     foreach ($polylines as $polyline) {
         array_push($polyVars, $polyline->getJavaScriptVariable());
     }
     // Guardo las variables en String $ret, para ser el retorno del metodo
     $ret = 'markers = new Array(); map = ' . $mapVar . ';' . ' polylines = new Array();';
     $i = 0;
     foreach ($variables as $variable) {
         $ret = $ret . 'markers[' . $i . '] = ' . $variable . ';' . PHP_EOL;
         $i++;
     }
     $i = 0;
     foreach ($polyVars as $polyline) {
         $ret = $ret . 'polylines[' . $i . '] = ' . $polyline . ';' . PHP_EOL;
     }
     return $ret;
 }
예제 #2
0
 public function testMarkerWithoutAutoZoom()
 {
     $marker = $this->getMock('Ivory\\GoogleMap\\Overlays\\Marker');
     $this->setUpBound();
     $this->map->getBound()->expects($this->never())->method('extend');
     $this->map->addMarker($marker);
     $this->assertSame(array($marker), $this->map->getMarkers());
 }
예제 #3
0
 /**
  * Computes the marker info windows of a map.
  *
  * @param \Ivory\GoogleMap\Map $map The map.
  *
  * @return array The computed marker info windows.
  */
 protected function computeMarkerInfoWindows(Map $map)
 {
     $infoWinfows = array();
     foreach ($map->getMarkers() as $marker) {
         if ($marker->hasInfoWindow() && !in_array($marker->getInfoWindow(), $infoWinfows)) {
             $infoWinfows[] = $marker->getInfoWindow();
         }
     }
     return $infoWinfows;
 }