26,7 → 26,12 |
google.maps.MapTypeId.HYBRID, |
google.maps.MapTypeId.SATELLITE, |
google.maps.MapTypeId.TERRAIN] |
} |
}, |
zoomControlOptions: { |
style: google.maps.ZoomControlStyle.LARGE, |
position: google.maps.ControlPosition.LEFT_CENTER |
}, |
panControl: false |
}; |
var osmMapType = new google.maps.ImageMapType({ |
getTileUrl: function(coord, zoom) { |
61,6 → 66,7 |
function initialiserWidget() { |
urlVars = getUrlVars(); |
definirTailleTitre(); |
centrerTitreEtStats(); |
initialiserAffichageCarte(); |
initialiserAffichagePanneauLateral(); |
initialiserCarte(); |
90,7 → 96,7 |
/*+--------------------------------------------------------------------------------------------------------+*/ |
// AFFICHAGE GÉNÉRAL |
|
function afficherTitreCarte() { |
function afficherTitreCarteEtStats() { |
if (stations != null && taxonsCarte.length > 0) { |
var obsNbre = stations.stats.observations; |
var obsNbreFormate = obsNbre; |
113,37 → 119,41 |
stationNbreFormate = stations.stats.stations.formaterNombre(); |
} |
|
var titre = obsNbreFormate+' observation'; |
titre += (obsNbre > 1) ? 's' : '' ; |
var stats = obsNbreFormate+' observation'; |
stats += (obsNbre > 1) ? 's' : '' ; |
|
if(photos_seulement == 1) { |
titre += ' avec photos '; |
if(photos != null && photos == 1) { |
stats += ' avec photos '; |
} |
|
titre += ' sur '+(stationNbre+ communeNbre)+' station'; |
titre += (stationNbre > 1) ? 's' : '' ; |
stats += ' sur '+(stationNbre+ communeNbre)+' station'; |
stats += (stationNbre > 1) ? 's' : '' ; |
|
if (nt == '*') { |
titre += ' parmi '+plteNbreFormate+' plante'; |
titre += (plteNbre > 1) ? 's' : '' ; |
stats += ' parmi '+plteNbreFormate+' plante'; |
stats += (plteNbre > 1) ? 's' : '' ; |
} else { |
if($('.taxon-actif .taxon').text() != '') { |
var element = $('.taxon-actif .taxon').clone(); |
element.children().remove(); |
var taxon = element.text(); |
titre += ' pour '+taxon; |
stats += ' pour '+taxon; |
} else { |
if (taxonsCarte[0]) { |
var taxon = taxonsCarte[0]; |
titre += ' pour '+taxon.nom; |
stats += ' pour '+taxon.nom; |
} |
} |
} |
|
$('#carte-titre-infos').text(titre); |
$('#pl-indication-filtre').html('Filtrer parmi <br />'+plteNbre+'<br />plantes'); |
$('#zone-stats').show(); |
$('#zone-stats > h1').text(stats); |
} |
centrerTitreEtStats(); |
} |
|
var tailleTitreOriginelle = null; |
function definirTailleTitre() { |
var largeurViewPort = $(window).width(); |
var taille = null; |
154,20 → 164,60 |
} else if (largeurViewPort >= 800) { |
taille = '1.6'; |
} |
|
// Aménagement de la taille de police selon l'écran |
$("#carte-titre").css('font-size', taille+'em'); |
$("#zone-stats h1").css('font-size', taille+'em'); |
|
// Dimensionnement du titre et du logo |
if(urlLogo != "null") { |
hauteurLogo = $('#logo img').height(); |
// Redimensionnement du logo s'il est trop grand |
// on perd en qualité mais ça vaut mieux que de casser l'affichage |
if(hauteurLogo > 60) { |
hauteurLogo = 60; |
$('#logo img').height(60); |
} |
|
if(hauteurLogo == 0) { |
$('#logo img').load(function(event) { |
definirTailleTitre(); |
}); |
return; |
} |
|
largeurLogo = $('#logo img').width(); |
largeurTitre = $('#carte-titre-infos').width(); |
|
$('#zone-titre').css("height", (hauteurLogo)+"px"); |
$('#zone-titre').css("width", (largeurLogo+largeurTitre+16)+"px"); |
|
if(titreCarte != 'null' && titreCarte != 0) { |
$('#carte-titre-infos').css("position", "absolute"); |
$('#carte-titre-infos').css("left", (largeurLogo+16)+"px"); |
$('#carte-titre-infos').css("top", (hauteurLogo/2 - 8)+"px"); |
} |
} |
} |
|
function centrerTitreEtStats() { |
var largeurViewPort = $(window).width(); |
var largeurTitre = $('#zone-titre').width(); |
var marge = (largeurViewPort - largeurTitre)/2; |
$('#zone-titre').css("margin-left",marge); |
|
var largeurStats = $('#zone-stats').width(); |
var marge = (largeurViewPort - largeurStats)/2; |
$('#zone-stats').css("left",marge); |
} |
|
/*+--------------------------------------------------------------------------------------------------------+*/ |
// CARTE |
|
function initialiserAffichageCarte() { |
$('#carte').height($(window).height() - 35); |
$('#carte').width($(window).width() - 24); |
|
if (nt != '*') { |
$('#carte').css('left', 0); |
$('#carte').height($(window).height()); |
$('#carte').width($(window).width()); |
} |
} |
|
function initialiserCarte() { |
map = new google.maps.Map(document.getElementById('carte'), carteOptions); |
267,7 → 317,7 |
marqueurs = new Array(); |
|
stations = data; |
afficherTitreCarte(); |
afficherTitreCarteEtStats(); |
|
$.each(stations.points, function (index, station) { |
if(station != null) { |
557,7 → 607,7 |
pagineur.total = pointClique.stationInfos.obsNbre; |
// Si on est en mode photo on reste en mode liste quelque soit le |
// nombre de résultats |
if (pagineur.total > 4 && photos_seulement != 1) { |
if (pagineur.total > 4 && photos != 1) { |
pagineur.format = 'tableau'; |
} else { |
pagineur.format = 'liste'; |
864,8 → 914,6 |
// PANNEAU LATÉRAL |
|
function initialiserAffichagePanneauLateral() { |
$('#panneau-lateral').height($(window).height() - 35); |
|
if (nt == '*') { |
$('#pl-ouverture').bind('click', afficherPanneauLateral); |
$('#pl-fermeture').bind('click', cacherPanneauLateral); |
891,7 → 939,7 |
if (nt == '*') { |
afficherTaxons(); |
} |
afficherTitreCarte(); |
afficherTitreCarteEtStats(); |
} |
} |
|
903,21 → 951,22 |
|
|
function afficherPanneauLateral() { |
$('#panneau-lateral').height($(window).height()); |
$('#panneau-lateral').width(300); |
$('#pl-contenu').css('display', 'block'); |
$('#pl-ouverture').css('display', 'none'); |
$('#pl-fermeture').css('display', 'block'); |
$('#carte').css('left', '300px'); |
$('#panneau-lateral').css("top","0"); |
|
google.maps.event.trigger(map, 'resize'); |
}; |
|
function cacherPanneauLateral() { |
$('#panneau-lateral').width(24); |
$('#panneau-lateral').height("60px"); |
$('#panneau-lateral').width("83px"); |
$('#pl-contenu').css('display', 'none'); |
$('#pl-ouverture').css('display', 'block'); |
$('#pl-fermeture').css('display', 'none'); |
$('#carte').css('left', '24px'); |
|
google.maps.event.trigger(map, 'resize'); |
}; |