Subversion Repositories eFlore/Applications.cel

Rev

Rev 1435 | Rev 1442 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1435 Rev 1438
Line 24... Line 24...
24
		mapTypeIds: ['OSM', 
24
		mapTypeIds: ['OSM', 
25
		             google.maps.MapTypeId.ROADMAP, 
25
		             google.maps.MapTypeId.ROADMAP, 
26
		             google.maps.MapTypeId.HYBRID, 
26
		             google.maps.MapTypeId.HYBRID, 
27
		             google.maps.MapTypeId.SATELLITE, 
27
		             google.maps.MapTypeId.SATELLITE, 
28
		             google.maps.MapTypeId.TERRAIN]
28
		             google.maps.MapTypeId.TERRAIN]
29
	}
29
	},
-
 
30
	zoomControlOptions: {
-
 
31
        style: google.maps.ZoomControlStyle.LARGE,
-
 
32
        position: google.maps.ControlPosition.LEFT_CENTER
-
 
33
    },
-
 
34
    panControl: false
30
};			
35
};			
31
var osmMapType = new google.maps.ImageMapType({
36
var osmMapType = new google.maps.ImageMapType({
32
	getTileUrl: function(coord, zoom) {
37
	getTileUrl: function(coord, zoom) {
33
		return "http://tile.openstreetmap.org/" +
38
		return "http://tile.openstreetmap.org/" +
34
		zoom + "/" + coord.x + "/" + coord.y + ".png";
39
		zoom + "/" + coord.x + "/" + coord.y + ".png";
Line 59... Line 64...
59
});
64
});
Line 60... Line 65...
60
 
65
 
61
function initialiserWidget() {
66
function initialiserWidget() {
62
	urlVars = getUrlVars();
67
	urlVars = getUrlVars();
-
 
68
	definirTailleTitre();
63
	definirTailleTitre();
69
	centrerTitreEtStats();
64
	initialiserAffichageCarte();
70
	initialiserAffichageCarte();
65
	initialiserAffichagePanneauLateral();
71
	initialiserAffichagePanneauLateral();
66
	initialiserCarte();
72
	initialiserCarte();
67
	initialiserGestionnaireMarqueurs()
73
	initialiserGestionnaireMarqueurs()
Line 88... Line 94...
88
}
94
}
Line 89... Line 95...
89
 
95
 
90
/*+--------------------------------------------------------------------------------------------------------+*/
96
/*+--------------------------------------------------------------------------------------------------------+*/
Line 91... Line 97...
91
// AFFICHAGE GÉNÉRAL
97
// AFFICHAGE GÉNÉRAL
92
 
98
 
93
function afficherTitreCarte() {
99
function afficherTitreCarteEtStats() {
94
	if (stations != null && taxonsCarte.length > 0) {
100
	if (stations != null && taxonsCarte.length > 0) {
95
		var obsNbre = stations.stats.observations;
101
		var obsNbre = stations.stats.observations;
96
		var obsNbreFormate = obsNbre;
102
		var obsNbreFormate = obsNbre;
Line 111... Line 117...
111
		var stationNbreFormate = stationNbre;
117
		var stationNbreFormate = stationNbre;
112
		if(stationNbre != 0) {
118
		if(stationNbre != 0) {
113
		  	stationNbreFormate = stations.stats.stations.formaterNombre();
119
		  	stationNbreFormate = stations.stats.stations.formaterNombre();
114
		}
120
		}
Line 115... Line 121...
115
	
121
	
116
		var titre = obsNbreFormate+' observation';
122
		var stats = obsNbreFormate+' observation';
Line 117... Line 123...
117
		titre += (obsNbre > 1) ? 's' : '' ;
123
		stats += (obsNbre > 1) ? 's' : '' ;
118
 
124
 
119
		if(photos_seulement == 1) {
125
		if(photos != null && photos == 1) {
Line 120... Line 126...
120
			titre += ' avec photos ';
126
			stats += ' avec photos ';
121
		}
127
		}
Line 122... Line 128...
122
		
128
		
123
		titre += ' sur '+(stationNbre+ communeNbre)+' station';
129
		stats += ' sur '+(stationNbre+ communeNbre)+' station';
124
		titre += (stationNbre > 1) ? 's' : '' ;
130
		stats += (stationNbre > 1) ? 's' : '' ;
125
 
131
 
126
		if (nt == '*') {
132
		if (nt == '*') {
127
			titre += ' parmi '+plteNbreFormate+' plante';
133
			stats += ' parmi '+plteNbreFormate+' plante';
128
			titre += (plteNbre > 1) ? 's' : '' ;
134
			stats += (plteNbre > 1) ? 's' : '' ;
129
		} else {
135
		} else {
130
			if($('.taxon-actif .taxon').text() != '') {
136
			if($('.taxon-actif .taxon').text() != '') {
131
				var element = $('.taxon-actif .taxon').clone();
137
				var element = $('.taxon-actif .taxon').clone();
132
				element.children().remove();
138
				element.children().remove();
133
		        var taxon = element.text();
139
		        var taxon = element.text();
134
				titre += ' pour '+taxon;
140
		        stats += ' pour '+taxon;
135
			} else {
141
			} else {
136
				if (taxonsCarte[0]) {
142
				if (taxonsCarte[0]) {
137
					var taxon = taxonsCarte[0];
143
					var taxon = taxonsCarte[0];
Line -... Line 144...
-
 
144
					stats += ' pour '+taxon.nom;
-
 
145
				}
138
					titre += ' pour '+taxon.nom;
146
			}
139
				}
147
		}
-
 
148
		
140
			}
149
		$('#pl-indication-filtre').html('Filtrer parmi <br />'+plteNbre+'<br />plantes');
Line -... Line 150...
-
 
150
		$('#zone-stats').show();
141
		}
151
		$('#zone-stats > h1').text(stats);
142
		
152
	}
143
		$('#carte-titre-infos').text(titre);
153
	centrerTitreEtStats();
144
	}
154
}
145
}
155
 
146
 
156
var tailleTitreOriginelle = null;
147
function definirTailleTitre() {
157
function definirTailleTitre() {
148
	var largeurViewPort = $(window).width();
158
	var largeurViewPort = $(window).width();
149
	var taille = null;
159
	var taille = null;
150
	if (largeurViewPort < 400) {
160
	if (largeurViewPort < 400) {
-
 
161
		taille = '0.8';
-
 
162
	} else if (largeurViewPort >= 400 && largeurViewPort < 800) {
151
		taille = '0.8';
163
		taille = '1.0';
-
 
164
	} else if (largeurViewPort >= 800) {
-
 
165
		taille = '1.6';
-
 
166
	}
-
 
167
	
-
 
168
	// Aménagement de la taille de police selon l'écran
-
 
169
	$("#carte-titre").css('font-size', taille+'em');
-
 
170
	$("#zone-stats h1").css('font-size', taille+'em');
-
 
171
	
-
 
172
	// Dimensionnement du titre et du logo
-
 
173
	if(urlLogo != "null") {
-
 
174
		hauteurLogo = $('#logo img').height();
-
 
175
		// Redimensionnement du logo s'il est trop grand
-
 
176
		// on perd en qualité mais ça vaut mieux que de casser l'affichage
-
 
177
		if(hauteurLogo > 60) {
-
 
178
			hauteurLogo = 60;
-
 
179
			$('#logo img').height(60);
-
 
180
		}
-
 
181
		
-
 
182
		if(hauteurLogo == 0) {
-
 
183
			$('#logo img').load(function(event) {
-
 
184
				definirTailleTitre();
-
 
185
			});
-
 
186
			return;
-
 
187
		}
-
 
188
		
-
 
189
		largeurLogo = $('#logo img').width();
-
 
190
		largeurTitre = $('#carte-titre-infos').width();
-
 
191
		
-
 
192
		$('#zone-titre').css("height", (hauteurLogo)+"px");
-
 
193
		$('#zone-titre').css("width", (largeurLogo+largeurTitre+16)+"px");
-
 
194
		
-
 
195
		if(titreCarte != 'null' && titreCarte != 0) {
-
 
196
			$('#carte-titre-infos').css("position", "absolute");
-
 
197
			$('#carte-titre-infos').css("left", (largeurLogo+16)+"px");
-
 
198
			$('#carte-titre-infos').css("top", (hauteurLogo/2 - 8)+"px");
-
 
199
		}
-
 
200
	}
-
 
201
}
-
 
202
 
-
 
203
function centrerTitreEtStats() {
-
 
204
	var largeurViewPort = $(window).width();
-
 
205
	var largeurTitre = $('#zone-titre').width();
152
	} else if (largeurViewPort >= 400 && largeurViewPort < 800) {
206
	var marge = (largeurViewPort - largeurTitre)/2;
Line 153... Line 207...
153
		taille = '1.0';
207
	$('#zone-titre').css("margin-left",marge);
154
	} else if (largeurViewPort >= 800) {
208
	
Line 155... Line 209...
155
		taille = '1.6';
209
	var largeurStats = $('#zone-stats').width();
156
	}
210
	var marge = (largeurViewPort - largeurStats)/2;
157
	$("#carte-titre").css('font-size', taille+'em');
211
	$('#zone-stats').css("left",marge);
158
}
-
 
159
 
-
 
160
/*+--------------------------------------------------------------------------------------------------------+*/
-
 
161
// CARTE
-
 
162
 
212
}
Line 163... Line 213...
163
function initialiserAffichageCarte() {
213
 
164
	$('#carte').height($(window).height() - 35);
214
/*+--------------------------------------------------------------------------------------------------------+*/
165
	$('#carte').width($(window).width() - 24);
215
// CARTE
Line 265... Line 315...
265
		marqueur.setMap(null);
315
		marqueur.setMap(null);
266
	});
316
	});
267
	marqueurs = new Array();
317
	marqueurs = new Array();
Line 268... Line 318...
268
	
318
	
269
	stations = data;
319
	stations = data;
Line 270... Line 320...
270
	afficherTitreCarte();
320
	afficherTitreCarteEtStats();
271
	
321
	
272
	$.each(stations.points, function (index, station) {		
322
	$.each(stations.points, function (index, station) {		
273
		if(station != null) {
323
		if(station != null) {
Line 555... Line 605...
555
function actualiserPagineur() {
605
function actualiserPagineur() {
556
	pagineur.stationId = pointClique.stationInfos.id;
606
	pagineur.stationId = pointClique.stationInfos.id;
557
	pagineur.total = pointClique.stationInfos.obsNbre;
607
	pagineur.total = pointClique.stationInfos.obsNbre;
558
	// Si on est en mode photo on reste en mode liste quelque soit le 
608
	// Si on est en mode photo on reste en mode liste quelque soit le 
559
	// nombre de résultats
609
	// nombre de résultats
560
	if (pagineur.total > 4 && photos_seulement != 1) {
610
	if (pagineur.total > 4 && photos != 1) {
561
		pagineur.format = 'tableau';
611
		pagineur.format = 'tableau';
562
	} else {
612
	} else {
563
		pagineur.format = 'liste';
613
		pagineur.format = 'liste';
564
	}
614
	}
565
}
615
}
Line 861... Line 911...
861
	return false;
911
	return false;
862
}
912
}
863
/*+--------------------------------------------------------------------------------------------------------+*/
913
/*+--------------------------------------------------------------------------------------------------------+*/
864
// PANNEAU LATÉRAL
914
// PANNEAU LATÉRAL
Line 865... Line 915...
865
 
915
 
866
function initialiserAffichagePanneauLateral() {
-
 
867
	$('#panneau-lateral').height($(window).height() - 35);
-
 
868
	
916
function initialiserAffichagePanneauLateral() {	
869
	if (nt == '*') {
917
	if (nt == '*') {
870
		$('#pl-ouverture').bind('click', afficherPanneauLateral);
918
		$('#pl-ouverture').bind('click', afficherPanneauLateral);
871
		$('#pl-fermeture').bind('click', cacherPanneauLateral);
919
		$('#pl-fermeture').bind('click', cacherPanneauLateral);
872
	} else {
920
	} else {
Line 889... Line 937...
889
		});
937
		});
890
	} else {
938
	} else {
891
		if (nt == '*') {
939
		if (nt == '*') {
892
			afficherTaxons();
940
			afficherTaxons();
893
		}
941
		}
894
		afficherTitreCarte();
942
		afficherTitreCarteEtStats();
895
	}
943
	}
896
}
944
}
Line 897... Line 945...
897
 
945
 
898
function afficherTaxons() {
946
function afficherTaxons() {
Line 901... Line 949...
901
	$('.taxon').live('click', filtrerParTaxon);
949
	$('.taxon').live('click', filtrerParTaxon);
902
}
950
}
Line 903... Line 951...
903
 
951
 
-
 
952
 
904
 
953
function afficherPanneauLateral() {
905
function afficherPanneauLateral() {
954
	$('#panneau-lateral').height($(window).height());
906
	$('#panneau-lateral').width(300);
955
	$('#panneau-lateral').width(300);
907
	$('#pl-contenu').css('display', 'block');
956
	$('#pl-contenu').css('display', 'block');
908
	$('#pl-ouverture').css('display', 'none');
957
	$('#pl-ouverture').css('display', 'none');
Line 909... Line 958...
909
	$('#pl-fermeture').css('display', 'block');
958
	$('#pl-fermeture').css('display', 'block');
910
	$('#carte').css('left', '300px');
959
	$('#panneau-lateral').css("top","0");
Line 911... Line 960...
911
 
960
 
-
 
961
	google.maps.event.trigger(map, 'resize');
912
	google.maps.event.trigger(map, 'resize');
962
};
913
};
963
 
914
 
964
function cacherPanneauLateral() {
915
function cacherPanneauLateral() {
965
	$('#panneau-lateral').height("60px");
916
	$('#panneau-lateral').width(24);
-
 
Line 917... Line 966...
917
	$('#pl-contenu').css('display', 'none');
966
	$('#panneau-lateral').width("83px");
918
	$('#pl-ouverture').css('display', 'block');
967
	$('#pl-contenu').css('display', 'none');
Line 919... Line 968...
919
	$('#pl-fermeture').css('display', 'none');
968
	$('#pl-ouverture').css('display', 'block');