var map; var mgr; var icons = {}; var allmarkers = []; function loadGoogleMap(choixCarte) { var latlng; var nivZoom; if (choixCarte == "Bureau_Touristique") { latlng = new google.maps.LatLng(46.3415649,-72.5406258); nivZoom } if (choixCarte == "Tourisme_Trois_Rivieres") { latlng = new google.maps.LatLng(46.342344, -72.543326); } if (choixCarte == "Plan_Ville_Touristique") { latlng = new google.maps.LatLng(46.3422216,-72.5433579); } var myOptions = { zoom: 15, center: latlng, mapTypeId: google.maps.MapTypeId.ROADMAP, mapTypeControl: false, streetViewControl: true, streetView: pano //mapTypeControlOptions: { // style: google.maps.MapTypeControlStyle.DEFAULT, // mapTypeIds: [] //[google.maps.MapTypeId.ROADMAP,google.maps.MapTypeId.SATELLITE] //} }; map = new google.maps.Map(document.getElementById("map"), myOptions); mgr = new MarkerManager(map); var infoTouristique = createMarker(new google.maps.LatLng(46.3415649,-72.5406258), 105, "info", "Bureau d'information touristique", "/google_maps/icones_carte/icone_info.png", null, ""); google.maps.event.addListener(mgr, 'loaded', function () { setupCarte(); pano.setVisible(false); }); if (GBrowserIsCompatible()) { map = new GMap2(document.getElementById("map")); if (choixCarte == "Bureau_Touristique") map.setCenter(new GLatLng(46.3415649,-72.5406258), 15); if (choixCarte == "Tourisme_Trois_Rivieres") map.setCenter(new GLatLng(46.342344, -72.543326), 16); if (choixCarte == "Plan_Ville_Touristique") map.setCenter(new GLatLng(46.3422216,-72.5433579), 13); var extLargeMapControl = new ExtLargeMapControl({type : "small", zoomInBtnTitle : "Rapprocher", zoomOutBtnTitle : "Éloigner"}); map.addControl(extLargeMapControl); window.setTimeout("setupCarte("+choixCarte+")", 0); } } function getIcon(images) { var icon = null; if (images) { if (icons[images[0]]) { icon = icons[images[0]]; } else { icon = new GIcon(G_DEFAULT_ICON); icon.image = "/google_maps/icones_carte/" + images[0] + ".png"; var size = iconData[images[0]]; var hauteur = size.height - 1; var largeur = size.width - 1; icon.iconSize = new GSize(size.width, size.height); if (images[0] == "tourisme_trois_rivieres") { icon.iconAnchor = new GPoint(65, 100); } else { icon.iconAnchor = new GPoint(size.width >> 1, size.height >> 1); } icon.infoWindowAnchor = new GPoint(14, 3); icon.imageMap = [0,hauteur, largeur,hauteur, largeur,0, 0,0]; //Dans Firefox, pour que l'icone soit cliquable en entier //icon.shadow = "/google_maps/icones_carte/" + images[1] + ".png"; icon.shadow = null; size = iconData[images[1]]; icon.shadowSize = new GSize(size.width, size.height); icons[images[0]] = icon; } } return icon; } function setupCarte(choixCarte) { mgr = new MarkerManager(map, {trackMarkers:false}); allmarkers.length = 0; for (var i in choixCarte) { var layer = choixCarte[i]; var markers = []; for (var j in layer["places"]) { var place = layer["places"][j]; var icon = getIcon(place["icon"]); var title = place["name"]; var infoBulle = place["info"]; var posn = new GLatLng(place["posn"][0], place["posn"][1]); var marker = createMarker(posn,title,icon,infoBulle); markers.push(marker); allmarkers.push(marker); } mgr.addMarkers(markers, layer["zoom"][0], layer["zoom"][1]); } mgr.refresh(); if (choixCarte != "Plan_Ville_Touristique") { if (infoBulle != "") { map.openInfoWindowHtml(map.getCenter(), infoBulle, {pixelOffset: new GSize(-7, -12), noCloseOnClick:true}); } } } function createMarker(posn, title, icon, infoBulle) { var marker = new GMarker(posn, {title: title, icon: icon, draggable:false }); if (infoBulle != "") { GEvent.addListener(marker, 'click', function() { marker.openInfoWindowHtml(infoBulle); }); } return marker; }