/** * Renders the map type control * * @param Ivory\GoogleMapBundle\Model\Controls\MapTypeControl $mapTypeControl * @return string HTML output */ public function render(MapTypeControl $mapTypeControl) { $mapTypeIds = array(); foreach ($mapTypeControl->getMapTypeIds() as $mapTypeId) { $mapTypeIds[] = $this->mapTypeIdHelper->render($mapTypeId); } return sprintf('{"mapTypeIds":[%s],"position":%s,"style":%s}', implode(', ', $mapTypeIds), $this->controlPositionHelper->render($mapTypeControl->getControlPosition()), $this->mapTypeControlStyleHelper->render($mapTypeControl->getMapTypeControlStyle())); }
/** * Checks the render method */ public function testRender() { $this->assertEquals(self::$controlPositionHelper->render(ControlPosition::BOTTOM_CENTER), 'google.maps.ControlPosition.BOTTOM_CENTER'); $this->assertEquals(self::$controlPositionHelper->render(ControlPosition::BOTTOM_LEFT), 'google.maps.ControlPosition.BOTTOM_LEFT'); $this->assertEquals(self::$controlPositionHelper->render(ControlPosition::BOTTOM_RIGHT), 'google.maps.ControlPosition.BOTTOM_RIGHT'); $this->assertEquals(self::$controlPositionHelper->render(ControlPosition::LEFT_BOTTOM), 'google.maps.ControlPosition.LEFT_BOTTOM'); $this->assertEquals(self::$controlPositionHelper->render(ControlPosition::LEFT_CENTER), 'google.maps.ControlPosition.LEFT_CENTER'); $this->assertEquals(self::$controlPositionHelper->render(ControlPosition::LEFT_TOP), 'google.maps.ControlPosition.LEFT_TOP'); $this->assertEquals(self::$controlPositionHelper->render(ControlPosition::RIGHT_BOTTOM), 'google.maps.ControlPosition.RIGHT_BOTTOM'); $this->assertEquals(self::$controlPositionHelper->render(ControlPosition::RIGHT_CENTER), 'google.maps.ControlPosition.RIGHT_CENTER'); $this->assertEquals(self::$controlPositionHelper->render(ControlPosition::RIGHT_TOP), 'google.maps.ControlPosition.RIGHT_TOP'); $this->assertEquals(self::$controlPositionHelper->render(ControlPosition::TOP_CENTER), 'google.maps.ControlPosition.TOP_CENTER'); $this->assertEquals(self::$controlPositionHelper->render(ControlPosition::TOP_LEFT), 'google.maps.ControlPosition.TOP_LEFT'); $this->assertEquals(self::$controlPositionHelper->render(ControlPosition::TOP_RIGHT), 'google.maps.ControlPosition.TOP_RIGHT'); $this->setExpectedException('InvalidArgumentException'); self::$controlPositionHelper->render('foo'); }
/** * Renders the scale control * * @param Ivory\GoogleMapBundle\Model\Controls\ScaleControl $scaleControl * @return string HTML output */ public function render(ScaleControl $scaleControl) { return sprintf('{"position":%s,"style":%s}', $this->controlPositionHelper->render($scaleControl->getControlPosition()), $this->scaleControlStyleHelper->render($scaleControl->getScaleControlStyle())); }