1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
| // JavaScript Document
//<![CDATA[
if (GBrowserIsCompatible()) {
/* -----------------------------------------------*/
/* Zone functions */
/* ---------------------------------------------- */
// Transformation d'une adresse en coordonnées
function showAddress(address) {
if (geocoder) {
geocoder.getLatLng(
address,
function(point) {
if (!point) { // Adresse non connue par Google Maps
alert(address + " not found");
}
else {
var marker = new GMarker(point);
icon.image = points[i]['icon'];
map.addOverlay(new GMarker(point, icon));
i++;
}
}
);
}
};
/* FIN zone functions ------------------------------------------------------- */
// Déclaration des variables
// création de l'objet map
var map = new GMap2(document.getElementById("map"));
map.setCenter(new GLatLng(46.042735, 3.955078),5);
map.addControl(new GLargeMapControl());
map.addControl(new GMapTypeControl());
var geocoder = new GClientGeocoder();
var points = new Array();
var i = 0;
points[0] = new Array();
points[0]['icon'] = "./images/icone_1.png";
points[1] = new Array();
points[1]['icon'] = "./images/icone_2.png";
points[2] = new Array();
points[2]['icon'] = "./images/icone_3.png";
points[3] = new Array();
points[3]['icon'] = "./images/icone_4.png";
/* définition d'une classe d'icône */
var icon = new GIcon();
icon.shadow = "./images/shadow_1.png";
icon.iconSize = new GSize(32, 32);
icon.shadowSize = new GSize(56, 32);
icon.iconAnchor = new GPoint(6, 20);
icon.infoWindowAnchor = new GPoint(5, 1);
}
else {
alert("Sorry, the Google Maps API is not compatible with this browser");
}
//]]> |
Partager