134,15 → 134,10 |
|
// enfin on considère le composant comme instancié |
estInstancie = true; |
|
|
} |
|
}); |
} |
|
|
|
/** |
* ajoute les listeners pour les boutons et le cochage des entites |
*/ |
181,13 → 176,11 |
|
nomFiltre = "" ; |
entitesGeographiquesEncours = "" ; |
String nomPere = "" ; |
String nomGrandPere = "" ; |
String nomArriereGrandPere = ""; |
|
switch(node.getDepth()) |
{ |
case 0: |
String[] filtresStr = {"pays","departement","localite","lieudit","station"}; |
|
int profNoeud = node.getDepth(); |
if(profNoeud == 0) { |
if(!arbreCharge) |
{ |
arbreEntitesGeographiques.getRootNode().expand(); |
196,28 → 189,16 |
{ |
observationMediateur.obtenirNombreObservation() ; |
} |
return ; |
case 4: nomFiltre += "station,lieudit,commune,departement"; |
nomPere = ((String[])node.getParentNode().getUserObject())[0] ; |
nomGrandPere = ((String[])node.getParentNode().getParentNode().getUserObject())[0] ; |
nomArriereGrandPere = ((String[])node.getParentNode().getParentNode().getParentNode().getUserObject())[0] ; |
entitesGeographiquesEncours += node.getText()+","+nomPere+","+nomGrandPere+","+nomArriereGrandPere ; |
break; |
case 3: nomFiltre += "lieudit,commune,departement"; |
nomPere = ((String[])node.getParentNode().getUserObject())[0] ; |
nomGrandPere = ((String[])node.getParentNode().getParentNode().getUserObject())[0] ; |
entitesGeographiquesEncours += node.getText()+","+nomPere+","+nomGrandPere ; |
break; |
case 2: nomFiltre += "commune,departement"; |
nomPere = ((String[])node.getParentNode().getUserObject())[0] ; |
entitesGeographiquesEncours += node.getText()+","+nomPere ; |
break; |
case 1: nomFiltre += "departement"; |
entitesGeographiquesEncours += node.getText() ; |
break; |
default: |
break; |
} else { |
Node noeud = (Node)node; |
for(int i = profNoeud - 1; i >= 0; i--) { |
nomFiltre += filtresStr[i]+","; |
entitesGeographiquesEncours += ((String[])noeud.getUserObject())[0]+","; |
noeud = noeud.getParentNode(); |
} |
nomFiltre.replaceAll(",$", ""); |
entitesGeographiquesEncours.replaceAll(",$", ""); |
} |
|
filtreModifie = true ; |
} |
318,6 → 299,7 |
|
Observation obs = (Observation)nouvelleDonnees ; |
EntiteGeographiqueObservation ent = new EntiteGeographiqueObservation(obs.getIdentifiantLocalite(),obs.getLocalite(),obs.getLieudit(),obs.getStation()); |
ent.setPays(obs.getPays()); |
|
creerHierarchieNoeud(arbreEntitesGeographiques.getTree(), arbreEntitesGeographiques.getRootNode(), ent); |
|
514,6 → 496,8 |
String lieuDit=null; |
String station=null; |
|
String id_pays = ent.getPays(); |
|
// TODO creer une fonction plus efficace lors du passage au multi reférentiel |
id_zone_geo = Util.convertirChaineZoneGeoVersDepartement(ent.getIdZoneGeo()); |
|
524,9 → 508,17 |
lieuDit = ent.getLieuDit(); |
station = ent.getStation(); |
|
if(id_pays.equals(null) || (id_pays.trim()).isEmpty()) { |
id_pays="Inconnue" ; |
} |
|
if(id_zone_geo.contains("000null") || id_zone_geo.equals(null) || (id_zone_geo.trim()).equals("")) { |
id_zone_geo="Inconnue" ; |
} else { |
if(ent.getIdZoneGeo().contains("INSEE-C:") && ent.getIdZoneGeo().length() > 10) { |
id_pays = "FR"; |
} |
} |
|
if(zone_geo.contains("000null") || zone_geo.equals(null) || (zone_geo.trim().equals(""))) { |
zone_geo="Inconnue" ; |
540,37 → 532,28 |
station="Inconnue" ; |
} |
|
Node noeudMemeId = arbre.getNodeById(""+id_zone_geo); |
if(noeudMemeId == null) { |
// on crée le noeud de l'identifiant zone_geo |
noeudMemeId = creerNoeud(""+id_zone_geo,id_zone_geo); |
root.appendChild(noeudMemeId) ; |
} |
String[] idLocalites = {id_pays, id_zone_geo, zone_geo, lieuDit, station}; |
|
// on teste si la localité existe |
Node noeudMemeLoc = arbre.getNodeById(""+(id_zone_geo+zone_geo)); |
if(noeudMemeLoc == null) |
{ |
// on crée le noeud de la zone_geo |
noeudMemeLoc = creerNoeud(""+id_zone_geo+zone_geo, zone_geo); |
noeudMemeId.appendChild(noeudMemeLoc) ; |
} |
Node noeudMemeId = null; |
String idNoeud = ""; |
String locNiveau = ""; |
|
// on teste si le lieu dit existe |
Node noeudMemeLieu = arbre.getNodeById(""+(id_zone_geo+zone_geo+lieuDit)); |
if(noeudMemeLieu == null) |
{ |
// on crée le noeud du lieu dit |
noeudMemeLieu = creerNoeud(id_zone_geo+zone_geo+lieuDit, lieuDit); |
noeudMemeLoc.appendChild(noeudMemeLieu) ; |
Node noeudParent = root; |
|
for(int i = 0; i < idLocalites.length; i++) { |
// Recherche des noeuds correspondant à chacun des niveaux de la hierarchie |
locNiveau = idLocalites[i]; |
idNoeud += idLocalites[i]; |
|
noeudMemeId = arbre.getNodeById(idNoeud); |
|
// Si le noeud n'existe pas on le crée |
if(noeudMemeId == null) { |
noeudMemeId = creerNoeud(idNoeud, locNiveau); |
noeudParent.appendChild(noeudMemeId) ; |
} |
|
// on teste si la station existe |
Node noeudMemeStation = arbre.getNodeById(""+(id_zone_geo+zone_geo+lieuDit+station)); |
if(noeudMemeStation == null) { |
// on crée le noeud de la station |
noeudMemeStation = creerNoeud(id_zone_geo+zone_geo+lieuDit+station,station); |
noeudMemeLieu.appendChild(noeudMemeStation); |
noeudParent = noeudMemeId; |
} |
|
root.sort(comparerNoeuds()) ; |
620,22 → 603,26 |
|
int profondeur = 0; |
|
if(nom.equals("departement")) { |
if(nom.equals("pays")) { |
profondeur = 1; |
} |
|
if(nom.equals("commune")) { |
if(nom.equals("departement")) { |
profondeur = 2; |
} |
|
if(nom.equals("lieudit")) { |
if(nom.equals("localite")) { |
profondeur = 3; |
} |
|
if(nom.equals("station")) { |
if(nom.equals("lieudit")) { |
profondeur = 4; |
} |
|
if(nom.equals("station")) { |
profondeur = 5; |
} |
|
return profondeur; |
} |
|