43,10 → 43,11 |
private boolean carteAjoutee = false; |
private boolean infoOuverte = false; |
|
String valeurCommune = "Bourges"; // j'aurais préféré Bort-les-Orgues |
String valeurLocalite = "Bourges"; // j'aurais préféré Bort-les-Orgues |
LatLng centreFrance = null; |
LatLng pointCommune = null; |
LatLng pointLocalite = null; |
String codeLoc = ""; |
String pays = ""; |
|
int niveauZoom = 6; |
|
89,7 → 90,7 |
|
if(panneauCarto.isVisible()) { |
if(masquer) { |
panneauCarto.getEl().mask("Recherche des coordonnées et de la commune, veuillez patienter"); |
panneauCarto.getEl().mask("Recherche des coordonnées et de la localite, veuillez patienter"); |
} else { |
panneauCarto.getEl().unmask(); |
} |
96,21 → 97,22 |
} |
} |
|
public void obtenirInfosCommunes(LatLng coord) { |
public void obtenirInfosLocalites(LatLng coord) { |
// Remise à zéro des infos restantes d'une ancienne requete |
valeurCommune = ""; |
valeurLocalite = ""; |
codeLoc = ""; |
pays = ""; |
|
oMediateur.obtenirInformationCoord(this, coord.lat(), coord.lng()); |
} |
|
public void mettreAJourInfos(final LatLng pointNouvelleCommune, int zoom) { |
public void mettreAJourInfos(final LatLng pointNouvelleLocalite, int zoom) { |
GoogleMap mapNulle = null; |
if(nmk != null) { |
nmk.setMap(mapNulle); |
} |
pointCommune = pointNouvelleCommune; |
nmk = fabriquerMarqueur(pointCommune); |
pointLocalite = pointNouvelleLocalite; |
nmk = fabriquerMarqueur(pointLocalite); |
nmk.setMap(map); |
afficherInfoMarker(nmk, construireContenuInfoMarker(nmk)); |
recentrerCarte(nmk.getPosition()); |
117,12 → 119,12 |
map.setZoom(zoom); |
} |
|
private void initialiserCarte(boolean commune) { |
private void initialiserCarte(boolean localite) { |
|
panneauCarto.clear(); |
|
centreFrance = LatLng.create(47.0504, 2.2347); |
pointCommune = centreFrance; |
pointLocalite = centreFrance; |
|
MapOptions options = MapOptions.create(); |
options.setCenter(centreFrance); |
145,7 → 147,7 |
} |
}); |
|
if(!commune) { |
if(!localite) { |
fabriquerMarqueurIndication(); |
} |
|
152,7 → 154,7 |
map.addClickListener(new ClickHandler() { |
@Override |
public void handle(MouseEvent event) { |
obtenirInfosCommunes(event.getLatLng()); |
obtenirInfosLocalites(event.getLatLng()); |
} |
}); |
|
175,10 → 177,10 |
if(nmk != null) { |
nmk.setMap(mapNulle); |
} |
nmk = fabriquerMarqueur(pointCommune); |
nmk = fabriquerMarqueur(pointLocalite); |
nmk.setMap(map); |
info.setContent("<div id=\"info_contenu\">"+ |
"Déplacez ce marqueur pour localiser votre observation (commune et coordonnées)<br />" |
"Déplacez ce marqueur pour localiser votre observation (localite et coordonnées)<br />" |
+"longitude=" |
+ Util.tronquerNombrePourAffichage("" + nmk.getPosition().lng(), 5) + "<br />latitude=" |
+ Util.tronquerNombrePourAffichage("" + nmk.getPosition().lat(), 5) + "</div>"); |
211,11 → 213,11 |
bouton.addListener("click", new EventCallback() { |
@Override |
public void execute(EventObject e) { |
EntiteGeographiqueObservation infosCommune = new EntiteGeographiqueObservation(codeLoc,valeurCommune,null,null); |
// TODO: ajouter pays à tout Ceci |
infosCommune.setLat(pointCommune.lat()+""); |
infosCommune.setLon(pointCommune.lng()+""); |
oMediateur.rafraichirSaisieCommuneObservation(infosCommune); |
EntiteGeographiqueObservation infosLocalite = new EntiteGeographiqueObservation(codeLoc,valeurLocalite,null,null); |
infosLocalite.setPays(pays); |
infosLocalite.setLat(pointLocalite.lat()+""); |
infosLocalite.setLon(pointLocalite.lng()+""); |
oMediateur.rafraichirSaisieLocaliteObservation(infosLocalite); |
} |
}); |
|
257,10 → 259,11 |
niveauZoom = infos.getZoom(); |
} |
|
String nouvelleValeurCommune = infos.getZoneGeo(); |
valeurCommune = nouvelleValeurCommune; |
String nouvelleValeurLocalite = infos.getZoneGeo(); |
valeurLocalite = nouvelleValeurLocalite; |
codeLoc = ""; |
if(infos.getIdZoneGeo() != null) { |
// Quoi stocker pour en dehors de la france ? |
if (infos.getPays().equals("FR")) { |
codeLoc = Util.convertirChaineZoneGeoVersDepartement(infos.getIdZoneGeo()); |
} else { |
267,7 → 270,8 |
codeLoc = infos.getPays(); |
} |
} |
pointCommune = coord; |
pays = infos.getPays(); |
pointLocalite = coord; |
|
mettreAJourInfos(coord, niveauZoom); |
} |
287,7 → 291,7 |
@Override |
public void handle(MouseEvent event) { |
afficherInfoMarker(marker, construireContenuPartielInfoMarker(marker)); |
obtenirInfosCommunes(event.getLatLng()); |
obtenirInfosLocalites(event.getLatLng()); |
} |
}); |
|
342,7 → 346,7 |
|
String contenuMarker = ""; |
|
if(valeurCommune == null || valeurCommune.trim().equals("")) { |
if(valeurLocalite == null || valeurLocalite.trim().equals("")) { |
if(marker.getPosition().lng() == 0 && marker.getPosition().lat() == 0) { |
LatLng point = centreFrance; |
marker.setPosition(point); |
356,10 → 360,10 |
+"latitude="+Util.tronquerNombrePourAffichage(""+marker.getPosition().lat(), 5)+ |
"</div>"; |
} else { |
String chaineCommune = valeurCommune + ((codeLoc.isEmpty()) ? "" : " ("+codeLoc+")"); |
String chaineLocalite = valeurLocalite + ((codeLoc.isEmpty()) ? "" : " ("+codeLoc+")"); |
contenuMarker = |
"<div id=\"info_contenu\">"+ |
chaineCommune+"<br />" |
chaineLocalite+"<br />" |
+"longitude="+Util.tronquerNombrePourAffichage(""+marker.getPosition().lng(), 5)+"<br />" |
+"latitude="+Util.tronquerNombrePourAffichage(""+marker.getPosition().lat(), 5)+ |
"</div>"; |
398,7 → 402,7 |
info.setContent(contenuInfo); |
info.open(map, marker); |
|
pointCommune = marker.getPosition(); |
pointLocalite = marker.getPosition(); |
|
info.addDomReadyListenerOnce(new InfoWindow.DomReadyHandler() { |
@Override |
411,8 → 415,8 |
} |
|
public void afficherCarteEnAttenteAvecMarker(double lat, double lon) { |
pointCommune = LatLng.create(lat, lon); |
nmk.setPosition(pointCommune); |
pointLocalite = LatLng.create(lat, lon); |
nmk.setPosition(pointLocalite); |
afficherInfoMarker(nmk, construireContenuPartielInfoMarker(nmk)); |
} |
|