Exemplo n.º 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');
 }
<?php

/**
 * Teste la sauvegarde d'équipes dans le backend
 * @author fabriceb
 * @since Feb 16, 2009 fabriceb
 */
include dirname(__FILE__) . '/../bootstrap/unit.php';
$t = new lime_test(15, new lime_output_color());
$t->diag('GMapGeocodedAddress Tests');
$gAddress = new GMapGeocodedAddress('60 rue de Seine, Paris');
$t->diag('->getRawAddress');
$t->is($gAddress->getRawAddress(), '60 rue de Seine, Paris', '->getRawAddress ok');
require_once dirname(__FILE__) . '/../../lib/GMapClientTestCache.class.php';
$gMapClient = new GMapClient('test');
$gMapClientTestCache = new GMapClientTestCache();
$gMapClient->setCache($gMapClientTestCache);
$t->diag('->geocode');
$t->is($gAddress->geocode($gMapClient), 8, 'Geocoded returned accuracy 8');
$t->is($gAddress->getLat(), 48.853795, 'Lat ok');
$t->is($gAddress->getLng(), 2.3369433, 'Lng ok');
$t->is($gAddress->getAccuracy(), 8, 'Accuracy ok');
$t->is($gAddress->geocodeXml($gMapClient), 8, 'Geocoded returned accuracy 8');
$t->is($gAddress->getLat(), 48.853795, 'Lat ok');
$t->is($gAddress->getLng(), 2.3369433, 'Lng ok');
$t->is($gAddress->getAccuracy(), 8, 'Accuracy ok');
$t->is($gAddress->getGeocodedAddress(), '60 Rue de Seine, 75006 Paris, France', 'Normalized address ok');
$t->is($gAddress->getGeocodedCity(), 'Paris', 'Normalized City ok');
$t->is($gAddress->getGeocodedCountry(), 'France', 'Normalized Country ok');
$t->is($gAddress->getGeocodedCountryCode(), 'FR', 'Normalized Country code ok');
$t->is($gAddress->getGeocodedPostalCode(), '75006', 'Normalized postal code ok');