コード例 #1
1
 public function testPolylineWithoutAutoZoom()
 {
     $polyline = $this->getMock('Ivory\\GoogleMap\\Overlays\\Polyline');
     $this->setUpBound();
     $this->map->getBound()->expects($this->never())->method('extend');
     $this->map->addPolyline($polyline);
     $this->assertSame(array($polyline), $this->map->getPolylines());
 }
コード例 #2
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;
 }
コード例 #3
0
 /**
  * Renders the javascript container polylines.
  *
  * @param \Ivory\GoogleMap\Map $map The map.
  *
  * @return string The JS output.
  */
 public function renderJsContainerPolylines(Map $map)
 {
     $output = array();
     foreach ($map->getPolylines() as $polyline) {
         $output[] = sprintf('%s.polylines.%s = %s', $this->getJsContainerName($map), $polyline->getJavascriptVariable(), $this->polylineHelper->render($polyline, $map));
     }
     return implode('', $output);
 }