Line 15... |
Line 15... |
15 |
this.supprimerIconeUrl = null;
|
15 |
this.supprimerIconeUrl = null;
|
16 |
this.serviceTraceRueUrl = null;
|
16 |
this.serviceTraceRueUrl = null;
|
17 |
this.taxons = {};
|
17 |
this.taxons = {};
|
18 |
this.listeRues = {};
|
18 |
this.listeRues = {};
|
19 |
this.indexRueSelectionnee = 0;
|
19 |
this.indexRueSelectionnee = 0;
|
- |
|
20 |
this.requeteRechercheRue = null;
|
- |
|
21 |
this.aucuneRueSelectionnee = "Aucune rue sélectionnée";
|
- |
|
22 |
this.nomDeRueInconnue = "Nom de rue inconnu";
|
20 |
}
|
23 |
}
|
21 |
WidgetSaisieSauvages.prototype = new WidgetSaisie();
|
24 |
WidgetSaisieSauvages.prototype = new WidgetSaisie();
|
Line 22... |
Line 25... |
22 |
|
25 |
|
23 |
// surcharge
|
26 |
// surcharge
|
Line 276... |
Line 279... |
276 |
this.latLngDeb = this.markerDeb.getPosition();
|
279 |
this.latLngDeb = this.markerDeb.getPosition();
|
277 |
this.deplacerMarkerDeb(this.latLngDeb);
|
280 |
this.deplacerMarkerDeb(this.latLngDeb);
|
278 |
};
|
281 |
};
|
Line 279... |
Line 282... |
279 |
|
282 |
|
- |
|
283 |
WidgetSaisieSauvages.prototype.deplacerMarkerDeb = function(nouvellePosition) {
|
- |
|
284 |
|
- |
|
285 |
// Annulation d'une éventuelle recherche de rue déjà en cours
|
- |
|
286 |
this.annulerRechercherRue();
|
280 |
WidgetSaisieSauvages.prototype.deplacerMarkerDeb = function(nouvellePosition) {
|
287 |
|
281 |
this.latLngDeb = nouvellePosition;
|
288 |
this.latLngDeb = nouvellePosition;
|
282 |
this.markerDeb.setPosition(this.latLngDeb);
|
289 |
this.markerDeb.setPosition(this.latLngDeb);
|
283 |
this.map.setCenter(this.latLngDeb);
|
290 |
this.map.setCenter(this.latLngDeb);
|
284 |
this.mettreAJourMarkerPosition(this.latLngDeb);
|
291 |
this.mettreAJourMarkerPosition(this.latLngDeb);
|
Line 311... |
Line 318... |
311 |
this.markerFin.setPosition(this.latLngFin);
|
318 |
this.markerFin.setPosition(this.latLngFin);
|
312 |
this.dessinerLigneRue(this.latLngDeb, this.latLngFin);
|
319 |
this.dessinerLigneRue(this.latLngDeb, this.latLngFin);
|
313 |
};
|
320 |
};
|
Line 314... |
Line 321... |
314 |
|
321 |
|
- |
|
322 |
WidgetSaisieSauvages.prototype.surDeplacementMarkerFin = function() {
|
- |
|
323 |
// Annulation d'une éventuelle recherche déjà en cours
|
315 |
WidgetSaisieSauvages.prototype.surDeplacementMarkerFin = function() {
|
324 |
this.annulerRechercherRue();
|
316 |
this.rechercherRue();
|
325 |
this.rechercherRue();
|
Line 317... |
Line 326... |
317 |
};
|
326 |
};
|
318 |
|
327 |
|
Line 340... |
Line 349... |
340 |
|
349 |
|
341 |
var params = "latitude_debut="+this.markerDeb.getPosition().lat()+"&longitude_debut="+this.markerDeb.getPosition().lng()+
|
350 |
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();
|
351 |
"&latitude_fin="+this.markerFin.getPosition().lat()+"&longitude_fin="+this.markerFin.getPosition().lng();
|
Line 343... |
Line 352... |
343 |
var lthis = this;
|
352 |
var lthis = this;
|
344 |
|
353 |
|
345 |
$.getJSON(this.serviceTraceRueUrl+'?'+params, function(data) {
|
354 |
this.requeteRechercheRue = $.getJSON(this.serviceTraceRueUrl+'?'+params, function(data) {
|
346 |
$('#indication-nom-rue-nom').html("");
|
355 |
$('#indication-nom-rue-nom').html("");
|
347 |
lthis.listeRues = data.elements;
|
356 |
lthis.listeRues = data.elements;
|
348 |
var coordDeb = {"lat" : lthis.markerDeb.getPosition().lat(), "lon" : lthis.markerDeb.getPosition().lng()};
|
357 |
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()};
|
358 |
var coordFin = {"lat" : lthis.markerFin.getPosition().lat(), "lon" : lthis.markerFin.getPosition().lng()};
|
350 |
var tags = {"name" : "Aucune rue sélectionnée" };
|
359 |
var tags = {"name" : lthis.aucuneRueSelectionnee};
|
351 |
var pasDeRue = {"geometry" : [coordDeb, coordFin], "tags" : tags};
|
360 |
var pasDeRue = {"geometry" : [coordDeb, coordFin], "tags" : tags};
|
352 |
lthis.listeRues.push(pasDeRue);
|
361 |
lthis.listeRues.push(pasDeRue);
|
353 |
lthis.indexRueSelectionnee = 0;
|
362 |
lthis.indexRueSelectionnee = 0;
|
354 |
lthis.mettreRueEnValeur(lthis.listeRues[0]);
|
363 |
lthis.mettreRueEnValeur(lthis.listeRues[0]);
|
Line -... |
Line 364... |
- |
|
364 |
});
|
- |
|
365 |
}
|
- |
|
366 |
|
- |
|
367 |
WidgetSaisieSauvages.prototype.annulerRechercherRue = function() {
|
- |
|
368 |
if(this.requeteRechercheRue != null) {
|
- |
|
369 |
this.requeteRechercheRue.abort();
|
- |
|
370 |
this.requeteRechercheRue = null;
|
- |
|
371 |
$('#indication-nom-rue').css('visibility','hidden');
|
- |
|
372 |
}
|
355 |
});
|
373 |
}
|
356 |
}
|
374 |
|
357 |
|
375 |
|
358 |
WidgetSaisieSauvages.prototype.mettreRueEnValeur = function(rue) {
|
376 |
WidgetSaisieSauvages.prototype.mettreRueEnValeur = function(rue) {
|
359 |
this.afficherIndicationRue(rue['tags']['name']);
|
377 |
this.afficherIndicationRue(rue['tags']['name']);
|
Line 360... |
Line 378... |
360 |
this.afficherTraceRue(rue['geometry']);
|
378 |
this.afficherTraceRue(rue['geometry']);
|
361 |
this.afficherEtapeGeolocalisation(4);
|
379 |
this.afficherEtapeGeolocalisation(4);
|
362 |
}
|
380 |
}
|
363 |
|
381 |
|
364 |
WidgetSaisieSauvages.prototype.afficherIndicationRue = function(indication) {
|
382 |
WidgetSaisieSauvages.prototype.afficherIndicationRue = function(indication) {
|
365 |
indication = !!indication ? indication : "Nom de rue inconnu";
|
383 |
indication = !!indication ? indication : this.nomDeRueInconnue;
|
366 |
$('#indication-nom-rue-nom').html(indication);
|
384 |
$('#indication-nom-rue-nom').html(indication);
|
Line 665... |
Line 683... |
665 |
nomSpecial = $('#taxon-liste option:selected').hasClass('nom-special'),
|
683 |
nomSpecial = $('#taxon-liste option:selected').hasClass('nom-special'),
|
666 |
taxon = ($('#taxon-liste').val() == '?') ? $('#taxon').val() : $('#taxon-liste option:selected').data('nom-a-sauver'),
|
684 |
taxon = ($('#taxon-liste').val() == '?') ? $('#taxon').val() : $('#taxon-liste option:selected').data('nom-a-sauver'),
|
667 |
referentiel = (numNomSel == undefined) ? '' : '['+ this.nomSciReferentiel +']',
|
685 |
referentiel = (numNomSel == undefined) ? '' : '['+ this.nomSciReferentiel +']',
|
668 |
commune = $('#commune-nom').text(),
|
686 |
commune = $('#commune-nom').text(),
|
669 |
codeInsee = $('#commune-code-insee').text(),
|
687 |
codeInsee = $('#commune-code-insee').text(),
|
670 |
station = $('input[name="adresse"]').val(),
|
688 |
station = this.getValeurStation(),
|
671 |
lat = $('input[name="latitude"]').val(),
|
689 |
lat = $('input[name="latitude"]').val(),
|
672 |
lng = $('input[name="longitude"]').val(),
|
690 |
lng = $('input[name="longitude"]').val(),
|
673 |
date = $('#date').val(),
|
691 |
date = $('#date').val(),
|
674 |
milieux = this.getMilieux(),
|
692 |
milieux = this.getMilieux(),
|
675 |
notes = (nomSpecial ? this.taxons[numNomSel]['nom_fr'] + ".<br />" : '') + $('#notes').val();
|
693 |
notes = (nomSpecial ? this.taxons[numNomSel]['nom_fr'] + ".<br />" : '') + $('#notes').val();
|
Line 713... |
Line 731... |
713 |
'</div>'+
|
731 |
'</div>'+
|
714 |
'</div>');
|
732 |
'</div>');
|
715 |
$('#zone-liste-obs').removeClass("hidden");
|
733 |
$('#zone-liste-obs').removeClass("hidden");
|
716 |
};
|
734 |
};
|
Line -... |
Line 735... |
- |
|
735 |
|
- |
|
736 |
WidgetSaisieSauvages.prototype.getValeurStation = function() {
|
- |
|
737 |
var station = "";
|
- |
|
738 |
var valeurSelectionnee = $("#indication-nom-rue-nom").text().trim();
|
- |
|
739 |
if(valeurSelectionnee == this.aucuneRueSelectionnee || valeurSelectionnee == this.nomDeRueInconnue) {
|
- |
|
740 |
station = $('input[name="adresse"]').val().trim()
|
- |
|
741 |
} else {
|
- |
|
742 |
station = $("#indication-nom-rue-nom").text().trim();
|
- |
|
743 |
}
|
- |
|
744 |
|
- |
|
745 |
return station;
|
- |
|
746 |
}
|
717 |
|
747 |
|
718 |
WidgetSaisieSauvages.prototype.getMilieux = function() {
|
748 |
WidgetSaisieSauvages.prototype.getMilieux = function() {
|
719 |
var milieuxStr = '',
|
749 |
var milieuxStr = '',
|
720 |
milieux = [];
|
750 |
milieux = [];
|
721 |
$('.cb-milieux:checked').each(function() {
|
751 |
$('.cb-milieux:checked').each(function() {
|
Line 833... |
Line 863... |
833 |
|
863 |
|
834 |
$('#liste-obs').data('obsId'+this.obsNbre, {
|
864 |
$('#liste-obs').data('obsId'+this.obsNbre, {
|
835 |
'date': $('#date').val(),
|
865 |
'date': $('#date').val(),
|
Line 836... |
Line 866... |
836 |
'notes': notes,
|
866 |
'notes': notes,
|
837 |
|
867 |
|
838 |
'station': $('input[name="adresse"]').val(),
|
868 |
'station': this.getValeurStation(),
|
839 |
'latitude': $('#latitude').val(),
|
869 |
'latitude': $('#latitude').val(),
|
840 |
'longitude': $('#longitude').val(),
|
870 |
'longitude': $('#longitude').val(),
|