Subversion Repositories eFlore/Applications.cel

Rev

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

Rev 1447 Rev 1448
Line 63... Line 63...
63
	initialiserWidget();
63
	initialiserWidget();
64
});
64
});
Line 65... Line 65...
65
 
65
 
66
function initialiserWidget() {
66
function initialiserWidget() {
-
 
67
	urlVars = getUrlVars();
-
 
68
	initialiserCarte();
67
	urlVars = getUrlVars();
69
	dimensionnerCarte();
68
	definirTailleOverlay();
70
	definirTailleOverlay();
69
	attribuerListenersOverlay();
71
	attribuerListenersOverlay();
70
	centrerTitreEtStats();
-
 
71
	initialiserAffichageCarte();
72
	centrerTitreEtStats();
72
	initialiserAffichagePanneauLateral();
-
 
73
	initialiserCarte();
73
	initialiserAffichagePanneauLateral();
74
	initialiserGestionnaireMarqueurs()
74
	initialiserGestionnaireMarqueurs()
75
	initialiserInfoBulle();
75
	initialiserInfoBulle();
76
	initialiserFormulaireContact();
76
	initialiserFormulaireContact();
77
	chargerLimitesCommunales();
77
	chargerLimitesCommunales();
Line 145... Line 145...
145
				}
145
				}
146
			}
146
			}
147
		}
147
		}
Line 148... Line 148...
148
		
148
		
-
 
149
		$('#zone-stats').show();
149
		$('#zone-stats').show();
150
	} else {
150
		$('#zone-stats > h1').text(stats);
151
		stats = "Aucune observation pour ces critères ou pour cette zone";
-
 
152
	}
-
 
153
	
151
	}
154
	$('#zone-stats > h1').text(stats);
152
	centrerTitreEtStats();
155
	centrerTitreEtStats();
Line 153... Line 156...
153
}
156
}
Line 154... Line 157...
154
 
157
 
155
function attribuerListenersOverlay() {
158
function attribuerListenersOverlay() {
-
 
159
	
156
	
160
	$(window).resize(function() {
157
	$(window).resize(function() {
161
		google.maps.event.trigger($('#carte'), 'resize');
158
		google.maps.event.trigger($('#carte'), 'resize');
162
		dimensionnerCarte();
159
		definirTailleOverlay();
163
		definirTailleOverlay();
Line 177... Line 181...
177
	var taille = '1.6';
181
	var taille = '1.6';
178
	var tailleMaxLogo = 60;
182
	var tailleMaxLogo = 60;
179
	var tailleMaxIcones = 10;
183
	var tailleMaxIcones = 10;
180
	var padding_icones = 8;
184
	var padding_icones = 8;
181
	var tailleFiltre = 80;
185
	var tailleFiltre = 80;
182
	if (largeurViewPort <= 500) {
186
	if (largeurViewPort <= 450) {
-
 
187
		taille = '1';
-
 
188
		tailleMaxIcones = 10;
-
 
189
		tailleFiltre = 65;
-
 
190
		padding_icones = 2;	
-
 
191
		var tailleMaxLogo = 50;
-
 
192
	} else if (largeurViewPort <= 500) {
183
		taille = '1.2';
193
		taille = '1.2';
184
		tailleMaxIcones = 10;
194
		tailleMaxIcones = 10;
185
		tailleFiltre = 65;
195
		tailleFiltre = 65;
186
		padding_icones = 2;	
196
		padding_icones = 2;	
-
 
197
		var tailleMaxLogo = 50;
187
	} else if (largeurViewPort > 500 && largeurViewPort <= 800) {
198
	} else if (largeurViewPort > 500 && largeurViewPort <= 800) {
188
		taille = '1.4';
199
		taille = '1.4';
189
		tailleMaxIcones = 15;
200
		tailleMaxIcones = 15;
190
		padding_icones = 6;
201
		padding_icones = 6;
191
		tailleFiltre = 65;
202
		tailleFiltre = 65;
-
 
203
		var tailleMaxLogo = 55;
192
	} else if (largeurViewPort > 800) {
204
	} else if (largeurViewPort > 800) {
193
		taille = '1.6';
205
		taille = '1.6';
194
		tailleMaxIcones = 20;
206
		tailleMaxIcones = 20;
195
		padding_icones = 8;
207
		padding_icones = 8;
196
		tailleFiltre = 80;
208
		tailleFiltre = 80;
197
	}
209
	}
Line 198... Line 210...
198
	
210
	
199
	// Aménagement de la taille de police selon l'écran
211
	// Aménagement de la taille de police selon l'écran
Line 200... Line 212...
200
	$("#carte-titre").css('font-size', taille+'em');
212
	$("#carte-titre").css('font-size', taille+'em');
201
	
213
	
202
	$("#zone-stats h1").css('font-size', Math.round((taille*0.75*100)/100)+'em');
214
	$("#zone-stats h1").css('font-size', Math.round((taille*0.75*100))/100+'em');
Line 203... Line 215...
203
	$("#zone-stats").css('padding', padding_icones+"px "+padding_icones+"px "+Math.round(padding_icones/4)+"px");	
215
	$("#zone-stats").css('padding', padding_icones+"px "+padding_icones+"px "+Math.round(padding_icones/4)+"px");	
204
	$('#zone-stats').height(tailleMaxIcones*1.5);
216
	$('#zone-stats').height(tailleMaxIcones*1.5);
Line 217... Line 229...
217
	$("#pl-contenu").css('font-size', (taille/2)+'em');
229
	$("#pl-contenu").css('font-size', (taille/2)+'em');
Line 218... Line 230...
218
	
230
	
219
	$("#panneau-lateral").css('padding', padding_icones+"px "+padding_icones+"px "+Math.round(padding_icones/4)+"px");
231
	$("#panneau-lateral").css('padding', padding_icones+"px "+padding_icones+"px "+Math.round(padding_icones/4)+"px");
220
	$('#pl-ouverture').height(((padding_icones*2)+$('#panneau-lateral').height())+"px");
232
	$('#pl-ouverture').height(((padding_icones*2)+$('#panneau-lateral').height())+"px");
221
	$("#panneau-lateral").width(tailleFiltre);
233
	$("#panneau-lateral").width(tailleFiltre);
-
 
234
		
-
 
235
	dimensionnerLogo(tailleMaxLogo);
-
 
236
	dimensionnerImage(largeurViewPort);
-
 
237
	redimensionnerControleTypeCarte(largeurViewPort);
-
 
238
}
-
 
239
 
222
	
240
function dimensionnerLogo(tailleMaxLogo) {
223
	// Dimensionnement du titre et du logo
241
	// Dimensionnement du logo
224
	hauteurLogo = $('.image-logo').height();
242
	hauteurLogo = $('.image-logo').height();
225
	// Redimensionnement du logo s'il est trop grand
243
	// Redimensionnement du logo s'il est trop grand
226
	// on perd en qualité mais ça vaut mieux que de casser l'affichage
244
	// on perd en qualité mais ça vaut mieux que de casser l'affichage
227
	if(hauteurLogo > tailleMaxLogo) {
245
	if(hauteurLogo > tailleMaxLogo) {
Line 238... Line 256...
238
	}
256
	}
Line 239... Line 257...
239
	
257
	
240
	largeurLogo = $('#logo img').width();
258
	largeurLogo = $('#logo img').width();
Line -... Line 259...
-
 
259
}
-
 
260
 
-
 
261
function dimensionnerImage(largeurViewPort) {
-
 
262
	// Dimensionnement de l'image
-
 
263
	if(largeurViewPort > 500) {
-
 
264
		largeurLogo = 155;
-
 
265
	} else {
-
 
266
		largeurLogo = 70;
-
 
267
	}
-
 
268
	
-
 
269
	$('#image-utilisateur img').width(largeurLogo);
-
 
270
}
-
 
271
 
-
 
272
function redimensionnerControleTypeCarte(largeurViewPort) {
-
 
273
	if (largeurViewPort <= 500) {
-
 
274
		carteOptions.mapTypeControlOptions.style = google.maps.MapTypeControlStyle.DROPDOWN_MENU;
-
 
275
	} else {
-
 
276
		carteOptions.mapTypeControlOptions.style = google.maps.MapTypeControlStyle.DEFAULT;
-
 
277
	}
-
 
278
	
-
 
279
	map.setOptions(carteOptions);
241
}
280
}
242
 
281
 
243
function centrerTitreEtStats() {
282
function centrerTitreEtStats() {
244
	centrerTitre();
283
	centrerTitre();
Line 259... Line 298...
259
}
298
}
Line 260... Line 299...
260
 
299
 
261
function centrerStats() {
300
function centrerStats() {
262
	var largeurViewPort = $(window).width();
301
	var largeurViewPort = $(window).width();
263
	var largeurStats = $('#zone-stats').width();
302
	var largeurStats = $('#zone-stats').width();
264
	var marge = ((largeurViewPort - largeurStats)/2) - 10;
303
	var marge = ((largeurViewPort - largeurStats)/2);
265
	$('#zone-stats').css("left",marge);
304
	$('#zone-stats').css("margin-left",marge);
Line 266... Line 305...
266
}
305
}
267
 
306
 
Line 268... Line 307...
268
/*+--------------------------------------------------------------------------------------------------------+*/
307
/*+--------------------------------------------------------------------------------------------------------+*/
269
// CARTE
308
// CARTE
270
 
309
 
271
function initialiserAffichageCarte() {
310
function dimensionnerCarte() {
Line 272... Line 311...
272
	$('#carte').height($(window).height());
311
	$('#carte').height($(window).height());
Line 385... Line 424...
385
function doitCentrerCarte() {
424
function doitCentrerCarte() {
386
	return premierChargement && urlVars != null && urlVars.length > 0;
425
	return premierChargement && urlVars != null && urlVars.length > 0;
387
}
426
}
Line 388... Line 427...
388
 
427
 
-
 
428
function rafraichirMarqueurs(data) {
-
 
429
	
-
 
430
	marqueurs = new Array();
-
 
431
	stations = null;
389
function rafraichirMarqueurs(data) {
432
	
390
	if(data.points.length > 0) {
433
	if(data.points.length > 0) {
391
		$.each(marqueurs, function(index, marqueur) {
434
		$.each(marqueurs, function(index, marqueur) {
392
			marqueur.setMap(null);
435
			marqueur.setMap(null);
393
		});
436
		});
Line 394... Line 437...
394
		marqueurs = new Array();
437
		marqueurs = new Array();
395
		
-
 
Line 396... Line 438...
396
		stations = data;
438
		
397
		afficherTitreCarteEtStats();
439
		stations = data;
398
		
440
		
399
		$.each(stations.points, function (index, station) {		
441
		$.each(stations.points, function (index, station) {		
Line 410... Line 452...
410
			var latMin = new google.maps.LatLng(data.stats.coordmax.latMin, data.stats.coordmax.lngMin);
452
			var latMin = new google.maps.LatLng(data.stats.coordmax.latMin, data.stats.coordmax.lngMin);
411
			bounds.extend(latMax);
453
			bounds.extend(latMax);
412
			bounds.extend(latMin);
454
			bounds.extend(latMin);
413
			rendrePointsVisibles(bounds);	
455
			rendrePointsVisibles(bounds);	
414
		}
456
		}
415
	} else {
-
 
416
		afficherMessageAucuneObs();
-
 
417
	}
457
	}
-
 
458
	
-
 
459
	afficherTitreCarteEtStats();
418
}
460
}
Line 419... Line 461...
419
 
461
 
420
function creerMarqueur(station) {
462
function creerMarqueur(station) {
421
	var titre = '';
463
	var titre = '';