3,6 → 3,8 |
var tableau_marqueurs = new Array(); |
var infowindow = new google.maps.InfoWindow(); |
var infos_observations = new Array(); |
var nb_observations_par_espece = {}; |
var nb_observations_par_annee = {}; |
|
var type_espece = '0'; |
var espece = '0'; |
135,6 → 137,44 |
return code_widget; |
} |
|
String.prototype.hashCode = function() { |
var hash = 0, i, chr; |
if (this.length === 0) return hash; |
for (i = 0; i < this.length; i++) { |
chr = this.charCodeAt(i); |
hash = ((hash << 5) - hash) + chr; |
hash |= 0; // Convert to 32bit integer |
} |
return hash; |
}; |
|
function renverserTableauEtHashcoderIndex(trans) { |
var key, tmp_ar = {}; |
|
for (key in trans) |
{ |
if (trans.hasOwnProperty(key)) |
{ |
tmp_ar[trans[key].hashCode()] = key; |
} |
} |
|
return tmp_ar; |
} |
|
function trierTableau(tableau) { |
if(!tableau) { |
return; |
} |
|
var tableau_trie = tableau.slice(0); |
tableau_trie.sort(function(a,b){ |
return a.localeCompare(b); |
}); |
|
return tableau_trie; |
} |
|
$('#lien_cette_recherche').ready(function() { |
$('#lien_cette_recherche').click(function() { |
window.alert(obtenirCodeWidget()); |
142,6 → 182,15 |
}); |
}); |
|
function selectionnerParametresDynamiquesParDefaut() { |
if($('.conteneur_selecteur_liste_annees').is(':visible')) { |
var annee_courante = (new Date()).getFullYear(); |
$('#annee_numero_'+annee_courante).attr( "checked", true ); |
} |
premier_chargement = false; |
} |
|
var premier_chargement = true; |
$(document).ready(function() { |
traiterParametresUrl(); |
}); |
264,8 → 313,8 |
} |
|
function initialiserValeursParDefaut() { |
type_espece = 2; |
$('select#selecteur_liste_types_especes').val("2"); |
type_espece = 0; |
$('select#selecteur_liste_types_especes').val("0"); |
modifierTableauEspeces(); |
obtenirObservations(); |
} |
302,7 → 351,7 |
var myOptions = { |
zoom: 5, |
center:latlng, |
mapTypeId: google.maps.MapTypeId.HYBRID, |
mapTypeId: google.maps.MapTypeId.ROADMAP, |
mapTypeControlOptions: { |
mapTypeIds: ['OSM', |
google.maps.MapTypeId.ROADMAP, |
353,14 → 402,23 |
} |
} |
|
var obs_xhr = null; |
function obtenirObservations() { |
|
if(obs_xhr != null) { |
viderMarqueurs(); |
console.log('annulation de la xhr'); |
obs_xhr.abort(); |
} |
|
annee = getAnneeSelectionnee(); |
requete = '?annee='+annee; |
|
if(type_espece != '0' && espece == '0') { |
if(type_espece != '0') { |
requete += '&type_espece='+type_espece; |
} |
|
var espece = getEspeceSelectionnee(); |
if(espece != '0') { |
requete += '&espece='+espece; |
} |
379,8 → 437,13 |
|
$.get(getUrlBaseJrest()+'OdsExport/ExportObservationJson/'+requete, function(data) { |
|
obs_xhr = null; |
|
infos_observations = data; |
|
nb_observations_par_espece = {}; |
nb_observations_par_annee = {}; |
|
if(tableau_marqueurs.length > 0) { |
viderMarqueurs(); |
} |
405,8 → 468,19 |
if(typeof(tableau_couleurs_en_cours[observation.id_espece]) != 'undefined') { |
chaine_couleur += tableau_couleurs_en_cours[observation.id_espece]+","; |
} |
|
if(!nb_observations_par_espece[observation.id_espece]) { |
nb_observations_par_espece[observation.id_espece] = 0; |
} |
nb_observations_par_espece[observation.id_espece]++; |
|
var annee_obs = observation.date.split('/')[2]; |
if(!nb_observations_par_annee[annee_obs]) { |
nb_observations_par_annee[annee_obs] = 0; |
} |
nb_observations_par_annee[annee_obs]++; |
} |
|
chaine_couleur = chaine_couleur.slice(0,chaine_couleur.length - 1); |
var image = obtenirImagePourChaineCouleur(chaine_couleur); |
|