Subversion Repositories eFlore/Applications.cel

Compare Revisions

Ignore whitespace Rev 2745 → Rev 2748

/trunk/widget/modules/saisie/squelettes/sauvages/js/WidgetSaisieSauvages.js
17,6 → 17,9
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();
 
278,6 → 281,10
};
 
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);
313,6 → 320,8
};
 
WidgetSaisieSauvages.prototype.surDeplacementMarkerFin = function() {
// Annulation d'une éventuelle recherche déjà en cours
this.annulerRechercherRue();
this.rechercherRue();
};
 
342,12 → 351,12
"&latitude_fin="+this.markerFin.getPosition().lat()+"&longitude_fin="+this.markerFin.getPosition().lng();
var lthis = this;
 
$.getJSON(this.serviceTraceRueUrl+'?'+params, function(data) {
this.requeteRechercheRue = $.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 tags = {"name" : lthis.aucuneRueSelectionnee};
var pasDeRue = {"geometry" : [coordDeb, coordFin], "tags" : tags};
lthis.listeRues.push(pasDeRue);
lthis.indexRueSelectionnee = 0;
355,6 → 364,15
});
}
 
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']);
362,7 → 380,7
}
 
WidgetSaisieSauvages.prototype.afficherIndicationRue = function(indication) {
indication = !!indication ? indication : "Nom de rue inconnu";
indication = !!indication ? indication : this.nomDeRueInconnue;
$('#indication-nom-rue-nom').html(indication);
$('#indication-nom-rue').css('visibility','visible');
$('#indication-nom-rue').effect("highlight", {}, 500);
667,7 → 685,7
referentiel = (numNomSel == undefined) ? '' : '['+ this.nomSciReferentiel +']',
commune = $('#commune-nom').text(),
codeInsee = $('#commune-code-insee').text(),
station = $('input[name="adresse"]').val(),
station = this.getValeurStation(),
lat = $('input[name="latitude"]').val(),
lng = $('input[name="longitude"]').val(),
date = $('#date').val(),
715,6 → 733,18
$('#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 = [];
835,7 → 865,7
'date': $('#date').val(),
'notes': notes,
 
'station': $('input[name="adresse"]').val(),
'station': this.getValeurStation(),
'latitude': $('#latitude').val(),
'longitude': $('#longitude').val(),
'commune_nom': $('#commune-nom').text(),