Subversion Repositories eFlore/Applications.cel

Compare Revisions

Ignore whitespace Rev 265 → Rev 266

/trunk/src/org/tela_botanica/client/modeles/InformationCommuneDAO.java
51,36 → 51,42
.parse(response.getText());
 
if (responseValue.isObject() != null) {
EntiteGeographiqueObservation infos;
String idLocalite = "";
String nomCommune = "";
JSONObject resultat = responseValue.isObject();
JSONArray tableauCommune = resultat.get("geonames")
if(resultat != null && resultat.containsKey("geonames")) {
if(resultat.get("geonames").isArray() != null) {
JSONArray tableauCommune = resultat.get("geonames")
.isArray();
JSONObject objetCommune = tableauCommune.get(0)
.isObject();
 
/*String valeurCommune = objetCommune.get("name")
.isString().stringValue();
r.rafraichir(valeurCommune, false);*/
String pays = objetCommune.get("countryName").isString()
.stringValue();
if(!pays.equals("France")){
r.rafraichir("Aucune commune française n'a été trouvée à cet emplacement", false);
return;
if(tableauCommune.get(0) != null) {
if(tableauCommune.get(0).isObject() != null) {
JSONObject objetCommune = tableauCommune.get(0)
.isObject();
if(objetCommune.containsKey("name")) {
if(objetCommune.get("name").isString() != null) {
nomCommune = objetCommune.get(
"name").isString().stringValue();
}
}
if(objetCommune.containsKey("adminCode2")) {
if(objetCommune.get("adminCode2").isString() != null) {
idLocalite = objetCommune.get(
"adminCode2").isString().stringValue();
}
}
}
}
}
}
Double newLng = objetCommune.get("lng").isNumber()
.doubleValue();
Double newLat = objetCommune.get("lat").isNumber()
.doubleValue();
String nomCommune = objetCommune.get(
"name").isString().stringValue();
String idLocalite = objetCommune.get(
"adminCode2").isString().stringValue();
infos = new EntiteGeographiqueObservation(idLocalite, nomCommune, null, null);
infos.setLat(""+lat);
infos.setLon(""+lng);
Object[] infos = { lat, lng, idLocalite, nomCommune, newLat, newLng};
r.rafraichir(infos, false);
}
}
125,30 → 131,61
.parse(response.getText());
 
if (responseValue.isObject() != null) {
EntiteGeographiqueObservation infos;
String idLocalite = "";
String nomCommune = "";
Double lng = 0.0;
Double lat = 0.0;
 
JSONObject resultat = responseValue.isObject();
JSONArray tableauCommune = resultat.get(
"postalCodes").isArray();
 
if (tableauCommune.get(0) != null) {
JSONObject objetCommune = tableauCommune.get(0)
.isObject();
 
Double lng = objetCommune.get("lng").isNumber()
.doubleValue();
Double lat = objetCommune.get("lat").isNumber()
.doubleValue();
String nomCommune = objetCommune.get(
"placeName").isString().stringValue();
String idLocalite = objetCommune.get(
"adminCode2").isString().stringValue();
 
Object[] infos = { lat, lng, idLocalite, nomCommune};
 
 
r.rafraichir(infos, false);
if(resultat != null && resultat.containsKey("postalCodes")) {
if(resultat.get("postalCodes").isArray() != null) {
JSONArray tableauCommune = resultat.get("postalCodes")
.isArray();
if(tableauCommune.get(0) != null) {
if(tableauCommune.get(0).isObject() != null) {
JSONObject objetCommune = tableauCommune.get(0)
.isObject();
if(objetCommune.containsKey("lng")) {
if(objetCommune.get("lng").isNumber() != null) {
lng = objetCommune.get(
"lng").isNumber().doubleValue();
}
}
if(objetCommune.containsKey("lat")) {
if(objetCommune.get("lat").isNumber() != null) {
lat = objetCommune.get(
"lat").isNumber().doubleValue();
}
}
if(objetCommune.containsKey("adminCode2")) {
if(objetCommune.get("adminCode2").isString() != null) {
idLocalite = objetCommune.get(
"adminCode2").isString().stringValue();
}
}
if(objetCommune.containsKey("placeName")) {
if(objetCommune.get("placeName").isString() != null) {
nomCommune = objetCommune.get(
"placeName").isString().stringValue();
}
}
}
}
}
}
infos = new EntiteGeographiqueObservation(idLocalite, nomCommune, null, null);
infos.setLat(""+lat);
infos.setLon(""+lng);
r.rafraichir(infos, false);
}
}
}
/trunk/src/org/tela_botanica/client/modeles/ListeObservationAsynchroneDAO.java
54,7 → 54,7
for (int i = 0; i < criteres.length; i++) {
if(!criteres[i][1].equals(""))
if(!criteres[i][1].equals("") && criteres[i][1] != null)
{
if(i!= 0)
{
112,10 → 112,12
String commentaire=Util.toCelString(((JSONString) observation .get(12)).toString());
String date=((JSONString) observation .get(8)).stringValue();
String numeroOrdre=((JSONString) observation.get(7)).stringValue();
//String motsCles=((JSONString) observation.get(15)).stringValue();
String coordX=((JSONString) observation.get(15)).stringValue();
String coordY=((JSONString) observation.get(16)).stringValue();
Observation obs=new Observation(transmis, nomSaisi, nomRetenu, numeroNomenclaturalSaisi, numeroNomenclaturalRetenu ,numeroTaxonomique, famille, localite, identifiantLocalite, lieudit, station, milieu, commentaire, date, numeroOrdre/*, motsCles*/);
obs.setCoordonneeX(coordX);
obs.setCoordonneeY(coordY);
observationData.put(obs.getNumeroOrdre(),obs);
181,6 → 183,14
if(obs.getCommentaire() != null) {
postData += "&commentaire="+URL.encodeComponent(""+obs.getCommentaire());
}
if(obs.getCoordonneeX() != null && obs.getCoordonneeY() != null) {
postData += "&coord_x="+URL.encodeComponent(""+obs.getCoordonneeX());
postData += "&coord_y="+URL.encodeComponent(""+obs.getCoordonneeY());
}
/*+"&mots_cles="+URL.encodeComponent(obs.getMotsCles()) */;
try {