New file |
0,0 → 1,101 |
function getUrlBaseJrest() { |
return 'http://162.38.234.9/obs_saisons/applications/jrest/'; |
} |
|
function initialiserCarte() { |
|
if($('#map_canvas').length == 0) { |
return; |
} |
|
var latlng = new google.maps.LatLng(47.0504, 2.2347); |
var myOptions = { |
zoom: 5, |
center: latlng, |
mapTypeId: google.maps.MapTypeId.HYBRID |
}; |
|
map = new google.maps.Map(document.getElementById("map_canvas"), |
myOptions); |
|
$('.lien_vers_profil').live('click', function(event) { |
event.preventDefault(); |
window.open($(this).attr('href')); |
return false; |
}); |
|
obtenirStations(); |
} |
|
function obtenirStations() { |
|
$.get(getUrlBaseJrest()+'OdsExport/ExportStationJson/', function(data) { |
|
infos_stations = data; |
|
for(i in infos_stations) { |
creerEtAjouterMarqueur(i, infos_stations[i]); |
} |
}); |
} |
|
function obtenirImagePourChaineCouleur(chaine_couleur) { |
|
chaine_couleur = encodeURIComponent(chaine_couleur); |
var image = getUrlBaseJrest()+"OdsMarqueur/point?couleurs="+chaine_couleur; |
|
return image; |
} |
|
function creerEtAjouterMarqueur(id_marqueur, infos_station) { |
|
latlng = new google.maps.LatLng(infos_station['latitude'],infos_station['longitude']); |
/*var chaine_couleur = ''; |
|
for(i in infos_stations.especes) { |
var observation = infos_station.obs[i]; |
|
if(typeof(tableau_couleurs_en_cours[observation.id_espece]) != 'undefined') { |
chaine_couleur += tableau_couleurs_en_cours[observation.id_espece]+","; |
} |
} |
|
chaine_couleur = chaine_couleur.slice(0,chaine_couleur.length - 1); |
*/ |
var chaine_couleur = "#A9582B"; |
var image = obtenirImagePourChaineCouleur(chaine_couleur); |
|
|
var marqueur_station = new google.maps.Marker({ |
position: latlng, |
icon:image, |
title:infos_station.station, |
optimized: false |
}); |
|
/*google.maps.event.addListener(tableau_marqueurs[id_marqueur], 'click', function() { |
|
//contenu_fenetre = formaterContenuFenetre(infos_stations.obs); |
infowindow.close(); |
infowindow.content = contenu_fenetre; |
infowindow.open(map,this); |
});*/ |
|
marqueur_station.setDraggable(false); |
marqueur_station.setClickable(true); |
|
marqueur_station.setMap(map); |
|
} |
|
function obtenirImagePourChaineCouleur(chaine_couleur) { |
|
chaine_couleur = encodeURIComponent(chaine_couleur); |
var image = getUrlBaseJrest()+"OdsMarqueur/point?couleurs="+chaine_couleur; |
|
return image; |
} |
|
$('#map_canvas').ready(function() { |
initialiserCarte(); |
}); |