/** * Renders a map type control. * * @param \Ivory\GoogleMap\Controls\MapTypeControl $mapTypeControl The map type control. * * @return string The JS output. */ public function render(MapTypeControl $mapTypeControl) { $this->jsonBuilder->reset(); foreach ($mapTypeControl->getMapTypeIds() as $index => $mapTypeId) { $this->jsonBuilder->setValue(sprintf('[mapTypeIds][%d]', $index), $this->mapTypeIdHelper->render($mapTypeId), false); } return $this->jsonBuilder->setValue('[position]', $this->controlPositionHelper->render($mapTypeControl->getControlPosition()), false)->setValue('[style]', $this->mapTypeControlStyleHelper->render($mapTypeControl->getMapTypeControlStyle()), false)->build(); }
/** * @expectedException \Ivory\GoogleMap\Exception\HelperException * @expectedExceptionMessage The control position can only be : bottom_center, bottom_left, bottom_right, * left_bottom, left_center, left_top, right_bottom, right_center, right_top, top_center, top_left, top_right. */ public function testRenderWithInvalidValue() { $this->controlPositionHelper->render('foo'); }
/** * Renders a rotate control. * * @param \Ivory\GoogleMap\Controls\RotateControl $rotateControl The rotate control. * * @return string The JS output. */ public function render(RotateControl $rotateControl) { return $this->jsonBuilder->reset()->setValue('[position]', $this->controlPositionHelper->render($rotateControl->getControlPosition()), false)->build(); }
/** * Renders a zoom control. * * @param \Ivory\GoogleMap\Controls\ZoomControl $zoomControl The zoom control. * * @return string The JS output. */ public function render(ZoomControl $zoomControl) { return $this->jsonBuilder->reset()->setValue('[position]', $this->controlPositionHelper->render($zoomControl->getControlPosition()), false)->setValue('[style]', $this->zoomControlStyleHelper->render($zoomControl->getZoomControlStyle()), false)->build(); }