//================================================================================ // MyMap - LGPL Copyright (c) 2006 Lionel Laské // // This file is part of MyMap. // // MyMap is free software; you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation; either version 2.1 of the License, or // (at your option) any later version. // // MyMap is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License // along with MyMap; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // //================================================================================ var map = null; var geo = null; var gmlb_map = null; var MYMODE_MAP = G_NORMAL_MAP; var MYMODE_SATELLITE = G_SATELLITE_MAP; var MYMODE_MIXTE = G_HYBRID_MAP; var MYMARKER_TYPE1 = null; function MyMapInitialize(mapname, lat, lng, zoom, mode) { if(GBrowserIsCompatible()) { map = new GMap2($(mapname)); map.setCenter(new GLatLng(lat, lng), zoom, mode); map.addControl(new GLargeMapControl()); map.addControl(new GMapTypeControl()); geo = new GClientGeocoder(); var baseIcon = new GIcon(); baseIcon.shadow = site_url + "elmts/shadow.png"; baseIcon.image = site_url + "elmts/picto_googlemap.gif"; baseIcon.iconSize = new GSize(20, 30); baseIcon.shadowSize = new GSize(37, 30); baseIcon.iconAnchor = new GPoint(10, 30); //baseIcon.infoWindowAnchor = new GPoint(9, 2); //baseIcon.infoShadowAnchor = new GPoint(18, 25); MYMARKER_TYPE1 = baseIcon; } } function MyMapTerminate() { GUnload(); } function MyMapAddMarker(lat, lng, markertype, index) { var resto = adrs[index]; var newmarker = new GMarker(new GLatLng(lat, lng), markertype); GEvent.addListener(newmarker, "click", function() { gmlb_map = document.createElement("a"); gmlb_map.style.display = "none"; gmlb_map.setAttribute("id", "map_" + resto.id); gmlb_map.setAttribute("gmap", resto.url); gmlb_map.setAttribute("title", "Google Map : « " + resto.intitule + " »"); gm_ShowMap(gmlb_map);return false; } ); map.addOverlay(newmarker); return newmarker; } function MyMapRemoveMarker(marker) { map.removeOverlay(marker); } function MyMapSetGoto(lat, lng) { map.panTo(new GLatLng(lat, lng)); } function MyMapSetZoom(zoom) { map.setZoom(zoom); } function MyMapPoint() { this.lat = 0; this.lng = 0; } function MyMapGeocode(address, callback) { geo.getLatLng(address, function(point) { if (!point) { callback(null); } else { res = new MyMapPoint(); res.lat = point.lat(); res.lng = point.lng(); callback(res); } } ); } var adrs = [ { "id": 1, "lat": 48.844794, "lng": 2.320282, "zoom": 16, "url": "http://maps.google.fr/maps?f=q&hl=fr&geocode=&q=2,+avenue+du+Maine+75015+Paris&sll=48.844794,2.320282&ie=UTF8&z=16&iwloc=addr&op=1", "adrs": "2, avenue du Maine 75015 Paris", "intitule": "Maine" }, { "id": 3, "lat": 48.872212, "lng": 2.339317, "zoom": 16, "url": "http://maps.google.fr/maps?f=q&hl=fr&geocode=&q=2,+boulevard+Haussmann+75009+Paris&sll=48.872212,2.339317&ie=UTF8&z=16&iwloc=addr&op=3", "adrs": "2, boulevard Haussmann 75009 Paris", "intitule": "Haussmann" }, { "id": 4, "lat": 48.8849, "lng": 2.261, "zoom": 16, "url": "http://maps.google.fr/maps?f=q&hl=fr&geocode=&q=168,+av.+Charles+de+Gaulle+92200+NEUILLY+SUR+SEINE&sll=48.8849,2.261&ie=UTF8&z=16&iwloc=addr&op=4", "adrs": "168, av. Charles de Gaulle 92200 NEUILLY SUR SEINE", "intitule": "Neuilly" }, { "id": 9, "lat": 48.78, "lng": 2.45925, "zoom": 16, "url": "http://maps.google.fr/maps?f=q&hl=fr&geocode=&q=Centre+Régional+Créteil+Soleil+-+Niveau+4+94000+CRETEIL&sll=48.78,2.45925&ie=UTF8&z=16&iwloc=addr&op=9", "adrs": "Centre Régional Créteil Soleil - Niveau 4 94000 CRETEIL", "intitule": "Créteil" }, { "id": 10, "lat": 48.833312, "lng": 2.277153, "zoom": 16, "url": "http://maps.google.fr/maps?f=q&hl=fr&geocode=&q=Aquaboulevard+-+4+rue+Louis+Armand+75015+Paris&sll=48.833312,2.277153&ie=UTF8&z=16&iwloc=addr&op=10", "adrs": "Aquaboulevard - 4 rue Louis Armand 75015 Paris", "intitule": "Aquaboulevard" }, { "id": 11, "lat": 48.9769, "lng": 2.4986, "zoom": 16, "url": "http://maps.google.fr/maps?f=q&hl=fr&geocode=&q=CC+Usines+Center+95500+GONESSE&sll=48.9769,2.4986&ie=UTF8&z=16&iwloc=addr&op=11", "adrs": "CC Usines Center 95500 GONESSE", "intitule": "Usines Center" }, { "id": 12, "lat": 43.9205, "lng": 4.792614, "zoom": 16, "url": "http://maps.google.fr/maps?f=q&hl=fr&geocode=&q=Gare+TGV+Méditerranée+d'Avignon+84000+AVIGNON&sll=43.9205,4.792614&ie=UTF8&z=16&iwloc=addr&op=12", "adrs": "Gare TGV Méditerranée d'Avignon 84000 AVIGNON", "intitule": "Avignon " }]; function MyMapLoad() { if($('map')) { gmLb_init(); MyMapInitialize("map", 48.859088, 2.346391, 12, MYMODE_MAP); for (i=0; i -1) { var resto = adrs[index]; MyMapSetZoom(16); MyMapSetGoto(resto.lat, resto.lng); } else { MyMapSetZoom(12); MyMapSetGoto(48.859088, 2.346391); } } function MyMapGotoselected() { MyMapGoto($("MyMapList").value); } function MyMapFilter(pref) { for (i=0; i