$(function(){ var map; var sebt = new google.maps.LatLng(45.709083,-73.721357); var centre_congres = new google.maps.LatLng(46.809437,-71.216404); var expo_cite = new google.maps.LatLng(46.826008,-71.249696); var bounds = new google.maps.LatLngBounds(); bounds.extend( sebt ); bounds.extend( centre_congres ); bounds.extend( expo_cite ); var MY_MAPTYPE_ID = 'TESSIER'; var directionDisplay; var directionsService = new google.maps.DirectionsService(); var $parcours = $('#parcours').dialog({ title:'Parcours', autoOpen:false, width:$(document).width()/2, height:$(document).height()*0.75, buttons:{ 'Close':function(){$(this).dialog('close');} } }); directionsDisplay = new google.maps.DirectionsRenderer(); var stylez = [ { featureType: "all", elementType: "all", stylers: [ { saturation: -100 } ] },{ featureType: "road.highway", elementType: "labels", stylers: [ { saturation: 60 }, { hue: "#310000" } ] } ]; map = new google.maps.Map(document.getElementById("map_canvas"), { zoom: 12, center: sebt, disableDefaultUI:true, mapTypeControl: true, streetViewControl:true, // mapTypeControlOptions: {style: google.maps.MapTypeControlStyle.DROPDOWN_MENU}, //[ DEFAULT | DROPDOWN_MENU | HORIZONTAL_BAR ] navigationControl: true, navigationControlOptions: {style: google.maps.NavigationControlStyle.ZOOM_PAN}, //[ ANDROID | DEFAULT | SMALL | ZOOM_PAN ] mapTypeControlOptions: { mapTypeIds: [google.maps.MapTypeId.ROADMAP, MY_MAPTYPE_ID] //[ google.maps.MapTypeId.HYBRID | google.maps.MapTypeId.ROADMAP | google.maps.MapTypeId.SATELLITE | google.maps.MapTypeId.TERRAIN ] }, mapTypeId: MY_MAPTYPE_ID }); //map.fitBounds( bounds ); directionsDisplay.setMap(map); var companyImage = new google.maps.MarkerImage('/./images/default/map-pointer.png', new google.maps.Size(56,64), new google.maps.Point(0,0), new google.maps.Point(24,58) ); /*var centreCongresImage = new google.maps.MarkerImage('/./images/default/map-pointer-centre-congres.png', new google.maps.Size(56,64), new google.maps.Point(0,0), new google.maps.Point(24,58) ); var expoCiteImage = new google.maps.MarkerImage('/./images/default/map-pointer-expocite.png', new google.maps.Size(56,64), new google.maps.Point(0,0), new google.maps.Point(24,58) );*/ var styledMapOptions = { name: "INNOVAPLAST" }; var jayzMapType = new google.maps.StyledMapType(stylez, styledMapOptions); map.mapTypes.set(MY_MAPTYPE_ID, jayzMapType); map.panBy(67, -125); var companyMarker = new google.maps.Marker({ position: sebt, flat:true, //no shadow map: map, icon: companyImage, title:"Innovaplast", zIndex: 3 }); /*var centreCongresMarker = new google.maps.Marker({ position: centre_congres, flat:true, //no shadow map: map, icon: centreCongresImage, title:"Centre des congrès", zIndex: 3 }); var expoCiteMarker = new google.maps.Marker({ position: expo_cite, flat:true, //no shadow map: map, icon: expoCiteImage, title:"ExpoCité", zIndex: 3 });*/ //BULLE var iWindow = new google.maps.InfoWindow({ content: '
Innovaplast
2325 Boul. des Entreprises,
Terrebonne, Quebec,
Canada J6X 4J9
T 450-477-4005
F 450-477-4006
info@innovaplast.com
' }); //iWindow.open(map, companyMarker); google.maps.event.addListener(companyMarker, 'click', function() { iWindow.open(map, companyMarker); }); //TRACÉ DE LA ROUTE function calcRoute(e) { e.stopPropagation(); var start = $('#mLocation').val(); var end = sebt; var request = { origin:start, destination:end, travelMode: google.maps.DirectionsTravelMode.DRIVING }; directionsService.route(request, function(response, status) { if (status == google.maps.DirectionsStatus.OK) { directionsDisplay.setDirections(response); } console.log(response); if( typeof response.routes[0] != 'undefined' ) { $parcours.empty(); $parcours.append(''); var $container = $parcours.find('tbody'); $container.append(''); var infos = response.routes[0].legs[0].steps; for( var i=0; i'); } $parcours.dialog('open'); } }); } if( $('#form_submit_map').length ) { $('#button_submit_map').bind('click', calcRoute).focus(); $('#form_submit_map').submit(function(e){ e.preventDefault(); e.stopPropagation(); $('#button_submit_map').trigger('click'); return false; }); } });
Distance total : '+response.routes[0].legs[0].distance.text+'
['+infos[i].distance.text+']
'+infos[i].instructions+'