public function testRender() { $infoWindow = new InfoWindow(); $infoWindow->setPosition(1.1, 2.1, true); $infoWindow->getPosition()->setJavascriptVariable('position'); $infoWindow->setPixelOffset(3, 4, 'px', 'px'); $infoWindow->getPixelOffset()->setJavascriptVariable('pixel_offset'); $infoWindow->setContent('content'); $infoWindow->setOpen(true); $infoWindow->setOptions(array('option1' => 'value1', 'option2' => 'value2')); $expected = $infoWindow->getJavascriptVariable() . ' = new InfoBox({' . '"position":position,' . '"pixelOffset":pixel_offset,' . '"content":"content",' . '"option1":"value1",' . '"option2":"value2"' . '});' . PHP_EOL; $this->assertSame($expected, $this->infoBoxHelper->render($infoWindow, true)); }
protected function getGoogleMapMarkerInfo($markerContent) { $infoWindow = new InfoWindow(); // Configure the info window options $infoWindow->setPrefixJavascriptVariable('info_window_'); $infoWindow->setPosition(0, 0, true); $infoWindow->setPixelOffset(1.1, 2.1, 'px', 'pt'); $infoWindow->setContent($markerContent); $infoWindow->setOpen(false); $infoWindow->setAutoOpen(true); $infoWindow->setOpenEvent(MouseEvent::CLICK); $infoWindow->setAutoClose(false); $infoWindow->setOption('disableAutoPan', true); $infoWindow->setOption('zIndex', 10); $infoWindow->setOptions(array('disableAutoPan' => true, 'zIndex' => 10)); return $infoWindow; }
public function testRenderJsContainerSizes() { $map = new Map(); $map->setJavascriptVariable('map'); $map->addInfoWindow($mapInfoWindow = new InfoWindow()); $mapInfoWindow->setPixelOffset(1, 2); $mapInfoWindow->getPixelOffset()->setJavascriptVariable('map_info_winfow_pixel_offset'); $map->addMarker($marker = new Marker()); $marker->setInfoWindow($markerInfoWindow = new InfoWindow()); $markerInfoWindow->setPixelOffset(1, 2); $markerInfoWindow->getPixelOffset()->setJavascriptVariable('marker_info_window_pixel_offset'); $marker->setIcon('url'); $marker->getIcon()->setSize(1, 2); $marker->getIcon()->getSize()->setJavascriptVariable('marker_icon_size'); $marker->getIcon()->setScaledSize(1, 2); $marker->getIcon()->getScaledSize()->setJavascriptVariable('marker_icon_scaled_size'); $marker->setShadow('url'); $marker->getShadow()->setSize(1, 2); $marker->getShadow()->getSize()->setJavascriptVariable('marker_shadow_size'); $marker->getShadow()->setScaledSize(1, 2); $marker->getShadow()->getScaledSize()->setJavascriptVariable('marker_shadow_scaled_size'); $expected = <<<EOF map_container.sizes.map_info_winfow_pixel_offset = map_info_winfow_pixel_offset = new google.maps.Size(1, 2); map_container.sizes.marker_info_window_pixel_offset = marker_info_window_pixel_offset = new google.maps.Size(1, 2); map_container.sizes.marker_icon_size = marker_icon_size = new google.maps.Size(1, 2); map_container.sizes.marker_icon_scaled_size = marker_icon_scaled_size = new google.maps.Size(1, 2); map_container.sizes.marker_shadow_size = marker_shadow_size = new google.maps.Size(1, 2); map_container.sizes.marker_shadow_scaled_size = marker_shadow_scaled_size = new google.maps.Size(1, 2); EOF; $this->assertSame($expected, $this->mapHelper->renderJsContainerSizes($map)); }
/** * Crée une fenêtre d'information pour un marker * @param $fiche, la fiche pour laquelle il créer une fenêtre d'informations * @return InfoWindow * @throws \Ivory\GoogleMap\Exception\AssetException * @throws \Ivory\GoogleMap\Exception\OverlayException */ public function InfoWindowMarker($fiche) { $infoWindow = new InfoWindow(); $infoWindow->setPrefixJavascriptVariable('info_window_'); $infoWindow->setPosition($fiche->getLatitude(), $fiche->getLongitude(), true); $infoWindow->setPixelOffset(1.1, 2.1, 'px', 'pt'); $infoWindow->setOpen(false); $infoWindow->setAutoOpen(true); $infoWindow->setOpenEvent('mouseover'); $infoWindow->setAutoClose(true); $infoWindow->setOption('disableAutoPan', true); $infoWindow->setOptions(array('disableAutoPan' => true, 'zIndex' => 10)); return $infoWindow; }
/** * @expectedException \Ivory\GoogleMap\Exception\OverlayException * @expectedExceptionMessage The pixel offset setter arguments is invalid. * The available prototypes are : * - function setPixelOffset(Ivory\GoogleMap\Base\Size $scaledSize) * - function setPixelOffset(double $width, double $height, string $widthUnit = null, string $heightUnit = null) */ public function testPixedOffsetWithInvalidValue() { $this->infoWindow->setPixelOffset('foo'); }