You can subscribe to this list here.
| 2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(20) |
Aug
(34) |
Sep
|
Oct
(8) |
Nov
(2) |
Dec
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2006 |
Jan
(2) |
Feb
|
Mar
|
Apr
|
May
|
Jun
(3) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(20) |
Sep
|
Oct
|
Nov
|
Dec
|
| 2008 |
Jan
(29) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(2) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Eric G. <eg...@us...> - 2008-07-22 14:41:38
|
Update of /cvsroot/oxygene-project/geoxygene/src/fr/ign/cogit/geoxygene/contrib/appariement/reseaux In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv16990/src/fr/ign/cogit/geoxygene/contrib/appariement/reseaux Modified Files: ParametresApp.java Log Message: update : comments Index: ParametresApp.java =================================================================== RCS file: /cvsroot/oxygene-project/geoxygene/src/fr/ign/cogit/geoxygene/contrib/appariement/reseaux/ParametresApp.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ParametresApp.java 31 Jan 2008 16:27:53 -0000 1.1 --- ParametresApp.java 22 Jul 2008 14:41:37 -0000 1.2 *************** *** 294,298 **** ///////////// OPTIONS D'EXPORT //////////// ///////////////////////////////////////////////////////////////////////////////// ! /** Si true, la géométrie des liens est calculée des objets2 vers les objets 2 * si false, c'est l'inverse */ --- 294,298 ---- ///////////// OPTIONS D'EXPORT //////////// ///////////////////////////////////////////////////////////////////////////////// ! /** Si true, la géométrie des liens est calculée des objets2 vers les objets 1 * si false, c'est l'inverse */ |
|
From: Eric G. <eg...@us...> - 2008-07-22 14:40:44
|
Update of /cvsroot/oxygene-project/geoxygene/src/fr/ign/cogit/geoxygene/contrib/appariement/reseaux In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv16487/src/fr/ign/cogit/geoxygene/contrib/appariement/reseaux Modified Files: AppariementIO.java Log Message: bug : correction Index: AppariementIO.java =================================================================== RCS file: /cvsroot/oxygene-project/geoxygene/src/fr/ign/cogit/geoxygene/contrib/appariement/reseaux/AppariementIO.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** AppariementIO.java 31 Jan 2008 16:27:53 -0000 1.1 --- AppariementIO.java 22 Jul 2008 14:40:52 -0000 1.2 *************** *** 51,55 **** * * @author Mustiere - IGN / Laboratoire COGIT ! * @version 1.0 * */ --- 51,55 ---- * * @author Mustiere - IGN / Laboratoire COGIT ! * @version 1.1 * */ *************** *** 100,108 **** if ( paramApp.projeteNoeud2surReseau1 ) { if ( paramApp.debugAffichageCommentaires > 1 ) System.out.println(" Projection du réseau 2 sur le réseau 1 "+(new Time(System.currentTimeMillis())).toString()); ! else reseauRef.projete(reseauComp, paramApp.projeteNoeud2surReseau1_DistanceNoeudArc, paramApp.projeteNoeud2surReseau1_DistanceProjectionNoeud, paramApp.projeteNoeud2surReseau1_ImpassesSeulement); } if ( paramApp.projeteNoeuds1SurReseau2 ) { if ( paramApp.debugAffichageCommentaires > 1 ) System.out.println(" Projection du réseau 1 sur le réseau 2 "+(new Time(System.currentTimeMillis())).toString()); ! else reseauComp.projete(reseauRef, paramApp.projeteNoeuds1SurReseau2_DistanceNoeudArc, paramApp.projeteNoeuds1SurReseau2_DistanceProjectionNoeud, paramApp.projeteNoeuds1SurReseau2_ImpassesSeulement); } --- 100,108 ---- if ( paramApp.projeteNoeud2surReseau1 ) { if ( paramApp.debugAffichageCommentaires > 1 ) System.out.println(" Projection du réseau 2 sur le réseau 1 "+(new Time(System.currentTimeMillis())).toString()); ! reseauRef.projete(reseauComp, paramApp.projeteNoeud2surReseau1_DistanceNoeudArc, paramApp.projeteNoeud2surReseau1_DistanceProjectionNoeud, paramApp.projeteNoeud2surReseau1_ImpassesSeulement); } if ( paramApp.projeteNoeuds1SurReseau2 ) { if ( paramApp.debugAffichageCommentaires > 1 ) System.out.println(" Projection du réseau 1 sur le réseau 2 "+(new Time(System.currentTimeMillis())).toString()); ! reseauComp.projete(reseauRef, paramApp.projeteNoeuds1SurReseau2_DistanceNoeudArc, paramApp.projeteNoeuds1SurReseau2_DistanceProjectionNoeud, paramApp.projeteNoeuds1SurReseau2_ImpassesSeulement); } |
|
From: Eric G. <eg...@us...> - 2008-01-31 16:54:18
|
Update of /cvsroot/oxygene-project/geoxygene/src/fr/ign/cogit/geoxygene/contrib/cartetopo/exemple In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv24316/src/fr/ign/cogit/geoxygene/contrib/cartetopo/exemple Modified Files: ExempleConstruction.java Log Message: Cleaning Index: ExempleConstruction.java =================================================================== RCS file: /cvsroot/oxygene-project/geoxygene/src/fr/ign/cogit/geoxygene/contrib/cartetopo/exemple/ExempleConstruction.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ExempleConstruction.java 8 Aug 2007 08:34:38 -0000 1.1 --- ExempleConstruction.java 31 Jan 2008 16:54:12 -0000 1.2 *************** *** 120,134 **** // Affichage du nombre de faces ! System.out.println("Nombre de faces de la carte : "+ct.getListefaces().size()); // Affichage des coordonnees du noeud initial et du noeud final du premier arc ! MonArc arc = (MonArc) ct.getListearcs().get(0); ! System.out.println("Noeud initial de a0 : "+arc.getNoeudini().getCoord()); ! System.out.println("Noeud final de a0 : "+arc.getNoeudfin().getCoord()); // Calcul de la superficie des deux faces ! MaFace face = (MaFace) ct.getListefaces().get(0); System.out.println("Superficie de f0 : "+face.getGeom().area()); ! face = (MaFace) ct.getListefaces().get(1); System.out.println("Superficie de f1 : "+face.getGeom().area()); --- 120,134 ---- // Affichage du nombre de faces ! System.out.println("Nombre de faces de la carte : "+ct.getListeFaces().size()); // Affichage des coordonnees du noeud initial et du noeud final du premier arc ! MonArc arc = (MonArc) ct.getListeArcs().get(0); ! System.out.println("Noeud initial de a0 : "+arc.getNoeudIni().getCoord()); ! System.out.println("Noeud final de a0 : "+arc.getNoeudFin().getCoord()); // Calcul de la superficie des deux faces ! MaFace face = (MaFace) ct.getListeFaces().get(0); System.out.println("Superficie de f0 : "+face.getGeom().area()); ! face = (MaFace) ct.getListeFaces().get(1); System.out.println("Superficie de f1 : "+face.getGeom().area()); *************** *** 143,145 **** --- 143,146 ---- } + } |
Update of /cvsroot/oxygene-project/geoxygene/src/fr/ign/cogit/geoxygene/contrib/cartetopo In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv24316/src/fr/ign/cogit/geoxygene/contrib/cartetopo Modified Files: CarteTopo.java Noeud.java ElementCarteTopo.java Arc.java Face.java Chargeur.java Groupe.java Log Message: Cleaning Index: Noeud.java =================================================================== RCS file: /cvsroot/oxygene-project/geoxygene/src/fr/ign/cogit/geoxygene/contrib/cartetopo/Noeud.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Noeud.java 8 Aug 2007 08:34:38 -0000 1.1 --- Noeud.java 31 Jan 2008 16:54:12 -0000 1.2 *************** *** 51,91 **** public class Noeud extends ElementCarteTopo { ! public Noeud() { ! } ///////////////////////////////////////////////////////////////////////////////////////////////// ! // Géométrie ///////////////////////////////////////////////////////////////////////////////////////////////// ! /** Renvoie le GM_Point qui définit la géométrie de self */ ! public GM_Point getGeometrie() {return (GM_Point)geom;} [...1491 lines suppressed...] ! else if ( arc.getNoeudIni() == this ) { listePts = Operateurs.premiersPoints(arc.getGeometrie(),longueurEspaceTravail); if ( listePts.size() < 2 ) { ! listePts.add(arc.getGeometrie().coord().get(1)); } } else return null; ! if (pasEchantillonage == 0) arcEchantillone = listePts; else arcEchantillone = Operateurs.echantillonePasVariable(new GM_LineString(listePts),pasEchantillonage).coord(); *************** *** 824,826 **** } ! } --- 809,811 ---- } ! } \ No newline at end of file Index: Face.java =================================================================== RCS file: /cvsroot/oxygene-project/geoxygene/src/fr/ign/cogit/geoxygene/contrib/cartetopo/Face.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Face.java 8 Aug 2007 08:34:38 -0000 1.1 --- Face.java 31 Jan 2008 16:54:12 -0000 1.2 *************** *** 72,85 **** /* Groupes auquels self appartient */ ! private Collection listegroupes = new ArrayList(); /** Renvoie la liste des groupes de self*/ ! public Collection getListegroupes() {return this.listegroupes;} /** Définit la liste des groupes de self*/ ! public void setListegroupes(Collection liste) {this.listegroupes = liste;} /** Ajoute un groupe à self*/ public void addGroupe(Groupe groupe) { ! if (groupe != null && !listegroupes.contains(groupe)) { ! this.listegroupes.add(groupe); ! if (!groupe.getListefaces().contains(this)) groupe.addFace(this); } --- 72,85 ---- /* Groupes auquels self appartient */ ! private Collection listeGroupes = new ArrayList(); /** Renvoie la liste des groupes de self*/ ! public Collection getListeGroupes() {return this.listeGroupes;} /** Définit la liste des groupes de self*/ ! public void setListeGroupes(Collection liste) {this.listeGroupes = liste;} /** Ajoute un groupe à self*/ public void addGroupe(Groupe groupe) { ! if (groupe != null && !listeGroupes.contains(groupe)) { ! this.listeGroupes.add(groupe); ! if (!groupe.getListeFaces().contains(this)) groupe.addFace(this); } *************** *** 92,106 **** ///////////////////////////////////////////////////////////////////////////////////////////////// ! private List arcsdirects = new ArrayList(); /** Renvoie la liste des arcs directs de self */ ! public List getArcsdirects() { ! return arcsdirects; ! } /** Ajoute un arc direct de self */ ! public void addArcdirect (Arc arc) { ! if (arc != null && !arcsdirects.contains(arc)) { ! arcsdirects.add(arc); ! if (arc.getFacegauche() != this) ! arc.setFacegauche(this); } } --- 92,104 ---- ///////////////////////////////////////////////////////////////////////////////////////////////// ! private List arcsDirects = new ArrayList(); /** Renvoie la liste des arcs directs de self */ ! public List getArcsDirects() { return arcsDirects; } /** Ajoute un arc direct de self */ ! public void addArcDirect (Arc arc) { ! if (arc != null && !arcsDirects.contains(arc)) { ! arcsDirects.add(arc); ! if (arc.getFaceGauche() != this) ! arc.setFaceGauche(this); } } *************** *** 108,127 **** public void enleveArcDirect (Arc arc) { if (arc == null) return; ! if (!arcsdirects.contains(arc)) return; ! arcsdirects.remove(arc); ! arc.setFacegauche(null); } ! private List arcsindirects = new ArrayList(); /** Renvoie la liste des arcs indirects de self */ ! public List getArcsindirects() { ! return arcsindirects; ! } /** Ajoute un arc indirect de self */ ! public void addArcindirect (Arc arc) { ! if (arc != null && !arcsindirects.contains(arc)) { ! arcsindirects.add(arc); ! if (arc.getFacedroite() != this) ! arc.setFacedroite(this); } } --- 106,123 ---- public void enleveArcDirect (Arc arc) { if (arc == null) return; ! if (!arcsDirects.contains(arc)) return; ! arcsDirects.remove(arc); ! arc.setFaceGauche(null); } ! private List arcsIndirects = new ArrayList(); /** Renvoie la liste des arcs indirects de self */ ! public List getArcsIndirects() { return arcsIndirects; } /** Ajoute un arc indirect de self */ ! public void addArcIndirect (Arc arc) { ! if (arc != null && !arcsIndirects.contains(arc)) { ! arcsIndirects.add(arc); ! if (arc.getFaceDroite() != this) ! arc.setFaceDroite(this); } } *************** *** 129,135 **** public void enleveArcIndirect (Arc arc) { if (arc == null) return; ! if (!arcsindirects.contains(arc)) return; ! arcsindirects.remove(arc); ! arc.setFacedroite(null); } --- 125,131 ---- public void enleveArcIndirect (Arc arc) { if (arc == null) return; ! if (!arcsIndirects.contains(arc)) return; ! arcsIndirects.remove(arc); ! arc.setFaceDroite(null); } *************** *** 142,147 **** public List arcs() { List Arcs = new ArrayList(); ! Arcs.addAll(this.getArcsdirects()); ! Arcs.addAll(this.getArcsindirects()); return Arcs; } --- 138,143 ---- public List arcs() { List Arcs = new ArrayList(); ! Arcs.addAll(this.getArcsDirects()); ! Arcs.addAll(this.getArcsIndirects()); return Arcs; } *************** *** 234,242 **** arc0 = (Arc)arcs.get(0); ! if ( arc0.getFacedroite() == this ) { cycle = arc0.cycleADroite(); renverser = true; } ! else if ( arc0.getFacegauche() == this ) { cycle = arc0.cycleAGauche(); renverser = false; --- 230,238 ---- arc0 = (Arc)arcs.get(0); ! if ( arc0.getFaceDroite() == this ) { cycle = arc0.cycleADroite(); renverser = true; } ! else if ( arc0.getFaceGauche() == this ) { cycle = arc0.cycleAGauche(); renverser = false; *************** *** 249,254 **** arc = (Arc)itArcsEntourants.next(); orientation = ((Boolean)itOrientations.next()).booleanValue(); ! if (orientation) noeud = arc.getNoeudini(); ! else noeud = arc.getNoeudfin(); if (renverser) noeuds.add(0, noeud); else noeuds.add(noeud); --- 245,250 ---- arc = (Arc)itArcsEntourants.next(); orientation = ((Boolean)itOrientations.next()).booleanValue(); ! if (orientation) noeud = arc.getNoeudIni(); ! else noeud = arc.getNoeudFin(); if (renverser) noeuds.add(0, noeud); else noeuds.add(noeud); Index: Arc.java =================================================================== RCS file: /cvsroot/oxygene-project/geoxygene/src/fr/ign/cogit/geoxygene/contrib/cartetopo/Arc.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Arc.java 8 Aug 2007 08:34:38 -0000 1.1 --- Arc.java 31 Jan 2008 16:54:12 -0000 1.2 *************** *** 75,109 **** // Gestion de la topologie arc / noeuds ///////////////////////////////////////////////////////////////////////////////////////////////// ! private Noeud noeudini; /** Renvoie le noeud initial de self */ ! public Noeud getNoeudini() {return this.noeudini;} /** Définit le noeud initial de self. * NB: met à jour la relation inverse "sortants" de noeud */ ! public void setNoeudini(Noeud i) { ! if (i != null) { ! this.noeudini = i; ! if (!i.getSortants().contains(this)) ! i.addSortant(this); } else { ! if (this.getNoeudini() != null ) this.getNoeudini().getSortants().remove(i); ! noeudini = null; } } ! private Noeud noeudfin; /** Renvoie le noeud final de self */ ! public Noeud getNoeudfin() {return this.noeudfin;} /** Définit le noeud final de self. * NB: met à jour la relation inverse "entrants" de noeud */ ! public void setNoeudfin(Noeud f) { ! if (f != null) { ! this.noeudfin = f; ! if (!f.getEntrants().contains(this)) ! f.addEntrant(this); } else { ! if (this.getNoeudfin() != null ) this.getNoeudfin().getEntrants().remove(f); ! noeudfin = null; } } --- 75,109 ---- // Gestion de la topologie arc / noeuds ///////////////////////////////////////////////////////////////////////////////////////////////// ! private Noeud noeudIni; /** Renvoie le noeud initial de self */ ! public Noeud getNoeudIni() {return this.noeudIni;} /** Définit le noeud initial de self. * NB: met à jour la relation inverse "sortants" de noeud */ ! public void setNoeudIni(Noeud noeud) { ! if (noeud != null) { ! this.noeudIni = noeud; ! if (!noeud.getSortants().contains(this)) ! noeud.addSortant(this); } else { ! if (this.getNoeudIni() != null ) this.getNoeudIni().getSortants().remove(noeud); ! noeudIni = null; } } ! private Noeud noeudFin; /** Renvoie le noeud final de self */ ! public Noeud getNoeudFin() {return this.noeudFin;} /** Définit le noeud final de self. * NB: met à jour la relation inverse "entrants" de noeud */ ! public void setNoeudFin(Noeud noeud) { ! if (noeud != null) { ! this.noeudFin = noeud; ! if (!noeud.getEntrants().contains(this)) ! noeud.addEntrant(this); } else { ! if (this.getNoeudFin() != null ) this.getNoeudFin().getEntrants().remove(noeud); ! noeudFin = null; } } *************** *** 112,117 **** public List noeuds() { List noeuds = new ArrayList(); ! if ( !(noeudini == null) ) noeuds.add(noeudini); ! if ( !(noeudfin == null) ) noeuds.add(noeudfin); return noeuds; } --- 112,117 ---- public List noeuds() { List noeuds = new ArrayList(); ! if ( !(noeudIni == null) ) noeuds.add(noeudIni); ! if ( !(noeudFin == null) ) noeuds.add(noeudFin); return noeuds; } *************** *** 169,187 **** // instanciation de la topologie et des attributs ! this.getNoeudini().getSortants().remove(this); ! arcAvant.setNoeudini(this.getNoeudini()); ! arcAvant.setNoeudfin(nouveauNoeud); arcAvant.setCorrespondants(this.getCorrespondants()); arcAvant.setOrientation(this.getOrientation()); ! arcApres.setNoeudini(nouveauNoeud); ! this.getNoeudfin().getEntrants().remove(this); ! arcApres.setNoeudfin(this.getNoeudfin()); arcApres.setCorrespondants(this.getCorrespondants()); arcApres.setOrientation(this.getOrientation()); //destruction de l'ancien arc ! this.setNoeudini(null); ! this.setNoeudfin(null); popArcs.enleveElement(this); } --- 169,187 ---- // instanciation de la topologie et des attributs ! this.getNoeudIni().getSortants().remove(this); ! arcAvant.setNoeudIni(this.getNoeudIni()); ! arcAvant.setNoeudFin(nouveauNoeud); arcAvant.setCorrespondants(this.getCorrespondants()); arcAvant.setOrientation(this.getOrientation()); ! arcApres.setNoeudIni(nouveauNoeud); ! this.getNoeudFin().getEntrants().remove(this); ! arcApres.setNoeudFin(this.getNoeudFin()); arcApres.setCorrespondants(this.getCorrespondants()); arcApres.setOrientation(this.getOrientation()); //destruction de l'ancien arc ! this.setNoeudIni(null); ! this.setNoeudFin(null); popArcs.enleveElement(this); } *************** *** 193,232 **** public List faces() { List faces = new ArrayList(); ! if(this.getFacegauche()!=null) faces.add(this.getFacegauche()); ! if(this.getFacedroite()!=null) faces.add(this.getFacedroite()); return faces; } ! private Face facegauche; /** Renvoie la face à gauche de self */ ! public Face getFacegauche() {return this.facegauche;} /** Définit la face à gauche de self. * NB: met à jour la relation inverse "arsc directs" de face */ ! public void setFacegauche(Face f) { ! if (f != null) { ! this.facegauche = f; ! if (!f.getArcsdirects().contains(this)) ! f.addArcdirect(this); } else { ! if (this.getFacegauche() != null ) this.getFacegauche().getArcsdirects().remove(f); ! facegauche = null; } } ! private Face facedroite; /** Renvoie la face à droite de self */ ! public Face getFacedroite() {return this.facedroite;} /** Définit la face à droite de self. * NB: met à jour la relation inverse "arsc indirects" de face */ ! public void setFacedroite(Face f) { ! if (f != null) { ! this.facedroite = f; ! if (!f.getArcsindirects().contains(this)) ! f.addArcindirect(this); } else { ! if (this.getFacedroite() != null ) this.getFacedroite().getArcsindirects().remove(f); ! facedroite = null; } } --- 193,232 ---- public List faces() { List faces = new ArrayList(); ! if(this.getFaceGauche()!=null) faces.add(this.getFaceGauche()); ! if(this.getFaceDroite()!=null) faces.add(this.getFaceDroite()); return faces; } ! private Face faceGauche; /** Renvoie la face à gauche de self */ ! public Face getFaceGauche() {return this.faceGauche;} /** Définit la face à gauche de self. * NB: met à jour la relation inverse "arsc directs" de face */ ! public void setFaceGauche(Face face) { ! if (face != null) { ! this.faceGauche = face; ! if (!face.getArcsDirects().contains(this)) ! face.addArcDirect(this); } else { ! if (this.getFaceGauche() != null ) this.getFaceGauche().getArcsDirects().remove(face); ! faceGauche = null; } } ! private Face faceDroite; /** Renvoie la face à droite de self */ ! public Face getFaceDroite() {return this.faceDroite;} /** Définit la face à droite de self. * NB: met à jour la relation inverse "arsc indirects" de face */ ! public void setFaceDroite(Face face) { ! if (face != null) { ! this.faceDroite = face; ! if (!face.getArcsIndirects().contains(this)) ! face.addArcIndirect(this); } else { ! if (this.getFaceDroite() != null ) this.getFaceDroite().getArcsIndirects().remove(face); ! faceDroite = null; } } *************** *** 388,394 **** */ public List arcSuivantFin() { ! if ( this.getNoeudfin() == null ) return null; ! List arcs = (List)this.getNoeudfin().arcsClasses().get(0); ! List arcsOrientation = (List)this.getNoeudfin().arcsClasses().get(1); Iterator itArcs = arcs.iterator(); Iterator itArcsOrientation = arcsOrientation.iterator(); --- 388,394 ---- */ public List arcSuivantFin() { ! if ( this.getNoeudFin() == null ) return null; ! List arcs = (List)this.getNoeudFin().arcsClasses().get(0); ! List arcsOrientation = (List)this.getNoeudFin().arcsClasses().get(1); Iterator itArcs = arcs.iterator(); Iterator itArcsOrientation = arcsOrientation.iterator(); *************** *** 429,435 **** */ public List arcSuivantDebut() { ! if ( this.getNoeudini() == null ) return null; ! List arcs = (List)this.getNoeudini().arcsClasses().get(0); ! List arcsOrientation = (List)this.getNoeudini().arcsClasses().get(1); Iterator itArcs = arcs.iterator(); Iterator itArcsOrientation = arcsOrientation.iterator(); --- 429,435 ---- */ public List arcSuivantDebut() { ! if ( this.getNoeudIni() == null ) return null; ! List arcs = (List)this.getNoeudIni().arcsClasses().get(0); ! List arcsOrientation = (List)this.getNoeudIni().arcsClasses().get(1); Iterator itArcs = arcs.iterator(); Iterator itArcsOrientation = arcsOrientation.iterator(); *************** *** 470,476 **** */ public List arcPrecedentFin() { ! if ( this.getNoeudfin() == null ) return null; ! List arcs = (List)this.getNoeudfin().arcsClasses().get(0); ! List arcsOrientation = (List)this.getNoeudfin().arcsClasses().get(1); Iterator itArcs = arcs.iterator(); Iterator itArcsOrientation = arcsOrientation.iterator(); --- 470,476 ---- */ public List arcPrecedentFin() { ! if ( this.getNoeudFin() == null ) return null; ! List arcs = (List)this.getNoeudFin().arcsClasses().get(0); ! List arcsOrientation = (List)this.getNoeudFin().arcsClasses().get(1); Iterator itArcs = arcs.iterator(); Iterator itArcsOrientation = arcsOrientation.iterator(); *************** *** 514,520 **** */ public List arcPrecedentDebut() { ! if ( this.getNoeudini() == null ) return null; ! List arcs = (List)this.getNoeudini().arcsClasses().get(0); ! List arcsOrientation = (List)this.getNoeudini().arcsClasses().get(1); Iterator itArcs = arcs.iterator(); Iterator itArcsOrientation = arcsOrientation.iterator(); --- 514,520 ---- */ public List arcPrecedentDebut() { ! if ( this.getNoeudIni() == null ) return null; ! List arcs = (List)this.getNoeudIni().arcsClasses().get(0); ! List arcsOrientation = (List)this.getNoeudIni().arcsClasses().get(1); Iterator itArcs = arcs.iterator(); Iterator itArcsOrientation = arcsOrientation.iterator(); *************** *** 546,552 **** return null; } - - - --- 546,549 ---- *************** *** 571,576 **** public List inisOrientes() { List noeuds = new ArrayList(); ! if ( (orientation == 2 || orientation == 1) && !(noeudini == null) ) noeuds.add(noeudini); ! if ( (orientation == 2 || orientation == -1) && !(noeudfin == null) ) noeuds.add(noeudfin); return noeuds; } --- 568,573 ---- public List inisOrientes() { List noeuds = new ArrayList(); ! if ( (orientation == 2 || orientation == 1) && !(noeudIni == null) ) noeuds.add(noeudIni); ! if ( (orientation == 2 || orientation == -1) && !(noeudFin == null) ) noeuds.add(noeudFin); return noeuds; } *************** *** 583,588 **** public List finsOrientes() { List noeuds = new ArrayList(); ! if ( (orientation == 2 || orientation == -1) && !(noeudini == null) ) noeuds.add(noeudini); ! if ( (orientation == 2 || orientation == 1) && !(noeudfin == null) ) noeuds.add(noeudfin); return noeuds; } --- 580,585 ---- public List finsOrientes() { List noeuds = new ArrayList(); ! if ( (orientation == 2 || orientation == -1) && !(noeudIni == null) ) noeuds.add(noeudIni); ! if ( (orientation == 2 || orientation == 1) && !(noeudFin == null) ) noeuds.add(noeudFin); return noeuds; } *************** *** 603,620 **** /* Groupes auquels self appartient */ ! private Collection listegroupes = new ArrayList(); /** Renvoie la liste des groupes de self*/ ! public Collection getListegroupes() {return this.listegroupes;} /** Définit la liste des groupes de self*/ ! public void setListegroupes(Collection liste) {this.listegroupes = liste;} /** Ajoute un groupe à self*/ public void addGroupe(Groupe groupe) { ! if (groupe != null && !listegroupes.contains(groupe)) { ! this.listegroupes.add(groupe); ! if (!groupe.getListearcs().contains(this)) groupe.addArc(this); } } - --- 600,616 ---- /* Groupes auquels self appartient */ ! private Collection listeGroupes = new ArrayList(); /** Renvoie la liste des groupes de self*/ ! public Collection getListeGroupes() {return this.listeGroupes;} /** Définit la liste des groupes de self*/ ! public void setListegroupes(Collection liste) {this.listeGroupes = liste;} /** Ajoute un groupe à self*/ public void addGroupe(Groupe groupe) { ! if (groupe != null && !listeGroupes.contains(groupe)) { ! this.listeGroupes.add(groupe); ! if (!groupe.getListeArcs().contains(this)) groupe.addArc(this); } } Index: Chargeur.java =================================================================== RCS file: /cvsroot/oxygene-project/geoxygene/src/fr/ign/cogit/geoxygene/contrib/cartetopo/Chargeur.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Chargeur.java 8 Aug 2007 08:34:38 -0000 1.1 --- Chargeur.java 31 Jan 2008 16:54:12 -0000 1.2 *************** *** 102,104 **** System.out.println("Nb de faces importées : "+nbFaces); } ! } --- 102,104 ---- System.out.println("Nb de faces importées : "+nbFaces); } ! } \ No newline at end of file Index: CarteTopo.java =================================================================== RCS file: /cvsroot/oxygene-project/geoxygene/src/fr/ign/cogit/geoxygene/contrib/cartetopo/CarteTopo.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** CarteTopo.java 8 Aug 2007 08:34:38 -0000 1.1 --- CarteTopo.java 31 Jan 2008 16:54:12 -0000 1.2 *************** *** 63,69 **** public class CarteTopo extends DataSet { ! //////////////////////////////////////////////////////////////////////////////////////////// ! // Accès aux composants de la carte topo ! //////////////////////////////////////////////////////////////////////////////////////////// /** Population des arcs de la carte topo. */ public Population getPopArcs() {return this.getPopulation("Arc");} --- 63,69 ---- public class CarteTopo extends DataSet { [...1626 lines suppressed...] ! /** Initialise le poids de chaque arc comme étant égal à sa longueur; * NB: utile uniquement aux plus courts chemins */ *************** *** 1379,1385 **** } } ! ///////////////////////////////////////////////////////////////////////////////////////////// ! // IMPORT: remplissage de la carte topo à partir de Features ///////////////////////////////////////////////////////////////////////////////////////////// --- 1376,1382 ---- } } ! ///////////////////////////////////////////////////////////////////////////////////////////// ! // IMPORT: remplissage de la carte topo à partir de Features ///////////////////////////////////////////////////////////////////////////////////////////// Index: ElementCarteTopo.java =================================================================== RCS file: /cvsroot/oxygene-project/geoxygene/src/fr/ign/cogit/geoxygene/contrib/cartetopo/ElementCarteTopo.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ElementCarteTopo.java 8 Aug 2007 08:34:38 -0000 1.1 --- ElementCarteTopo.java 31 Jan 2008 16:54:12 -0000 1.2 *************** *** 37,39 **** } ! } --- 37,39 ---- } ! } \ No newline at end of file Index: Groupe.java =================================================================== RCS file: /cvsroot/oxygene-project/geoxygene/src/fr/ign/cogit/geoxygene/contrib/cartetopo/Groupe.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Groupe.java 8 Aug 2007 08:34:38 -0000 1.1 --- Groupe.java 31 Jan 2008 16:54:12 -0000 1.2 *************** *** 58,74 **** /* Noeuds composants du groupe */ ! private List listenoeuds = new ArrayList(); /** Renvoie la liste des noeuds de self*/ ! public List getListenoeuds() {return this.listenoeuds;} /** Définit la liste des noeuds de self*/ ! public void setListenoeuds(List liste) {this.listenoeuds = liste;} /** Ajoute un noeud à self*/ public void addNoeud(Noeud noeud) { ! if (noeud != null && !listenoeuds.contains(noeud)) { ! this.listenoeuds.add(noeud); ! if (!noeud.getListegroupes().contains(this)) noeud.addGroupe(this); } } public void addAllNoeuds(List liste) { Iterator itObj = liste.iterator(); --- 58,75 ---- /* Noeuds composants du groupe */ ! private List listeNoeuds = new ArrayList(); /** Renvoie la liste des noeuds de self*/ ! public List getListeNoeuds() {return this.listeNoeuds;} /** Définit la liste des noeuds de self*/ ! public void setListeNoeuds(List liste) {this.listeNoeuds = liste;} /** Ajoute un noeud à self*/ public void addNoeud(Noeud noeud) { ! if (noeud != null && !listeNoeuds.contains(noeud)) { ! this.listeNoeuds.add(noeud); ! if (!noeud.getListeGroupes().contains(this)) noeud.addGroupe(this); } } + /** Ajoute une liste de noeuds à self**/ public void addAllNoeuds(List liste) { Iterator itObj = liste.iterator(); *************** *** 80,96 **** /* Arcs composants du groupe */ ! private List listearcs = new ArrayList(); /** Renvoie la liste des arcs de self*/ ! public List getListearcs() {return this.listearcs;} /** Définit la liste des arcs de self*/ ! public void setListearcs(List liste) {this.listearcs = liste;} /** Ajoute un arc de self*/ public void addArc(Arc arc) { ! if (arc != null && !listearcs.contains(arc)) { ! this.listearcs.add(arc); ! if (!arc.getListegroupes().contains(this)) arc.addGroupe(this); } } public void addAllArcs(List liste) { Iterator itObj = liste.iterator(); --- 81,98 ---- /* Arcs composants du groupe */ ! private List listeArcs = new ArrayList(); /** Renvoie la liste des arcs de self*/ ! public List getListeArcs() {return this.listeArcs;} /** Définit la liste des arcs de self*/ ! public void setListeArcs(List liste) {this.listeArcs = liste;} /** Ajoute un arc de self*/ public void addArc(Arc arc) { ! if (arc != null && !listeArcs.contains(arc)) { ! this.listeArcs.add(arc); ! if (!arc.getListeGroupes().contains(this)) arc.addGroupe(this); } } + /** Ajoute une liste d'arcs à self**/ public void addAllArcs(List liste) { Iterator itObj = liste.iterator(); *************** *** 102,118 **** /* Faces composants du groupe */ ! private List listefaces = new ArrayList(); /** Renvoie la liste des faces de self*/ ! public List getListefaces() {return this.listefaces;} /** Définit la liste des faces de self*/ ! public void setListefaces(List liste) {this.listefaces = liste;} /** Ajoute une face à self*/ public void addFace(Face face) { ! if (face != null && !listefaces.contains(face)) { ! this.listefaces.add(face); ! if (!face.getListegroupes().contains(this)) face.addGroupe(this); } } public void addAllFaces(List liste) { Iterator itObj = liste.iterator(); --- 104,121 ---- /* Faces composants du groupe */ ! private List listeFaces = new ArrayList(); /** Renvoie la liste des faces de self*/ ! public List getListeFaces() {return this.listeFaces;} /** Définit la liste des faces de self*/ ! public void setListeFaces(List liste) {this.listeFaces = liste;} /** Ajoute une face à self*/ public void addFace(Face face) { ! if (face != null && !listeFaces.contains(face)) { ! this.listeFaces.add(face); ! if (!face.getListeGroupes().contains(this)) face.addGroupe(this); } } + /** Ajoute une liste de faces à self**/ public void addAllFaces(List liste) { Iterator itObj = liste.iterator(); *************** *** 122,127 **** } } - - /////////////////////////////////////////////////// --- 125,128 ---- *************** *** 132,142 **** public List getEntrants() { List arcs = new ArrayList(); ! List arcs_du_noeud = new ArrayList(); int i, j; ! for (i=0; i<this.getListenoeuds().size();i++) { ! arcs_du_noeud = ((Noeud)this.getListenoeuds().get(i)).getEntrants(); ! for (j=0; j<arcs_du_noeud.size(); j++) { ! if (!this.getListearcs().contains(arcs_du_noeud.get(j))) arcs.add(arcs_du_noeud.get(j)); } } --- 133,143 ---- public List getEntrants() { List arcs = new ArrayList(); ! List arcsDuNoeud = new ArrayList(); int i, j; ! for (i=0; i<this.getListeNoeuds().size();i++) { ! arcsDuNoeud = ((Noeud)this.getListeNoeuds().get(i)).getEntrants(); ! for (j=0; j<arcsDuNoeud.size(); j++) { ! if (!this.getListeArcs().contains(arcsDuNoeud.get(j))) arcs.add(arcsDuNoeud.get(j)); } } *************** *** 147,157 **** public List getSortants() { List arcs = new ArrayList(); ! List arcs_du_noeud = new ArrayList(); int i, j; ! for (i=0; i<this.getListenoeuds().size();i++) { ! arcs_du_noeud = ((Noeud)this.getListenoeuds().get(i)).getSortants(); ! for (j=0; j<arcs_du_noeud.size(); j++) { ! if (!this.getListearcs().contains(arcs_du_noeud.get(j))) arcs.add(arcs_du_noeud.get(j)); } } --- 148,158 ---- public List getSortants() { List arcs = new ArrayList(); ! List arcsDuNoeud = new ArrayList(); int i, j; ! for (i=0; i<this.getListeNoeuds().size();i++) { ! arcsDuNoeud = ((Noeud)this.getListeNoeuds().get(i)).getSortants(); ! for (j=0; j<arcsDuNoeud.size(); j++) { ! if (!this.getListeArcs().contains(arcsDuNoeud.get(j))) arcs.add(arcsDuNoeud.get(j)); } } *************** *** 176,186 **** public List entrantsOrientes() { List arcs = new ArrayList(); ! List arcs_du_noeud = new ArrayList(); int i, j; ! for (i=0; i<this.getListenoeuds().size();i++) { ! arcs_du_noeud = ((Noeud)this.getListenoeuds().get(i)).entrantsOrientes(); ! for (j=0; j<arcs_du_noeud.size(); j++) { ! if (!this.getListearcs().contains(arcs_du_noeud.get(j))) arcs.add(arcs_du_noeud.get(j)); } } --- 177,187 ---- public List entrantsOrientes() { List arcs = new ArrayList(); ! List arcsDuNoeud = new ArrayList(); int i, j; ! for (i=0; i<this.getListeNoeuds().size();i++) { ! arcsDuNoeud = ((Noeud)this.getListeNoeuds().get(i)).entrantsOrientes(); ! for (j=0; j<arcsDuNoeud.size(); j++) { ! if (!this.getListeArcs().contains(arcsDuNoeud.get(j))) arcs.add(arcsDuNoeud.get(j)); } } *************** *** 191,201 **** public List sortantsOrientes() { List arcs = new ArrayList(); ! List arcs_du_noeud = new ArrayList(); int i, j; ! for (i=0; i<this.getListenoeuds().size();i++) { ! arcs_du_noeud = ((Noeud)this.getListenoeuds().get(i)).sortantsOrientes(); ! for (j=0; j<arcs_du_noeud.size(); j++) { ! if (!this.getListearcs().contains(arcs_du_noeud.get(j))) arcs.add(arcs_du_noeud.get(j)); } } --- 192,202 ---- public List sortantsOrientes() { List arcs = new ArrayList(); ! List arcsDuNoeud = new ArrayList(); int i, j; ! for (i=0; i<this.getListeNoeuds().size();i++) { ! arcsDuNoeud = ((Noeud)this.getListeNoeuds().get(i)).sortantsOrientes(); ! for (j=0; j<arcsDuNoeud.size(); j++) { ! if (!this.getListeArcs().contains(arcsDuNoeud.get(j))) arcs.add(arcsDuNoeud.get(j)); } } *************** *** 215,222 **** */ public List arcsClasses() { ! List arcsclasses = new ArrayList(); ! List arcsclasses_orientation = new ArrayList(); ! List arcs_entrants = new ArrayList(this.getEntrants()); ! List arcs_sortants = new ArrayList(this.getSortants()); List arcs = new ArrayList(); List angles = new ArrayList(); --- 216,223 ---- */ public List arcsClasses() { ! List arcsClasses = new ArrayList(); ! List arcsClassesOrientation = new ArrayList(); ! List arcsEntrants = new ArrayList(this.getEntrants()); ! List arcsSortants = new ArrayList(this.getSortants()); List arcs = new ArrayList(); List angles = new ArrayList(); *************** *** 225,229 **** Arc arc; Angle angle; ! double anglemin, anglecourant; int imin; Iterator itArcs; --- 226,230 ---- Arc arc; Angle angle; ! double angleMin, angleCourant; int imin; Iterator itArcs; *************** *** 231,235 **** // recherche de l'angle de départ de chaque arc sortant ! itArcs = arcs_sortants.iterator(); while ( itArcs.hasNext() ) { arc = (Arc)itArcs.next(); --- 232,236 ---- // recherche de l'angle de départ de chaque arc sortant ! itArcs = arcsSortants.iterator(); while ( itArcs.hasNext() ) { arc = (Arc)itArcs.next(); *************** *** 240,244 **** } // recherche de l'angle de départ de chaque arc entrant ! itArcs = arcs_entrants.iterator(); while ( itArcs.hasNext() ) { arc = (Arc)itArcs.next(); --- 241,245 ---- } // recherche de l'angle de départ de chaque arc entrant ! itArcs = arcsEntrants.iterator(); while ( itArcs.hasNext() ) { arc = (Arc)itArcs.next(); *************** *** 251,265 **** // classement des arcs while ( !(arcs.isEmpty()) ) { ! anglemin = ((Angle)angles.get(0)).getAngle(); imin = 0; for(i=1;i<arcs.size() ;i++) { ! anglecourant = ((Angle)angles.get(i)).getAngle(); ! if ( anglecourant < anglemin ) { ! anglemin = anglecourant; imin = i; } } ! arcsclasses.add(arcs.get(imin)); ! arcsclasses_orientation.add(orientations.get(imin)); arcs.remove(imin); angles.remove(imin); --- 252,266 ---- // classement des arcs while ( !(arcs.isEmpty()) ) { ! angleMin = ((Angle)angles.get(0)).getAngle(); imin = 0; for(i=1;i<arcs.size() ;i++) { ! angleCourant = ((Angle)angles.get(i)).getAngle(); ! if ( angleCourant < angleMin ) { ! angleMin = angleCourant; imin = i; } } ! arcsClasses.add(arcs.get(imin)); ! arcsClassesOrientation.add(orientations.get(imin)); arcs.remove(imin); angles.remove(imin); *************** *** 267,272 **** } //retour du résultat ! resultat.add(arcsclasses); ! resultat.add(arcsclasses_orientation); return resultat; } --- 268,273 ---- } //retour du résultat ! resultat.add(arcsClasses); ! resultat.add(arcsClassesOrientation); return resultat; } *************** *** 279,294 **** */ public void vide() { ! Iterator itArcs = this.getListearcs().iterator(); while (itArcs.hasNext()) { Arc arc = (Arc) itArcs.next(); ! arc.getListegroupes().remove(this); } ! Iterator itNoeuds = this.getListenoeuds().iterator(); while (itNoeuds.hasNext()) { Noeud noeud= (Noeud) itNoeuds.next(); ! noeud.getListegroupes().remove(this); } ! this.getListearcs().clear(); ! this.getListenoeuds().clear(); } --- 280,295 ---- */ public void vide() { ! Iterator itArcs = this.getListeArcs().iterator(); while (itArcs.hasNext()) { Arc arc = (Arc) itArcs.next(); ! arc.getListeGroupes().remove(this); } ! Iterator itNoeuds = this.getListeNoeuds().iterator(); while (itNoeuds.hasNext()) { Noeud noeud= (Noeud) itNoeuds.next(); ! noeud.getListeGroupes().remove(this); } ! this.getListeArcs().clear(); ! this.getListeNoeuds().clear(); } *************** *** 312,318 **** //Groupe copie = new Groupe(); Groupe copie = (Groupe)this.getPopulation().nouvelElement(); ! copie.addAllArcs(this.getListearcs()); ! copie.addAllNoeuds(this.getListenoeuds()); ! copie.addAllFaces(this.getListefaces()); //copie.setPopulation(this.getPopulation()); return copie; --- 313,319 ---- //Groupe copie = new Groupe(); Groupe copie = (Groupe)this.getPopulation().nouvelElement(); ! copie.addAllArcs(this.getListeArcs()); ! copie.addAllNoeuds(this.getListeNoeuds()); ! copie.addAllFaces(this.getListeFaces()); //copie.setPopulation(this.getPopulation()); return copie; *************** *** 330,335 **** */ public List decomposeConnexes() { ! List groupes_connexes = new ArrayList(); ! Groupe groupe_connexe; Noeud amorce; Arc arc; --- 331,336 ---- */ public List decomposeConnexes() { ! List groupesConnexes = new ArrayList(); ! Groupe groupeConnexe; Noeud amorce; Arc arc; *************** *** 358,378 **** } ! while (this.getListenoeuds().size() != 0) { ! groupe_connexe = (Groupe)this.getPopulation().nouvelElement(); ! groupes_connexes.add(groupe_connexe); // le premier noeud de la liste des noeuds, vidée au fur et à mesure, est l'amorce d'un nouveau groupe connexe ! amorce = (Noeud)this.getListenoeuds().get(0); ! groupe_connexe.ajoute_voisins(amorce, this); //nb: méthode récursive ! groupe_connexe.arcs_dans_groupe(this); // recherche des arcs du groupe, situés entre 2 noeuds du goupe connexe } // vidage des arcs du groupe, pour faire propre (on a déjà vidé les noeuds au fur et à mesure) ! for (i=0; i<this.getListearcs().size(); i++) { ! arc = (Arc)this.getListearcs().get(i); ! arc.getListegroupes().remove(this); } ! this.getListearcs().clear(); this.getPopulation().enleveElement(this); ! return groupes_connexes; } catch (Exception e) {System.out.println("----- ERREUR dans décomposition en groupes connxes: "); System.out.println("Source possible : Nom de la classe des groupes pas ou mal renseigné dans la carte topo"); --- 359,379 ---- } ! while (this.getListeNoeuds().size() != 0) { ! groupeConnexe = (Groupe)this.getPopulation().nouvelElement(); ! groupesConnexes.add(groupeConnexe); // le premier noeud de la liste des noeuds, vidée au fur et à mesure, est l'amorce d'un nouveau groupe connexe ! amorce = (Noeud)this.getListeNoeuds().get(0); ! groupeConnexe.ajouteVoisins(amorce, this); //nb: méthode récursive ! groupeConnexe.arcsDansGroupe(this); // recherche des arcs du groupe, situés entre 2 noeuds du goupe connexe } // vidage des arcs du groupe, pour faire propre (on a déjà vidé les noeuds au fur et à mesure) ! for (i=0; i<this.getListeArcs().size(); i++) { ! arc = (Arc)this.getListeArcs().get(i); ! arc.getListeGroupes().remove(this); } ! this.getListeArcs().clear(); this.getPopulation().enleveElement(this); ! return groupesConnexes; } catch (Exception e) {System.out.println("----- ERREUR dans décomposition en groupes connxes: "); System.out.println("Source possible : Nom de la classe des groupes pas ou mal renseigné dans la carte topo"); *************** *** 380,410 **** } ! // Methode nécessaire à Decompose_Connexe // ajoute le noeud au groupe connexe, cherche ses voisins, puis l'enlève du goupe total ! private void ajoute_voisins(Noeud noeud, ! Groupe groupe_total) { ! List noeuds_voisins = new ArrayList(); int i; ! if ( this.getListenoeuds().contains(noeud) ) return; this.addNoeud(noeud); noeud.addGroupe(this); ! noeuds_voisins = noeud.voisins(groupe_total); ! groupe_total.getListenoeuds().remove(noeud); ! noeud.getListegroupes().remove(groupe_total); ! for (i=0; i<noeuds_voisins.size(); i++) { ! this.ajoute_voisins((Noeud)noeuds_voisins.get(i), groupe_total); } return; } ! // Methode nécessaire à Decompose_Connexe ! // Recherche les arcs de groupe_total ayant pour extrémité des noeuds de this. ! private void arcs_dans_groupe(Groupe groupe_total) { int i; Arc arc; ! for (i=0; i<groupe_total.getListearcs().size(); i++) { ! arc = (Arc)groupe_total.getListearcs().get(i); ! if ( this.getListenoeuds().contains(arc.getNoeudini()) || this.getListenoeuds().contains(arc.getNoeudini()) ) { this.addArc(arc); arc.addGroupe(this); --- 381,410 ---- } ! // Methode nécessaire à DecomposeConnexe // ajoute le noeud au groupe connexe, cherche ses voisins, puis l'enlève du goupe total ! private void ajouteVoisins(Noeud noeud, Groupe groupeTotal) { ! List noeudsVoisins = new ArrayList(); int i; ! if ( this.getListeNoeuds().contains(noeud) ) return; this.addNoeud(noeud); noeud.addGroupe(this); ! noeudsVoisins = noeud.voisins(groupeTotal); ! groupeTotal.getListeNoeuds().remove(noeud); ! noeud.getListeGroupes().remove(groupeTotal); ! for (i=0; i<noeudsVoisins.size(); i++) { ! this.ajouteVoisins((Noeud)noeudsVoisins.get(i), groupeTotal); } return; } ! // Methode nécessaire à DecomposeConnexe ! // Recherche les arcs de groupeTotal ayant pour extrémité des noeuds de this. ! private void arcsDansGroupe(Groupe groupeTotal) { int i; Arc arc; ! for (i=0; i<groupeTotal.getListeArcs().size(); i++) { ! arc = (Arc)groupeTotal.getListeArcs().get(i); ! if ( this.getListeNoeuds().contains(arc.getNoeudIni()) || this.getListeNoeuds().contains(arc.getNoeudIni()) ) { this.addArc(arc); arc.addGroupe(this); *************** *** 417,422 **** int i; double longueur = 0; ! for(i=0;i<this.getListearcs().size() ;i++) { ! longueur = longueur + ((Arc)this.getListearcs().get(i)).longueur(); } return longueur; --- 417,422 ---- int i; double longueur = 0; ! for(i=0;i<this.getListeArcs().size() ;i++) { ! longueur = longueur + ((Arc)this.getListeArcs().get(i)).longueur(); } return longueur; *************** *** 427,433 **** * NB: si des arcs sont en double dans un des groupes et pas dans l'autre, renvoie true quand même */ ! public boolean contient_memes_arcs(Groupe groupe) { ! if (!groupe.getListearcs().containsAll(this.getListearcs()) ) return false; ! if (!this.getListearcs().containsAll(groupe.getListearcs()) ) return false; return true; } --- 427,433 ---- * NB: si des arcs sont en double dans un des groupes et pas dans l'autre, renvoie true quand même */ ! public boolean contientMemesArcs(Groupe groupe) { ! if (!groupe.getListeArcs().containsAll(this.getListeArcs()) ) return false; ! if (!this.getListeArcs().containsAll(groupe.getListeArcs()) ) return false; return true; } *************** *** 442,451 **** Arc arc; ! for (i=0; i<this.getListearcs().size(); i++) { ! arc = (Arc)this.getListearcs().get(i); ! ini = arc.getNoeudini(); ! fin = arc.getNoeudfin(); if ( ini != null ) { ! if ( !this.getListenoeuds().contains(ini) ) { this.addNoeud(ini); ini.addGroupe(this); --- 442,451 ---- Arc arc; ! for (i=0; i<this.getListeArcs().size(); i++) { ! arc = (Arc)this.getListeArcs().get(i); ! ini = arc.getNoeudIni(); ! fin = arc.getNoeudFin(); if ( ini != null ) { ! if ( !this.getListeNoeuds().contains(ini) ) { this.addNoeud(ini); ini.addGroupe(this); *************** *** 453,457 **** } if ( fin != null ) { ! if ( !this.getListenoeuds().contains(fin) ) { this.addNoeud(fin); fin.addGroupe(this); --- 453,457 ---- } if ( fin != null ) { ! if ( !this.getListeNoeuds().contains(fin) ) { this.addNoeud(fin); fin.addGroupe(this); *************** *** 459,467 **** } } ! } ! ! ! ! ! } --- 459,463 ---- } } ! } ! } \ No newline at end of file |
|
From: Eric G. <eg...@us...> - 2008-01-31 16:54:12
|
Update of /cvsroot/oxygene-project/geoxygene/src/fr/ign/cogit/geoxygene/contrib/delaunay In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv24316/src/fr/ign/cogit/geoxygene/contrib/delaunay Modified Files: Triangulation.java ChargeurTriangulation.java TriangleDelaunay.java ArcDelaunay.java Log Message: Cleaning Index: ChargeurTriangulation.java =================================================================== RCS file: /cvsroot/oxygene-project/geoxygene/src/fr/ign/cogit/geoxygene/contrib/delaunay/ChargeurTriangulation.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ChargeurTriangulation.java 8 Aug 2007 08:38:52 -0000 1.1 --- ChargeurTriangulation.java 31 Jan 2008 16:54:12 -0000 1.2 *************** *** 49,54 **** public class ChargeurTriangulation extends Chargeur { ! public ChargeurTriangulation() { ! } public static void importLigneEnPoints(String nomClasseGeo, --- 49,53 ---- public class ChargeurTriangulation extends Chargeur { ! public ChargeurTriangulation() {} public static void importLigneEnPoints(String nomClasseGeo, *************** *** 79,89 **** } System.out.println("Fin importLigneEnPoints"); - } ! ! ! ! public static void importLigneEnPoints(FT_FeatureCollection listeFeatures, Triangulation carte) throws Exception { FT_Feature objGeo; --- 78,84 ---- } System.out.println("Fin importLigneEnPoints"); } ! public static void importLigneEnPoints(FT_FeatureCollection listeFeatures, Triangulation carte) throws Exception { FT_Feature objGeo; *************** *** 110,117 **** } System.out.println("Fin importLigneEnPoints"); - } - public static void importSegments(String nomClasseGeo, Triangulation carte) throws Exception { --- 105,110 ---- *************** *** 123,129 **** DirectPositionList listePoints; DirectPosition dp; ! ArrayList listetemp, listenoeuds, listenoeudseffaces = null; DirectPositionList tableau = null; ! Iterator iter, iterentrants, itersortants = null; int i, j; --- 116,122 ---- DirectPositionList listePoints; DirectPosition dp; ! ArrayList listeTemp, listeNoeuds, listeNoeudsEffaces = null; DirectPositionList tableau = null; ! Iterator it, itEntrants, itSortants = null; int i, j; *************** *** 132,137 **** Object[] parama = new Object[2]; - - for(i=0 ; i<listeFeatures.size() ; i++) { System.out.println("Nombre de lignes importées :" + i); --- 125,128 ---- *************** *** 140,144 **** if ( objGeo.getGeom() instanceof fr.ign.cogit.geoxygene.spatial.coordgeom.GM_LineString ) { listePoints = ((GM_LineString)objGeo.getGeom()).getControlPoint(); ! listetemp = new ArrayList(); for (j=0; j<listePoints.size(); j++) { if ( (j % 100) == 0 ) { --- 131,135 ---- if ( objGeo.getGeom() instanceof fr.ign.cogit.geoxygene.spatial.coordgeom.GM_LineString ) { listePoints = ((GM_LineString)objGeo.getGeom()).getControlPoint(); ! listeTemp = new ArrayList(); for (j=0; j<listePoints.size(); j++) { if ( (j % 100) == 0 ) { *************** *** 147,197 **** noeud1 = (NoeudDelaunay)carte.getPopNoeuds().nouvelElement(); noeud1.setCoord(listePoints.get(j)); ! listetemp.add(noeud1); } ! for(j=0;j<listetemp.size()-1;j++) { ! parama[0] = (NoeudDelaunay) listetemp.get(j); ! parama[1] = (NoeudDelaunay) listetemp.get(j+1); arc = (ArcDelaunay)carte.getPopArcs().nouvelElement(signaturea,parama); } - } } - // Filtrage des noeuds en double et correction de la topologie System.out.println("Filtrage des noeuds en double"); ! listenoeuds = new ArrayList(carte.getListenoeuds()); ! iter = carte.getListenoeuds().iterator(); tableau = new DirectPositionList(); ! listenoeudseffaces = new ArrayList(); ! while (iter.hasNext()) { ! noeud1 = (NoeudDelaunay) iter.next(); dp = noeud1.getCoord(); if (Operateurs.indice2D(tableau,dp) != -1) { System.out.println("Elimination d'un doublon"); ! iterentrants = noeud1.getEntrants().iterator(); ! while (iterentrants.hasNext()) { ! arc = (ArcDelaunay) iterentrants.next(); ! arc.setNoeudfin((NoeudDelaunay)listenoeuds.get(Operateurs.indice2D(tableau,dp))); } ! itersortants = noeud1.getSortants().iterator(); ! while (itersortants.hasNext()) { ! arc = (ArcDelaunay) itersortants.next(); ! arc.setNoeudini((NoeudDelaunay)listenoeuds.get(Operateurs.indice2D(tableau,dp))); } } tableau.add(dp); } ! iter = listenoeudseffaces.iterator(); ! while (iter.hasNext()) { ! noeud1 = (NoeudDelaunay) iter.next(); carte.getPopNoeuds().remove(noeud1); // pour la bidirection } System.out.println("Fin importSegments"); - } ! public static void importSegments(FT_FeatureCollection listeFeatures, Triangulation carte) throws Exception { FT_Feature objGeo; --- 138,185 ---- noeud1 = (NoeudDelaunay)carte.getPopNoeuds().nouvelElement(); noeud1.setCoord(listePoints.get(j)); ! listeTemp.add(noeud1); } ! for(j=0;j<listeTemp.size()-1;j++) { ! parama[0] = (NoeudDelaunay) listeTemp.get(j); ! parama[1] = (NoeudDelaunay) listeTemp.get(j+1); arc = (ArcDelaunay)carte.getPopArcs().nouvelElement(signaturea,parama); } } } // Filtrage des noeuds en double et correction de la topologie System.out.println("Filtrage des noeuds en double"); ! listeNoeuds = new ArrayList(carte.getListeNoeuds()); ! it = carte.getListeNoeuds().iterator(); tableau = new DirectPositionList(); ! listeNoeudsEffaces = new ArrayList(); ! while (it.hasNext()) { ! noeud1 = (NoeudDelaunay) it.next(); dp = noeud1.getCoord(); if (Operateurs.indice2D(tableau,dp) != -1) { System.out.println("Elimination d'un doublon"); ! itEntrants = noeud1.getEntrants().iterator(); ! while (itEntrants.hasNext()) { ! arc = (ArcDelaunay) itEntrants.next(); ! arc.setNoeudFin((NoeudDelaunay)listeNoeuds.get(Operateurs.indice2D(tableau,dp))); } ! itSortants = noeud1.getSortants().iterator(); ! while (itSortants.hasNext()) { ! arc = (ArcDelaunay) itSortants.next(); ! arc.setNoeudIni((NoeudDelaunay)listeNoeuds.get(Operateurs.indice2D(tableau,dp))); } } tableau.add(dp); } ! it = listeNoeudsEffaces.iterator(); ! while (it.hasNext()) { ! noeud1 = (NoeudDelaunay) it.next(); carte.getPopNoeuds().remove(noeud1); // pour la bidirection } System.out.println("Fin importSegments"); } ! public static void importSegments(FT_FeatureCollection listeFeatures, Triangulation carte) throws Exception { FT_Feature objGeo; *************** *** 201,207 **** DirectPositionList listePoints; DirectPosition dp; ! ArrayList listetemp, listenoeuds, listenoeudseffaces = null; DirectPositionList tableau = null; ! Iterator iter, iterentrants, itersortants = null; int i, j; --- 189,195 ---- DirectPositionList listePoints; DirectPosition dp; ! ArrayList listeTemp, listeNoeuds, listeNoeudsEffaces = null; DirectPositionList tableau = null; ! Iterator it, itEntrants, itSortants = null; int i, j; *************** *** 209,214 **** Object[] parama = new Object[2]; - - for(i=0 ; i<listeFeatures.size() ; i++) { System.out.println("Nombre de lignes importées :" + i); --- 197,200 ---- *************** *** 217,221 **** if ( objGeo.getGeom() instanceof fr.ign.cogit.geoxygene.spatial.coordgeom.GM_LineString ) { listePoints = ((GM_LineString)objGeo.getGeom()).coord(); ! listetemp = new ArrayList(); for (j=0; j<listePoints.size(); j++) { if ( (j % 100) == 0 ) { --- 203,207 ---- if ( objGeo.getGeom() instanceof fr.ign.cogit.geoxygene.spatial.coordgeom.GM_LineString ) { listePoints = ((GM_LineString)objGeo.getGeom()).coord(); ! listeTemp = new ArrayList(); for (j=0; j<listePoints.size(); j++) { if ( (j % 100) == 0 ) { *************** *** 224,236 **** noeud1 = (NoeudDelaunay)carte.getPopNoeuds().nouvelElement(); noeud1.setCoord(listePoints.get(j)); ! listetemp.add(noeud1); } ! for(j=0;j<listetemp.size()-1;j++) { ! parama[0] = (NoeudDelaunay) listetemp.get(j); ! parama[1] = (NoeudDelaunay) listetemp.get(j+1); arc = (ArcDelaunay)carte.getPopArcs().nouvelElement(signaturea,parama); } ! parama[0] = (NoeudDelaunay) listetemp.get(listetemp.size()-1); ! parama[1] = (NoeudDelaunay) listetemp.get(0); arc = (ArcDelaunay)carte.getPopArcs().nouvelElement(signaturea,parama); --- 210,222 ---- noeud1 = (NoeudDelaunay)carte.getPopNoeuds().nouvelElement(); noeud1.setCoord(listePoints.get(j)); ! listeTemp.add(noeud1); } ! for(j=0;j<listeTemp.size()-1;j++) { ! parama[0] = (NoeudDelaunay) listeTemp.get(j); ! parama[1] = (NoeudDelaunay) listeTemp.get(j+1); arc = (ArcDelaunay)carte.getPopArcs().nouvelElement(signaturea,parama); } ! parama[0] = (NoeudDelaunay) listeTemp.get(listeTemp.size()-1); ! parama[1] = (NoeudDelaunay) listeTemp.get(0); arc = (ArcDelaunay)carte.getPopArcs().nouvelElement(signaturea,parama); *************** *** 240,244 **** listePoints = ((GM_Polygon)objGeo.getGeom()).coord(); System.out.println("Polygone "+i+" "+listePoints); ! listetemp = new ArrayList(); for (j=0; j<listePoints.size(); j++) { if ( (j % 100) == 0 ) { --- 226,230 ---- listePoints = ((GM_Polygon)objGeo.getGeom()).coord(); System.out.println("Polygone "+i+" "+listePoints); ! listeTemp = new ArrayList(); for (j=0; j<listePoints.size(); j++) { if ( (j % 100) == 0 ) { *************** *** 247,258 **** noeud1 = (NoeudDelaunay)carte.getPopNoeuds().nouvelElement(); noeud1.setCoord(listePoints.get(j)); ! listetemp.add(noeud1); } ! for(j=0;j<listetemp.size()-1;j++) { ! parama[0] = (NoeudDelaunay) listetemp.get(j); ! parama[1] = (NoeudDelaunay) listetemp.get(j+1); arc = (ArcDelaunay)carte.getPopArcs().nouvelElement(signaturea,parama); } - } } --- 233,243 ---- noeud1 = (NoeudDelaunay)carte.getPopNoeuds().nouvelElement(); noeud1.setCoord(listePoints.get(j)); ! listeTemp.add(noeud1); } ! for(j=0;j<listeTemp.size()-1;j++) { ! parama[0] = (NoeudDelaunay) listeTemp.get(j); ! parama[1] = (NoeudDelaunay) listeTemp.get(j+1); arc = (ArcDelaunay)carte.getPopArcs().nouvelElement(signaturea,parama); } } } *************** *** 260,297 **** // Filtrage des noeuds en double et correction de la topologie System.out.println("Filtrage des noeuds en double"); ! listenoeuds = new ArrayList(carte.getListenoeuds()); ! iter = carte.getListenoeuds().iterator(); tableau = new DirectPositionList(); ! listenoeudseffaces = new ArrayList(); ! while (iter.hasNext()) { ! noeud1 = (NoeudDelaunay) iter.next(); dp = noeud1.getCoord(); if (Operateurs.indice2D(tableau,dp) != -1) { //System.out.println("Elimination d'un doublon"); ! iterentrants = noeud1.getEntrants().iterator(); ! while (iterentrants.hasNext()) { ! arc = (ArcDelaunay) iterentrants.next(); ! arc.setNoeudfin((NoeudDelaunay)listenoeuds.get(Operateurs.indice2D(tableau,dp))); } ! itersortants = noeud1.getSortants().iterator(); ! while (itersortants.hasNext()) { ! arc = (ArcDelaunay) itersortants.next(); ! arc.setNoeudini((NoeudDelaunay)listenoeuds.get(Operateurs.indice2D(tableau,dp))); } } tableau.add(dp); } ! iter = listenoeudseffaces.iterator(); ! while (iter.hasNext()) { ! noeud1 = (NoeudDelaunay) iter.next(); carte.getPopNoeuds().remove(noeud1); // pour la bidirection } System.out.println("Fin importSegments"); ! System.out.println("liste de noeuds "+carte.getListenoeuds().size()); ! System.out.println("liste des arcs "+carte.getListearcs().size()); ! } ! public static void importPolygoneEnPoints(FT_FeatureCollection listeFeatures, Triangulation carte) throws Exception { FT_Feature objGeo; --- 245,281 ---- // Filtrage des noeuds en double et correction de la topologie System.out.println("Filtrage des noeuds en double"); ! listeNoeuds = new ArrayList(carte.getListeNoeuds()); ! it = carte.getListeNoeuds().iterator(); tableau = new DirectPositionList(); ! listeNoeudsEffaces = new ArrayList(); ! while (it.hasNext()) { ! noeud1 = (NoeudDelaunay) it.next(); dp = noeud1.getCoord(); if (Operateurs.indice2D(tableau,dp) != -1) { //System.out.println("Elimination d'un doublon"); ! itEntrants = noeud1.getEntrants().iterator(); ! while (itEntrants.hasNext()) { ! arc = (ArcDelaunay) itEntrants.next(); ! arc.setNoeudFin((NoeudDelaunay)listeNoeuds.get(Operateurs.indice2D(tableau,dp))); } ! itSortants = noeud1.getSortants().iterator(); ! while (itSortants.hasNext()) { ! arc = (ArcDelaunay) itSortants.next(); ! arc.setNoeudIni((NoeudDelaunay)listeNoeuds.get(Operateurs.indice2D(tableau,dp))); } } tableau.add(dp); } ! it = listeNoeudsEffaces.iterator(); ! while (it.hasNext()) { ! noeud1 = (NoeudDelaunay) it.next(); carte.getPopNoeuds().remove(noeud1); // pour la bidirection } System.out.println("Fin importSegments"); ! System.out.println("liste de noeuds "+carte.getListeNoeuds().size()); ! System.out.println("liste des arcs "+carte.getListeArcs().size()); } ! public static void importPolygoneEnPoints(FT_FeatureCollection listeFeatures, Triangulation carte) throws Exception { FT_Feature objGeo; *************** *** 313,324 **** noeud = (NoeudDelaunay)carte.getPopNoeuds().nouvelElement(); noeud.setCoord(listePoints.get(j)); - } } } System.out.println("Fin importPolygoneEnPoints"); ! ! } ! ! ! } --- 297,304 ---- noeud = (NoeudDelaunay)carte.getPopNoeuds().nouvelElement(); noeud.setCoord(listePoints.get(j)); } } } System.out.println("Fin importPolygoneEnPoints"); ! } ! } \ No newline at end of file Index: Triangulation.java =================================================================== RCS file: /cvsroot/oxygene-project/geoxygene/src/fr/ign/cogit/geoxygene/contrib/delaunay/Triangulation.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Triangulation.java 8 Aug 2007 08:38:52 -0000 1.1 --- Triangulation.java 31 Jan 2008 16:54:12 -0000 1.2 *************** *** 68,72 **** GM_Point point; DirectPosition coord; ! ArrayList noeuds = new ArrayList(this.getListenoeuds()); jin.numberofpoints = noeuds.size(); --- 68,72 ---- GM_Point point; DirectPosition coord; ! ArrayList noeuds = new ArrayList(this.getListeNoeuds()); jin.numberofpoints = noeuds.size(); *************** *** 83,93 **** private void convertJinSegments() { int i; ! ArrayList noeuds = new ArrayList(this.getListenoeuds()); ! ArrayList aretes = new ArrayList(this.getListearcs()); jin.numberofsegments = aretes.size(); jin.segmentlist = new int[2*jin.numberofsegments]; for (i=0; i<jin.numberofsegments; i++) { ! jin.segmentlist[2*i]=noeuds.indexOf(((ArcDelaunay)aretes.get(i)).getNoeudini()); ! jin.segmentlist[2*i+1]=noeuds.indexOf(((ArcDelaunay)aretes.get(i)).getNoeudfin()); } --- 83,93 ---- private void convertJinSegments() { int i; ! ArrayList noeuds = new ArrayList(this.getListeNoeuds()); ! ArrayList aretes = new ArrayList(this.getListeArcs()); jin.numberofsegments = aretes.size(); jin.segmentlist = new int[2*jin.numberofsegments]; for (i=0; i<jin.numberofsegments; i++) { ! jin.segmentlist[2*i]=noeuds.indexOf(((ArcDelaunay)aretes.get(i)).getNoeudIni()); ! jin.segmentlist[2*i+1]=noeuds.indexOf(((ArcDelaunay)aretes.get(i)).getNoeudFin()); } *************** *** 102,106 **** GM_LineString ls; - for (i=jin.numberofpoints; i<jout.numberofpoints; i++) { --- 102,105 ---- *************** *** 110,115 **** } ! ! ArrayList noeuds = new ArrayList(this.getListenoeuds()); Class[] signaturea = {this.getPopNoeuds().getClasse(),this.getPopNoeuds().getClasse()}; --- 109,113 ---- } ! ArrayList noeuds = new ArrayList(this.getListeNoeuds()); Class[] signaturea = {this.getPopNoeuds().getClasse(),this.getPopNoeuds().getClasse()}; *************** *** 155,159 **** } - public void triangule() throws Exception{ this.lanceTriangulation("czeB"); --- 153,156 ---- *************** *** 161,163 **** } ! } --- 158,160 ---- } ! } \ No newline at end of file Index: TriangleDelaunay.java =================================================================== RCS file: /cvsroot/oxygene-project/geoxygene/src/fr/ign/cogit/geoxygene/contrib/delaunay/TriangleDelaunay.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TriangleDelaunay.java 8 Aug 2007 08:38:52 -0000 1.1 --- TriangleDelaunay.java 31 Jan 2008 16:54:12 -0000 1.2 *************** *** 58,66 **** while (iterarcs.hasNext()) { arc = (Arc) iterarcs.next(); ! if ((arc.getNoeudini() == n1) && (arc.getNoeudfin() == n2)) { ! arc.setFacegauche(this); break; ! } else if ((arc.getNoeudini() == n2) && (arc.getNoeudfin() == n1)) { ! arc.setFacedroite(this); break; } --- 58,66 ---- while (iterarcs.hasNext()) { arc = (Arc) iterarcs.next(); ! if ((arc.getNoeudIni() == n1) && (arc.getNoeudFin() == n2)) { ! arc.setFaceGauche(this); break; ! } else if ((arc.getNoeudIni() == n2) && (arc.getNoeudFin() == n1)) { ! arc.setFaceDroite(this); break; } *************** *** 70,78 **** while (iterarcs.hasNext()) { arc = (Arc) iterarcs.next(); ! if ((arc.getNoeudini() == n2) && (arc.getNoeudfin() == n3)) { ! arc.setFacegauche(this); break; ! } else if ((arc.getNoeudini() == n3) && (arc.getNoeudfin() == n2)) { ! arc.setFacedroite(this); break; } --- 70,78 ---- while (iterarcs.hasNext()) { arc = (Arc) iterarcs.next(); ! if ((arc.getNoeudIni() == n2) && (arc.getNoeudFin() == n3)) { ! arc.setFaceGauche(this); break; ! } else if ((arc.getNoeudIni() == n3) && (arc.getNoeudFin() == n2)) { ! arc.setFaceDroite(this); break; } *************** *** 82,98 **** while (iterarcs.hasNext()) { arc = (Arc) iterarcs.next(); ! if ((arc.getNoeudini() == n3) && (arc.getNoeudfin() == n1)) { ! arc.setFacegauche(this); break; ! } else if ((arc.getNoeudini() == n1) && (arc.getNoeudfin() == n3)) { ! arc.setFacedroite(this); break; } ! } ! ! } ! ! ! } --- 82,94 ---- while (iterarcs.hasNext()) { arc = (Arc) iterarcs.next(); ! if ((arc.getNoeudIni() == n3) && (arc.getNoeudFin() == n1)) { ! arc.setFaceGauche(this); break; ! } else if ((arc.getNoeudIni() == n1) && (arc.getNoeudFin() == n3)) { ! arc.setFaceDroite(this); break; } ! } } ! } \ No newline at end of file Index: ArcDelaunay.java =================================================================== RCS file: /cvsroot/oxygene-project/geoxygene/src/fr/ign/cogit/geoxygene/contrib/delaunay/ArcDelaunay.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ArcDelaunay.java 8 Aug 2007 08:38:52 -0000 1.1 --- ArcDelaunay.java 31 Jan 2008 16:54:12 -0000 1.2 *************** *** 45,50 **** dpl.add(n2.getCoord()); setCoord(dpl); ! setNoeudini(n1); ! setNoeudfin(n2); } --- 45,50 ---- dpl.add(n2.getCoord()); setCoord(dpl); ! setNoeudIni(n1); ! setNoeudFin(n2); } |
|
From: Eric G. <eg...@us...> - 2008-01-31 16:53:18
|
Update of /cvsroot/oxygene-project/geoxygene/lib In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv23923/lib Removed Files: postgis.jar jts.jar jdbc3-postgresql.jar Log Message: Deletion of old libraries --- postgis.jar DELETED --- --- jdbc3-postgresql.jar DELETED --- --- jts.jar DELETED --- |
|
From: Eric G. <eg...@us...> - 2008-01-31 16:45:43
|
Update of /cvsroot/oxygene-project/geoxygene In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv20613 Modified Files: NOTICE NEWS CHANGES Log Message: Version updates Index: NEWS =================================================================== RCS file: /cvsroot/oxygene-project/geoxygene/NEWS,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** NEWS 12 Jun 2006 11:11:35 -0000 1.2 --- NEWS 31 Jan 2008 16:45:43 -0000 1.3 *************** *** 1,2 **** --- 1,14 ---- + Version 1.3: + + - This version provides a data matching tool and a generator of DBMS tables and XML mapping + files from Java classes. + + + Version 1.2: + + - This version provides new tools (topological map, geometric tools, Delaunay's triangulation) + and corrects some minor bugs. + + Version 1.1: *************** *** 9,11 **** ! Please refer to http://oxygene-project.sourceforge.net for a detailed list of supported features. --- 21,23 ---- ! Please refer to http://oxygene-project.sourceforge.net for a detailed list of supported features. \ No newline at end of file Index: NOTICE =================================================================== RCS file: /cvsroot/oxygene-project/geoxygene/NOTICE,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** NOTICE 8 Aug 2007 09:02:36 -0000 1.3 --- NOTICE 31 Jan 2008 16:45:43 -0000 1.4 *************** *** 1,3 **** ! GeOxygene, version 1.2 GeOxygene aims at providing an open framework which implements OGC/ISO specifications for --- 1,3 ---- ! GeOxygene, version 1.3 GeOxygene aims at providing an open framework which implements OGC/ISO specifications for *************** *** 41,49 **** The Java Topology Suite (JTS) is an API of 2D spatial predicates and functions, which conforms to the Simple Features Specification for SQL published by the OGC. ! Website: http://www.vividsolutions.com/jts/jtshome.htm JTS is released under the LGPL license: http://www.gnu.org/copyleft/lesser.html ! The file "jts.jar" of the GeOxygene distribution is the version 1.4 of JTS distribution. --- 41,49 ---- The Java Topology Suite (JTS) is an API of 2D spatial predicates and functions, which conforms to the Simple Features Specification for SQL published by the OGC. ! Website: http://sourceforge.net/projects/jts-topo-suite JTS is released under the LGPL license: http://www.gnu.org/copyleft/lesser.html ! The file "jts-1.9.jar" of the GeOxygene distribution is the version 1.9 of JTS distribution. *************** *** 101,107 **** http://www.postgresql.org/about/licence ! The file "pg74.1jdbc3.jar" of the Geoxygene distribution is the JDBC driver ! of PostgreSQL v7.4 for JDBC 3. ! http://jdbc.postgresql.org/ --- 101,108 ---- http://www.postgresql.org/about/licence ! The file "postgresql-8.2-507.jdbc4.jar" of the Geoxygene distribution is the JDBC driver ! of PostgreSQL v8.2 for JDBC4 (JDBC4 is recommended with the 1.6 Java Virtual Machine). ! If you use the 1.5 JVM, you should download and use the file "postgresql-8.2-507.jdbc3.jar" ! available on the website http://jdbc.postgresql.org. *************** *** 112,119 **** Website: http://postgis.refractions.net/ ! PostGIS is released under the LGPL license: http://www.gnu.org/copyleft/lesser.html ! The file "postgis.jar" of the Geoxygene distribution allows the access to PostGIS database from Java code and is included in the PostGIS distribution. --- 113,120 ---- Website: http://postgis.refractions.net/ ! The PostGIS Driver is released under the LGPL license: http://www.gnu.org/copyleft/lesser.html ! The file "postgis-1.3.2.jar" of the Geoxygene distribution allows the access to PostGIS database from Java code and is included in the PostGIS distribution. *************** *** 126,129 **** --- 127,131 ---- - the "SDOAPI" library that allows the access to "Oracle spatial" database from Java code + 8) JAMA Index: CHANGES =================================================================== RCS file: /cvsroot/oxygene-project/geoxygene/CHANGES,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** CHANGES 14 Jun 2006 20:54:31 -0000 1.3 --- CHANGES 31 Jan 2008 16:45:43 -0000 1.4 *************** *** 1,2 **** --- 1,29 ---- + GeOxygene 1.3 + 2008/01/31 + + - Adding a data matching tool. + + - Adding a simple method to create minimal spanning trees. + + - Adding a generator of DBMS tables and XML mapping files from Java classes. + + - Improvment of the GeOxygeneReader methods to partially take into account the GM_Aggregate + geometry type (useful to visualize data matching results). + + + ------------------------------------------------------------ + GeOxygene 1.2 + 2007/08/08 + + - Adding geometric tools (angles, distances, shape indicators, vectors) + + - Adding a topological map and graph management tool. + + - Adding Delaunay's triangulation support. + + - Correction of some minor bugs. + + + ------------------------------------------------------------ GeOxygene 1.1 2006/06/12 *************** *** 34,36 **** 2005/05/08 ! Initial release ! --- 61,63 ---- 2005/05/08 ! Initial release ! \ No newline at end of file |
|
From: Eric G. <eg...@us...> - 2008-01-31 16:42:03
|
Update of /cvsroot/oxygene-project/geoxygene/lib In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv18993/lib Added Files: postgis_1.3.2.jar postgresql-8.2-507.jdbc4.jar jts-1.9.jar Log Message: Add libraries to support new versions of PostgreSQL, PostGIS and JTS --- NEW FILE: postgis_1.3.2.jar --- (This appears to be a binary file; contents omitted.) --- NEW FILE: jts-1.9.jar --- (This appears to be a binary file; contents omitted.) --- NEW FILE: postgresql-8.2-507.jdbc4.jar --- (This appears to be a binary file; contents omitted.) |
|
From: Eric G. <eg...@us...> - 2008-01-31 16:40:24
|
Update of /cvsroot/oxygene-project/geoxygene/sql/oracle/appariement In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv18588/sql/oracle/appariement Added Files: init_lien.sql Log Message: adding a data matching tool --- NEW FILE: init_lien.sql --- ------------------------------------------------------------------------------ -- SCRIPT DE CREATION DES TABLES RELATIVES AUX LIENS ET AUX ENSEMBLES DE LIENS ------------------------------------------------------------------------------ -- DROP TABLE ENSEMBLE_LIENS; -- DROP TABLE LIEN; -- DELETE FROM USER_SDO_GEOM_METADATA WHERE TABLE_NAME='LIEN'; CREATE TABLE ENSEMBLE_LIENS ( COGITID INTEGER PRIMARY KEY, NOM VARCHAR(255), PARAMETRAGE VARCHAR(255), EVALINTERNE VARCHAR(255), EVALGLOBALE VARCHAR(255), DATEHEURE VARCHAR(100), POPULATIONS VARCHAR(1000), ROUGE INTEGER, VERT INTEGER, BLEU INTEGER ); CREATE TABLE LIEN ( COGITID INTEGER PRIMARY KEY, GEOM MDSYS.SDO_GEOMETRY, OBJETSREF VARCHAR(1000), OBJETSCOMP VARCHAR(1000), EVALUATION NUMBER, INDICATEURS VARCHAR(255), COMMENTAIRE VARCHAR(255), NOM VARCHAR(255), TYPE VARCHAR(255), REFERENCE VARCHAR(255), COMPARAISON VARCHAR(255), ENSLIENSID INTEGER ); INSERT INTO USER_SDO_GEOM_METADATA VALUES ('LIEN','GEOM',NULL,NULL); commit; |
|
From: Eric G. <eg...@us...> - 2008-01-31 16:40:23
|
Update of /cvsroot/oxygene-project/geoxygene/sql/postgis/appariement In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv18588/sql/postgis/appariement Added Files: init_lien.sql Log Message: adding a data matching tool --- NEW FILE: init_lien.sql --- ------------------------------------------------------------------------------ -- SCRIPT DE CREATION DEs TABLES RELATIVES AUX LIENS ET AUX ENSEMBLES DE LIENS ------------------------------------------------------------------------------ -- script de destruction -- DROP TABLE ensemble_liens; -- DROP TABLE lien; -- SELECT DropGeometryColumn('lien','geom'); CREATE TABLE ensemble_liens ( cogitid INTEGER PRIMARY KEY, nom VARCHAR(255), parametrage VARCHAR(255), evalinterne VARCHAR(255), evalglobale VARCHAR(255), dateheure VARCHAR(100), populations VARCHAR(1000), rouge INTEGER, vert INTEGER, bleu INTEGER ); CREATE TABLE lien ( cogitid INTEGER PRIMARY KEY, objetsref VARCHAR(1000), objetscomp VARCHAR(1000), evaluation DOUBLE PRECISION, indicateurs VARCHAR(255), commentaire VARCHAR(255), nom VARCHAR(255), type VARCHAR(255), reference VARCHAR(255), comparaison VARCHAR(255), ensliensid INTEGER ); SELECT AddGeometryColumn('','lien','geom','-1','GEOMETRYCOLLECTION',2); commit; |
|
From: Eric G. <eg...@us...> - 2008-01-31 16:38:59
|
Update of /cvsroot/oxygene-project/geoxygene/sql/postgis/appariement In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv17762/sql/postgis/appariement Log Message: Directory /cvsroot/oxygene-project/geoxygene/sql/postgis/appariement added to the repository |
|
From: Eric G. <eg...@us...> - 2008-01-31 16:38:58
|
Update of /cvsroot/oxygene-project/geoxygene/sql/oracle/appariement In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv17762/sql/oracle/appariement Log Message: Directory /cvsroot/oxygene-project/geoxygene/sql/oracle/appariement added to the repository |
|
From: Eric G. <eg...@us...> - 2008-01-31 16:38:17
|
Update of /cvsroot/oxygene-project/geoxygene/mapping/ojb1/appariement In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv17714/mapping/ojb1/appariement Added Files: repository_lien.xml Log Message: adding a data matching tool --- NEW FILE: repository_lien.xml --- <!-- ENSEMBLE DE LIENS --> <class-descriptor class="fr.ign.cogit.geoxygene.contrib.appariement.stockageLiens.EnsembleDeLiensSGBD" table="ensemble_liens" > <field-descriptor name="id" column="cogitid" jdbc-type="INTEGER" primarykey="true" autoincrement="true"/> <field-descriptor name="nom" column="nom" jdbc-type="VARCHAR" /> <field-descriptor name="parametrage" column="parametrage" jdbc-type="VARCHAR" /> <field-descriptor name="evaluationInterne" column="evalinterne" jdbc-type="VARCHAR" /> <field-descriptor name="evaluationGlobale" column="evalglobale" jdbc-type="VARCHAR" /> <field-descriptor name="populations" column="populations" jdbc-type="VARCHAR" /> <field-descriptor name="date" column="dateheure" jdbc-type="VARCHAR" /> <field-descriptor name="rouge" column="rouge" jdbc-type="INTEGER" /> <field-descriptor name="vert" column="vert" jdbc-type="INTEGER" /> <field-descriptor name="bleu" column="bleu" jdbc-type="INTEGER" /> <collection-descriptor name="liensSGBD" element-class-ref="fr.ign.cogit.geoxygene.contrib.appariement.stockageLiens.LienSGBD" > <inverse-foreignkey field-ref="ensembleLiensID" /> </collection-descriptor> </class-descriptor> <!-- LIEN --> <class-descriptor class="fr.ign.cogit.geoxygene.contrib.appariement.stockageLiens.LienSGBD" table="LIEN" > <field-descriptor name="id" column="COGITID" jdbc-type="INTEGER" primarykey="true" autoincrement="true"/> <field-descriptor name="objetsRef" column="objetsref" jdbc-type="VARCHAR" /> <field-descriptor name="objetsComp" column="objetscomp" jdbc-type="VARCHAR" /> <field-descriptor name="evaluation" column="evaluation" jdbc-type="DOUBLE" /> <field-descriptor name="indicateurs" column="indicateurs" jdbc-type="VARCHAR" /> <field-descriptor name="commentaire" column="commentaire" jdbc-type="VARCHAR" /> <field-descriptor name="nom" column="nom" jdbc-type="VARCHAR" /> <field-descriptor name="type" column="type" jdbc-type="VARCHAR" /> <field-descriptor name="reference" column="reference" jdbc-type="VARCHAR" /> <field-descriptor name="comparaison" column="comparaison" jdbc-type="VARCHAR" /> <field-descriptor name="geom" column="GEOM" jdbc-type="STRUCT" conversion="fr.ign.cogit.geoxygene.datatools.ojb.GeomGeOxygene2Dbms" /> <field-descriptor name="ensembleLiensID" column="ensliensid" jdbc-type="INTEGER" access="anonymous"/> <reference-descriptor name="ensembleLiensSGBD" class-ref="fr.ign.cogit.geoxygene.contrib.appariement.stockageLiens.EnsembleDeLiensSGBD" > <foreignkey field-ref="ensembleLiensID" /> </reference-descriptor> </class-descriptor> |
|
From: Eric G. <eg...@us...> - 2008-01-31 16:38:17
|
Update of /cvsroot/oxygene-project/geoxygene/mapping/ojb1/appariement In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv17700/mapping/ojb1/appariement Log Message: Directory /cvsroot/oxygene-project/geoxygene/mapping/ojb1/appariement added to the repository |
|
From: Eric G. <eg...@us...> - 2008-01-31 16:33:27
|
Update of /cvsroot/oxygene-project/geoxygene/src/fr/ign/cogit/geoxygene/util/viewer In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv15749/src/fr/ign/cogit/geoxygene/util/viewer Modified Files: GeOxygeneReader.java Log Message: Improvment of the GeOxygeneReader methods to partially take into account the GM_Aggregate geometry type (useful to visualize data matching results). Index: GeOxygeneReader.java =================================================================== RCS file: /cvsroot/oxygene-project/geoxygene/src/fr/ign/cogit/geoxygene/util/viewer/GeOxygeneReader.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** GeOxygeneReader.java 2 Aug 2005 18:22:46 -0000 1.2 --- GeOxygeneReader.java 31 Jan 2008 16:33:30 -0000 1.3 *************** *** 64,84 **** /** ! * A class to simplify the process of loading a FT_FeatureCollection from GeOxygene. ! * Collections must be MUST be homogeneous. ! * Geometry types in the collection MUST be the same for all features (but some null geometries are accepted). ! * All features in the collection must belong to same class. ! * Works only for collections of features whose geometry type is : ! * GM_Point, GM_LineString, GM_Polygon, GM_MultiPoint, GM_MultiCurve (with linestrings), GM_Multisurface (with polygons). ! * No aggregates. ! * ID are fill with hashcode(). ! * One GeOxygeneReader is created by Theme stemming from GeOxygene data. ! * ! * @author Thierry Badard & Arnaud Braun ! * @version 1.0 ! * ! */ class GeOxygeneReader implements DataSource { ! // Default public static boolean SHOW_PUBLIC_ATTRIBUTES = true; --- 64,85 ---- /** ! * A class to simplify the process of loading a FT_FeatureCollection from GeOxygene. ! * Collections MUST be homogeneous. ! * Geometry types in the collection MUST be the same for all features (but some null geometries are accepted). ! * All features in the collection must belong to same class. ! * Works only for collections of features whose geometry type is : ! * GM_Point, GM_LineString, GM_Polygon, GM_MultiPoint, GM_MultiCurve (with linestrings), GM_Multisurface (with polygons) ! * and GM_Aggregate with an homogeneous geometry type inside. ! * ID are fill with hashcode(). ! * One GeOxygeneReader is created by Theme stemming from GeOxygene data. ! * ! * @author Thierry Badard & Arnaud Braun & Eric Grosso ! * @version 1.1 ! * ! * ! */ class GeOxygeneReader implements DataSource { ! // Default public static boolean SHOW_PUBLIC_ATTRIBUTES = true; *************** *** 88,106 **** private FT_FeatureCollection coll; private Class featureClass ; ! // GEOTOOLS fields private Layer layer; private Theme theme; ! public GeOxygeneReader (FT_FeatureCollection featColl) { coll = featColl; ! // guess feature class (type of the first feature ...) coll.initIterator(); FT_Feature feature = coll.next(); featureClass = feature.getClass(); ! // guess geometry type (type of the first geometry is the type for all geometries ...) coll.initIterator(); --- 89,107 ---- private FT_FeatureCollection coll; private Class featureClass ; ! // GEOTOOLS fields private Layer layer; private Theme theme; ! public GeOxygeneReader (FT_FeatureCollection featColl) { coll = featColl; ! // guess feature class (type of the first feature ...) coll.initIterator(); FT_Feature feature = coll.next(); featureClass = feature.getClass(); ! // guess geometry type (type of the first geometry is the type for all geometries ...) coll.initIterator(); *************** *** 121,154 **** // init layer if (GM_Point.class.isAssignableFrom(geom.getClass()) ! || GM_MultiPoint.class.isAssignableFrom(geom.getClass())) layer = readPoints(); else if (GM_LineString.class.isAssignableFrom(geom.getClass()) ! || GM_MultiCurve.class.isAssignableFrom(geom.getClass())) layer = readLines(); else if (GM_Polygon.class.isAssignableFrom(geom.getClass()) ! || GM_MultiSurface.class.isAssignableFrom(geom.getClass())) layer = readPolygons(); else { ! System.out.println(" ## GeOxygeneReader works only for GM_Point, GM_LineString or GM_Polygon or MultiPrimitives"); System.out.println(" ## Have tried to read : " + geom.getClass().getName()); } ! // init theme theme = new Theme(getLayer()); } ! ! /** Layer for use in a Theme. */ public Layer getLayer() { return layer; } ! ! /** Theme for use in a Viewer. */ public Theme getTheme() { return theme; } ! ! /** Returns a Theme shaded by an attribute. */ public Theme getTheme (Shader shader, String shadedBy) { --- 122,171 ---- // init layer if (GM_Point.class.isAssignableFrom(geom.getClass()) ! || GM_MultiPoint.class.isAssignableFrom(geom.getClass())) layer = readPoints(); else if (GM_LineString.class.isAssignableFrom(geom.getClass()) ! || GM_MultiCurve.class.isAssignableFrom(geom.getClass())) layer = readLines(); else if (GM_Polygon.class.isAssignableFrom(geom.getClass()) ! || GM_MultiSurface.class.isAssignableFrom(geom.getClass())) layer = readPolygons(); + //ajout pour le cas des GM_Aggregate ( + else if (GM_Aggregate.class.isAssignableFrom(geom.getClass())){ + Class classe = ((GM_Aggregate)geom).get(0).getClass(); + if (GM_Point.class.isAssignableFrom(geom.getClass()) + || GM_MultiPoint.class.isAssignableFrom(classe)){ + layer = readPoints(); + } + else if (GM_LineString.class.isAssignableFrom(classe) + || GM_MultiCurve.class.isAssignableFrom(classe)){ + layer = readLines(); + } + else if (GM_Polygon.class.isAssignableFrom(classe) + || GM_MultiSurface.class.isAssignableFrom(classe)){ + layer = readPolygons(); + } + } else { ! System.out.println(" ## GeOxygeneReader works only for GM_Point, GM_LineString or GM_Polygon or MultiPrimitives or GM_Aggregate with the same geometry"); System.out.println(" ## Have tried to read : " + geom.getClass().getName()); } ! // init theme theme = new Theme(getLayer()); } ! ! /** Layer for use in a Theme. */ public Layer getLayer() { return layer; } ! ! /** Theme for use in a Viewer. */ public Theme getTheme() { return theme; } ! ! /** Returns a Theme shaded by an attribute. */ public Theme getTheme (Shader shader, String shadedBy) { *************** *** 163,167 **** } return theme; ! } else if (shader instanceof UniqueShader) { InitUniqueShader uShader = new InitUniqueShader (shader, shadedBy); --- 180,184 ---- } return theme; ! } else if (shader instanceof UniqueShader) { InitUniqueShader uShader = new InitUniqueShader (shader, shadedBy); *************** *** 176,184 **** return theme; } ! return theme; } ! ! /** Refresh the feature. The feature must belong to the collection.*/ public void refreshFeature (FT_Feature feature) { --- 193,201 ---- return theme; } ! return theme; } ! ! /** Refresh the feature. The feature must belong to the collection.*/ public void refreshFeature (FT_Feature feature) { *************** *** 193,198 **** } } ! ! /** Reads the feature information from the FT_FeatureCollection and produces a PointLayer for use in a Theme. */ private Layer readPoints() { --- 210,215 ---- } } ! ! /** Reads the feature information from the FT_FeatureCollection and produces a PointLayer for use in a Theme. */ private Layer readPoints() { *************** *** 205,209 **** if (GM_Point.class.isAssignableFrom(geom.getClass())) { layer.addGeoPoint(geOxygenePointToGeoPoint(feat.hashCode(), geom)); ! } else if (GM_MultiPoint.class.isAssignableFrom(geom.getClass())) { GM_Aggregate aggr = (GM_Aggregate)geom; aggr.initIterator(); --- 222,227 ---- if (GM_Point.class.isAssignableFrom(geom.getClass())) { layer.addGeoPoint(geOxygenePointToGeoPoint(feat.hashCode(), geom)); ! } else if (GM_MultiPoint.class.isAssignableFrom(geom.getClass()) ! || GM_Aggregate.class.isAssignableFrom(geom.getClass())) { GM_Aggregate aggr = (GM_Aggregate)geom; aggr.initIterator(); *************** *** 215,220 **** return layer; } ! ! /** Reads the feature information from the FT_FeatureCollection and produces a LineLayer for use in a Theme. */ private Layer readLines() { --- 233,238 ---- return layer; } ! ! /** Reads the feature information from the FT_FeatureCollection and produces a LineLayer for use in a Theme. */ private Layer readLines() { *************** *** 227,231 **** if (GM_LineString.class.isAssignableFrom(geom.getClass())) { layer.addGeoLine(geOxygeneLineStringToGeoLine(feat.hashCode(),geom)); ! } else if (GM_MultiCurve.class.isAssignableFrom(geom.getClass())) { GM_Aggregate aggr = (GM_Aggregate)geom; aggr.initIterator(); --- 245,250 ---- if (GM_LineString.class.isAssignableFrom(geom.getClass())) { layer.addGeoLine(geOxygeneLineStringToGeoLine(feat.hashCode(),geom)); ! } else if (GM_MultiCurve.class.isAssignableFrom(geom.getClass()) ! || GM_Aggregate.class.isAssignableFrom(geom.getClass())) { GM_Aggregate aggr = (GM_Aggregate)geom; aggr.initIterator(); *************** *** 237,242 **** return layer; } ! ! /** Reads the feature information from the FT_FeatureCollection and produces a PolygonLayer for use in a Theme. */ private Layer readPolygons() { --- 256,261 ---- return layer; } ! ! /** Reads the feature information from the FT_FeatureCollection and produces a PolygonLayer for use in a Theme. */ private Layer readPolygons() { *************** *** 255,259 **** layer.addGeoPolygon(geOxygenePolygonToGeoPolygon(feat.hashCode(), inter) ); } ! } else if (GM_MultiSurface.class.isAssignableFrom(geom.getClass())) { GM_Aggregate aggr = (GM_Aggregate)geom; aggr.initIterator(); --- 274,279 ---- layer.addGeoPolygon(geOxygenePolygonToGeoPolygon(feat.hashCode(), inter) ); } ! } else if (GM_MultiSurface.class.isAssignableFrom(geom.getClass()) ! || GM_Aggregate.class.isAssignableFrom(geom.getClass())) { GM_Aggregate aggr = (GM_Aggregate)geom; aggr.initIterator(); *************** *** 272,277 **** return layer; } ! ! /** Convert a GM_Point to a GeoPoint */ private GeoPoint geOxygenePointToGeoPoint(int id, GM_Object geom) { --- 292,297 ---- return layer; } ! ! /** Convert a GM_Point to a GeoPoint */ private GeoPoint geOxygenePointToGeoPoint(int id, GM_Object geom) { *************** *** 290,295 **** return geoLine; } ! ! /** Convert a GM_Polygon (single, without holes) to a Polygon */ private GeoPolygon geOxygenePolygonToGeoPolygon(int id, GM_Object geom) { --- 310,315 ---- return geoLine; } ! ! /** Convert a GM_Polygon (single, without holes) to a Polygon */ private GeoPolygon geOxygenePolygonToGeoPolygon(int id, GM_Object geom) { *************** *** 300,305 **** return geoPoly; } ! ! private void addGeoShape(FT_Feature feature, GM_Object geom) { if (GM_Point.class.isAssignableFrom(geom.getClass())) { --- 320,325 ---- return geoPoly; } ! ! private void addGeoShape(FT_Feature feature, GM_Object geom) { if (GM_Point.class.isAssignableFrom(geom.getClass())) { *************** *** 319,323 **** aggr.initIterator(); while (aggr.hasNext()) ! ((LineLayer)layer).addGeoLine(geOxygeneLineStringToGeoLine(feature.hashCode(),aggr.next())); } else if (GM_Polygon.class.isAssignableFrom(geom.getClass())) { --- 339,343 ---- aggr.initIterator(); while (aggr.hasNext()) ! ((LineLayer)layer).addGeoLine(geOxygeneLineStringToGeoLine(feature.hashCode(),aggr.next())); } else if (GM_Polygon.class.isAssignableFrom(geom.getClass())) { *************** *** 349,359 **** } } ! ! /** Fills geodata objects with all of the fields of the collection. */ public Object[] readData() { Vector columnNames = new Vector(); Vector rowData = new Vector(); ! // Fill columnNames Field[] fields = getAccessibleFields(); --- 369,379 ---- } } ! ! /** Fills geodata objects with all of the fields of the collection. */ public Object[] readData() { Vector columnNames = new Vector(); Vector rowData = new Vector(); ! // Fill columnNames Field[] fields = getAccessibleFields(); *************** *** 361,365 **** for (int i=0; i<nbFields; i++) columnNames.add(fields[i].getName()); ! // Fill rowData coll.initIterator(); --- 381,385 ---- for (int i=0; i<nbFields; i++) columnNames.add(fields[i].getName()); ! // Fill rowData coll.initIterator(); *************** *** 374,385 **** row.add(null); } ! rowData.add(row); } ! return new Vector[] {columnNames, rowData}; ! } ! ! /** Fills a geodata objects with this field. * Field type MUST be String ou double. */ --- 394,405 ---- row.add(null); } ! rowData.add(row); } ! return new Vector[] {columnNames, rowData}; ! } ! ! /** Fills a geodata objects with this field. * Field type MUST be String ou double. */ *************** *** 422,429 **** return data; ! } ! /** Returns all fields name. */ public String[] getFieldsNames() { --- 442,449 ---- return data; ! } ! /** Returns all fields name. */ public String[] getFieldsNames() { *************** *** 434,439 **** return strings; } ! ! /** Returns all possible values for a litteral field. */ private String[] getPossibleValues (String fieldName) { --- 454,459 ---- return strings; } ! ! /** Returns all possible values for a litteral field. */ private String[] getPossibleValues (String fieldName) { *************** *** 457,469 **** } return result; ! } ! ! public Class getFieldType (String fieldName) { return getAccessibleField(fieldName).getType(); } ! ! private Field getAccessibleField (String fieldName) { Field[] fields = getAccessibleFields(); --- 477,489 ---- } return result; ! } ! ! public Class getFieldType (String fieldName) { return getAccessibleField(fieldName).getType(); } ! ! private Field getAccessibleField (String fieldName) { Field[] fields = getAccessibleFields(); *************** *** 473,493 **** return null; } ! ! private Field[] getAccessibleFields() { return ObjectBrowser.getAccessibleFields(featureClass, SHOW_PUBLIC_ATTRIBUTES, SHOW_PROTECTED_ATTRIBUTES); } ! ! private Color getRandomColor() { return new Color((float)Math.random(),(float)Math.random(),(float)Math.random()); } ! ! public FT_FeatureCollection getFeatureCollection() { return coll; } ! ! public FT_Feature getFeatureById (int id) { coll.initIterator(); --- 493,513 ---- return null; } ! ! private Field[] getAccessibleFields() { return ObjectBrowser.getAccessibleFields(featureClass, SHOW_PUBLIC_ATTRIBUTES, SHOW_PROTECTED_ATTRIBUTES); } ! ! private Color getRandomColor() { return new Color((float)Math.random(),(float)Math.random(),(float)Math.random()); } ! ! public FT_FeatureCollection getFeatureCollection() { return coll; } ! ! public FT_Feature getFeatureById (int id) { coll.initIterator(); *************** *** 500,505 **** return null; } ! ! class InitUniqueShader extends Thread { Shader shader; --- 520,525 ---- return null; } ! ! class InitUniqueShader extends Thread { Shader shader; *************** *** 543,548 **** } } ! ! class InitHSVShader extends Thread { Shader shader; --- 563,568 ---- } } ! ! class InitHSVShader extends Thread { Shader shader; *************** *** 556,560 **** theme.setGeoData(data); shader.setRange(data); ! } public Shader getShader() { --- 576,580 ---- theme.setGeoData(data); shader.setRange(data); ! } public Shader getShader() { *************** *** 562,565 **** } } ! } --- 582,585 ---- } } ! } |
|
From: Eric G. <eg...@us...> - 2008-01-31 16:31:59
|
Update of /cvsroot/oxygene-project/geoxygene/src/fr/ign/cogit/geoxygene/util/console In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv14988/src/fr/ign/cogit/geoxygene/util/console Modified Files: GeOxygeneConsoleInterface.java Log Message: Adding a generator of DBMS tables and XML mapping files from Java classes. Index: GeOxygeneConsoleInterface.java =================================================================== RCS file: /cvsroot/oxygene-project/geoxygene/src/fr/ign/cogit/geoxygene/util/console/GeOxygeneConsoleInterface.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** GeOxygeneConsoleInterface.java 2 Aug 2005 18:22:42 -0000 1.2 --- GeOxygeneConsoleInterface.java 31 Jan 2008 16:32:00 -0000 1.3 *************** *** 38,53 **** /** ! * ! * @author Thierry Badard & Arnaud Braun ! * @version 1.0 ! * ! */ class GeOxygeneConsoleInterface extends JFrame { ! private static String ojb = "OJB"; private static String castor= "Castor"; ! private static String sqlToJavaText = "SQL to Java"; private static String javaToSqlText = "Java to SQL"; --- 38,53 ---- /** ! * ! * @author Thierry Badard & Arnaud Braun & Eric Grosso ! * @version 1.1 ! * ! */ class GeOxygeneConsoleInterface extends JFrame { ! private static String ojb = "OJB"; private static String castor= "Castor"; ! private static String sqlToJavaText = "SQL to Java"; private static String javaToSqlText = "Java to SQL"; *************** *** 65,82 **** private void InterfaceInit() { ! System.out.println("Bonjour"); ! // Init GUI this.getContentPane().setLayout( new GridLayout(8,1) ); ! //A COMMENTER final JPanel mappingPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 20, 10)); final JComboBox mappingComboBox = new JComboBox( new String[] {ojb,castor} ); mappingPanel.add(mappingComboBox); ! this.getContentPane().add(mappingPanel); ! JButton sqlToJavaButton = new JButton (sqlToJavaText); this.getContentPane().add(sqlToJavaButton); --- 65,82 ---- private void InterfaceInit() { ! System.out.println("Bonjour"); ! // Init GUI this.getContentPane().setLayout( new GridLayout(8,1) ); ! //A COMMENTER final JPanel mappingPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 20, 10)); final JComboBox mappingComboBox = new JComboBox( new String[] {ojb,castor} ); mappingPanel.add(mappingComboBox); ! this.getContentPane().add(mappingPanel); ! JButton sqlToJavaButton = new JButton (sqlToJavaText); this.getContentPane().add(sqlToJavaButton); *************** *** 87,99 **** } }); ! JButton javaToSqlButton = new JButton (javaToSqlText); this.getContentPane().add(javaToSqlButton); javaToSqlButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { ! System.out.println("marche pas !!"); } }); ! JButton manageDataButton = new JButton (manageDataText); this.getContentPane().add(manageDataButton); --- 87,99 ---- } }); ! JButton javaToSqlButton = new JButton (javaToSqlText); this.getContentPane().add(javaToSqlButton); javaToSqlButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { ! JavaToSql.action(); } }); ! JButton manageDataButton = new JButton (manageDataText); this.getContentPane().add(manageDataButton); *************** *** 103,107 **** } }); ! JButton datasetButton = new JButton (datasetText); this.getContentPane().add(datasetButton); --- 103,107 ---- } }); ! JButton datasetButton = new JButton (datasetText); this.getContentPane().add(datasetButton); *************** *** 111,115 **** } }); ! JButton importDataButton = new JButton (importDatatext); this.getContentPane().add(importDataButton); --- 111,115 ---- } }); ! JButton importDataButton = new JButton (importDatatext); this.getContentPane().add(importDataButton); *************** *** 119,123 **** } }); ! JButton viewDataButton = new JButton (viewDataText); this.getContentPane().add(viewDataButton); --- 119,123 ---- } }); ! JButton viewDataButton = new JButton (viewDataText); this.getContentPane().add(viewDataButton); *************** *** 127,131 **** } }); ! JButton quitButton = new JButton (quitText); this.getContentPane().add(quitButton); --- 127,131 ---- } }); ! JButton quitButton = new JButton (quitText); this.getContentPane().add(quitButton); *************** *** 136,143 **** } }); ! } ! ! private int getMappingTool (String string) { if (string.equals(ojb)) return GeOxygeneConsole.OJB; --- 136,143 ---- } }); ! } ! ! private int getMappingTool (String string) { if (string.equals(ojb)) return GeOxygeneConsole.OJB; *************** *** 145,148 **** else return 0; } ! } --- 145,148 ---- else return 0; } ! } |
|
From: Eric G. <eg...@us...> - 2008-01-31 16:31:53
|
Update of /cvsroot/oxygene-project/geoxygene/src/fr/ign/cogit/geoxygene/util/loader In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv14961/src/fr/ign/cogit/geoxygene/util/loader Added Files: SQLXMLGenerator.java Log Message: Adding a generator of DBMS tables and XML mapping files from Java classes. --- NEW FILE: SQLXMLGenerator.java --- /* * This file is part of the GeOxygene project source files. * * GeOxygene aims at providing an open framework which implements OGC/ISO specifications for * the development and deployment of geographic (GIS) applications. It is a open source * contribution of the COGIT laboratory at the Institut Géographique National (the French * National Mapping Agency). * * See: http://oxygene-project.sourceforge.net * * Copyright (C) 2005 Institut Géographique National * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with * this library (see file LICENSE if present); if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ package fr.ign.cogit.geoxygene.util.loader; import java.lang.reflect.Field; import java.math.BigDecimal; import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import javax.swing.JOptionPane; import fr.ign.cogit.geoxygene.datatools.Geodatabase; import fr.ign.cogit.geoxygene.util.loader.gui.GUISelectionGeometrie; /** * Usage interne. Appelé par la Console. * Génére à partir d'une classe Java, la table dans le SGBD et le fichier de mapping * correspondants. * * @author Eric Grosso - IGN / Laboratoire COGIT * @version 1.0 * */ public class SQLXMLGenerator { private Geodatabase data; private OjbXMLGenerator theXMLGenerator; private String geOxygeneMapping; // path private String extentMappingFileName; private String tableName; private String javaFilePath; private String userName; /////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////// public SQLXMLGenerator (Geodatabase Data, String JavaFilePath, String mappingDirectory, String TableName, String mappingFileName){ data = Data; tableName = TableName; javaFilePath = JavaFilePath; String extentClassName = ""; extentMappingFileName = null; geOxygeneMapping = mappingDirectory; theXMLGenerator = new OjbXMLGenerator(data,geOxygeneMapping,mappingFileName, extentClassName, extentMappingFileName ); } /////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////// public void writeAll() { //ecriture de la table correspondante à la classe java boolean heritage = true; // à paramétrer par la suite try { if (data.getDBMS() == Geodatabase.ORACLE) querySQLOracle(javaFilePath,tableName,heritage); else if (data.getDBMS() == Geodatabase.POSTGIS)querySQLPostgis(javaFilePath,tableName,heritage); else { JOptionPane.showMessageDialog(null,"Problème de SGBD non supporté : il apparaît que" + " ce n'est ni Oracle ni PostgreSQL","SGBD non supporté",JOptionPane.WARNING_MESSAGE); return; } } catch (Exception e){ e.printStackTrace(); } //ecriture du fichier de mapping correspondant try { Connection conn = data.getConnection(); Statement stm = conn.createStatement(); System.out.println(""); theXMLGenerator.writeClassHeader(javaFilePath,tableName.toUpperCase()); String query = ""; if (data.getDBMS() == Geodatabase.ORACLE){ query = getQueryColumnNameOracle(tableName.toUpperCase()); conn.commit(); ResultSet rs = (ResultSet)stm.executeQuery(query); // Boucle sur les colonnes while (rs.next()) { // La colonne SQL String sqlColumnName = rs.getString(1); // Le type SQL String sqlDbmsType = rs.getString(2); // Si c'est le champ COGITID : on passe if (sqlColumnName.compareToIgnoreCase("COGITID") == 0) continue; // bidouille speciale Oracle pour traiter le cas des entiers et des booléens... if (rs.getObject(3) != null) { int dataScale = ((BigDecimal)rs.getObject(3)).intValue(); //cas des entiers if ((sqlDbmsType.compareToIgnoreCase("NUMBER")==0) && (dataScale == 0)) sqlDbmsType ="INTEGER"; //cas des booleans (ne sont pas reconnus par Oracle JDBC) //On suppose que CHAR(1) est un boolean if ((sqlDbmsType.compareToIgnoreCase("CHAR")==0) && (dataScale == 1)) sqlDbmsType ="BOOLEAN"; } // fin de la bidouille // Le nom Java String javaFieldName = sqlColumnName.toLowerCase(); theXMLGenerator.writeField(javaFieldName,sqlColumnName,sqlDbmsType); System.out.println(" nom sql : "+sqlColumnName+"\n nom java : "+javaFieldName); } rs.close(); theXMLGenerator.writeClassBottom(); } else if (data.getDBMS() == Geodatabase.POSTGIS){ try { userName = conn.getMetaData().getUserName(); } catch (SQLException e) { e.printStackTrace(); } query = getQueryColumnNamePostgis(tableName,userName); conn.commit(); ResultSet rs = (ResultSet)stm.executeQuery(query); // Boucle sur les colonnes while (rs.next()) { // La colonne SQL String sqlColumnName = rs.getString(1); // Le type SQL String sqlDbmsType = rs.getString(2); // Si c'est le champ COGITID : on passe if (sqlColumnName.compareToIgnoreCase("COGITID") == 0) continue; // Le nom Java String javaFieldName = sqlColumnName.toLowerCase(); theXMLGenerator.writeField(javaFieldName,sqlColumnName,sqlDbmsType); System.out.println(" nom sql : "+sqlColumnName+"\n nom java : "+javaFieldName); } rs.close(); theXMLGenerator.writeClassBottom(); } stm.close(); } catch (Exception e) { e.printStackTrace(); } theXMLGenerator.writeFileBottom(); theXMLGenerator.writeInFile(); } /////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////// private String getQueryColumnNameOracle(String tableName) { return "SELECT COLUMN_NAME, DATA_TYPE, DATA_SCALE FROM USER_TAB_COLUMNS WHERE TABLE_NAME = '"+tableName+"'"; } /////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////// private String getQueryColumnNamePostgis(String tableName, String user) { return "select pg_attribute.attname, pg_type.typname "+ "from pg_attribute, pg_type, pg_class, pg_user "+ "where pg_class.oid = pg_attribute.attrelid "+ "and pg_attribute.attnum>0 "+ "and pg_attribute.atttypid = pg_type.oid "+ "and pg_class.relowner = pg_user.usesysid "+ "and pg_user.usename = '"+user.toLowerCase()+"' "+ "and pg_class.relname='"+tableName.toLowerCase()+"'"; } /////////////////////////////////////////////////////////////////////// //////////////////////////////// ORACLE /////////////////////////////// /////////////////////////////////////////////////////////////////////// //l'identifiant COGITID est créé par défaut en tant que clé primaire de la table //HERITAGE : //héritage jusqu'à ce que la classe mère soit différente de java.lang.Object //n'est hérité de FT_Feature que la géométrie et l'identifiant private void querySQLOracle(String cheminClasse, String nomTable, boolean flagHeritage) throws Exception { String query="", queryGeom=""; Field[] attributs; Class classe = Class.forName(cheminClasse); try { Connection conn = data.getConnection(); Statement stm = conn.createStatement(); if (flagHeritage){ String [][] dataNomAttributs, dataTypeAttributs; String nomAttribut, type; query = "CREATE TABLE "+nomTable+" (COGITID INTEGER PRIMARY KEY"; while (!classe.getName().equals("java.lang.Object")){ attributs = classe.getDeclaredFields(); dataNomAttributs = new String[attributs.length][1]; dataTypeAttributs = new String[attributs.length][1]; if (!classe.getName().equals("fr.ign.cogit.geoxygene.feature.FT_Feature")){ int i = 0; while(i!=attributs.length){ query = query+", "; Field attribut = (Field)attributs[i]; nomAttribut = attribut.getName(); if (!nomAttribut.equals("id")){ type = javaType2OracleType(attribut.getType().getName()); query = query + attribut.getName() +" "+type; if (type.equals("MDSYS.SDO_GEOMETRY")) { stm.executeQuery("INSERT INTO USER_SDO_GEOM_METADATA VALUES ('"+nomTable+"','"+nomAttribut+"',NULL,NULL)"); } } i++; } } else { query = query + ",GEOM MDSYS.SDO_GEOMETRY"; stm.executeQuery("INSERT INTO USER_SDO_GEOM_METADATA VALUES ('"+nomTable+"','GEOM',NULL,NULL)"); } classe = classe.getSuperclass(); } query = query + ")"; } else { attributs = classe.getDeclaredFields(); String [][] dataNomAttributs = new String[attributs.length][1], dataTypeAttributs = new String[attributs.length][1]; String nomAttribut, type; query = "CREATE TABLE "+nomTable+" (COGITID INTEGER PRIMARY KEY"; int i = 0; while(i!=attributs.length){ query = query+","; Field attribut = (Field)attributs[i]; nomAttribut = attribut.getName(); if (!nomAttribut.equals("id")){ type = javaType2OracleType(attribut.getType().getName()); query = query +attribut.getName() +" "+type; if (type.equals("MDSYS.SDO_GEOMETRY")) { stm.executeQuery("INSERT INTO USER_SDO_GEOM_METADATA VALUES ('"+nomTable+"','"+nomAttribut+"',NULL,NULL)"); } } i++; } query = query + ")"; } stm.executeQuery(query); stm.close(); } catch (Exception e) { e.printStackTrace(); } } /////////////////////////////////////////////////////////////////////// //////////////////////////////// POSTGIS ////////////////////////////// /////////////////////////////////////////////////////////////////////// //l'identifiant COGITID est créé par défaut en tant que clé primaire de la table //HERITAGE : //héritage jusqu'à ce que la classe mère soit différente de java.lang.Object //n'est hérité de FT_Feature que la géométrie et l'identifiant private void querySQLPostgis(String cheminClasse, String nomTable, boolean flagHeritage) throws Exception { String query="", queryGeom=""; Field[] attributs; Class classe = Class.forName(cheminClasse); boolean flagGeomFeature = false; try { Connection conn = data.getConnection(); Statement stm = conn.createStatement(); if (flagHeritage){ String [][] dataNomAttributs, dataTypeAttributs; String nomAttribut, type; query = "CREATE TABLE "+nomTable+" (COGITID INTEGER PRIMARY KEY"; while (!classe.getName().equals("java.lang.Object")){ attributs = classe.getDeclaredFields(); dataNomAttributs = new String[attributs.length][1]; dataTypeAttributs = new String[attributs.length][1]; if (!classe.getName().equals("fr.ign.cogit.geoxygene.feature.FT_Feature")){ int i = 0; while(i!=attributs.length){ query = query+", "; Field attribut = (Field)attributs[i]; nomAttribut = attribut.getName(); if (!nomAttribut.equals("id")){ type = javaType2PostgisType(attribut.getType().getName()); query = query + attribut.getName() +" "+type; //if (type.equals("GEOMETRY")) { //interface pour connaitre le type de géométrie (impossible à savoir interactivement) //stm.executeQuery("SELECT AddGeometrycolumn ('','"+nomTable+"','"+nomAttribut+"','-1','GEOMETRY',2)"); //} } i++; } } else { flagGeomFeature = true; } classe = classe.getSuperclass(); } query = query + ")"; } else { attributs = classe.getDeclaredFields(); String [][] dataNomAttributs = new String[attributs.length][1], dataTypeAttributs = new String[attributs.length][1]; String nomAttribut, type; query = "CREATE TABLE "+nomTable+" (COGITID INTEGER PRIMARY KEY"; int i = 0; while(i!=attributs.length){ query = query+","; Field attribut = (Field)attributs[i]; nomAttribut = attribut.getName(); if (!nomAttribut.equals("id")){ type = javaType2PostgisType(attribut.getType().getName()); query = query +attribut.getName() +" "+type; if (type.equals("GEOMETRY")) { flagGeomFeature = true; } } i++; } query = query + ")"; } try { stm.executeQuery(query); } catch (Exception e) { //e.printStackTrace(); } //interface pour connaitre le type de géométrie (impossible à savoir interactivement) if (flagGeomFeature){ GUISelectionGeometrie sg = new GUISelectionGeometrie(); switch (sg.getTypeGeometrie()) { case 0: stm.executeQuery("SELECT AddGeometrycolumn ('','"+nomTable+"','geom','-1','MULTIPOINT',"+sg.getDimensionGeometrie()+")"); try { stm.executeQuery("ALTER TABLE "+nomTable+" DROP CONSTRAINT enforce_geotype_geom"); } catch (Exception e) { } stm.executeQuery("ALTER TABLE "+nomTable+" ADD CONSTRAINT enforce_geotype_geom CHECK (geometrytype(geom) = 'POINT'::text OR geometrytype(geom) = 'MULTIPOINT'::text OR isempty(geom) OR geom IS NULL)"); break; case 1: stm.executeQuery("SELECT AddGeometrycolumn ('','"+nomTable+"','geom','-1','MULTILINESTRING',"+sg.getDimensionGeometrie()+")"); try { stm.executeQuery("ALTER TABLE "+nomTable+" DROP CONSTRAINT enforce_geotype_geom"); } catch (Exception e) { } stm.executeQuery("ALTER TABLE "+nomTable+" ADD CONSTRAINT enforce_geotype_geom CHECK (geometrytype(geom) = 'LINESTRING'::text OR geometrytype(geom) = 'MULTILINESTRING'::text OR isempty(geom) OR geom IS NULL)"); break; case 2: stm.executeQuery("SELECT AddGeometrycolumn ('','"+nomTable+"','geom','-1','MULTIPOLYGON',"+sg.getDimensionGeometrie()+")"); try { stm.executeQuery("ALTER TABLE "+nomTable+" DROP CONSTRAINT enforce_geotype_geom"); } catch (Exception e) { } stm.executeQuery("ALTER TABLE "+nomTable+" ADD CONSTRAINT enforce_geotype_geom CHECK (geometrytype(geom) = 'POLYGON'::text OR geometrytype(geom) = 'MULTIPOLYGON'::text OR isempty(geom) OR geom IS NULL)"); break; case 3: stm.executeQuery("SELECT AddGeometrycolumn ('','"+nomTable+"','geom','-1','GEOMETRYCOLLECTION',"+sg.getDimensionGeometrie()+")"); stm.executeQuery("ALTER TABLE "+nomTable+" DROP CONSTRAINT enforce_geotype_geom"); break; default: break; } } stm.close(); } catch (Exception e) { //e.printStackTrace(); } } /////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////// private static String javaType2OracleType(String javaType) throws Exception { if (javaType.compareToIgnoreCase("java.lang.String")==0)return "VARCHAR(255)"; else if (javaType.compareToIgnoreCase("double")==0)return "NUMBER"; else if (javaType.compareToIgnoreCase("int")==0)return "INTEGER"; else if (javaType.compareToIgnoreCase("boolean")==0)return "CHAR(1)"; else if (javaType.compareToIgnoreCase("fr.ign.cogit.geoxygene.spatial.geomroot.GM_Object") == 0) return "MDSYS.SDO_GEOMETRY"; else if (javaType.compareToIgnoreCase("fr.ign.cogit.geoxygene.spatial.geomprim.GM_Point") == 0) return "MDSYS.SDO_GEOMETRY"; else if (javaType.compareToIgnoreCase("fr.ign.cogit.geoxygene.spatial.coordgeom.GM_LineString") == 0) return "MDSYS.SDO_GEOMETRY"; else if (javaType.compareToIgnoreCase("fr.ign.cogit.geoxygene.spatial.coordgeom.GM_Polygon")==0)return "MDSYS.SDO_GEOMETRY"; else throw new Exception("type non reconnu : "+javaType); } /////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////// private static String javaType2PostgisType(String javaType) throws Exception { if (javaType.endsWith("GM_LineString"))return "ligne"; else if (javaType.endsWith("String"))return "VARCHAR"; else if (javaType.endsWith("boolean"))return "boolean"; else if (javaType.endsWith("double"))return "double precision"; else if (javaType.endsWith("GM_Point"))return "point"; else if (javaType.endsWith("int"))return "INTEGER"; else if (javaType.endsWith("GM_Polygon"))return "surface"; else if (javaType.endsWith("List")) return "liste"; else if (javaType.compareToIgnoreCase("fr.ign.cogit.geoxygene.spatial.geomroot.GM_Object") == 0) return "GEOMETRY"; else throw new Exception("type non reconnu : "+javaType); } } |
|
From: Eric G. <eg...@us...> - 2008-01-31 16:31:47
|
Update of /cvsroot/oxygene-project/geoxygene/src/fr/ign/cogit/geoxygene/util/loader/gui In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv14961/src/fr/ign/cogit/geoxygene/util/loader/gui Added Files: GUIConfigSqlOJBXML.java GUISelectionGeometrie.java Log Message: Adding a generator of DBMS tables and XML mapping files from Java classes. --- NEW FILE: GUIConfigSqlOJBXML.java --- /* * This file is part of the GeOxygene project source files. * * GeOxygene aims at providing an open framework which implements OGC/ISO specifications for * the development and deployment of geographic (GIS) applications. It is a open source * contribution of the COGIT laboratory at the Institut Géographique National (the French * National Mapping Agency). * * See: http://oxygene-project.sourceforge.net * * Copyright (C) 2005 Institut Géographique National * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with * this library (see file LICENSE if present); if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ package fr.ign.cogit.geoxygene.util.loader.gui; import java.awt.Container; import java.awt.FlowLayout; import java.awt.Frame; import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.File; import javax.swing.JButton; import javax.swing.JDialog; import javax.swing.JFileChooser; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JTextField; import javax.swing.filechooser.FileFilter; /** * Choix des parametres pour la generation de tables dans le SGBD et de fichiers de mapping OJB. * Ces parametres sont : repertoires d'accueil (XML), nom du package,nom des fichiers de mapping. * * @author Eric Grosso - IGN / Laboratoire COGIT * @version 1.0 * */ public class GUIConfigSqlOJBXML extends JFrame { private static final String FRAME_TITLE = "GeOxygene Configuration SQL / mapping OJB"; private String javaFilePath; private String tableName; private String mappingDirectory; private String mappingFileName; private static String javaFilePathText = "Classe Java à traduire : "; private static String tableNameText = "Nom de la table : "; private static String mappingDirectoryText = "Repertoire d'accueil du fichier de mapping : "; private static String mappingFileNameText = "Nom du fichier de mapping : "; private String[] selectedValues = new String[4]; public GUIConfigSqlOJBXML (String GeoxygeneDirectory, String MappingDirectory, String MappingFileName) { javaFilePath = GeoxygeneDirectory; mappingDirectory = MappingDirectory; mappingFileName = MappingFileName; } public String[] showDialog() { final JDialog dialog = createDialog(this); dialog.setVisible(true); dialog.dispose(); return selectedValues; } private void getSelectedValues() { selectedValues[0] = javaFilePath; selectedValues[1] = mappingDirectory; selectedValues[2] = tableName; selectedValues[3] = mappingFileName; } private JDialog createDialog (Frame parent) { String title = FRAME_TITLE; final JDialog dialog = new JDialog(parent, title, true); Container contentPane = dialog.getContentPane(); contentPane.setLayout(new GridLayout(5,2)); JLabel javaFilePathLabel = new JLabel (javaFilePathText); JPanel javaFilePathPanel = new JPanel(new FlowLayout()); final JTextField javaFilePathTextField = new JTextField (javaFilePath); JButton javaFilePathChoiceButton = new JButton("..."); javaFilePathChoiceButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { javaFilePathTextField.setText(GUIConfigSqlOJBXML.selectRepertoire(javaFilePath)); } }); javaFilePathPanel.add(javaFilePathTextField); javaFilePathPanel.add(javaFilePathChoiceButton); contentPane.add(javaFilePathLabel); contentPane.add(javaFilePathPanel); JLabel tableNameLabel = new JLabel (tableNameText); final JTextField tableNameTextField = new JTextField (tableName); contentPane.add(tableNameLabel); contentPane.add(tableNameTextField); JLabel mappingDirectoryLabel = new JLabel (mappingDirectoryText); JPanel mappingDirectoryPanel = new JPanel(new FlowLayout()); final JTextField mappingDirectoryTextField = new JTextField (mappingDirectory); JButton mappingDirectoryChoiceButton = new JButton("..."); mappingDirectoryChoiceButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { mappingDirectoryTextField.setText(GUIConfigSqlOJBXML.selectRepertoire(mappingDirectory)); } }); mappingDirectoryPanel.add(mappingDirectoryTextField); mappingDirectoryPanel.add(mappingDirectoryChoiceButton); contentPane.add(mappingDirectoryLabel); contentPane.add(mappingDirectoryPanel); JLabel mappingFileNameLabel = new JLabel (mappingFileNameText); final JTextField mappingFileNameTextField = new JTextField (mappingFileName); contentPane.add(mappingFileNameLabel); contentPane.add(mappingFileNameTextField); JPanel controlPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 20, 10)); JButton okButton = new JButton("Ok"); okButton.setActionCommand("Ok"); okButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { tableName = tableNameTextField.getText(); javaFilePath = javaFilePathTextField.getText().replace('/','.'); javaFilePath = javaFilePath.replace('\\','.'); mappingDirectory = mappingDirectoryTextField.getText(); mappingFileName = mappingFileNameTextField.getText(); getSelectedValues(); dialog.dispose(); } }); JButton cancelButton = new JButton("Annuler"); cancelButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { selectedValues[0] = null; //file java path dialog.dispose(); } }); controlPanel.add(okButton); controlPanel.add(cancelButton); contentPane.add(controlPanel); dialog.pack(); dialog.setLocationRelativeTo(parent); return dialog; } /////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////// private static String selectRepertoire(String javaFilePath){ JFileChooser fileChooser = new JFileChooser(javaFilePath); fileChooser.setFileFilter(new FileFilter() { public boolean accept(File f) { return f.getName().toLowerCase().endsWith(".java")||f.isDirectory(); } public String getDescription() { return "Java Files (*.java)"; } }); int result = fileChooser.showOpenDialog(null); String pathFileJava = ""; if (result == JFileChooser.APPROVE_OPTION) { File f = fileChooser.getSelectedFile(); String absolutePathFileJava = f.getPath(); pathFileJava = absolutePathFileJava.substring(javaFilePath.toString().length()+1); System.out.println(pathFileJava); } if (pathFileJava == null || pathFileJava.equals("") || !pathFileJava.endsWith(".java")){ JOptionPane.showMessageDialog(null,"Le type de votre fichier n'est pas valide (.java)","Fichier de type incorrect", JOptionPane.WARNING_MESSAGE); pathFileJava = ""; } else { if (pathFileJava.startsWith("src")) pathFileJava = pathFileJava.substring(4,pathFileJava.length()-5); else if (pathFileJava.startsWith("data")) pathFileJava = pathFileJava.substring(5,pathFileJava.length()-5); } return pathFileJava; } } --- NEW FILE: GUISelectionGeometrie.java --- package fr.ign.cogit.geoxygene.util.loader.gui; import java.awt.Color; import java.awt.Container; import java.awt.Dialog; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import javax.swing.BorderFactory; import javax.swing.Box; import javax.swing.BoxLayout; import javax.swing.ButtonGroup; import javax.swing.JButton; import javax.swing.JCheckBox; import javax.swing.JDialog; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JScrollPane; /** * Choix des paramètres géométriques lors de la création de tables postgis * et du fichier de mapping à partir d'une classe java (le problème ne se * pose pas avec Oracle) * * @author Eric Grosso - IGN / Laboratoire COGIT * @version 1.0 */ public class GUISelectionGeometrie extends JDialog { private static Dialog frame = new JDialog(); private final GUISelectionGeometrie selectionGeometrie; private Color bluegray = new Color(197,197,232); private JPanel panneauType, panneauDimension, jPanelBoutton; private JScrollPane scrollChargement, scrollStockage; private Box boxType, boxDimension; private int selectionType = 0, selectionDimension = 0; private JButton jButtonOK; private Box boxe = Box.createVerticalBox(); private static String[] stringsChoixType = new String[4]; private static String[] stringsChoixDimension = new String[2]; private String titreType=""; private String titreDimension=""; private int typeGeometrie; public int getTypeGeometrie() {return typeGeometrie;} public void setTypeGeometrie(int typeGeometrie) {this.typeGeometrie = typeGeometrie;} private int dimensionGeometrie; public int getDimensionGeometrie() {return dimensionGeometrie;} public void setDimensionGeometrie(int dimensionGeometrie) {this.dimensionGeometrie = dimensionGeometrie;} /** Constructeur de l'interface **/ public GUISelectionGeometrie(){ super(frame,"Choix de la géométrie",true); selectionGeometrie = this; setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); setPreferredSize(new Dimension(430,270)); setSize(430,270); setResizable(false); setBackground(Color.white); setAlwaysOnTop(true); Dimension tailleEcran = Toolkit.getDefaultToolkit().getScreenSize(); this.setLocation((tailleEcran.width-this.getWidth())/2, (tailleEcran.height-this.getHeight())/2); Container contentPane = this.getContentPane(); contentPane.setLayout(new BoxLayout(contentPane,BoxLayout.Y_AXIS)); //initialisation des différents composants et variables stringsChoixType[0]="Point"; stringsChoixType[1]="LineString"; stringsChoixType[2]="Polygon"; stringsChoixType[3]="Geometry collection"; stringsChoixDimension[0]="2D"; stringsChoixDimension[1]="3D"; titreType = "Quel est le type de votre géométrie ?"; titreDimension = "Quel est la dimension de votre géométrie ?"; initBoxTypeGeom(); initBoxDimensionGeom(); initJPanelType(true); initJPanelDimension(true); initJPanelBoutton(); boxe.setBackground(Color.white); boxe.add(panneauType); boxe.add(panneauDimension); boxe.add(jPanelBoutton); //Association des panneaux au conteneur this.setContentPane(boxe); //Visualisation this.pack(); this.setVisible(true); } /**initialise le panel principal**/ private void initJPanelType(boolean flag) { panneauType = new JPanel(new java.awt.BorderLayout()); panneauType.setPreferredSize(new Dimension(820,300)); panneauType.setMaximumSize(new Dimension(820,300)); panneauType.setBackground(Color.white); panneauType.setBorder(BorderFactory.createTitledBorder( BorderFactory.createEtchedBorder(bluegray, bluegray),titreType)); panneauType.add(boxType); } /**initialise le panel principal**/ private void initJPanelDimension(boolean flag) { panneauDimension = new JPanel(new java.awt.BorderLayout()); panneauDimension.setPreferredSize(new Dimension(820,300)); panneauDimension.setMaximumSize(new Dimension(820,300)); panneauDimension.setBackground(Color.white); panneauDimension.setBorder(BorderFactory.createTitledBorder( BorderFactory.createEtchedBorder(bluegray, bluegray),titreDimension)); panneauDimension.add(boxDimension); } private void initBoxTypeGeom() { boxType = Box.createVerticalBox(); ButtonGroup choix = new ButtonGroup(); JCheckBox checkBox; final int t = stringsChoixType.length; for (int i=0;i<t;i++){ checkBox = new JCheckBox((String)stringsChoixType[i]); checkBox.setBackground(Color.white); if(i==0){ checkBox.setSelected(true); setTypeGeometrie(0); } checkBox.addItemListener(new ItemListener(){ public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == 1){ Object source = e.getItemSelectable(); for (int i=0;i<t;i++){ if (((JCheckBox)source).getText().equals(stringsChoixType[i])){ setTypeGeometrie(i); } } } } }); choix.add(checkBox); boxType.add(checkBox); } } private void initBoxDimensionGeom() { boxDimension = Box.createVerticalBox(); ButtonGroup choix = new ButtonGroup(); JCheckBox checkBox; final int t = stringsChoixDimension.length; for (int i=0;i<t;i++){ checkBox = new JCheckBox((String)stringsChoixDimension[i]); checkBox.setBackground(Color.white); if(i==0){ checkBox.setSelected(true); setDimensionGeometrie(2); } checkBox.addItemListener(new ItemListener(){ public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == 1){ Object source = e.getItemSelectable(); for (int i=0;i<t;i++){ if (((JCheckBox)source).getText().equals(stringsChoixDimension[i])){ setDimensionGeometrie(i+2); } } } } }); choix.add(checkBox); boxDimension.add(checkBox); } } /** initialisation de jPanelBoutton*/ private void initJPanelBoutton() { initJButtonOK(); jPanelBoutton = new JPanel(); jPanelBoutton.setLayout(new FlowLayout()); jPanelBoutton.add(jButtonOK); jPanelBoutton.setBackground(Color.white); } /** This method initializes jButtonChargement */ private void initJButtonOK() { jButtonOK = new JButton(); jButtonOK.setPreferredSize(new java.awt.Dimension(80,30)); jButtonOK.setSize(new java.awt.Dimension(80,30)); jButtonOK.setText("Ok"); jButtonOK.setVisible(true); jButtonOK.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { selectionGeometrie.dispose(); } }); } } |
|
From: Eric G. <eg...@us...> - 2008-01-31 16:31:47
|
Update of /cvsroot/oxygene-project/geoxygene/src/fr/ign/cogit/geoxygene/util/console In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv14961/src/fr/ign/cogit/geoxygene/util/console Added Files: JavaToSql.java Log Message: Adding a generator of DBMS tables and XML mapping files from Java classes. --- NEW FILE: JavaToSql.java --- /* * This file is part of the GeOxygene project source files. * * GeOxygene aims at providing an open framework which implements OGC/ISO specifications for * the development and deployment of geographic (GIS) applications. It is a open source * contribution of the COGIT laboratory at the Institut Géographique National (the French * National Mapping Agency). * * See: http://oxygene-project.sourceforge.net * * Copyright (C) 2005 Institut Géographique National * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with * this library (see file LICENSE if present); if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ package fr.ign.cogit.geoxygene.util.console; import java.io.File; import javax.swing.JPanel; import org.apache.ojb.broker.util.configuration.impl.OjbConfiguration; import fr.ign.cogit.geoxygene.datatools.Geodatabase; import fr.ign.cogit.geoxygene.datatools.ojb.GeodatabaseOjbFactory; import fr.ign.cogit.geoxygene.util.loader.SQLXMLGenerator; import fr.ign.cogit.geoxygene.util.loader.gui.GUIConfigSqlOJBXML; /** * permet à partir d'une classe java choisie par l'utilisateur de générer automatiquement * la table correspondante dans le sgbd (postgis ou oracle) et le fichier de mapping * correspondant * * @author Eric Grosso - IGN / Laboratoire COGIT * @version 1.0 * */ class JavaToSql extends JPanel { // nom du fichier de mapping private static String mappingFileName = "repository_geo.xml"; // repertoire de la racine du projet geoxygene private static String geoxygeneDirectory = ""; // repertoire d'accueil des fichiers de mapping private static String geOxygeneMapping ; protected static void action() { System.out.println("Generation de tables dans le SGBD et du mapping XML correspondant ... "); try { // initialisation Geodatabase data = GeodatabaseOjbFactory.newInstance(); // determine valeur par defaut de la racine du projet geoxygene OjbConfiguration config = new OjbConfiguration(); File fileMapping = new File(config.getRepositoryFilename()); try{ File tryFileData = new File (fileMapping.getParentFile().getParentFile().getParentFile(),"data"); if (tryFileData.exists()) { geoxygeneDirectory = tryFileData.getParentFile().getPath(); } else { tryFileData = new File (fileMapping.getParentFile().getParentFile().getParentFile().getParentFile(),"data"); if (tryFileData.exists()) { geoxygeneDirectory = tryFileData.getParentFile().getPath(); } } if (!tryFileData.exists()){ tryFileData = new File (fileMapping.getParentFile().getParentFile().getParentFile().getParentFile().getParentFile(),"data"); if (tryFileData.exists()) { geoxygeneDirectory = tryFileData.getParentFile().getPath(); } } } catch (Exception e) { } // determine valeur par defaut de geoxygeneMapping geOxygeneMapping = fileMapping.getParentFile().getPath(); GUIConfigSqlOJBXML configuration = new GUIConfigSqlOJBXML(geoxygeneDirectory,geOxygeneMapping,mappingFileName); String[] selectedValues = configuration.showDialog(); String javaFilePath = selectedValues[0]; String mappingDirectory = selectedValues[1]; String tableName = selectedValues[2]; mappingFileName = selectedValues[3]; if (javaFilePath == null || mappingDirectory == null || tableName == null || mappingFileName == null) return; SQLXMLGenerator generator = new SQLXMLGenerator(data,javaFilePath,mappingDirectory,tableName,mappingFileName); generator.writeAll(); } catch (Exception e) { e.printStackTrace(); } } } |
|
From: Eric G. <eg...@us...> - 2008-01-31 16:29:50
|
Update of /cvsroot/oxygene-project/geoxygene/src/fr/ign/cogit/geoxygene/contrib/graphe In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv14119/src/fr/ign/cogit/geoxygene/contrib/graphe Added Files: ARM.java Log Message: Adding a simple method to create minimal spanning trees. --- NEW FILE: ARM.java --- /* * This file is part of the GeOxygene project source files. * * GeOxygene aims at providing an open framework which implements OGC/ISO specifications for * the development and deployment of geographic (GIS) applications. It is a open source * contribution of the COGIT laboratory at the Institut Géographique National (the French * National Mapping Agency). * * See: http://oxygene-project.sourceforge.net * * Copyright (C) 2005 Institut Géographique National * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with * this library (see file LICENSE if present); if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ package fr.ign.cogit.geoxygene.contrib.graphe; import java.util.Iterator; import fr.ign.cogit.geoxygene.contrib.cartetopo.Arc; import fr.ign.cogit.geoxygene.contrib.cartetopo.CarteTopo; import fr.ign.cogit.geoxygene.contrib.cartetopo.Noeud; import fr.ign.cogit.geoxygene.feature.FT_Feature; import fr.ign.cogit.geoxygene.feature.FT_FeatureCollection; import fr.ign.cogit.geoxygene.spatial.coordgeom.GM_LineString; import fr.ign.cogit.geoxygene.spatial.geomprim.GM_Point; /** * Méthodes statiques pour la création d'un ARM (Arbre de Recouvrement Minimal, * Minimal Spanning Tree) * * @author Mustiere - IGN / Laboratoire COGIT * version 1.0 * */ public class ARM { /** Création d'un ARM à partir d'un ensemble de points * * Cette méthode est très brutale: adaptée pour quelques points seulement. * On fait des calculs de distance beaucoup trop souvent. * L'ARM étant un sous-graphe de Delaunay, cela peut être grandement optimisé en * effectuant un Delaunay d'abord. * * @param points * Liste d'objets en entrée: ils doivent avoir une géométrie de type point * * @return * Une carte topo contenant un noeud pour chaque point, * et un arc pour chaque tronçon du ARM * ("correspondant" est instancié pour relier les noeuds et les points). */ public static CarteTopo creeARM(FT_FeatureCollection points) { Noeud noeud, nouveauNoeud; Arc arc; FT_Feature point; double dist, distMin; CarteTopo arm = new CarteTopo("AMR"); int i,j,imin=0,jmin=0; GM_LineString trait; FT_FeatureCollection pointsCopie = new FT_FeatureCollection(points); if (pointsCopie.size() == 0) return null; // Amorce, on prend un point au hasard: le premier point = pointsCopie.get(0); if ( ! (point.getGeom() instanceof GM_Point) ) { System.out.println("Un des objets en entrée n'est pas un point, renvoie Null"); return null; } pointsCopie.remove(point); nouveauNoeud= (Noeud)arm.getPopNoeuds().nouvelElement(); nouveauNoeud.setGeom(point.getGeom()); nouveauNoeud.addCorrespondant(point); // Ajout des points un à un while(true) { if (pointsCopie.size() == 0) break; //ça y est, on a relié tous les points //on cherche le couple noeud-point le pus proche (TRES bourrin) distMin = Double.MAX_VALUE; for(i=0;i<pointsCopie.size();i++) { point = (FT_Feature) pointsCopie.get(i); if ( ! (point.getGeom() instanceof GM_Point) ) { System.out.println("Un des objets en entrée n'est pas un point, renvoie Null"); return null; } for(j=0;j<arm.getPopNoeuds().size();j++) { noeud = (Noeud)arm.getPopNoeuds().get(j); dist = noeud.getGeom().distance(point.getGeom()); if (dist < distMin ) { distMin=dist; imin = i; jmin = j; } } } point = (FT_Feature) pointsCopie.get(imin); noeud = (Noeud)arm.getPopNoeuds().get(jmin); // on remplit l'ARM pointsCopie.remove(point); nouveauNoeud = (Noeud)arm.getPopNoeuds().nouvelElement(); nouveauNoeud.setGeom(point.getGeom()); nouveauNoeud.addCorrespondant(point); arc = (Arc)arm.getPopArcs().nouvelElement(); arc.setNoeudIni(noeud); arc.setNoeudFin(nouveauNoeud); trait = new GM_LineString(); trait.addControlPoint(arc.getNoeudIni().getGeometrie().getPosition()); trait.addControlPoint(arc.getNoeudFin().getGeometrie().getPosition()); arc.setGeometrie(trait); } return arm; } /** Methode pour créer un ARM à partir des centroides d'un ensemble d'objets. * * @param objets * Liste d'objets en entrée: ils doivent avoir une géométrie quelconque * * @return * Une carte topo contenant un noeud pour chaque point, * et un arc pour chaque tronçon du ARM * ("correspondant" est instancié pour relier les noeuds et les points). * */ public static CarteTopo creeARMsurObjetsQuelconques(FT_FeatureCollection objets) { FT_FeatureCollection points=new FT_FeatureCollection(); Iterator itObjets = objets.getElements().iterator(); while (itObjets.hasNext()) { FT_Feature objet = (FT_Feature) itObjets.next(); if (objet.getGeom() == null) { System.out.println("Un des objets en entrée n'a pas de géométrie, renvoie Null"); return null; } Noeud objet2 = new Noeud(); objet2.setGeom(objet.getGeom().centroid()); points.add(objet2); } return creeARM(points); } } |
|
From: Eric G. <eg...@us...> - 2008-01-31 16:29:43
|
Update of /cvsroot/oxygene-project/geoxygene/src/fr/ign/cogit/geoxygene/contrib/graphe In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv14109/src/fr/ign/cogit/geoxygene/contrib/graphe Log Message: Directory /cvsroot/oxygene-project/geoxygene/src/fr/ign/cogit/geoxygene/contrib/graphe added to the repository |
|
From: Eric G. <eg...@us...> - 2008-01-31 16:28:59
|
Update of /cvsroot/oxygene-project/geoxygene/src/fr/ign/cogit/geoxygene/contrib/appariement/surfaces In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv13713/src/fr/ign/cogit/geoxygene/contrib/appariement/surfaces Added Files: AppariementSurfaces.java ParametresAppSurfaces.java Log Message: adding a data matching tool --- NEW FILE: ParametresAppSurfaces.java --- /* * This file is part of the GeOxygene project source files. * * GeOxygene aims at providing an open framework which implements OGC/ISO specifications for * the development and deployment of geographic (GIS) applications. It is a open source * contribution of the COGIT laboratory at the Institut Géographique National (the French * National Mapping Agency). * * See: http://oxygene-project.sourceforge.net * * Copyright (C) 2005 Institut Géographique National * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with * this library (see file LICENSE if present); if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ package fr.ign.cogit.geoxygene.contrib.appariement.surfaces; /** * Paramètres de l'appariement de surfaces. * * @author Mustiere - IGN / Laboratoire COGIT * @version 1.0 * */ public class ParametresAppSurfaces implements Cloneable { /** 2 surfaces, pour être appariées, doivent s'intersecter et l'intersection * doit faire au moins la taille fixée par ce seuil. A l'extrême, ce paramètre peut être nul. * Valeur par défaut : 1 m2 */ public double surface_min_intersection = 1; /** 2 surfaces, pour être appariées, doivent s'intersecter et l'intersection * doit faire au moins la taille d'une des surfaces multipliée * par ce paramètre. A l'extrême, ce paramètre peut être nul. * Valeur par défaut : 0.2 */ public double pourcentage_min_intersection = 0.2; /** Si 2 surfaces s'intersectent d'au moins la taille d'une des surfaces multipliée * par ce paramètre, on garde ce lien à coup sûr. * Valeur par défaut : 0.8 */ public double pourcentage_intersection_sur = 0.8; /** Mesure de ressemblance entre surfaces (ou groupes de surfaces) * à optimiser lors du choix final de l'appariement. * 2 possibilités : * TRUE : minimise la distance surfacique * (conseillé par Atef en cas de données avec des niveaux de détail similaires). * FALSE : minimise la somme Exactitude + Complétude. * * Remarque : * - Complétude = surf(Sref inter Scomp) / Sref * - Exactitude = surf(Sref inter Scomp) / Scomp. * */ public boolean minimiseDistanceSurfacique = true; /** Si on utilise le critère de Distance Surfacique * (cf. parametre minimiseDistanceSurfacique): * On n'accepte que les appariements finaux pour lesquels * distance surfacique est inférieure à ce seuil. */ public double distSurfMaxFinal = 0.6; /** Si on utilise le critère d'exactitude/complétude : * (cf. parametre minimiseDistanceSurfacique): * On n'accepte que les appariements finaux pour lesquels la somme * exactitude + complétude est supérieur à ce seuil. */ public double completudeExactitudeMinFinal = 0.3; /** Paramètre indiquant si on souhaite faire un regroupement optimal * des liens */ public boolean regroupementOptimal = true; /** Paramètre indiquant si on souhaite faire un filtrage final * des liens sur des critères de distance surfacique ou de complétude */ public boolean filtrageFinal = true; /** Paramètre indiquant si on souhaite faire un raffinement * en essayant d'aparier les petites surfaces non appariées */ public boolean ajoutPetitesSurfaces = false; /** On ne rajout que les petites surface de taille inférieure à * ce paramètre * taille de la surface à laquelle on le rajoute */ public double seuilPourcentageTaillePetitesSurfaces = 0.1; /** Paramètre indiquant si les liens fianux sont redus persistant ou non. * Par défaut: false */ public boolean persistant = false; /** Uniquement pour des problèmes de robustesse du code si les surfaces * en entrée ne sont pas propres (existence de mini-boucles). * Si JTS plante à cuase de ces surfaces bizarres, celles-ci seront * filtrées avec DouglasPeucker. * On essaiera plusieurs forces de filtrage: * entre resolutionMin et resolutionMax. */ public double resolutionMin = 1; /** Uniquement pour des problèmes de robustesse du code si les surfaces * en entrée ne sont pas propres (existence de mini-boucles). * Si JTS plante à cuase de ces surfaces bizarres, celles-ci seront * filtrées avec DouglasPeucker. * On essaiera plusieurs forces de filtrage: * entre resolutionMin et resolutionMax. */ public double resolutionMax = 11; /** Clone l'objet. */ public Object clone() { try { return super.clone(); } catch (Exception e) { e.printStackTrace(); return null; } } } --- NEW FILE: AppariementSurfaces.java --- /* * This file is part of the GeOxygene project source files. * * GeOxygene aims at providing an open framework which implements OGC/ISO specifications for * the development and deployment of geographic (GIS) applications. It is a open source * contribution of the COGIT laboratory at the Institut Géographique National (the French * National Mapping Agency). * * See: http://oxygene-project.sourceforge.net * * Copyright (C) 2005 Institut Géographique National * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with * this library (see file LICENSE if present); if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ package fr.ign.cogit.geoxygene.contrib.appariement.surfaces; import java.sql.Time; import java.util.ArrayList; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Set; import fr.ign.cogit.geoxygene.contrib.appariement.EnsembleDeLiens; import fr.ign.cogit.geoxygene.contrib.appariement.Lien; import fr.ign.cogit.geoxygene.contrib.cartetopo.Arc; import fr.ign.cogit.geoxygene.contrib.cartetopo.CarteTopo; import fr.ign.cogit.geoxygene.contrib.cartetopo.Groupe; import fr.ign.cogit.geoxygene.contrib.cartetopo.Noeud; import fr.ign.cogit.geoxygene.contrib.geometrie.Distances; import fr.ign.cogit.geoxygene.contrib.geometrie.Operateurs; import fr.ign.cogit.geoxygene.contrib.graphe.ARM; import fr.ign.cogit.geoxygene.contrib.operateurs.Ensemble; import fr.ign.cogit.geoxygene.feature.DataSet; import fr.ign.cogit.geoxygene.feature.FT_Feature; import fr.ign.cogit.geoxygene.feature.FT_FeatureCollection; import fr.ign.cogit.geoxygene.spatial.coordgeom.GM_LineString; import fr.ign.cogit.geoxygene.spatial.geomaggr.GM_Aggregate; import fr.ign.cogit.geoxygene.spatial.geomaggr.GM_MultiSurface; import fr.ign.cogit.geoxygene.spatial.geomprim.GM_Point; import fr.ign.cogit.geoxygene.spatial.geomprim.GM_Surface; import fr.ign.cogit.geoxygene.spatial.geomroot.GM_Object; import fr.ign.cogit.geoxygene.util.index.Tiling; /** * Appariement de surfaces. * Processus défini dans la thèse de Atef Bel Hadj Ali (2001), * et resume dans le rapport [Mustiere 2002]: * ("Description des processus d'appariement mis en oeuvre au COGIT",SR/2002.0072, chap.6). * * @author Braun & Mustière - Laboratoire COGIT * version 1.0 * */ public abstract class AppariementSurfaces { /** * Appariement entre deux ensembles de surfaces. * Processus inspiré de celui défini dans la thèse de Atef Bel Hadj Ali (2001), * et resumé dans le rapport de Seb * ("Description des processus d'appariement mise en oeuvre au COGIT",SR/2002.0072, chap.6). * * NB 1 : LE CAS DES LIENS N-M N'EST PAS VRAIMENT SATIFAISANT * ET DOIT ENCORE ETRE REVU (reflechir aux mesures). Néanmoins... * le processus a été amélioré pour mieux raffiner le traitement des liens n-m : * un lien n-m issu du regroupement des liens 1-1 peut être redécoupé en * plusieurs liens n'-m', alors que le processus d'Atef ne semble permettre * que de simplifier ce groupe n-m en UN seul groupe n'-m' (n'<=n, m'<=m) * * NB 2 :Les liens finaux sont qualifiés (evaluation) par la mesure de * distance surfacique entre groupes de surfaces. * * NB 3 : si la population de référence n'est pas indexée, elle le sera pendant le calcul * * NB 4 : l'appariement est symétrique (si ref et comp sont échangés, les résultats sont identiques) * * @param popRef : population des objets de référence. * Ces objets doivent avoir une géométrie "geom" de type GM_Polygon * @param popComp : population des objets de comparaison * Ces objets doivent avoir une géométrie "geom" de type GM_Polygon * @param param : paramètres de l'appariement * * * @return : liens d'appariement calculés. Ces liens peuvent être de type n-m. */ public static EnsembleDeLiens appariementSurfaces(FT_FeatureCollection popRef, FT_FeatureCollection popComp, ParametresAppSurfaces param) { EnsembleDeLiens liensPreApp, liensRegroupes, liensFiltres; // indexation au besoin des surfaces de comparaison if ( ! popComp.hasSpatialIndex() ) { System.out.println("-- Indexation spatiale des surfaces de comparaison "+new Time(System.currentTimeMillis())); popComp.initSpatialIndex(Tiling.class, true); } // pré-appariement selon un test sur la surface de l'intersection // entre les surfaces de référence et de comparaison System.out.println("-- Pre-appariement sur des critères d'intersection "+new Time(System.currentTimeMillis())); liensPreApp = preAppariementSurfaces(popRef, popComp, param); // appariement par recherche des regroupements optimaux if ( param.regroupementOptimal ) { System.out.println("-- Appariement par recherche des regroupements optimaux : "+new Time(System.currentTimeMillis())); liensRegroupes = rechercheRegroupementsOptimaux(liensPreApp, popRef, popComp, param); } else liensRegroupes = liensPreApp; // recollage des petites surfaces non encore appariées if ( param.ajoutPetitesSurfaces ) { System.out.println("-- Recollage des petites surfaces non encore appariées : "+new Time(System.currentTimeMillis())); ajoutPetitesSurfaces(liensRegroupes, popRef, popComp, param); } // filtrage final pour n'accepter que les appariements suffisament bons if ( param.filtrageFinal) { System.out.println("-- Filtrage final : "+new Time(System.currentTimeMillis())); liensFiltres = filtreLiens(liensRegroupes, param); } else liensFiltres = liensRegroupes; System.out.println("-- Création de la géométrie des liens : "+new Time(System.currentTimeMillis())); creeGeometrieDesLiens(liensFiltres, param.persistant); System.out.println("Fin du traitement"); return liensFiltres; } /** 2 surfaces sont pré-appariées si elles respectent le "test d'association" * défini par Atef Bel Hadj Ali (2001). C'est-à-dire si : * 1/ l'intersection des surfaces a une taille supérieure au seuil "surface_min" * ET * 2/ l'intersection fait au moins la taille d'une des surfaces multipliée * par le paramètre "pourcentage_min". * * NB 1 : Par construction : chaque lien pointe vers UN SEUL objet de la population * de référence et vers UN SEUL objet de la population de comparaison. * NB 2 : Aucune géométrie n'est instanciée pour les liens créés. * NB 3 : l'appariement est symétrique. * NB 4 : la population de comparaison est indexée si elle ne l'était pas avant * * @param popRef : population des objets de référence. * @param popComp : population des objets de comparaison. * @param param : paramètres de l'appariement. * * @return : liens de pré-appariement calculés. */ public static EnsembleDeLiens preAppariementSurfaces(FT_FeatureCollection popRef, FT_FeatureCollection popComp, ParametresAppSurfaces param) { EnsembleDeLiens preAppLiens = new EnsembleDeLiens(); Lien lien ; FT_FeatureCollection candidatComp; FT_Feature featureRef, featureComp; GM_Object geomRef, geomComp; double surfaceIntersection, pourcentageRecouvrement; if ( ! popComp.hasSpatialIndex() ) { System.out.println("Indexation spatiale de la poplation des surfaces de comparaison"); popComp.initSpatialIndex(Tiling.class, true); } popRef.initIterator(); while (popRef.hasNext()) { featureRef = popRef.next(); geomRef = (GM_Object)featureRef.getGeom(); if ( !(geomRef instanceof GM_Surface)) { System.out.println("Objet de la population de référence sans géométrie surfacique COGITID = "+featureRef.getId()); continue; } // Test d'association sur tous les objets comp intersectant l'objet ref candidatComp = popComp.select(geomRef); candidatComp.initIterator(); while (candidatComp.hasNext()) { featureComp = candidatComp.next(); geomComp = (GM_Object) featureComp.getGeom(); if ( !(geomComp instanceof GM_Surface)) { System.out.println("Objet de la population de comparaison sans géométrie surfacique COGITID = "+featureComp.getId()); continue; } // création éventuelle d'un nouveau lien de pré-appariement GM_Object inter = Operateurs.intersectionRobuste(geomRef,geomComp,param.resolutionMin,param.resolutionMax); if (inter == null) continue; // si plantage aux calculs d'intersection surfaceIntersection = inter.area(); if (surfaceIntersection<=param.surface_min_intersection) continue; pourcentageRecouvrement= Math.max(surfaceIntersection/geomRef.area(), surfaceIntersection/geomComp.area()); if ( pourcentageRecouvrement<param.pourcentage_min_intersection) continue; //intersection pas suffisante lien = (Lien)preAppLiens.nouvelElement(); lien.addObjetRef(featureRef); lien.addObjetComp(featureComp); lien.setEvaluation(pourcentageRecouvrement); } } System.out.println(" Nombre de liens (1-1) créés au pré-appariement "+preAppLiens.size()); return preAppLiens; } /** On recherche les regroupements optimaux de liens de pré-appariement, pour * maximiser la distance surfacique entre les groupes de référence et de comparaison. * * NB : l'appariement est symétrique * * @param param : paramètres de l'appariement * @param liensPreApp : liens issus du pré-appariement * @return : liens d'appariement calculés (contient des objets de la classe Lien). * Ces liens sont des liens n-m. */ public static EnsembleDeLiens rechercheRegroupementsOptimaux(EnsembleDeLiens liensPreApp, FT_FeatureCollection popRef, FT_FeatureCollection popComp, ParametresAppSurfaces param) { EnsembleDeLiens liensGroupes; Lien lienGroupe, lienArc; double distSurfMin, distExacMax, dist; CarteTopo grapheDesLiens ; Groupe groupeTotal, groupeConnexe, groupeLight; Iterator itGroupes, itCombinaisons, itNoeuds, itArcs; List groupesConnexes ; List arcsEnlevables, arcsNonEnlevables, arcsDuGroupeEnleves, arcsDuGroupeEnlevesFinal; Noeud noeud; FT_Feature feat; int i=0; List groupesGardes = new ArrayList(); List groupesDecomposes ; //on crée les liens n-m (groupes connexes du graphe des liens) grapheDesLiens = liensPreApp.transformeEnCarteTopo(popRef, popComp); groupeTotal = (Groupe)grapheDesLiens.getPopGroupes().nouvelElement(); groupeTotal.setListeArcs(grapheDesLiens.getListeArcs()); groupeTotal.setListeNoeuds(grapheDesLiens.getListeNoeuds()); groupesConnexes = groupeTotal.decomposeConnexes(); System.out.println("Nombre de liens (n-m) à traiter "+groupesConnexes.size()); // on parcours tous les liens n-m créés itGroupes = groupesConnexes.iterator(); while (itGroupes.hasNext()) { i++; if ( i % 10000 == 0 ) System.out.println("Nb de groupes traités : "+i+" "+new Time(System.currentTimeMillis())); groupeConnexe = (Groupe)itGroupes.next(); // pour les objets isolés ou les liens 1-1, on ne fait rien de plus if ( groupeConnexe.getListeArcs().size() == 0 ) continue; if ( groupeConnexe.getListeArcs().size() == 1 ) { groupesGardes.add(groupeConnexe); continue; } // pour les groupes n-m, on va essayer d'enlever des arcs // mais on garde à coup sûr les liens avec suffisament de recouvremnt arcsEnlevables = new ArrayList(groupeConnexe.getListeArcs()); arcsNonEnlevables=new ArrayList(); itArcs = arcsEnlevables.iterator(); while (itArcs.hasNext()) { Arc arc = (Arc) itArcs.next(); lienArc= (Lien)arc.getCorrespondant(0); if (lienArc.getEvaluation()>param.pourcentage_intersection_sur) arcsNonEnlevables.add(arc); } arcsEnlevables.removeAll(arcsNonEnlevables); if (arcsEnlevables.size() == 0) { //si on ne peut rien enlever, on s'arrête là groupesGardes.add(groupeConnexe); continue; } //on cherche à enlever toutes les combinaisons possibles d'arcs virables itCombinaisons = Ensemble.combinaisons(arcsEnlevables).iterator(); distSurfMin = 2; // cas de distance surfacique à minimiser distExacMax = 0; // cas de completude / exactitude à maximiser arcsDuGroupeEnlevesFinal = new ArrayList(); while (itCombinaisons.hasNext()) { //boucle sur les combinaisons possibles arcsDuGroupeEnleves = (List)itCombinaisons.next(); groupeLight = groupeConnexe.copie(); groupeLight.getListeArcs().removeAll(arcsDuGroupeEnleves); if (groupeLight.getListeArcs().size() == 0) continue; //on refuse la solution extreme de ne rien garder comme apparié dist = mesureEvaluationGroupe(groupeLight, popRef, popComp, param); if ( param.minimiseDistanceSurfacique ) { // cas de distance surfacique à minimiser if ( dist < distSurfMin ) { distSurfMin = dist ; arcsDuGroupeEnlevesFinal = arcsDuGroupeEnleves; } } else { // cas de completude / exactitude à maximiser if ( dist > distExacMax ) { distExacMax = dist ; arcsDuGroupeEnlevesFinal = arcsDuGroupeEnleves; } } } //fin boucle sur les combinaisons possibles groupeConnexe.getListeArcs().removeAll(arcsDuGroupeEnlevesFinal); //simplification finale des liens d'appariement du groupe groupesDecomposes = groupeConnexe.decomposeConnexes(); //création des groupes finaux gardés groupesGardes.addAll(groupesDecomposes); } // création des liens retenus (passage de structure graphe à liens): // les groupes qui restent dans la carte topo représentent les liens finaux. liensGroupes = new EnsembleDeLiens(); liensGroupes.setNom("Liens issus d'un appariement de surfaces"); // on parcours tous les groupes connexes créés itGroupes = groupesGardes.iterator(); while (itGroupes.hasNext()) { groupeConnexe = (Groupe)itGroupes.next(); if ( groupeConnexe.getListeArcs().size() == 0 ) continue; // cas des noeuds isolés //if ( groupeConnexe.getListenoeuds().size() == 0 ) continue; lienGroupe = (Lien)liensGroupes.nouvelElement(); itNoeuds = groupeConnexe.getListeNoeuds().iterator(); while (itNoeuds.hasNext()) { noeud = (Noeud)itNoeuds.next(); feat = noeud.getCorrespondant(0); if ( popRef.getElements().contains(feat) ) lienGroupe.addObjetRef(feat); if ( popComp.getElements().contains(feat) ) lienGroupe.addObjetComp(feat); // nettoyage de la carteTopo créée noeud.setCorrespondants(new ArrayList()); } } return liensGroupes; } /** Distance surfacique ou complétude "étendue" sur un groupe. * Attention: vide le groupe au passage. * MESURE NON SATISFAISANTE POUR LIENS N-M : moyenne entre parties connexes A REVOIR */ private static double mesureEvaluationGroupe(Groupe groupe, FT_FeatureCollection popRef, FT_FeatureCollection popComp, ParametresAppSurfaces param) { List groupesConnexes; Iterator itGroupes, itNoeuds; GM_MultiSurface geomRef, geomComp; double dist, distTot = 0; Groupe groupeConnnexe; Noeud noeud; FT_Feature feat; // on décompose le groupe en parties connexes groupesConnexes = groupe.decomposeConnexes(); itGroupes = groupesConnexes.iterator(); while (itGroupes.hasNext()){ // on mesure la qualité de l'appariement pour chaque partie connexe, groupeConnnexe = (Groupe)itGroupes.next(); if ( groupeConnnexe.getListeArcs().size() == 0 ) continue; geomRef = new GM_MultiSurface(); geomComp = new GM_MultiSurface(); itNoeuds = groupeConnnexe.getListeNoeuds().iterator(); while ( itNoeuds.hasNext() ) { noeud = (Noeud)itNoeuds.next(); feat = noeud.getCorrespondant(0); //if ( feat.getPopulation()==popRef ) geomRef.add(feat.getGeom()); //if ( feat.getPopulation()==popComp ) geomComp.add(feat.getGeom()); if ( popRef.getElements().contains(feat) ) geomRef.add(feat.getGeom()); if ( popComp.getElements().contains(feat) ) geomComp.add(feat.getGeom()); } if ( param.minimiseDistanceSurfacique ){ dist = Distances.distanceSurfaciqueRobuste(geomRef, geomComp); } else dist = Distances.exactitude(geomRef, geomComp) + Distances.completude(geomRef, geomComp); // on combine les mesures des parties connexes distTot = distTot + dist; } return distTot; // / groupesConnexes.size(); } //Bourrin: a optimiser public static void ajoutPetitesSurfaces(EnsembleDeLiens liens, FT_FeatureCollection popRef, FT_FeatureCollection popComp, ParametresAppSurfaces param) { Iterator itRef = popRef.getElements().iterator(); Iterator itLiens = liens.getElements().iterator(); Set objetsRefLies = new HashSet(); FT_FeatureCollection objetsAdjacents; Lien lienAdjacent, lien2; double surfAdj; boolean tousPareils; if ( ! popRef.hasSpatialIndex() ) { System.out.println("Indexation spatiale des surfaces de référence "+new Time(System.currentTimeMillis())); popRef.initSpatialIndex(Tiling.class, true); } while (itLiens.hasNext()) { Lien lien = (Lien) itLiens.next(); objetsRefLies.addAll(lien.getObjetsRef()); } while (itRef.hasNext()) { FT_Feature objetRef = (FT_Feature) itRef.next(); if (objetsRefLies.contains(objetRef)) continue; // cas d'un objet non apparié objetsAdjacents=popRef.select(objetRef.getGeom()); if (objetsAdjacents == null) continue; if (objetsAdjacents.size() == 1) continue; objetsAdjacents.remove(objetRef); lienAdjacent = liensDeObj((FT_Feature)objetsAdjacents.get(0), liens); surfAdj = ((FT_Feature)objetsAdjacents.get(0)).getGeom().area(); if (lienAdjacent == null) continue; tousPareils=true; for(int i=1;i<objetsAdjacents.size();i++) { lien2 = liensDeObj((FT_Feature)objetsAdjacents.get(i), liens); if (lienAdjacent!=lien2) { tousPareils=false; break; } surfAdj = surfAdj + ((FT_Feature)objetsAdjacents.get(i)).getGeom().area(); } if (!tousPareils) continue; if ( objetRef.getGeom().area() / surfAdj > param.seuilPourcentageTaillePetitesSurfaces) continue; lienAdjacent.addObjetRef(objetRef); } } private static Lien liensDeObj(FT_Feature objet, EnsembleDeLiens liens) { Iterator itLiens = liens.getElements().iterator(); while (itLiens.hasNext()) { Lien lien = (Lien) itLiens.next(); if (lien.getObjetsRef().contains(objet))return lien; } return null; } public static EnsembleDeLiens filtreLiens(EnsembleDeLiens liensRegroupes,ParametresAppSurfaces param) { EnsembleDeLiens liensFiltres = new EnsembleDeLiens(); Lien lien, lienOK ; double distSurf; Iterator itGroupes = liensRegroupes.getElements().iterator(); while (itGroupes.hasNext()) { lien = (Lien) itGroupes.next(); // si on depasse le seuil acceptable: on refuse. if ( param.minimiseDistanceSurfacique) { distSurf = lien.distanceSurfaciqueRobuste(); if (distSurf < param.distSurfMaxFinal ) { lienOK = (Lien)liensFiltres.nouvelElement(); lienOK.copie(lien); lienOK.setEvaluation(distSurf); } } else { if ((lien.exactitude() > param.completudeExactitudeMinFinal ) && (lien.completude() > param.completudeExactitudeMinFinal)){ lienOK = (Lien)liensFiltres.nouvelElement(); lienOK.copie(lien); } } } System.out.println(" Nombre de liens retenus après filtrage : "+liensFiltres.size()); return liensFiltres; } public static void creeGeometrieDesLiens(EnsembleDeLiens liens, boolean persistant) { FT_FeatureCollection objetsRef, objetsComp; FT_Feature objetComp; GM_Point pointAccrocheRef, pointAccrocheComp; CarteTopo armRef, armComp; Iterator itLiens = liens.getElements().iterator(); Iterator itArcs, itNoeuds, itObjetsComp; Arc arc; Noeud noeud; GM_Aggregate geomLien; if (persistant) DataSet.db.begin(); System.out.println("Création de la géométrie des liens"); while (itLiens.hasNext()) { Lien lien = (Lien) itLiens.next(); if (lien.getObjetsRef().size() == 0) { System.out.println("Attention, lien sans objet de référence"); continue; } if (lien.getObjetsComp().size() == 0) { System.out.println("Attention, lien sans objet de comparaison"); continue; } if (persistant) DataSet.db.makePersistent(lien); geomLien = new GM_Aggregate(); lien.setGeom(geomLien); objetsRef = new FT_FeatureCollection(); objetsRef.getElements().addAll(lien.getObjetsRef()); armRef=ARM.creeARMsurObjetsQuelconques(objetsRef); // ajout des traits reliant les objets ref itArcs=armRef.getPopArcs().getElements().iterator(); while (itArcs.hasNext()) { arc = (Arc) itArcs.next(); geomLien.add(arc.getGeometrie()); } // ajout des points centroides des objets ref itNoeuds=armRef.getPopNoeuds().getElements().iterator(); while (itNoeuds.hasNext()) { noeud = (Noeud) itNoeuds.next(); geomLien.add(noeud.getGeometrie()); } objetsComp = new FT_FeatureCollection(); objetsComp.getElements().addAll(lien.getObjetsComp()); armComp=ARM.creeARMsurObjetsQuelconques(objetsComp); // ajout des traits reliant les objets ref itArcs=armComp.getPopArcs().getElements().iterator(); while (itArcs.hasNext()) { arc = (Arc) itArcs.next(); geomLien.add(arc.getGeometrie()); } // ajout des points centroides des objets ref itNoeuds=armComp.getPopNoeuds().getElements().iterator(); while (itNoeuds.hasNext()) { noeud = (Noeud) itNoeuds.next(); geomLien.add(noeud.getGeometrie()); } //ajout des traits reliant les objets comp au point d'accroche ref pointAccrocheRef=((Noeud)armRef.getPopNoeuds().getElements().get(0)).getGeometrie(); itObjetsComp = lien.getObjetsComp().iterator(); while (itObjetsComp.hasNext()) { objetComp = (FT_Feature) itObjetsComp.next(); pointAccrocheComp = (GM_Point)objetComp.getGeom().centroid(); if (pointAccrocheComp==null) continue; GM_LineString trait = new GM_LineString(); trait.addControlPoint(pointAccrocheRef.getPosition()); trait.addControlPoint(pointAccrocheComp.getPosition()); geomLien.add(trait); // pour faire joli : //Vecteur V = new Vecteur(); //V.setX(0.1);V.setY(0); //geomLien.add(V.translate(trait)); } } if (persistant) { System.out.println("-- Stockage: commit: "+new Time(System.currentTimeMillis())); DataSet.db.commit(); } } } |
|
From: Eric G. <eg...@us...> - 2008-01-31 16:28:59
|
Update of /cvsroot/oxygene-project/geoxygene/src/fr/ign/cogit/geoxygene/contrib/appariement/stockageLiens In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv13713/src/fr/ign/cogit/geoxygene/contrib/appariement/stockageLiens Added Files: StockageLiens.java EnsembleDeLiensSGBD.java LienSGBD.java Log Message: adding a data matching tool --- NEW FILE: StockageLiens.java --- /* * This file is part of the GeOxygene project source files. * * GeOxygene aims at providing an open framework which implements OGC/ISO specifications for * the development and deployment of geographic (GIS) applications. It is a open source * contribution of the COGIT laboratory at the Institut Géographique National (the French * National Mapping Agency). * * See: http://oxygene-project.sourceforge.net * * Copyright (C) 2005 Institut Géographique National * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with * this library (see file LICENSE if present); if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ package fr.ign.cogit.geoxygene.contrib.appariement.stockageLiens; import fr.ign.cogit.geoxygene.contrib.appariement.EnsembleDeLiens; import fr.ign.cogit.geoxygene.datatools.ojb.GeodatabaseOjbFactory; import fr.ign.cogit.geoxygene.feature.DataSet; /** * Classe permettant le stockage et le chargement d'ensemble de liens résultants * d'appariement * * @author Eric Grosso - IGN / Laboratoire COGIT * @version 1.0 * */ public class StockageLiens { /** Méthode permettant de stocker automatiquement un ensemble de liens d'appariement * et les liens correspondants dans le SGBD * @param ensembleLiens */ public static void stockageDesLiens(EnsembleDeLiens ensembleLiens,int rouge, int vert, int bleu){ DataSet.db = GeodatabaseOjbFactory.newInstance(); DataSet.db.begin(); EnsembleDeLiensSGBD liensSGBD = new EnsembleDeLiensSGBD(true); liensSGBD.conversionEnsembleLiensVersSGBD(ensembleLiens,rouge,vert,bleu); DataSet.db.commit(); } /** Méthode permettant de déstocker automatiquement un ensemble de liens d'appariement * SGBD et les liens correspondants, en renvoyant l'ensemble de liens correspondants * @param ensembleLiensSGBG */ public static EnsembleDeLiens destockageDesLiens(EnsembleDeLiensSGBD ensembleLiensSGBD){ EnsembleDeLiens liens = new EnsembleDeLiens(); ensembleLiensSGBD.conversionSGBDVersEnsembleLiens(liens); return liens; } } --- NEW FILE: EnsembleDeLiensSGBD.java --- /* * This file is part of the GeOxygene project source files. * * GeOxygene aims at providing an open framework which implements OGC/ISO specifications for * the development and deployment of geographic (GIS) applications. It is a open source * contribution of the COGIT laboratory at the Institut Géographique National (the French * National Mapping Agency). * * See: http://oxygene-project.sourceforge.net * * Copyright (C) 2005 Institut Géographique National * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with * this library (see file LICENSE if present); if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ package fr.ign.cogit.geoxygene.contrib.appariement.stockageLiens; import java.util.ArrayList; import java.util.GregorianCalendar; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.StringTokenizer; import fr.ign.cogit.geoxygene.contrib.appariement.EnsembleDeLiens; import fr.ign.cogit.geoxygene.contrib.appariement.Lien; import fr.ign.cogit.geoxygene.datatools.Geodatabase; import fr.ign.cogit.geoxygene.datatools.ojb.GeodatabaseOjbFactory; import fr.ign.cogit.geoxygene.feature.Population; /** * Structure permettant le stockage des Résultats de la réalisation * d'un appariement au sein du SGBD * * @author Eric Grosso - IGN / Laboratoire COGIT * @version 1.0 * */ @SuppressWarnings("unchecked") public class EnsembleDeLiensSGBD extends Population { public EnsembleDeLiensSGBD() { super(false, "Ensemble de liens SGBD", LienSGBD.class, true); } public EnsembleDeLiensSGBD(boolean persistant) { super(persistant, "Ensemble de liens SGBD", LienSGBD.class, true); } /** Nom du l'ensemble des liens d'appariement (ex: "Appariement des routes par la méthode XX")*/ private String nom ; public String getNom() {return nom;} public void setNom(String nom) {this.nom = nom;} /** Description textuelle des paramètres utilisés pour l'appariement */ private String parametrage ; public String getParametrage() {return parametrage;} public void setParametrage(String parametrage) {this.parametrage = parametrage;} /** Description textuelle du résultat de l'auto-évaluation des liens */ private String evaluationInterne ; public String getEvaluationInterne() {return evaluationInterne;} public void setEvaluationInterne(String evaluation) {evaluationInterne = evaluation;} /** Description textuelle du résultat de l'évaluation globale des liens */ private String evaluationGlobale ; public String getEvaluationGlobale() {return evaluationGlobale;} public void setEvaluationGlobale(String evaluation) {evaluationGlobale = evaluation;} /** Liste des populations auxquelles les objets ref et comp des liens sont attachés * sous forme de string*/ private String populations ; public String getPopulations() {return populations;} public void setPopulations(String populations) {this.populations = populations;} /** Liste aidant à instancier la variable populations*/ private HashSet<String> listePop; public HashSet<String> getListePop() {return listePop;} public void setListePop(HashSet<String> listePop) {this.listePop = listePop;} /** Liste des populations réelles*/ private List<Population> listePopulations; public List<Population> getListePopulations() {return listePopulations;} public void setListePopulations(List<Population> listePopulations) {this.listePopulations = listePopulations;} /** Date de l'enregistrement*/ private String date; public String getDate() {return date;} public void setDate(String date) {this.date = date;} /**Couleur du lien : rouge */ private int rouge; public int getRouge() { return rouge; } public void setRouge(int rouge) { this.rouge = rouge; } /**Couleur du lien : vert */ private int vert; public int getVert() { return vert; } public void setVert(int vert) { this.vert = vert; } /**Couleur du lien : bleu */ private int bleu; public int getBleu() { return bleu; } public void setBleu(int bleu) { this.bleu = bleu; } ////////////////////////////////////////////////////////////////////////// // relation BIDIRECTIONNELLE 1-n //////////////////////// ////////////////////////////////////////////////////////////////////////// /** Lien bidirectionnel 1-n vers Lien. * 1 objet EnsembleDeLiens est en relation avec n objets LienSGBD (n pouvant etre nul). * 1 objet LienSGBD est en relation avec 1 objet EnsembleDeLiens au plus. * * NB: un objet EnsembleDeLiens ne doit pas être en relation plusieurs fois avec le même objet LienSGBD : * il est impossible de bien gérer des relations 1-n bidirectionnelles avec doublons. * * ATTENTION: Pour assurer la bidirection, il faut modifier les listes uniquement avec * les methodes fournies. * * NB: si il n'y a pas d'objet en relation, la liste est vide mais n'est pas "null". * Pour casser toutes les relations, faire setListe(new ArrayList()) ou emptyListe(). */ private List<LienSGBD> liensSGBD = this.getElements(); /** Récupère la liste des objets en relation. */ public List<LienSGBD> getLiensSGBD() {return liensSGBD ; } /** Définit la liste des objets en relation, et met à jour la relation inverse. */ public void setLiensSGBD (List<LienSGBD> L) { List old = new ArrayList(liensSGBD); Iterator it1 = old.iterator(); while ( it1.hasNext() ) { LienSGBD lien = (LienSGBD)it1.next(); lien.setEnsembleLiensSGBD(null); } Iterator it2 = L.iterator(); while ( it2.hasNext() ) { LienSGBD lien = (LienSGBD)it2.next(); lien.setEnsembleLiensSGBD(this); } } /** Récupère le ième élément de la liste des objets en relation. */ public LienSGBD getLienSGBD(int i) {return (LienSGBD)liensSGBD.get(i) ; } /** Ajoute un objet à la liste des objets en relation, et met à jour la relation inverse. */ public void addLienSGBD (LienSGBD lien) { if ( lien == null ) return; liensSGBD.add(lien) ; lien.setEnsembleLiensSGBD(this) ; } /** Enlève un élément de la liste des objets en relation, et met à jour la relation inverse. */ public void removeLienSGBD(LienSGBD lien) { if ( lien == null ) return; liensSGBD.remove(lien) ; lien.setEnsembleLiensSGBD(null); } /** Vide la liste des objets en relation, et met à jour la relation inverse. */ public void emptyLiensSGBD () { List old = new ArrayList(liensSGBD); Iterator it = old.iterator(); while ( it.hasNext() ) { LienSGBD lien = (LienSGBD)it.next(); lien.setEnsembleLiensSGBD(null); } } /** Détruit dans le SGBD l'ensemble de liens SGBD et les liens d'appariement SGBD * en correspondance (attention: il faut que les objets soient persistants) */ public void detruitEnsembleDeLiensSGBD(Geodatabase geodatabase){ Iterator<LienSGBD> it = this.getLiensSGBD().iterator(); while(it.hasNext()){ LienSGBD lien = it.next(); geodatabase.deletePersistent(lien); } geodatabase.deletePersistent(this); } //////////////////////////////////////////////////////////////////////////////////// ////////// CONVERSION ENTRE ENSEMBLE DE LIENS ET ENSEMBLE DE LIENS SGBD ////////// //////////////////////////////////////////////////////////////////////////////////// /**Methode de conversion entre les ensembles de liens d'appariement vers les ensemebles * de liens SGBD */ public EnsembleDeLiensSGBD conversionEnsembleLiensVersSGBD(EnsembleDeLiens ensemble, int rouge, int vert, int bleu){ //nom if (ensemble.getNom()==null || ensemble.getNom().length()==0)this.setNom("Non renseigné"); else this.setNom(ensemble.getNom()); //parametrage if (ensemble.getParametrage()==null || ensemble.getParametrage().length()==0){ this.setParametrage("Non renseigné"); } else this.setParametrage(ensemble.getParametrage()); //evaluationInterne if (ensemble.getEvaluationInterne()==null || ensemble.getEvaluationInterne().length()==0)this.setEvaluationInterne("Non renseigné"); else this.setEvaluationInterne(ensemble.getEvaluationInterne()); //evaluationGlobale if (ensemble.getEvaluationGlobale()==null || ensemble.getEvaluationGlobale().length()==0)this.setEvaluationGlobale("Non renseigné"); else this.setEvaluationGlobale(ensemble.getEvaluationGlobale()); //date this.setDate(new GregorianCalendar().getTime().toString()); //couleur this.setRouge(rouge); this.setVert(vert); this.setBleu(bleu); //liensSGBD this.setListePop(new HashSet<String>()); Iterator it = ensemble.getElements().iterator(); while(it.hasNext()){ LienSGBD lienSGBD = (LienSGBD)this.nouvelElement(); this.addLienSGBD(lienSGBD); lienSGBD.conversionLiensVersSGBD((Lien)it.next()); } Iterator<String> itPop = listePop.iterator(); String pop = ""; while(itPop.hasNext()){ pop = pop.concat(itPop.next()+"|"); } this.setPopulations(pop.substring(0, pop.length()-1)); return this; } /**Methode de conversion entre les ensembles de liens SGBD vers les ensembles de * liens d'appariement */ public void conversionSGBDVersEnsembleLiens(EnsembleDeLiens ensemble){ //nom ensemble.setNom(this.getNom()); //parametrage ensemble.setParametrage(this.getParametrage()); //evaluationInterne ensemble.setEvaluationInterne(this.getEvaluationInterne()); //evaluationGlobale ensemble.setEvaluationGlobale(this.getEvaluationGlobale()); //chargement des populations concernées par les liens d'appariement en mémoire StringTokenizer token = new StringTokenizer(this.getPopulations(),"|"); String pop; Geodatabase geodb = GeodatabaseOjbFactory.newInstance(); this.setListePopulations(new ArrayList()); while(token.hasMoreElements()){ pop = token.nextToken(); try { Class classe = Class.forName(pop); Population population = new Population(false,"Population",classe,true); population.addCollection(geodb.loadAllFeatures(classe)); this.getListePopulations().add(population); } catch (Exception e) { e.printStackTrace(); System.out.println("ATTENTION: la classe "+pop+" stockée dans LIENS ne semble plus existée"); System.out.println("RESOLUTION: recréer cette classe ou refaire un appariement pour un stockage adapté de vos liens"); } } //liensSGBD Iterator<LienSGBD> it = this.getLiensSGBD().iterator(); while(it.hasNext()){ LienSGBD lienSGBD = it.next(); //ensemble.getElements().add(lienSGBD.conversionSGBDVersLiens()); //meilleure solution dans le sens où précise la population du lien //mais plantage au niveau du stockage au moment de la création de la population //de l'ensemble de liens SGBD ensemble.add(lienSGBD.conversionSGBDVersLiens()); } } } --- NEW FILE: LienSGBD.java --- /* * This file is part of the GeOxygene project source files. * * GeOxygene aims at providing an open framework which implements OGC/ISO specifications for * the development and deployment of geographic (GIS) applications. It is a open source * contribution of the COGIT laboratory at the Institut Géographique National (the French * National Mapping Agency). * * See: http://oxygene-project.sourceforge.net * * Copyright (C) 2005 Institut Géographique National * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with * this library (see file LICENSE if present); if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ package fr.ign.cogit.geoxygene.contrib.appariement.stockageLiens; import java.util.Iterator; import java.util.List; import java.util.StringTokenizer; import fr.ign.cogit.geoxygene.contrib.appariement.Lien; import fr.ign.cogit.geoxygene.feature.FT_Feature; import fr.ign.cogit.geoxygene.feature.Population; /** * Liens stockables dans le SGBD * Resultat de l'appariement : lien entre objets de BDref et objets de BDcomp. * Un lien a aussi une géométrie qui est sa représentation graphique. * * @author Eric Grosso - IGN / Laboratoire COGIT * @version 1.0 * */ public class LienSGBD extends FT_Feature { /** Les objets de Reference pointés par le lien */ protected String objetsRef; public String getObjetsRef() {return objetsRef;} public void setObjetsRef(String liste) { objetsRef = liste; } /** Les objets de Comparaison pointés par le lien */ protected String objetsComp; public String getObjetsComp() {return objetsComp;} public void setObjetsComp(String liste) { objetsComp = liste; } /** Estimation de la qualité du lien d'appariement * (mapping fait avec la table Representation_Lien au besoin)*/ private double evaluation ; public double getEvaluation() {return evaluation;} public void setEvaluation(double evaluation) {this.evaluation = evaluation;} /** Liste d'indicateurs temporaires utilisés pendant les calculs d'appariement */ protected String indicateurs; public String getIndicateurs() {return indicateurs;} public void setIndicateurs(String indicateurs) { this.indicateurs = indicateurs; } /** Texte libre * (mapping fait avec la table Representation_Lien au besoin)*/ protected String commentaire = new String(); public String getCommentaire() {return commentaire;} public void setCommentaire(String commentaire) { this.commentaire = commentaire; } /** Texte libre pour décrire le nom de l'appariement. * (mapping fait avec la table Representation_Lien au besoin)*/ protected String nom = new String(); public String getNom() {return nom;} public void setNom(String nom) { this.nom = nom; } /** Texte libre pour décrire le type d'appariement (ex. "Noeud-Noeud"). * (mapping fait avec la table Representation_Lien au besoin)*/ protected String type = new String(); public String getType() {return type;} public void setType(String type) { this.type = type; } /** Texte libre pour décrire les objets de référence pointés. * (mapping fait avec la table Representation_Lien au besoin)*/ protected String reference = new String(); public String getReference() {return reference;} public void setReference(String reference) { this.reference = reference; } /** Texte libre pour décrire les objets de comparaison pointés. * (mapping fait avec la table Representation_Lien au besoin)*/ protected String comparaison = new String(); public String getComparaison() {return comparaison;} public void setComparaison(String comparaison) { this.comparaison = comparaison; } /**Methode de conversion entre les liens d'appariement vers les liens SGBD */ public LienSGBD conversionLiensVersSGBD(Lien lien){ List objetsRef = lien.getObjetsRef(), objetsComp = lien.getObjetsComp(), indic = lien.getIndicateurs(); Iterator itRef = objetsRef.iterator(), itComp = objetsComp.iterator(), itIndic = indic.iterator(); FT_Feature feature; String formatRef="", formatComp="", formatIndic="", classe=""; //Reference while(itRef.hasNext()){ feature = (FT_Feature)itRef.next(); classe = feature.getClass().getName(); if (formatRef.contains(classe)&&formatRef.length()!=0) formatRef = formatRef.replaceAll(classe,classe+" "+feature.getId()); else{ formatRef = formatRef+classe+" "+feature.getId()+"|"; this.getEnsembleLiensSGBD().getListePop().add(classe); } } formatRef = formatRef.substring(0,formatRef.length()-1); this.setObjetsRef(formatRef); //Comparaison while(itComp.hasNext()){ feature = (FT_Feature)itComp.next(); classe = feature.getClass().getName(); if (formatComp.contains(classe)&&formatComp.length()!=0) formatComp = formatComp.replaceAll(classe,classe+" "+feature.getId()); else { formatComp = formatComp+classe+" "+feature.getId()+"|"; this.getEnsembleLiensSGBD().getListePop().add(classe); } } formatComp = formatComp.substring(0,formatComp.length()-1); this.setObjetsComp(formatComp); //Indicateurs while(itIndic.hasNext()){ formatIndic = formatIndic+(String)itIndic.next()+"|"; } if (formatIndic.length()>0)this.setIndicateurs(formatIndic.substring(0,formatIndic.length()-1)); else this.setIndicateurs("Non renseigné"); //evaluation this.setEvaluation(lien.getEvaluation()); //commentaire if (lien.getCommentaire().length()==0)this.setCommentaire("Non renseigné"); else this.setCommentaire(lien.getCommentaire()); //nom if (lien .getNom().length()==0)this.setNom("Non renseigné"); else this.setNom(lien.getNom()); //type if (lien.getType().length()==0)this.setType("Non renseigné"); else this.setType(lien.getType()); //reference if (lien.getReference().length()==0)this.setReference("Non renseigné"); else this.setReference(lien.getReference()); //comparaison if (lien.getComparaison().length()==0)this.setComparaison("Non renseigné"); else this.setComparaison(lien.getComparaison()); //geometrie this.setGeom(lien.getGeom()); return this; } /**Methode de conversion entre les liens SGBD vers les liens d'appariement */ @SuppressWarnings("unchecked") public Lien conversionSGBDVersLiens(){ Lien lien = new Lien(); //reference String formatRef = this.getObjetsRef(), valeurRef, valeurRefClass, valeurRefIds,valeurRefId; StringTokenizer tokenRef = new StringTokenizer(formatRef,"|");StringTokenizer tokenRefId; Population population; FT_Feature feature; List<Population> liste = this.getEnsembleLiensSGBD().getListePopulations(); while(tokenRef.hasMoreElements()){ valeurRef = tokenRef.nextToken(); valeurRefClass = valeurRef.substring(0,valeurRef.indexOf(" ")); valeurRefIds = valeurRef.replaceFirst(valeurRefClass,""); tokenRefId = new StringTokenizer(valeurRefIds," "); Iterator<Population> it = liste.iterator(); while(it.hasNext()){ population = it.next(); if(valeurRefClass.equals(population.getNomClasse())){ while(tokenRefId.hasMoreElements()){ valeurRefId = tokenRefId.nextToken(); int id = new Integer(valeurRefId).intValue(); Iterator<FT_Feature> itPop = population.getElements().iterator(); while(itPop.hasNext()){ feature = itPop.next(); if(id==feature.getId()){ lien.addObjetRef(feature); break; } } } break; } } } //comparaison String formatComp = this.getObjetsComp(), valeurComp, valeurCompClass, valeurCompIds,valeurCompId; StringTokenizer tokenComp = new StringTokenizer(formatComp,"|");StringTokenizer tokenCompId; while(tokenComp.hasMoreElements()){ valeurComp = tokenComp.nextToken(); valeurCompClass = valeurComp.substring(0,valeurComp.indexOf(" ")); valeurCompIds = valeurComp.replaceFirst(valeurCompClass,""); tokenCompId = new StringTokenizer(valeurCompIds," "); Iterator<Population> it = liste.iterator(); while(it.hasNext()){ population = it.next(); if(valeurCompClass.equals(population.getNomClasse())){ while(tokenCompId.hasMoreElements()){ valeurCompId = tokenCompId.nextToken(); int id = new Integer(valeurCompId).intValue(); Iterator<FT_Feature> itPop = population.getElements().iterator(); while(itPop.hasNext()){ feature = itPop.next(); if(id==feature.getId()){ lien.addObjetComp(feature); break; } } } break; } } } //Indicateurs String formatIndic = this.getIndicateurs(), valeurIndic; StringTokenizer tokenIndic = new StringTokenizer(formatIndic,"|"); while(tokenIndic.hasMoreElements()){ valeurIndic = tokenIndic.nextToken(); lien.addIndicateur(valeurIndic); } //evaluation lien.setEvaluation(this.getEvaluation()); //commentaire lien.setCommentaire(this.getCommentaire()); //nom lien.setNom(this.getNom()); //type lien.setType(this.getType()); //reference lien.setReference(this.getReference()); //comparaison lien.setComparaison(this.getComparaison()); //geometrie lien.setGeom(this.getGeom()); return lien; } ////////////////////////////////////// private EnsembleDeLiensSGBD ensembleLiensSGBD; /** Récupère l'objet en relation. */ public EnsembleDeLiensSGBD getEnsembleLiensSGBD() {return ensembleLiensSGBD; } /** Définit l'objet en relation, et met à jour la relation inverse. */ public void setEnsembleLiensSGBD(EnsembleDeLiensSGBD ensemble) { EnsembleDeLiensSGBD old = ensembleLiensSGBD; ensembleLiensSGBD = ensemble; if ( old != null ) old.getLiensSGBD().remove(this); if ( ensemble != null) { if ( ! ensemble.getLiensSGBD().contains(this) ) ensemble.getLiensSGBD().add(this); } } } |
|
From: Eric G. <eg...@us...> - 2008-01-31 16:28:48
|
Update of /cvsroot/oxygene-project/geoxygene/src/fr/ign/cogit/geoxygene/contrib/appariement/surfaces In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv13697/src/fr/ign/cogit/geoxygene/contrib/appariement/surfaces Log Message: Directory /cvsroot/oxygene-project/geoxygene/src/fr/ign/cogit/geoxygene/contrib/appariement/surfaces added to the repository |
|
From: Eric G. <eg...@us...> - 2008-01-31 16:28:48
|
Update of /cvsroot/oxygene-project/geoxygene/src/fr/ign/cogit/geoxygene/contrib/appariement/stockageLiens In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv13697/src/fr/ign/cogit/geoxygene/contrib/appariement/stockageLiens Log Message: Directory /cvsroot/oxygene-project/geoxygene/src/fr/ign/cogit/geoxygene/contrib/appariement/stockageLiens added to the repository |