Subversion Repositories eFlore/Applications.cel

Rev

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

Rev 2904 Rev 2909
Line 153... Line 153...
153
};
153
};
Line 154... Line 154...
154
 
154
 
155
// surcharge
155
// surcharge
156
WidgetSaisieSauvages.prototype.initialiserGoogleMap = function() {
156
WidgetSaisieSauvages.prototype.initialiserGoogleMap = function() {
157
	var lthis = this;
157
	var lthis = this;
-
 
158
	this.latLngDeb = new google.maps.LatLng(48.8543, 2.3483);// Paris par défaut
-
 
159
	
158
	this.latLngDeb = new google.maps.LatLng(48.8543, 2.3483);// Paris
160
	// si param "zone_geo"
159
	if (this.ville == 'Marseille') {
161
	if (this.zoneGeo != "") {
160
		this.latLngDeb = new google.maps.LatLng(43.29545, 5.37458);
162
		var url = "http://api.tela-botanica.org/service:cel:coordSearch?zone=" + this.zoneGeo;
161
	} else if (this.ville == 'Montpellier') {
163
		$.getJSON(url, function(data) {
-
 
164
			lthis.latLngDeb = new google.maps.LatLng(data.lat, data.lng);
-
 
165
			lthis.suiteInitialiserGoogleMap();
-
 
166
		});
162
		this.latLngDeb = new google.maps.LatLng(43.61077, 3.87672);
167
		
-
 
168
	}
-
 
169
	
-
 
170
	// si param "ville"
-
 
171
	else {
-
 
172
		if (this.ville == 'Marseille') {
-
 
173
			this.latLngDeb = new google.maps.LatLng(43.29545, 5.37458);
-
 
174
		} 
-
 
175
		if (this.ville == 'Montpellier') {
-
 
176
			this.latLngDeb = new google.maps.LatLng(43.61077, 3.87672);
-
 
177
		}
-
 
178
		this.suiteInitialiserGoogleMap();
-
 
179
	}
-
 
180
	
-
 
181
	
-
 
182
}
-
 
183
 
-
 
184
 
163
	}
185
WidgetSaisieSauvages.prototype.suiteInitialiserGoogleMap = function() {
164
	var options = {
186
	var options = {
165
			zoom: 16,
187
			zoom: 16,
166
			center: this.latLngDeb,
188
			center: this.latLngDeb,
167
			mapTypeId: google.maps.MapTypeId.HYBRID,
189
			mapTypeId: google.maps.MapTypeId.HYBRID,
Line 191... Line 213...
191
 
213
 
192
	// Ajout de l'évènment sur click dans Carte
214
	// Ajout de l'évènment sur click dans Carte
Line 193... Line 215...
193
	google.maps.event.addListener(this.map, 'click', this.surClickDansCarte.bind(this));
215
	google.maps.event.addListener(this.map, 'click', this.surClickDansCarte.bind(this));
-
 
216
 
194
 
217
	// 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
218
	var lthis = this;
196
	google.maps.event.addListenerOnce(this.map, 'idle', function(){
219
	google.maps.event.addListenerOnce(this.map, 'idle', function(){
197
		// Initialisation du marker de début de rue
220
		// Initialisation du marker de début de rue
198
		if (!lthis.obsId) {
221
		if (!lthis.obsId) {
-
 
222
			// Tentative de geolocalisation si aucune obs à précharger
199
			// Tentative de geocalisation si aucune obs à précharger
223
			lthis.initialiserMarkerDeb();
-
 
224
			if (this.zoneGeo == "" && this.ville == "") {
200
			lthis.initialiserMarkerDeb();
225
				lthis.tenterGeolocalisation();
201
			lthis.tenterGeolocalisation();
226
			}
Line 202... Line 227...
202
		}
227
		}
203
	});
228
	});