Subversion Repositories eFlore/Applications.cel

Rev

Rev 610 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 610 Rev 654
Line 3... Line 3...
3
import org.tela_botanica.client.interfaces.Rafraichissable;
3
import org.tela_botanica.client.interfaces.Rafraichissable;
4
import org.tela_botanica.client.modeles.Configuration;
4
import org.tela_botanica.client.modeles.Configuration;
5
import org.tela_botanica.client.modeles.EntiteGeographiqueObservation;
5
import org.tela_botanica.client.modeles.EntiteGeographiqueObservation;
6
import org.tela_botanica.client.observation.ObservationMediateur;
6
import org.tela_botanica.client.observation.ObservationMediateur;
Line -... Line 7...
-
 
7
 
7
 
8
import com.google.gwt.core.client.JavaScriptObject;
8
import com.google.gwt.maps.client.InfoWindow;
9
import com.google.gwt.maps.client.InfoWindow;
9
import com.google.gwt.maps.client.InfoWindowContent;
10
import com.google.gwt.maps.client.InfoWindowContent;
10
import com.google.gwt.maps.client.MapType;
11
import com.google.gwt.maps.client.MapType;
11
import com.google.gwt.maps.client.MapWidget;
12
import com.google.gwt.maps.client.MapWidget;
Line 23... Line 24...
23
import com.google.gwt.user.client.Window;
24
import com.google.gwt.user.client.Window;
24
import com.gwtext.client.core.EventCallback;
25
import com.gwtext.client.core.EventCallback;
25
import com.gwtext.client.core.EventObject;
26
import com.gwtext.client.core.EventObject;
26
import com.gwtext.client.core.Ext;
27
import com.gwtext.client.core.Ext;
27
import com.gwtext.client.core.ExtElement;
28
import com.gwtext.client.core.ExtElement;
-
 
29
import com.gwtext.client.widgets.BoxComponent;
-
 
30
import com.gwtext.client.widgets.Component;
28
import com.gwtext.client.widgets.Container;
31
import com.gwtext.client.widgets.Container;
29
import com.gwtext.client.widgets.Panel;
32
import com.gwtext.client.widgets.Panel;
-
 
33
import com.gwtext.client.widgets.event.ContainerListener;
30
import com.gwtext.client.widgets.event.ContainerListenerAdapter;
34
import com.gwtext.client.widgets.event.ContainerListenerAdapter;
31
import com.gwtext.client.widgets.form.Label;
35
import com.gwtext.client.widgets.form.Label;
32
import com.gwtext.client.widgets.layout.FitLayout;
36
import com.gwtext.client.widgets.layout.FitLayout;
33
import com.gwtext.client.widgets.layout.RowLayout;
37
import com.gwtext.client.widgets.layout.RowLayout;
34
import com.gwtext.client.widgets.layout.RowLayoutData;
38
import com.gwtext.client.widgets.layout.RowLayoutData;
Line 75... Line 79...
75
 
79
 
76
		add(panneauExplication, new RowLayoutData(12));
80
		add(panneauExplication, new RowLayoutData(12));
Line 77... Line 81...
77
		add(panneauCarto, new RowLayoutData());
81
		add(panneauCarto, new RowLayoutData());
-
 
82
		
78
		
83
		if(!carteAjoutee) {
79
		if(!carteAjoutee) {
84
			
80
			Maps.loadMapsApi(Configuration.getCleGoogleMaps(), "2", false, new Runnable() {
85
			Maps.loadMapsApi(Configuration.getCleGoogleMaps(), "2", false, new Runnable() {
81
				public void run() {
-
 
82
					initialiserCarte(false);
86
				public void run() {
83
					recentrerCarte();
87
					initialiserCarte(false);
84
				}
88
				}
Line 85... Line 89...
85
			});
89
			});
Line 86... Line 90...
86
		}
90
		}
Line 87... Line 91...
87
				
91
				
88
		addListener(new ContainerListenerAdapter() {
-
 
-
 
92
		addListener(new ContainerListenerAdapter() {
89
			
93
			
90
			public void onAfterLayout(Container c) {
94
			public void onAfterLayout(Container c) {
91
				
95
				
92
				if(carteAjoutee) {
-
 
93
					
96
				if(carteAjoutee) {
-
 
97
					panneauCarto.setHeight("100%");
94
					if((panneauCarto.getHeight() - 20) > map.getSize().getHeight()) {
98
					if((panneauCarto.getHeight() - 20) > map.getSize().getHeight()) {
95
						map.setSize(map.getSize().getWidth()+"px", (panneauCarto.getHeight() - 20)+"px");
99
						map.setSize(map.getSize().getWidth()+"px", (panneauCarto.getHeight() - 20)+"px");
96
					}
100
					}
Line 97... Line 101...
97
					panneauCarto.setHeight("100%");
101
					panneauCarto.doLayout();
98
					panneauCarto.doLayout();
102
					panneauCarto.expand();
Line 99... Line 103...
99
				}
103
				}
100
			}
-
 
101
		});
-
 
102
		
104
			}
-
 
105
		});
103
		panneauCarto.setAutoHeight(true);
106
		
104
	}
107
		panneauCarto.setAutoHeight(true);
105
	
-
 
106
	public void masquerChargement(boolean masquer) {
108
	}
107
		if (masquer) {
-
 
108
			ExtElement masked = Ext.get(id);
-
 
109
 
-
 
110
			if (masked != null) {
109
	
111
				masked.mask("Chargement");
110
	public void masquerChargement(boolean masquer) {
112
			}
111
		
113
		} else {
112
		if(panneauCarto.isVisible()) {
Line 114... Line 113...
114
			ExtElement masked = Ext.get(id);
113
			if(masquer) {
Line 180... Line 179...
180
		info.open(marker, new InfoWindowContent("<div id=\"info_contenu\">"+
179
		info.open(marker, new InfoWindowContent("<div id=\"info_contenu\">"+
181
				"Déplacez ce marqueur pour localiser votre observation (commune et coordonnées)<br />"
180
				"Déplacez ce marqueur pour localiser votre observation (commune et coordonnées)<br />"
182
				+"longitude="
181
				+"longitude="
183
				+ marker.getLatLng().getLongitude() + "<br />latitude="
182
				+ marker.getLatLng().getLongitude() + "<br />latitude="
184
				+ marker.getLatLng().getLatitude() + "</div>"));
183
				+ marker.getLatLng().getLatitude() + "</div>"));
185
		map.setZoomLevel(3);
184
		map.setZoomLevel(12);
186
	}
185
	}
Line 187... Line 186...
187
 
186
 
188
	public void AfficherMessageAucuneInfos() {
187
	public void AfficherMessageAucuneInfos() {
189
		mettreAJourInfos(centreFrance,"", niveauZoom);
188
		mettreAJourInfos(centreFrance,"", niveauZoom);
Line 230... Line 229...
230
			}
229
			}
231
		}
230
		}
Line 232... Line 231...
232
 
231
 
Line -... Line 232...
-
 
232
		if (nouvelleDonnees instanceof EntiteGeographiqueObservation) {
-
 
233
			
-
 
234
			oMediateur.changementTabProg = true;
233
		if (nouvelleDonnees instanceof EntiteGeographiqueObservation) {
235
			oMediateur.afficherOngletCartographiqueSansLocaliser();
-
 
236
			
-
 
237
			EntiteGeographiqueObservation infos = (EntiteGeographiqueObservation) nouvelleDonnees;
-
 
238
			
-
 
239
			Double lat = 0.0;
-
 
240
			Double lon = 0.0;
234
			
241
			
235
			EntiteGeographiqueObservation infos = (EntiteGeographiqueObservation) nouvelleDonnees;
242
			try {
-
 
243
				lat = Double.parseDouble(infos.getLat());
-
 
244
				lon = Double.parseDouble(infos.getLon());
-
 
245
			} catch (NumberFormatException nbe) {
-
 
246
				
-
 
247
			}
Line 236... Line 248...
236
			LatLng coord = LatLng.newInstance(Double.parseDouble(infos.getLat()),
248
			
237
					Double.parseDouble(infos.getLon()));
249
			LatLng coord = LatLng.newInstance(lat, lon);
238
			
250
			
Line 252... Line 264...
252
		options.setDraggable(true);
264
		options.setDraggable(true);
253
		final Marker marker = new Marker(pointMarqueur, options);
265
		final Marker marker = new Marker(pointMarqueur, options);
Line 254... Line 266...
254
		
266
		
255
		marker.addMarkerDragEndHandler(new MarkerDragEndHandler() {
267
		marker.addMarkerDragEndHandler(new MarkerDragEndHandler() {
-
 
268
			public void onDragEnd(MarkerDragEndEvent event) {
256
			public void onDragEnd(MarkerDragEndEvent event) {
269
				masquerChargement(true);
257
				obtenirInfosCommunes(marker.getLatLng());
270
				obtenirInfosCommunes(marker.getLatLng());
Line 258... Line 271...
258
			}
271
			}
Line 285... Line 298...
285
			map.setSize((this.getWidth() - 12)+"px" , (this.getHeight() - 24)+"px");
298
			map.setSize((this.getWidth() - 12)+"px" , (this.getHeight() - 24)+"px");
286
			panneauCarto.setSize((this.getWidth() - 12)+"px" , (this.getHeight() - 12)+"px");
299
			panneauCarto.setSize((this.getWidth() - 12)+"px" , (this.getHeight() - 12)+"px");
287
		}
300
		}
288
		map.setCenter(pointCommune, niveauZoom);
301
		map.setCenter(pointCommune, niveauZoom);
289
		map.checkResizeAndCenter();
302
		map.checkResizeAndCenter();
290
		doLayout();
-
 
291
	}
303
	}
Line 292... Line 304...
292
 
304
 
293
	public boolean isCarteAjoutee() {
305
	public boolean isCarteAjoutee() {
294
		return carteAjoutee;
306
		return carteAjoutee;
Line 320... Line 332...
320
				+ htmlBoutonOk));
332
				+ htmlBoutonOk));
Line 321... Line 333...
321
		
333
		
322
		recentrerCarte();
334
		recentrerCarte();
323
		ajouterListenerBouton("okMap");
335
		ajouterListenerBouton("okMap");
-
 
336
	}
-
 
337
	
-
 
338
	public LatLng getCentreFrance() {
-
 
339
		return LatLng.newInstance(47.0504, 2.2347);
Line 324... Line 340...
324
	}
340
	}