Subversion Repositories eFlore/Applications.cel

Rev

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

Rev 2736 Rev 2744
Line 11... Line 11...
11
	this.avertissementDeuxPhotosAffiche = false;
11
	this.avertissementDeuxPhotosAffiche = false;
12
	this.googleMapMarqueurDebutUrl = null;
12
	this.googleMapMarqueurDebutUrl = null;
13
	this.googleMapMarqueurFinUrl = null;
13
	this.googleMapMarqueurFinUrl = null;
14
	this.ville = null;
14
	this.ville = null;
15
	this.supprimerIconeUrl = null;
15
	this.supprimerIconeUrl = null;
-
 
16
	this.serviceTraceRueUrl = null;
16
	this.taxons = {};
17
	this.taxons = {};
-
 
18
	this.listeRues = {};
-
 
19
	this.indexRueSelectionnee = 0;
17
}	
20
}	
18
WidgetSaisieSauvages.prototype = new WidgetSaisie();
21
WidgetSaisieSauvages.prototype = new WidgetSaisie();
Line 19... Line 22...
19
 
22
 
20
// surcharge
23
// surcharge
Line 136... Line 139...
136
 
139
 
137
	$('#photo-placeholder').click(function(event) {
140
	$('#photo-placeholder').click(function(event) {
138
		$('#fichier').click();
141
		$('#fichier').click();
139
	});
142
	});
-
 
143
	$('#geolocaliser').on('click', this.geolocaliser.bind(this));
-
 
144
	
140
	$('#geolocaliser').on('click', this.geolocaliser.bind(this));
145
	$('.navigation-rue').on('click', this.surClicRueSuivantPrecedent.bind(this))
Line 141... Line 146...
141
};
146
};
142
 
147
 
143
WidgetSaisieSauvages.prototype.montrerFormIdentite = function() {
148
WidgetSaisieSauvages.prototype.montrerFormIdentite = function() {
Line 277... Line 282...
277
	this.markerDeb.setPosition(this.latLngDeb);
282
	this.markerDeb.setPosition(this.latLngDeb);
278
	this.map.setCenter(this.latLngDeb);
283
	this.map.setCenter(this.latLngDeb);
279
	this.mettreAJourMarkerPosition(this.latLngDeb);
284
	this.mettreAJourMarkerPosition(this.latLngDeb);
280
	this.trouverCommune(this.latLngDeb);
285
	this.trouverCommune(this.latLngDeb);
Line 281... Line -...
281
 
-
 
282
	if (this.premierDeplacement) {
-
 
283
		this.initialiserMarkerDeb();
-
 
284
		this.premierDeplacement = false;
-
 
285
	} else {
286
 
286
		var nouvellePositionFin = new google.maps.LatLng(this.latLngDeb.lat(), this.latLngDeb.lng() + 0.0010);
287
	var nouvellePositionFin = new google.maps.LatLng(this.latLngDeb.lat(), this.latLngDeb.lng() + 0.0010);
287
		this.initialiserMarkerFin();
288
	this.initialiserMarkerFin();
288
		this.deplacerMarkerFin(nouvellePositionFin)
289
	this.deplacerMarkerFin(nouvellePositionFin)
289
		this.afficherEtapeGeolocalisation(3);
-
 
290
	}
290
	this.afficherEtapeGeolocalisation(3);
Line 291... Line 291...
291
};
291
};
292
 
292
 
293
WidgetSaisieSauvages.prototype.initialiserMarkerFin = function() {
293
WidgetSaisieSauvages.prototype.initialiserMarkerFin = function() {
Line 311... Line 311...
311
	this.markerFin.setPosition(this.latLngFin);
311
	this.markerFin.setPosition(this.latLngFin);
312
	this.dessinerLigneRue(this.latLngDeb, this.latLngFin);
312
	this.dessinerLigneRue(this.latLngDeb, this.latLngFin);
313
};
313
};
Line 314... Line 314...
314
 
314
 
-
 
315
WidgetSaisieSauvages.prototype.surDeplacementMarkerFin = function() {
-
 
316
	this.rechercherRue();
-
 
317
};
-
 
318
 
-
 
319
WidgetSaisieSauvages.prototype.surClicRueSuivantPrecedent = function(event) {
-
 
320
	event.preventDefault();
-
 
321
	if($(event.target).hasClass("navigation-rue-suivant")) {
-
 
322
		this.indexRueSelectionnee = this.indexRueSelectionnee < this.listeRues.length - 1 ? this.indexRueSelectionnee + 1 : 0;
-
 
323
	} else {
-
 
324
		this.indexRueSelectionnee = this.indexRueSelectionnee > 0 ? this.indexRueSelectionnee - 1 : this.listeRues.length - 1;
-
 
325
	}
-
 
326
	this.mettreRueEnValeur(this.listeRues[this.indexRueSelectionnee]);
-
 
327
}
-
 
328
 
-
 
329
WidgetSaisieSauvages.prototype.afficherChargementRechercheRue = function() {
-
 
330
	this.ligneRue.setMap(null);
-
 
331
	var img = '<img src="'+this.chargementImageIconeUrl+'" />';
-
 
332
	$('#indication-nom-rue-nom').html(img+" Recherche de la rue en cours");
-
 
333
	$('#indication-nom-rue').css('visibility','visible');
-
 
334
	$('#indication-nom-rue').effect("highlight", {}, 500);
-
 
335
	$(".navigation-rue").toggle(false);
-
 
336
}
-
 
337
 
-
 
338
WidgetSaisieSauvages.prototype.rechercherRue = function() {
-
 
339
	this.afficherChargementRechercheRue();
-
 
340
	
-
 
341
	var params = "latitude_debut="+this.markerDeb.getPosition().lat()+"&longitude_debut="+this.markerDeb.getPosition().lng()+
-
 
342
	"&latitude_fin="+this.markerFin.getPosition().lat()+"&longitude_fin="+this.markerFin.getPosition().lng();
-
 
343
	var lthis = this;
-
 
344
 
-
 
345
	$.getJSON(this.serviceTraceRueUrl+'?'+params, function(data) {
-
 
346
		$('#indication-nom-rue-nom').html("");	
-
 
347
		lthis.listeRues = data.elements;
315
WidgetSaisieSauvages.prototype.surDeplacementMarkerFin = function() {
348
		var coordDeb = {"lat" : lthis.markerDeb.getPosition().lat(), "lon" : lthis.markerDeb.getPosition().lng()};
-
 
349
		var coordFin = {"lat" : lthis.markerFin.getPosition().lat(), "lon" : lthis.markerFin.getPosition().lng()};
-
 
350
		var tags = {"name" : "Aucune rue sélectionnée" };
-
 
351
		var pasDeRue = {"geometry" : [coordDeb, coordFin], "tags" : tags};
-
 
352
		lthis.listeRues.push(pasDeRue);
-
 
353
		lthis.indexRueSelectionnee = 0;
-
 
354
		lthis.mettreRueEnValeur(lthis.listeRues[0]);	
-
 
355
	});
-
 
356
}
-
 
357
 
-
 
358
WidgetSaisieSauvages.prototype.mettreRueEnValeur = function(rue) {
316
	this.dessinerLigneRue(this.markerDeb.getPosition(), this.markerFin.getPosition());
359
	this.afficherIndicationRue(rue['tags']['name']);
317
	this.afficherCentreRue();
360
	this.afficherTraceRue(rue['geometry']);
-
 
361
	this.afficherEtapeGeolocalisation(4);
-
 
362
}
-
 
363
 
-
 
364
WidgetSaisieSauvages.prototype.afficherIndicationRue = function(indication) {
-
 
365
	indication = !!indication ? indication : "Nom de rue inconnu";
-
 
366
	$('#indication-nom-rue-nom').html(indication);
-
 
367
	$('#indication-nom-rue').css('visibility','visible');
-
 
368
	$('#indication-nom-rue').effect("highlight", {}, 500);
-
 
369
	$(".navigation-rue").toggle(this.listeRues.length > 1);
-
 
370
}
-
 
371
 
-
 
372
WidgetSaisieSauvages.prototype.afficherTraceRue = function(rue) {
-
 
373
 
-
 
374
	if (this.ligneRue != undefined) {
-
 
375
		this.ligneRue.setMap(null);
-
 
376
	}
-
 
377
 
-
 
378
	var cheminRue = new Array();
-
 
379
	if(rue.length > 0) {
-
 
380
		$.each(rue, function(index, value) {
-
 
381
			cheminRue.push(new google.maps.LatLng(value['lat'], value['lon']));
-
 
382
		});
-
 
383
		
-
 
384
		this.ligneRue = new google.maps.Polyline({
-
 
385
			path: cheminRue,
-
 
386
			strokeColor: "#FF0000",
-
 
387
			strokeOpacity: 1.0,
-
 
388
			strokeWeight: 2
-
 
389
		});
-
 
390
	
-
 
391
		this.ligneRue.setMap(this.map);
318
	this.afficherEtapeGeolocalisation(4);
392
	}
Line 319... Line 393...
319
};
393
};
320
 
394
 
321
WidgetSaisieSauvages.prototype.dessinerLigneRue = function(pointDebut, pointFin) {
395
WidgetSaisieSauvages.prototype.dessinerLigneRue = function(pointDebut, pointFin) {