13,7 → 13,10 |
this.googleMapMarqueurFinUrl = null; |
this.ville = null; |
this.supprimerIconeUrl = null; |
this.serviceTraceRueUrl = null; |
this.taxons = {}; |
this.listeRues = {}; |
this.indexRueSelectionnee = 0; |
} |
WidgetSaisieSauvages.prototype = new WidgetSaisie(); |
|
138,6 → 141,8 |
$('#fichier').click(); |
}); |
$('#geolocaliser').on('click', this.geolocaliser.bind(this)); |
|
$('.navigation-rue').on('click', this.surClicRueSuivantPrecedent.bind(this)) |
}; |
|
WidgetSaisieSauvages.prototype.montrerFormIdentite = function() { |
279,15 → 284,10 |
this.mettreAJourMarkerPosition(this.latLngDeb); |
this.trouverCommune(this.latLngDeb); |
|
if (this.premierDeplacement) { |
this.initialiserMarkerDeb(); |
this.premierDeplacement = false; |
} else { |
var nouvellePositionFin = new google.maps.LatLng(this.latLngDeb.lat(), this.latLngDeb.lng() + 0.0010); |
this.initialiserMarkerFin(); |
this.deplacerMarkerFin(nouvellePositionFin) |
this.afficherEtapeGeolocalisation(3); |
} |
var nouvellePositionFin = new google.maps.LatLng(this.latLngDeb.lat(), this.latLngDeb.lng() + 0.0010); |
this.initialiserMarkerFin(); |
this.deplacerMarkerFin(nouvellePositionFin) |
this.afficherEtapeGeolocalisation(3); |
}; |
|
WidgetSaisieSauvages.prototype.initialiserMarkerFin = function() { |
313,9 → 313,83 |
}; |
|
WidgetSaisieSauvages.prototype.surDeplacementMarkerFin = function() { |
this.dessinerLigneRue(this.markerDeb.getPosition(), this.markerFin.getPosition()); |
this.afficherCentreRue(); |
this.rechercherRue(); |
}; |
|
WidgetSaisieSauvages.prototype.surClicRueSuivantPrecedent = function(event) { |
event.preventDefault(); |
if($(event.target).hasClass("navigation-rue-suivant")) { |
this.indexRueSelectionnee = this.indexRueSelectionnee < this.listeRues.length - 1 ? this.indexRueSelectionnee + 1 : 0; |
} else { |
this.indexRueSelectionnee = this.indexRueSelectionnee > 0 ? this.indexRueSelectionnee - 1 : this.listeRues.length - 1; |
} |
this.mettreRueEnValeur(this.listeRues[this.indexRueSelectionnee]); |
} |
|
WidgetSaisieSauvages.prototype.afficherChargementRechercheRue = function() { |
this.ligneRue.setMap(null); |
var img = '<img src="'+this.chargementImageIconeUrl+'" />'; |
$('#indication-nom-rue-nom').html(img+" Recherche de la rue en cours"); |
$('#indication-nom-rue').css('visibility','visible'); |
$('#indication-nom-rue').effect("highlight", {}, 500); |
$(".navigation-rue").toggle(false); |
} |
|
WidgetSaisieSauvages.prototype.rechercherRue = function() { |
this.afficherChargementRechercheRue(); |
|
var params = "latitude_debut="+this.markerDeb.getPosition().lat()+"&longitude_debut="+this.markerDeb.getPosition().lng()+ |
"&latitude_fin="+this.markerFin.getPosition().lat()+"&longitude_fin="+this.markerFin.getPosition().lng(); |
var lthis = this; |
|
$.getJSON(this.serviceTraceRueUrl+'?'+params, function(data) { |
$('#indication-nom-rue-nom').html(""); |
lthis.listeRues = data.elements; |
var coordDeb = {"lat" : lthis.markerDeb.getPosition().lat(), "lon" : lthis.markerDeb.getPosition().lng()}; |
var coordFin = {"lat" : lthis.markerFin.getPosition().lat(), "lon" : lthis.markerFin.getPosition().lng()}; |
var tags = {"name" : "Aucune rue sélectionnée" }; |
var pasDeRue = {"geometry" : [coordDeb, coordFin], "tags" : tags}; |
lthis.listeRues.push(pasDeRue); |
lthis.indexRueSelectionnee = 0; |
lthis.mettreRueEnValeur(lthis.listeRues[0]); |
}); |
} |
|
WidgetSaisieSauvages.prototype.mettreRueEnValeur = function(rue) { |
this.afficherIndicationRue(rue['tags']['name']); |
this.afficherTraceRue(rue['geometry']); |
this.afficherEtapeGeolocalisation(4); |
} |
|
WidgetSaisieSauvages.prototype.afficherIndicationRue = function(indication) { |
indication = !!indication ? indication : "Nom de rue inconnu"; |
$('#indication-nom-rue-nom').html(indication); |
$('#indication-nom-rue').css('visibility','visible'); |
$('#indication-nom-rue').effect("highlight", {}, 500); |
$(".navigation-rue").toggle(this.listeRues.length > 1); |
} |
|
WidgetSaisieSauvages.prototype.afficherTraceRue = function(rue) { |
|
if (this.ligneRue != undefined) { |
this.ligneRue.setMap(null); |
} |
|
var cheminRue = new Array(); |
if(rue.length > 0) { |
$.each(rue, function(index, value) { |
cheminRue.push(new google.maps.LatLng(value['lat'], value['lon'])); |
}); |
|
this.ligneRue = new google.maps.Polyline({ |
path: cheminRue, |
strokeColor: "#FF0000", |
strokeOpacity: 1.0, |
strokeWeight: 2 |
}); |
|
this.ligneRue.setMap(this.map); |
} |
}; |
|
WidgetSaisieSauvages.prototype.dessinerLigneRue = function(pointDebut, pointFin) { |