コード例 #1
0
 /**
  * Multiple GMapInfoWindow sample
  *
  * @author Vincent Guillon <*****@*****.**>
  * @since 2010-03-04
  */
 public function executeSample10()
 {
     // Initialize the google map
     $gMap = new GMap();
     $markers = array(new GMapMarker(51.245475, 6.821373), new GMapMarker(46.262248, 6.115969), new GMapMarker(48.848959, 2.341577), new GMapMarker(48.718952, 2.21918), new GMapMarker(47.37642, 8.547995));
     foreach ($markers as $marker) {
         // Reverse geocoding of the center of the map
         $geocoded_addr = new GMapGeocodedAddress(null);
         $geocoded_addr->setLat($marker->getLat());
         $geocoded_addr->setLng($marker->getLng());
         $geocoded_addr->reverseGeocode($gMap->getGMapClient());
         $info_window = new GMapInfoWindow('<div>' . $geocoded_addr->getRawAddress() . '</div>');
         $marker->addHtmlInfoWindow($info_window);
         $gMap->addMarker($marker);
     }
     // Center the map on marker width 0.3 margin
     $gMap->centerAndZoomOnMarkers(0.3);
     $this->gMap = $gMap;
     $this->setTemplate('sample1');
     // END OF ACTION
     $this->message = 'Multiple info window : click marker to open info window';
     $this->action_source = $this->functionToString('executeSample10');
 }