Line 20... |
Line 20... |
20 |
// surcharge
|
20 |
// surcharge
|
21 |
WidgetSaisieSauvages.prototype.initCarto = function() {
|
21 |
WidgetSaisieSauvages.prototype.initCarto = function() {
|
22 |
this.initialiserGoogleMap();
|
22 |
this.initialiserGoogleMap();
|
23 |
this.afficherEtapeGeolocalisation(1);
|
23 |
this.afficherEtapeGeolocalisation(1);
|
Line -... |
Line 24... |
- |
|
24 |
|
24 |
|
25 |
var lthis = this;
|
25 |
$('#carte-recherche').autocomplete({
|
26 |
$('#carte-recherche').autocomplete({
|
26 |
//Cette partie utilise geocoder pour extraire des valeurs d'adresse
|
27 |
//Cette partie utilise geocoder pour extraire des valeurs d'adresse
|
27 |
source: function(request, response) {
|
28 |
source: function(request, response) {
|
28 |
lthis.geocoder.geocode( {'address': request.term+', France', 'region' : 'fr' }, function(results, status) {
|
29 |
lthis.geocoder.geocode( {'address': request.term+', France', 'region' : 'fr' }, function(results, status) {
|
Line 58... |
Line 59... |
58 |
});
|
59 |
});
|
59 |
};
|
60 |
};
|
Line 60... |
Line 61... |
60 |
|
61 |
|
61 |
//surcharge
|
62 |
//surcharge
|
62 |
WidgetSaisieSauvages.prototype.initForm = function() {
|
63 |
WidgetSaisieSauvages.prototype.initForm = function() {
|
63 |
//this.requeterIdentite();// Sur rechargement de la page
|
- |
|
64 |
// Gestion de la liste des taxons
|
- |
|
65 |
this.configurerDatePicker('#date');
|
- |
|
66 |
this.ajouterAutocompletionNoms();
|
- |
|
67 |
this.configurerFormValidator();
|
64 |
// super() à la main - toute autre manière de faire est über-komplex
|
Line 68... |
Line 65... |
68 |
this.definirReglesFormValidator();
|
65 |
WidgetSaisie.prototype.initForm.call(this);
|
69 |
|
66 |
|
70 |
this.surChangementTaxonListe();
|
67 |
this.surChangementTaxonListe();
|
71 |
$('#taxon-liste').on('change', this.surChangementTaxonListe);
|
68 |
$('#taxon-liste').on('change', this.surChangementTaxonListe);
|
Line 188... |
Line 185... |
188 |
|
185 |
|
189 |
// Lorsque la carte est chargée, on vérifie si on peut précharger des données
|
186 |
// Lorsque la carte est chargée, on vérifie si on peut précharger des données
|
190 |
google.maps.event.addListenerOnce(this.map, 'idle', function(){
|
187 |
google.maps.event.addListenerOnce(this.map, 'idle', function(){
|
191 |
// Initialisation du marker de début de rue
|
188 |
// Initialisation du marker de début de rue
|
192 |
lthis.initialiserMarkerDeb();
|
189 |
lthis.initialiserMarkerDeb();
|
193 |
if (this.obsId != '') {
|
- |
|
194 |
lthis.chargerInfoObs();
|
- |
|
195 |
} else {
|
190 |
if (this.obsId == '') {
|
196 |
// Tentative de geocalisation si aucune obs à précharger
|
191 |
// Tentative de geocalisation si aucune obs à précharger
|
197 |
lthis.tenterGeolocalisation();
|
192 |
lthis.tenterGeolocalisation();
|
198 |
}
|
193 |
}
|
Line 199... |
Line 194... |
199 |
});
|
194 |
});
|
200 |
|
195 |
|
201 |
// Création du Geocoder
|
196 |
// Création du Geocoder
|
Line -... |
Line 197... |
- |
|
197 |
this.geocoder = new google.maps.Geocoder();
|
- |
|
198 |
};
|
- |
|
199 |
|
- |
|
200 |
WidgetSaisieSauvages.prototype.surClickDansCarte = function(event) {
|
202 |
this.geocoder = new google.maps.Geocoder();
|
201 |
this.deplacerMarkerDeb(event.latLng);
|
203 |
};
|
202 |
};
|
Line 204... |
Line 203... |
204 |
|
203 |
|
205 |
// surcharge
|
204 |
// surcharge
|
Line 224... |
Line 223... |
224 |
}
|
223 |
}
|
Line 225... |
Line 224... |
225 |
|
224 |
|
226 |
var deb = new google.maps.LatLng(data.extension.latitudeDebutRue.valeur, data.extension.longitudeDebutRue.valeur);
|
225 |
var deb = new google.maps.LatLng(data.extension.latitudeDebutRue.valeur, data.extension.longitudeDebutRue.valeur);
|
Line 227... |
Line 226... |
227 |
var fin = new google.maps.LatLng(data.extension.latitudeFinRue.valeur, data.extension.longitudeFinRue.valeur);
|
226 |
var fin = new google.maps.LatLng(data.extension.latitudeFinRue.valeur, data.extension.longitudeFinRue.valeur);
|
Line 228... |
Line 227... |
228 |
|
227 |
|
229 |
this.mettreAJourStationPosition(pos);
|
228 |
this.mettreAJourMarkerPosition(pos);
|
230 |
|
229 |
|
Line 272... |
Line 271... |
272 |
|
271 |
|
273 |
WidgetSaisieSauvages.prototype.deplacerMarkerDeb = function(nouvellePosition) {
|
272 |
WidgetSaisieSauvages.prototype.deplacerMarkerDeb = function(nouvellePosition) {
|
274 |
this.latLngDeb = nouvellePosition;
|
273 |
this.latLngDeb = nouvellePosition;
|
275 |
this.markerDeb.setPosition(this.latLngDeb);
|
274 |
this.markerDeb.setPosition(this.latLngDeb);
|
276 |
this.map.setCenter(this.latLngDeb);
|
275 |
this.map.setCenter(this.latLngDeb);
|
277 |
this.mettreAJourStationPosition(this.latLngDeb);
|
276 |
this.mettreAJourMarkerPosition(this.latLngDeb);
|
Line 278... |
Line 277... |
278 |
this.trouverCommune(this.latLngDeb);
|
277 |
this.trouverCommune(this.latLngDeb);
|
279 |
|
278 |
|
280 |
if (this.premierDeplacement) {
|
279 |
if (this.premierDeplacement) {
|
Line 333... |
Line 332... |
333 |
|
332 |
|
334 |
WidgetSaisieSauvages.prototype.afficherCentreRue = function() {
|
333 |
WidgetSaisieSauvages.prototype.afficherCentreRue = function() {
|
335 |
this.latLngDeb = this.markerDeb.getPosition();
|
334 |
this.latLngDeb = this.markerDeb.getPosition();
|
336 |
this.latLngFin = this.markerFin.getPosition();
|
335 |
this.latLngFin = this.markerFin.getPosition();
|
337 |
this.latLngCentre = new google.maps.LatLng((this.latLngFin.lat() + this.latLngDeb.lat())/2, (this.latLngFin.lng() + this.latLngDeb.lng())/2);
|
336 |
this.latLngCentre = new google.maps.LatLng((this.latLngFin.lat() + this.latLngDeb.lat())/2, (this.latLngFin.lng() + this.latLngDeb.lng())/2);
|
338 |
this.mettreAJourStationPosition(this.latLngCentre);
|
- |
|
339 |
};
|
- |
|
340 |
|
- |
|
341 |
WidgetSaisieSauvages.prototype.mettreAJourStationPosition = function(latLng) {
|
- |
|
342 |
var lat = latLng.lat().toFixed(5),
|
- |
|
343 |
lng = latLng.lng().toFixed(5);
|
- |
|
344 |
this.remplirChampLatitude(lat);
|
- |
|
345 |
this.remplirChampLongitude(lng);
|
337 |
this.mettreAJourMarkerPosition(this.latLngCentre);
|
Line 346... |
Line 338... |
346 |
};
|
338 |
};
|
347 |
|
339 |
|
348 |
WidgetSaisieSauvages.prototype.afficherEtapeGeolocalisation = function(numEtape) {
|
340 |
WidgetSaisieSauvages.prototype.afficherEtapeGeolocalisation = function(numEtape) {
|
Line 749... |
Line 741... |
749 |
var lthis = this;
|
741 |
var lthis = this;
|
750 |
var nomHorsListe = $('#taxon-liste').val() == '?' ? true : false;
|
742 |
var nomHorsListe = $('#taxon-liste').val() == '?' ? true : false;
|
751 |
nomSpecial = $('#taxon-liste option:selected').hasClass('nom-special'),
|
743 |
nomSpecial = $('#taxon-liste option:selected').hasClass('nom-special'),
|
752 |
numNomSel = nomHorsListe ? $('#taxon').data('numNomSel') : $('#taxon-liste').val(),
|
744 |
numNomSel = nomHorsListe ? $('#taxon').data('numNomSel') : $('#taxon-liste').val(),
|
753 |
nomSel = nomHorsListe ? $('#taxon').val() : $('#taxon-liste option:selected').data('nom-a-sauver'),
|
745 |
nomSel = nomHorsListe ? $('#taxon').val() : $('#taxon-liste option:selected').data('nom-a-sauver'),
|
754 |
nomRet = nomHorsListe ? $('#taxon').data('nomRet') : taxons[numNomSel]['nom_ret'],
|
746 |
nomRet = nomHorsListe ? $('#taxon').data('nomRet') : this.taxons[numNomSel]['nom_ret'],
|
755 |
numNomRet = nomHorsListe ? $('#taxon').data('numNomRet') : taxons[numNomSel]['num_nom_ret'],
|
747 |
numNomRet = nomHorsListe ? $('#taxon').data('numNomRet') : this.taxons[numNomSel]['num_nom_ret'],
|
756 |
numTaxon = nomHorsListe ? $('#taxon').data('nt') : taxons[numNomSel]['num_taxon'],
|
748 |
numTaxon = nomHorsListe ? $('#taxon').data('nt') : this.taxons[numNomSel]['num_taxon'],
|
757 |
famille = nomHorsListe ? $('#taxon').data('famille') : taxons[numNomSel]['famille'],
|
749 |
famille = nomHorsListe ? $('#taxon').data('famille') : this.taxons[numNomSel]['famille'],
|
758 |
referentiel = (numNomSel == undefined) ? '' : this.nomSciReferentiel,
|
750 |
referentiel = (numNomSel == undefined) ? '' : this.nomSciReferentiel,
|
759 |
notes = (nomSpecial ? taxons[numNomSel]['nom_fr'] + '. ' : '') + $('#notes').val();
|
751 |
notes = (nomSpecial ? this.taxons[numNomSel]['nom_fr'] + '. ' : '') + $('#notes').val();
|
Line 760... |
Line 752... |
760 |
|
752 |
|
761 |
certitude = $('input[name=certitude]:checked').val();
|
753 |
certitude = $('input[name=certitude]:checked').val();
|
Line 762... |
Line 754... |
762 |
certitude = (certitude == undefined) ? '' : certitude;
|
754 |
certitude = (certitude == undefined) ? '' : certitude;
|