Subversion Repositories eFlore/Applications.cel

Rev

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

Rev 2270 Rev 2275
Line 31... Line 31...
31
import com.google.maps.gwt.client.MouseEvent;
31
import com.google.maps.gwt.client.MouseEvent;
Line 32... Line 32...
32
 
32
 
Line 33... Line 33...
33
public class CartographieObservationVue extends Panel implements Rafraichissable {
33
public class CartographieObservationVue extends Panel implements Rafraichissable {
34
 
-
 
35
	private String id = "cartographie_observation";
34
 
Line 36... Line 35...
36
	
35
	private String id = "cartographie_observation";
37
	private ObservationMediateur oMediateur = null;
36
	private ObservationMediateur oMediateur = null;
38
	
37
	
Line 52... Line 51...
52
 
51
 
53
	Label panneauExplication = new Label(
52
	Label panneauExplication = new Label(
Line 54... Line 53...
54
			"Précisez le lieu de votre observation et cliquez sur OK. Les coordonnées sont données en degrés décimaux, comptés positivement vers le Nord pour la latitude, et vers l'Est pour la longitude");
53
			"Précisez le lieu de votre observation et cliquez sur OK. Les coordonnées sont données en degrés décimaux, comptés positivement vers le Nord pour la latitude, et vers l'Est pour la longitude");
-
 
54
 
Line 55... Line 55...
55
 
55
	private InfoWindow info;
56
	private InfoWindow info;
56
	private boolean zoomerSurRetour = false;
57
 
57
 
Line 58... Line 58...
58
	public CartographieObservationVue(ObservationMediateur om) {
58
	public CartographieObservationVue(ObservationMediateur om) {
59
		
59
 
60
		oMediateur = om;
60
		oMediateur = om;
Line 108... Line 108...
108
		pointCommune = pointNouvelleCommune;
108
		pointCommune = pointNouvelleCommune;
109
		nmk = fabriquerMarqueur(pointCommune, infosComplementaires);
109
		nmk = fabriquerMarqueur(pointCommune, infosComplementaires);
110
		nmk.setMap(map);
110
		nmk.setMap(map);
111
		afficherInfoMarker(nmk);
111
		afficherInfoMarker(nmk);
112
		recentrerCarte(nmk.getPosition());
112
		recentrerCarte(nmk.getPosition());
-
 
113
		map.setZoom(zoom);
113
	}
114
	}
Line 114... Line 115...
114
 
115
 
115
	private void initialiserCarte(boolean commune) {
116
	private void initialiserCarte(boolean commune) {
116
		
117
 
117
		panneauCarto.clear();
118
		panneauCarto.clear();
118
		
119
 
119
		centreFrance = LatLng.create(47.0504, 2.2347);
120
		centreFrance = LatLng.create(47.0504, 2.2347);
120
		pointCommune = centreFrance;
121
		pointCommune = centreFrance;
121
		
122
 
122
		MapOptions options  = MapOptions.create();
123
		MapOptions options = MapOptions.create();
123
	    options.setCenter(centreFrance);   
124
	    options.setCenter(centreFrance);
124
	    options.setZoom(6) ;
125
	    options.setZoom(6);
125
	    options.setMapTypeId(MapTypeId.HYBRID);
126
	    options.setMapTypeId(MapTypeId.HYBRID);
126
	    options.setDraggable(true);
127
	    options.setDraggable(true);
127
	    options.setMapTypeControl(true);
128
	    options.setMapTypeControl(true);
128
	    options.setScaleControl(true) ;
129
	    options.setScaleControl(true);
129
	    options.setScrollwheel(true) ;
130
	    options.setScrollwheel(true);
130
	    
131
 
Line 131... Line 132...
131
		map = GoogleMap.create(panneauCarto.getElement(), options ) ;
132
		map = GoogleMap.create(panneauCarto.getElement(), options );
132
				
133
				
133
		InfoWindowOptions infopts = InfoWindowOptions.create();
134
		InfoWindowOptions infopts = InfoWindowOptions.create();
134
		info = InfoWindow.create();
135
		info = InfoWindow.create();
Line 216... Line 217...
216
			bouton.focus();
217
			bouton.focus();
217
		}
218
		}
218
	}
219
	}
Line 219... Line 220...
219
 
220
 
220
	@Override
221
	@Override
221
	public void rafraichir(Object nouvelleDonnees,
-
 
-
 
222
	public void rafraichir(Object nouvelleDonnees, boolean repandreRaffraichissement) {
222
			boolean repandreRaffraichissement) {
223
 
Line 223... Line 224...
223
		if (nouvelleDonnees instanceof String) {
224
		if (nouvelleDonnees instanceof String) {
224
			
225
			
225
			if(isVisible()) {
226
			if(isVisible()) {
226
				Window.alert((String)nouvelleDonnees);
227
				Window.alert((String)nouvelleDonnees);
Line 227... Line 228...
227
			}
228
			}
Line 228... Line 229...
228
		}
229
		}
229
 
-
 
230
		if (nouvelleDonnees instanceof EntiteGeographiqueObservation) {
230
 
231
			
-
 
232
			oMediateur.afficherFenetreCarto();
231
		if (nouvelleDonnees instanceof EntiteGeographiqueObservation) {
233
			
232
			
Line 234... Line 233...
234
			EntiteGeographiqueObservation infos = (EntiteGeographiqueObservation) nouvelleDonnees;
233
			oMediateur.afficherFenetreCarto();
235
			
234
			EntiteGeographiqueObservation infos = (EntiteGeographiqueObservation) nouvelleDonnees;
236
			Double lat = 0.0;
235
			Double lat = 0.0;
237
			Double lon = 0.0;
236
			Double lon = 0.0;
Line 238... Line 237...
238
			
237
			
239
			try {
-
 
240
				lat = Double.parseDouble(infos.getLat());
238
			try {
-
 
239
				lat = Double.parseDouble(infos.getLat());
-
 
240
				lon = Double.parseDouble(infos.getLon());
-
 
241
			} catch (NumberFormatException nbe) {
-
 
242
				
-
 
243
			}
Line 241... Line 244...
241
				lon = Double.parseDouble(infos.getLon());
244
			LatLng coord = LatLng.create(lat, lon);
242
			} catch (NumberFormatException nbe) {
245
			// si on a un point, on zoome fort dès le début
243
				
246
			if (zoomerSurRetour) {
244
			}
247
				niveauZoom = 16;
Line 357... Line 360...
357
 
360
 
358
	public double[] getCoordsCentreFrance() {
361
	public double[] getCoordsCentreFrance() {
359
		double[] coords = {47.0504, 2.2347};
362
		double[] coords = {47.0504, 2.2347};
360
		return coords;
363
		return coords;
-
 
364
	}
-
 
365
 
-
 
366
	public void setDoitZoomerSurRetour(boolean b) {
-
 
367
		zoomerSurRetour  = b;
361
	}
368
	}