17,9 → 17,6 |
this.taxons = {}; |
this.listeRues = {}; |
this.indexRueSelectionnee = 0; |
this.requeteRechercheRue = null; |
this.aucuneRueSelectionnee = "Aucune rue sélectionnée"; |
this.nomDeRueInconnue = "Nom de rue inconnu"; |
} |
WidgetSaisieSauvages.prototype = new WidgetSaisie(); |
|
281,10 → 278,6 |
}; |
|
WidgetSaisieSauvages.prototype.deplacerMarkerDeb = function(nouvellePosition) { |
|
// Annulation d'une éventuelle recherche de rue déjà en cours |
this.annulerRechercherRue(); |
|
this.latLngDeb = nouvellePosition; |
this.markerDeb.setPosition(this.latLngDeb); |
this.map.setCenter(this.latLngDeb); |
320,8 → 313,6 |
}; |
|
WidgetSaisieSauvages.prototype.surDeplacementMarkerFin = function() { |
// Annulation d'une éventuelle recherche déjà en cours |
this.annulerRechercherRue(); |
this.rechercherRue(); |
}; |
|
351,12 → 342,12 |
"&latitude_fin="+this.markerFin.getPosition().lat()+"&longitude_fin="+this.markerFin.getPosition().lng(); |
var lthis = this; |
|
this.requeteRechercheRue = $.getJSON(this.serviceTraceRueUrl+'?'+params, function(data) { |
$.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" : lthis.aucuneRueSelectionnee}; |
var tags = {"name" : "Aucune rue sélectionnée" }; |
var pasDeRue = {"geometry" : [coordDeb, coordFin], "tags" : tags}; |
lthis.listeRues.push(pasDeRue); |
lthis.indexRueSelectionnee = 0; |
364,15 → 355,6 |
}); |
} |
|
WidgetSaisieSauvages.prototype.annulerRechercherRue = function() { |
if(this.requeteRechercheRue != null) { |
this.requeteRechercheRue.abort(); |
this.requeteRechercheRue = null; |
$('#indication-nom-rue').css('visibility','hidden'); |
} |
} |
|
|
WidgetSaisieSauvages.prototype.mettreRueEnValeur = function(rue) { |
this.afficherIndicationRue(rue['tags']['name']); |
this.afficherTraceRue(rue['geometry']); |
380,7 → 362,7 |
} |
|
WidgetSaisieSauvages.prototype.afficherIndicationRue = function(indication) { |
indication = !!indication ? indication : this.nomDeRueInconnue; |
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); |
685,7 → 667,7 |
referentiel = (numNomSel == undefined) ? '' : '['+ this.nomSciReferentiel +']', |
commune = $('#commune-nom').text(), |
codeInsee = $('#commune-code-insee').text(), |
station = this.getValeurStation(), |
station = $('input[name="adresse"]').val(), |
lat = $('input[name="latitude"]').val(), |
lng = $('input[name="longitude"]').val(), |
date = $('#date').val(), |
733,18 → 715,6 |
$('#zone-liste-obs').removeClass("hidden"); |
}; |
|
WidgetSaisieSauvages.prototype.getValeurStation = function() { |
var station = ""; |
var valeurSelectionnee = $("#indication-nom-rue-nom").text().trim(); |
if(valeurSelectionnee == this.aucuneRueSelectionnee || valeurSelectionnee == this.nomDeRueInconnue) { |
station = $('input[name="adresse"]').val().trim() |
} else { |
station = $("#indication-nom-rue-nom").text().trim(); |
} |
|
return station; |
} |
|
WidgetSaisieSauvages.prototype.getMilieux = function() { |
var milieuxStr = '', |
milieux = []; |
865,7 → 835,7 |
'date': $('#date').val(), |
'notes': notes, |
|
'station': this.getValeurStation(), |
'station': $('input[name="adresse"]').val(), |
'latitude': $('#latitude').val(), |
'longitude': $('#longitude').val(), |
'commune_nom': $('#commune-nom').text(), |