Subversion Repositories eFlore/Applications.cel

Rev

Rev 2757 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2757 Rev 2759
Line 193... Line 193...
193
	google.maps.event.addListener(this.map, 'click', this.surClickDansCarte.bind(this));
193
	google.maps.event.addListener(this.map, 'click', this.surClickDansCarte.bind(this));
Line 194... Line 194...
194
 
194
 
195
	// Lorsque la carte est chargée, on vérifie si on peut précharger des données
195
	// Lorsque la carte est chargée, on vérifie si on peut précharger des données
196
	google.maps.event.addListenerOnce(this.map, 'idle', function(){
196
	google.maps.event.addListenerOnce(this.map, 'idle', function(){
197
		// Initialisation du marker de début de rue
-
 
198
		lthis.initialiserMarkerDeb();
197
		// Initialisation du marker de début de rue
199
		if (this.obsId == '') {
198
		if (!lthis.obsId) {
-
 
199
			// Tentative de geocalisation si aucune obs à précharger
200
			// Tentative de geocalisation si aucune obs à précharger
200
			lthis.initialiserMarkerDeb();
201
			lthis.tenterGeolocalisation();
201
			lthis.tenterGeolocalisation();
202
		}
202
		}
Line 203... Line 203...
203
	});
203
	});
Line 222... Line 222...
222
	}
222
	}
Line 223... Line 223...
223
 
223
 
Line 224... Line 224...
224
    var pos = new google.maps.LatLng(data.latitude, data.longitude);
224
    var pos = new google.maps.LatLng(data.latitude, data.longitude);
225
 
-
 
226
    if(data.hasOwnProperty("extension")) {
-
 
227
    	this.initialiserMarkerFin();
225
 
228
 
226
    if(data.hasOwnProperty("extension")) {
229
    	// cas des obs florilèges qui apparaissent aussi comme des obs sauvages
227
    	// cas des obs florilèges qui apparaissent aussi comme des obs sauvages
230
    	// mais qui n'ont pas de coté de rue
228
    	// mais qui n'ont pas de coté de rue
231
    	if(data.extension.hasOwnProperty("coteRue")) {
229
    	if(data.extension.hasOwnProperty("coteRue")) {
Line 232... Line 230...
232
    		$('#rue_cote option[value='+data.extension.coteRue.valeur+']').attr("selected", "selected");
230
    		$('#rue_cote option[value='+data.extension.coteRue.valeur+']').attr("selected", "selected");
233
    	}
231
    	}
234
 
232
 
235
    	var deb = new google.maps.LatLng(data.extension.latitudeDebutRue.valeur, data.extension.longitudeDebutRue.valeur);
233
    	var deb = new google.maps.LatLng(data.extension.latitudeDebutRue.valeur, data.extension.longitudeDebutRue.valeur);
Line -... Line 234...
-
 
234
	    var fin = new google.maps.LatLng(data.extension.latitudeFinRue.valeur, data.extension.longitudeFinRue.valeur);
236
	    var fin = new google.maps.LatLng(data.extension.latitudeFinRue.valeur, data.extension.longitudeFinRue.valeur);
235
	    
-
 
236
	    this.mettreAJourMarkerPosition(pos);
-
 
237
 
237
 
238
	    this.latLngDeb = deb;
-
 
239
		this.initialiserMarkerDebSimple();
238
	    this.mettreAJourMarkerPosition(pos);
240
		
Line 239... Line 241...
239
 
241
		this.latLngFin = fin;
240
	    this.deplacerMarkerDeb(deb);
242
	    this.initialiserMarkerFin(fin);
241
	    this.deplacerMarkerFin(fin);
243
	    
242
	    this.afficherEtapeGeolocalisation(4);
244
	    this.rechercherRue();
Line 249... Line 251...
249
    } else if(data.hasOwnProperty("latitude") && data.hasOwnProperty("longitude")) {
251
    } else if(data.hasOwnProperty("latitude") && data.hasOwnProperty("longitude")) {
250
    	this.deplacerMarkerDeb(pos);
252
    	this.deplacerMarkerDeb(pos);
251
    }
253
    }
252
};
254
};
Line -... Line 255...
-
 
255
 
-
 
256
WidgetSaisieSauvages.prototype.initialiserMarkerDebSimple = function() {
-
 
257
	this.premierDeplacement = true;
-
 
258
	if (this.markerDeb == undefined) {
-
 
259
		// Marqueur de début de Rue
-
 
260
		this.markerDeb = new google.maps.Marker({
-
 
261
			map: this.map,
-
 
262
			draggable: true,
-
 
263
			title: 'Début de la portion de rue étudiée',
-
 
264
			icon: this.googleMapMarqueurDebutUrl,
-
 
265
			position: this.latLngDeb
-
 
266
		});
-
 
267
		google.maps.event.addListener(this.markerDeb, 'dragend', this.surDeplacementMarkerDeb.bind(this));
-
 
268
	}
-
 
269
}
-
 
270
 
253
 
271
 
254
WidgetSaisieSauvages.prototype.initialiserMarkerDeb = function() {
272
WidgetSaisieSauvages.prototype.initialiserMarkerDeb = function() {
255
	this.premierDeplacement = true;
273
	this.premierDeplacement = true;
256
	if (this.markerDeb == undefined) {
274
	if (this.markerDeb == undefined) {
257
		// Marqueur de début de Rue
275
		// Marqueur de début de Rue
Line 274... Line 292...
274
		this.ligneRue.setMap(null);
292
		this.ligneRue.setMap(null);
275
	}
293
	}
276
};
294
};
Line 277... Line 295...
277
 
295
 
-
 
296
WidgetSaisieSauvages.prototype.surDeplacementMarkerDeb = function() {
-
 
297
	// Annulation d'une éventuelle recherche de rue déjà en cours
278
WidgetSaisieSauvages.prototype.surDeplacementMarkerDeb = function() {
298
	this.annulerRechercherRue();
279
	this.latLngDeb = this.markerDeb.getPosition();
299
	this.latLngDeb = this.markerDeb.getPosition();
280
	this.deplacerMarkerDeb(this.latLngDeb);
300
	this.deplacerMarkerDeb(this.latLngDeb);
Line 281... Line 301...
281
};
301
};
Line 282... Line -...
282
 
-
 
283
WidgetSaisieSauvages.prototype.deplacerMarkerDeb = function(nouvellePosition) {
-
 
284
	
-
 
285
	// Annulation d'une éventuelle recherche de rue déjà en cours
302
 
-
 
303
WidgetSaisieSauvages.prototype.deplacerMarkerDeb = function(nouvellePosition) {
-
 
304
	
-
 
305
	this.latLngDeb = nouvellePosition;
-
 
306
	if (this.markerDeb == undefined) {
-
 
307
		// Marqueur de début de Rue
-
 
308
		this.markerDeb = new google.maps.Marker({
-
 
309
			map: this.map,
-
 
310
			draggable: true,
-
 
311
			title: 'Début de la portion de rue étudiée',
-
 
312
			icon: this.googleMapMarqueurDebutUrl,
-
 
313
			position: this.latLngDeb
286
	this.annulerRechercherRue();
314
		});
287
	
315
		google.maps.event.addListener(this.markerDeb, 'dragend', this.surDeplacementMarkerDeb.bind(this));
288
	this.latLngDeb = nouvellePosition;
316
	}
289
	this.markerDeb.setPosition(this.latLngDeb);
317
	this.markerDeb.setPosition(this.latLngDeb);
Line 290... Line 318...
290
	this.map.setCenter(this.latLngDeb);
318
	this.map.setCenter(this.latLngDeb);
291
	this.mettreAJourMarkerPosition(this.latLngDeb);
319
	this.mettreAJourMarkerPosition(this.latLngDeb);
292
	this.trouverCommune(this.latLngDeb);
320
	this.trouverCommune(this.latLngDeb);
293
 
321
 
294
	var nouvellePositionFin = new google.maps.LatLng(this.latLngDeb.lat(), this.latLngDeb.lng() + 0.0010);
322
	var nouvellePositionFin = new google.maps.LatLng(this.latLngDeb.lat(), this.latLngDeb.lng() + 0.0010);
Line 295... Line 323...
295
	this.initialiserMarkerFin();
323
	this.initialiserMarkerFin();
296
	this.deplacerMarkerFin(nouvellePositionFin)
324
	this.deplacerMarkerFin(nouvellePositionFin);
Line 305... Line 333...
305
			title: 'Fin de la portion de rue étudiée',
333
			title: 'Fin de la portion de rue étudiée',
306
			icon: this.googleMapMarqueurFinUrl,
334
			icon: this.googleMapMarqueurFinUrl,
307
			position: this.latLngFin
335
			position: this.latLngFin
308
		});
336
		});
309
		google.maps.event.addListener(this.markerFin, 'dragend', this.surDeplacementMarkerFin.bind(this));
337
		google.maps.event.addListener(this.markerFin, 'dragend', this.surDeplacementMarkerFin.bind(this));
310
	} else {
-
 
311
		this.markerFin.setMap(null);
-
 
312
	}
338
	}
313
};
339
};
Line 314... Line 340...
314
 
340
 
315
WidgetSaisieSauvages.prototype.deplacerMarkerFin = function(nouvellePosition) {
341
WidgetSaisieSauvages.prototype.deplacerMarkerFin = function(nouvellePosition) {
Line 334... Line 360...
334
	}
360
	}
335
	this.mettreRueEnValeur(this.listeRues[this.indexRueSelectionnee]);
361
	this.mettreRueEnValeur(this.listeRues[this.indexRueSelectionnee]);
336
}
362
}
Line 337... Line 363...
337
 
363
 
-
 
364
WidgetSaisieSauvages.prototype.afficherChargementRechercheRue = function() {
338
WidgetSaisieSauvages.prototype.afficherChargementRechercheRue = function() {
365
	if(!!this.ligneRue) {
-
 
366
		this.ligneRue.setMap(null);
339
	this.ligneRue.setMap(null);
367
	}
340
	var img = '<img src="'+this.chargementImageIconeUrl+'" />';
368
	var img = '<img src="'+this.chargementImageIconeUrl+'" />';
341
	$('#indication-nom-rue-nom').html(img+" Recherche de la rue en cours");
369
	$('#indication-nom-rue-nom').html(img+" Recherche de la rue en cours");
342
	$('#indication-nom-rue').css('visibility','visible');
370
	$('#indication-nom-rue').css('visibility','visible');
343
	$('#indication-nom-rue').effect("highlight", {}, 500);
371
	$('#indication-nom-rue').effect("highlight", {}, 500);
Line 458... Line 486...
458
				nouvellePosition = new google.maps.LatLng(latitude, longitude);
486
				nouvellePosition = new google.maps.LatLng(latitude, longitude);
459
			lthis.initialiserMarkerDeb();
487
			lthis.initialiserMarkerDeb();
460
			lthis.deplacerMarkerDeb(nouvellePosition);
488
			lthis.deplacerMarkerDeb(nouvellePosition);
461
			lthis.map.setZoom(16);
489
			lthis.map.setZoom(16);
462
		});
490
		});
-
 
491
	} else {
-
 
492
		lthis.initialiserMarkerDeb();
463
	}
493
	}
464
};
494
};
Line 465... Line 495...
465
 
495
 
466
/**
496
/**