var map; var layers = []; var directionsDisplay; var directionsService; jQuery(document).ready(function ($) { directionsDisplay = new google.maps.DirectionsRenderer(); directionsService = new google.maps.DirectionsService(); var mapOptions = { center: new google.maps.LatLng(44.932238,4.903679), zoom: 11, navigationControl: false, streetViewControl: true, mapTypeControlOptions: { mapTypeIds: [google.maps.MapTypeId.ROADMAP, google.maps.MapTypeId.SATELLITE], position: google.maps.ControlPosition.TOP_CENTER }, streetViewControl: true, streetViewControlOptions: { position: google.maps.ControlPosition.TOP_CENTER }, mapTypeId: 'university_layer' }; map = new google.maps.Map(document.getElementById('google_map'), mapOptions); setBuildingOverlay(); // campus extents : mountain, college of technology, south var latlon_all = new google.maps.LatLng(44.986656,4.98642); var latlon_main = new google.maps.LatLng(44.927863,4.934063); var latlon_cot = new google.maps.LatLng(44.987627,4.977665); var latlon_sc = new google.maps.LatLng(45.0352,5.051479); map.setCenter(latlon_all); // default position $("#expand").live("click", function() { map.setZoom(11); map.setCenter(latlon_all); if ($(this).hasClass("on")) { $(this).removeClass("on"); } else { $(this).addClass("on"); } }); $("#main").live("click", function() { map.setZoom(12); map.setCenter(latlon_main); if ($(this).hasClass("on")) { $(this).removeClass("on"); } else { $(this).addClass("on"); } }); $("#tech").live("click", function() { map.setZoom(15); map.setCenter(latlon_cot); if ($(this).hasClass("on")) { $(this).removeClass("on"); } else { $(this).addClass("on"); } }); $("#south").live("click", function() { map.setZoom(14); map.setCenter(latlon_sc); if ($(this).hasClass("on")) { $(this).removeClass("on"); } else { $(this).addClass("on"); } }); /***** STYLE *****/ universityStyle(); /***** SIDEBAR *****/ setSidebar(); $("#views h3").live("click", function(){ if ($(this).hasClass("on")) { $('#views ul').slideUp(); $(this).removeClass("on"); } else { $('#views ul').slideDown(); $(this).addClass("on"); } }); $("#layers h3").live("click", function(){ if ($(this).hasClass("on")) { $('#layers ul').slideUp(); $(this).removeClass("on"); } else { $('#layers ul').slideDown(); $(this).addClass("on"); } }); $("#style h3").live("click", function(){ if ($(this).hasClass("on")) { $('#style ul').slideUp(); $(this).removeClass("on"); } else { $('#style ul').slideDown(); $(this).addClass("on"); } }); $("#labs h3").live("click", function(){ if ($(this).hasClass("on")) { $('#labs ul').slideUp(); $(this).removeClass("on"); } else { $('#labs ul').slideDown(); $(this).addClass("on"); } }); $("#bldg h3").live("click", function(){ if ($(this).hasClass("on")) { directionsDisplay.setMap(null); $('#directions').slideUp(); $(this).removeClass("on"); } else { showWalking(); $('#directions').slideDown(); $(this).addClass("on"); } }); $(".category").live("click", function(){ var id = $(this).attr("id"); if ($(this).hasClass("on")) { layers[id].setMap(null); $(this).removeClass("on"); } else { layers[id].setMap(map); $(this).addClass("on"); } }); // newbus = axes de communication appelle kml var newbus_layer = new google.maps.KmlLayer('http://maps.google.fr/maps/ms?authuser=0&vps=2&hl=fr&ie=UTF8&msa=0&output=kml&msid=207353998238333751213.0004b034fed97b7f5cecb', {preserveViewport: true}); $("#new_bus").live("click", function(){ if ($(this).hasClass("on")) { newbus_layer.setMap(null); $(this).removeClass("on"); } else { newbus_layer.setMap(map); $(this).addClass("on"); } }); // art = parcs d'activité appelle kml var art = new google.maps.KmlLayer('http://maps.google.fr/maps/ms?authuser=0&vps=2&hl=fr&ie=UTF8&msa=0&output=kml&msid=207353998238333751213.0004ac6edb71bfb237e63', {preserveViewport: true}); $("#art").live("click", function(){ if ($(this).hasClass("on")) { art.setMap(null); $(this).removeClass("on"); } else { art.setMap(map); $(this).addClass("on"); } }); function fenetreCent(url,nom,largeur,hauteur,options) { var haut=(screen.height-hauteur)/2; var Gauche=(screen.width-largeur)/2; fencent=window.open(url,nom,"top="+haut+",left="+Gauche+",width="+largeur+",height="+hauteur+","+options); } var largeur = 700; var centreCarte = new google.maps.LatLng(47.127608,0.998898); var optionsCarte = { zoom: 8, center: centreCarte } var maCarte = new google.maps.Map(document.getElementById("EmplacementDeMaCarte"), optionsCarte); var optionsMarqueur = { position: centreCarte, map: macarte, title: "Titre de mon premier marqueur" } var marqueur = new google.maps.Marker(optionsMarqueur); var contenuInfoBulle = '
Remontez le temps pour découvrir l\'une des plus belles cités fortifiées de France.
' + 'Le DONJON, haut de 36 mètres, a été construit par un comte d\'Anjou, Foulques Nerra, au début du XIe siècle. S\'il figure parmi les plus imposants de son époque en Europe, il est aussi l\'un des mieux conservés. Modèle d\'architecture militaire, il est transformé en prison royale par Louis XI.
' + 'Le LOGIS ROYAL se trouve à proximité. Ce joyau de la Renaissance française, haut lieu de l\'Histoire de France, a été une résidence de prédilection de la dynastie des Valois. Sa façade ouverte en terrasse domine la ville et la vallée de l\'Indre. Le logis a accueilli notamment Jeanne d\'Arc, Agnès Sorel et Anne de Bretagne. Pour en savoir plus : La cité royale de Loches
'; var infoBulle = new google.maps.InfoWindow({ content: contenuInfoBulle }) google.maps.event.addListener(marqueur, 'click', function() { infoBulle.open(maCarte, marqueur); }); var myLatlng = new google.maps.LatLng(44.932238,4.903679); var wireless = new google.maps.KmlLayer('http://maps.google.fr/maps/ms?authuser=0&vps=2&hl=fr&ie=UTF8&msa=0&output=kml&msid=207353998238333751213.0004b0d02b11093670b4d', {preserveViewport: true}); var wireless2 = new google.maps.Marker({ position: myLatlng, title:"Hello World!" }); google.maps.event.addListener(wireless2, 'click', function() { if (!infoBubble.isOpen()) { infoBubble.open(map, wireless2); } else {infoBubble.close(map, wireless2);} }); $("#wireless").live("click", function(){ if ($(this).hasClass("on")) { wireless.setMap(null); wireless2.setMap(null); $(this).removeClass("on"); } else { wireless.setMap(map); wireless2.setMap(map); $(this).addClass("on"); } }); // printing = vide var printing = new google.maps.KmlLayer('https://sites.google.com/site/universityofmontanabetamap/home/data-sources/prints.kmz', {preserveViewport: true}); $("#prints").live("click", function(){ if ($(this).hasClass("on")) { printing.setMap(null); $(this).removeClass("on"); } else { printing.setMap(map); $(this).addClass("on"); } }); // food = cadre de vie var foodplaces = new google.maps.KmlLayer('http://maps.google.fr/maps/ms?authuser=0&vps=10&ie=UTF8&msa=0&output=kml&msid=207353998238333751213.0004ac6fdaf7becf9161a', {preserveViewport: true}); $("#food").live("click", function(){ if ($(this).hasClass("on")) { foodplaces.setMap(null); $(this).removeClass("on"); } else { foodplaces.setMap(map); $(this).addClass("on"); } }); var panoramas = new google.maps.KmlLayer('http://bbs.keyhole.com/ubb/ubbthreads.php?ubb=download&Number=1017822&filename=20110815093613-4e494afda82029.84028183.kmz', {preserveViewport: true}); $("#pano").live("click", function(){ if ($(this).hasClass("on")) { panoramas.setMap(null); $(this).removeClass("on"); } else { panoramas.setMap(map); $(this).addClass("on"); } }); var parking = new google.maps.KmlLayer('https://sites.google.com/site/universityofmontanabetamap/home/data-sources/parking_lots.kml', {suppressInfoWindows: true}); $('.panel2').hide(); $("#park").live("click", function(){ $('.panel2').hide(); if ($(this).hasClass("on")) { parking.setMap(null); $(this).removeClass("on"); map.setMapTypeId('university_layer'); } else { map.setMapTypeId(google.maps.MapTypeId.HYBRID); parking.setMap(map); $(this).addClass("on"); $('.panel2').show(); } }); var tagFilter = 'university of montana'; var panoramioLayer = new google.maps.panoramio.PanoramioLayer(); var userID = '175971'; panoramioLayer.setUserId(userID); // panoramioLayer.setTag(tagFilter); $("#img").live("click", function() { if ($(this).hasClass("on")) { panoramioLayer.setMap(null); $(this).removeClass("on"); } else { panoramioLayer.setMap(map); $(this).addClass("on"); } }); $("#start").html($("#start option").sort(function (a, b) { return a.text == b.text ? 0 : a.text < b.text ? -1 : 1 })); $("#end").html($("#end option").sort(function (a, b) { return a.text == b.text ? 0 : a.text < b.text ? -1 : 1 })); }); function universityStyle() { var style = [ { featureType: "all", elementType: "labels", stylers: [ { visibility: "off" } ] },{ featureType: "poi.park", elementType: "all", stylers: [ { visibility: "off" } ] },{ featureType: "poi.place_of_worship", elementType: "all", stylers: [ { visibility: "off" } ] },{ featureType: "road.highway", elementType: "geometry", stylers: [ { lightness: 99 }, { hue: "#1900ff" }, { visibility: "on" } ] },{ featureType: "road.arterial", elementType: "geometry", stylers: [ { visibility: "on" }, { lightness: 100 } ] }, { featureType: "transit", elementType: "all", stylers: [ { visibility: "off" } ] },{ featureType: "poi.medical", elementType: "all", stylers: [ { visibility: "off" } ] },{ featureType: "all", elementType: "labels", stylers: [ { visibility: "off" } ] },{ featureType: "poi", elementType: "labels", stylers: [ { visibility: "on" } ] },{ featureType: "poi.park", elementType: "labels", stylers: [ { visibility: "off" } ] },{ featureType: "administrative.locality", elementType: "labels", stylers: [ { visibility: "on" } ] },{ featureType: "landscape.man_made", elementType: "labels", stylers: [ { visibility: "on" } ] },{ featureType: "poi.park", elementType: "geometry", stylers: [ { visibility: "on" } ] },{ featureType: "poi.place_of_worship", elementType: "all", stylers: [ { visibility: "off" } ] },{ featureType: "poi.business", elementType: "all", stylers: [ { visibility: "off" } ] } ]; var styledMapOptions = { name: "Campus" }; var styleMapType = new google.maps.StyledMapType( style, styledMapOptions); map.mapTypes.set('university_layer', styleMapType); map.setMapTypeId('university_layer'); } function setBuildingOverlay() { var building_overlay = new google.maps.KmlLayer('https://sites.google.com/site/universityofmontanabetamap/home/data-sources/buildings_trans.kml', {preserveViewport: true}); building_overlay.setMap(map); } function setSidebar() { /*** default open menu sections ***/ $("#bldg h3").addClass("on"); $('#directions').css("display","block"); showWalking(); $("#labs h3").addClass("on"); $('#labs ul').css("display","block"); /*** *** ***/ } /* Directions */ function clearDirections() { $("#directions_walking").hide(); $("#directions_bus").hide(); $("#directions_drive").hide(); } function showWalking() { clearDirections(); $("#directions_walking").show(); } function showBus() { clearDirections(); $("#directions_bus").show(); } function showDrive() { clearDirections(); $("#directions_drive").show(); } function walkingDirections() { var start = document.getElementById("start").value; var end = document.getElementById("end").value; var request = { origin:start, destination:end, travelMode: google.maps.DirectionsTravelMode.WALKING }; directionsService.route(request, function(response, status) { if (status == google.maps.DirectionsStatus.OK) { directionsDisplay.setDirections(response); } }); directionsDisplay.setMap(map); } function busDirections() { var busA = document.getElementById("busA").value; var busB = document.getElementById("busB").value; window.open("http://www.google.com/maps?ie=UTF8&f=d&saddr=" +busA+ "&daddr=" +busB+ "&dirflg=r") } function drivingDirections() { var driveA = document.getElementById("driveA").value; var driveB = document.getElementById("driveB").value; window.open("http://www.google.com/maps?ie=UTF8&f=d&saddr=" +driveA+ "&daddr=" +driveB); }