コード例 #1
0
 public function testZoomControlWithZoomControlParameters()
 {
     $controlPosition = ControlPosition::BOTTOM_CENTER;
     $zoomControlStyle = ZoomControlStyle::LARGE;
     $this->map->setZoomControl($controlPosition, $zoomControlStyle);
     $this->assertSame($controlPosition, $this->map->getZoomControl()->getControlPosition());
     $this->assertSame($zoomControlStyle, $this->map->getZoomControl()->getZoomControlStyle());
     $this->assertTrue($this->map->getMapOption('zoomControl'));
 }
コード例 #2
0
 /**
  * Renders a map control in the json builder.
  *
  * @param \Ivory\GoogleMap\Map $map           The map.
  * @param string               $controlName   The control name.
  * @param mixed                $controlHelper The control helper.
  */
 protected function renderMapControl(Map $map, $controlName, $controlHelper)
 {
     $lcFirstControlName = lcfirst($controlName);
     if (!$map->hasMapOption($lcFirstControlName)) {
         return;
     }
     $this->jsonBuilder->setValue(sprintf('[%s]', $lcFirstControlName), (bool) $map->getMapOption($lcFirstControlName));
     if ($map->getMapOption($lcFirstControlName)) {
         $hasControlMethod = 'has' . $controlName;
         if ($map->{$hasControlMethod}()) {
             $getControlMethod = 'get' . $controlName;
             $this->jsonBuilder->setValue(sprintf('[%sOptions]', $lcFirstControlName), $controlHelper->render($map->{$getControlMethod}()), false);
         }
     }
     $map->removeMapOption($lcFirstControlName);
 }