You can subscribe to this list here.
2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(46) |
Jul
(37) |
Aug
(154) |
Sep
(140) |
Oct
(132) |
Nov
(104) |
Dec
(67) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2009 |
Jan
(113) |
Feb
(73) |
Mar
(102) |
Apr
(106) |
May
(114) |
Jun
(67) |
Jul
(116) |
Aug
(48) |
Sep
(108) |
Oct
(296) |
Nov
(56) |
Dec
(53) |
2010 |
Jan
(95) |
Feb
(31) |
Mar
(40) |
Apr
(12) |
May
(10) |
Jun
(27) |
Jul
(19) |
Aug
(81) |
Sep
(48) |
Oct
(45) |
Nov
(40) |
Dec
(7) |
2011 |
Jan
(16) |
Feb
(32) |
Mar
(55) |
Apr
(38) |
May
(24) |
Jun
(37) |
Jul
(12) |
Aug
(16) |
Sep
(97) |
Oct
(90) |
Nov
(101) |
Dec
(89) |
2012 |
Jan
(18) |
Feb
(2) |
Mar
(54) |
Apr
(69) |
May
(97) |
Jun
(131) |
Jul
(70) |
Aug
(48) |
Sep
(48) |
Oct
(119) |
Nov
(194) |
Dec
(60) |
2013 |
Jan
(73) |
Feb
(35) |
Mar
(42) |
Apr
(28) |
May
(7) |
Jun
(17) |
Jul
(27) |
Aug
(10) |
Sep
(38) |
Oct
(12) |
Nov
(4) |
Dec
(16) |
2014 |
Jan
(33) |
Feb
(37) |
Mar
(19) |
Apr
(3) |
May
(47) |
Jun
(26) |
Jul
(22) |
Aug
|
Sep
(10) |
Oct
(30) |
Nov
(24) |
Dec
(19) |
2015 |
Jan
(13) |
Feb
(16) |
Mar
(36) |
Apr
(19) |
May
(5) |
Jun
(5) |
Jul
(3) |
Aug
(11) |
Sep
(22) |
Oct
(7) |
Nov
(14) |
Dec
|
2016 |
Jan
|
Feb
(26) |
Mar
(13) |
Apr
(61) |
May
|
Jun
|
Jul
(4) |
Aug
|
Sep
|
Oct
(27) |
Nov
(14) |
Dec
(21) |
2017 |
Jan
(30) |
Feb
(4) |
Mar
(3) |
Apr
(5) |
May
(69) |
Jun
(29) |
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <emm...@us...> - 2009-01-30 17:09:29
|
Revision: 4430 http://fudaa.svn.sourceforge.net/fudaa/?rev=4430&view=rev Author: emmanuel_martin Date: 2009-01-30 17:09:25 +0000 (Fri, 30 Jan 2009) Log Message: ----------- Tache #164 : "Edition 1D : Ne pas limiter ?\195?\160 3 le nombre de segments sur les profils" Modified Paths: -------------- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/Bief.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/ProfilContainer.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/ProfilContainerAdapter.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/VueTableau.java Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/Bief.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/Bief.java 2009-01-30 15:11:50 UTC (rev 4429) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/Bief.java 2009-01-30 17:09:25 UTC (rev 4430) @@ -861,6 +861,16 @@ else if(_att==GISAttributeConstants.INTERSECTION_LIMITE_STOCKAGE_DROITE) updateGeom(_idxGeom, limitesStockagsesModified_, 1, idxAttlsDroite_); else if(_att==GISAttributeConstants.INTERSECTIONS_LIGNES_DIRECTRICES) + /* + * Attention subtilit\xE9 : Quand l'attribut est + * GISAttributeConstants.INTERSECTIONS_LIGNES_DIRECTRICES c'est que + * l'\xE9v\xE9nement vient de la liste des index d'intersection avec une ligne + * directrice m\xE9moris\xE9e dans chaque profil. Or pour cette liste + * l'_idxGeom est en r\xE9alit\xE9 son index modifi\xE9. Vu que les lignes + * directrices sont ordonn\xE9es dans cette attribut, l'information qu'on + * re\xE7oit sous le nom _idxGeom est en faite l'index de la + * ligneDirectrice modifi\xE9e. + */ updateLd(_idxGeom); } @@ -870,7 +880,8 @@ updateGeom(_idxGeom, rivesModified_, 1, idxAttRiveDroite_); updateGeom(_idxGeom, limitesStockagsesModified_, 0, idxAttlsGauche_); updateGeom(_idxGeom, limitesStockagsesModified_, 1, idxAttlsDroite_); - updateLd(_idxGeom); + for(int i=0;i<lignesDirectrices_.getNombre();i++) + updateLd(i); } } Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/ProfilContainer.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/ProfilContainer.java 2009-01-30 15:11:50 UTC (rev 4429) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/ProfilContainer.java 2009-01-30 17:09:25 UTC (rev 4430) @@ -105,8 +105,6 @@ /** Place l'intersection du profil avec la rive droite \xE0 l'index _idx. */ public void setRiveDroite(int _idx, CtuluCommandContainer _cmd); - - /** Retourne le nombre de lignes directrices croisant le profil. */ public int getNbLignesDirectrices(); @@ -127,4 +125,7 @@ /** Retourne les index des lignes directrices pouvant \xEAtre d\xE9plac\xE9s au point indiqu\xE9.*/ public int[] getAllowedMoveOfLignesDirectricesTo(int _idxPoint); + + /** Retourne vrai si le point indiqu\xE9 est un point de rupture. */ + public boolean isRupturePoint(int _idx); } Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/ProfilContainerAdapter.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/ProfilContainerAdapter.java 2009-01-30 15:11:50 UTC (rev 4429) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/ProfilContainerAdapter.java 2009-01-30 17:09:25 UTC (rev 4430) @@ -9,7 +9,10 @@ import java.util.ArrayList; import java.util.BitSet; +import java.util.HashSet; +import java.util.Iterator; import java.util.List; +import java.util.Set; import org.fudaa.ctulu.CtuluCommand; import org.fudaa.ctulu.CtuluCommandComposite; @@ -22,10 +25,10 @@ import org.fudaa.ctulu.gis.GISAttributeModelIntegerList; import org.fudaa.ctulu.gis.GISCoordinateSequenceContainerInterface; import org.fudaa.ctulu.gis.GISGeometryFactory; -import org.fudaa.ctulu.gis.GISPolyligne; import org.fudaa.ctulu.gis.GISZoneCollection; import org.fudaa.ctulu.gis.GISZoneCollectionLigneBrisee; import org.fudaa.fudaa.commun.FudaaLib; +import org.fudaa.fudaa.modeleur.LibUtils; import com.vividsolutions.jts.geom.Coordinate; import com.vividsolutions.jts.geom.CoordinateSequence; @@ -97,6 +100,21 @@ } } + /** + * Marge d'acceptation avant de consid\xE9r\xE9 un point comme \xE9tant un point de + * rupture. La valeur est la diff\xE9rence des coefficients directeurs des + * segments avant et apr\xE8s le point. + * En donnant la valeur en radian de l'angle minimal : tolerance_=Math.tan(#ValeurDegr\xE9#) + * Avec #ValeurDegr\xE9# C [0;PI/2[ + * En donnant la valeur en radian de l'angle maximal : tolerance_=Math.tan(Math.PI-#ValeurDegr\xE9#) + * Avec #ValeurDegr\xE9# C ]PI/2;PI] + * En donnant la valeur en degr\xE9 de l'angle minimal : tolerance_=Math.tan(#ValeurDegr\xE9#*Math.PI/2/90) + * Avec #ValeurDegr\xE9# C [0;90[ + * En donnant la valeur en degr\xE9 de l'angle maximal : tolerance_=Math.tan((180-#ValeurDegr\xE9#)*Math.PI/2/90) + * Avec #ValeurDegr\xE9# C ]90;180] + */ + static final double tolerance_=Math.tan(89*Math.PI/2/90); + /** Le biefContainer contenant le bief contenant les profils utilis\xE9s. */ private BiefContainer biefContainer_; /** Le profil selectionn\xE9. */ @@ -106,17 +124,22 @@ // Caches \\ private int idxZMax_; private int idxZMin_; - private double curviligneDecalage_; // d\xE9calage de l'axe hydraulique. - // Le profil est potentiellement coup\xE9 en trois, les deux indices qui suivent - // indique l'index de chacune de ces ruptures. - private int idxRupture1_; - private int idxRupture2_; + /** D\xE9calage de l'axe hydraulique. */ + private double curviligneDecalage_; + /** Les points de ruptures du profils sont contenus dans cet ensemble. */ + private Set<Integer> idxRuptures_=new HashSet<Integer>(); public ProfilContainerAdapter(BiefContainer _biefContainer) { biefContainer_=_biefContainer; biefContainer_.addBiefContainerListener(this); } + public boolean isRupturePoint(int _idx) { + if(_idx<0||_idx>=getNbPoint()) + throw new IllegalArgumentException(FudaaLib.getS("_idx d'appartient pas au profil.")); + return idxRuptures_.contains(_idx); + } + /** * Change le profil selectionn\xE9. * @throws DataGeometryException @@ -202,7 +225,7 @@ * Permet de choisir la g\xE9om\xE9trie sur lequel l'instance va travailler. * Hypoth\xE8se importante : les points de la g\xE9om\xE9tries sont correctement * ordonn\xE9s (les points sont ordonn\xE9s en ordre croissant de leur abscisse - * curviligne). La veracit\xE9 de cette hypoth\xE8se n'est PAS v\xE9rifi\xE9 dans setData. + * curviligne). La veracit\xE9 de cette hypoth\xE8se n'est PAS v\xE9rifi\xE9 dans updateData. * * @param _zone la zone contenant la g\xE9om\xE9trie * @param _idxGeom l'indice de la g\xE9om\xE9trie dans _zone @@ -213,6 +236,7 @@ z_=null; curv_=null; curviligneDecalage_=0; + idxRuptures_.clear(); } else if (biefContainer_.getZoneProfils()!=null&&idxProfilSelected_>=0&&idxProfilSelected_<biefContainer_.getZoneProfils().getNbGeometries()&&biefContainer_.getZoneProfils().getAttributeIsZ()!=null) { try { @@ -249,11 +273,8 @@ throw new ProfilContainerException(FudaaLib.getS("Le profil se coupe lui m\xEAme. Il n'est donc pas valide.")); } - // / D\xE9termination des points de ruptures et verification qu'il y en a - // au maximun deux. \\\ - idxRupture1_=-1; - idxRupture2_=-1; - double upsilon=0.0001; // Marge d'erreur des calculs sur double + /// D\xE9termination des points de ruptures. \\\ + idxRuptures_.clear(); double coefDirecteur=0; // coefDirX : Indique si le coefficient directeur est calcul\xE9 sur les x // ou sur les y (au d\xE9nominateur). @@ -288,18 +309,22 @@ newCoefDirecteur=0; } // D\xE9tection des ruptures - if (coefDirX!=newCoefDirX||Math.abs(coefDirecteur-newCoefDirecteur)>upsilon) { - if (idxRupture1_==-1) - idxRupture1_=idx-1; - else if (idxRupture2_==-1) - idxRupture2_=idx-1; - else - throw new ProfilContainerException(FudaaLib.getS("Il y a plus que deux ruptures dans le profil.")); - } + if (coefDirX!=newCoefDirX||Math.abs(coefDirecteur-newCoefDirecteur)>tolerance_) + idxRuptures_.add(idx-1); // Pr\xE9paration de l'it\xE9ration suivante coefDirecteur=newCoefDirecteur; coefDirX=newCoefDirX; } + // Lin\xE9arisation du profil + if(idxRuptures_.size()>0) { + int[] idxRuptures=new int[idxRuptures_.size()+2]; + idxRuptures[0]=0; + Iterator<Integer> it=idxRuptures_.iterator(); + for(int i=0;i<idxRuptures_.size();i++) + idxRuptures[i+1]=it.next(); + idxRuptures[idxRuptures.length-1]=seq.size()-1; + LibUtils.linearisePolyligne(biefContainer_.getZoneProfils(), idxProfilSelected_, idxRuptures, null); + } } catch(ProfilContainerException _exp) { // Remise dans un \xE9tat coh\xE9rent @@ -307,6 +332,7 @@ z_=null; curv_=null; curviligneDecalage_=0; + idxRuptures_.clear(); fireProfilContainerDataModified(); // Propagation de l'exception throw _exp; @@ -701,18 +727,18 @@ * m\xEAme raison. Pour ne pas trop perdre en performance, seuls les * coordonn\xE9es modifi\xE9es sont clon\xE9es. */ - // Les nouvelles valeurs du points \xE0 d\xE9placer - double newX; - double newY; - // Delta pour savoir si des doubles sont \xE9gaux - double tolerance=0.000001; +// // Les nouvelles valeurs du points \xE0 d\xE9placer +// double newX; +// double newY; +// // Delta pour savoir si des doubles sont \xE9gaux +// double tolerance=0.000001; // Verifie que le point reste encadr\xE9 par le(s) m\xEAme(s) point(s) if((_idxPoint==0&&_value>=curv_.get(1))||(_idxPoint==seq.size()-1&&_value<=curv_.get(seq.size()-2))||(_idxPoint!=0&&_idxPoint!=seq.size()-1&&(_value<=curv_.get(_idxPoint-1)||_value>=curv_.get(_idxPoint+1)))) throw new ProfilContainerException(FudaaLib.getS("Il est interdit de d\xE9placer un point au dela des points l'encadrant.")); // Cas o\xF9 l'index n'est pas sur un point de rupture \\ - if (_idxPoint!=idxRupture1_&&_idxPoint!=idxRupture2_) { + if (!idxRuptures_.contains(_idxPoint)) { // Le point reste encadr\xE9 par les deux m\xEAme points => le signe de xa-xb et // de ya-yb ne change pas Coordinate newCoord=UtilsProfil1d.getCoordinateXY(seq, _value); @@ -726,202 +752,202 @@ curv_.set(_idxPoint, _value); } - // Cas complexe : l'index est sur un point de rupture \\ - else { - /* - * Abstract : - * Pour trouver le point restectant la concervation de labcisse curviligne, est - * utilis\xE9 par la suite une m\xE9thode d'intersection de deux cercles. - * - Soient A, B, C, trois points non confondus. Soit la polyligne A, C, B. - * On veut construire C' tq cruv(C')=c et que curv(B) reste constant. - * Donc : - * dist(AC)+dist(CB)=dist(AC')+dist(C'B) - * Ce probl\xE8me peut se r\xE9duire \xE0 la recherche de l'intersection de deux cercles : - * C1=cercle(centre=A, rayon=c-curv(A)) avec C2=cercle(centre=B, rayon=curv(B)-c) - * - * Cas 1 : ya-yb != 0: - * La r\xE9solution de ce probl\xE8me donne l'\xE9quation : - * x\xB2[M\xB2+1] + x[2yaM-2NM-2xa] + xa\xB2+ya\xB2+N\xB2-rayonC1\xB2-2yaN=0 - * avec N=(rayonC2\xB2-rayonC1\xB2-xb\xB2+xa\xB2-yb\xB2+ya\xB2)/(2(ya-yb)) - * et M=(xa-xb)/(ya-yb) - * C'est une \xE9quation du second degr\xE9. - * Pour la r\xE9solution de l'\xE9quation, nous nommerons : - * equA=[M\xB2+1] - * equB=[2yaM-2NM-2xa] - * equC=xa\xB2+ya\xB2+N\xB2-rayonC1\xB2-2yaN - * La r\xE9solution de l'\xE9quation r\xE9sultante donne deux solutions (c1' et c2'). - * Pour trouver celle qui nous interesse (si elle existe) la contrainte suivante doit \xEAtre v\xE9rifi\xE9e : - * vecteurNorm\xE9(C, Proj(C, AB)) = vecteurNorm\xE9(CX', Proj(CX', AB)) - * A noter que Proj(C1', AB)=Proj(C2', AB) de plus pour simplifier cette r\xE9solution sera faite sur z=0. - * - * Cas 2 : ya-yb = 0 et xa-xb != 0: - * La r\xE9solution de ce prol\xE8me donne l'\xE9quation : - * y\xB2-2yay+xa+K\xB2-2xaK-rayonC1\xB2=0 - * avec K=(rayonC2\xB2-rayonC1\xB2-xb\xB2+xa\xB2)/(2*(xa-xb)) - * # k est \xE9galement la valeur de x des deux solutions potentielles - * C'est un \xE9quation du second degr\xE9. - * Pour la r\xE9solution de l'aquation, nous nommerons : - * equA=1 - * equB=2ya - * equC=K\xB2-2xaK-rayonC1\xB2 - * La r\xE9solution de l'\xE9quation r\xE9sultante donne deux solutions (c1' et c2'). - * Pour trouver celle qui nous interesse (si elle existe) la contrainte suivante doit \xEAtre v\xE9rifi\xE9e : - * vecteurNorm\xE9(C, Proj(C, AB)) = vecteurNorm\xE9(CX', Proj(CX', AB)) - * A noter que Proj(C1', AB)=Proj(C2', AB) de plus pour simplifier cette r\xE9solution sera faite sur z=0. - * - * Cas 3 : ya-yb = 0 et xa-xb=0: - * quel qu'en soit le r\xE9sultat, c'est incoh\xE9rent pour notre contexte. - * - * De plus on verifie que le r\xE9sultat ne provoque pas de croisement avec les autres axes - * du profil. - * - * Une fois ce point trouv\xE9, on va \xE9galement d\xE9placer tous les points des deux axes adjacents, - * pour que le profil concerve sa forme g\xE9n\xE9rale. Ce r\xE9aligement se faire en concervant les - * abscisses curvilignes de chacun des points. - * Pour y parvenir le nouveau coefficient directeur des axes est calcul\xE9 et appliqu\xE9 au rapport de - * l'abcisse curviligne avec l'abscisse du point extr\xE9mit\xE9 de l'axe. - * - * Derni\xE8re petite note pour la fin, le cas dit 'simple' pr\xE9c\xE9dent - * (d\xE9placement d'un point qui n'est pas un point de rupture) n'est qu'un - * cas particulier de la r\xE9solution ci dessus (la solution de l'\xE9quation - * du second degr\xE9 serait unique). On pourrait donc l'enlever, mais je pense que - * s\xE9parer ces deux cas ne fait pas de mal pour une \xE9ventuelle relecture - * et/ou modification de ce code. - */ - - // Application de la m\xE9thode d\xE9crite ci dessus \\ - - // Valuation des variables d'entr\xE9es n\xE9c\xE9ssaires - final int idxPtdeb=_idxPoint==idxRupture1_?0:idxRupture1_; - final int idxPtFin=_idxPoint==idxRupture2_||idxRupture2_==-1?seq.size()-1:idxRupture2_; - final Coordinate a=seq.getCoordinate(idxPtdeb); - final Coordinate b=seq.getCoordinate(idxPtFin); - final Coordinate c=seq.getCoordinate(_idxPoint); - final double rayonC1=_value-curv_.get(idxPtdeb); - final double rayonC2=curv_.get(idxPtFin)-_value; - // Solutions - double x1; - double y1; - double x2; - double y2; - // Cas 1 - if(Math.abs(a.y-b.y)>tolerance){ - // Variables interm\xE9diaires - double n=(rayonC2*rayonC2-rayonC1*rayonC1-b.x*b.x+a.x*a.x-b.y*b.y+a.y*a.y)/(2*(a.y-b.y)); - double m=(a.x-b.x)/(a.y-b.y); - double equA=m*m+1; - double equB=2*(a.y*m-n*m-a.x); - double equC=a.x*a.x+a.y*a.y+n*n-rayonC1*rayonC1-2*a.y*n; - // Variables de r\xE9solution - double deltaTmp=equB*equB-4*equA*equC; - if(deltaTmp<0) - throw new ProfilContainerException(FudaaLib.getS("Ce d\xE9placement n'est pas possible sans violer la contrainte de constance de la longueur du profil.")); - double delta=Math.sqrt(equB*equB-4*equA*equC); - x1=(-equB+delta)/(2*equA); - y1=n-x1*m; - x2=(-equB-delta)/(2*equA); - y2=n-x2*m; - } - // Cas 2 - else if(Math.abs(a.x-b.x)>tolerance){ - // Variables interm\xE9diaires - double k=(rayonC2*rayonC2-rayonC1*rayonC1-b.x*b.x+a.x*a.x)/(2*(a.x-b.x)); - double equA=1; - double equB=2*a.y; - double equC=k*k-2*a.x*k-rayonC1*rayonC1; - // Variables de r\xE9solution - double deltaTmp=equB*equB-4*equA*equC; - if(deltaTmp<0) - throw new ProfilContainerException(FudaaLib.getS("Ce d\xE9placement n'est pas possible sans violer la contrainte de constance de la longueur du profil.")); - double delta=Math.sqrt(equB*equB-4*equA*equC); - y1=(-equB+delta)/(2*equA); - x1=k; - y2=(-equB-delta)/(2*equA); - x2=k; - } - // Cas 3 - else - throw new ProfilContainerException(FudaaLib.getS("Ce d\xE9placement n'est pas valide. Ce cas ne devrait jamais arriver. CSI_1")); - // Recherche du r\xE9sultat nous interessant dans ce cas ci - Coordinate aZ0=new Coordinate(a.x, a.y, 0); - Coordinate bZ0=new Coordinate(b.x, b.y, 0); - Coordinate cZ0=new Coordinate(c.x, c.y, 0); - Coordinate vecReference=UtilsProfil1d.vec(cZ0, UtilsProfil1d.proj(cZ0, aZ0, bZ0)); - Coordinate cProj=UtilsProfil1d.proj(new Coordinate(x1, y1, 0), aZ0, bZ0); - assert(UtilsProfil1d.egal(cProj, UtilsProfil1d.proj(new Coordinate(x2, y2, 0), aZ0, bZ0), 0.0001, false)); - if(UtilsProfil1d.egal(vecReference, UtilsProfil1d.vec(new Coordinate(x1, y1, 0), cProj), 0.0001, true)){ - newX=x1; - newY=y1; - } - else if(UtilsProfil1d.egal(vecReference, UtilsProfil1d.vec(new Coordinate(x2, y2, 0), cProj), 0.0001, true)) { - newX=x2; - newY=y2; - } - else - throw new ProfilContainerException(FudaaLib.getS("Ce d\xE9placement n'est pas valide. Ce cas ne devrait jamais arriver. CSI_2")); - - // Verifie que le point trouv\xE9 ne coupe pas un autre axe du profil \\ - boolean noCut=true; - Coordinate newP=new Coordinate(newX, newY); - GISPolyligne axe1=GISGeometryFactory.INSTANCE.createLineString(new Coordinate[]{a, newP}); - GISPolyligne axe2=GISGeometryFactory.INSTANCE.createLineString(new Coordinate[]{newP, b}); - if(idxPtdeb>0) { - /* - * Test de croisement entre les deux axes modifi\xE9s et l'axe avant. l'axe - * a, newP a normalement un point d'intersectino (a). - */ - GISPolyligne axeTest=GISGeometryFactory.INSTANCE.createLineString(new Coordinate[]{new Coordinate(coords[0]), new Coordinate(coords[idxPtdeb])}); - noCut=axe1.intersection(axeTest).getNumPoints()==1; - noCut=noCut&&!axe2.intersects(axeTest); - } - if(idxPtFin<seq.size()-1) { - /* - * Test de croisement entre les deux axes modifi\xE9s et l'axe avant. l'axe - * newP, b a normalement un point d'intersectino (b). - */ - GISPolyligne axeTest=GISGeometryFactory.INSTANCE.createLineString(new Coordinate[]{new Coordinate(coords[idxPtFin]), new Coordinate(coords[coords.length-1])}); - noCut=noCut&&axe2.intersection(axeTest).getNumPoints()==1; - noCut=noCut&&!axe1.intersects(axeTest); - } - // Traitement de l'\xE9ventuelle d\xE9tection d'un croisement - if(!noCut) - throw new ProfilContainerException(FudaaLib.getS("Ce d\xE9placement est impossible sans obtenir un profil dont des axes se coupent.")); - // Enregistrement du nouveau point C' et de la nouvelle valeur curviligne - coords[_idxPoint]=new Coordinate(newX, newY, coords[_idxPoint].z); - // Mise a jour de la table des valeurs curvilignes - curv_.set(_idxPoint, _value); - - // R\xE9alignement des points des axes adjacents \\ - for(int inc=0;inc<2;inc++){ - // D\xE9termination des points de d\xE9but et de fin d'axe - int idxDeb; - int idxFin; - if(inc==0) { // premi\xE8re it\xE9ration, axe : debut, C' - idxDeb=_idxPoint==idxRupture1_?0:idxRupture1_; - idxFin=_idxPoint; - } - else { // seconde it\xE9ration, axe : C', fin - idxDeb=_idxPoint; - idxFin=_idxPoint==idxRupture2_||idxRupture2_==-1 ? seq.size()-1:idxRupture2_; - } - // R\xE9alignement sur l'axe - if (Math.abs(coords[idxFin].x-coords[idxDeb].x)>tolerance) { - double sign=Math.signum(coords[idxFin].x-coords[idxDeb].x); - double newCoefDirecteur=(coords[idxFin].y-coords[idxDeb].y)/(coords[idxFin].x-coords[idxDeb].x); - for (int i=idxDeb+1; i<idxFin; i++) { - coords[i]=new Coordinate(0, 0, coords[i].z); - coords[i].x=coords[idxDeb].x+sign*(curv_.get(i)-curv_.get(idxDeb))/Math.sqrt(1+newCoefDirecteur*newCoefDirecteur); - coords[i].y=coords[idxDeb].y+newCoefDirecteur*(coords[i].x-coords[idxDeb].x); - } - } - else { // Cas du bout de profil vertical - double sign=Math.signum(coords[idxFin].y-coords[idxDeb].y); - for (int i=idxDeb+1; i<idxFin; i++) - coords[i]=new Coordinate(coords[idxDeb].x, coords[idxDeb].y+sign*(curv_.get(i)-curv_.get(idxDeb)), - coords[i].z); - } - } - } +// // Cas complexe : l'index est sur un point de rupture \\ +// else { +// /* +// * Abstract : +// * Pour trouver le point restectant la concervation de labcisse curviligne, est +// * utilis\xE9 par la suite une m\xE9thode d'intersection de deux cercles. +// * - Soient A, B, C, trois points non confondus. Soit la polyligne A, C, B. +// * On veut construire C' tq cruv(C')=c et que curv(B) reste constant. +// * Donc : +// * dist(AC)+dist(CB)=dist(AC')+dist(C'B) +// * Ce probl\xE8me peut se r\xE9duire \xE0 la recherche de l'intersection de deux cercles : +// * C1=cercle(centre=A, rayon=c-curv(A)) avec C2=cercle(centre=B, rayon=curv(B)-c) +// * +// * Cas 1 : ya-yb != 0: +// * La r\xE9solution de ce probl\xE8me donne l'\xE9quation : +// * x\xB2[M\xB2+1] + x[2yaM-2NM-2xa] + xa\xB2+ya\xB2+N\xB2-rayonC1\xB2-2yaN=0 +// * avec N=(rayonC2\xB2-rayonC1\xB2-xb\xB2+xa\xB2-yb\xB2+ya\xB2)/(2(ya-yb)) +// * et M=(xa-xb)/(ya-yb) +// * C'est une \xE9quation du second degr\xE9. +// * Pour la r\xE9solution de l'\xE9quation, nous nommerons : +// * equA=[M\xB2+1] +// * equB=[2yaM-2NM-2xa] +// * equC=xa\xB2+ya\xB2+N\xB2-rayonC1\xB2-2yaN +// * La r\xE9solution de l'\xE9quation r\xE9sultante donne deux solutions (c1' et c2'). +// * Pour trouver celle qui nous interesse (si elle existe) la contrainte suivante doit \xEAtre v\xE9rifi\xE9e : +// * vecteurNorm\xE9(C, Proj(C, AB)) = vecteurNorm\xE9(CX', Proj(CX', AB)) +// * A noter que Proj(C1', AB)=Proj(C2', AB) de plus pour simplifier cette r\xE9solution sera faite sur z=0. +// * +// * Cas 2 : ya-yb = 0 et xa-xb != 0: +// * La r\xE9solution de ce prol\xE8me donne l'\xE9quation : +// * y\xB2-2yay+xa+K\xB2-2xaK-rayonC1\xB2=0 +// * avec K=(rayonC2\xB2-rayonC1\xB2-xb\xB2+xa\xB2)/(2*(xa-xb)) +// * # k est \xE9galement la valeur de x des deux solutions potentielles +// * C'est un \xE9quation du second degr\xE9. +// * Pour la r\xE9solution de l'aquation, nous nommerons : +// * equA=1 +// * equB=2ya +// * equC=K\xB2-2xaK-rayonC1\xB2 +// * La r\xE9solution de l'\xE9quation r\xE9sultante donne deux solutions (c1' et c2'). +// * Pour trouver celle qui nous interesse (si elle existe) la contrainte suivante doit \xEAtre v\xE9rifi\xE9e : +// * vecteurNorm\xE9(C, Proj(C, AB)) = vecteurNorm\xE9(CX', Proj(CX', AB)) +// * A noter que Proj(C1', AB)=Proj(C2', AB) de plus pour simplifier cette r\xE9solution sera faite sur z=0. +// * +// * Cas 3 : ya-yb = 0 et xa-xb=0: +// * quel qu'en soit le r\xE9sultat, c'est incoh\xE9rent pour notre contexte. +// * +// * De plus on verifie que le r\xE9sultat ne provoque pas de croisement avec les autres axes +// * du profil. +// * +// * Une fois ce point trouv\xE9, on va \xE9galement d\xE9placer tous les points des deux axes adjacents, +// * pour que le profil concerve sa forme g\xE9n\xE9rale. Ce r\xE9aligement se faire en concervant les +// * abscisses curvilignes de chacun des points. +// * Pour y parvenir le nouveau coefficient directeur des axes est calcul\xE9 et appliqu\xE9 au rapport de +// * l'abcisse curviligne avec l'abscisse du point extr\xE9mit\xE9 de l'axe. +// * +// * Derni\xE8re petite note pour la fin, le cas dit 'simple' pr\xE9c\xE9dent +// * (d\xE9placement d'un point qui n'est pas un point de rupture) n'est qu'un +// * cas particulier de la r\xE9solution ci dessus (la solution de l'\xE9quation +// * du second degr\xE9 serait unique). On pourrait donc l'enlever, mais je pense que +// * s\xE9parer ces deux cas ne fait pas de mal pour une \xE9ventuelle relecture +// * et/ou modification de ce code. +// */ +// +// // Application de la m\xE9thode d\xE9crite ci dessus \\ +// +// // Valuation des variables d'entr\xE9es n\xE9c\xE9ssaires +// final int idxPtdeb=_idxPoint==idxRupture1_?0:idxRupture1_; +// final int idxPtFin=_idxPoint==idxRupture2_||idxRupture2_==-1?seq.size()-1:idxRupture2_; +// final Coordinate a=seq.getCoordinate(idxPtdeb); +// final Coordinate b=seq.getCoordinate(idxPtFin); +// final Coordinate c=seq.getCoordinate(_idxPoint); +// final double rayonC1=_value-curv_.get(idxPtdeb); +// final double rayonC2=curv_.get(idxPtFin)-_value; +// // Solutions +// double x1; +// double y1; +// double x2; +// double y2; +// // Cas 1 +// if(Math.abs(a.y-b.y)>tolerance){ +// // Variables interm\xE9diaires +// double n=(rayonC2*rayonC2-rayonC1*rayonC1-b.x*b.x+a.x*a.x-b.y*b.y+a.y*a.y)/(2*(a.y-b.y)); +// double m=(a.x-b.x)/(a.y-b.y); +// double equA=m*m+1; +// double equB=2*(a.y*m-n*m-a.x); +// double equC=a.x*a.x+a.y*a.y+n*n-rayonC1*rayonC1-2*a.y*n; +// // Variables de r\xE9solution +// double deltaTmp=equB*equB-4*equA*equC; +// if(deltaTmp<0) +// throw new ProfilContainerException(FudaaLib.getS("Ce d\xE9placement n'est pas possible sans violer la contrainte de constance de la longueur du profil.")); +// double delta=Math.sqrt(equB*equB-4*equA*equC); +// x1=(-equB+delta)/(2*equA); +// y1=n-x1*m; +// x2=(-equB-delta)/(2*equA); +// y2=n-x2*m; +// } +// // Cas 2 +// else if(Math.abs(a.x-b.x)>tolerance){ +// // Variables interm\xE9diaires +// double k=(rayonC2*rayonC2-rayonC1*rayonC1-b.x*b.x+a.x*a.x)/(2*(a.x-b.x)); +// double equA=1; +// double equB=2*a.y; +// double equC=k*k-2*a.x*k-rayonC1*rayonC1; +// // Variables de r\xE9solution +// double deltaTmp=equB*equB-4*equA*equC; +// if(deltaTmp<0) +// throw new ProfilContainerException(FudaaLib.getS("Ce d\xE9placement n'est pas possible sans violer la contrainte de constance de la longueur du profil.")); +// double delta=Math.sqrt(equB*equB-4*equA*equC); +// y1=(-equB+delta)/(2*equA); +// x1=k; +// y2=(-equB-delta)/(2*equA); +// x2=k; +// } +// // Cas 3 +// else +// throw new ProfilContainerException(FudaaLib.getS("Ce d\xE9placement n'est pas valide. Ce cas ne devrait jamais arriver. CSI_1")); +// // Recherche du r\xE9sultat nous interessant dans ce cas ci +// Coordinate aZ0=new Coordinate(a.x, a.y, 0); +// Coordinate bZ0=new Coordinate(b.x, b.y, 0); +// Coordinate cZ0=new Coordinate(c.x, c.y, 0); +// Coordinate vecReference=UtilsProfil1d.vec(cZ0, UtilsProfil1d.proj(cZ0, aZ0, bZ0)); +// Coordinate cProj=UtilsProfil1d.proj(new Coordinate(x1, y1, 0), aZ0, bZ0); +// assert(UtilsProfil1d.egal(cProj, UtilsProfil1d.proj(new Coordinate(x2, y2, 0), aZ0, bZ0), 0.0001, false)); +// if(UtilsProfil1d.egal(vecReference, UtilsProfil1d.vec(new Coordinate(x1, y1, 0), cProj), 0.0001, true)){ +// newX=x1; +// newY=y1; +// } +// else if(UtilsProfil1d.egal(vecReference, UtilsProfil1d.vec(new Coordinate(x2, y2, 0), cProj), 0.0001, true)) { +// newX=x2; +// newY=y2; +// } +// else +// throw new ProfilContainerException(FudaaLib.getS("Ce d\xE9placement n'est pas valide. Ce cas ne devrait jamais arriver. CSI_2")); +// +// // Verifie que le point trouv\xE9 ne coupe pas un autre axe du profil \\ +// boolean noCut=true; +// Coordinate newP=new Coordinate(newX, newY); +// GISPolyligne axe1=GISGeometryFactory.INSTANCE.createLineString(new Coordinate[]{a, newP}); +// GISPolyligne axe2=GISGeometryFactory.INSTANCE.createLineString(new Coordinate[]{newP, b}); +// if(idxPtdeb>0) { +// /* +// * Test de croisement entre les deux axes modifi\xE9s et l'axe avant. l'axe +// * a, newP a normalement un point d'intersectino (a). +// */ +// GISPolyligne axeTest=GISGeometryFactory.INSTANCE.createLineString(new Coordinate[]{new Coordinate(coords[0]), new Coordinate(coords[idxPtdeb])}); +// noCut=axe1.intersection(axeTest).getNumPoints()==1; +// noCut=noCut&&!axe2.intersects(axeTest); +// } +// if(idxPtFin<seq.size()-1) { +// /* +// * Test de croisement entre les deux axes modifi\xE9s et l'axe avant. l'axe +// * newP, b a normalement un point d'intersectino (b). +// */ +// GISPolyligne axeTest=GISGeometryFactory.INSTANCE.createLineString(new Coordinate[]{new Coordinate(coords[idxPtFin]), new Coordinate(coords[coords.length-1])}); +// noCut=noCut&&axe2.intersection(axeTest).getNumPoints()==1; +// noCut=noCut&&!axe1.intersects(axeTest); +// } +// // Traitement de l'\xE9ventuelle d\xE9tection d'un croisement +// if(!noCut) +// throw new ProfilContainerException(FudaaLib.getS("Ce d\xE9placement est impossible sans obtenir un profil dont des axes se coupent.")); +// // Enregistrement du nouveau point C' et de la nouvelle valeur curviligne +// coords[_idxPoint]=new Coordinate(newX, newY, coords[_idxPoint].z); +// // Mise a jour de la table des valeurs curvilignes +// curv_.set(_idxPoint, _value); +// +// // R\xE9alignement des points des axes adjacents \\ +// for(int inc=0;inc<2;inc++){ +// // D\xE9termination des points de d\xE9but et de fin d'axe +// int idxDeb; +// int idxFin; +// if(inc==0) { // premi\xE8re it\xE9ration, axe : debut, C' +// idxDeb=_idxPoint==idxRupture1_?0:idxRupture1_; +// idxFin=_idxPoint; +// } +// else { // seconde it\xE9ration, axe : C', fin +// idxDeb=_idxPoint; +// idxFin=_idxPoint==idxRupture2_||idxRupture2_==-1 ? seq.size()-1:idxRupture2_; +// } +// // R\xE9alignement sur l'axe +// if (Math.abs(coords[idxFin].x-coords[idxDeb].x)>tolerance) { +// double sign=Math.signum(coords[idxFin].x-coords[idxDeb].x); +// double newCoefDirecteur=(coords[idxFin].y-coords[idxDeb].y)/(coords[idxFin].x-coords[idxDeb].x); +// for (int i=idxDeb+1; i<idxFin; i++) { +// coords[i]=new Coordinate(0, 0, coords[i].z); +// coords[i].x=coords[idxDeb].x+sign*(curv_.get(i)-curv_.get(idxDeb))/Math.sqrt(1+newCoefDirecteur*newCoefDirecteur); +// coords[i].y=coords[idxDeb].y+newCoefDirecteur*(coords[i].x-coords[idxDeb].x); +// } +// } +// else { // Cas du bout de profil vertical +// double sign=Math.signum(coords[idxFin].y-coords[idxDeb].y); +// for (int i=idxDeb+1; i<idxFin; i++) +// coords[i]=new Coordinate(coords[idxDeb].x, coords[idxDeb].y+sign*(curv_.get(i)-curv_.get(idxDeb)), +// coords[i].z); +// } +// } +// } CtuluCommandComposite cmd=new CtuluCommandComposite("Changement abs. curviligne"); // Enregistrement des nouvelles coordonn\xE9es \\ biefContainer_.getZoneProfils().setCoordinateSequence(idxProfilSelected_, GISGeometryFactory.INSTANCE.getCoordinateSequenceFactory().create(coords), cmd); Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/VueTableau.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/VueTableau.java 2009-01-30 15:11:50 UTC (rev 4429) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/VueTableau.java 2009-01-30 17:09:25 UTC (rev 4430) @@ -112,7 +112,7 @@ if(column==0) return false; else - return true; + return !data_.isRupturePoint(row); } public Class<?> getColumnClass(int columnIndex) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <emm...@us...> - 2009-01-30 15:11:58
|
Revision: 4429 http://fudaa.svn.sourceforge.net/fudaa/?rev=4429&view=rev Author: emmanuel_martin Date: 2009-01-30 15:11:50 +0000 (Fri, 30 Jan 2009) Log Message: ----------- Tache #176 : "Modifier la commande "rendre rectiligne des polylignes" pour qu'elle puisse rendre rectiligne des portions de segments." Modified Paths: -------------- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlSceneEditor.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/action/SceneLinearisePolyligneAction.java Added Paths: ----------- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/LibUtils.java Added: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/LibUtils.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/LibUtils.java (rev 0) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/LibUtils.java 2009-01-30 15:11:50 UTC (rev 4429) @@ -0,0 +1,175 @@ +/* + * @creation 30 janv. 2009 + * @modification $Date:$ + * @license GNU General Public License 2 + * @copyright (c)1998-2009 CETMEF 2 bd Gambetta F-60231 Compiegne + * @mail fud...@li... + */ +package org.fudaa.fudaa.modeleur; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import org.fudaa.ctulu.CtuluCommandComposite; +import org.fudaa.ctulu.CtuluCommandContainer; +import org.fudaa.ctulu.collection.CtuluCollection; +import org.fudaa.ctulu.gis.GISAttributeInterface; +import org.fudaa.ctulu.gis.GISAttributeModel; +import org.fudaa.ctulu.gis.GISGeometryFactory; +import org.fudaa.ctulu.gis.GISPolyligne; +import org.fudaa.ctulu.gis.GISZoneCollectionLigneBrisee; +import org.fudaa.ebli.geometrie.GrPoint; +import org.fudaa.ebli.geometrie.GrVecteur; + +import com.vividsolutions.jts.geom.Coordinate; + +/** + * Quelques m\xE9thodes utiles et ind\xE9dendantes. + * @author Emmanuel MARTIN + * @version $Id:$ + */ +public class LibUtils { + + /** + * Rend rectiligne un morceau d'une polyligne. + * _idxPoints doit contenir au moins deux index de point. + * + * Si plus de deux points sont selectionn\xE9s dans la g\xE9om\xE9trie (exemple idx : + * 0, 3 et 4), on iterre sur les points selectionn\xE9s deux \xE0 deux (donc 0 et 3 + * puis 3 et 4) pour chacune de ces it\xE9rations on projete sur le segment les + * points dont les indices sont entre les deux trait\xE9s (premi\xE8re it\xE9ration : + * projection du point 2, aucun pour la seconde). si la projection d'un point + * n'appartient pas au segment, il est ignor\xE9. + */ + @SuppressWarnings("unchecked") + static public void linearisePolyligne(GISZoneCollectionLigneBrisee _zone, int _idxGeom, int[] _idxPoints, CtuluCommandContainer _cmd) { + if(_zone==null||_idxPoints==null) + throw new IllegalArgumentException("_zone et _idxPoints ne doivent pas \xEAtre null."); + if(_idxGeom<0||_idxGeom>=_zone.getNbGeometries()) + throw new IllegalArgumentException("_idxGeom n'appartient pas \xE0 _zone."); + if(_idxPoints.length<2) + throw new IllegalArgumentException("Il doit y avoir au moins deux points selectionn\xE9s."); + for(int i=0;i<_idxPoints.length;i++) + if(_idxPoints[i]<0||_idxPoints[i]>=_zone.getGeometry(_idxGeom).getNumPoints()) + throw new IllegalArgumentException("Au moins un des index de _idxPoints est invalide."); + + /** Class contenant les infromations relatives \xE0 une coordonn\xE9s projet\xE9e. */ + class PointProj implements Comparable<PointProj> { + public Coordinate c; // Coordonn\xE9 projet\xE9e + public double indiceCurviligne; // Indice Curviligne (k tq k*VecDirecteur=Vec(PtOrigine, c)) + public List<Object> data=new ArrayList<Object>(); // valeur des attributs atomiques + /** M\xE9thode pour utiliser les alorithmes de tris fournis par java. */ + public int compareTo(PointProj o) { + if (indiceCurviligne<o.indiceCurviligne) + return -1; + else if (indiceCurviligne==o.indiceCurviligne) + return 0; + else + return 1; + } + } + CtuluCommandComposite cmd=new CtuluCommandComposite(); + // Pour chaque polyligne selectionn\xE9es + GISPolyligne polyligne=(GISPolyligne)_zone.getGeometry(_idxGeom); + List<Coordinate> newCoords=new ArrayList<Coordinate>(polyligne.getNumPoints()); + for (int j=0; j<polyligne.getNumPoints(); j++) + newCoords.add(polyligne.getCoordinateN(j)); + + // Tableau contenant les valeurs d'attributs de la g\xE9om\xE9trie (les atomiques + // sont dupliqu\xE9s) + Object[] newData=new Object[_zone.getNbAttributes()]; + for (int j=0; j<_zone.getNbAttributes(); j++) + if (_zone.getAttribute(j).isAtomicValue()) { + Object[] values=((GISAttributeModel)_zone.getDataModel(j).getObjectValueAt(_idxGeom)).getObjectValues(); + List<Object> lst=new ArrayList<Object>(values.length); + for (int k=0; k<values.length; k++) + lst.add(values[k]); + newData[j]=lst; + } + else + newData[j]=_zone.getDataModel(j).getObjectValueAt(_idxGeom); + /* + * Si plus d'un point est selectionn\xE9 dans la g\xE9om\xE9trie (exemple idx : + * 0, 3 et 4), on iterre sur les points selectionn\xE9s deux \xE0 deux (donc 0 + * et 3 puis 3 et 4) pour chacune de ces it\xE9rations on projete sur le + * segment les points dont les indices sont entre les deux trait\xE9s + * (premi\xE8re it\xE9ration : projection du point 2, aucun pour la seconde). + * si la projection d'un point n'appartient pas au segment, il est + * ignor\xE9. + * Sinon on utilise le premier et le dernier point de la + * polyligne comme destination de la projection. pt1 et pt2 sont ces + * deux points de r\xE9f\xE9rence. + */ + // Couples contients les couples d'indices \xE0 traiter. + Arrays.sort(_idxPoints); + int[][] couples; + couples=new int[_idxPoints.length-1][]; + for (int j=0; j<couples.length; j++) + couples[j]=new int[]{_idxPoints[j], _idxPoints[j+1]}; + // Iterration sur chacun des couples d'index + for (int j=couples.length-1; j>=0; j--) { + int idx1=couples[j][0]; + int idx2=couples[j][1]; + assert (idx1<idx2); + GrPoint pt1=new GrPoint(newCoords.get(idx1)); + GrPoint pt2=new GrPoint(newCoords.get(idx2)); + + // Vecteur de la droite de destination + GrVecteur vecP1P2=new GrVecteur(pt2.x_-pt1.x_, pt2.y_-pt1.y_, pt2.z_-pt1.z_); + // Construction de l'ensemble des points modifi\xE9s \\ + List<PointProj> lstNewPtsCurv=new ArrayList<PointProj>(); + for (int k=1; k<idx2-idx1; k++) { + GrPoint a=new GrPoint(polyligne.getCoordinateSequence().getCoordinate(k+idx1)); + // Projection + GrVecteur vecP1A=new GrVecteur(a.x_-pt1.x_, a.y_-pt1.y_, a.z_-pt1.z_); + GrPoint p=pt1.addition(vecP1A.projection(vecP1P2)); + Coordinate cp=new Coordinate(p.x_, p.y_, p.z_); + // Remplissage des informations relatives au point calcul\xE9 + PointProj pointProj=new PointProj(); + pointProj.c=cp; + pointProj.indiceCurviligne=new GrVecteur(cp.x-pt1.x_, cp.y-pt1.y_, cp.z-pt1.z_).division(vecP1P2); + if (pointProj.indiceCurviligne>=0&&pointProj.indiceCurviligne<=1) { + for (int l=0; l<_zone.getNbAttributes(); l++) + if (_zone.getAttribute(l).isAtomicValue()) + pointProj.data.add(((CtuluCollection)_zone.getValue(l, _idxGeom)).getObjectValueAt(k+idx1)); + lstNewPtsCurv.add(pointProj); + } + } + PointProj[] newPtsCurv=new PointProj[lstNewPtsCurv.size()]; + newPtsCurv=lstNewPtsCurv.toArray(newPtsCurv); + // Tri des points en fonction de leur abcisse curviligne \\ + Arrays.sort(newPtsCurv); + // Enregistrement des coordonn\xE9s et suppression des points disparus + for (int k=newPtsCurv.length-1; k>=0; k--) + newCoords.set(k+idx1+1, newPtsCurv[k].c); + for (int k=idx2-1; k>idx1+newPtsCurv.length; k--) + newCoords.remove(k); + // R\xE9cup\xE9ration des values des attributs atomiques + int nemeAttAtomique=0; + for (int k=0; k<_zone.getNbAttributes(); k++) + if (_zone.getAttribute(k).isAtomicValue()) { + List<Object> lst=(List<Object>)newData[k]; + for (int l=newPtsCurv.length-1; l>=0; l--) + lst.set(l+idx1+1, newPtsCurv[l].data.get(nemeAttAtomique)); + for (int l=idx2-1; l>idx1+newPtsCurv.length; l--) + lst.remove(l+idx1); + nemeAttAtomique++; + } + } + // Remplacement de l'ancienne g\xE9om\xE9trie \\ + _zone.setGeometry(_idxGeom, GISGeometryFactory.INSTANCE.createLineString(newCoords.toArray(new Coordinate[0])), cmd); + for (int j=0; j<_zone.getNbAttributes(); j++) { + GISAttributeInterface attr=_zone.getAttribute(j); + if (attr.isAtomicValue()) { + Object[] values=((List<Object>)newData[j]).toArray(); + _zone.setAttributValue(j, _idxGeom, attr.createDataForGeom(values, values.length), cmd); + } + else + _zone.setAttributValue(j, _idxGeom, newData[j], cmd); + } + // Mise \xE0 jour du undo/redo + if (_cmd!=null) + _cmd.addCmd(cmd.getSimplify()); + } +} Property changes on: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/LibUtils.java ___________________________________________________________________ Added: svn:keywords + Id Added: svn:eol-style + native Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlSceneEditor.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlSceneEditor.java 2009-01-30 10:28:57 UTC (rev 4428) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlSceneEditor.java 2009-01-30 15:11:50 UTC (rev 4429) @@ -17,7 +17,6 @@ import org.fudaa.ctulu.CtuluCommandContainer; import org.fudaa.ctulu.CtuluListSelection; import org.fudaa.ctulu.CtuluListSelectionInterface; -import org.fudaa.ctulu.collection.CtuluCollection; import org.fudaa.ctulu.gis.GISAttributeConstants; import org.fudaa.ctulu.gis.GISAttributeInterface; import org.fudaa.ctulu.gis.GISAttributeModelDoubleArray; @@ -31,6 +30,7 @@ import org.fudaa.ctulu.gis.GISPolyligne; import org.fudaa.ctulu.gis.GISZoneCollection; import org.fudaa.ctulu.gis.GISZoneCollectionGeometry; +import org.fudaa.ctulu.gis.GISZoneCollectionLigneBrisee; import org.fudaa.ctulu.interpolation.InterpolationParameters; import org.fudaa.ctulu.interpolation.InterpolationResultsHolderI; import org.fudaa.ctulu.interpolation.InterpolationSupportGISAdapter; @@ -48,8 +48,6 @@ import org.fudaa.ebli.calque.edition.ZCalqueEditable; import org.fudaa.ebli.calque.edition.ZModeleEditable; import org.fudaa.ebli.calque.edition.ZSceneEditor; -import org.fudaa.ebli.geometrie.GrPoint; -import org.fudaa.ebli.geometrie.GrVecteur; import org.fudaa.fudaa.commun.FudaaLib; import org.fudaa.fudaa.modeleur.layer.MdlModel2dLine; import org.fudaa.fudaa.modeleur.layer.MdlModel2dMultiPoint; @@ -444,32 +442,8 @@ * Rend rectiligne une polyligne. */ public void linearisePolyligne() { - /** Class contenant les informations relativent \xE0 une polyligne. */ - class Poly { - public GISPolyligne poly; - public Object[] data; - public Poly(GISPolyligne _poly, Object[] _data) { - poly=_poly; - data=_data; - } - } - /** Class contenant les infromations relatives \xE0 une coordonn\xE9s projet\xE9e. */ - class PointProj implements Comparable<PointProj> { - public Coordinate c; // Coordonn\xE9 projet\xE9e - public double indiceCurviligne; // Indice Curviligne (k tq k*VecDirecteur=Vec(PtOrigine, c)) - public List<Object> data=new ArrayList<Object>(); // valeur des attributs atomiques - /** M\xE9thode pour utiliser les alorithmes de tris fournis par java. */ - public int compareTo(PointProj o) { - if (indiceCurviligne<o.indiceCurviligne) - return -1; - else if (indiceCurviligne==o.indiceCurviligne) - return 0; - else - return 1; - } - } + CtuluCommandComposite cmd=new CtuluCommandComposite(); int[] geoms=getScene().getSelectionHelper().getSelectedIndexes(); - Map<ZCalqueAffichageDonneesInterface, List<Poly>> newPoly=new HashMap<ZCalqueAffichageDonneesInterface, List<Poly>>(); // Verification de la selection \\ boolean selectionValid=true; int w=-1; @@ -478,87 +452,22 @@ if(selectionValid){ // Pour chaque polyligne selectionn\xE9es for (int i : geoms) { - GISPolyligne polyligne=((GISPolyligne)getScene().getObject(i)); + int idxGeom=getScene().sceneId2LayerId(i); + GISPolyligne polyligne=((GISPolyligne)getScene().getObject(idxGeom)); ZCalqueAffichageDonneesInterface calque=getScene().getLayerForId(i); - GISZoneCollection zone=((ZModeleEditable)calque.modeleDonnees()).getGeomData(); - /* - * Si deux points sont selectionn\xE9s dans cette polyligne, on les utilises - * comme destination de projection, sinon, ou si le nombre de point - * selectionn\xE9 n'est pas exactement deux, on utilise le premier et le - * dernier point de la polyligne comme destination de la projection. pt1 - * et pt2 sont ces deux points de r\xE9f\xE9rence. - */ - GrPoint pt1; - GrPoint pt2; - if (getScene().isAtomicMode()&&getScene().getLayerSelectionMulti().getSelection(i).getNbSelectedIndex()==2) { - pt1=new GrPoint(polyligne.getCoordinateSequence().getCoordinate(getScene().getLayerSelectionMulti().getSelection(i).getSelectedIndex()[0])); - pt2=new GrPoint(polyligne.getCoordinateSequence().getCoordinate(getScene().getLayerSelectionMulti().getSelection(i).getSelectedIndex()[1])); - } - else { - pt1=new GrPoint(polyligne.getCoordinateSequence().getCoordinate(0)); - pt2=new GrPoint(polyligne.getCoordinateSequence().getCoordinate(polyligne.getCoordinateSequence().size()-1)); - } - // Vecteur de la droite de destination - GrVecteur vecP1P2=new GrVecteur(pt2.x_-pt1.x_, pt2.y_-pt1.y_, pt2.z_-pt1.z_); - // Construction de l'ensemble des points composant la nouvelle polyligne \\ - PointProj[] newPtsCurv=new PointProj[polyligne.getCoordinateSequence().size()]; - for (int j=0; j<newPtsCurv.length; j++) { - GrPoint a=new GrPoint(polyligne.getCoordinateSequence().getCoordinate(j)); - // Projection - GrVecteur vecP1A=new GrVecteur(a.x_-pt1.x_, a.y_-pt1.y_, a.z_-pt1.z_); - GrPoint p=pt1.addition(vecP1A.projection(vecP1P2)); - Coordinate cp=new Coordinate(p.x_, p.y_, p.z_); - // Remplissage des informations relatives au point calcul\xE9 - newPtsCurv[j]=new PointProj(); - newPtsCurv[j].c=cp; - newPtsCurv[j].indiceCurviligne=new GrVecteur(cp.x-pt1.x_, cp.y-pt1.y_, cp.z-pt1.z_).division(vecP1P2); - for (int k=0; k<zone.getNbAttributes(); k++) - if (zone.getAttribute(k).isAtomicValue()) - newPtsCurv[j].data.add(((CtuluCollection)zone.getValue(k, getScene().sceneId2LayerId(i))).getObjectValueAt(j)); - } - // Tri des points en fonction de leur abcisse curviligne \\ - Arrays.sort(newPtsCurv); - // R\xE9cup\xE9ration des coordonn\xE9s - Coordinate[] newPts=new Coordinate[newPtsCurv.length]; - for (int j=0; j<newPts.length; j++) - newPts[j]=newPtsCurv[j].c; - // R\xE9cup\xE9ration des values des attributs atomiques - Object[] newData=new Object[zone.getNbAttributes()]; - int nemeAttAtomique=0; - for (int j=0; j<zone.getNbAttributes(); j++) { - if (zone.getAttribute(j).isAtomicValue()) { - Object[] values=new Object[newPtsCurv.length]; - for (int k=0; k<newPtsCurv.length; k++) - values[k]=newPtsCurv[k].data.get(nemeAttAtomique); - newData[j]=zone.getAttribute(j).createDataForGeom(values, newPtsCurv.length); - nemeAttAtomique++; - } - else - newData[j]=zone.getValue(j, getScene().sceneId2LayerId(i)); - } - // Ajout \xE0 la list des nouvelles polylignes \\ - if (!newPoly.containsKey(calque)) - newPoly.put(calque, new ArrayList<Poly>()); - newPoly.get(calque).add(new Poly(GISGeometryFactory.INSTANCE.createLineString(newPts), newData)); + GISZoneCollectionLigneBrisee zone=(GISZoneCollectionLigneBrisee) ((ZModeleEditable)calque.modeleDonnees()).getGeomData(); + + if (getScene().isAtomicMode()&&getScene().getLayerSelectionMulti().getSelection(i).getNbSelectedIndex()>1) + LibUtils.linearisePolyligne(zone, idxGeom, getScene().getLayerSelectionMulti().getSelection(i).getSelectedIndex(), cmd); + else + LibUtils.linearisePolyligne(zone, idxGeom, new int[]{0, polyligne.getNumPoints()-1}, cmd); } - CtuluCommandComposite cmd=new CtuluCommandComposite(); - // Destruction des anciennes polylignes - Arrays.sort(geoms); - for (int i=geoms.length-1; i>=0; i--) - ((ZModeleEditable)getScene().getLayerForId(geoms[i]).modeleDonnees()).getGeomData().removeGeometries(new int[]{getScene().sceneId2LayerId(geoms[i])}, cmd); - // Ajout des nouvelles polylignes - for (Map.Entry<ZCalqueAffichageDonneesInterface, List<Poly>> entry : newPoly.entrySet()) { - GISZoneCollection zone=((ZModeleEditable)((ZCalqueEditable)entry.getKey()).modeleDonnees()).getGeomData(); - List<Poly> polys=entry.getValue(); - for (int i=0; i<polys.size(); i++) - zone.addGeometry(polys.get(i).poly, polys.get(i).data, cmd); - } - // Mise \xE0 jour du undo/redo - if(mng_!=null) - mng_.addCmd(cmd.getSimplify()); - // Suppression de la selection - getScene().clearSelection(); } + // Mise \xE0 jour du undo/redo + if(mng_!=null) + mng_.addCmd(cmd.getSimplify()); + // Suppression de la selection + getScene().clearSelection(); } /** Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/action/SceneLinearisePolyligneAction.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/action/SceneLinearisePolyligneAction.java 2009-01-30 10:28:57 UTC (rev 4428) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/action/SceneLinearisePolyligneAction.java 2009-01-30 15:11:50 UTC (rev 4429) @@ -38,13 +38,13 @@ public String getEnableCondition() { return CtuluLib - .getS("<p>En mode sommet, s\xE9lectionner deux points pour chaque polyligne<p>En mode global, s\xE9lectionner une ou plusieurs polyligne(s)."); + .getS("<p>En mode sommet, s\xE9lectionner au moins deux points pour chaque polyligne<p>En mode global, s\xE9lectionner une ou plusieurs polyligne(s)."); } public void selectionChanged(ZSelectionEvent _evt) { ZScene scn=sceneEditor_.getScene(); // Au moins une et seulement des polylignes de selectionn\xE9es. Et si en mode - // atomique, deux sommets doivent \xEAtre selectionn\xE9s pour chacune d'entre + // atomique, deux sommets au moins doivent \xEAtre selectionn\xE9s pour chacune d'entre // elles. int[] geomSelected=scn.getSelectionHelper().getSelectedIndexes(); boolean b=geomSelected.length>0; @@ -52,7 +52,7 @@ while (b&&i<geomSelected.length) { b=scn.getObject(geomSelected[i]) instanceof GISPolyligne; if (scn.isAtomicMode()) - b=b&&scn.getLayerSelectionMulti()!=null&&scn.getLayerSelectionMulti().getSelection(geomSelected[i]).getNbSelectedIndex()==2; + b=b&&scn.getLayerSelectionMulti()!=null&&scn.getLayerSelectionMulti().getSelection(geomSelected[i]).getNbSelectedIndex()>=2; i++; } setEnabled(b); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <emm...@us...> - 2009-01-30 10:29:02
|
Revision: 4428 http://fudaa.svn.sourceforge.net/fudaa/?rev=4428&view=rev Author: emmanuel_martin Date: 2009-01-30 10:28:57 +0000 (Fri, 30 Jan 2009) Log Message: ----------- Tache #173 : "Export vers Rubar : Si selection d'un profil et export de tous les calques, message : "le nombre de points sur les lignes directrices doit ?\195?\170tre ?\195?\169gal au nombre de profils"" Modified Paths: -------------- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/sig/layer/FSigLayerFilter.java Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/sig/layer/FSigLayerFilter.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/sig/layer/FSigLayerFilter.java 2009-01-30 10:17:22 UTC (rev 4427) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/sig/layer/FSigLayerFilter.java 2009-01-30 10:28:57 UTC (rev 4428) @@ -72,10 +72,14 @@ final GISDataModel getCollect(final ZCalqueAffichageDonneesInterface _o) { GISZoneCollection zone = ((ZModeleGeometry) _o.modeleDonnees()).getGeomData(); zone.prepareExport(); - int[] idxAttributes=new int[zone.getNbAttributes()]; - for(int i=0;i<zone.getNbAttributes();i++) - idxAttributes[i]=i; - return new GISDataModelFilterAdapter(zone, idxAttributes, _o.getSelectedObjectInTable()); + if (onlySelectedGeometries_) { + int[] idxAttributes=new int[zone.getNbAttributes()]; + for (int i=0; i<zone.getNbAttributes(); i++) + idxAttributes[i]=i; + return new GISDataModelFilterAdapter(zone, idxAttributes, _o.getSelectedObjectInTable()); + } + else + return zone; } final GISDataModel getCollect(final Object _o) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <emm...@us...> - 2009-01-30 10:17:26
|
Revision: 4427 http://fudaa.svn.sourceforge.net/fudaa/?rev=4427&view=rev Author: emmanuel_martin Date: 2009-01-30 10:17:22 +0000 (Fri, 30 Jan 2009) Log Message: ----------- Tache #172 : "Profil raffin?\195?\169 2 fois de suite : les Z sont incorrectes" Modified Paths: -------------- branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISReprojectInterpolateur1D.java Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISReprojectInterpolateur1D.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISReprojectInterpolateur1D.java 2009-01-29 22:44:57 UTC (rev 4426) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISReprojectInterpolateur1D.java 2009-01-30 10:17:22 UTC (rev 4427) @@ -7,16 +7,15 @@ */ package org.fudaa.ctulu.gis; +import org.fudaa.ctulu.CtuluLibGeometrie; + +import com.memoire.fu.FuLog; import com.vividsolutions.jts.algorithm.CGAlgorithms; import com.vividsolutions.jts.algorithm.LineIntersector; import com.vividsolutions.jts.algorithm.RobustLineIntersector; import com.vividsolutions.jts.geom.Coordinate; import com.vividsolutions.jts.geom.CoordinateSequence; -import com.memoire.fu.FuLog; - -import org.fudaa.ctulu.CtuluLibGeometrie; - /** * Une interpolateur basique a utiliser pour interpoler sur une ligne. * @author Fred Deniger @@ -108,6 +107,9 @@ _dest[0]=i+1; _dest[1]=i; } + + tmpSrc_.x=tmpSrc2_.x; + tmpSrc_.y=tmpSrc2_.y; } //pas exactement sur la ligne return false; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2009-01-29 22:45:03
|
Revision: 4426 http://fudaa.svn.sourceforge.net/fudaa/?rev=4426&view=rev Author: deniger Date: 2009-01-29 22:44:57 +0000 (Thu, 29 Jan 2009) Log Message: ----------- Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ctulu/src/com/memoire/bu/BuSplashScreen.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZEbliCalquesPanel.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliScene.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliSceneController.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidget.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetArrowEditor.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetEditModeListener.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetTextEditor.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCalqueLegende.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetVueCalque.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetGraphe.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/impl/Fudaa.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/impl/FudaaSplashScreen.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/TrLauncherDefault.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostFlecheContentDefaultSaver.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostUserVariableSaver.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/data/TrPostDataCreatedCstTime.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/data/TrPostDataCreatedCstTimeSaver.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/data/TrPostDataCreatedSaver.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/data/TrPostDataCreatedStatisticSaver.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/persist/TrPostPersistenceManager.java Modified: branches/Prepro-0.92-SNAPSHOT/ctulu/src/com/memoire/bu/BuSplashScreen.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ctulu/src/com/memoire/bu/BuSplashScreen.java 2009-01-29 18:53:28 UTC (rev 4425) +++ branches/Prepro-0.92-SNAPSHOT/ctulu/src/com/memoire/bu/BuSplashScreen.java 2009-01-29 22:44:57 UTC (rev 4426) @@ -17,6 +17,8 @@ import java.lang.reflect.InvocationTargetException; import javax.swing.JComponent; +import javax.swing.JLabel; +import javax.swing.JPanel; import javax.swing.JWindow; import javax.swing.SwingConstants; import javax.swing.SwingUtilities; @@ -38,8 +40,8 @@ /* * class XMultiLabel extends BuLabelMultiLine { protected void paintComponent(Graphics _g) { Color - * old=getForeground(); setForeground(Color.white); for(int i=-1;i<=1;i++) for(int j=-1;j<=1;j++) { - * _g.translate(i,j); super.paintComponent(_g); _g.translate(-i,-j); } setForeground(old); super.paintComponent(_g); } } + * old=getForeground(); setForeground(Color.white); for(int i=-1;i<=1;i++) for(int j=-1;j<=1;j++) { _g.translate(i,j); + * super.paintComponent(_g); _g.translate(-i,-j); } setForeground(old); super.paintComponent(_g); } } */ private ClassLoader loader_; @@ -50,7 +52,7 @@ protected JComponent content_; - protected BuPanel panel_; + protected JPanel panel_; protected BuPanel left_; protected BuProgressBar progression_; protected BuLabel load_; @@ -86,7 +88,7 @@ } public void build() { - panel_ = new BuPanel(); + panel_ = new JPanel(); panel_.setLayout(new BuBorderLayout()); BuPicture ml_logo = null; @@ -225,94 +227,83 @@ run(); } - public void run() - { - long avant,apres,diff; - avant=System.currentTimeMillis(); + public void run() { + long avant, apres, diff; + avant = System.currentTimeMillis(); // BuUpdateGUI.repaintNow(content_);//this); - int i,j,p,pp,m,l; - String ps=null; + int i, j, p, pp, m, l; + String ps = null; /* * String paquet=base_; i=paquet.lastIndexOf('.'); if(i>=0) paquet=paquet.substring(0,i+1); else paquet=""; */ // System.err.println("PAQUET="+paquet); + pp = -1; - pp=-1; + l = 0; + for (i = 0; i < classes_.length; i++) + l += classes_[i].length; - l=0; - for(i=0; i<classes_.length;i++) - l+=classes_[i].length; - - m=0; - for(i=0; i<classes_.length;i++) - for(j=0; j<classes_[i].length;j++) - { - String n=classes_[i][j]; - // int k=n.lastIndexOf('.'); - // setText(k>=0 ? n.substring(k+1) : n); - String t=n; - int k=t.indexOf('$'); - if(k>=0) t=t.substring(0,k); - k=t.lastIndexOf('.'); - if(k>=0) t=t.substring(0,k); - k=t.lastIndexOf('.'); - if(k>=0) t=t.substring(k+1); - if(!t.equals(ps)) - { + m = 0; + for (i = 0; i < classes_.length; i++) + for (j = 0; j < classes_[i].length; j++) { + String n = classes_[i][j]; + // int k=n.lastIndexOf('.'); + // setText(k>=0 ? n.substring(k+1) : n); + String t = n; + int k = t.indexOf('$'); + if (k >= 0) t = t.substring(0, k); + k = t.lastIndexOf('.'); + if (k >= 0) t = t.substring(0, k); + k = t.lastIndexOf('.'); + if (k >= 0) t = t.substring(k + 1); + if (!t.equals(ps)) { setText(t); - ps=t; + ps = t; } - // if(k<0) n=paquet+n; - try - { - if(loader_==null) - Class.forName(n); - else loader_.loadClass(n); // Class.forName(n,false,loader_); + // if(k<0) n=paquet+n; + try { + if (loader_ == null) Class.forName(n); + else loader_.loadClass(n); // Class.forName(n,false,loader_); - // Class c=Class.forName(n); - // FuClassLoaderDedicated.putGlobal(c); - } - catch(Exception ex) - { - /* System.err.println("Error loading class "+n); */ - break; - } - - Thread.yield(); - /* - * try { Thread.sleep(5); } catch(Exception ex) { } - */ + // Class c=Class.forName(n); + // FuClassLoaderDedicated.putGlobal(c); + } catch (Exception ex) { + /* System.err.println("Error loading class "+n); */ + break; + } - m++; - p=100*m/l; - if(p!=pp) - { - setProgression(p); - pp=p; - } + Thread.yield(); + /* + * try { Thread.sleep(5); } catch(Exception ex) { } + */ + + m++; + p = 100 * m / l; + if (p != pp) { + setProgression(p); + pp = p; + } } setText(""); setProgression(100); - apres=System.currentTimeMillis(); - if(apres<avant+delai_) - { - delai_=avant+delai_-apres; - avant=apres; - do - { - try { Thread.sleep(50); } - catch(Exception ex) { } + apres = System.currentTimeMillis(); + if (apres < avant + delai_) { + delai_ = avant + delai_ - apres; + avant = apres; + do { + try { + Thread.sleep(50); + } catch (Exception ex) {} - diff=System.currentTimeMillis()-avant; - p=(int)(diff*100/delai_); - setProgression(p); - } - while(delai_>diff); + diff = System.currentTimeMillis() - avant; + p = (int) (diff * 100 / delai_); + setProgression(p); + } while (delai_ > diff); } } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZEbliCalquesPanel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZEbliCalquesPanel.java 2009-01-29 18:53:28 UTC (rev 4425) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZEbliCalquesPanel.java 2009-01-29 22:44:57 UTC (rev 4426) @@ -23,7 +23,6 @@ import java.awt.print.PageFormat; import java.awt.print.Printable; import java.util.ArrayList; -import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.List; @@ -40,15 +39,14 @@ import javax.swing.JPopupMenu; import javax.swing.JScrollPane; import javax.swing.JTabbedPane; -import javax.swing.JTable; import javax.swing.ListCellRenderer; import javax.swing.SwingUtilities; import javax.swing.event.TreeModelEvent; import javax.swing.event.TreeModelListener; -import javax.swing.table.DefaultTableModel; import javax.swing.tree.TreeModel; import org.fudaa.ctulu.CtuluLibString; +import org.fudaa.ctulu.CtuluSelectionInterface; import org.fudaa.ctulu.CtuluUI; import org.fudaa.ctulu.gui.CtuluLibSwing; import org.fudaa.ctulu.gui.CtuluTreeComboboxModel; @@ -80,15 +78,16 @@ /** * Fenetre d'affichage de calques contenant des services de base. (position souris, zoom fenetre, selection, - * transformations spatiales). Il est possible d'ajouter des boutons grace aux methodes <code>addButtonGroup</code>. - * Par defaut, 3 groupes de boutons sont proposes : selection, standard et navigation. Ils peuvent etre supprimes ou + * transformations spatiales). Il est possible d'ajouter des boutons grace aux methodes <code>addButtonGroup</code>. Par + * defaut, 3 groupes de boutons sont proposes : selection, standard et navigation. Ils peuvent etre supprimes ou * modifies avec les methodes remove * * @version $Id: ZEbliCalquesPanel.java,v 1.55.4.4 2008-05-13 12:10:36 bmarchan Exp $ * @author Guillaume Desnoix , Axel von Arnim, Fred deniger */ public class ZEbliCalquesPanel extends BuPanel implements EbliFilleCalquesInterface, BCalqueContextuelListener, - CtuluImageProducer, BCalqueSaverTargetInterface, EbliFindable, ActionListener, ZSelectionListener { + CtuluImageProducer, BCalqueSaverTargetInterface, EbliFindable, ActionListener, ZSelectionListener, + CtuluSelectionInterface { protected class AnimAdapter extends EbliAnimationSourceAbstract { @@ -257,6 +256,7 @@ /** * Rempli le menu avec les actions de la scene + * * @param _m le menu a remplir */ protected void fillMenuWithSceneActions(final JMenu _m) { @@ -271,7 +271,7 @@ * @param _m le menu a remplir */ protected void fillMenuWithSceneActions(final JPopupMenu _m) { - if (scene_!= null && scene_.getActions() != null) { + if (scene_ != null && scene_.getActions() != null) { EbliComponentFactory.INSTANCE.addActionsToMenu(scene_.getActions(), _m); } } @@ -292,14 +292,14 @@ /** * contient des informations de cr\xE9ation du vue2d. */ - public final static String NOM_FIC=EbliResource.EBLI.getString("Fichier res"); - public final static String PATH_FIC=EbliResource.EBLI.getString("Chemin"); - public final static String TITRE_FIC=EbliResource.EBLI.getString("Titre"); - public final static String MAILLAGE_FIC=EbliResource.EBLI.getString("Maillage utilis\xE9"); - public final static String DIFF_FIC=EbliResource.EBLI.getString("Diff\xE9rentiel fichiers"); - - public Map<String,String> infosCreation_=new HashMap<String,String>(); - + public final static String NOM_FIC = EbliResource.EBLI.getString("Fichier res"); + public final static String PATH_FIC = EbliResource.EBLI.getString("Chemin"); + public final static String TITRE_FIC = EbliResource.EBLI.getString("Titre"); + public final static String MAILLAGE_FIC = EbliResource.EBLI.getString("Maillage utilis\xE9"); + public final static String DIFF_FIC = EbliResource.EBLI.getString("Diff\xE9rentiel fichiers"); + + public Map<String, String> infosCreation_ = new HashMap<String, String>(); + protected BuMenu contextTools_; protected BuLabel mode_; @@ -340,6 +340,7 @@ /** * Construction des calques par defaut. + * * @param _gcInit le calque de base * @param _controller * @param _addSouth Ajout ou non des services d'info en bas de fenetre (position, mode, etc.). @@ -354,22 +355,21 @@ gc.setName("cqRACINE"); gc.setTitle(EbliResource.EBLI.getString("Calque racine")); gc.setDestructible(false); - + gcDonnees_ = new BGroupeCalque() { - + // B.M. Pour eviter le plantage, une boite est retourn\xE9e si rien n'est affich\xE9 ou boite non conforme. public GrBoite getDomaine() { - GrBoite bt=super.getDomaine(); - - if (bt==null) { - bt=new GrBoite(new GrPoint(0,0,0),new GrPoint(100,100,0)); + GrBoite bt = super.getDomaine(); + + if (bt == null) { + bt = new GrBoite(new GrPoint(0, 0, 0), new GrPoint(100, 100, 0)); + } else if (bt.getDeltaX() == 0 || bt.getDeltaY() == 0) { + bt.o_.x_ -= 10; + bt.o_.y_ -= 10; + bt.e_.x_ += 10; + bt.e_.y_ += 10; } - else if (bt.getDeltaX()==0 || bt.getDeltaY()==0) { - bt.o_.x_-=10; - bt.o_.y_-=10; - bt.e_.x_+=10; - bt.e_.y_+=10; - } return bt; } }; @@ -425,8 +425,8 @@ if (_controller == null) { throw new IllegalArgumentException(); } controller_ = _controller; controller_.setView(this); - - scene_=new ZScene(gcDonnees_,controller_.getCqSelectionI()); + + scene_ = new ZScene(gcDonnees_, controller_.getCqSelectionI()); scene_.setRestrictedToCalqueActif(true); scene_.addSelectionListener(this); modelArbre_.addTreeModelListener(scene_); @@ -482,16 +482,16 @@ public final void inverseSelection() { getScene().inverseSelection(); -// if (getCalqueActif() instanceof ZCalqueAffichageDonneesInterface) { -// ((ZCalqueAffichageDonneesInterface) getCalqueActif()).inverseSelection(); -// } + // if (getCalqueActif() instanceof ZCalqueAffichageDonneesInterface) { + // ((ZCalqueAffichageDonneesInterface) getCalqueActif()).inverseSelection(); + // } } public final void clearSelection() { getScene().clearSelection(); -// if (getCalqueActif() instanceof ZCalqueAffichageDonneesInterface) { -// ((ZCalqueAffichageDonneesInterface) getCalqueActif()).clearSelection(); -// } + // if (getCalqueActif() instanceof ZCalqueAffichageDonneesInterface) { + // ((ZCalqueAffichageDonneesInterface) getCalqueActif()).clearSelection(); + // } } public final ZEbliCalquePanelController getController() { @@ -526,15 +526,11 @@ final String act = _e.getActionCommand(); if ("SELECTFROMPOLY".equals(act)) { findPolys(); - } /*else if ("CLEARSELECTION".equals(act)) { - clearSelection(); - } else if ("INVERSESELECTION".equals(act)) { - inverseSelection(); - } else if ("TOUTSELECTIONNER".equals(act)) { - select(); - } else if ("RECHERCHER".equals(act)) { - find(); - }*/ + } /* + * else if ("CLEARSELECTION".equals(act)) { clearSelection(); } else if ("INVERSESELECTION".equals(act)) { + * inverseSelection(); } else if ("TOUTSELECTIONNER".equals(act)) { select(); } else if ("RECHERCHER".equals(act)) + * { find(); } + */ } @@ -593,11 +589,12 @@ public BCalque getCalqueActif() { return controller_.getCalqueActif(); } - + /** * Revoie la scene. */ - private ZScene scene_=null; + private ZScene scene_ = null; + public ZScene getScene() { return scene_; } @@ -829,9 +826,9 @@ public void select() { getScene().selectAll(); -// if (getCalqueActif() instanceof ZCalqueAffichageDonneesInterface) { -// ((ZCalqueAffichageDonneesInterface) getCalqueActif()).selectAll(); -// } + // if (getCalqueActif() instanceof ZCalqueAffichageDonneesInterface) { + // ((ZCalqueAffichageDonneesInterface) getCalqueActif()).selectAll(); + // } } public ListCellRenderer getComboRender() { @@ -921,10 +918,9 @@ } /** - * Ajoute les calques d'informations. - * Les calques contenus dans ce groupe de calques ne sont pas visibles dans l'arbre des calques. - * Les objets de ces calques ne sont pas s\xE9lectionnables, mais visibles dans la fenetre de vue - * des calques. + * Ajoute les calques d'informations. Les calques contenus dans ce groupe de calques ne sont pas visibles dans l'arbre + * des calques. Les objets de ces calques ne sont pas s\xE9lectionnables, mais visibles dans la fenetre de vue des + * calques. * * @param _g le maillage associe */ @@ -1001,14 +997,13 @@ .getMenuIcon("draw-polygon"), this); return selection; } - - /* + + /* * @see org.fudaa.ebli.calque.ZSelectionListener#selectionChanged(org.fudaa.ebli.calque.ZSelectionEvent) */ public void selectionChanged(ZSelectionEvent _evt) { modelArbre_.fireObservableChanged(); } - public ZEbliCalquesPanel duplicate(Map options) { /* @@ -1024,34 +1019,31 @@ return null; } - /** - * Cree un tableau qui r\xE9capitule le contenu des infos de cr\xE9ation de la vue 2d. - * Retourne un panel vide si aucune infos n'est disponible. + * Cree un tableau qui r\xE9capitule le contenu des infos de cr\xE9ation de la vue 2d. Retourne un panel vide si aucune + * infos n'est disponible. + * * @return */ - public BuPanel buildInfosCreationComposant(){ - - - if(infosCreation_==null || infosCreation_.keySet()==null ||infosCreation_.keySet().size()==0) - return new BuPanel(); - List<String> liste=new ArrayList<String>(infosCreation_.keySet()); - Collections.sort(liste); - List<String> col=new ArrayList<String>(); - col.add(EbliResource.EBLI.getString("Nom")); - col.add(EbliResource.EBLI.getString("Valeur")); - - EbliModelInfos modelInfos=new EbliModelInfos(liste,infosCreation_,col); - BuTable table=new BuTable(modelInfos); - - table.getColumnModel().getColumn(0).setPreferredWidth(20); - BuPanel conteneur=new BuPanel(new BorderLayout()); - conteneur.add(new JScrollPane(table),BorderLayout.CENTER); - - conteneur.add(new JLabel("<html><body><b>"+EbliResource.EBLI.getString("Infos cr\xE9ations")+"</b></body></html>",JLabel.CENTER),BorderLayout.NORTH); - return conteneur; + public BuPanel buildInfosCreationComposant() { + + if (infosCreation_ == null || infosCreation_.keySet() == null || infosCreation_.keySet().size() == 0) return new BuPanel(); + List<String> liste = new ArrayList<String>(infosCreation_.keySet()); + Collections.sort(liste); + List<String> col = new ArrayList<String>(); + col.add(EbliResource.EBLI.getString("Nom")); + col.add(EbliResource.EBLI.getString("Valeur")); + + EbliModelInfos modelInfos = new EbliModelInfos(liste, infosCreation_, col); + BuTable table = new BuTable(modelInfos); + + table.getColumnModel().getColumn(0).setPreferredWidth(20); + BuPanel conteneur = new BuPanel(new BorderLayout()); + conteneur.add(new JScrollPane(table), BorderLayout.CENTER); + + conteneur.add(new JLabel("<html><body><b>" + EbliResource.EBLI.getString("Infos cr\xE9ations") + "</b></body></html>", + JLabel.CENTER), BorderLayout.NORTH); + return conteneur; } - - } \ No newline at end of file Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliScene.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliScene.java 2009-01-29 18:53:28 UTC (rev 4425) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliScene.java 2009-01-29 22:44:57 UTC (rev 4426) @@ -13,6 +13,8 @@ import java.util.Map; import java.util.Set; +import javax.swing.JComponent; + import org.fudaa.ctulu.CtuluCommandManager; import org.fudaa.ctulu.CtuluLibGenerator; import org.fudaa.ctulu.CtuluUI; @@ -60,7 +62,7 @@ Set<?> objects2 = getSelectedObjects(); if (objects2 != null) { for (Iterator iterator = objects2.iterator(); iterator.hasNext();) { - Object object = (Object) iterator.next(); + Object object = iterator.next(); stopEditing(findWidget(object)); } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliSceneController.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliSceneController.java 2009-01-29 18:53:28 UTC (rev 4425) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliSceneController.java 2009-01-29 22:44:57 UTC (rev 4426) @@ -26,7 +26,7 @@ final private WidgetAction alignWithResizeAction; - // final private WidgetAction alignWithResizeActionProportionnal; + // final private WidgetAction alignWithResizeActionProportionnal; Set<EbliWidgetEditModeListener> listeners_ = new HashSet<EbliWidgetEditModeListener>(); BuMenuBar menuCalque_ = null; @@ -57,15 +57,13 @@ // scene_.getInteractionLayer(), ActionFactory // .createDefaultAlignWithMoveDecorator(), false); - alignWithResizeAction = EbliWidgetActionFactory.createAlignWithProportionnalResizeAction(scene_ - .getVisu(), scene_ - .getInteractionLayer(), - ActionFactory.createDefaultAlignWithMoveDecorator(), false); - + alignWithResizeAction = EbliWidgetActionFactory.createAlignWithProportionnalResizeAction(scene_.getVisu(), scene_ + .getInteractionLayer(), ActionFactory.createDefaultAlignWithMoveDecorator(), false); + rectangularSelection_ = ActionFactory.createRectangularSelectAction(scene_, scene_.getInteractionLayer()); // -- ajoute l'action du zoom ( ctrl + clic) - //suppression pour eviter les bugs sioux -// scene_.getActions().addAction(ActionFactory.createCenteredZoomAction(1.1)); + // suppression pour eviter les bugs sioux + // scene_.getActions().addAction(ActionFactory.createCenteredZoomAction(1.1)); scene_.getActions().addAction(rectangularSelection_); // -- ajouter le menu popup de base @@ -73,9 +71,9 @@ } -// public WidgetAction getAlignWithResizeActionProportionnal() { -// return alignWithResizeActionProportionnal; -// } + // public WidgetAction getAlignWithResizeActionProportionnal() { + // return alignWithResizeActionProportionnal; + // } public boolean isEditable() { return false; @@ -85,15 +83,15 @@ listeners_.add(_l); } - public void fireEditStart(final Widget w) { + public void fireEditStart(final Widget _w, JComponent _editor) { for (final EbliWidgetEditModeListener l : listeners_) { - l.editStart(w); + l.editStart(_w, _editor); } } - public void fireEditStop(final Widget w) { + public void fireEditStop(final Widget w, JComponent editor) { for (final EbliWidgetEditModeListener l : listeners_) { - l.editStop(w); + l.editStop(w, editor); } } @@ -171,10 +169,10 @@ return alignWithResizeAction; } -// public WidgetAction getProportionnalResizeAction() { -// return alignWithResizeActionProportionnal; -// } - + // public WidgetAction getProportionnalResizeAction() { + // return alignWithResizeActionProportionnal; + // } + public BuToolBar getToolbarComponent() { return null; } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidget.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidget.java 2009-01-29 18:53:28 UTC (rev 4425) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidget.java 2009-01-29 22:44:57 UTC (rev 4426) @@ -9,6 +9,8 @@ import java.util.List; import java.util.Map; +import javax.swing.JComponent; + import org.fudaa.ctulu.CtuluCommand; import org.fudaa.ctulu.CtuluCommandContainer; import org.fudaa.ctulu.CtuluLibString; @@ -35,9 +37,8 @@ */ public class EbliWidget extends Widget implements BSelecteurTargetInterface, EbliWidgetInterface<EbliWidgetController> { - - public final static boolean AMELIO_LOT_VISIBLE=true; - + public final static boolean AMELIO_LOT_VISIBLE = true; + public final static String COLORCONTOUR = "ColorContour"; public final static String COLORFOND = "colorFond"; @@ -52,7 +53,7 @@ public final static String ROTATION = "rotation"; public final static String TRANSPARENCE = "Transpa"; - + protected EbliWidgetController controller_; /** * L'identifiant unique du widget @@ -97,10 +98,10 @@ // -- ajout de l angle de rotation par default PI --// propGraphique.put(ROTATION, Math.PI); - - //-- ajout de la trnaparence a false --// - propGraphique.put( EbliWidget.TRANSPARENCE,false); - + + // -- ajout de la trnaparence a false --// + propGraphique.put(EbliWidget.TRANSPARENCE, false); + } /** @@ -121,18 +122,15 @@ } - - - public boolean getTransparent() { - return (Boolean) propGraphique.get(TRANSPARENCE); -} + return (Boolean) propGraphique.get(TRANSPARENCE); + } -public void setTransparent(boolean transparent) { - propGraphique.put(TRANSPARENCE, new Boolean(transparent)); -} + public void setTransparent(boolean transparent) { + propGraphique.put(TRANSPARENCE, new Boolean(transparent)); + } -public boolean canColorBackground() { + public boolean canColorBackground() { return true && !getTransparent(); } @@ -209,15 +207,15 @@ return mapDupliquee; } - protected void editingStart() { + protected void editingStart(JComponent _editor) { isInEditMode_ = true; - getEbliScene().getController().fireEditStart(this); + getEbliScene().getController().fireEditStart(this, _editor); } - protected void editingStop() { + protected void editingStop(JComponent _editor) { isInEditMode_ = false; - getEbliScene().getController().fireEditStop(this); + getEbliScene().getController().fireEditStop(this, _editor); } /** @@ -445,8 +443,8 @@ if (parent != null) { // System.err.println("parent not null"+ toString()); setBorder(lookFeel.getBorderInGroup(_newState)); - parent.setBorder(lookFeel.getBorder(_newState, parent.getController().canResize_, - parent.getController().isProportional())); + parent.setBorder(lookFeel.getBorder(_newState, parent.getController().canResize_, parent.getController() + .isProportional())); } else { setBorder(lookFeel.getBorder(_newState, getController().canResize_, getController().isProportional())); } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetArrowEditor.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetArrowEditor.java 2009-01-29 18:53:28 UTC (rev 4425) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetArrowEditor.java 2009-01-29 22:44:57 UTC (rev 4426) @@ -99,12 +99,12 @@ Widget widget, EbliEditorArrow editor, boolean commit) { imageFleche = null; repaint(); - editingStop(); + editingStop(editor); } public void notifyOpened(org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, Widget widget, EbliEditorArrow editor) { - editingStart(); + editingStart(editor); } } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetEditModeListener.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetEditModeListener.java 2009-01-29 18:53:28 UTC (rev 4425) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetEditModeListener.java 2009-01-29 22:44:57 UTC (rev 4426) @@ -4,6 +4,8 @@ */ package org.fudaa.ebli.visuallibrary; +import javax.swing.JComponent; + import org.netbeans.api.visual.widget.Widget; /** @@ -13,8 +15,8 @@ */ public interface EbliWidgetEditModeListener { - void editStart(Widget w); + void editStart(Widget w, JComponent _editor); - void editStop(Widget w); + void editStop(Widget w, JComponent _editor); } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetTextEditor.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetTextEditor.java 2009-01-29 18:53:28 UTC (rev 4425) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetTextEditor.java 2009-01-29 22:44:57 UTC (rev 4426) @@ -50,16 +50,16 @@ final EbliWidgetControllerTextEditor controller = new EbliWidgetControllerTextEditor(this); controller.setEditable(true); setController(controller); - + } -// @Override -//public boolean canColorBackground() { -// // TODO Auto-generated method stub -// return false; -//} + // @Override + // public boolean canColorBackground() { + // // TODO Auto-generated method stub + // return false; + // } -public boolean canRotate() { + public boolean canRotate() { return false; } @@ -183,7 +183,7 @@ // intern_.revalidate(); this.repaint(); getEbliScene().refresh(); - editingStop(); + editingStop(_editor); } @@ -194,7 +194,7 @@ // editorPane_.setDocumentText(contenuHTML_.getText()); // -- on masque l affichage du widgetcomponent --// setHtml(CtuluLibString.EMPTY_STRING); - editingStart(); + editingStart(_editor); } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCalqueLegende.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCalqueLegende.java 2009-01-29 18:53:28 UTC (rev 4425) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCalqueLegende.java 2009-01-29 22:44:57 UTC (rev 4426) @@ -45,11 +45,11 @@ // Font oldFont_; boolean mustUpdateFont_ = false; - + public EbliWidgetCalqueLegende(final EbliScene _scene, final boolean _controller/* , BArbreCalqueModel model */, final BCalqueLegendePanel _legendePanel) { super(_scene, _controller); - + setCheckClipping(true); // oldFont_ = getFormeFont(); // -- la legende est un listener des modifs de son calque --// @@ -127,16 +127,14 @@ return null; } - - public void notifyClosing(final EditorController _controller, final Widget _widget, final JComponent _editor, final boolean _commit) { - editingStop(); + editingStop(_editor); } public void notifyOpened(final EditorController _controller, final Widget _widget, final JComponent _editor) { - editingStart(); + editingStart(_editor); } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetVueCalque.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetVueCalque.java 2009-01-29 18:53:28 UTC (rev 4425) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetVueCalque.java 2009-01-29 22:44:57 UTC (rev 4426) @@ -3,7 +3,6 @@ import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics2D; -import java.awt.Insets; import java.awt.Rectangle; import java.awt.Window; import java.awt.image.BufferedImage; @@ -102,10 +101,10 @@ */ public void notifyClosing(final org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, final Widget widget, final BuPanel editor, final boolean commit) { - editingStop(); + editingStop(editor); setZoom(calquePanel_.getVueCalque().getViewBoite()); - //le zoom n'a pas chang\xE9. -// zoomChanged_=false; + // le zoom n'a pas chang\xE9. + // zoomChanged_=false; getEbliScene().refresh(); } @@ -144,7 +143,6 @@ } boolean zoomChanged_ = true; - @Override protected void paintWidget() { @@ -208,7 +206,7 @@ public void notifyOpened(final org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, final Widget widget, final BuPanel editor) { - editingStart(); + editingStart(editor); // calquePanel_.setBorder(BorderFactory.createLineBorder(Color.GRAY, 1)); } @@ -298,8 +296,8 @@ if (CtuluLib.isEquals(_zoom, zoom_)) return; clearCacheImage(); this.zoom_ = _zoom; - zoomChanged_=true; -// repaint(); + zoomChanged_ = true; + // repaint(); } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetGraphe.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetGraphe.java 2009-01-29 18:53:28 UTC (rev 4425) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetGraphe.java 2009-01-29 22:44:57 UTC (rev 4426) @@ -187,7 +187,7 @@ public void notifyClosing(final org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, final Widget widget, final BuPanel editor, final boolean commit) { - editingStop(); + editingStop(editor); } @@ -253,7 +253,7 @@ public void notifyOpened(final org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, final Widget widget, final BuPanel editor) { - editingStart(); + editingStart(editor); } public void axeAspectChanged(final EGAxe _c) { Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/impl/Fudaa.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/impl/Fudaa.java 2009-01-29 18:53:28 UTC (rev 4425) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/impl/Fudaa.java 2009-01-29 22:44:57 UTC (rev 4426) @@ -33,7 +33,7 @@ private final FudaaCommandLineParser flags_ = new FudaaCommandLineParser(); private FudaaSplashScreen splash_; private File toOpen_; - private boolean splashTextVisible_=true; + private boolean splashTextVisible_ = true; public boolean isDoNotUseFudaaTee() { return doNotUseFudaaTee_; @@ -47,9 +47,10 @@ return applyLanguage_; } - public void setSplashTextVisible(boolean b){ - splashTextVisible_=b; + public void setSplashTextVisible(boolean b) { + splashTextVisible_ = b; } + public void setApplyLanguage(final boolean _applyLanguage) { applyLanguage_ = _applyLanguage; } @@ -154,7 +155,7 @@ // il est inutile de charger des classes. Cela encombre la memoire pour rien if (!flags_.noSplash_ && FudaaStartupExitPreferencesPanel.isSplashActivated()) { splash_ = new FudaaSplashScreen(_soft, 2000, new String[0][0]); - splash_.setVisible(splashTextVisible_); + splash_.setVisible(splashTextVisible_); splash_.start(); } } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/impl/FudaaSplashScreen.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/impl/FudaaSplashScreen.java 2009-01-29 18:53:28 UTC (rev 4425) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/impl/FudaaSplashScreen.java 2009-01-29 22:44:57 UTC (rev 4426) @@ -7,54 +7,51 @@ * @mail de...@fu... */ package org.fudaa.fudaa.commun.impl; -import java.awt.Color; + import java.awt.Component; -import java.awt.Container; import javax.swing.JLabel; +import javax.swing.JPanel; import javax.swing.SwingConstants; +import org.fudaa.fudaa.ressource.FudaaResource; + import com.memoire.bu.BuInformationsSoftware; -import com.memoire.bu.BuLabel; -import com.memoire.bu.BuPanel; import com.memoire.bu.BuPicture; import com.memoire.bu.BuSplashScreen; -import org.fudaa.fudaa.ressource.FudaaResource; /** - * @version $Revision: 1.2 $ $Date: 2008-02-29 16:47:10 $ by $Author: opasteur $ - * @author Guillaume Desnoix + * @version $Revision: 1.2 $ $Date: 2008-02-29 16:47:10 $ by $Author: opasteur $ + * @author Guillaume Desnoix */ +@SuppressWarnings("serial") public class FudaaSplashScreen extends BuSplashScreen { - boolean visibleText_ = true; - public FudaaSplashScreen( - final BuInformationsSoftware _info, - final long _delai, - final String[][] _classes) { + + public FudaaSplashScreen(final BuInformationsSoftware _info, final long _delai, final String[][] _classes) { super(_info, _delai, _classes); } + public final void build() { super.build(); name_.setVerticalAlignment(SwingConstants.BOTTOM); - //setForeground(Color.WHITE); + // setForeground(Color.WHITE); name_.setText("Fudaa-" + name_.getText()); - if(!visibleText_) setLabelVisibleFalse(panel_); left_.add(new BuPicture(FudaaResource.FUDAA.getIcon("fudaa-logo"))); } - - public void setVisibleText(boolean b){ - visibleText_ = b; + + public void setTextUnvisible(boolean b) { + setLabelVisibleFalse(panel_); } - - private void setLabelVisibleFalse(BuPanel panel){ - Component[] comps = panel.getComponents(); - for (int i = 0; i < comps.length; i++) { - if (comps[i] instanceof JLabel) ((JLabel)comps[i]).setText(" "); - else if (comps[i] instanceof BuPanel){ - setLabelVisibleFalse((BuPanel)comps[i]); - } - } + + private void setLabelVisibleFalse(JPanel panel) { + Component[] comps = panel.getComponents(); + for (int i = 0; i < comps.length; i++) { + if (comps[i] instanceof JLabel) ((JLabel) comps[i]).setText(" "); + else if (comps[i] instanceof JPanel) { + setLabelVisibleFalse((JPanel) comps[i]); + } + } } - + } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/TrLauncherDefault.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/TrLauncherDefault.java 2009-01-29 18:53:28 UTC (rev 4425) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/TrLauncherDefault.java 2009-01-29 22:44:57 UTC (rev 4426) @@ -131,8 +131,8 @@ infoSoft = new BuInformationsSoftware(); infoSoft.name = "prepro"; - infoSoft.version = "0.92-MAQUETTE-V7"; - infoSoft.date = "2008-12-13"; + infoSoft.version = "0.92-MAQUETTE-V8"; + infoSoft.date = "2009-01-29"; infoSoft.rights = TrResource.getS("Tous droits r\xE9serv\xE9s") + ". CETMEF (c)2003-2007"; infoSoft.contact = "fre...@fu..."; infoSoft.license = "GPL2"; @@ -148,7 +148,7 @@ } else { infoSoft.man = manUrl.toString() + '/'; } - infoSoft.authors = new String[] { "Nicolas Clavreul", "Fr\xE9d\xE9ric Deniger" }; + infoSoft.authors = new String[] { "Nicolas Clavreul", "Fr\xE9d\xE9ric Deniger", "Adrien Hadoux" }; infoSoft.contributors = new String[] { "Equipes Dodico, Ebli et Fudaa" }; infoSoft.documentors = new String[] { "" }; infoSoft.testers = new String[] { "Fr\xE9d\xE9ric Deniger, Patrick Gomi, Vanessya Laborie", "Andr\xE9 Paquier", Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostFlecheContentDefaultSaver.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostFlecheContentDefaultSaver.java 2009-01-29 18:53:28 UTC (rev 4425) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostFlecheContentDefaultSaver.java 2009-01-29 22:44:57 UTC (rev 4426) @@ -28,8 +28,8 @@ vy_ = _defaut.getVy().getShortName(); } - public TrPostDataCreated restore(TrPostSource _src, CtuluUI _ui, Map _shortName) { - H2dVariableType var = (H2dVariableType) _shortName.get(name_); + public TrPostDataCreated restore(H2dVariableType _newVar, TrPostSource _src, CtuluUI _ui, Map _shortName) { + H2dVariableType var = _newVar; H2dVariableType varX = (H2dVariableType) _shortName.get(vx_); H2dVariableType varY = (H2dVariableType) _shortName.get(vy_); if (var != null && varX != null && varY != null) { return new TrPostFlecheContentDefaut(_src, var, varX, varY); } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java 2009-01-29 18:53:28 UTC (rev 4425) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java 2009-01-29 22:44:57 UTC (rev 4426) @@ -22,6 +22,7 @@ import javax.swing.JToolBar; import org.fudaa.ctulu.CtuluCommandManager; +import org.fudaa.ctulu.CtuluSelectionInterface; import org.fudaa.ctulu.CtuluUndoRedoInterface; import org.fudaa.ctulu.gui.CtuluFilleWithComponent; import org.fudaa.ctulu.image.CtuluImageProducer; @@ -76,7 +77,8 @@ * @author Adrien Hadoux */ public class TrPostLayoutFille extends BuInternalFrame implements CtuluFilleWithComponent, CtuluUndoRedoInterface, - BuUndoRedoInterface, BuCutCopyPasteInterface, EbliWidgetEditModeListener, CtuluImageProducer, EbliPageable { + BuUndoRedoInterface, BuCutCopyPasteInterface, CtuluSelectionInterface, EbliWidgetEditModeListener, + CtuluImageProducer, EbliPageable { /** * @@ -89,7 +91,7 @@ // final private EbliScene scene_; public TrPostLayoutPanelController controller_; - final JComponent defaultSouth_ = new JLabel("Details:"); + final JComponent defaultSouth_ = new JLabel(TrResource.getS("Details:")); private EbliPageableDelegate delegueImpression_; @@ -164,45 +166,43 @@ panelSouthSuiviSouris_ = new JLabel(); this.add(panelSouthSuiviSouris_, BorderLayout.SOUTH); - // oldSize_=getSize(); - // -- ajout du controller en cas de resize --// - // this.addComponentListener(new ComponentListener(){ - // - // @Override - // public void componentHidden(ComponentEvent e) { - // // TODO Auto-generated method stub - // - // } - // - // @Override - // public void componentMoved(ComponentEvent e) { - // // TODO Auto-generated method stub - // - // } - // - // @Override - // public void componentResized(ComponentEvent e) { - // // TODO Auto-generated method stub - // // Dimension size=getSize(); - // // System.out.println("Size nouvelle:"+size); - // // if(size!=oldSize_ ){ - // // controller_.getSceneCourante().resizeInnerWidget(size,oldSize_); - // // - // // //-- stockage de la taille comme ancienne size --// - // // oldSize_=size; - // // } - // } - // - // @Override - // public void componentShown(ComponentEvent e) { - // // TODO Auto-generated method stub - // - // } - // - // }); + } + public void find() { + if (editorEnCours_ instanceof CtuluSelectionInterface) { + ((CtuluSelectionInterface) editorEnCours_).find(); + } + } + public void replace() { + if (editorEnCours_ instanceof CtuluSelectionInterface) { + ((CtuluSelectionInterface) editorEnCours_).replace(); + } + + } + + public void select() { + if (editorEnCours_ instanceof CtuluSelectionInterface) { + ((CtuluSelectionInterface) editorEnCours_).select(); + } + + } + + public void inverseSelection() { + if (editorEnCours_ instanceof CtuluSelectionInterface) { + ((CtuluSelectionInterface) editorEnCours_).inverseSelection(); + } + + } + + public void clearSelection() { + if (editorEnCours_ instanceof CtuluSelectionInterface) { + ((CtuluSelectionInterface) editorEnCours_).clearSelection(); + } + + } + /** * @param _title * @param _preferredLocation @@ -328,19 +328,20 @@ // TODO trop dangereux... // listeActions.add(new TrPostCourbeAddPointsAction(projet_.impl_, _graphe.getGraphe(), _calque)); - // if (!(_graphe.getGraphe().getModel() instanceof MvProfileTreeModel)) listeActions -// .add(new TrPostCourbeAddVariableAction(projet_.impl_, _graphe.getGraphe())); - - //-- action ajout de variable --// -// if (_graphe.getGraphe().getModel() instanceof TrPostCourbeTreeModel){ -// ((EbliWidgetControllerGraphe)_controller).tree_.getActions().getMenu().add(new TrPostCourbeAddVariableAction(projet_.impl_, _graphe.getGraphe())); -// -// } + // if (!(_graphe.getGraphe().getModel() instanceof MvProfileTreeModel)) listeActions + // .add(new TrPostCourbeAddVariableAction(projet_.impl_, _graphe.getGraphe())); + + // -- action ajout de variable --// + // if (_graphe.getGraphe().getModel() instanceof TrPostCourbeTreeModel){ + // ((EbliWidgetControllerGraphe)_controller).tree_.getActions().getMenu().add(new + // TrPostCourbeAddVariableAction(projet_.impl_, _graphe.getGraphe())); + // + // } if (_graphe.getGraphe().getModel() instanceof MvProfileTreeModel) { listeActions .add(new TrPostActionBilan(((MvProfileTreeModel) _graphe.getGraphe().getModel()), projet_.getImpl())); -// listeActions.add(new TrPostActionCubature(((MvProfileTreeModel) _graphe.getGraphe().getModel()), projet_ -// .getImpl())); + // listeActions.add(new TrPostActionCubature(((MvProfileTreeModel) _graphe.getGraphe().getModel()), projet_ + // .getImpl())); } // -- ajout de l'importation dans les courbes de l'action --// @@ -473,9 +474,12 @@ throw new IllegalAccessError("not supported"); } - public void editStart(final Widget _w) { + JComponent editorEnCours_; + + public void editStart(final Widget _w, JComponent _editor) { + editorEnCours_ = _editor; final EbliNode node = (EbliNode) controller_.getSceneCourante().findObject(_w); - if (node == null || !node.hasWidget() || node.getWidget().getController() == null) editStop(null); + if (node == null || !node.hasWidget() || node.getWidget().getController() == null) editStop(null, null); if (node.getCreator() instanceof EbliWidgetCreatorVueCalque) { // -- etape 1: ajout du tree dans fudaaImplementation --// @@ -505,19 +509,18 @@ setTitle(previousTitleFrame); } - //-- cas des fleches + // -- cas des fleches else if (node.getCreator() instanceof EbliWidgetCreatorArrowEditor) { - FuLog.debug("arrow editor"); - - // -- etape 1: on fout eventuellement le tree des layouts --// - changeTree(getScene()); - // -- etape 2: rechargement de la toolbar specifique dans this --// - changeToolbar(node.getWidget().getController()); - setTitle(previousTitleFrame); + FuLog.debug("arrow editor"); - } - - + // -- etape 1: on fout eventuellement le tree des layouts --// + changeTree(getScene()); + // -- etape 2: rechargement de la toolbar specifique dans this --// + changeToolbar(node.getWidget().getController()); + setTitle(previousTitleFrame); + + } + else { // -- etape 1: on fout eventuellement le tree des layouts --// changeTree(getScene()); @@ -528,7 +531,8 @@ } - public void editStop(final Widget _w) { + public void editStop(final Widget _w, JComponent _editor) { + editorEnCours_ = null; changeTree(getScene()); changeToolbarScene(); setTitle(previousTitleFrame); Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostUserVariableSaver.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostUserVariableSaver.java 2009-01-29 18:53:28 UTC (rev 4425) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostUserVariableSaver.java 2009-01-29 22:44:57 UTC (rev 4426) @@ -103,7 +103,7 @@ final Map shortName = getShortNameVariable(_src); final TrPostDataCreated[] newData = new TrPostDataCreated[saver_.length]; for (int i = 0; i < saver_.length; i++) { - newData[i] = saver_[i].restore(_src, _ui, shortName); + newData[i] = saver_[i].restore(varCreatedSimple_[i], _src, _ui, shortName); } _src.addUserVar(varCreatedSimple_, newData, null); } @@ -198,7 +198,7 @@ final TrPostDataCreated created = (TrPostDataCreated) e.getValue(); final H2dVariableType var = (H2dVariableTypeCreated) e.getKey(); // pas de sauvegarde possible ou non basee sur une expression - if (created!=null && !created.isExpr() && created.createSaver() == null) { + if (created != null && !created.isExpr() && created.createSaver() == null) { varToRemove.add(var); varToRemove.addAll(TrPostDataCreatedExpr.getAllVarDependingOn(var, _src)); } @@ -212,12 +212,10 @@ for (final Iterator it = map.entrySet().iterator(); it.hasNext();) { final Map.Entry e = (Map.Entry) it.next(); final TrPostDataCreated data = ((TrPostDataCreated) e.getValue()); - if (data!=null &&data.isExpr()) { - if (data!=null) - exprVar.put(e.getKey(), data); + if (data != null && data.isExpr()) { + if (data != null) exprVar.put(e.getKey(), data); } else { - if (data!=null) - otherVar.put(e.getKey(), data); + if (data != null) otherVar.put(e.getKey(), data); } } @@ -231,7 +229,7 @@ } save.varCreatedSimple_ = new H2dVariableTypeCreated[otherVar.size()]; save.saver_ = new TrPostDataCreatedSaver[otherVar.size()]; - idx = 0; + idx = 0; for (final Iterator it = otherVar.entrySet().iterator(); it.hasNext();) { final Map.Entry e = (Map.Entry) it.next(); save.varCreatedSimple_[idx] = (H2dVariableTypeCreated) e.getKey(); Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/data/TrPostDataCreatedCstTime.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/data/TrPostDataCreatedCstTime.java 2009-01-29 18:53:28 UTC (rev 4425) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/data/TrPostDataCreatedCstTime.java 2009-01-29 22:44:57 UTC (rev 4426) @@ -27,8 +27,8 @@ private final int timeIdx_; - public static TrPostDataCreatedCstTime createFrom(final TrPostSource _src, - final TrPostDataCreatedCstTimeSaver _saver, final Map _shortName) { + public static TrPostDataCreatedCstTime createFrom(H2dVariableType _newVar, + final TrPostSource _src, final TrPostDataCreatedCstTimeSaver _saver, final Map _shortName) { if (_src == null || _saver == null || _shortName == null) { return null; } final H2dVariableType var = (H2dVariableType) _shortName.get(_saver.shortName_); if (var == null) { return null; } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/data/TrPostDataCreatedCstTimeSaver.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/data/TrPostDataCreatedCstTimeSaver.java 2009-01-29 18:53:28 UTC (rev 4425) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/data/TrPostDataCreatedCstTimeSaver.java 2009-01-29 22:44:57 UTC (rev 4426) @@ -10,6 +10,7 @@ import java.util.Map; import org.fudaa.ctulu.CtuluUI; +import org.fudaa.dodico.h2d.type.H2dVariableType; import org.fudaa.fudaa.tr.post.TrPostSource; /** @@ -31,8 +32,8 @@ tidx_ = _data.getTimeIdx(); } - public TrPostDataCreated restore(final TrPostSource _src, final CtuluUI _ui, final Map _shortName) { - return TrPostDataCreatedCstTime.createFrom(_src, this, _shortName); + public TrPostDataCreated restore(H2dVariableType _newVar, final TrPostSource _src, final CtuluUI _ui, final Map _shortName) { + return TrPostDataCreatedCstTime.createFrom(_newVar, _src, this, _shortName); } } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/data/TrPostDataCreatedSaver.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/data/TrPostDataCreatedSaver.java 2009-01-29 18:53:28 UTC (rev 4425) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/data/TrPostDataCreatedSaver.java 2009-01-29 22:44:57 UTC (rev 4426) @@ -10,6 +10,7 @@ import java.util.Map; import org.fudaa.ctulu.CtuluUI; +import org.fudaa.dodico.h2d.type.H2dVariableType; import org.fudaa.fudaa.tr.post.TrPostSource; /** @@ -18,6 +19,6 @@ */ public interface TrPostDataCreatedSaver { - TrPostDataCreated restore(TrPostSource _src, CtuluUI _ui, Map _shortName); + TrPostDataCreated restore(H2dVariableType _newVar, TrPostSource _src, CtuluUI _ui, Map _shortName); } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/data/TrPostDataCreatedStatisticSaver.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/data/TrPostDataCreatedStatisticSaver.java 2009-01-29 18:53:28 UTC (rev 4425) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/data/TrPostDataCreatedStatisticSaver.java 2009-01-29 22:44:57 UTC (rev 4426) @@ -11,6 +11,7 @@ import org.fudaa.ctulu.CtuluRange; import org.fudaa.ctulu.CtuluUI; +import org.fudaa.dodico.h2d.type.H2dVariableType; import org.fudaa.fudaa.tr.post.TrPostSource; /** @@ -19,7 +20,7 @@ */ public class TrPostDataCreatedStatisticSaver implements TrPostDataCreatedSaver { - public TrPostDataCreated restore(final TrPostSource _src, final CtuluUI _ui, final Map _shortName) { + public TrPostDataCreated restore(H2dVariableType _newVar, final TrPostSource _src, final CtuluUI _ui, final Map _shortName) { return TrPostDataCreatedStatistic.createFrom(this, _src, _shortName, _ui); } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/persist/TrPostPersistenceManager.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/persist/TrPostPersistenceManager.java 2009-01-29 18:53:28 UTC (rev 4425) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/persist/TrPostPersistenceManager.java 2009-01-29 22:44:57 UTC (rev 4426) @@ -3,7 +3,6 @@ import java.awt.Dimension; import java.awt.Point; import java.io.File; -import java.io.FileFilter; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.FileWriter; @@ -43,12 +42,10 @@ import org.fudaa.fudaa.tr.common.TrResource; import org.fudaa.fudaa.tr.post.TrPostCommonImplementation; import org.fudaa.fudaa.tr.post.TrPostLayoutFille; -import org.fudaa.fudaa.tr.post.TrPostMultiSourceActivator; import org.fudaa.fudaa.tr.post.TrPostMultiSourceActivator2; import org.fudaa.fudaa.tr.post.TrPostProjet; import org.fudaa.fudaa.tr.post.TrPostSource; import org.fudaa.fudaa.tr.post.TrPostSourceAbstract; -import org.fudaa.fudaa.tr.post.TrPostSourceAbstractFromIdx; import org.fudaa.fudaa.tr.post.TrPostSourceFromReader; import org.fudaa.fudaa.tr.post.TrPostSourcePersistComposite; import org.fudaa.fudaa.tr.post.TrPostTimeModelSaver; @@ -161,30 +158,38 @@ final CtuluFileChooser fileChooser = new CtuluFileChooser(true); fileChooser.setDialogTitle(EbliResource.EBLI.getString("S\xE9lectionnez l'emplacement de votre projet")); fileChooser.setAcceptAllFileFilterUsed(false); - fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); +// fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); fileChooser.addChoosableFileFilter(new TrPostFileFilter.DirectoryPOSTFilter()); // -- par defaut on choisis le nom du fichier resultat + .POST --// - File fileDefaut = null; - boolean constrcutFileDefaut = false; + + // boolean constrcutFileDefaut = false; if (trprojet_.listeSrc_ != null && trprojet_.listeSrc_.size() >= 1) { String indice = ""; - int i = 1; - do { - // TODO Adrien complique - // String path = fileChooser.getCurrentDirectory().getAbsolutePath() + File.separator - // + ; - // fileDefaut = new File(path); - fileDefaut = new File(fileChooser.getCurrentDirectory(), trprojet_.getSource(0).getFiles().iterator().next() - .getName() - + indice + EXTENSION); - indice = "_" + (i++); - } while (fileDefaut.exists()); + File fileDefaut = new File(fileChooser.getCurrentDirectory(), trprojet_.getSource(0).getFiles().iterator() + .next().getName() + + EXTENSION); + if (fileDefaut.exists()) { + int i = 1; + do { + // TODO Adrien complique + // String path = fileChooser.getCurrentDirectory().getAbsolutePath() + File.separator + // + ; + // fileDefaut = new File(path); + fileDefaut = new File(fileChooser.getCurrentDirectory(), trprojet_.getSource(0).getFiles().iterator() + .next().getName() + + indice + EXTENSION); + indice = "_" + (i++); + } while (fileDefaut.exists() && i < 20);// Garde fou + } + // FRED faux cree le repertoire alors que l'utilisateur ne l'a pas choisit !!!!! + // if (!fileDefaut.exists()) { + // constrcutFileDefaut = fileDefaut.mkdir(); + // } if (!fileDefaut.exists()) { - constrcutFileDefaut = fileDefaut.mkdir(); + fileChooser.setSelectedFile(fileDefaut); } - fileChooser.setSelectedFile(fileDefaut); } if (projet_ != null) { // initialiser le saveas dans le meme rep @@ -196,18 +201,19 @@ // -- si le fichier choisit en d\xE9finitif est diff\xE9rent du fichier d\xE9faut et qu'il a \xE9t\xE9t cr\xE9r pour rien, on le // supprime --// - if (constrcutFileDefaut && fileDefaut != null - && !fileDefaut.getAbsolutePath().equals(conteneurProjet.getAbsolutePath())) { - fileDefaut.delete(); + // FRED ben pourquoi l'avoir cree alors !!!!! + // if (constrcutFileDefaut && fileDefaut != null + // && !fileDefaut.getAbsolutePath().equals(conteneurProjet.getAbsolutePath())) { + // fileDefaut.delete(); + // } + + // -- test si le fichier choisit par l'utilisateur existe djea, si oui. demander confirmation d'ecrasement --// + if (conteneurProjet.exists()) { + //Fred il faut traduire + boolean resp = trprojet_.impl_.question("Fichier " + conteneurProjet.getName() + " existant", "Le fichier " + + conteneurProjet.getName() + " existe d\xE9j\xE0.\n Voulez-vous l'\xE9craser ?"); + if (!resp) return false; } - - //-- test si le fichier choisit par l'utilisateur existe djea, si oui. demander confirmation d'ecrasement --// - if(conteneurProjet.exists()){ - boolean resp=trprojet_.impl_.question("Fichier "+conteneurProjet.getName()+" existant", "Le fichier "+conteneurProjet.getName()+" existe d\xE9j\xE0.\n Voulez-vous l'\xE9craser ?"); - if(!resp) - return false; - } - if (projet_ == null || !projet_.equals(conteneurProjet)) projet_ = new File(GetExtensionName(conteneurProjet .getAbsolutePath())); @@ -226,9 +232,9 @@ } else { // -- on supprime le fichier defaut construit pour rien si il a \xE9t\xE9 construit --// - if (constrcutFileDefaut) { - fileDefaut.delete(); - } + // if (constrcutFileDefaut) { + // fileDefaut.delete(); + // } return false; } @@ -599,10 +605,10 @@ trprojet_.deliverSourceId(src); listeCouplesIdSources.add(new TrPostSourcePersist(src, projet_)); // -- sauveagrde de la variable correspondante --// - - final TrPostUserVariableSaver var = TrPostUserVariableSaver.saveIn((TrPostSourceAbstract) src, null); - listeVar.add(var); - + + final TrPostUserVariableSaver var = TrPostUserVariableSaver.saveIn((TrPostSourceAbstract) src, null); + listeVar.add(var); + listePdt.add(new TrPostTimeModelSaver(src)); } ... [truncated message content] |
From: <had...@us...> - 2009-01-29 18:53:33
|
Revision: 4425 http://fudaa.svn.sourceforge.net/fudaa/?rev=4425&view=rev Author: hadouxad Date: 2009-01-29 18:53:28 +0000 (Thu, 29 Jan 2009) Log Message: ----------- plein d'am?\195?\169liorations/corrections lot 3 + stabilisation appli Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ctulu/src/com/memoire/bu/BuMenu.java branches/Prepro-0.92-SNAPSHOT/ctulu/src/com/memoire/bu/BuMenuItem.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/commun/EbliModelInfos.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGraphe.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGPaletteLegendeGraphe.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetControllerGraphe.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaCourbeWizardImportScope.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostBuilderSuiteCalcul.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCommonImplementation.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjet.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjetsManagerFille.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostUserVariableSaver.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/actions/TrPostActionChooseAndCreateCalque.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/persist/TrPostPersistenceManager.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/persist/TrPostSourcePersist.java Modified: branches/Prepro-0.92-SNAPSHOT/ctulu/src/com/memoire/bu/BuMenu.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ctulu/src/com/memoire/bu/BuMenu.java 2009-01-29 09:53:07 UTC (rev 4424) +++ branches/Prepro-0.92-SNAPSHOT/ctulu/src/com/memoire/bu/BuMenu.java 2009-01-29 18:53:28 UTC (rev 4425) @@ -47,6 +47,7 @@ { private boolean left_; + public BuMenu() { this("Menu","MENU",true,0); } Modified: branches/Prepro-0.92-SNAPSHOT/ctulu/src/com/memoire/bu/BuMenuItem.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ctulu/src/com/memoire/bu/BuMenuItem.java 2009-01-29 09:53:07 UTC (rev 4424) +++ branches/Prepro-0.92-SNAPSHOT/ctulu/src/com/memoire/bu/BuMenuItem.java 2009-01-29 18:53:28 UTC (rev 4425) @@ -13,23 +13,57 @@ import java.awt.Graphics; import java.awt.Point; +import java.awt.event.ActionListener; import java.awt.event.MouseEvent; +import java.util.ArrayList; +import java.util.List; import javax.swing.Action; import javax.swing.Icon; import javax.swing.JMenuItem; +import org.fudaa.ctulu.CtuluLibGenerator; + /** * Like JMenuItem but with better management of icons. */ public class BuMenuItem extends JMenuItem { + + + private String id_; + + public BuMenuItem() { this("",(BuIcon)null); } + public BuMenuItem(BuMenuItem clone) + { + if(clone.getIcon()!=null) + this.setIcon(clone.getIcon()); + if(clone.getText()!=null) + this.setText(clone.getText()); + if(clone.getActionCommand()!=null) + this.setActionCommand(clone.getActionCommand()); + + if(clone.getActionListeners()!=null) + for(int i=0;i<clone.getActionListeners().length;i++) + this.addActionListener(clone.getActionListeners()[i]); + if(clone.getAccelerator()!=null) + this.setAccelerator(clone.getAccelerator()); + + if(clone.id_!=null) + this.id_=clone.id_; + else { + String gene= CtuluLibGenerator.getInstance().deliverUniqueStringId(); + this.id_=gene; + clone.id_=gene; + } + } + public BuMenuItem(BuIcon _icon) { this("",_icon); @@ -95,7 +129,48 @@ super.paint(_g); } - public Point getToolTipLocation(MouseEvent _evt) + +public boolean equals(Object obj) { + if(obj instanceof BuMenuItem){} + else return false; + if(obj==this) + return true; + + + BuMenuItem clone=(BuMenuItem)obj; + if(clone.id_==null || this.id_==null) + return false; + if(!clone.id_.equals(this.id_)) + return false; +// +// if(clone.getText()!=null && this.getText()!=null ) +// if(! this.getText().equals(clone.getText())) +// return false; +// +// if(clone.getActionCommand()!=null && this.getActionCommand()!=null ) +// if(!clone.getActionCommand().equals(this.getActionCommand())) +// return false; +// List<ActionListener> liste=new ArrayList<ActionListener>(); +// if(clone.getActionListeners()!=null) +// for(int i=0;i<clone.getActionListeners().length;i++) +// liste.add(clone.getActionListeners()[i]); +// if(clone.getActionListeners()!=null){ +// for(int i=0;i<this.getActionListeners().length;i++) +// if(!liste.contains(this.getActionListeners()[i])) +// return false; +// +// }else if (liste.size()>0) +// return false; +// + + + + + + return true; +} + +public Point getToolTipLocation(MouseEvent _evt) { Point r=super.getToolTipLocation(_evt); if(r==null) r=new Point(getWidth(),0); Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/commun/EbliModelInfos.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/commun/EbliModelInfos.java 2009-01-29 09:53:07 UTC (rev 4424) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/commun/EbliModelInfos.java 2009-01-29 18:53:28 UTC (rev 4425) @@ -28,6 +28,7 @@ private static final long serialVersionUID = -2080709568281587469L; private List<String> listeKey_; + private List<String> listeValue_; private final List<String> colonnes_; /** * Les infos de la table. @@ -46,6 +47,11 @@ infos_=map; comparator_=comparator; colonnes_=colonnes; + + listeValue_=new ArrayList<String>(); + for(String key:liste) + listeValue_.add(map.get(key)); + } @@ -83,11 +89,17 @@ if(row==getRowCount()-1 && !((String)value).equals(EbliResource.EBLI.getString("Editable"))){ //-- ajout --// - if(column==1) - infos_.put("Note "+(infos_.keySet().size()+1),(String)value); - else + if(column==1){ + String newKey="Note "+(infos_.keySet().size()+1); + infos_.put(newKey,(String)value); + listeKey_.add(newKey); + listeValue_.add((String)value); + } + else{ infos_.put((String)value,""); - + listeKey_.add((String)value); + listeValue_.add(""); + } fireTableDataChanged(); }else{ @@ -96,8 +108,10 @@ String res=infos_.get(getKey(row)); infos_.remove(getKey(row)); infos_.put((String)value, res); + listeKey_.set(row, (String)value); }else{ infos_.put(getKey(row),(String)value); + listeValue_.set(row,(String)value); } fireTableDataChanged(); } @@ -114,17 +128,17 @@ public void fireTableDataChanged() { //-- on modif le tableau --// - listeKey_=new ArrayList<String>(infos_.keySet()); - //-- on ordonne la liste - if(comparator_==null) - Collections.sort(listeKey_); - else - Collections.sort(listeKey_,comparator_); +// listeKey_=new ArrayList<String>(infos_.keySet()); +// //-- on ordonne la liste +// if(comparator_==null) +// Collections.sort(listeKey_); +// else +// Collections.sort(listeKey_,comparator_); super.fireTableDataChanged(); } public String getValue(int row){ - return infos_.get(getKey(row)); + return listeValue_.get(row); } @Override Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGraphe.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGraphe.java 2009-01-29 09:53:07 UTC (rev 4424) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGraphe.java 2009-01-29 18:53:28 UTC (rev 4425) @@ -58,6 +58,13 @@ public static final Font DEFAULT_FONT = new Font("SansSerif", Font.PLAIN, 10); + + /** + * Liste qui contient les parametres d'origines des titres, + * doit etre relanc\xE9 dans le cas ou l'on ajoute de nouveau une legende. + */ + HashMap<EGCourbe,String> listeTitlesOrigins_=new HashMap<EGCourbe,String>(); + private static void zoomIn(final EGAxe _axe, final double _sCenter, final double _zoomFactor) { final double newEcart = _axe.getEcart() * _zoomFactor / 2; final double newMax = _sCenter + newEcart; @@ -104,6 +111,8 @@ cmd_ = new CtuluCommandManager(); repereController_ = new RepereMouseKeyController(this); setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR)); + + initTitlesOrigins(); } private void ajusteXAxe() { @@ -857,6 +866,22 @@ zoom(true); } + + + + public void initTitlesOrigins( ){ + EGCourbe[] listeCourbes=getModel().getCourbes(); + for(int i=0;i<listeCourbes.length;i++) + listeTitlesOrigins_.put(listeCourbes[i], listeCourbes[i].getTitle()); + + } + public void reinitTitlesOrigins( ){ + EGCourbe[] listeCourbes=getModel().getCourbes(); + for(int i=0;i<listeCourbes.length;i++) + if(listeTitlesOrigins_.get(listeCourbes[i])!=null) + listeCourbes[i].setTitle(listeTitlesOrigins_.get(listeCourbes[i])); + + } public EGGraphe duplicate() { EGGrapheDuplicator duplicator = new EGGrapheDuplicator(); Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGPaletteLegendeGraphe.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGPaletteLegendeGraphe.java 2009-01-29 09:53:07 UTC (rev 4424) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGPaletteLegendeGraphe.java 2009-01-29 18:53:28 UTC (rev 4425) @@ -381,7 +381,8 @@ * Reinitialise les titres des courbes avec les donn\xE9es initiales. */ private void reinitPlages() { - + graphe_.reinitTitlesOrigins(); + list_.revalidate(); } /** Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetControllerGraphe.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetControllerGraphe.java 2009-01-29 09:53:07 UTC (rev 4424) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetControllerGraphe.java 2009-01-29 18:53:28 UTC (rev 4425) @@ -82,11 +82,7 @@ EbliActionEditorOneClick<BuPanel> editorAction_; - /** - * Liste qui contient les parametres d'origines des titres, - * doit etre relanc\xE9 dans le cas ou l'on ajoute de nouveau une legende. - */ - HashMap<EGCourbe,String> listeTitlesOrigins_=new HashMap<EGCourbe,String>(); + public EbliWidgetControllerGraphe(final EbliWidgetGraphe widget_, final EbliNodeDefault nodeLegende) { super(widget_); @@ -100,7 +96,7 @@ setProportional(true); - initTitlesOrigins(widgetGraphe_.panelGraphe_.getGraphe().getModel()); + @@ -332,25 +328,9 @@ }); } - /** - * Initialise les titres d origines du graphe. - * @param model - */ - public void initTitlesOrigins(EGGrapheModel model){ - EGCourbe[] listeCourbes=model.getCourbes(); - for(int i=0;i<listeCourbes.length;i++) - listeTitlesOrigins_.put(listeCourbes[i], listeCourbes[i].getTitle()); - - } - public void reinitTitlesOrigins(EGGrapheModel model){ - EGCourbe[] listeCourbes=model.getCourbes(); - for(int i=0;i<listeCourbes.length;i++) - if(listeTitlesOrigins_.get(listeCourbes[i])!=null) - listeCourbes[i].setTitle(listeTitlesOrigins_.get(listeCourbes[i])); - - } + public void ajoutLegende() { // -- creation de la l\xE9gende --// if (widget_.getEbliScene() != null) { @@ -368,7 +348,7 @@ widgetGraphe_.getNodeLegende().setPreferedLocation(positionLegende); } - // -- non de la legende --// + // -- nom de la legende --// widgetGraphe_.getNodeLegende().setTitle("L\xE9gende " + (indiceLegende++)); final EbliWidgetCreatorLegende creator = new EbliWidgetCreatorLegende(((EbliWidgetGraphe) widget_).getGraphe(), @@ -384,7 +364,7 @@ //-- reinitialisation des titres de la legendes --// - reinitTitlesOrigins(widgetGraphe_.panelGraphe_.getGraphe().getModel()); + widgetGraphe_.panelGraphe_.getGraphe().reinitTitlesOrigins(); } else if (widgetGraphe_.getNodeLegende().hasWidget()) { // -- cas ou la legende est masquee --// widgetGraphe_.getNodeLegende().getWidget().setVisible(true); Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaCourbeWizardImportScope.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaCourbeWizardImportScope.java 2009-01-29 09:53:07 UTC (rev 4424) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaCourbeWizardImportScope.java 2009-01-29 18:53:28 UTC (rev 4425) @@ -2,6 +2,8 @@ import java.awt.BorderLayout; import java.awt.CardLayout; +import java.awt.Component; +import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.GridLayout; import java.awt.event.ActionEvent; @@ -13,6 +15,8 @@ import javax.swing.AbstractAction; import javax.swing.BorderFactory; +import javax.swing.Box; +import javax.swing.ButtonGroup; import javax.swing.DefaultListModel; import javax.swing.JCheckBox; import javax.swing.JComboBox; @@ -31,6 +35,7 @@ import org.fudaa.ctulu.ProgressionInterface; import org.fudaa.ctulu.fileformat.FileFormat; import org.fudaa.ctulu.fileformat.FileFormatUnique; +import org.fudaa.ctulu.gui.CtuluDialogPanel; import org.fudaa.ctulu.gui.CtuluFileChooser; import org.fudaa.ctulu.gui.CtuluLibSwing; import org.fudaa.ctulu.gui.CtuluTaskOperationGUI; @@ -50,17 +55,27 @@ import org.fudaa.fudaa.commun.impl.FudaaGuiLib; import org.fudaa.fudaa.ressource.FudaaResource; import org.fudaa.fudaa.tr.common.TrResource; +import org.jdesktop.swingx.UIAction; +import com.memoire.bu.BuBorderLayout; +import com.memoire.bu.BuBorders; import com.memoire.bu.BuButton; import com.memoire.bu.BuButtonPanel; import com.memoire.bu.BuCharValidator; import com.memoire.bu.BuFileFilter; +import com.memoire.bu.BuLabel; +import com.memoire.bu.BuList; +import com.memoire.bu.BuPanel; +import com.memoire.bu.BuRadioButton; import com.memoire.bu.BuResource; +import com.memoire.bu.BuScrollPane; import com.memoire.bu.BuStringValidator; import com.memoire.bu.BuTextField; +import com.memoire.bu.BuToggleButton; import com.memoire.bu.BuValueValidator; import com.memoire.bu.BuWizardDialog; import com.memoire.bu.BuWizardTask; +import com.memoire.fu.FuComparator; /** * Wizard qui se charge d'importer des courbes au format scope dans le post. @@ -85,71 +100,80 @@ File fileChoosen_=null; protected ScopeStructure data_; EGGraphe result_; - + //choix du fichier JPanel panelFichier_; BuTextField filePath_; - + //choix parametres s t ou gene JPanel panelParametres_; - + //choix donnees S et T BuTextField plageDeb_=new BuTextField(5); BuTextField plageFin_=new BuTextField(5); double xMin; - double xMax; + double xMax; JList listVariablesST_; - - + + public static class ImportAction extends EbliActionSimple { - final FudaaCommonImplementation ui_; - FudaaCourbeImporter.Target target_; - public ImportAction(final FudaaCommonImplementation _ui,FudaaCourbeImporter.Target target) { - super(BuResource.BU.getString("Importer au format scope"), BuResource.BU.getIcon("IMPORTER"), "IMPORTER"); - ui_ = _ui; - target_=target; - } - public void actionPerformed(final ActionEvent _e) { - FudaaCourbeWizardImportScope wizard=new FudaaCourbeWizardImportScope(ui_,target_); - BuWizardDialog DialogWizard = new BuWizardDialog(ui_.getFrame(), wizard); - // --affichage du wizard --// - DialogWizard.setSize(600, 500); - DialogWizard.setLocationRelativeTo(ui_.getFrame()); - DialogWizard.setVisible(true); - } + final FudaaCommonImplementation ui_; + FudaaCourbeImporter.Target target_; + public ImportAction(final FudaaCommonImplementation _ui,FudaaCourbeImporter.Target target) { + super(BuResource.BU.getString("Importer au format scope"), BuResource.BU.getIcon("IMPORTER"), "IMPORTER"); + ui_ = _ui; + target_=target; + } + public void actionPerformed(final ActionEvent _e) { + FudaaCourbeWizardImportScope wizard=new FudaaCourbeWizardImportScope(ui_,target_); + BuWizardDialog DialogWizard = new BuWizardDialog(ui_.getFrame(), wizard); + // --affichage du wizard --// + DialogWizard.setSize(600, 500); + DialogWizard.setLocationRelativeTo(ui_.getFrame()); + DialogWizard.setVisible(true); + } } - + /** * Boolean qui implique si on rejoue et dans ce cas si on ecrase les datas. */ boolean replayData_=false; - + public FudaaCourbeWizardImportScope(FudaaCommonImplementation impl,FudaaCourbeImporter.Target target) { this(impl,target,false,null); - - + + } - + public FudaaCourbeWizardImportScope(FudaaCommonImplementation impl,FudaaCourbeImporter.Target target,boolean replayData,File fileToReload) { super(); target_=target; impl_=impl; replayData_=replayData; fileChoosen_=fileToReload; - + //-- on avance \xE0 l'\xE9tape 2 directement --// if(replayData_ && fileChoosen_!=null){ panelFichier_=buildFilePanel(); this.filePath_.setText(""+fileChoosen_.getAbsolutePath()); typeFormat_=devineTypeWithExtension(fileChoosen_.getName()); - computeData(impl.getMainProgression()); - current_=1; + if(typeFormat_==-1) + typeFormat_=selectType("Choix du format", impl.getFrame()); + try{ + computeData(impl.getMainProgression()); + current_=1; + }catch(Exception e){ + impl_.error("Impossible de charger le fichier avec l'algorithme "+getType(typeFormat_)+".\n Le format n'est pas compatible. Veuillez essayer avec une autre extension."); + } + + + } - + } - + public int devineTypeWithExtension(String name){ - + for(int i=0;i<ScopeSFileFormat.getInstance().getExtensions().length;i++) if(name.contains(ScopeSFileFormat.getInstance().getExtensions()[i]) || name.contains(ScopeSFileFormat.getInstance().getExtensions()[i].toLowerCase())) return 0; @@ -157,39 +181,39 @@ if(name.contains(ScopeSFileFormat.getInstance().getExtensions()[i])|| name.contains(ScopeSFileFormat.getInstance().getExtensions()[i].toLowerCase())) return 1; for(int i=0;i<ScopeGENEFileFormat.getInstance().getExtensions().length;i++){ - String ext=ScopeGENEFileFormat.getInstance().getExtensions()[i]; + String ext=ScopeGENEFileFormat.getInstance().getExtensions()[i]; if(name.contains(ScopeGENEFileFormat.getInstance().getExtensions()[i])|| name.contains(ScopeGENEFileFormat.getInstance().getExtensions()[i].toLowerCase())) return 2; } - return -1; - - + return -1; + + } - - + + @Override public JComponent getStepComponent() { - switch (current_) { - case 0: { + switch (current_) { + case 0: { - if(panelFichier_==null) - panelFichier_=buildFilePanel(); - return panelFichier_; - } - case 1: { - - if(data_==null){ - return new JLabel(TrResource.getS("Erreur. Veuillez choisir un fichier valide")); - } - -// if(panelParametres_==null) -// panelParametres_=buildPanelParametresImportation(); - return buildPanelParametresImportation(); - } - - } + if(panelFichier_==null) + panelFichier_=buildFilePanel(); + return panelFichier_; + } + case 1: { - return null; + if(data_==null){ + return new JLabel(TrResource.getS("Erreur. Veuillez choisir un fichier valide")); + } + + // if(panelParametres_==null) + // panelParametres_=buildPanelParametresImportation(); + return buildPanelParametresImportation(); + } + + } + + return null; } @Override @@ -201,47 +225,54 @@ public String getStepText() { String r = null; - switch (current_) { - case 0: - - break; - case 1: - - break; - - } - return r; + switch (current_) { + case 0: + + break; + case 1: + + break; + + } + return r; } ScopeStructure.SorT dataST(){ return (ScopeStructure.SorT)data_; } - + ScopeStructure.Gene dataG(){ return (ScopeStructure.Gene)data_; } - + @Override public String getStepTitle() { - String r = null; + String r = null; - switch (current_) { - case 0: - r = TrResource.getS("Choisir le fichier"); - break; - case 1: - r = TrResource.getS("Param\xE8tres de cr\xE9ation"); - break; - - } - return r; + switch (current_) { + case 0: + r = TrResource.getS("Choisir le fichier"); + break; + case 1: + r = TrResource.getS("Param\xE8tres de cr\xE9ation"); + break; + + } + return r; } + BuRadioButton typeScopeS=new BuRadioButton("Scop S"); + BuRadioButton typeScopeT=new BuRadioButton("Scop T"); + BuRadioButton typeScopeGENE=new BuRadioButton("Scop GENE"); + int typeRadioChoisi_=-1; /** * construit le panel de selection du fichier * @return */ JPanel buildFilePanel(){ + + BuPanel conteneur=new BuPanel(new BorderLayout()); + final JLabel labelAlerte=new JLabel(""); JPanel content=new JPanel(new FlowLayout(FlowLayout.CENTER)); content.add(new JLabel(TrResource.getS("Choisir le fichier:"))); filePath_=new BuTextField(20); @@ -250,78 +281,184 @@ BuButton parcourir =new BuButton(TrResource.getS("Parcourir...")); parcourir.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent arg0) { - final FileFormat[] ft = getFileFormatForImport(); - Arrays.sort(ft); - final BuFileFilter[] filters = FileFormat.createFilters(ft); - final CtuluFileChooser fileChooser = FudaaGuiLib.getFileChooser(BuResource.BU.getString("Importer"), filters, - null); - fileChooser.setAcceptAllFileFilterUsed(false); - for (int i = filters.length - 1; i >= 0; i--) { - if (ft[i].getID() == EvolutionFileFormat.getInstance().getID()) { - fileChooser.setFileFilter(filters[i]); - break; - } - } - final File initFile = FudaaGuiLib.chooseFile(CtuluLibSwing.getFrameAncestor(impl_.getParentComponent()), true,fileChooser); - if (initFile == null) { - return; - } - filePath_.setText(initFile.getAbsolutePath()); - - final FileFilter filter = fileChooser.getFileFilter(); - final int i = CtuluLibArray.getIndex(filter, filters); - if (i < 0) { - return; - } - typeFormat_=i; - fileChoosen_=initFile; - importData(); - - - + final FileFormat[] ft = getFileFormatForImport(); + Arrays.sort(ft); + final BuFileFilter[] filters = FileFormat.createFilters(ft); + final CtuluFileChooser fileChooser = FudaaGuiLib.getFileChooser(BuResource.BU.getString("Importer"), filters, + null); + fileChooser.setAcceptAllFileFilterUsed(true); + for (int i = filters.length - 1; i >= 0; i--) { + if (ft[i].getID() == EvolutionFileFormat.getInstance().getID()) { + fileChooser.setFileFilter(filters[i]); + break; + } + } + final File initFile = FudaaGuiLib.chooseFile(CtuluLibSwing.getFrameAncestor(impl_.getParentComponent()), true,fileChooser); + if (initFile == null) { + return; + } + filePath_.setText(initFile.getAbsolutePath()); + + final FileFilter filter = fileChooser.getFileFilter(); + final int i = CtuluLibArray.getIndex(filter, filters); + // if (i < 0) { + // return; + // } + typeFormat_=i; + + //-- si -1, c'est qu'on a choisi le filtre all, il faut alors le determiner --// + typeFormat_=devineTypeWithExtension(initFile.getName()); + + //-- si le format vaut toujours -1, il faut pr\xE9ciser avec le bouton radio --// + if(typeFormat_==-1){ + + if(typeRadioChoisi_>-1){ + if(impl_.question("format non reconnu", "Le format n'est pas reconnu, le fichier sera charg\xE9 avec l'algorithme "+getType(typeRadioChoisi_)+".\n continuer ?")) + typeFormat_=typeRadioChoisi_; + else + typeFormat_=selectType("Selection du type de format",impl_.getFrame()); + + } + else{ + labelAlerte.setText(FudaaResource.FUDAA.getString("Attention, format non reconnu, pr\xE9cisez \xE0 l'aide des boutons radio")); + typeFormat_=selectType("Selection du type de format",impl_.getFrame()); + } + } + //-- on met a jour el bon bouton radio --// + switch(typeFormat_){ + case 0:typeScopeS.setSelected(true);break; + case 1:typeScopeT.setSelected(true);break; + case 2:typeScopeGENE.setSelected(true);break; + + + } + + fileChoosen_=initFile; + try{ + importData(); + }catch(Exception e){ + impl_.error("Impossible de charger le fichier avec l'algorithme "+getType(typeFormat_)+".\n Le format n'est pas compatible. Veuillez essayer avec une autre extension."); + } + + } - + }); content.add(parcourir); - return content; + + conteneur.add(content,BorderLayout.NORTH); + + //Box boutonsPanel=Box.createVerticalBox(); + BuPanel boutonsPanel=new BuPanel(new GridLayout(10,1)); + int hgap=150,vgap=20; + BuPanel boutons=new BuPanel(new FlowLayout(FlowLayout.LEFT,hgap,vgap)); + boutons.add(labelAlerte); + boutonsPanel.add(boutons); + boutons=new BuPanel(new FlowLayout(FlowLayout.LEFT,hgap,vgap)); + boutons.add(typeScopeS); + boutonsPanel.add(boutons); + boutons=new BuPanel(new FlowLayout(FlowLayout.LEFT,hgap,vgap)); + boutons.add(typeScopeT); + boutonsPanel.add(boutons); + boutons=new BuPanel(new FlowLayout(FlowLayout.LEFT,hgap,vgap)); + boutons.add(typeScopeGENE); + boutonsPanel.add(boutons); + //boutonsPanel.add(Box.createVerticalGlue()); + + boutonsPanel.setPreferredSize(new Dimension(300,200)); + + + + typeScopeS.addActionListener(new ActionListener(){ + public void actionPerformed(ActionEvent e) { + typeRadioChoisi_=0; + labelAlerte.setText("Scope S choisi"); + // if(fileChoosen_!=null) + // importData(); + }}); + typeScopeT.addActionListener(new ActionListener(){ + public void actionPerformed(ActionEvent e) { + typeRadioChoisi_=1; + labelAlerte.setText("Scope T choisi"); + // if(fileChoosen_!=null) + // importData(); + }}); + typeScopeGENE.addActionListener(new ActionListener(){ + public void actionPerformed(ActionEvent e) { + typeRadioChoisi_=2; + labelAlerte.setText("Scope GENE choisi"); + // if(fileChoosen_!=null) + // importData(); + }}); + ButtonGroup group=new ButtonGroup(); + group.add(typeScopeS); + group.add(typeScopeT); + group.add(typeScopeGENE); + + conteneur.add(boutonsPanel,BorderLayout.CENTER); + + return conteneur; + } + + public String getType(int i){ + switch(i){ + case 0:return "Scope S"; + case 1:return "Scope T"; + case 2:return "Scope GENE"; + default: return ""; + } + } + public static int selectType(final String _title, final Component _parent) { + + final Object[] _init=new String[]{"Scope S","Scope T","ScopeGENE"}; + final BuList l = CtuluLibSwing.createBuList(_init); + final CtuluDialogPanel pn = new CtuluDialogPanel(false); + pn.setLayout(new BuBorderLayout()); + pn.setBorder(BuBorders.EMPTY3333); + pn.add(new BuLabel(CtuluLib.getS("S\xE9lectionner le fichier r\xE9sultat")), BuBorderLayout.NORTH); + pn.add(new BuScrollPane(l)); + if (CtuluDialogPanel.isOkResponse(pn.afficheModale(_parent, _title))) { return l.getSelectedIndex(); } + return -1; + } + /** * Retourne les formats de fichiers disponibles * @return */ public static FileFormat[] getFileFormatForImport() { - final ArrayList<FileFormatUnique> r = new ArrayList<FileFormatUnique>(10); - r.add(ScopeSFileFormat.getInstance()); - r.add(ScopeTFileFormat.getInstance()); - r.add(ScopeGENEFileFormat.getInstance()); - final FileFormat[] rf = new FileFormat[r.size()]; - r.toArray(rf); - return rf; - } - - + final ArrayList<FileFormatUnique> r = new ArrayList<FileFormatUnique>(10); + r.add(ScopeSFileFormat.getInstance()); + r.add(ScopeTFileFormat.getInstance()); + r.add(ScopeGENEFileFormat.getInstance()); + final FileFormat[] rf = new FileFormat[r.size()]; + r.toArray(rf); + return rf; + } + + /** * Methode iumportante d'importation des datas en fonction du fichier choisi et du type. * Remplit la structure scope */ private void importData(){ - new CtuluTaskOperationGUI(impl_, FudaaLib.getS("Importation graphe")) { - public void act() { - - computeData(getMainStateReceiver()); - - - }}.start(); - + new CtuluTaskOperationGUI(impl_, FudaaLib.getS("Importation graphe")) { + public void act() { + + computeData(getMainStateReceiver()); + + + }}.start(); + } - + /** * Methode qui realise le calcul de la structure. * @param prog */ private void computeData(ProgressionInterface prog){ - + switch(typeFormat_){ case 0: //cas s @@ -337,55 +474,55 @@ break; } } - + private ScopeStructure.SorT lectureScopeS(final File _f,ProgressionInterface prog) { - final CtuluIOOperationSynthese op = ScopeSFileFormat.getInstance().getLastVersionInstance(null).read(_f, prog); - final ScopeStructure.SorT struct = (ScopeStructure.SorT) op.getSource(); - return struct; - } + final CtuluIOOperationSynthese op = ScopeSFileFormat.getInstance().getLastVersionInstance(null).read(_f, prog); + final ScopeStructure.SorT struct = (ScopeStructure.SorT) op.getSource(); + return struct; + } private ScopeStructure.SorT lectureScopeT(final File _f,ProgressionInterface prog) { - final CtuluIOOperationSynthese op = ScopeTFileFormat.getInstance().getLastVersionInstance(null).read(_f, prog); - final ScopeStructure.SorT struct = (ScopeStructure.SorT) op.getSource(); - return struct; - } + final CtuluIOOperationSynthese op = ScopeTFileFormat.getInstance().getLastVersionInstance(null).read(_f, prog); + final ScopeStructure.SorT struct = (ScopeStructure.SorT) op.getSource(); + return struct; + } private ScopeStructure.Gene lectureScopeGENE(final File _f,ProgressionInterface prog) { - final CtuluIOOperationSynthese op = ScopeGENEFileFormat.getInstance().getLastVersionInstance(null).read(_f, prog); - final ScopeStructure.Gene struct = (ScopeStructure.Gene) op.getSource(); - return struct; - } - - + final CtuluIOOperationSynthese op = ScopeGENEFileFormat.getInstance().getLastVersionInstance(null).read(_f, prog); + final ScopeStructure.Gene struct = (ScopeStructure.Gene) op.getSource(); + return struct; + } + + /** * Construit le panel de choix des donn\xE9es a importer pour les formats s et t * @return */ JPanel buildPanelScopeSorT(){ JPanel content=new JPanel(new BorderLayout()); - + String[] listeVar=new String[dataST().getNbVariables()-1]; - + //on ne prends pas les x for(int i=1;i<dataST().getNbVariables();i++) listeVar[i-1]=dataST().getVariable(i); - + listVariablesST_=new JList(listeVar); listVariablesST_.setSelectedIndex(0); content.add(listVariablesST_,BorderLayout.CENTER); listVariablesST_.setBorder(BorderFactory.createTitledBorder(TrResource.getS("S\xE9lection des variables"))); - + plageDeb_.setCharValidator(BuCharValidator.FLOAT); plageDeb_.setStringValidator(BuStringValidator.FLOAT); plageDeb_.setValueValidator(BuValueValidator.FLOAT); plageFin_.setCharValidator(BuCharValidator.FLOAT); plageFin_.setStringValidator(BuStringValidator.FLOAT); plageFin_.setValueValidator(BuValueValidator.FLOAT); - + //-- on init les plages --// xMin=dataST().getXMin(); plageDeb_.setText(""+xMin); xMax=dataST().getXMax(); plageFin_.setText(""+xMax); - + JPanel plages=new JPanel(new FlowLayout(FlowLayout.CENTER)); plages.add(new JLabel(TrResource.getS("Choisir la plage des abscisses"))); plages.add(plageDeb_); @@ -393,12 +530,12 @@ plages.add(plageFin_); plages.add(new JLabel("(Min: "+xMin+", Max: "+xMax+")")); content.add(plages,BorderLayout.SOUTH); - + return content; } - - - + + + JComboBox comBoChoixTypeGraphe_=new JComboBox(new String[]{TrResource.getS("Profil Spatial"),TrResource.getS("Evolution temporelle"),TrResource.getS("Corr\xE9lation")}); JList listSeparator_,listSeparatorDebPlage_,listSeparatorFinPlage_, listSeparatorCorrel1_,listSeparatorCorrel2_; JList listVariablesGENE_,listVariablesGENE2_,listVariablesGENECorrlX_,listVariablesGENECorrlY_; @@ -426,30 +563,30 @@ // TODO Auto-generated method stub return "("+nomVar+"/"+nomSeparator+")"; } - + public EvolutionReguliere transform(boolean _time){ - double[] tabX = new double[listX.size()]; - double[] tabY = new double[listY.size()]; - for (int j = 0; j < listX.size(); j++) { - tabX[j] = listX.get(j); - tabY[j] = listY.get(j); - } + double[] tabX = new double[listX.size()]; + double[] tabY = new double[listY.size()]; + for (int j = 0; j < listX.size(); j++) { + tabX[j] = listX.get(j); + tabY[j] = listY.get(j); + } EvolutionReguliere evol=new EvolutionReguliere(tabX, tabY,_time); evol.setNom(nomVar+" "+nomSeparator); evol.isScope_=true; - //-- ajout des infos specifiques --// - Map infos= evol.infos_; - infos.put("Type", "Profil spatial scopGene"); - infos.put("Fichier scopGENE", fileChoosen_.getName()); - infos.put(ScopeStructure.NOM_FICHIER, fileChoosen_.getAbsolutePath()); - infos.put("Variable", nomVar.replace(" ", "")); - infos.put("Plage de valeurs", nomSeparator.replace(" ", "")); - + //-- ajout des infos specifiques --// + Map infos= evol.infos_; + infos.put("Type", "Profil spatial scopGene"); + infos.put("Fichier scopGENE", fileChoosen_.getName()); + infos.put(ScopeStructure.NOM_FICHIER, fileChoosen_.getAbsolutePath()); + infos.put("Variable", nomVar.replace(" ", "")); + infos.put("Plage de valeurs", nomSeparator.replace(" ", "")); + return evol; } - + } - + /** * donne la description du fonctionnement de l'import gene specifique * @return @@ -459,13 +596,13 @@ case 0: return "<html><body>"+TrResource.getS("S\xE9lectionnez des couples variable/valeurs num\xE9riques de s\xE9parateur. <br /> Cliquez sur ajouter pour le prendre en compte. On peut ajouter plusieurs couples.<br /> Chaque couple g\xE9n\xE9rera une courbe en prenant les valeurs num\xE9riques du s\xE9parateur choisi.")+"</body></html> "; case 1: return "<html><body>"+TrResource.getS("S\xE9lectionner toutes les variables voulues ainsi q'une plage de d\xE9part et une plage de fin.<br /> Cela g\xE9n\xE9rera une courbe par variables. Chaque courbe prendra pour Y une interpolation par rapport au x choisi. <br />Il y aura donc autant de couples (x,y) que de s\xE9parateurs dans l'intervalle d\xE9but/fin choisi.")+"</body></html> "; case 2: return TrResource.getS("S\xE9lectionner une variable et une plage de valeur num\xE9rique pour repr\xE9senter les valeurs de X. Idem pour Y."); - + } return ""; - + } - - + + JCheckBox choixNuagePoints_; /** * Creation du panel scopGene pour choisir ses parametres @@ -477,7 +614,7 @@ final JPanel content=new JPanel(new BorderLayout()); content2.add(content,BorderLayout.CENTER); final JLabel description=new JLabel(getDescriptionImportGENE()); - + content.add(description,BorderLayout.NORTH); final JPanel container=new JPanel(layoutParamGene); content.add(container,BorderLayout.CENTER); @@ -486,14 +623,14 @@ String val=(String) comBoChoixTypeGraphe_.getSelectedItem(); layoutParamGene.show(container, val); //layoutParamGene.next(container); -// content.revalidate(); -// container.revalidate(); + // content.revalidate(); + // container.revalidate(); description.setText(getDescriptionImportGENE()); - + } }); - + //-- ACHTUNG!!! DANS LES SPEC ON VEUT POUVOIR SAISIR DES COUPLES SEPARATOR/VARIABLES --// //-- creation de la liste des variables --// String[] listeVar=new String[dataG().getNbVariables()-1]; @@ -502,7 +639,7 @@ listeVar[i-1]=dataG().getVariable(i); listVariablesGENE_=new JList(listeVar); listVariablesGENE_.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); - + //-- creation de la liste des separators --// listeVar=new String[dataG().getNbSeparator()]; //on ne prends pas les x @@ -510,63 +647,63 @@ listeVar[i]=dataG().getSeparator(i); listSeparator_=new JList(listeVar); listSeparator_.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); - - + + //-- panel reserv\xE9 aux profils spatiaux --// - JPanel paramProfils=new JPanel(new BorderLayout()); - container.add(paramProfils, TrResource.getS("Profil Spatial")); - JPanel choixVar=new JPanel(new GridLayout(1,2)); - JScrollPane pane=new JScrollPane(listVariablesGENE_); - pane.setBorder(BorderFactory.createTitledBorder(TrResource.getS("S\xE9lection des variables"))); - choixVar.add(pane); - pane=new JScrollPane(listSeparator_); - pane.setBorder(BorderFactory.createTitledBorder(TrResource.getS("Valeurs num\xE9riques du s\xE9parateur de bloc"))); - - choixVar.add(pane); - paramProfils.add(choixVar,BorderLayout.NORTH); - //--panel du milieu: liste de couples VAR/SEPARATOR --// - modelCoupleSpatiauxGENE_=new DefaultListModel(); - listCoupleSpatiauxGENE_=new JList(modelCoupleSpatiauxGENE_); - pane=new JScrollPane(listCoupleSpatiauxGENE_); - pane.setBorder(BorderFactory.createTitledBorder(TrResource.getS("Liste des couples variable/separateur"))); - paramProfils.add(pane,BorderLayout.CENTER); - //-- boutons du bas d'ajout/supression dans la liste --// - BuButton ajouter=new BuButton(FudaaResource.FUDAA.getIcon("crystal_ajouter"), TrResource.getS("Ajouter")); - ajouter.addActionListener(new ActionListener(){ - public void actionPerformed(ActionEvent e) { - if(listSeparator_.getSelectedIndex()==-1) - impl_.error(TrResource.getS("Il faut choisir une valeur num\xE9rique de s\xE9parateur.")); - else if(listVariablesGENE_.getSelectedIndex()==-1) - impl_.error(TrResource.getS("Il faut choisir une variable.")); - else{ - //-- creation du couple choisi en recherchant les bonnes donn\xE9es dans la structure --// - int indiceVarChoisie=listVariablesGENE_.getSelectedIndex()+1; - String varChoisie=dataG().getVariable(indiceVarChoisie); - String separatorChoisi=dataG().getSeparator(listSeparator_.getSelectedIndex()); - CoupleVarSepartor newCouple=new CoupleVarSepartor(varChoisie,separatorChoisi,dataG().getAllX(separatorChoisi),dataG().getListValueForVariableForSeparator(separatorChoisi,indiceVarChoisie)); - modelCoupleSpatiauxGENE_.addElement(newCouple); - } + JPanel paramProfils=new JPanel(new BorderLayout()); + container.add(paramProfils, TrResource.getS("Profil Spatial")); + JPanel choixVar=new JPanel(new GridLayout(1,2)); + JScrollPane pane=new JScrollPane(listVariablesGENE_); + pane.setBorder(BorderFactory.createTitledBorder(TrResource.getS("S\xE9lection des variables"))); + choixVar.add(pane); + pane=new JScrollPane(listSeparator_); + pane.setBorder(BorderFactory.createTitledBorder(TrResource.getS("Valeurs num\xE9riques du s\xE9parateur de bloc"))); + + choixVar.add(pane); + paramProfils.add(choixVar,BorderLayout.NORTH); + //--panel du milieu: liste de couples VAR/SEPARATOR --// + modelCoupleSpatiauxGENE_=new DefaultListModel(); + listCoupleSpatiauxGENE_=new JList(modelCoupleSpatiauxGENE_); + pane=new JScrollPane(listCoupleSpatiauxGENE_); + pane.setBorder(BorderFactory.createTitledBorder(TrResource.getS("Liste des couples variable/separateur"))); + paramProfils.add(pane,BorderLayout.CENTER); + //-- boutons du bas d'ajout/supression dans la liste --// + BuButton ajouter=new BuButton(FudaaResource.FUDAA.getIcon("crystal_ajouter"), TrResource.getS("Ajouter")); + ajouter.addActionListener(new ActionListener(){ + public void actionPerformed(ActionEvent e) { + if(listSeparator_.getSelectedIndex()==-1) + impl_.error(TrResource.getS("Il faut choisir une valeur num\xE9rique de s\xE9parateur.")); + else if(listVariablesGENE_.getSelectedIndex()==-1) + impl_.error(TrResource.getS("Il faut choisir une variable.")); + else{ + //-- creation du couple choisi en recherchant les bonnes donn\xE9es dans la structure --// + int indiceVarChoisie=listVariablesGENE_.getSelectedIndex()+1; + String varChoisie=dataG().getVariable(indiceVarChoisie); + String separatorChoisi=dataG().getSeparator(listSeparator_.getSelectedIndex()); + CoupleVarSepartor newCouple=new CoupleVarSepartor(varChoisie,separatorChoisi,dataG().getAllX(separatorChoisi),dataG().getListValueForVariableForSeparator(separatorChoisi,indiceVarChoisie)); + modelCoupleSpatiauxGENE_.addElement(newCouple); } - - }); - BuButton supprimer=new BuButton(FudaaResource.FUDAA.getIcon("crystal_enlever"), TrResource.getS("Enlever")); - supprimer.addActionListener(new ActionListener(){ - public void actionPerformed(ActionEvent e) { - if(listCoupleSpatiauxGENE_.getSelectedIndex()==-1) - impl_.error(TrResource.getS("Il faut choisir une valeur du couple \xE0 supprimer")); - - else{ - modelCoupleSpatiauxGENE_.remove(listCoupleSpatiauxGENE_.getSelectedIndex()); - } + } + + }); + BuButton supprimer=new BuButton(FudaaResource.FUDAA.getIcon("crystal_enlever"), TrResource.getS("Enlever")); + supprimer.addActionListener(new ActionListener(){ + public void actionPerformed(ActionEvent e) { + if(listCoupleSpatiauxGENE_.getSelectedIndex()==-1) + impl_.error(TrResource.getS("Il faut choisir une valeur du couple \xE0 supprimer")); + + else{ + modelCoupleSpatiauxGENE_.remove(listCoupleSpatiauxGENE_.getSelectedIndex()); } - - }); + } + + }); //ajout des boutons - JPanel panelActions=new JPanel(new FlowLayout()); - panelActions.add(ajouter); - panelActions.add(supprimer); - paramProfils.add(panelActions, BorderLayout.SOUTH); - + JPanel panelActions=new JPanel(new FlowLayout()); + panelActions.add(ajouter); + panelActions.add(supprimer); + paramProfils.add(panelActions, BorderLayout.SOUTH); + //-- panel reserv\xE9 aux courbes temporelles --// JPanel paramTempo=new JPanel(new BorderLayout()); container.add(paramTempo, TrResource.getS("Evolution temporelle")); @@ -584,12 +721,12 @@ listSeparatorFinPlage_=new JList(listeVar); listSeparatorFinPlage_.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); listSeparatorFinPlage_.setSelectedIndex(listSeparatorDebPlage_.getModel().getSize()-1); - + JPanel listData=new JPanel(new GridLayout(1,2)); JPanel listData2=new JPanel(new GridLayout(2,1)); pane=new JScrollPane(listVariablesGENE2_); pane.setBorder(BorderFactory.createTitledBorder(TrResource.getS("S\xE9lection des variables"))); - + listData.add(pane); listData.add(listData2); pane=new JScrollPane(listSeparatorDebPlage_); @@ -599,7 +736,7 @@ pane.setBorder(BorderFactory.createTitledBorder(TrResource.getS("Plage fin du s\xE9parateur de bloc"))); listData2.add(pane); paramTempo.add(listData,BorderLayout.CENTER); - + //textField contenant le x choisi xMax=dataG().getXMax(); xMin=dataG().getXMin(); @@ -611,15 +748,15 @@ panelInfo.add(fieldX); paramTempo.add(panelInfo,BorderLayout.SOUTH); fieldX.setText(""+((xMax+xMin)/2)); - - - + + + //-- panel reserv\xE9s au corr\xE9lations --// JPanel panelCorrelation=new JPanel(new BorderLayout()); JPanel paramCorrel=new JPanel(new GridLayout(2,2)); panelCorrelation.add(paramCorrel,BorderLayout.CENTER); container.add(panelCorrelation, TrResource.getS("Corr\xE9lation")); - + listeVar=new String[dataG().getNbVariables()-1]; for(int i=1;i<dataG().getNbVariables();i++) listeVar[i-1]=dataG().getVariable(i); @@ -627,19 +764,19 @@ listVariablesGENECorrlX_.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); listVariablesGENECorrlY_=new JList(listeVar); listVariablesGENECorrlY_.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); - - + + listeVar=new String[dataG().getNbSeparator()]; for(int i=0;i<dataG().getNbSeparator();i++) listeVar[i]=dataG().getSeparator(i); listSeparatorCorrel1_=new JList(listeVar); listSeparatorCorrel1_.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); listSeparatorCorrel1_.setSelectedIndex(0); - + listSeparatorCorrel2_=new JList(listeVar); listSeparatorCorrel2_.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); listSeparatorCorrel2_.setSelectedIndex(0); - + pane=new JScrollPane(listVariablesGENECorrlX_); pane.setBorder(BorderFactory.createTitledBorder(TrResource.getS("S\xE9lection la variable pour l'axe X"))); paramCorrel.add(pane); @@ -652,13 +789,13 @@ pane=new JScrollPane(listSeparatorCorrel2_); pane.setBorder(BorderFactory.createTitledBorder(TrResource.getS("Plage associ\xE9e \xE0 la variable Y"))); paramCorrel.add(pane); - + choixNuagePoints_=new JCheckBox(EbliResource.EBLI.getString("Nuage de points")); panelCorrelation.add(choixNuagePoints_,BorderLayout.SOUTH); - + return content2; } - + JPanel buildPanelParametresImportation(){ switch(typeFormat_){ case 0: @@ -671,135 +808,135 @@ //cas scopGENE return buildPanelScopeGENE(); } - + return null; } - + public String getTaskTitle() { // TODO Auto-generated method stub return TrResource.getS("Importation depuis les formats Scop S, T et GENE"); } /** - * MEthode utilisee pour disabler ou non les boutons suivants - */ - public int getStepDisabledButtons() { - int r = super.getStepDisabledButtons(); - if (current_ == 1) { - - //cas scope s ou t - if(typeFormat_==1 || typeFormat_==0){ - if(data_==null) - r |= BuButtonPanel.TERMINER; - else - if(plageDeb_.getText().equals("") || plageFin_.getText().equals("")) - r |= BuButtonPanel.TERMINER; - else{ - //verifier que les plages ne sont pas depassees - double valDeb=Double.parseDouble(plageDeb_.getText()); - double valFin=Double.parseDouble(plageFin_.getText()); - if(valDeb<xMin || xMax<valFin) - r |= BuButtonPanel.TERMINER; - } - - }else{ - //cas scope gene - } - - } - return r; - } - - - public void doTask() { - done_ = true; - new CtuluTaskOperationGUI(impl_, FudaaLib.getS("Importation graphe")) { - public void act() { - - /** - * Cas de rejoue des donn\xE9es, on supprime le contenu du graphe - */ - if(replayData_){ - if(target_ instanceof EGGrapheTreeModel){ - java.util.List<EGCourbeChild> listecb=((EGGrapheTreeModel)target_).getAllCourbesChild(); - - ((EGGrapheTreeModel)target_).removeCurves( listecb.toArray(new EGCourbeChild[listecb.size()]), new CtuluCommandManager()); - - } - } - - - final ProgressionInterface prog = getMainStateReceiver(); - //mise a jour de la structure - impl_.setMainProgression(10); - impl_.setMainMessage(CtuluLib.getS("Structure modification")); - prog.setProgression(10); - prog.setDesc(CtuluLib.getS("Structure modification")); - if(typeFormat_<=1){ - dataST().restreindreStructure(listVariablesST_.getSelectedIndices(),Double.parseDouble(plageDeb_.getText()),Double.parseDouble(plageFin_.getText())); - impl_.setMainProgression(30); - impl_.setMainMessage(CtuluLib.getS("Cr\xE9ation du graphe")); - FudaaCourbeImporterScope.createGraphe(fileChoosen_,target_, data_, null, prog,false); - } - else{ - //-- format scopeGen, selon le type de format g\xE9n\xE9r\xE9--// - if(comBoChoixTypeGraphe_.getSelectedIndex()==0){ - //profil spatial, on recupere la liste des couples solutions - EvolutionReguliere[] tabEvol=new EvolutionReguliere[modelCoupleSpatiauxGENE_.getSize()]; - for(int i=0;i<modelCoupleSpatiauxGENE_.getSize();i++) - tabEvol[i]=((CoupleVarSepartor) modelCoupleSpatiauxGENE_.getElementAt(i)).transform(false); - - impl_.setMainProgression(30); - impl_.setMainMessage(CtuluLib.getS("Cr\xE9ation du graphe")); - FudaaCourbeImporterScope.createGraphe(target_, tabEvol, null, prog,false); - }else - if(comBoChoixTypeGraphe_.getSelectedIndex()==1){ - //evol temporelle - int debSeparator=listSeparatorDebPlage_.getSelectedIndex(); - int finSeparator=listSeparatorFinPlage_.getSelectedIndex(); - int[] selectedVariables= listVariablesGENE2_.getSelectedIndices(); - double xchoosen=Double.parseDouble(fieldX.getText()); - dataG().restreindreStructure(debSeparator,finSeparator,selectedVariables,xchoosen); - - impl_.setMainProgression(30); - impl_.setMainMessage(CtuluLib.getS("Cr\xE9ation du graphe")); - //on cree les evol reguliere SPECIFIQUES pour ces courbes. - FudaaCourbeImporterScope.createGraphe(target_, dataG().returnEvolRegulierePourTemporelles(xchoosen,fileChoosen_), null, prog,false); - - }else{ - //correlation - impl_.setMainProgression(30); - impl_.setMainMessage(CtuluLib.getS("Cr\xE9ation du graphe")); - //on cree les evol reguliere SPECIFIQUES pour ces courbes. - int varX=listVariablesGENECorrlX_.getSelectedIndex(); - int varY=listVariablesGENECorrlY_.getSelectedIndex(); - - int plageX=listSeparatorCorrel1_.getSelectedIndex(); - int plageY=listSeparatorCorrel2_.getSelectedIndex(); - - //-- recuperation du choix nuage de points ou non - boolean nuagePoints=choixNuagePoints_.isSelected(); - - FudaaCourbeImporterScope.createGraphe(target_, dataG().returnEvolReguliereCorrelation(varX,varY,plageX,plageY,fileChoosen_), null, prog,nuagePoints); - - - } - - } - - //-- mise en forme du resultata g\xE9n\xE9r\xE9 --// - createGraphImported(); - } - }.start(); - } + * MEthode utilisee pour disabler ou non les boutons suivants + */ + public int getStepDisabledButtons() { + int r = super.getStepDisabledButtons(); + if (current_ == 1) { - - /** - * Methode a surcharger. - * Appel\xE9e a la toute fin, gere le resultat - */ - public void createGraphImported(){ - //placer le graphe ou vous voulez... - } - + //cas scope s ou t + if(typeFormat_==1 || typeFormat_==0){ + if(data_==null) + r |= BuButtonPanel.TERMINER; + else + if(plageDeb_.getText().equals("") || plageFin_.getText().equals("")) + r |= BuButtonPanel.TERMINER; + else{ + //verifier que les plages ne sont pas depassees + double valDeb=Double.parseDouble(plageDeb_.getText()); + double valFin=Double.parseDouble(plageFin_.getText()); + if(valDeb<xMin || xMax<valFin) + r |= BuButtonPanel.TERMINER; + } + + }else{ + //cas scope gene + } + + } + return r; + } + + + public void doTask() { + done_ = true; + new CtuluTaskOperationGUI(impl_, FudaaLib.getS("Importation graphe")) { + public void act() { + + /** + * Cas de rejoue des donn\xE9es, on supprime le contenu du graphe + */ + if(replayData_){ + if(target_ instanceof EGGrapheTreeModel){ + java.util.List<EGCourbeChild> listecb=((EGGrapheTreeModel)target_).getAllCourbesChild(); + + ((EGGrapheTreeModel)target_).removeCurves( listecb.toArray(new EGCourbeChild[listecb.size()]), new CtuluCommandManager()); + + } + } + + + final ProgressionInterface prog = getMainStateReceiver(); + //mise a jour de la structure + impl_.setMainProgression(10); + impl_.setMainMessage(CtuluLib.getS("Structure modification")); + prog.setProgression(10); + prog.setDesc(CtuluLib.getS("Structure modification")); + if(typeFormat_<=1){ + dataST().restreindreStructure(listVariablesST_.getSelectedIndices(),Double.parseDouble(plageDeb_.getText()),Double.parseDouble(plageFin_.getText())); + impl_.setMainProgression(30); + impl_.setMainMessage(CtuluLib.getS("Cr\xE9ation du graphe")); + FudaaCourbeImporterScope.createGraphe(fileChoosen_,target_, data_, null, prog,false); + } + else{ + //-- format scopeGen, selon le type de format g\xE9n\xE9r\xE9--// + if(comBoChoixTypeGraphe_.getSelectedIndex()==0){ + //profil spatial, on recupere la liste des couples solutions + EvolutionReguliere[] tabEvol=new EvolutionReguliere[modelCoupleSpatiauxGENE_.getSize()]; + for(int i=0;i<modelCoupleSpatiauxGENE_.getSize();i++) + tabEvol[i]=((CoupleVarSepartor) modelCoupleSpatiauxGENE_.getElementAt(i)).transform(false); + + impl_.setMainProgression(30); + impl_.setMainMessage(CtuluLib.getS("Cr\xE9ation du graphe")); + FudaaCourbeImporterScope.createGraphe(target_, tabEvol, null, prog,false); + }else + if(comBoChoixTypeGraphe_.getSelectedIndex()==1){ + //evol temporelle + int debSeparator=listSeparatorDebPlage_.getSelectedIndex(); + int finSeparator=listSeparatorFinPlage_.getSelectedIndex(); + int[] selectedVariables= listVariablesGENE2_.getSelectedIndices(); + double xchoosen=Double.parseDouble(fieldX.getText()); + dataG().restreindreStructure(debSeparator,finSeparator,selectedVariables,xchoosen); + + impl_.setMainProgression(30); + impl_.setMainMessage(CtuluLib.getS("Cr\xE9ation du graphe")); + //on cree les evol reguliere SPECIFIQUES pour ces courbes. + FudaaCourbeImporterScope.createGraphe(target_, dataG().returnEvolRegulierePourTemporelles(xchoosen,fileChoosen_), null, prog,false); + + }else{ + //correlation + impl_.setMainProgression(30); + impl_.setMainMessage(CtuluLib.getS("Cr\xE9ation du graphe")); + //on cree les evol reguliere SPECIFIQUES pour ces courbes. + int varX=listVariablesGENECorrlX_.getSelectedIndex(); + int varY=listVariablesGENECorrlY_.getSelectedIndex(); + + int plageX=listSeparatorCorrel1_.getSelectedIndex(); + int plageY=listSeparatorCorrel2_.getSelectedIndex(); + + //-- recuperation du choix nuage de points ou non + boolean nuagePoints=choixNuagePoints_.isSelected(); + + FudaaCourbeImporterScope.createGraphe(target_, dataG().returnEvolReguliereCorrelation(varX,varY,plageX,plageY,fileChoosen_), null, prog,nuagePoints); + + + } + + } + + //-- mise en forme du resultata g\xE9n\xE9r\xE9 --// + createGraphImported(); + } + }.start(); + } + + + /** + * Methode a surcharger. + * Appel\xE9e a la toute fin, gere le resultat + */ + public void createGraphImported(){ + //placer le graphe ou vous voulez... + } + } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostBuilderSuiteCalcul.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostBuilderSuiteCalcul.java 2009-01-29 09:53:07 UTC (rev 4424) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostBuilderSuiteCalcul.java 2009-01-29 18:53:28 UTC (rev 4425) @@ -257,7 +257,7 @@ TrPostSource resultat = new TrPostSourceFromReader(suite, TrResource.getS("Suite de calcul"), grille, _impl); resultat.buildDefaultVarUpdateLists(); - _impl.getCurrentProject().deliverSourceSuiteId(resultat); + _impl.getCurrentProject().deliverSourceId(resultat); // -- creation du source Reader --// return resultat; } @@ -304,7 +304,7 @@ if (suiteProgressive != null) { maxiStringLeo += "La suite de calcul s'arrete donc avec les fichiers " + suiteProgressive.getTitle(); suiteProgressive.setId(idSrc); - projet.ajouterSource(suiteProgressive); + projet.ajouterSource(suiteProgressive,suiteProgressive.getTitle()); } impl.error(maxiStringLeo); @@ -315,7 +315,7 @@ // -- trigger signal modif --// suiteProgressive.setId(idSrc); - projet.ajouterSource(suiteProgressive); + projet.ajouterSource(suiteProgressive,suiteProgressive.getTitle()); return suiteProgressive; } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCommonImplementation.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCommonImplementation.java 2009-01-29 09:53:07 UTC (rev 4424) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCommonImplementation.java 2009-01-29 18:53:28 UTC (rev 4425) @@ -183,19 +183,21 @@ final String com = _evt.getActionCommand(); if ("CREER".equals(com)) { - + if(c_!=null){ - final int reponse = JOptionPane.showConfirmDialog(this.getParentComponent(),TrResource.getS("Le projet courant va \xEAtre ferm\xE9. \n Voulez vous sauvegarder le projet courant avant sa fermeture?")); - if (reponse == JOptionPane.CANCEL_OPTION) { return; } - if (reponse == JOptionPane.OK_OPTION) { - c_.getManager().saveProject(false); + final int reponse = JOptionPane.showConfirmDialog(this.getParentComponent(),TrResource.getS("Le projet courant va \xEAtre ferm\xE9. \n Voulez vous sauvegarder le projet courant avant sa fermeture?")); + if (reponse == JOptionPane.CANCEL_OPTION) { return; } + if (reponse == JOptionPane.OK_OPTION) { + c_.getManager().saveProject(false); + } + //-- nettoyage du projet pr\xE9c\xE9dent --// + + c_.getManager().clearProject(); } - //-- nettoyage du projet pr\xE9c\xE9dent --// - - c_.getManager().clearProject(); + else { + c_=new TrPostProjet(this); + c_.setMenuPost(); } - else - c_=new TrPostProjet(this); //-- ouverture d'un fichier r\xE9sultat qui sera automatiquement ajout\xE9 dans la layout courante --// c_.createNewLayoutFrame(); //-- ouverture d'un fichier r\xE9sultat --// @@ -207,17 +209,21 @@ }else if ("OUVRIR".equals(com)) { // -- ouverture d un nouveau projet --// + if(c_!=null){ + final int reponse = JOptionPane.showConfirmDialog(this.getParentComponent(),TrResource.getS("Le projet courant va \xEAtre ferm\xE9. \n Voulez vous sauvegarder le projet courant avant sa fermeture?")); + if (reponse == JOptionPane.CANCEL_OPTION) { return; } + if (reponse == JOptionPane.OK_OPTION) { + c_.getManager().saveProject(false); + } - final int reponse = JOptionPane.showConfirmDialog(this.getParentComponent(),TrResource.getS("Le projet courant va \xEAtre ferm\xE9. \n Voulez vous sauvegarder le projet courant avant sa fermeture?")); - if (reponse == JOptionPane.CANCEL_OPTION) { return; } - if (reponse == JOptionPane.OK_OPTION) { - c_.getManager().saveProject(false); + //-- nettoyage du projet pr\xE9c\xE9dent --// + c_.getManager().clearProject(); + }else + { + c_=new TrPostProjet(this); + c_.setMenuPost(); } - //-- nettoyage du projet pr\xE9c\xE9dent --// - c_.getManager().clearProject(); - - c_.getManager().loadProject(false, null); //new TrPostFusionProjet(c_); Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java ==========================================... [truncated message content] |
From: <emm...@us...> - 2009-01-29 09:53:09
|
Revision: 4424 http://fudaa.svn.sourceforge.net/fudaa/?rev=4424&view=rev Author: emmanuel_martin Date: 2009-01-29 09:53:07 +0000 (Thu, 29 Jan 2009) Log Message: ----------- Am?\195?\169lioration de la stabilit?\195?\169 du modeleur1d Modified Paths: -------------- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/controller/Controller1d.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/controller/ControllerBief.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/Bief.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/BiefSet.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/UtilsProfil1d.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/VueModuleGestionBief.java Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/controller/Controller1d.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/controller/Controller1d.java 2009-01-28 22:44:24 UTC (rev 4423) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/controller/Controller1d.java 2009-01-29 09:53:07 UTC (rev 4424) @@ -409,12 +409,10 @@ @Override public void internalFrameActivated(InternalFrameEvent e) { + controllerBief_.removeAllBiefs(); controllerBief_.updateFrom2d(); } - /* (non-Javadoc) - * @see javax.swing.event.InternalFrameAdapter#internalFrameDeactivated(javax.swing.event.InternalFrameEvent) - */ @Override public void internalFrameDeactivated(InternalFrameEvent e) { mng_.clean(); Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/controller/ControllerBief.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/controller/ControllerBief.java 2009-01-28 22:44:24 UTC (rev 4423) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/controller/ControllerBief.java 2009-01-29 09:53:07 UTC (rev 4424) @@ -74,7 +74,12 @@ * Se r\xE9g\xE9n\xE8re par rapport aux 2d. */ public void updateFrom2d(){ - importBiefsFrom2d(controller1d_.getImplementation().get2dFrame().getVisuPanel().getArbreCalqueModel().getRootCalque().getCalqueParNom("gcBiefs")); + try { + importBiefsFrom2d(controller1d_.getImplementation().get2dFrame().getVisuPanel().getArbreCalqueModel().getRootCalque().getCalqueParNom("gcBiefs")); + } + catch(IllegalArgumentException _exp) { + controller1d_.getImplementation().error(FudaaLib.getS("Erreur dans l'import depuis le 2d"), _exp.getMessage()); + } } /** @@ -107,6 +112,7 @@ biefSet_.removeBief(names[i], null); BCalque[] calques=_rootCalque.getCalques(); // It\xE9ration du chaque bief + StringBuilder errors=new StringBuilder(); for (int i=0; i<calques.length; i++) { BCalque calqueBief=calques[i]; List<ZModeleLigneBrisee> modelsDuFutureBief=new ArrayList<ZModeleLigneBrisee>(); @@ -116,13 +122,21 @@ if (sousCalques[j] instanceof FSigLayerLineEditable) modelsDuFutureBief.add(((FSigLayerLineEditable)sousCalques[j]).getModele()); // Ajout du bief - biefSet_.addBief(calqueBief.getTitle(), modelsDuFutureBief.toArray(new ZModeleLigneBrisee[0]), null); + try { + biefSet_.addBief(calqueBief.getTitle(), modelsDuFutureBief.toArray(new ZModeleLigneBrisee[0]), null); + } + catch (IllegalArgumentException _exp) { + errors.append(FudaaLib.getS("Bief \"")+calqueBief.getTitle()+"\" : "+_exp.getMessage()+"\n"); + } } // Ajout d'une selection if(biefSet_.getNbBief()>selectedValue&&selectedValue!=-1) biefSelectionModel_.addSelectionInterval(selectedValue, selectedValue); else if(biefSet_.getNbBief()>0&&selectedValue==-1) biefSelectionModel_.addSelectionInterval(0, 0); + // Traitement des erreurs + if(errors.length()>0) + throw new IllegalArgumentException(errors.toString()); } /** @@ -159,12 +173,36 @@ public void removeBief(int[] _idx){ Arrays.sort(_idx); CtuluCommandComposite cmd=new CtuluCommandComposite(FudaaLib.getS("Suppression de biefs")); - for(int i=_idx.length-1;i>=0;i--) + for(int i=_idx.length-1;i>=0;i--) { + if(biefSelectionModel_.getSelectedBief()==_idx[i]) + biefSelectionModel_.clearSelection(); biefSet_.removeBief(biefSet_.getBiefName(_idx[i]), cmd); + } getCommandManager().addCmd(cmd.getSimplify()); } /** + * Supprime tous les biefs. + */ + public void removeAllBiefs() { + int[] idx=new int[biefSet_.getNbBief()]; + for(int i=0;i<idx.length;i++) + idx[i]=i; + removeBief(idx); + } + + /** + * Supprime le bief selectionn\xE9. + */ + public void removeSelectedBief() { + int idxBief=biefSelectionModel_.getSelectedBief(); + if(idxBief!=-1) { + biefSelectionModel_.clearSelection(); + biefSet_.removeBief(biefSet_.getBiefName(idxBief), getCommandManager()); + } + } + + /** * Fusion de deux biefs. */ public void fusionnerBiefs(int _idxBief1, int _idxBief2){ @@ -373,9 +411,11 @@ public BiefSelectionModel getBiefSelectionModel() { return biefSelectionModel_; } - + /** - * Retourne le biefContainer, c'est \xE0 dire le conteneur de tout les biefs. + * Retourne le biefContainer, c'est \xE0 dire le conteneur de tous les biefs. + * Attention, pour la suppression de biefs, mieux vaut passer par le + * controller, sinon des incoh\xE9rences avec la selection peuvent apparaitre. */ public BiefSet getBiefSet(){ return biefSet_; Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/Bief.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/Bief.java 2009-01-28 22:44:24 UTC (rev 4423) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/Bief.java 2009-01-29 09:53:07 UTC (rev 4424) @@ -56,9 +56,11 @@ /** Le synchroniser de gis. */ private GisZoneSynchroniser gisSynchroniser_=new GisZoneSynchroniser(); - + /** * Les models de bases sont instanci\xE9s, le synchronizer n'est pas lanc\xE9. + * Attention le modele d'axe hydraulique ne contient pas d'axe hydraulique. Il + * est donc invalide. */ public Bief(){ axeHydraulique_=new MdlModel1dAxe(null); @@ -109,7 +111,7 @@ if (_models[i]==null) throw new IllegalArgumentException(FudaaLib.getS("Erreur programmation : _models ne doit pas contenir de valeurs null")); if (_models[i].getGeomData()==null) - throw new IllegalArgumentException(FudaaLib.getS("Erreur programmation : Certain model n'ont pas de GSIZone.")); + throw new IllegalArgumentException(FudaaLib.getS("Erreur programmation : Certain model n'ont pas de GSIZoneCollection.")); if (!(_models[i].getGeomData() instanceof GISZoneCollectionLigneBrisee)) throw new IllegalArgumentException(FudaaLib.getS("Erreur programmation : Toutes les GISZone doivent \xEAtre des GISZoneCollectionLigneBrisee.")); String nature=(String)_models[i].getGeomData().getFixedAttributValue(GISAttributeConstants.NATURE); @@ -119,7 +121,9 @@ if (axeHydraulique_!=null) throw new IllegalArgumentException(FudaaLib.getS("Plusieurs models d'axe hydrauliques sont donn\xE9es.")); else if (_models[i].getGeomData().getNbGeometries()>1) - throw new IllegalArgumentException(FudaaLib.getS("Il ne peut pas y avoir plusieurs Axes hydrauliques dans le bief.")); + throw new IllegalArgumentException(FudaaLib.getS("Il ne peut pas y avoir plusieurs axes hydrauliques dans le bief.")); + else if (_models[i].getGeomData().getNbGeometries()==0) + throw new IllegalArgumentException(FudaaLib.getS("Il doit y avoir au moins un axe hydraulique dans le bief.")); else axeHydraulique_=_models[i]; else if (nature==GISAttributeConstants.ATT_NATURE_LD) @@ -131,7 +135,7 @@ if (limitesStockages_!=null) throw new IllegalArgumentException(FudaaLib.getS("Plusieurs models de limites de stockage sont donn\xE9es.")); else if (_models[i].getGeomData().getNbGeometries()>2) - throw new IllegalArgumentException(FudaaLib.getS("Il ne peut pas y avoir plus de 2 limites de stockage.")); + throw new IllegalArgumentException(FudaaLib.getS("Il ne peut pas y avoir plus de 2 limites de stockages.")); else limitesStockages_=_models[i]; else if (nature==GISAttributeConstants.ATT_NATURE_PF) @@ -184,89 +188,83 @@ int idxAttlsDroite=zone.getIndiceOf(GISAttributeConstants.INTERSECTION_LIMITE_STOCKAGE_DROITE); int idxAttLignesDirectrices=zone.getIndiceOf(GISAttributeConstants.INTERSECTIONS_LIGNES_DIRECTRICES); - if (axeHydraulique_.getNombre()==0) - for (int i=0; i<profils_.getNombre(); i++) { - profils_.getGeomData().setAttributValue(idxAttRiveGauche, i, null, null); - profils_.getGeomData().setAttributValue(idxAttRiveDroite, i, null, null); - profils_.getGeomData().setAttributValue(idxAttlsGauche, i, null, null); - profils_.getGeomData().setAttributValue(idxAttlsDroite, i, null, null); - GISAttributeModelIntegerList attrModel=new GISAttributeModelIntegerList(0, GISAttributeConstants.INTERSECTIONS_LIGNES_DIRECTRICES); - attrModel.setListener(profils_.getGeomData()); - profils_.getGeomData().setAttributValue(idxAttLignesDirectrices, i, attrModel, null); + Geometry axeHydraulique=(Geometry)axeHydraulique_.getObject(0); + CoordinateSequence seqAxeHydraulique=((GISCoordinateSequenceContainerInterface)axeHydraulique).getCoordinateSequence(); + orderProfils(-1, null); + // Normalise le sens du profil \\ + for (int k=0; k<profils_.getNombre(); k++) { + Geometry profil=zone.getGeometry(k); + CoordinateSequence seqProfil=((GISCoordinateSequenceContainerInterface)profil).getCoordinateSequence(); + // Normalisation du sens (gauche/droite) du profil \\ + Coordinate interAxeProfil=profil.intersection(axeHydraulique).getCoordinate(); + // Cr\xE9ation du vecteur contenant le sens de l'axe hydraulique + Coordinate vAxeH; + int idxPrevious=UtilsProfil1d.getPreviousIndex(seqAxeHydraulique, interAxeProfil); + int idxNext=UtilsProfil1d.getNextIndex(seqAxeHydraulique, interAxeProfil); + if (idxPrevious!=-1) + vAxeH=new Coordinate(interAxeProfil.x-seqAxeHydraulique.getCoordinate(idxPrevious).x, interAxeProfil.y + -seqAxeHydraulique.getCoordinate(idxPrevious).y, 0); + else + vAxeH=new Coordinate(seqAxeHydraulique.getCoordinate(idxNext).x-interAxeProfil.x, + seqAxeHydraulique.getCoordinate(idxNext).y-interAxeProfil.y, 0); + // Cr\xE9ation du vecteur contenant le sens du profil + Coordinate vProfilH; + idxPrevious=UtilsProfil1d.getPreviousIndex(seqProfil, interAxeProfil); + idxNext=UtilsProfil1d.getNextIndex(seqProfil, interAxeProfil); + if (idxPrevious!=-1) + vProfilH=new Coordinate(interAxeProfil.x-seqProfil.getCoordinate(idxPrevious).x, interAxeProfil.y + -seqProfil.getCoordinate(idxPrevious).y, 0); + else + vProfilH=new Coordinate(seqProfil.getCoordinate(idxNext).x-interAxeProfil.x, seqProfil.getCoordinate(idxNext).y + -interAxeProfil.y, 0); + // Inversion du sens du profil si besoin + double produitVectorielCoordZ=vAxeH.x*vProfilH.y-vAxeH.y*vProfilH.x; + if (produitVectorielCoordZ>0) { + inverseProfil(k); + profil=(Geometry)profils_.getGeomData().getGeometry(k); + seqProfil=((GISCoordinateSequenceContainerInterface)profil).getCoordinateSequence(); } - if (axeHydraulique_.getNombre()==1) { - Geometry axeHydraulique=(Geometry)axeHydraulique_.getObject(0); - CoordinateSequence seqAxeHydraulique=((GISCoordinateSequenceContainerInterface)axeHydraulique).getCoordinateSequence(); - orderProfils(-1, null); - // Normalise le sens du profil \\ - for (int k=0; k<profils_.getNombre(); k++) { - Geometry profil=zone.getGeometry(k); - CoordinateSequence seqProfil=((GISCoordinateSequenceContainerInterface)profil).getCoordinateSequence(); - // Normalisation du sens (gauche/droite) du profil \\ - Coordinate interAxeProfil=profil.intersection(axeHydraulique).getCoordinate(); - // Cr\xE9ation du vecteur contenant le sens de l'axe hydraulique - Coordinate vAxeH; - int idxPrevious=UtilsProfil1d.getPreviousIndex(seqAxeHydraulique, interAxeProfil); - int idxNext=UtilsProfil1d.getNextIndex(seqAxeHydraulique, interAxeProfil); - if(idxPrevious!=-1) - vAxeH=new Coordinate(interAxeProfil.x-seqAxeHydraulique.getCoordinate(idxPrevious).x, interAxeProfil.y-seqAxeHydraulique.getCoordinate(idxPrevious).y, 0); - else - vAxeH=new Coordinate(seqAxeHydraulique.getCoordinate(idxNext).x-interAxeProfil.x, seqAxeHydraulique.getCoordinate(idxNext).y-interAxeProfil.y, 0); - // Cr\xE9ation du vecteur contenant le sens du profil - Coordinate vProfilH; - idxPrevious=UtilsProfil1d.getPreviousIndex(seqProfil, interAxeProfil); - idxNext=UtilsProfil1d.getNextIndex(seqProfil, interAxeProfil); - if(idxPrevious!=-1) - vProfilH=new Coordinate(interAxeProfil.x-seqProfil.getCoordinate(idxPrevious).x, interAxeProfil.y-seqProfil.getCoordinate(idxPrevious).y, 0); - else - vProfilH=new Coordinate(seqProfil.getCoordinate(idxNext).x-interAxeProfil.x, seqProfil.getCoordinate(idxNext).y-interAxeProfil.y, 0); - // Inversion du sens du profil si besoin - double produitVectorielCoordZ=vAxeH.x*vProfilH.y-vAxeH.y*vProfilH.x; - if (produitVectorielCoordZ>0) { - inverseProfil(k); - profil=(Geometry)profils_.getGeomData().getGeometry(k); - seqProfil=((GISCoordinateSequenceContainerInterface)profil).getCoordinateSequence(); - } - } - // Cr\xE9ation des nouveaux points sur les profils \\ - for (int k=0; k<profils_.getNombre(); k++) { - // Ajout des points au profil si n\xE9c\xE9ssaire pour les intersections \\ - // Lignes de contraintes - for (int l=0; l<lignesContraints_.getNombre(); l++) - createPointIfNeededKeepZ(k, l, lignesContraints_); - // Rives - for (int l=0; l<rives_.getNombre(); l++) - createPointIfNeeded(k, (GISPolyligne) rives_.getObject(l)); - // Limites de stockages - for (int l=0; l<limitesStockages_.getNombre(); l++) - createPointIfNeeded(k, (GISPolyligne) limitesStockages_.getObject(l)); - // Lignes directrices - for (int l=0; l<lignesDirectrices_.getNombre(); l++) - createPointIfNeeded(k, (GISPolyligne) lignesDirectrices_.getObject(l)); - } - // Valuation des attributs simple d'intersection (rives et limites) \\ - for(int k=0;k<profils_.getNombre();k++) { - Geometry profil=zone.getGeometry(k); - CoordinateSequence seqProfil=((GISCoordinateSequenceContainerInterface)profil).getCoordinateSequence(); - Coordinate interAxeProfil=profil.intersection(axeHydraulique).getCoordinate(); - double abscisseCurvIntersectionAxe=UtilsProfil1d.abscisseCurviligne(seqProfil, interAxeProfil); - // Valuation des attributs avec les index des points des intersections \\ - // Rives - zone.setAttributValue(idxAttRiveGauche, k, 0, null); - zone.setAttributValue(idxAttRiveDroite, k, seqProfil.size()-1, null); - for (int l=0; l<rives_.getNombre(); l++) - valuateProfilIntersection(k, (Geometry) rives_.getObject(l), idxAttRiveGauche, idxAttRiveDroite, abscisseCurvIntersectionAxe); - // D\xE9tection des croisements zones de stockages droite et gauche \\ - // Limites de stockages - zone.setAttributValue(idxAttlsGauche, k, 0, null); - zone.setAttributValue(idxAttlsDroite, k, seqProfil.size()-1, null); - for (int l=0; l<limitesStockages_.getNombre(); l++) - valuateProfilIntersection(k, (Geometry) limitesStockages_.getObject(l), idxAttlsGauche, idxAttlsDroite, abscisseCurvIntersectionAxe); - } - // Valuation des attributs composites d'intersection (lignes directrices) \\ - // Lignes directrices \\ - valuateProfilIntersection(idxAttLignesDirectrices); } + // Cr\xE9ation des nouveaux points sur les profils \\ + for (int k=0; k<profils_.getNombre(); k++) { + // Ajout des points au profil si n\xE9c\xE9ssaire pour les intersections \\ + // Lignes de contraintes + for (int l=0; l<lignesContraints_.getNombre(); l++) + createPointIfNeededKeepZ(k, l, lignesContraints_); + // Rives + for (int l=0; l<rives_.getNombre(); l++) + createPointIfNeeded(k, (GISPolyligne)rives_.getObject(l)); + // Limites de stockages + for (int l=0; l<limitesStockages_.getNombre(); l++) + createPointIfNeeded(k, (GISPolyligne)limitesStockages_.getObject(l)); + // Lignes directrices + for (int l=0; l<lignesDirectrices_.getNombre(); l++) + createPointIfNeeded(k, (GISPolyligne)lignesDirectrices_.getObject(l)); + } + // Valuation des attributs simple d'intersection (rives et limites) \\ + for (int k=0; k<profils_.getNombre(); k++) { + Geometry profil=zone.getGeometry(k); + CoordinateSequence seqProfil=((GISCoordinateSequenceContainerInterface)profil).getCoordinateSequence(); + Coordinate interAxeProfil=profil.intersection(axeHydraulique).getCoordinate(); + double abscisseCurvIntersectionAxe=UtilsProfil1d.abscisseCurviligne(seqProfil, interAxeProfil); + // Valuation des attributs avec les index des points des intersections \\ + // Rives + zone.setAttributValue(idxAttRiveGauche, k, 0, null); + zone.setAttributValue(idxAttRiveDroite, k, seqProfil.size()-1, null); + for (int l=0; l<rives_.getNombre(); l++) + valuateProfilIntersection(k, (Geometry)rives_.getObject(l), idxAttRiveGauche, idxAttRiveDroite, abscisseCurvIntersectionAxe); + // D\xE9tection des croisements zones de stockages droite et gauche \\ + // Limites de stockages + zone.setAttributValue(idxAttlsGauche, k, 0, null); + zone.setAttributValue(idxAttlsDroite, k, seqProfil.size()-1, null); + for (int l=0; l<limitesStockages_.getNombre(); l++) + valuateProfilIntersection(k, (Geometry)limitesStockages_.getObject(l), idxAttlsGauche, idxAttlsDroite, + abscisseCurvIntersectionAxe); + } + // Valuation des attributs composites d'intersection (lignes directrices) \\ + // Lignes directrices \\ + valuateProfilIntersection(idxAttLignesDirectrices); + // Valuation des attributs sp\xE9cifique au 1d pour l'axe hydraulique \\ normalizeAxeHydrauliqueAttributes(axeHydraulique_.getGeomData()); // Activation du synchroniser @@ -612,8 +610,10 @@ Object[][] idxAbsCurv=new Object[profils_.getNombre()][]; for(int j=0;j<profils_.getNombre();j++) { Geometry intersection=axeHydraulique.intersection((Geometry) profils_.getObject(j)); - if(intersection.getNumPoints()!=1) - throw new IllegalArgumentException("Au moins un des profils est coup\xE9 plusieurs fois ou jamais."); + if(intersection.getNumPoints()==0) + throw new IllegalArgumentException("Au moins un des profils ne coupe jamais l'axe hydraulique."); + if(intersection.getNumPoints()>1) + throw new IllegalArgumentException("Au moins un des profils coupe plusieurs fois l'axe hydraulique."); idxAbsCurv[j]=new Object[]{j, UtilsProfil1d.abscisseCurviligne(seqAxeHydraulique, intersection.getCoordinate())}; } // Tri en fonction des abcsisses curvilignes Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/BiefSet.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/BiefSet.java 2009-01-28 22:44:24 UTC (rev 4423) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/BiefSet.java 2009-01-29 09:53:07 UTC (rev 4424) @@ -13,6 +13,7 @@ import java.util.Map; import org.fudaa.ctulu.CtuluCommand; +import org.fudaa.ctulu.CtuluCommandComposite; import org.fudaa.ctulu.CtuluCommandContainer; import org.fudaa.ctulu.CtuluNamedCommand; import org.fudaa.ebli.calque.ZModeleLigneBrisee; @@ -49,9 +50,9 @@ */ public void addBief(String _nom, ZModeleLigneBrisee[] _models, CtuluCommandContainer _cmd) { if(_nom==null||_models==null) - throw new IllegalArgumentException("Ni _nom ni _models ne peuvent \xEAtre null."); + throw new IllegalArgumentException(FudaaLib.getS("Ni _nom ni _models ne peuvent \xEAtre null.")); if(biefs_.containsKey(_nom)) - throw new IllegalArgumentException("Ce nom de profil est d\xE9j\xE0 utilis\xE9."); + throw new IllegalArgumentException(FudaaLib.getS("Ce nom de profil est d\xE9j\xE0 utilis\xE9.")); class AddBiefCtuluCommand implements CtuluCommand, CtuluNamedCommand { public String nom_; public Bief bief_; @@ -60,6 +61,7 @@ public void undo() {removeBief(nom_, null);} public String getName() {return FudaaLib.getS("Ajouter bief");} }; + // Transformation des du tableau de models en bief Bief newBief=new Bief(_models); biefs_.put(_nom, newBief); listNoms_.add(_nom); @@ -93,6 +95,18 @@ } /** + * Supprime tous les biefs du container. + */ + public void removeAllBiefs(CtuluCommandContainer _cmd) { + CtuluCommandComposite cmd=new CtuluCommandComposite(FudaaLib.getS("Suppression de tous les biefs")); + String[] names=getBiefNames(); + for(int i=0;i<names.length;i++) + removeBief(names[i], cmd); + if(_cmd!=null) + _cmd.addCmd(cmd.getSimplify()); + } + + /** * Supprime le bief dont le nom est donn\xE9 en param\xE8tre. */ public void removeBief(String _nomBief, CtuluCommandContainer _cmd) { Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/UtilsProfil1d.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/UtilsProfil1d.java 2009-01-28 22:44:24 UTC (rev 4423) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/UtilsProfil1d.java 2009-01-29 09:53:07 UTC (rev 4424) @@ -212,7 +212,7 @@ * Retourne -2 si la coordonn\xE9e n'appartient pas \xE0 la g\xE9om\xE9trie. */ static public int getPreviousIndex(CoordinateSequence _geom, Coordinate _point) { - if(_point==null||_geom.size()<=0||egal(_point, _geom.getCoordinate(0))) + if(_point==null||_geom.size()<=0||egalSansZ(_point, _geom.getCoordinate(0))) return -1; boolean fini=false; int i=-1; @@ -232,7 +232,7 @@ * Retourne -2 si la coordonn\xE9e n'appartient pas \xE0 la g\xE9om\xE9trie. */ static public int getNextIndex(CoordinateSequence _geom, Coordinate _point) { - if(_point==null||_geom.size()<=0||egal(_point, _geom.getCoordinate(_geom.size()-1))) + if(_point==null||_geom.size()<=0||egalSansZ(_point, _geom.getCoordinate(_geom.size()-1))) return -1; boolean fini=false; int i=_geom.size(); Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/VueModuleGestionBief.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/VueModuleGestionBief.java 2009-01-28 22:44:24 UTC (rev 4423) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/VueModuleGestionBief.java 2009-01-29 09:53:07 UTC (rev 4424) @@ -26,7 +26,6 @@ import org.fudaa.fudaa.modeleur.modeleur1d.controller.ControllerBief; import org.fudaa.fudaa.modeleur.modeleur1d.model.BiefSet; import org.fudaa.fudaa.modeleur.modeleur1d.model.BiefSetListener; -import org.fudaa.fudaa.modeleur.modeleur1d.model.UtilsProfil1d; import com.memoire.bu.BuBorderLayout; import com.memoire.bu.BuButton; @@ -97,9 +96,6 @@ int[] idx=new int[idxSupp.size()]; for(int i=0;i<idx.length;i++) idx[i]=idxSupp.get(i); - // D\xE9selection si besoin du bief en cours de manipulation - if(UtilsProfil1d.in(controllerBief_.getBiefSelectionModel().getMaxSelectionIndex(), idx)) - controllerBief_.getBiefSelectionModel().clearSelection(); // Suppression des biefs controllerBief_.removeBief(idx); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2009-01-28 22:44:35
|
Revision: 4423 http://fudaa.svn.sourceforge.net/fudaa/?rev=4423&view=rev Author: deniger Date: 2009-01-28 22:44:24 +0000 (Wed, 28 Jan 2009) Log Message: ----------- Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/gui/CtuluCellTextRenderer.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGPaletteLegendeGraphe.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileAction.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileBuilder.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileBuilderFromTree.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/tr_en.fr_txt branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCommonImplementation.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostFlecheContentDefaut.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostFlecheContentExpr.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjet.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostRubarEnvFlecheContent.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostRubarLoader.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceAbstract.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceTelemac3D.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/data/TrPostDataCreationPanel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/data/TrPostDataEditCommonPanel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/data/TrPostDataEditCstPanel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/data/TrPostDataUserVarModel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/data/TrPostDataVecteur.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/dialogSpec/TrPostWizardProfilSpatial.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/persist/TrPostPersistenceManager.java Added Paths: ----------- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostFlecheContentDefaultSaver.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/data/TrPostDataEditFlechePanel.java Modified: branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/gui/CtuluCellTextRenderer.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/gui/CtuluCellTextRenderer.java 2009-01-28 19:17:26 UTC (rev 4422) +++ branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/gui/CtuluCellTextRenderer.java 2009-01-28 22:44:24 UTC (rev 4423) @@ -24,6 +24,7 @@ * @author fred deniger * @version $Id: CtuluCellTextRenderer.java,v 1.14 2007-04-30 14:21:16 deniger Exp $ */ +@SuppressWarnings("serial") public class CtuluCellTextRenderer extends JLabel implements CtuluCellRenderer, TreeCellRenderer { private CtuluCellDecorator decorator_; Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGPaletteLegendeGraphe.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGPaletteLegendeGraphe.java 2009-01-28 19:17:26 UTC (rev 4422) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGPaletteLegendeGraphe.java 2009-01-28 22:44:24 UTC (rev 4423) @@ -4,33 +4,23 @@ import java.awt.Color; import java.awt.Component; import java.awt.Dimension; -import java.awt.FlowLayout; -import java.awt.Font; import java.awt.Graphics; import java.awt.Graphics2D; -import java.awt.GridLayout; -import java.awt.Rectangle; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import java.awt.event.ItemEvent; -import java.awt.event.ItemListener; -import java.awt.image.BufferedImage; -import java.util.HashMap; import java.util.List; -import java.util.Map; import javax.swing.BorderFactory; +import javax.swing.DefaultListCellRenderer; import javax.swing.Icon; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JColorChooser; -import javax.swing.JComponent; import javax.swing.JLabel; import javax.swing.JList; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTextField; -import javax.swing.ListCellRenderer; import javax.swing.ListModel; import javax.swing.ListSelectionModel; import javax.swing.SwingConstants; @@ -39,25 +29,19 @@ import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; -import jxl.Image; - -import org.fudaa.ctulu.CtuluLibString; import org.fudaa.ctulu.CtuluNumberFormatDefault; import org.fudaa.ctulu.CtuluNumberFormatI; import org.fudaa.ctulu.CtuluRange; +import org.fudaa.ctulu.gui.CtuluCellTextRenderer; import org.fudaa.ctulu.gui.CtuluDecimalFormatEditPanel; import org.fudaa.ctulu.gui.CtuluDialogPanel; import org.fudaa.ctulu.gui.CtuluPopupMenu; -import org.fudaa.ebli.calque.CalqueGISTreeModel.CellRenderer; import org.fudaa.ebli.commun.EbliLib; import org.fudaa.ebli.controle.BConfigurePalette; -import org.fudaa.ebli.palette.BPalettePlageLegende; import org.fudaa.ebli.palette.BPalettePlageTarget; import org.fudaa.ebli.palette.BPlageAbstract; import org.fudaa.ebli.ressource.EbliResource; -import org.fudaa.ebli.trace.BPlageInterface; import org.fudaa.ebli.trace.TraceIcon; -import org.fudaa.ebli.trace.TraceIconModel; import org.fudaa.ebli.trace.TraceLigne; import com.memoire.bu.BuBorderLayout; @@ -68,7 +52,6 @@ import com.memoire.bu.BuEmptyList; import com.memoire.bu.BuGridLayout; import com.memoire.bu.BuLabel; -import com.memoire.bu.BuLib; import com.memoire.bu.BuMenuItem; import com.memoire.bu.BuPanel; import com.memoire.bu.BuResource; @@ -77,354 +60,372 @@ import com.memoire.bu.BuToolButton; import com.memoire.bu.BuVerticalLayout; - /** - * Palette de l\xE9gende des graphes. - * Utilis\xE9e pour \xE9diter les l\xE9gendes des graphes + * Palette de l\xE9gende des graphes. Utilis\xE9e pour \xE9diter les l\xE9gendes des graphes + * * @author Adrien Hadoux - * */ -public class EGPaletteLegendeGraphe extends BuPanel implements ActionListener,ListSelectionListener,BuBorders{ +public class EGPaletteLegendeGraphe extends BuPanel implements ActionListener, ListSelectionListener, BuBorders { - /** - * Graphe associ\xE9 a la palette - */ - EGGraphe graphe_; + /** + * Graphe associ\xE9 a la palette + */ + EGGraphe graphe_; - //Map<BuTextField,EGCourbe > mapTitles_; + // Map<BuTextField,EGCourbe > mapTitles_; - /** - * Bouton qui applique les changements - */ - JButton btApply_; + /** + * Bouton qui applique les changements + */ + JButton btApply_; - BuToolButton btAssombrir_; + BuToolButton btAssombrir_; - JButton btColor_; + JButton btColor_; - BuToolButton btEcl_; + BuToolButton btEcl_; - BuButton btFormat_; + BuButton btFormat_; - JButton btRefresh_; + JButton btRefresh_; - BuCheckBox cbChangedLeg_; + BuCheckBox cbChangedLeg_; - CtuluRange dataBoite_; + CtuluRange dataBoite_; - TraceIcon ic_; + TraceIcon ic_; - boolean isAdjusting_; + boolean isAdjusting_; - BuMenuItem itemRemove_; + BuMenuItem itemRemove_; - BuMenuItem itemSplit_; + BuMenuItem itemSplit_; - JLabel lbGrapheTitle_; + JLabel lbGrapheTitle_; + /** + * Format des nombres des l\xE9gendes + */ + CtuluNumberFormatI format_ = CtuluNumberFormatDefault.DEFAULT_FMT; - /** - * Format des nombres des l\xE9gendes - */ - CtuluNumberFormatI format_ =CtuluNumberFormatDefault.DEFAULT_FMT; + /** + * S\xE9parateur entre les formats + */ + String separatorFormat_ = "-"; - /** - * S\xE9parateur entre les formats - */ - String separatorFormat_="-"; + /** + * La liste des cournes + */ + JList list_; - /** - * La liste des cournes - */ - JList list_; + CtuluPopupMenu menu_; - CtuluPopupMenu menu_; + /** + * Panel des donn\xE9es qui se met a jour automatiquement lors du clic dans la liste des courbes. + */ + JPanel panelData_; + BPlageAbstract plageEnCours_; - /** - * Panel des donn\xE9es qui se met a jour automatiquement lors du clic dans la liste des courbes. - */ - JPanel panelData_; + List plages_; - BPlageAbstract plageEnCours_; + /** + * LE scroll de la liste des courbe + */ + BuScrollPane sp_; - List plages_; + BPalettePlageTarget target_; - /** - * LE scroll de la liste des courbe - */ - BuScrollPane sp_; + JTextField tfPlageLeg_; + /** + * Textfield du contenu du titre de la courbe + */ + JTextField tfTitleCourbeTop_; - BPalettePlageTarget target_; + // BuTextField txtTitleCourbe_=new BuTextField(10); - JTextField tfPlageLeg_; - /** - * Textfield du contenu du titre de la courbe - */ - JTextField tfTitleCourbeTop_; + private class PlageTableModel implements ListModel { + EGCourbe[] liste_; + public PlageTableModel(EGCourbe[] list) { + super(); + liste_ = list; + } - //BuTextField txtTitleCourbe_=new BuTextField(10); + public void addListDataListener(ListDataListener l) {} + public Object getElementAt(int index) { + return liste_[index]; + } + public int getSize() { + return liste_.length; + } + public void removeListDataListener(ListDataListener l) {} + } + /** + * Renderer qui affiche la courbe sous forme de sa courbe miniature et son libell\xE9 \xE0 cot\xE9 + * + * @author Adrien Hadoux + */ + @SuppressWarnings("serial") + private static class LegendeRenderer extends CtuluCellTextRenderer { // ne pas refaire le travail !!!!!!! - private class PlageTableModel implements ListModel{ - EGCourbe[] liste_; - public PlageTableModel(EGCourbe[] list){ - super(); - liste_=list; - } + private final CellRendererIcon icon_ = new CellRendererIcon(); - public void addListDataListener(ListDataListener l) { - } + public LegendeRenderer() {} - public Object getElementAt(int index) { - return liste_[index]; - } + @Override + protected void setValue(Object _value) { + EGCourbe cb = (EGCourbe) _value; + icon_.setCourbe(cb); + setIcon(icon_); + setText(cb.getTitle()); + setOpaque(true); + } - public int getSize() { - return liste_.length; - } + // public Component getListCellRendererComponent(JList _list, Object _value, int _index, boolean _isSelected, + // boolean _cellHasFocus) { + // super.getListCellRendererComponent(_list, _value, _index, _isSelected, _cellHasFocus); + // EGCourbe cb = (EGCourbe) _value; + // // // pas optimise: a chaque fois que le renderer tu cree une image + // // BufferedImage image = new BufferedImage(20, 20, BufferedImage.TYPE_INT_RGB); + // // Graphics2D g = image.createGraphics(); + // // final Rectangle rec = new Rectangle(20, 20); + // // // g.translate(rec.x, rec.y); + // // // la ligne + // // g.setColor(Color.white); + // // g.fillRect(0, 0, 20, 20); + // // final TraceLigne l = new TraceLigne(cb.getLigneModel()); + // // l.dessineTrait(g, 0, rec.height / 2, rec.width, rec.height / 2); + // // // l'icone + // // final TraceIconModel icm = new TraceIconModel(cb.getIconModel()); + // // icm.setTaille(Math.min(rec.width / 3, rec.height / 3));// a voir + // // final TraceIcon ic = new TraceIcon(icm); + // // ic.paintIconCentre(g, rec.width / 2, rec.height / 2); + // // // g.translate(-rec.x, -rec.y); + // // image.flush(); + // icon_.setCourbe(cb); + // setIcon(icon_); + // setText(cb.getTitle()); + // setOpaque(true); + // // // resultat.setIconTextGap(12); + // // if (isSelected) { + // // resultat.setBackground(HIGHLIGHT_COLOR); + // // resultat.setForeground(Color.white); + // // } + // + // return this; + // } + } - public void removeListDataListener(ListDataListener l) { - } - } + /** + * Un icone + * + * @author deniger + */ + private static class CellRendererIcon implements Icon { + TraceLigne traceLigne_ = new TraceLigne(); + TraceIcon traceIcon_ = new TraceIcon(); - /** - * Renderer qui affiche la courbe sous forme de sa courbe miniature et son libell\xE9 \xE0 cot\xE9 - * @author Adrien Hadoux - * - */ - private class LegendeRenderer implements ListCellRenderer{ + protected void setCourbe(EGCourbe _c) { + traceLigne_.getModel().updateData(_c.getLigneModel()); + traceIcon_.getModel().updateData(_c.getIconModel()); + traceIcon_.setTaille(getIconHeight() / 4);// a voir + } - private final Color HIGHLIGHT_COLOR = UIManager.getColor("Tree.selectionBackground"); - public LegendeRenderer(){ + public int getIconHeight() { + return 20; + } - } + public int getIconWidth() { + return 30; + } - @Override - public Component getListCellRendererComponent(JList list, Object value, - int index, boolean isSelected, boolean cellHasFocus) { - EGCourbe cb=(EGCourbe) value; - JLabel resultat=new JLabel(); + public void paintIcon(Component _c, Graphics _g, int _x, int _y) { + Graphics2D g = (Graphics2D) _g; + g.setColor(Color.white); + g.fillRect(_x, _y, _x + getIconWidth(), _y + getIconHeight()); + int middleH = _y + getIconHeight() / 2; + traceLigne_.dessineTrait(g, _x, middleH, _x + getIconWidth(), middleH); + traceIcon_.paintIconCentre(g, _x + getIconWidth() / 2, middleH); - BufferedImage image=new BufferedImage(20,20,BufferedImage.TYPE_INT_RGB); - Graphics2D g = image.createGraphics(); - final Rectangle rec = new Rectangle(20,20); - //g.translate(rec.x, rec.y); - // la ligne - g.setColor(Color.white); - g.fillRect(0, 0, 20, 20); - final TraceLigne l = new TraceLigne(cb.getLigneModel()); - l.dessineTrait(g, 0, rec.height / 2, rec.width, rec.height / 2); - // l'icone - final TraceIconModel icm = new TraceIconModel(cb.getIconModel()); - icm.setTaille(Math.min(rec.width / 3, rec.height/3));// a voir - final TraceIcon ic = new TraceIcon(icm); - ic.paintIconCentre(g, rec.width / 2, rec.height / 2); - //g.translate(-rec.x, -rec.y); + } - resultat.setIcon(new ImageIcon(image)); - resultat.setText(cb.getTitle()); - resultat.setOpaque(true); - //resultat.setIconTextGap(12); - if (isSelected) { - resultat.setBackground(HIGHLIGHT_COLOR); - resultat.setForeground(Color.white); - } - - return resultat; - } + } - } + PlageTableModel model_; - PlageTableModel model_; + public EGPaletteLegendeGraphe(EGGraphe graphe) { + graphe_ = graphe; + // mapTitles_=new HashMap<BuTextField, EGCourbe>(); + // -- construction du panel des l\xE9gendes --// + buildContent(); + } - public EGPaletteLegendeGraphe(EGGraphe graphe){ - graphe_=graphe; - //mapTitles_=new HashMap<BuTextField, EGCourbe>(); - //-- construction du panel des l\xE9gendes --// - buildContent(); - } + private EGCourbe getSelectedCourbe() { + int select = this.list_.getSelectedIndex(); + if (select == -1) return null; + EGCourbe courbe = graphe_.getModel().getCourbes()[select]; + return courbe; + } + BConfigurePalette paletteConf_ = new BConfigurePalette(true); - private EGCourbe getSelectedCourbe(){ - int select=this.list_.getSelectedIndex(); - if(select==-1) - return null; - EGCourbe courbe=graphe_.getModel().getCourbes()[select]; - return courbe; - } + /** + * Met a jour le panneau des donn\xE9es. + */ + private void updatePanelData() { + // -- on r\xE9cup\xE8re la courbe selectionnee --// + EGCourbe courbe = getSelectedCourbe(); + if (courbe != null) paletteConf_.setPalettePanelTarget(courbe); + } - - BConfigurePalette paletteConf_=new BConfigurePalette(true); - /** - * Met a jour le panneau des donn\xE9es. - */ - private void updatePanelData() { - //-- on r\xE9cup\xE8re la courbe selectionnee --// - EGCourbe courbe=getSelectedCourbe(); - if(courbe!=null) - paletteConf_.setPalettePanelTarget(courbe); - } + private void buildContent() { + final EGCourbe[] cs = graphe_.getModel().getCourbes(); - private void buildContent(){ + final BuBorderLayout lay = new BuBorderLayout(2, 2); + setLayout(lay); - final EGCourbe[] cs = graphe_.getModel().getCourbes(); + // -- liste des courbes --// + list_ = new BuEmptyList(); + model_ = new PlageTableModel(cs); + list_.setModel(model_); + list_.setCellRenderer(new LegendeRenderer()); + list_.getSelectionModel().addListSelectionListener(this); + list_.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); - final BuBorderLayout lay = new BuBorderLayout(2, 2); - setLayout(lay); - - //-- liste des courbes --// - list_ = new BuEmptyList(); - model_ = new PlageTableModel(cs); - list_.setModel(model_); - list_.setCellRenderer(new LegendeRenderer()); - list_.getSelectionModel().addListSelectionListener(this); - list_.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + // list_.setFocusable(false); + sp_ = new BuScrollPane(list_); + sp_.setPreferredSize(new Dimension(150, 100)); + sp_.setBorder(BorderFactory.createTitledBorder(EbliResource.EBLI.getString("Liste des courbes"))); + add(sp_, BuBorderLayout.NORTH); - //list_.setFocusable(false); - sp_ = new BuScrollPane(list_); - sp_.setPreferredSize(new Dimension(150,100)); - sp_.setBorder(BorderFactory.createTitledBorder(EbliResource.EBLI.getString("Liste des courbes"))); - add(sp_, BuBorderLayout.NORTH); + final BuPanel pnColor = new BuPanel(); + pnColor.setLayout(new BuButtonLayout(1, SwingConstants.LEFT)); - final BuPanel pnColor = new BuPanel(); - pnColor.setLayout(new BuButtonLayout(1, SwingConstants.LEFT)); + // -- update le panel des donn\xE9es + updatePanelData(); - //-- update le panel des donn\xE9es - updatePanelData(); - - - //paletteConf_.setPreferredSize(new Dimension(300,300)); - paletteConf_.setBorder(BorderFactory.createTitledBorder(EbliResource.EBLI.getString("Param\xE9trage"))); + // paletteConf_.setPreferredSize(new Dimension(300,300)); + paletteConf_.setBorder(BorderFactory.createTitledBorder(EbliResource.EBLI.getString("Param\xE9trage"))); - JScrollPane peast=new JScrollPane(paletteConf_); - peast.setPreferredSize(new Dimension(150,200)); - - add(peast, BorderLayout.CENTER); - btApply_ = new BuButton(BuResource.BU.getIcon("appliquer")); - btApply_.setText(BuResource.BU.getString("Appliquer")); - btApply_.setToolTipText(EbliLib.getS("Appliquer les modifications")); - btApply_.addActionListener(this); - btRefresh_ = new BuButton(BuResource.BU.getIcon("rafraichir")); - btRefresh_.setText(EbliLib.getS("initialiser")); - btRefresh_.setToolTipText(EbliLib.getS("Initialiser les plages des couleurs")); - btRefresh_.addActionListener(this); - btRefresh_.setEnabled(true); -// btFormat_ = new BuButton(); -// btFormat_.setText(EbliLib.getS("Format des labels")); -// btFormat_.setToolTipText(EbliLib.getS("Permet de modifier le formattage des nombres et le s\xE9parateur de valeurs")); -// btFormat_.addActionListener(this); -// btFormat_.setEnabled(false); - final BuPanel btpn = new BuPanel(); - btpn.setLayout(new BuButtonLayout(1, SwingConstants.RIGHT)); + JScrollPane peast = new JScrollPane(paletteConf_); + peast.setPreferredSize(new Dimension(150, 200)); - //btpn.add(btFormat_); - btpn.add(btRefresh_); - //btpn.add(btApply_); - add(btpn, BuBorderLayout.SOUTH); + add(peast, BorderLayout.CENTER); + btApply_ = new BuButton(BuResource.BU.getIcon("appliquer")); + btApply_.setText(BuResource.BU.getString("Appliquer")); + btApply_.setToolTipText(EbliLib.getS("Appliquer les modifications")); + btApply_.addActionListener(this); + btRefresh_ = new BuButton(BuResource.BU.getIcon("rafraichir")); + btRefresh_.setText(EbliLib.getS("initialiser")); + btRefresh_.setToolTipText(EbliLib.getS("Initialiser les plages des couleurs")); + btRefresh_.addActionListener(this); + btRefresh_.setEnabled(true); + // btFormat_ = new BuButton(); + // btFormat_.setText(EbliLib.getS("Format des labels")); + // btFormat_.setToolTipText(EbliLib.getS("Permet de modifier le formattage des nombres et le s\xE9parateur de valeurs")); + // btFormat_.addActionListener(this); + // btFormat_.setEnabled(false); + final BuPanel btpn = new BuPanel(); + btpn.setLayout(new BuButtonLayout(1, SwingConstants.RIGHT)); - this.setPreferredSize(new Dimension(300,300)); - this.setMinimumSize(new Dimension(300,300)); + // btpn.add(btFormat_); + btpn.add(btRefresh_); + // btpn.add(btApply_); + add(btpn, BuBorderLayout.SOUTH); - this.setBorder(BorderFactory.createTitledBorder(EbliResource.EBLI.getString("Edition de la l\xE9gende des courbes"))); - //-- initialise au premier courbe --// - list_.setSelectedIndex(0); - } + this.setPreferredSize(new Dimension(300, 300)); + this.setMinimumSize(new Dimension(300, 300)); + this.setBorder(BorderFactory.createTitledBorder(EbliResource.EBLI.getString("Edition de la l\xE9gende des courbes"))); + // -- initialise au premier courbe --// + list_.setSelectedIndex(0); + } + public void actionPerformed(ActionEvent _e) { - public void actionPerformed(ActionEvent _e) { - - EGCourbe courbe=getSelectedCourbe(); - if(courbe==null)return; + EGCourbe courbe = getSelectedCourbe(); + if (courbe == null) return; - final Object s = _e.getSource(); - if ((s == btColor_) ) { - final Color n = JColorChooser.showDialog(this, EbliResource.EBLI.getString("Couleur"), ic_.getCouleur()); - if ((n != null) && (n != ic_.getCouleur())) { - // setModified(); - ic_.setCouleur(n); - if(courbe!=null) - courbe.setAspectContour(n); - } - } else if (s == btApply_) { - actionApply(); - } else if (s == btRefresh_) { - reinitPlages(); - } else if (btFormat_ == _e.getSource()) { - actionFormat(); - } + final Object s = _e.getSource(); + if ((s == btColor_)) { + final Color n = JColorChooser.showDialog(this, EbliResource.EBLI.getString("Couleur"), ic_.getCouleur()); + if ((n != null) && (n != ic_.getCouleur())) { + // setModified(); + ic_.setCouleur(n); + if (courbe != null) courbe.setAspectContour(n); + } + } else if (s == btApply_) { + actionApply(); + } else if (s == btRefresh_) { + reinitPlages(); + } else if (btFormat_ == _e.getSource()) { + actionFormat(); + } - - } + } + /** + * Appelee lorsqu'on appuie sur le bouton appliquer + */ + private void actionApply() { - /** - * Appelee lorsqu'on appuie sur le bouton appliquer - */ - private void actionApply() { + } - } + /** + * Reinitialise les titres des courbes avec les donn\xE9es initiales. + */ + private void reinitPlages() { - /** - * Reinitialise les titres des courbes avec les donn\xE9es initiales. - */ - private void reinitPlages() { + } - } + /** + * Methode qui ajuste toutes les l\xE9gendes en fonction du format choisi et du separator. + */ + protected void ajusteAllLegendes() { - /** - * Methode qui ajuste toutes les l\xE9gendes en fonction du format choisi et du separator. - */ - protected void ajusteAllLegendes() { + } - } + public void valueChanged(ListSelectionEvent e) { + updatePanelData(); + } + private void actionFormat() { + CtuluNumberFormatI ctuluNumberFormatI = format_; + /* + * CtuluNumberFormatI fmt = getDefaultFormat(); if (fmt == null) { fmt = CtuluLib.DEFAULT_NUMBER_FORMAT; } + */ + final CtuluDecimalFormatEditPanel fmtSelect = new CtuluDecimalFormatEditPanel(ctuluNumberFormatI); + fmtSelect.setErrorTextUnable(); + final CtuluDialogPanel pn = new CtuluDialogPanel() { + public boolean valide() { + return fmtSelect.valide(); + } + }; + pn.setLayout(new BuVerticalLayout(4)); + final JPanel pnSep = new BuPanel(new BuGridLayout(2, 2, 2)); + pnSep.add(new BuLabel(EbliLib.getS("S\xE9parateur"))); + final BuTextField tf = new BuTextField(); + tf.setText(separatorFormat_); + pnSep.add(tf); + pn.add(pnSep); - public void valueChanged(ListSelectionEvent e) { + if (ctuluNumberFormatI == null || ctuluNumberFormatI.isDecimal()) { + fmtSelect.setBorder(BorderFactory.createTitledBorder(EbliLib.getS("Format d\xE9cimal"))); + pn.add(fmtSelect); + } + if (CtuluDialogPanel.isOkResponse(pn.afficheModale(this, EbliLib.getS("Format")))) { + format_ = fmtSelect.getCurrentFmt(); + separatorFormat_ = tf.getText(); + ajusteAllLegendes(); - updatePanelData(); - } + } + } - - - private void actionFormat() { - CtuluNumberFormatI ctuluNumberFormatI =format_; - /* - * CtuluNumberFormatI fmt = getDefaultFormat(); if (fmt == null) { fmt = CtuluLib.DEFAULT_NUMBER_FORMAT; } - */ - final CtuluDecimalFormatEditPanel fmtSelect = new CtuluDecimalFormatEditPanel(ctuluNumberFormatI); - fmtSelect.setErrorTextUnable(); - final CtuluDialogPanel pn = new CtuluDialogPanel() { - public boolean valide() { - return fmtSelect.valide(); - } - }; - pn.setLayout(new BuVerticalLayout(4)); - final JPanel pnSep = new BuPanel(new BuGridLayout(2, 2, 2)); - pnSep.add(new BuLabel(EbliLib.getS("S\xE9parateur"))); - final BuTextField tf = new BuTextField(); - tf.setText(separatorFormat_); - pnSep.add(tf); - pn.add(pnSep); - - if (ctuluNumberFormatI == null || ctuluNumberFormatI.isDecimal()) { - fmtSelect.setBorder(BorderFactory.createTitledBorder(EbliLib.getS("Format d\xE9cimal"))); - pn.add(fmtSelect); - } - if (CtuluDialogPanel.isOkResponse(pn.afficheModale(this, EbliLib.getS("Format")))) { - format_= fmtSelect.getCurrentFmt(); - separatorFormat_= tf.getText(); - ajusteAllLegendes(); - - } - } - - } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileAction.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileAction.java 2009-01-28 19:17:26 UTC (rev 4422) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileAction.java 2009-01-28 22:44:24 UTC (rev 4423) @@ -13,7 +13,6 @@ import org.fudaa.fudaa.commun.impl.FudaaCommonImplementation; import org.fudaa.fudaa.meshviewer.MvResource; import org.fudaa.fudaa.meshviewer.layer.MvVisuPanel; -import org.fudaa.fudaa.tr.post.TrPostSource; import com.vividsolutions.jts.geom.LineString; Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileBuilder.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileBuilder.java 2009-01-28 19:17:26 UTC (rev 4422) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileBuilder.java 2009-01-28 22:44:24 UTC (rev 4423) @@ -112,7 +112,7 @@ * @param _prog * @param _selected */ - public void actBuildGroup( final ProgressionInterface _prog, final MvExportChooseVarAndTime _selected) { + public void actBuildGroup(final ProgressionInterface _prog, final MvExportChooseVarAndTime _selected) { int[] time = _selected.getSelectedTimeStepIdx(); final CtuluVariable[] vs = _selected.getSelectedVar(); @@ -218,15 +218,17 @@ _prog), _prog); EGCourbeChild child; if (isTime) { - String title=var.toString() + CtuluLibString.ESPACE ; - if(var.getCommonUnit()!=null) - title+="("+var.getCommonUnit()+")"+ CtuluLibString.ESPACE ; - title+=timeModel_.getElementAt(time[t]); - //-- on ajoute les extremites du segment choisi --// - title+=", P1("+format(this.selectedLine_.getCoordinateN(0).x,2)+";"+format(this.selectedLine_.getCoordinateN(0).y,2)+")"+sep+"P"+this.selectedLine_.getNumPoints()+"("+format(this.selectedLine_.getCoordinateN(this.selectedLine_.getNumPoints()-1).x,2)+";"+format(this.selectedLine_.getCoordinateN(this.selectedLine_.getNumPoints()-1).y,2)+")"; - - - model.setTitle(title); + String title = var.toString() + CtuluLibString.ESPACE; + if (var.getCommonUnit() != null) title += "(" + var.getCommonUnit() + ")" + CtuluLibString.ESPACE; + title += timeModel_.getElementAt(time[t]); + // -- on ajoute les extremites du segment choisi --// + title += ", P1(" + format(this.selectedLine_.getCoordinateN(0).x, 2) + ";" + + format(this.selectedLine_.getCoordinateN(0).y, 2) + ")" + sep + "P" + + this.selectedLine_.getNumPoints() + "(" + + format(this.selectedLine_.getCoordinateN(this.selectedLine_.getNumPoints() - 1).x, 2) + ";" + + format(this.selectedLine_.getCoordinateN(this.selectedLine_.getNumPoints() - 1).y, 2) + ")"; + + model.setTitle(title); child = new MvProfileCourbeTime(gri, model, timeModel_); } else { child = new MvProfileCourbe(gri, model); @@ -244,15 +246,14 @@ } - - public String format(double value,int nbChiffresSignificatifs){ - String forme="#."; - for(int i=0;i<nbChiffresSignificatifs;i++) - forme+="0"; - DecimalFormat df = new DecimalFormat(forme); - return df.format(value); + public String format(double value, int nbChiffresSignificatifs) { + String forme = "#."; + for (int i = 0; i < nbChiffresSignificatifs; i++) + forme += "0"; + DecimalFormat df = new DecimalFormat(forme); + return df.format(value); } - + /** * Methode qui permet d ajouter une courbe spatiale poru un grapeh deja existant. * @@ -385,7 +386,7 @@ } - protected void close() {} + public void close() {} protected String getHelpForVarTime() { return timeModel_ == null ? CtuluLib.getS("S\xE9lectionner les variables") : CtuluLib Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileBuilderFromTree.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileBuilderFromTree.java 2009-01-28 19:17:26 UTC (rev 4422) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileBuilderFromTree.java 2009-01-28 22:44:24 UTC (rev 4423) @@ -41,9 +41,6 @@ final MvLineChooser lineChooser_; - - - /** * panel qui contient les calques des isolignes */ @@ -61,11 +58,11 @@ // initSelected_ = _selected; calque_ = _panel; lineChooser_ = new MvLineChooser(_selected, panel_); - + } @Override - protected void close() { + public void close() { lineChooser_.close(); } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/tr_en.fr_txt =================================================================== (Binary files differ) Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCommonImplementation.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCommonImplementation.java 2009-01-28 19:17:26 UTC (rev 4422) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCommonImplementation.java 2009-01-28 22:44:24 UTC (rev 4423) @@ -208,7 +208,6 @@ if ("OUVRIR".equals(com)) { // -- ouverture d un nouveau projet --// - final int reponse = JOptionPane.showConfirmDialog(this.getParentComponent(),TrResource.getS("Le projet courant va \xEAtre ferm\xE9. \n Voulez vous sauvegarder le projet courant avant sa fermeture?")); if (reponse == JOptionPane.CANCEL_OPTION) { return; } if (reponse == JOptionPane.OK_OPTION) { Added: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostFlecheContentDefaultSaver.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostFlecheContentDefaultSaver.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostFlecheContentDefaultSaver.java 2009-01-28 22:44:24 UTC (rev 4423) @@ -0,0 +1,38 @@ +/** + * Licence GPL + * Copyright Genesis + */ +package org.fudaa.fudaa.tr.post; + +import java.util.Map; + +import org.fudaa.ctulu.CtuluUI; +import org.fudaa.dodico.h2d.type.H2dVariableType; +import org.fudaa.fudaa.tr.post.data.TrPostDataCreated; +import org.fudaa.fudaa.tr.post.data.TrPostDataCreatedSaver; + +/** + * Classe de sauvegarde pour les fleches + * + * @author deniger + */ +public class TrPostFlecheContentDefaultSaver implements TrPostDataCreatedSaver { + + String vx_; + String vy_; + String name_; + + public TrPostFlecheContentDefaultSaver(TrPostFlecheContentDefaut _defaut) { + name_ = _defaut.getVar().getShortName(); + vx_ = _defaut.getVx().getShortName(); + vy_ = _defaut.getVy().getShortName(); + } + + public TrPostDataCreated restore(TrPostSource _src, CtuluUI _ui, Map _shortName) { + H2dVariableType var = (H2dVariableType) _shortName.get(name_); + H2dVariableType varX = (H2dVariableType) _shortName.get(vx_); + H2dVariableType varY = (H2dVariableType) _shortName.get(vy_); + if (var != null && varX != null && varY != null) { return new TrPostFlecheContentDefaut(_src, var, varX, varY); } + return null; + } +} Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostFlecheContentDefaut.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostFlecheContentDefaut.java 2009-01-28 19:17:26 UTC (rev 4422) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostFlecheContentDefaut.java 2009-01-28 22:44:24 UTC (rev 4423) @@ -18,9 +18,8 @@ import com.memoire.fu.FuLog; -class TrPostFlecheContentDefaut implements TrPostFlecheContent { +public class TrPostFlecheContentDefaut implements TrPostFlecheContent { - private final boolean isElementData_; int lastTime_ = -1; final H2dVariableType name_; final TrPostSource src_; @@ -31,23 +30,35 @@ final H2dVariableType varVy_; + final boolean useSaver_; + /** * @param _name le nom de la variable * @param _idxX la valeur pour x * @param _idxY la valeur pour y - * @param _isElement true si valeur sur les elements */ public TrPostFlecheContentDefaut(final TrPostSource _src, final H2dVariableType _name, final H2dVariableType _idxX, - final H2dVariableType _idxY, final boolean _isElement) { + final H2dVariableType _idxY) { + this(_src, _name, _idxX, _idxY, false); + } + + /** + * @param _name le nom de la variable + * @param _idxX la valeur pour x + * @param _idxY la valeur pour y + * @param _useSaver true si ce vecteur doit fournir une classe de sauvegarde cf {@link #createSaver()} + */ + public TrPostFlecheContentDefaut(final TrPostSource _src, final H2dVariableType _name, final H2dVariableType _idxX, + final H2dVariableType _idxY, boolean _useSaver) { src_ = _src; name_ = _name; varVx_ = _idxX; varVy_ = _idxY; - isElementData_ = _isElement; + useSaver_ = _useSaver; } public TrPostFlecheContent changeVar(final H2dVariableType _newName) { - return new TrPostFlecheContentDefaut(src_, _newName, varVx_, varVy_, isElementData_); + return new TrPostFlecheContentDefaut(src_, _newName, varVx_, varVy_, useSaver_); } public void clearCache() { @@ -55,15 +66,16 @@ } public TrPostDataCreatedSaver createSaver() { - return null; + + return useSaver_ ? new TrPostFlecheContentDefaultSaver(this) : null; } public TrPostFlecheContent duplicate(final TrPostSource _src) { - return new TrPostFlecheContentDefaut(_src, name_, varVx_, varVy_, isElementData_); + return new TrPostFlecheContentDefaut(_src, name_, varVx_, varVy_, useSaver_); } public TrPostFlecheContent duplicate(final TrPostSource _src, final H2dVariableType _newName) { - return new TrPostFlecheContentDefaut(_src, _newName, varVx_, varVy_, isElementData_); + return new TrPostFlecheContentDefaut(_src, _newName, varVx_, varVy_, useSaver_); } public void fillWhithAllUsedVar(final Set _res) { @@ -85,7 +97,7 @@ try { final double vx = src_.getData(varVx_, _idxTime, _idxObject); final double vy = src_.getData(varVy_, _idxTime, _idxObject); - return Math.hypot(vx,vy); + return Math.hypot(vx, vy); } catch (final IOException _e) { FuLog.warning(_e); } @@ -95,7 +107,7 @@ public TrPostDataVecteur getValues(final int _tIdx) { if (_tIdx != lastTime_) { lastTime_ = _tIdx; - val_ = new TrPostDataVecteur(src_.getData(varVx_, lastTime_), src_.getData(varVy_, lastTime_), isElementData_); + val_ = new TrPostDataVecteur(src_.getData(varVx_, lastTime_), src_.getData(varVy_, lastTime_)); } return val_; @@ -122,7 +134,7 @@ } public boolean isEditable() { - return false; + return useSaver_; } public TrPostFlecheContent isFleche() { Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostFlecheContentExpr.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostFlecheContentExpr.java 2009-01-28 19:17:26 UTC (rev 4422) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostFlecheContentExpr.java 2009-01-28 22:44:24 UTC (rev 4423) @@ -94,7 +94,7 @@ public TrPostDataVecteur getValues(int _tIdx) { if (_tIdx != lastTime_) { lastTime_ = _tIdx; - lastValue_ = new TrPostDataVecteur(vx_.getDataFor(_tIdx), vy_.getDataFor(_tIdx), isElementData_); + lastValue_ = new TrPostDataVecteur(vx_.getDataFor(_tIdx), vy_.getDataFor(_tIdx)); } return lastValue_; } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjet.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjet.java 2009-01-28 19:17:26 UTC (rev 4422) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjet.java 2009-01-28 22:44:24 UTC (rev 4423) @@ -47,6 +47,7 @@ import org.fudaa.ctulu.gui.CtuluCellBooleanRenderer; import org.fudaa.ctulu.gui.CtuluDialog; import org.fudaa.ctulu.gui.CtuluDialogPanel; +import org.fudaa.ctulu.gui.CtuluLibDialog; import org.fudaa.ctulu.gui.CtuluTaskOperationGUI; import org.fudaa.dodico.ef.EfGridInterface; import org.fudaa.dodico.ef.EfLib; @@ -275,30 +276,6 @@ // liste des noeuuds coupes Set<EbliNode> nodesCutted = null; - // /** - // *ajout une fillelayout a la liste des frame layout - // * - // * @param _fille - // */ - // public void addFillesLayout(TrPostLayoutFille _fille) { - // listeFillesLayout.add(_fille); - // } - - // /** - // * retourne la frame layout en cours d utilisation par le user. sinon retourne la premiere fille. IMPORTANT: il faut - // * passer par cette methode pour etre root\xE9 vers la bonne scene en cours de manip. - // * - // * @return - // */ - // public TrPostLayoutFille getSelectedFilleLayout() { - // for (Iterator<TrPostLayoutFille> it = listeFillesLayout.iterator(); it.hasNext();) { - // TrPostLayoutFille fille = it.next(); - // if (fille.isSelected()) return fille; - // } - // // sinon retourne la premier frame - // return listeFillesLayout.get(0); - // } - /** * internalframe qui gere les multiProjets */ @@ -385,28 +362,28 @@ * @param _src */ public void ajouterSource(final TrPostSource _src) { - ajouterSource(_src,null); + ajouterSource(_src, null); } - - public void ajouterSource(final TrPostSource _src,String title) { - _src.addVariableListener(new VariableListener()); - if (_src.getFiles() == null || !isOneSourceLoaded(_src.getFiles())) { - listeSrc_.add(_src); - _src.buildDefaultVarUpdateLists(); - // -- ajout du menu correspondant uniquement a partir de la 2eme --// - // if (listeSrc_.size()>1 || (menuPost_!=null &&)) - construitMenuPostSpecifiqueSource(_src,title); + public void ajouterSource(final TrPostSource _src, String title) { + _src.addVariableListener(new VariableListener()); + if (_src.getFiles() == null || !isOneSourceLoaded(_src.getFiles())) { + listeSrc_.add(_src); + _src.buildDefaultVarUpdateLists(); - } else { - // -- messqge d erreur: le fichier est deja ouvert --// - new BuDialogMessage(impl_.getApp(), impl_.getInformationsSoftware(), "Le fichier est deja ouvert.").activate(); + // -- ajout du menu correspondant uniquement a partir de la 2eme --// + // if (listeSrc_.size()>1 || (menuPost_!=null &&)) + construitMenuPostSpecifiqueSource(_src, title); - } - // -- notify aux observers --// - this.notifyObservers(); - + } else { + // -- messqge d erreur: le fichier est deja ouvert --// + new BuDialogMessage(impl_.getApp(), impl_.getInformationsSoftware(), "Le fichier est deja ouvert.").activate(); + + } + // -- notify aux observers --// + this.notifyObservers(); + } public TrPostSource findSource(final String _file) { @@ -464,32 +441,32 @@ return null; } - + /** * Retourne toutes les sources qui ne sont pas des composites + * * @return */ - public List<TrPostSource> getAllClassicalSource(){ - List<TrPostSource> res=new ArrayList<TrPostSource>(); - for(TrPostSource src:listeSrc_){ - if(!isAsuiteCalcul(src)) - res.add(src); - } - return res; + public List<TrPostSource> getAllClassicalSource() { + List<TrPostSource> res = new ArrayList<TrPostSource>(); + for (TrPostSource src : listeSrc_) { + if (!isAsuiteCalcul(src)) res.add(src); + } + return res; } + /** - * Retourne toutes les sources qui sont des composites + * Retourne toutes les sources qui sont des composites + * * @return */ - public List<TrPostSourceFromReader> getAllCCompositeSource(){ - List<TrPostSourceFromReader> res=new ArrayList<TrPostSourceFromReader>(); - for(TrPostSource src:listeSrc_){ - if(isAsuiteCalcul(src)) - res.add((TrPostSourceFromReader)src); - } - return res; + public List<TrPostSourceFromReader> getAllCCompositeSource() { + List<TrPostSourceFromReader> res = new ArrayList<TrPostSourceFromReader>(); + for (TrPostSource src : listeSrc_) { + if (isAsuiteCalcul(src)) res.add((TrPostSourceFromReader) src); + } + return res; } - public boolean isSourceLoaded(final String _file) { return isSourceLoaded(new File(_file)); @@ -579,29 +556,27 @@ public String formatInfoSource(final TrPostSource _src) { // --ajout dans la liste des titres --// Collection<File> files = _src.getFiles(); - if(!isAsuiteCalcul(_src)) - return formatName(_src.getTitle()) + " | Fichier: " + formatFichier(files.iterator().next()); - else{ - -// String listeFiles=""; -// for(File f:files) -// listeFiles+="| "+f.getName(); - return _src.getTitle() ;//+ listeFiles; + if (!isAsuiteCalcul(_src)) return formatName(_src.getTitle()) + " | Fichier: " + + formatFichier(files.iterator().next()); + else { + + // String listeFiles=""; + // for(File f:files) + // listeFiles+="| "+f.getName(); + return _src.getTitle();// + listeFiles; } } - - public boolean isAsuiteCalcul(final TrPostSource _src){ - if(_src instanceof TrPostSourceFromReader){ - TrPostSourceFromReader s=(TrPostSourceFromReader) _src; - if(s.getReader() instanceof TrPostSourceReaderComposite) - return true; - - } - - return false; + public boolean isAsuiteCalcul(final TrPostSource _src) { + if (_src instanceof TrPostSourceFromReader) { + TrPostSourceFromReader s = (TrPostSourceFromReader) _src; + if (s.getReader() instanceof TrPostSourceReaderComposite) return true; + + } + + return false; } - + public String formatFichier(final File file) { if (file == null) return ""; final String nomFichier = file.getAbsolutePath(); @@ -637,15 +612,12 @@ * * @param _src */ - public void construitMenuPostSpecifiqueSource(final TrPostSource _src,String title) { + public void construitMenuPostSpecifiqueSource(final TrPostSource _src, String title) { - BuMenu menuSimul =null; - if(title==null) - menuSimul=new BuMenu((listeSrc_.size()) + ". " + formatFichier(_src.getFiles().iterator().next()), - "SIMULATION" + (listeSrc_.size())); - else - menuSimul=new BuMenu((listeSrc_.size()) + ". " + _src.getTitle(), - "SIMULATION" + (listeSrc_.size())); + BuMenu menuSimul = null; + if (title == null) menuSimul = new BuMenu((listeSrc_.size()) + ". " + + formatFichier(_src.getFiles().iterator().next()), "SIMULATION" + (listeSrc_.size())); + else menuSimul = new BuMenu((listeSrc_.size()) + ". " + _src.getTitle(), "SIMULATION" + (listeSrc_.size())); // -- ajout du menu au menu post --// getMenuPost().add(menuSimul); @@ -696,37 +668,6 @@ // } } - /** - * Construit le menu Layout. Cette methode doit etre appelee une seule fois - */ - // public void setMenuLayout() { - // //filleLayout_.controller_.construitMenuMultiScenes(impl_.getMainMenuBar()); - // final BuMenuBar menubar = impl_.getMainMenuBar(); - // // -- creation du menu principal des scenes a cote de post --// - // - // menuLayout_.addMenuItem(TrResource.getS(("Ajouter une nouvelle fen\xEAtre")), - // "AJOUTFRAME", CtuluResource.CTULU - // .getIcon("crystal_ajouter"), getSelectedFilleLayout().controller_); - // /* - // * - // * menu.addMenuItem(TrResource.getS(("Ajouter un layout dans la vue")), - // * "AJOUTLAYOUT", CtuluResource.CTULU .getIcon("crystal_ajouter"), - // * filleLayout_.controller_); - // * menu.addMenuItem(TrResource.getS(("Retirer un layout de la vue")), - // * "RETIRELAYOUT", CtuluResource.CTULU .getIcon("crystal_enlever"), - // * filleLayout_.controller_); menu.addSeparator("Layouts"); - // * menu.addSubMenu(filleLayout_.controller_.menuScenes_, true); - // */ - // // ajout a cote de menu post - // // menuLayout_.addSeparator(TrResource.getS("Liste des fen\xEAtres")); - // // menuLayout_.addMenuItem(TrResource.getS(("Layout ")) + - // // listeFillesLayout.size(), "FILLELAYOUT" - // // + (listeFillesLayout.size() - 1), null, this); - // // - // - // menubar.add(menuLayout_, 2); - // - // } public BuMenu getMenuPost() { if (menuPost_ == null) menuPost_ = new BuMenu(TrResource.getS("Post"), "POST"); return menuPost_; @@ -766,21 +707,19 @@ CtuluResource.CTULU.getIcon("crystal_ajouter"), new ActionListener() { public void actionPerformed(final ActionEvent _e) { - - final int reponse = JOptionPane - .showConfirmDialog( - getImpl().getParentComponent(), + boolean ok = CtuluLibDialog + .showConfirmation( + getImpl().getFrame(), + TrResource.getS("Fusionner avec un autre projet POST"), TrResource - .getS("Le projet courant va \xEAtre ferm\xE9. \n Voulez vous sauvegarder le projet courant avant sa fermeture?")); - if (reponse == JOptionPane.CANCEL_OPTION) { return; } - if (reponse == JOptionPane.OK_OPTION) { - getManager().saveProject(false); - } - + .getS("Le projet courant va \xEAtre ferm\xE9. \n Voulez vous sauvegarder le projet courant avant sa fermeture?"), + TrResource.getS("Sauvegarder et continuer"), TrResource.getS("Annuler")); + if (!ok) return; + getManager().saveProject(false); getManager().loadProject(false, null); // -- on reinitialise le nom path du projet a null pour qu'il soit redemand\xE9 lors de la nouvelle sauvegarde // --// - getManager().setProjet_(null); + getManager().setProjet(null); } }); @@ -794,11 +733,11 @@ // -- affichage de la fenetre de gestion multi projet --// if (!filleProjetctManager_.isVisible()) { - filleProjetctManager_.setSize(filleProjetctManager_.getSize().width, - filleProjetctManager_.getSize().height / 2); +// filleProjetctManager_.setSize(filleProjetctManager_.getSize().width, +// filleProjetctManager_.getSize().height / 2); impl_.addInternalFrame(filleProjetctManager_); - } + } else filleProjetctManager_.moveToFront(); } @@ -1431,27 +1370,27 @@ return src.getId(); } - + public String deliverSourceSuiteId(TrPostSource src) { - String idString = src.getTitle(); - if (src.getId() == null) { + String idString = src.getTitle(); + if (src.getId() == null) { - String uniqueId = CtuluLibGenerator.getInstance().deliverUniqueStringId(idString); - src.setId(uniqueId); - } else { + String uniqueId = CtuluLibGenerator.getInstance().deliverUniqueStringId(idString); + src.setId(uniqueId); + } else { - // -- on teste si l'id de base est 'parlant' => contient le nom du ficheir --// - String nameFormate = FuLib.clean(idString); - String id = src.getId(); - if (!id.startsWith(nameFormate)) { - String uniqueId = CtuluLibGenerator.getInstance().deliverUniqueStringId(idString); - src.setId(uniqueId); - } + // -- on teste si l'id de base est 'parlant' => contient le nom du ficheir --// + String nameFormate = FuLib.clean(idString); + String id = src.getId(); + if (!id.startsWith(nameFormate)) { + String uniqueId = CtuluLibGenerator.getInstance().deliverUniqueStringId(idString); + src.setId(uniqueId); + } - } - return src.getId(); + } + return src.getId(); - } + } /** * genere uniquement l id. Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostRubarEnvFlecheContent.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostRubarEnvFlecheContent.java 2009-01-28 19:17:26 UTC (rev 4422) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostRubarEnvFlecheContent.java 2009-01-28 22:44:24 UTC (rev 4423) @@ -90,7 +90,7 @@ public TrPostDataVecteur getValues(final int _tIdx) { if (val_ == null) { - val_ = new TrPostDataVecteur(src_.getEnveloppData(varVx_), src_.getEnveloppData(varVy_), true); + val_ = new TrPostDataVecteur(src_.getEnveloppData(varVx_), src_.getEnveloppData(varVy_)); } return val_; } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostRubarLoader.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostRubarLoader.java 2009-01-28 19:17:26 UTC (rev 4422) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostRubarLoader.java 2009-01-28 22:44:24 UTC (rev 4423) @@ -334,7 +334,7 @@ varEnveloppData.put(H2dVariableType.VITESSE_U, qx); final EfDataElement qy = new EfDataElement(qvMax); varEnveloppData.put(H2dVariableType.VITESSE_V, qy); - varEnveloppData.put(H2dVariableType.VITESSE, new TrPostDataVecteur(qx, qy, true)); + varEnveloppData.put(H2dVariableType.VITESSE, new TrPostDataVecteur(qx, qy)); src_.setEnvResultats(varEnveloppData); src_.setEnvTime(envReader.getTfinal()); checkEnvTime(); Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceAbstract.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceAbstract.java 2009-01-28 19:17:26 UTC (rev 4422) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceAbstract.java 2009-01-28 22:44:24 UTC (rev 4423) @@ -513,7 +513,7 @@ */ public final TrPostFlecheContent createSimpleVecteurContent(final H2dVariableType _name, final H2dVariableType _idxX, final H2dVariableType _idxY, final boolean _isElt) { - return new TrPostFlecheContentDefaut(this, _name, _idxX, _idxY, _isElt); + return new TrPostFlecheContentDefaut(this, _name, _idxX, _idxY); } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceTelemac3D.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceTelemac3D.java 2009-01-28 19:17:26 UTC (rev 4422) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceTelemac3D.java 2009-01-28 22:44:24 UTC (rev 4423) @@ -225,7 +225,7 @@ final H2dVariableType vy = variable[idxY * nbplan + k]; final H2dVariableTypeCreated var2d = H2dVariableType.createTempVar(nameBase + " 2D " + fmt.format(k + 1), _shortName); - fleches.add(new TrPostFlecheContentDefaut(source, var2d, vx, vy, false)); + fleches.add(new TrPostFlecheContentDefaut(source, var2d, vx, vy)); var2d.setUnit(H2dVariableType.VITESSE.getCommonUnitString()); } final int idxW = H2DLib.getIdxVarWithName(vars, nameBase + endz); Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/data/TrPostDataCreationPanel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/data/TrPostDataCreationPanel.java 2009-01-28 19:17:26 UTC (rev 4422) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/data/TrPostDataCreationPanel.java 2009-01-28 22:44:24 UTC (rev 4423) @@ -186,6 +186,9 @@ @Override protected void addBtAdd(final BuPanel _pn) { super.addBtAdd(_pn); + _pn.add(buildButton(BuResource.BU.getIcon("ajouter"), TrResource.getS("Ajouter un vecteur"), "ADD_FLECHE", + TrResource.getS("Ajouter un vecteur d\xE9fini par 2 variables d\xE9j\xE0 d\xE9finies"), + 0)); _pn.add(buildButton(BuResource.BU.getIcon("ajouter"), TrResource .getS("Ajouter une variable d\xE9finie par un pas de temps"), "ADD_TIME", TrResource .getS("Ajouter une nouvelle variable d\xE9finie par un pas de temps et une variable d\xE9j\xE0 d\xE9finie"), 0)); @@ -199,11 +202,11 @@ public void actionPerformed(final ActionEvent _evt) { if ("ADD_TIME".equals(_evt.getActionCommand())) { ((TrPostDataUserVarModel) getTableModel()).actionAddCst(); - } - if ("ADD_STATS".equals(_evt.getActionCommand())) { + } else if ("ADD_STATS".equals(_evt.getActionCommand())) { ((TrPostDataUserVarModel) getTableModel()).actionAddStatistic(); - } - super.actionPerformed(_evt); + } else if ("ADD_FLECHE".equals(_evt.getActionCommand())) { + ((TrPostDataUserVarModel) getTableModel()).actionAddFleche(); + } else super.actionPerformed(_evt); } }; tb_ = edi.getTable(); Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/data/TrPostDataEditCommonPanel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/data/TrPostDataEditCommonPanel.java 2009-01-28 19:17:26 UTC (rev 4422) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/data/TrPostDataEditCommonPanel.java 2009-01-28 22:44:24 UTC (rev 4423) @@ -37,6 +37,7 @@ * @author Fred Deniger * @version $Id: TrPostDataEditCommonPanel.java,v 1.4 2006-12-20 16:13:19 deniger Exp $ */ +@SuppressWarnings("serial") public abstract class TrPostDataEditCommonPanel extends CtuluDialogPanel { class NameDocumentListener implements DocumentListener { Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/data/TrPostDataEditCstPanel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/data/TrPostDataEditCstPanel.java 2009-01-28 19:17:26 UTC (rev 4422) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/data/TrPostDataEditCstPanel.java 2009-01-28 22:44:24 UTC (rev 4423) @@ -21,6 +21,7 @@ * @author Fred Deniger * @version $Id: TrPostDataEditCstPanel.java,v 1.4 2007-01-17 10:44:30 deniger Exp $ */ +@SuppressWarnings("serial") public class TrPostDataEditCstPanel extends TrPostDataEditCommonPanel { final BuComboBox cbTime_; Added: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/data/TrPostDataEditFlechePanel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/data/TrPostDataEditFlechePanel.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/data/TrPostDataEditFlechePanel.java 2009-01-28 22:44:24 UTC (rev 4423) @@ -0,0 +1,71 @@ +/* + * @creation 9 ao\xFBt 2005 + * @modification $Date: 2007-01-17 10:44:30 $ + * @license GNU General Public License 2 + * @copyright (c)1998-2001 CETMEF 2 bd Gambetta F-60231 Compiegne + * @mail fud...@li... + */ +package org.fudaa.fudaa.tr.post.data; + +import org.fudaa.dodico.h2d.type.H2dVariableType; +import org.fudaa.dodico.h2d.type.H2dVariableTypeCreated; +import org.fudaa.fudaa.tr.common.TrResource; +import org.fudaa.fudaa.tr.post.TrPostFlecheContentDefaut; +import org.fudaa.fudaa.tr.post.TrPostSource; + +import com.memoire.bu.BuComboBox; + +/** + * Permet l'edition des variables creees par l'utilisateur. + * + * @author Fred Deniger + * @version $Id: TrPostDataEditCstPanel.java,v 1.4 2007-01-17 10:44:30 deniger Exp $ + */ +@SuppressWarnings("serial") +public class TrPostDataEditFlechePanel extends TrPostDataEditCommonPanel { + + final BuComboBox cbVarX_; + final BuComboBox cbVarY_; + + H2dVariableType initVarX_; + H2dVariableType initVarY_; + + TrPostFlecheContentDefaut initFleche_; + + /** + * @param _src la source + * @param _var la variable a modifier: si null, phase de creation. + */ + public TrPostDataEditFlechePanel(final TrPostSource _src, final H2dVariableTypeCreated _var) { + super(_src, _var); + initFleche_ = _var == null ? null : (TrPostFlecheContentDefaut) _src.getUserCreatedVar(_var); + cbVarX_ = new BuComboBox(super.varToAdd_.toArray()); + cbVarY_ = new BuComboBox(super.varToAdd_.toArray()); + if (initFleche_ != null) { + initVarX_ = initFleche_.getVx(); + initVarY_ = initFleche_.getVy(); + cbVarX_.setSelectedItem(initVarX_); + cbVarY_.setSelectedItem(initVarY_); + } + addLabel(TrResource.getS("Composante selon X")); + add(cbVarX_); + addLabel(TrResource.getS("Composante selon Y")); + add(cbVarY_); + + } + + @Override + public TrPostDataCreated createData() { + return new TrPostFlecheContentDefaut(src_, getNewVar(), (H2dVariableType) cbVarX_.getSelectedItem(), + (H2dVariableType) cbVarY_.getSelectedItem(), true); + } + + /** + * @return true si des modifications ont ete faites. + */ + @Override + public boolean isModified() { + if (var_ == null || initVarX_ == null || initVarY_ == null) { return true; } + return super.isVarModified() || cbVarX_.getSelectedItem() != initVarX_ || cbVarY_.getSelectedItem() != initVarY_; + } +} Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/data/TrPostDataUserVarModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/data/TrPostDataUserVarModel.java 2009-01-28 19:17:26 UTC (rev 4422) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/data/TrPostDataUserVarModel.java 2009-01-28 22:44:24 UTC (rev 4423) @@ -20,6 +20,7 @@ import org.fudaa.dodico.h2d.type.H2dVariableType; import org.fudaa.dodico.h... [truncated message content] |
From: <had...@us...> - 2009-01-28 19:17:31
|
Revision: 4422 http://fudaa.svn.sourceforge.net/fudaa/?rev=4422&view=rev Author: hadouxad Date: 2009-01-28 19:17:26 +0000 (Wed, 28 Jan 2009) Log Message: ----------- lot 3 EDF POST - Legendes graphes: edition blind?\195?\169e - Correction du bug de d?\195?\169centrage des mode ?\195?\169dition!! - suite de calcul modifi?\195?\169e Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCalqueLegende.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetVueCalque.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetGraphe.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetTitle.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/WidgetLegendeManager.java Added Paths: ----------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGPaletteLegendeGraphe.java Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGPaletteLegendeGraphe.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGPaletteLegendeGraphe.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGPaletteLegendeGraphe.java 2009-01-28 19:17:26 UTC (rev 4422) @@ -0,0 +1,430 @@ +package org.fudaa.ebli.courbe; + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.Font; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.GridLayout; +import java.awt.Rectangle; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.awt.image.BufferedImage; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.swing.BorderFactory; +import javax.swing.Icon; +import javax.swing.ImageIcon; +import javax.swing.JButton; +import javax.swing.JColorChooser; +import javax.swing.JComponent; +import javax.swing.JLabel; +import javax.swing.JList; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTextField; +import javax.swing.ListCellRenderer; +import javax.swing.ListModel; +import javax.swing.ListSelectionModel; +import javax.swing.SwingConstants; +import javax.swing.UIManager; +import javax.swing.event.ListDataListener; +import javax.swing.event.ListSelectionEvent; +import javax.swing.event.ListSelectionListener; + +import jxl.Image; + +import org.fudaa.ctulu.CtuluLibString; +import org.fudaa.ctulu.CtuluNumberFormatDefault; +import org.fudaa.ctulu.CtuluNumberFormatI; +import org.fudaa.ctulu.CtuluRange; +import org.fudaa.ctulu.gui.CtuluDecimalFormatEditPanel; +import org.fudaa.ctulu.gui.CtuluDialogPanel; +import org.fudaa.ctulu.gui.CtuluPopupMenu; +import org.fudaa.ebli.calque.CalqueGISTreeModel.CellRenderer; +import org.fudaa.ebli.commun.EbliLib; +import org.fudaa.ebli.controle.BConfigurePalette; +import org.fudaa.ebli.palette.BPalettePlageLegende; +import org.fudaa.ebli.palette.BPalettePlageTarget; +import org.fudaa.ebli.palette.BPlageAbstract; +import org.fudaa.ebli.ressource.EbliResource; +import org.fudaa.ebli.trace.BPlageInterface; +import org.fudaa.ebli.trace.TraceIcon; +import org.fudaa.ebli.trace.TraceIconModel; +import org.fudaa.ebli.trace.TraceLigne; + +import com.memoire.bu.BuBorderLayout; +import com.memoire.bu.BuBorders; +import com.memoire.bu.BuButton; +import com.memoire.bu.BuButtonLayout; +import com.memoire.bu.BuCheckBox; +import com.memoire.bu.BuEmptyList; +import com.memoire.bu.BuGridLayout; +import com.memoire.bu.BuLabel; +import com.memoire.bu.BuLib; +import com.memoire.bu.BuMenuItem; +import com.memoire.bu.BuPanel; +import com.memoire.bu.BuResource; +import com.memoire.bu.BuScrollPane; +import com.memoire.bu.BuTextField; +import com.memoire.bu.BuToolButton; +import com.memoire.bu.BuVerticalLayout; + + +/** + * Palette de l\xE9gende des graphes. + * Utilis\xE9e pour \xE9diter les l\xE9gendes des graphes + * @author Adrien Hadoux + * + */ +public class EGPaletteLegendeGraphe extends BuPanel implements ActionListener,ListSelectionListener,BuBorders{ + + /** + * Graphe associ\xE9 a la palette + */ + EGGraphe graphe_; + + //Map<BuTextField,EGCourbe > mapTitles_; + + /** + * Bouton qui applique les changements + */ + JButton btApply_; + + BuToolButton btAssombrir_; + + JButton btColor_; + + BuToolButton btEcl_; + + BuButton btFormat_; + + JButton btRefresh_; + + BuCheckBox cbChangedLeg_; + + CtuluRange dataBoite_; + + TraceIcon ic_; + + boolean isAdjusting_; + + BuMenuItem itemRemove_; + + BuMenuItem itemSplit_; + + JLabel lbGrapheTitle_; + + + /** + * Format des nombres des l\xE9gendes + */ + CtuluNumberFormatI format_ =CtuluNumberFormatDefault.DEFAULT_FMT; + + /** + * S\xE9parateur entre les formats + */ + String separatorFormat_="-"; + + /** + * La liste des cournes + */ + JList list_; + + CtuluPopupMenu menu_; + + + /** + * Panel des donn\xE9es qui se met a jour automatiquement lors du clic dans la liste des courbes. + */ + JPanel panelData_; + + BPlageAbstract plageEnCours_; + + List plages_; + + /** + * LE scroll de la liste des courbe + */ + BuScrollPane sp_; + + BPalettePlageTarget target_; + + JTextField tfPlageLeg_; + /** + * Textfield du contenu du titre de la courbe + */ + JTextField tfTitleCourbeTop_; + + + //BuTextField txtTitleCourbe_=new BuTextField(10); + + + + + + private class PlageTableModel implements ListModel{ + EGCourbe[] liste_; + public PlageTableModel(EGCourbe[] list){ + super(); + liste_=list; + } + + public void addListDataListener(ListDataListener l) { + } + + public Object getElementAt(int index) { + return liste_[index]; + } + + public int getSize() { + return liste_.length; + } + + public void removeListDataListener(ListDataListener l) { + } + } + + /** + * Renderer qui affiche la courbe sous forme de sa courbe miniature et son libell\xE9 \xE0 cot\xE9 + * @author Adrien Hadoux + * + */ + private class LegendeRenderer implements ListCellRenderer{ + + private final Color HIGHLIGHT_COLOR = UIManager.getColor("Tree.selectionBackground"); + public LegendeRenderer(){ + + } + + @Override + public Component getListCellRendererComponent(JList list, Object value, + int index, boolean isSelected, boolean cellHasFocus) { + EGCourbe cb=(EGCourbe) value; + JLabel resultat=new JLabel(); + + BufferedImage image=new BufferedImage(20,20,BufferedImage.TYPE_INT_RGB); + Graphics2D g = image.createGraphics(); + final Rectangle rec = new Rectangle(20,20); + //g.translate(rec.x, rec.y); + // la ligne + g.setColor(Color.white); + g.fillRect(0, 0, 20, 20); + final TraceLigne l = new TraceLigne(cb.getLigneModel()); + l.dessineTrait(g, 0, rec.height / 2, rec.width, rec.height / 2); + // l'icone + final TraceIconModel icm = new TraceIconModel(cb.getIconModel()); + icm.setTaille(Math.min(rec.width / 3, rec.height/3));// a voir + final TraceIcon ic = new TraceIcon(icm); + ic.paintIconCentre(g, rec.width / 2, rec.height / 2); + //g.translate(-rec.x, -rec.y); + + resultat.setIcon(new ImageIcon(image)); + resultat.setText(cb.getTitle()); + resultat.setOpaque(true); + //resultat.setIconTextGap(12); + if (isSelected) { + resultat.setBackground(HIGHLIGHT_COLOR); + resultat.setForeground(Color.white); + } + + return resultat; + } + + } + + PlageTableModel model_; + + public EGPaletteLegendeGraphe(EGGraphe graphe){ + graphe_=graphe; + //mapTitles_=new HashMap<BuTextField, EGCourbe>(); + //-- construction du panel des l\xE9gendes --// + buildContent(); + } + + + private EGCourbe getSelectedCourbe(){ + int select=this.list_.getSelectedIndex(); + if(select==-1) + return null; + EGCourbe courbe=graphe_.getModel().getCourbes()[select]; + return courbe; + } + + + BConfigurePalette paletteConf_=new BConfigurePalette(true); + /** + * Met a jour le panneau des donn\xE9es. + */ + private void updatePanelData() { + //-- on r\xE9cup\xE8re la courbe selectionnee --// + EGCourbe courbe=getSelectedCourbe(); + if(courbe!=null) + paletteConf_.setPalettePanelTarget(courbe); + } + + + private void buildContent(){ + + final EGCourbe[] cs = graphe_.getModel().getCourbes(); + + final BuBorderLayout lay = new BuBorderLayout(2, 2); + setLayout(lay); + + //-- liste des courbes --// + list_ = new BuEmptyList(); + model_ = new PlageTableModel(cs); + list_.setModel(model_); + list_.setCellRenderer(new LegendeRenderer()); + list_.getSelectionModel().addListSelectionListener(this); + list_.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + + //list_.setFocusable(false); + sp_ = new BuScrollPane(list_); + sp_.setPreferredSize(new Dimension(150,100)); + sp_.setBorder(BorderFactory.createTitledBorder(EbliResource.EBLI.getString("Liste des courbes"))); + add(sp_, BuBorderLayout.NORTH); + + final BuPanel pnColor = new BuPanel(); + pnColor.setLayout(new BuButtonLayout(1, SwingConstants.LEFT)); + + //-- update le panel des donn\xE9es + updatePanelData(); + + + //paletteConf_.setPreferredSize(new Dimension(300,300)); + paletteConf_.setBorder(BorderFactory.createTitledBorder(EbliResource.EBLI.getString("Param\xE9trage"))); + + JScrollPane peast=new JScrollPane(paletteConf_); + peast.setPreferredSize(new Dimension(150,200)); + + add(peast, BorderLayout.CENTER); + btApply_ = new BuButton(BuResource.BU.getIcon("appliquer")); + btApply_.setText(BuResource.BU.getString("Appliquer")); + btApply_.setToolTipText(EbliLib.getS("Appliquer les modifications")); + btApply_.addActionListener(this); + btRefresh_ = new BuButton(BuResource.BU.getIcon("rafraichir")); + btRefresh_.setText(EbliLib.getS("initialiser")); + btRefresh_.setToolTipText(EbliLib.getS("Initialiser les plages des couleurs")); + btRefresh_.addActionListener(this); + btRefresh_.setEnabled(true); +// btFormat_ = new BuButton(); +// btFormat_.setText(EbliLib.getS("Format des labels")); +// btFormat_.setToolTipText(EbliLib.getS("Permet de modifier le formattage des nombres et le s\xE9parateur de valeurs")); +// btFormat_.addActionListener(this); +// btFormat_.setEnabled(false); + final BuPanel btpn = new BuPanel(); + btpn.setLayout(new BuButtonLayout(1, SwingConstants.RIGHT)); + + //btpn.add(btFormat_); + btpn.add(btRefresh_); + //btpn.add(btApply_); + add(btpn, BuBorderLayout.SOUTH); + + this.setPreferredSize(new Dimension(300,300)); + this.setMinimumSize(new Dimension(300,300)); + + this.setBorder(BorderFactory.createTitledBorder(EbliResource.EBLI.getString("Edition de la l\xE9gende des courbes"))); + //-- initialise au premier courbe --// + list_.setSelectedIndex(0); + } + + + + public void actionPerformed(ActionEvent _e) { + + EGCourbe courbe=getSelectedCourbe(); + if(courbe==null)return; + + final Object s = _e.getSource(); + if ((s == btColor_) ) { + final Color n = JColorChooser.showDialog(this, EbliResource.EBLI.getString("Couleur"), ic_.getCouleur()); + if ((n != null) && (n != ic_.getCouleur())) { + // setModified(); + ic_.setCouleur(n); + if(courbe!=null) + courbe.setAspectContour(n); + } + } else if (s == btApply_) { + actionApply(); + } else if (s == btRefresh_) { + reinitPlages(); + } else if (btFormat_ == _e.getSource()) { + actionFormat(); + } + + + } + + + /** + * Appelee lorsqu'on appuie sur le bouton appliquer + */ + private void actionApply() { + + } + + /** + * Reinitialise les titres des courbes avec les donn\xE9es initiales. + */ + private void reinitPlages() { + + } + + /** + * Methode qui ajuste toutes les l\xE9gendes en fonction du format choisi et du separator. + */ + protected void ajusteAllLegendes() { + + } + + + + public void valueChanged(ListSelectionEvent e) { + + updatePanelData(); + } + + + + private void actionFormat() { + CtuluNumberFormatI ctuluNumberFormatI =format_; + /* + * CtuluNumberFormatI fmt = getDefaultFormat(); if (fmt == null) { fmt = CtuluLib.DEFAULT_NUMBER_FORMAT; } + */ + final CtuluDecimalFormatEditPanel fmtSelect = new CtuluDecimalFormatEditPanel(ctuluNumberFormatI); + fmtSelect.setErrorTextUnable(); + final CtuluDialogPanel pn = new CtuluDialogPanel() { + public boolean valide() { + return fmtSelect.valide(); + } + }; + pn.setLayout(new BuVerticalLayout(4)); + final JPanel pnSep = new BuPanel(new BuGridLayout(2, 2, 2)); + pnSep.add(new BuLabel(EbliLib.getS("S\xE9parateur"))); + final BuTextField tf = new BuTextField(); + tf.setText(separatorFormat_); + pnSep.add(tf); + pn.add(pnSep); + + if (ctuluNumberFormatI == null || ctuluNumberFormatI.isDecimal()) { + fmtSelect.setBorder(BorderFactory.createTitledBorder(EbliLib.getS("Format d\xE9cimal"))); + pn.add(fmtSelect); + } + if (CtuluDialogPanel.isOkResponse(pn.afficheModale(this, EbliLib.getS("Format")))) { + format_= fmtSelect.getCurrentFmt(); + separatorFormat_= tf.getText(); + ajusteAllLegendes(); + + } + } + + +} Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCalqueLegende.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCalqueLegende.java 2009-01-28 19:16:56 UTC (rev 4421) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCalqueLegende.java 2009-01-28 19:17:26 UTC (rev 4422) @@ -13,6 +13,8 @@ import org.fudaa.ctulu.CtuluCommandContainer; import org.fudaa.ebli.calque.BCalqueLegendePanel; +import org.fudaa.ebli.courbe.EGFillePanel; +import org.fudaa.ebli.courbe.EGGraphe; import org.fudaa.ebli.palette.PaletteSelecteurCouleurPlage; import org.fudaa.ebli.visuallibrary.EbliScene; import org.fudaa.ebli.visuallibrary.EbliWidget; @@ -43,10 +45,11 @@ // Font oldFont_; boolean mustUpdateFont_ = false; - + public EbliWidgetCalqueLegende(final EbliScene _scene, final boolean _controller/* , BArbreCalqueModel model */, final BCalqueLegendePanel _legendePanel) { super(_scene, _controller); + setCheckClipping(true); // oldFont_ = getFormeFont(); // -- la legende est un listener des modifs de son calque --// Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetVueCalque.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetVueCalque.java 2009-01-28 19:16:56 UTC (rev 4421) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetVueCalque.java 2009-01-28 19:17:26 UTC (rev 4422) @@ -203,7 +203,7 @@ public Rectangle getInitialEditorComponentBounds( final org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, final Widget widget, final BuPanel editor, final Rectangle viewBounds) { - return convertLocalToScene(getClientArea()); + return null;// convertLocalToScene(getClientArea()); } public void notifyOpened(final org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetGraphe.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetGraphe.java 2009-01-28 19:16:56 UTC (rev 4421) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetGraphe.java 2009-01-28 19:17:26 UTC (rev 4422) @@ -245,10 +245,10 @@ public Rectangle getInitialEditorComponentBounds( final org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, final Widget widget, final BuPanel editor, final Rectangle viewBounds) { - final Rectangle rec = convertLocalToScene(getClientArea()); - rec.width -= 1; - rec.height -= 1; - return rec; +// final Rectangle rec = convertLocalToScene(getClientArea()); +// rec.width -= 1; +// rec.height -= 1; + return null;//rec; } public void notifyOpened(final org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetTitle.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetTitle.java 2009-01-28 19:16:56 UTC (rev 4421) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetTitle.java 2009-01-28 19:17:26 UTC (rev 4422) @@ -47,10 +47,10 @@ // -- ajouter l option de remplacer le text dans le label --// // -- creation de l action --// - final WidgetAction editorAction = ActionFactory.createInplaceEditorAction(this); + //final WidgetAction editorAction = ActionFactory.createInplaceEditorAction(this); // -- ajout de l action au label correspondant --// - intern_.getActions().addAction(editorAction); +// intern_.getActions().addAction(editorAction); // setEnabled(false); } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/WidgetLegendeManager.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/WidgetLegendeManager.java 2009-01-28 19:16:56 UTC (rev 4421) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/WidgetLegendeManager.java 2009-01-28 19:17:26 UTC (rev 4422) @@ -1,24 +1,36 @@ package org.fudaa.ebli.visuallibrary.graphe; +import java.awt.Dimension; import java.awt.Font; import java.awt.FontMetrics; import java.awt.Point; import java.awt.Rectangle; +import java.util.EnumSet; import java.util.Iterator; import java.util.List; +import javax.swing.JComponent; + import org.fudaa.ebli.courbe.EGAxe; import org.fudaa.ebli.courbe.EGCourbe; +import org.fudaa.ebli.courbe.EGFillePanel; import org.fudaa.ebli.courbe.EGGraphe; import org.fudaa.ebli.courbe.EGGrapheModelListener; import org.fudaa.ebli.courbe.EGObject; +import org.fudaa.ebli.courbe.EGPaletteLegendeGraphe; import org.fudaa.ebli.visuallibrary.EbliScene; import org.fudaa.ebli.visuallibrary.EbliWidget; import org.fudaa.ebli.visuallibrary.EbliWidgetControllerMenuOnly; +import org.netbeans.api.visual.action.ActionFactory; +import org.netbeans.api.visual.action.InplaceEditorProvider; +import org.netbeans.api.visual.action.WidgetAction; import org.netbeans.api.visual.layout.LayoutFactory.SerialAlignment; import org.netbeans.api.visual.widget.Widget; import org.netbeans.modules.visual.layout.FlowLayout; +import org.netbeans.modules.visual.util.GeomUtil; +import com.memoire.bu.BuPanel; + /** * @author denf01a adrien hadoux * @creation 5 ao\xFBt 2008 @@ -39,13 +51,20 @@ /** * Creation de la classe widget specifique au calque. Permet de gerer le resize via le changement de font */ - public static class WidgetCalqueLegende extends EbliWidget { + public static class WidgetCalqueLegende extends EbliWidget implements InplaceEditorProvider<BuPanel> { Font oldFont_; - - public WidgetCalqueLegende(final EbliScene scene, final boolean _controller) { + EGGraphe graphe_; + public WidgetCalqueLegende(EGGraphe graphe,final EbliScene scene, final boolean _controller) { super(scene, _controller); + graphe_=graphe; oldFont_ = getFormeFont(); + // -- creation de l action --// + final WidgetAction editorAction = ActionFactory.createInplaceEditorAction(this); + + // -- ajout de l action au label correspondant --// + this.getActions().addAction(editorAction); + } protected Rectangle resizeMaxLegende() { @@ -193,6 +212,80 @@ return true; } + + public BuPanel createEditorComponent( + org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, + Widget widget) { + EGPaletteLegendeGraphe palette =new EGPaletteLegendeGraphe(this.graphe_); + palette.setPreferredSize(new Dimension(300,300)); + + return palette; + } + + private void updateRectangleToFitToView(final Rectangle rectangle) { + final JComponent component = this.getScene().getView(); + if (rectangle.x + rectangle.width > component.getWidth()) rectangle.x = component.getWidth() - rectangle.width; + if (rectangle.y + rectangle.height > component.getHeight()) rectangle.y = component.getHeight() - rectangle.height; + if (rectangle.x < 0) rectangle.x = 0; + if (rectangle.y < 0) rectangle.y = 0; + } + + public EnumSet<org.netbeans.api.visual.action.InplaceEditorProvider.ExpansionDirection> getExpansionDirections( + org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, + Widget widget, BuPanel editor) { + return null; + } + + + public Rectangle getInitialEditorComponentBounds( + org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, + Widget widget, BuPanel editor, Rectangle viewBounds) { + + Rectangle rectangle = widget.getScene().convertSceneToView(widget.convertLocalToScene(widget.getBounds())); + + + final Point center = GeomUtil.center(rectangle); + final Dimension size = editor.getMinimumSize(); + if (rectangle.width > size.width) size.width = rectangle.width; + if (rectangle.height > size.height) size.height = rectangle.height; + final int x = center.x - size.width / 2; + final int y = center.y - size.height / 2; + rectangle = new Rectangle(x, y, size.width, size.height); + updateRectangleToFitToView(rectangle); + + //-- pour que ce soit clairment visible --// + int tailleMinW=400; + int tailleMinH=500; + if( rectangle.width<tailleMinW){ + int dim=tailleMinW-rectangle.width; + rectangle.width+=dim; + rectangle.x=rectangle.x-dim/2; + } + if( rectangle.height<tailleMinH){ + int dim=tailleMinH-rectangle.height; + rectangle.height+=dim; + rectangle.y=rectangle.y-dim/2; + } + + return rectangle; + } + + + public void notifyClosing( + org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, + Widget widget, BuPanel editor, boolean commit) { + // TODO Auto-generated method stub + + } + + + public void notifyOpened( + org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, + Widget widget, BuPanel editor) { + // TODO Auto-generated method stub + + } + } /** @@ -205,7 +298,7 @@ */ public static EbliWidget createLegende(final EGGraphe g, final EbliScene scene, final Point PreferredLocation) { final EGCourbe[] cs = g.getModel().getCourbes(); - final WidgetCalqueLegende res = new WidgetCalqueLegende(scene, false); + final WidgetCalqueLegende res = new WidgetCalqueLegende(g,scene, false); res.setLayout(new FlowLayout(true, SerialAlignment.CENTER, 5));// a // modifier // pour This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <had...@us...> - 2009-01-28 19:16:58
|
Revision: 4421 http://fudaa.svn.sourceforge.net/fudaa/?rev=4421&view=rev Author: hadouxad Date: 2009-01-28 19:16:56 +0000 (Wed, 28 Jan 2009) Log Message: ----------- lot 3 EDF POST - Legendes graphes: edition blind?\195?\169e - Correction du bug de d?\195?\169centrage des mode ?\195?\169dition!! - suite de calcul modifi?\195?\169e Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/ef/impl/EfGridDefaultAbstract.java Modified: branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/ef/impl/EfGridDefaultAbstract.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/ef/impl/EfGridDefaultAbstract.java 2009-01-28 14:47:05 UTC (rev 4420) +++ branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/ef/impl/EfGridDefaultAbstract.java 2009-01-28 19:16:56 UTC (rev 4421) @@ -1450,6 +1450,8 @@ _m.getPt(i, c1); getPt(i, cThis); if (!cThis.equals3D(c1)) { + //-- on teste la difference par rapport a epsilon --// + if(cThis.x-c1.x>_eps || cThis.y-c1.y>_eps || cThis.z-c1.z>_eps) return false; } up.majAvancement(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bma...@us...> - 2009-01-28 14:47:10
|
Revision: 4420 http://fudaa.svn.sourceforge.net/fudaa/?rev=4420&view=rev Author: bmarchan Date: 2009-01-28 14:47:05 +0000 (Wed, 28 Jan 2009) Log Message: ----------- Created tag FudaaModeleur_0_11. Added Paths: ----------- tags/FudaaModeleur_0_11/ tags/FudaaModeleur_0_11/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/gml/GISGMLZoneExporter.java tags/FudaaModeleur_0_11/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZCalqueDeplacement.java tags/FudaaModeleur_0_11/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlImplementation.java tags/FudaaModeleur_0_11/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlSceneEditor.java Removed Paths: ------------- tags/FudaaModeleur_0_11/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/gml/GISGMLZoneExporter.java tags/FudaaModeleur_0_11/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZCalqueDeplacement.java tags/FudaaModeleur_0_11/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlImplementation.java tags/FudaaModeleur_0_11/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlSceneEditor.java Property changes on: tags/FudaaModeleur_0_11 ___________________________________________________________________ Added: svn:ignore + eclipse_projects Added: svn:mergeinfo + /branches/Br_FudaaModeleur_TF:3445-3850 /branches/FudaaModeleur_TC1:3861-3891 Deleted: tags/FudaaModeleur_0_11/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/gml/GISGMLZoneExporter.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/gml/GISGMLZoneExporter.java 2009-01-27 18:04:48 UTC (rev 4414) +++ tags/FudaaModeleur_0_11/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/gml/GISGMLZoneExporter.java 2009-01-28 14:47:05 UTC (rev 4420) @@ -1,205 +0,0 @@ -/* - * @creation 19 mai 2005 - * @modification $Date: 2008-03-28 14:59:28 $ - * @license GNU General Public License 2 - * @copyright (c)1998-2001 CETMEF 2 bd Gambetta F-60231 Compiegne - * @mail de...@fu... - */ -package org.fudaa.ctulu.gis.gml; - -import gnu.trove.TIntArrayList; -import gnu.trove.TObjectIntHashMap; - -import java.io.IOException; -import java.io.OutputStream; - -import org.fudaa.ctulu.CtuluActivity; -import org.fudaa.ctulu.ProgressionInterface; -import org.fudaa.ctulu.ProgressionUpdater; -import org.fudaa.ctulu.gis.GISAttributeConstants; -import org.fudaa.ctulu.gis.GISAttributeInterface; -import org.fudaa.ctulu.gis.GISZoneCollection; -import org.geotools.data.DataStore; -import org.geotools.data.FeatureWriter; -import org.geotools.data.Transaction; -import org.geotools.feature.AttributeType; -import org.geotools.feature.AttributeTypeFactory; -import org.geotools.feature.Feature; -import org.geotools.feature.FeatureType; -import org.geotools.feature.FeatureTypes; -import org.geotools.feature.IllegalAttributeException; -import org.geotools.feature.SchemaException; -import org.geotools.feature.type.BasicFeatureTypes; - -import org.fudaa.ctulu.gis.GISDataModel; - -import com.memoire.fu.FuLog; -import com.vividsolutions.jts.geom.Geometry; - -/** - * @author Fred Deniger - * @version $Id: GISGMLZoneExporter.java,v 1.1.6.1 2008-03-28 14:59:28 bmarchan Exp $ - */ -public class GISGMLZoneExporter implements CtuluActivity { - - boolean stop_; - - public void stop() { - stop_ = true; - } - - public GISGMLZoneExporter() { - super(); - } - - private boolean useIdAsName_; - - public AttributeType[] createAttributes(final GISDataModel _zone, final TObjectIntHashMap _attrIdx) { - final int attributeNb = _zone.getNbAttributes(); - final TIntArrayList attribute = new TIntArrayList(attributeNb); - // pour l'instant, les attributs atomiques (definis sur chaque sommets) ne sont pas - // support\xE9s. - for (int i = 0; i < attributeNb; i++) { - if (!_zone.getAttribute(i).isAtomicValue()) { - attribute.add(i); - if (FuLog.isDebug()) { - FuLog.debug("add attribute " + _zone.getAttribute(i).getID() + " classe " - + _zone.getAttribute(i).getDataClass()); - } - } - } - final int size = attribute.size(); - // on construit les attributs que vont bien - final AttributeType[] atts = new AttributeType[2 + size]; - // le premier correspond a la geometrie - atts[0] = AttributeTypeFactory.newAttributeType(BasicFeatureTypes.GEOMETRY_ATTRIBUTE_NAME, Geometry.class); - - for (int i = 0; i < size; i++) { - final int posInZone = attribute.get(i); - final GISAttributeInterface atti = _zone.getAttribute(posInZone); - // 18 pour les shapefiles ...; - atts[1 + i] = AttributeTypeFactory.newAttributeType(useIdAsName_ ? atti.getID() : atti.getName(), atti - .getDataClass(), true, 18); - _attrIdx.put(atts[i + 1], posInZone); - } - // Le dernier correspond \xE0 l'index de la g\xE9om\xE9trie dans la GISZone - GISAttributeInterface attInd=GISAttributeConstants.INDEX_GEOM; - atts[atts.length-1]=AttributeTypeFactory.newAttributeType(attInd.getID(), attInd.getDataClass()); - return atts; - } - - DataStore store_; - OutputStream out_; - - protected FeatureWriter createWriter(final FeatureType _type) throws IOException { - if (store_ != null) { - store_.createSchema(_type); - return store_.getFeatureWriter(_type.getTypeName(), Transaction.AUTO_COMMIT); - } - return new GMLFeatureWriter(_type, out_); - } - - /** - * @param _prog la barre de progression - * @param _zone la zone a exporter - * @param _dest la destination - * @throws IOException - * @throws SchemaException - * @throws IllegalAttributeException - */ - public void process(final ProgressionInterface _prog, final GISDataModel _zone, final DataStore _dest) - throws IOException, SchemaException, IllegalAttributeException { - out_ = null; - store_ = _dest; - process(_prog, _zone); - } - - /** - * Attention: l'outputstream n'est pas ferme. - * - * @param _prog - * @param _zone - * @param _dest - * @throws IOException - * @throws SchemaException - * @throws IllegalAttributeException - */ - public void processGML(final ProgressionInterface _prog, final GISZoneCollection _zone, final OutputStream _dest) - throws IOException, SchemaException, IllegalAttributeException { - out_ = _dest; - store_ = null; - process(_prog, _zone); - - } - - private void process(final ProgressionInterface _prog, final GISDataModel _zone) throws IOException, - SchemaException, IllegalAttributeException { - stop_ = false; - final TObjectIntHashMap attIdx = new TObjectIntHashMap(_zone.getNbAttributes()); - final AttributeType[] atts = createAttributes(_zone, attIdx); - if (stop_) { - return; - } - final FeatureType featureType = createFeatureType(_zone, atts); - FeatureWriter writer = null; - try { - writer = createWriter(featureType); - if (stop_) { - return; - } - final int nb = _zone.getNumGeometries(); - final ProgressionUpdater up = new ProgressionUpdater(_prog); - up.setValue(9, nb, 10, 90); - final int nbAttribute = atts.length; - for (int i = 0; i < nb; i++) { - if (stop_) { - return; - } - final Feature feature = writer.next(); - feature.setDefaultGeometry(_zone.getGeometry(i)); - for (int j = 1; j < nbAttribute-1; j++) { - feature.setAttribute(j, _zone.getValue(attIdx.get(atts[j]), i)); - } - // Enregistrement de l'index de la g\xE9om\xE9trie dans le fichier - feature.setAttribute(nbAttribute-1, new Integer(i)); - writer.write(); - - up.majAvancement(); - } - } finally { - if (writer != null) { - if (out_ == null) { - writer.close(); - } else { - ((GMLFeatureWriter) writer).writeFooter(); - } - } - } - - } - - public FeatureType createFeatureType(final GISDataModel _zone, final AttributeType[] _atts) - throws SchemaException { - /* Changement de GISZoneCollection en GISDataModel, suppression des lignes dessous - String name = _zone.getTitle(); - if (name == null) { - name = "zone"; - }*/ - final FeatureType featureType = FeatureTypes.newFeatureType(_atts, "zone"); - return featureType; - } - - /** - * A utiliser pour des donn\xE9es sensibles lorsque l'on veut que certains attributs soient retrouv\xE9 dans toutes les - * langues. - * - * @return true si on utilise l'ID de la variable pour construire l'attribut \xE0 inclure dans le fichier de sortie. - */ - protected boolean isUseIdAsName() { - return useIdAsName_; - } - - public void setUseIdAsName(final boolean _useIdAsName) { - useIdAsName_ = _useIdAsName; - } -} Copied: tags/FudaaModeleur_0_11/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/gml/GISGMLZoneExporter.java (from rev 4418, branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/gml/GISGMLZoneExporter.java) =================================================================== --- tags/FudaaModeleur_0_11/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/gml/GISGMLZoneExporter.java (rev 0) +++ tags/FudaaModeleur_0_11/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/gml/GISGMLZoneExporter.java 2009-01-28 14:47:05 UTC (rev 4420) @@ -0,0 +1,211 @@ +/* + * @creation 19 mai 2005 + * @modification $Date: 2008-03-28 14:59:28 $ + * @license GNU General Public License 2 + * @copyright (c)1998-2001 CETMEF 2 bd Gambetta F-60231 Compiegne + * @mail de...@fu... + */ +package org.fudaa.ctulu.gis.gml; + +import gnu.trove.TIntArrayList; +import gnu.trove.TObjectIntHashMap; + +import java.io.IOException; +import java.io.OutputStream; + +import org.fudaa.ctulu.CtuluActivity; +import org.fudaa.ctulu.ProgressionInterface; +import org.fudaa.ctulu.ProgressionUpdater; +import org.fudaa.ctulu.gis.GISAttributeConstants; +import org.fudaa.ctulu.gis.GISAttributeInterface; +import org.fudaa.ctulu.gis.GISZoneCollection; +import org.geotools.data.DataStore; +import org.geotools.data.FeatureWriter; +import org.geotools.data.Transaction; +import org.geotools.feature.AttributeType; +import org.geotools.feature.AttributeTypeFactory; +import org.geotools.feature.Feature; +import org.geotools.feature.FeatureType; +import org.geotools.feature.FeatureTypes; +import org.geotools.feature.IllegalAttributeException; +import org.geotools.feature.SchemaException; +import org.geotools.feature.type.BasicFeatureTypes; + +import org.fudaa.ctulu.gis.GISDataModel; + +import com.memoire.fu.FuLog; +import com.vividsolutions.jts.geom.Geometry; + +/** + * @author Fred Deniger + * @version $Id: GISGMLZoneExporter.java,v 1.1.6.1 2008-03-28 14:59:28 bmarchan Exp $ + */ +public class GISGMLZoneExporter implements CtuluActivity { + + boolean stop_; + + public void stop() { + stop_ = true; + } + + public GISGMLZoneExporter() { + super(); + } + + private boolean useIdAsName_; + + public AttributeType[] createAttributes(final GISDataModel _zone, final TObjectIntHashMap _attrIdx) { + final int attributeNb = _zone.getNbAttributes(); + final TIntArrayList attribute = new TIntArrayList(attributeNb); + // pour l'instant, les attributs atomiques (definis sur chaque sommets) ne sont pas + // support\xE9s. + for (int i = 0; i < attributeNb; i++) { + if (!_zone.getAttribute(i).isAtomicValue()) { + attribute.add(i); + if (FuLog.isDebug()) { + FuLog.debug("add attribute " + _zone.getAttribute(i).getID() + " classe " + + _zone.getAttribute(i).getDataClass()); + } + } + } + final int size = attribute.size(); + // on construit les attributs que vont bien + final AttributeType[] atts = new AttributeType[2 + size]; + // le premier correspond a la geometrie + atts[0] = AttributeTypeFactory.newAttributeType(BasicFeatureTypes.GEOMETRY_ATTRIBUTE_NAME, Geometry.class); + + for (int i = 0; i < size; i++) { + final int posInZone = attribute.get(i); + final GISAttributeInterface atti = _zone.getAttribute(posInZone); + // 18 pour les shapefiles ...; + atts[1 + i] = AttributeTypeFactory.newAttributeType(useIdAsName_ ? atti.getID() : atti.getName(), atti + .getDataClass(), true, 18); + _attrIdx.put(atts[i + 1], posInZone); + } + // Le dernier correspond \xE0 l'index de la g\xE9om\xE9trie dans la GISZone + GISAttributeInterface attInd=GISAttributeConstants.INDEX_GEOM; + atts[atts.length-1]=AttributeTypeFactory.newAttributeType(attInd.getID(), attInd.getDataClass()); + return atts; + } + + DataStore store_; + OutputStream out_; + + protected FeatureWriter createWriter(final FeatureType _type) throws IOException { + if (store_ != null) { + store_.createSchema(_type); + return store_.getFeatureWriter(_type.getTypeName(), Transaction.AUTO_COMMIT); + } + return new GMLFeatureWriter(_type, out_); + } + + /** + * @param _prog la barre de progression + * @param _zone la zone a exporter + * @param _dest la destination + * @throws IOException + * @throws SchemaException + * @throws IllegalAttributeException + */ + public void process(final ProgressionInterface _prog, final GISDataModel _zone, final DataStore _dest) + throws IOException, SchemaException, IllegalAttributeException { + out_ = null; + store_ = _dest; + process(_prog, _zone); + } + + /** + * Attention: l'outputstream n'est pas ferme. + * + * @param _prog + * @param _zone + * @param _dest + * @throws IOException + * @throws SchemaException + * @throws IllegalAttributeException + */ + public void processGML(final ProgressionInterface _prog, final GISZoneCollection _zone, final OutputStream _dest) + throws IOException, SchemaException, IllegalAttributeException { + out_ = _dest; + store_ = null; + _zone.prepareExport(); + process(_prog, _zone); + + } + + private void process(final ProgressionInterface _prog, final GISDataModel _zone) throws IOException, + SchemaException, IllegalAttributeException { + /* + * Pour que les z atomiques soient exporter correctement, il faut que + * prepareExport() est \xE9t\xE9 appel\xE9 sur la GISZoneCollection dans le + * GISDataModel. + */ + stop_ = false; + final TObjectIntHashMap attIdx = new TObjectIntHashMap(_zone.getNbAttributes()); + final AttributeType[] atts = createAttributes(_zone, attIdx); + if (stop_) { + return; + } + final FeatureType featureType = createFeatureType(_zone, atts); + FeatureWriter writer = null; + try { + writer = createWriter(featureType); + if (stop_) { + return; + } + final int nb = _zone.getNumGeometries(); + final ProgressionUpdater up = new ProgressionUpdater(_prog); + up.setValue(9, nb, 10, 90); + final int nbAttribute = atts.length; + for (int i = 0; i < nb; i++) { + if (stop_) { + return; + } + final Feature feature = writer.next(); + feature.setDefaultGeometry(_zone.getGeometry(i)); + for (int j = 1; j < nbAttribute-1; j++) { + feature.setAttribute(j, _zone.getValue(attIdx.get(atts[j]), i)); + } + // Enregistrement de l'index de la g\xE9om\xE9trie dans le fichier + feature.setAttribute(nbAttribute-1, new Integer(i)); + writer.write(); + + up.majAvancement(); + } + } finally { + if (writer != null) { + if (out_ == null) { + writer.close(); + } else { + ((GMLFeatureWriter) writer).writeFooter(); + } + } + } + + } + + public FeatureType createFeatureType(final GISDataModel _zone, final AttributeType[] _atts) + throws SchemaException { + /* Changement de GISZoneCollection en GISDataModel, suppression des lignes dessous + String name = _zone.getTitle(); + if (name == null) { + name = "zone"; + }*/ + final FeatureType featureType = FeatureTypes.newFeatureType(_atts, "zone"); + return featureType; + } + + /** + * A utiliser pour des donn\xE9es sensibles lorsque l'on veut que certains attributs soient retrouv\xE9 dans toutes les + * langues. + * + * @return true si on utilise l'ID de la variable pour construire l'attribut \xE0 inclure dans le fichier de sortie. + */ + protected boolean isUseIdAsName() { + return useIdAsName_; + } + + public void setUseIdAsName(final boolean _useIdAsName) { + useIdAsName_ = _useIdAsName; + } +} Deleted: tags/FudaaModeleur_0_11/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZCalqueDeplacement.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZCalqueDeplacement.java 2009-01-27 18:04:48 UTC (rev 4414) +++ tags/FudaaModeleur_0_11/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZCalqueDeplacement.java 2009-01-28 14:47:05 UTC (rev 4420) @@ -1,251 +0,0 @@ -/* - * @creation 4 avr. 2005 - * @modification $Date: 2008-05-13 12:10:33 $ - * @license GNU General Public License 2 - * @copyright (c)1998-2001 CETMEF 2 bd Gambetta F-60231 Compiegne - * @mail de...@fu... - */ -package org.fudaa.ebli.calque.edition; - -import java.awt.Color; -import java.awt.Cursor; -import java.awt.Graphics; -import java.awt.Graphics2D; -import java.awt.Point; -import java.awt.event.MouseEvent; -import java.awt.event.MouseListener; -import java.awt.event.MouseMotionListener; - -import javax.swing.SwingUtilities; - -import com.memoire.bu.BuResource; - -import org.fudaa.ebli.calque.BCalqueInteraction; -import org.fudaa.ebli.calque.ZCalqueSelectionInteractionAbstract; -import org.fudaa.ebli.commun.EbliLib; -import org.fudaa.ebli.commun.EbliSelectionState; -import org.fudaa.ebli.geometrie.GrPoint; -import org.fudaa.ebli.geometrie.GrVecteur; -import org.fudaa.ebli.ressource.EbliResource; -import org.fudaa.ebli.trace.TraceIcon; - -/** - * @author Fred Deniger - * @version $Id: ZCalqueDeplacement.java,v 1.13.6.2 2008-05-13 12:10:33 bmarchan Exp $ - */ -public class ZCalqueDeplacement extends BCalqueInteraction implements MouseListener, MouseMotionListener { - /** - * @author fred deniger - * @version $Id: ZCalqueDeplacement.java,v 1.13.6.2 2008-05-13 12:10:33 bmarchan Exp $ - */ - public interface SpecPanel { - void updateState(); - } - - SpecPanel specPanel_; - int dx_, dy_; - - TraceIcon ic_ = new TraceIcon(TraceIcon.CARRE, 2, Color.LIGHT_GRAY); - int initX_, initY_; - - private boolean isDragged_; - - ZCalqueDeplacementTargetInterface target_; - - GrVecteur vect_; - - public final SpecPanel getSpecPanel() { - return specPanel_; - } - - public Cursor getSpecificCursor() { - return EbliResource.EBLI.getCursor("fleche-deplacement", -1, new Point(0, 0)); - } - - public String getDescription() { - return BuResource.BU.getString("D\xE9placer"); - } - - /** - * Deplacement des objets s\xE9lectionn\xE9s. - * - * @param _dx dx reel - * @param _dy dy reel - */ - public final void manualMove(final double _dx, final double _dy, final double _dz) { -// if (isGele()) { -// return; -// } - isDragged_ = false; - if (target_ != null) { - target_.moved(_dx, _dy, _dz); - repaint(); - } - } - - public final void setSpecPanel(final SpecPanel _specPanel) { - specPanel_ = _specPanel; - } - - private void updateVect() { - if (vect_ == null) { - vect_ = new GrVecteur(); - } - vect_.x_ = dx_; - vect_.y_ = dy_; - vect_.autoApplique(getVersReel()); - } - - public double getReelDx() { - updateVect(); - return vect_.x_; - - } - - public double getReelDy() { - updateVect(); - return vect_.y_; - - } - - /** - * @return true si en cours de deplacement - */ - public final boolean isDragged() { - return isDragged_; - } - - /** - * @return true si selection vide - */ - public final boolean isSelectionEmpty() { - return target_.getSupport() == null || target_.getSupport().isSelectionEmpty(); - } - - /** - * @param _select le calque de selection - */ - public ZCalqueDeplacement(final ZCalqueSelectionInteractionAbstract _select) { - super(); - selection_ = _select; - setName("cqDeplacement"); - addMouseListener(this); - addMouseMotionListener(this); - } - - public boolean alwaysPaint() { - return true; - } - - public final ZCalqueDeplacementTargetInterface getTarget() { - return target_; - } - - public void mouseClicked(final MouseEvent _e) {} - - public void mouseDragged(final MouseEvent _e) { - if (isGele()) { - isDragged_ = false; - return; - } - if (_e.isControlDown() || _e.isAltDown()) { - return; - } - dx_ = _e.getX() - initX_; - dy_ = _e.getY() - initY_; - if (!isDragged_ && (dx_ * dx_ + dy_ * dy_) > 10) { - isDragged_ = true; - } - updateSpecPanel(); - repaint(); - } - - private void updateSpecPanel() { - if (specPanel_ != null) { - specPanel_.updateState(); - } - } - - public void mouseEntered(final MouseEvent _e) { - if (isGele()) { - isDragged_ = false; - return; - } - isDragged_ = false; - repaint(); - } - - public void mouseExited(final MouseEvent _e) { - if (isGele()) { - isDragged_ = false; - return; - } - isDragged_ = false; - repaint(); - } - - public void mouseMoved(final MouseEvent _e) {} - - public void mousePressed(final MouseEvent _e) { - if (!SwingUtilities.isLeftMouseButton(_e) || EbliLib.isPopupMouseEvent(_e)) { - return; - } - if (isGele()) { - isDragged_ = false; - return; - } - initX_ = _e.getX(); - initY_ = _e.getY(); - if (state_ == null) { - state_ = new EbliSelectionState(); - } - state_.majControleDesc(_e); - final GrPoint pt = new GrPoint(initX_, initY_, 0); - pt.autoApplique(getVersReel()); - target_.getSupport().changeSelection(pt, 5, state_.getModificateur()); - updateSpecPanel(); - repaint(); - } - - EbliSelectionState state_; - - public void mouseReleased(final MouseEvent _e) { - if (!SwingUtilities.isLeftMouseButton(_e) || EbliLib.isPopupMouseEvent(_e)) { - return; - } - if (isGele()) { - isDragged_ = false; - return; - } else if (isDragged_ && target_ != null && !_e.isControlDown() && !_e.isAltDown()) { - dx_ = _e.getX() - initX_; - dy_ = _e.getY() - initY_; - target_.moved(getReelDx(), getReelDy(),0); - isDragged_ = false; - } - updateSpecPanel(); - repaint(); - } - - ZCalqueSelectionInteractionAbstract selection_; - - public void paintComponent(final Graphics _g) { - if (isGele() || target_ == null || target_.getSupport() == null) { - return; - } - if (selection_ != null && !target_.getSupport().isSelectionEmpty()) { - target_.getSupport() - .paintSelection((Graphics2D) _g, selection_.getTrace(), getVersEcran(), getClipReel(_g)); - } - if (target_ != null && isDragged_) { - target_.paintMove((Graphics2D) _g, dx_, dy_, ic_); - } - - } - - public final void setTarget(final ZCalqueDeplacementTargetInterface _target) { - if (target_ != _target) { - target_ = _target; - isDragged_ = false; - } - } -} Copied: tags/FudaaModeleur_0_11/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZCalqueDeplacement.java (from rev 4419, branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZCalqueDeplacement.java) =================================================================== --- tags/FudaaModeleur_0_11/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZCalqueDeplacement.java (rev 0) +++ tags/FudaaModeleur_0_11/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZCalqueDeplacement.java 2009-01-28 14:47:05 UTC (rev 4420) @@ -0,0 +1,251 @@ +/* + * @creation 4 avr. 2005 + * @modification $Date: 2008-05-13 12:10:33 $ + * @license GNU General Public License 2 + * @copyright (c)1998-2001 CETMEF 2 bd Gambetta F-60231 Compiegne + * @mail de...@fu... + */ +package org.fudaa.ebli.calque.edition; + +import java.awt.Color; +import java.awt.Cursor; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Point; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; +import java.awt.event.MouseMotionListener; + +import javax.swing.SwingUtilities; + +import com.memoire.bu.BuResource; + +import org.fudaa.ebli.calque.BCalqueInteraction; +import org.fudaa.ebli.calque.ZCalqueSelectionInteractionAbstract; +import org.fudaa.ebli.commun.EbliLib; +import org.fudaa.ebli.commun.EbliSelectionState; +import org.fudaa.ebli.geometrie.GrPoint; +import org.fudaa.ebli.geometrie.GrVecteur; +import org.fudaa.ebli.ressource.EbliResource; +import org.fudaa.ebli.trace.TraceIcon; + +/** + * @author Fred Deniger + * @version $Id: ZCalqueDeplacement.java,v 1.13.6.2 2008-05-13 12:10:33 bmarchan Exp $ + */ +public class ZCalqueDeplacement extends BCalqueInteraction implements MouseListener, MouseMotionListener { + /** + * @author fred deniger + * @version $Id: ZCalqueDeplacement.java,v 1.13.6.2 2008-05-13 12:10:33 bmarchan Exp $ + */ + public interface SpecPanel { + void updateState(); + } + + SpecPanel specPanel_; + int dx_, dy_; + + TraceIcon ic_ = new TraceIcon(TraceIcon.CARRE, 2, Color.LIGHT_GRAY); + int initX_, initY_; + + private boolean isDragged_; + + ZCalqueDeplacementTargetInterface target_; + + GrVecteur vect_; + + public final SpecPanel getSpecPanel() { + return specPanel_; + } + + public Cursor getSpecificCursor() { + return EbliResource.EBLI.getCursor("fleche-deplacement", -1, new Point(0, 0)); + } + + public String getDescription() { + return BuResource.BU.getString("D\xE9placer"); + } + + /** + * Deplacement des objets s\xE9lectionn\xE9s. + * + * @param _dx dx reel + * @param _dy dy reel + */ + public final void manualMove(final double _dx, final double _dy, final double _dz) { +// if (isGele()) { +// return; +// } + isDragged_ = false; + if (target_ != null) { + target_.moved(_dx, _dy, _dz); + repaint(); + } + } + + public final void setSpecPanel(final SpecPanel _specPanel) { + specPanel_ = _specPanel; + } + + private void updateVect() { + if (vect_ == null) { + vect_ = new GrVecteur(); + } + vect_.x_ = dx_; + vect_.y_ = dy_; + vect_.autoApplique(getVersReel()); + } + + public double getReelDx() { + updateVect(); + return vect_.x_; + + } + + public double getReelDy() { + updateVect(); + return vect_.y_; + + } + + /** + * @return true si en cours de deplacement + */ + public final boolean isDragged() { + return isDragged_; + } + + /** + * @return true si selection vide + */ + public final boolean isSelectionEmpty() { + return target_.getSupport() == null || target_.getSupport().isSelectionEmpty(); + } + + /** + * @param _select le calque de selection + */ + public ZCalqueDeplacement(final ZCalqueSelectionInteractionAbstract _select) { + super(); + selection_ = _select; + setName("cqDeplacement"); + addMouseListener(this); + addMouseMotionListener(this); + } + + public boolean alwaysPaint() { + return true; + } + + public final ZCalqueDeplacementTargetInterface getTarget() { + return target_; + } + + public void mouseClicked(final MouseEvent _e) {} + + public void mouseDragged(final MouseEvent _e) { + if (isGele()) { + isDragged_ = false; + return; + } + if (_e.isControlDown() || _e.isAltDown()) { + return; + } + dx_ = _e.getX() - initX_; + dy_ = _e.getY() - initY_; + if (!isDragged_ && (dx_ * dx_ + dy_ * dy_) > 10) { + isDragged_ = true; + } + updateSpecPanel(); + repaint(); + } + + private void updateSpecPanel() { + if (specPanel_ != null) { + specPanel_.updateState(); + } + } + + public void mouseEntered(final MouseEvent _e) { + if (isGele()) { + isDragged_ = false; + return; + } + isDragged_ = false; + repaint(); + } + + public void mouseExited(final MouseEvent _e) { + if (isGele()) { + isDragged_ = false; + return; + } + isDragged_ = false; + repaint(); + } + + public void mouseMoved(final MouseEvent _e) {} + + public void mousePressed(final MouseEvent _e) { + if (!SwingUtilities.isLeftMouseButton(_e) || EbliLib.isPopupMouseEvent(_e)) { + return; + } + if (isGele()) { + isDragged_ = false; + return; + } + initX_ = _e.getX(); + initY_ = _e.getY(); + if (state_ == null) { + state_ = new EbliSelectionState(); + } + state_.majControleDesc(_e); + final GrPoint pt = new GrPoint(initX_, initY_, 0); + pt.autoApplique(getVersReel()); + target_.getSupport().changeSelection(pt, 5, state_.getModificateur()); + updateSpecPanel(); + repaint(); + } + + EbliSelectionState state_; + + public void mouseReleased(final MouseEvent _e) { + if (!SwingUtilities.isLeftMouseButton(_e) || EbliLib.isPopupMouseEvent(_e)) { + return; + } + if (isGele()) { + isDragged_ = false; + return; + } else if (isDragged_ && target_ != null && !_e.isControlDown() && !_e.isAltDown()) { + dx_ = _e.getX() - initX_; + dy_ = _e.getY() - initY_; + target_.moved(getReelDx(), getReelDy(),0); + isDragged_ = false; + } + updateSpecPanel(); + repaint(); + } + + ZCalqueSelectionInteractionAbstract selection_; + + public void paintComponent(final Graphics _g) { + if (isGele() || target_ == null || target_.getSupport() == null) { + return; + } + if (selection_ != null && !target_.getSupport().isSelectionEmpty()) { + target_.getSupport() + .paintSelection((Graphics2D) _g, selection_.getTrace(), getVersEcran(), getClipReel(_g)); + } + if (target_ != null && isDragged_) { + target_.paintMove((Graphics2D) _g, dx_, dy_, ic_); + } + + } + + public final void setTarget(final ZCalqueDeplacementTargetInterface _target) { + if (target_ != _target) { + target_ = _target; + isDragged_ = false; + } + } +} Deleted: tags/FudaaModeleur_0_11/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlImplementation.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlImplementation.java 2009-01-27 18:04:48 UTC (rev 4414) +++ tags/FudaaModeleur_0_11/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlImplementation.java 2009-01-28 14:47:05 UTC (rev 4420) @@ -1,809 +0,0 @@ -/* - * @creation 7 juin 07 - * @license GNU General Public License 2 - * @copyright (c)1998-2001 CETMEF 2 bd Gambetta F-60231 Compiegne - * @mail de...@fu... - */ -package org.fudaa.fudaa.modeleur; - -import java.awt.Dimension; -import java.awt.Point; -import java.awt.event.ActionEvent; -import java.beans.PropertyVetoException; -import java.io.File; -import java.io.IOException; -import java.util.List; - -import javax.swing.JComponent; -import javax.swing.JInternalFrame; -import javax.swing.JOptionPane; -import javax.swing.filechooser.FileFilter; - -import org.fudaa.ctulu.CtuluArkLoader; -import org.fudaa.ctulu.CtuluExportDataInterface; -import org.fudaa.ctulu.CtuluLibFile; -import org.fudaa.ctulu.CtuluLibString; -import org.fudaa.ctulu.CtuluRunnable; -import org.fudaa.ctulu.CtuluTaskDelegate; -import org.fudaa.ctulu.ProgressionInterface; -import org.fudaa.ctulu.gui.CtuluDialogPanel; -import org.fudaa.ctulu.gui.CtuluFileChooserTestWritable; -import org.fudaa.ctulu.gui.CtuluLibDialog; -import org.fudaa.ebli.impression.EbliMiseEnPagePreferencesPanel; -import org.fudaa.ebli.ressource.EbliResource; -import org.fudaa.fudaa.commun.FudaaLib; -import org.fudaa.fudaa.commun.FudaaProjectStateListener; -import org.fudaa.fudaa.commun.FudaaProjetStateInterface; -import org.fudaa.fudaa.commun.impl.FudaaCommonImplementation; -import org.fudaa.fudaa.commun.impl.FudaaGuiLib; -import org.fudaa.fudaa.commun.impl.FudaaLookPreferencesPanel; -import org.fudaa.fudaa.commun.impl.FudaaStartupExitPreferencesPanel; -import org.fudaa.fudaa.commun.save.FudaaSaveLib; -import org.fudaa.fudaa.commun.save.FudaaSaveProject; -import org.fudaa.fudaa.commun.save.FudaaSaveZipLoader; -import org.fudaa.fudaa.modeleur.action.MdlShow1DFrameAction; -import org.fudaa.fudaa.modeleur.action.MdlShow2DFrameAction; -import org.fudaa.fudaa.modeleur.modeleur1d.MdlFille1d; -import org.fudaa.fudaa.ressource.FudaaResource; -import org.fudaa.fudaa.sig.FSigProjectPersistence; -import org.fudaa.fudaa.sig.FSigResource; -import org.fudaa.fudaa.tr.common.TrResource; - -import com.memoire.bu.BuAbstractPreferencesPanel; -import com.memoire.bu.BuBrowserPreferencesPanel; -import com.memoire.bu.BuColumn; -import com.memoire.bu.BuDesktopPreferencesPanel; -import com.memoire.bu.BuInformationsSoftware; -import com.memoire.bu.BuLanguagePreferencesPanel; -import com.memoire.bu.BuLib; -import com.memoire.bu.BuMainPanel; -import com.memoire.bu.BuMenu; -import com.memoire.bu.BuMenuBar; -import com.memoire.bu.BuMenuItem; -import com.memoire.bu.BuMenuRecentFiles; -import com.memoire.bu.BuPreferences; -import com.memoire.bu.BuRegistry; -import com.memoire.bu.BuResource; -import com.memoire.bu.BuScrollPane; -import com.memoire.bu.BuTaskView; -import com.memoire.bu.BuUserPreferencesPanel; -import com.memoire.fu.FuLog; - -/** - * La classe principale de mise en place de l'application, de gestion des - * actions, des \xE9tats de l'interface, etc. - * - * @author Bertrand Marchand - * @version $Id$ - */ -public class MdlImplementation extends FudaaCommonImplementation implements FudaaProjectStateListener { - - protected static BuInformationsSoftware isMdl_ = new BuInformationsSoftware(); - static { - isMdl_.name = "Modeleur"; - isMdl_.version = "0.10"; - isMdl_.date = "2009-01-12"; - isMdl_.rights = "Tous droits r\xE9serv\xE9s. CETMEF (c)1999-2009"; - isMdl_.license = "GPL2"; - isMdl_.languages = "fr,en"; - isMdl_.authors=new String[]{"F.Deniger, B.Marchand"}; - isMdl_.contact="nic...@eq..."; - isMdl_.http="http://www.fudaa.fr/mdl/"; - - isMdl_.logo = EbliResource.EBLI.getIcon("draw-palette"); - isMdl_.banner = BuResource.BU.getIcon("aproposde_32"); - } - - public static File getDestFile(File _init) { - return CtuluLibFile.appendExtensionIfNeeded(_init, getExtension()); - } - - public static String getExtension() { - return "mod.zip"; - } - - public static class MdlFileFilter extends FileFilter { - final String extension_ = '.' + getExtension(); - - public boolean accept(File _f) { - return _f != null && (_f.isDirectory() || _f.getName().endsWith(extension_)); - } - - public String getDescription() { - return FSigResource.FSIG.getString("Fudaa Modeleur (*.mod.zip)"); - } - - } - - public static BuInformationsSoftware informationsSoftware() { - return isMdl_; - } - - public final static FileFilter FILTER = new MdlFileFilter(); - - /** Fenetre interne pour le modeleur 2D. */ - MdlFille2d mdl2dFrame_; - /** Fenetre interne pour le modeleur 1D */ - MdlFille1d mdl1dFrame_=null; - /** Projet modeleur. */ - MdlProjet project_; - - public MdlImplementation() { - super(); - useNewHelp_ = false; - } - - /** - * Retourne le fichier s\xE9lectionn\xE9 par boite de dialogue. - * @param _saveDialog true : Save dialog, test si fichier existant avant ecriture. - * @return LE fichier, ou null si op\xE9ration abort\xE9e. - */ - private File chooseNewFile(boolean _saveDialog) { - return getDestFile(chooseFile(_saveDialog)); - } - - private File chooseFile(boolean _saveDialog) { - return FudaaGuiLib.ouvrirFileChooser(FSigResource.FSIG.getString("Fichier modeleur"), FILTER, this.getFrame(), - _saveDialog, _saveDialog ? new CtuluFileChooserTestWritable(this) : null); - } - - protected void setFileIfNeeded() { - if (project_.getParamsFile() == null) { - project_.setParamFile(chooseNewFile(true)); - } - } - - public void projectStateChanged(FudaaProjetStateInterface _proj) { - updateActionsState(); - } - - /** - * Mise \xE0 jour de l'\xE9tat des boutons. - */ - void updateActionsState() { - boolean bprjOpen=project_!=null; - boolean bprjModPar=bprjOpen && project_.getProjectState().isParamsModified(); - boolean buiMod=bprjOpen && project_.getProjectState().isUIModified(); - - setEnabledForAction("ENREGISTRER", bprjModPar | buiMod); - setEnabledForAction("ENREGISTRERSOUS", bprjOpen); - setEnabledForAction("FERMER", bprjOpen); - setEnabledForAction("IMPORT_PROJECT", bprjOpen); - setEnabledForAction(CtuluExportDataInterface.EXPORT_CMD, bprjOpen); - } - - /** - * Creation de la vue 2D, et ajout. - */ - void createNew2dFrame() { - mdl2dFrame_ = new MdlFille2d(this); - addInternalFrame(mdl2dFrame_); - } - - /** - * Creation de la vue 1D. Ajout a la demande. - */ - void createNew1dFrame() { - if (mdl1dFrame_==null) { - mdl1dFrame_=new MdlFille1d(this); - } - } - - /** - * @return La vue 1D, ou null si inexistante. - */ - public MdlFille1d get1dFrame() { - return mdl1dFrame_; - } - - /** - * @return La vue 2D, ou null si inexistante. - */ - public MdlFille2d get2dFrame() { - return mdl2dFrame_; - } - - /** - * Installe la vue 1d sur le desktop, et la rend active. - */ - public void install1dFrame() { - boolean alreadyInstalled=false; - for (JInternalFrame f: getAllInternalFrames()) { - if (f.equals(mdl1dFrame_)) { - alreadyInstalled=true; - break; - } - } - if (!alreadyInstalled) - addInternalFrame(mdl1dFrame_); - else - activateInternalFrame(mdl1dFrame_); - } - - protected boolean buildExportDataToolIcon() { - return true; - } - - protected boolean buildFudaaReportTool() { - return true; - } - - protected boolean buildImageToolIcon() { - return true; - } - - /** - * Ferme le projet, ferme les fenetres associ\xE9s, sans demande d'enregistrement en cas - * de modif (ce controle a \xE9t\xE9 effectu\xE9 en amont). - */ - protected void closeProject() { - if (project_==null) return; - project_.close(); - try { - mdl2dFrame_.setClosed(true); - mdl1dFrame_.setClosed(true); - } catch (PropertyVetoException _evt) { - FuLog.error(_evt); - - } - removeInternalFrames(getAllInternalFrames()); - getMainMenuBar().getMenu("mnPROJECT").setVisible(false); - project_ = null; - } - - /** - * Cr\xE9e un nouveau projet, la fenetre 2D si necessaire. - * @param _add true : Recr\xE9e la fenetre. - */ - protected void createProject(final boolean _add) { - project_ = new MdlProjet(); - project_.setOpening(true); - if (_add) createNew2dFrame(); - else ((MdlVisuPanel)mdl2dFrame_.getVisuPanel()).initCalques(false); - createNew1dFrame(); - project_.install(this); - BuLib.invokeLater(new Runnable() { - - public void run() { - project_.setOpening(false); -// changeSaveActions(false); - updateActionsState(); - project_.setSaved(); - getMainMenuBar().getMenu("mnPROJECT").setVisible(true); - } - }); - } - - protected boolean useScrollInBuDesktop() { - return true; - } - - public void actionPerformed(ActionEvent _evt) { - final String action = _evt.getActionCommand(); - if (action == null) { - return; - } - if ("OUVRIR".equals(action)) { - ouvrir(null); - } else if ("ENREGISTRER".equals(action)) { - save(); - } else if ("ENREGISTRERSOUS".equals(action)) { - saveAs(); - } else if ("FERMER".equals(action)) { - close(); - } else if ("CREER".equals(action)) { - create(); - } else if ("IMPORT_PROJECT".equals(action)) { - importProject(); - } else if ("AIDE_INDEX".equals(action)) { - displayHelp(getAideIndexUrl()); - } else if (action.startsWith("TOGGLE")) { - final BuColumn c = getMainPanel().getRightColumn(); - final JComponent comp = c.getToggleComponent(action); - if (comp != null) { - comp.setVisible(!comp.isVisible()); - c.revalidate(); - } - } else if (action.startsWith("REOUVRIR")) { - FuLog.trace(action.substring(9,action.length()-1)); - ouvrir(new File(action.substring(9,action.length()-1))); - } else - super.actionPerformed(_evt); - } - - /** - * Met a jour les fichiers recents chaque fois que necessaire. - */ - private void updateRecentFiles(File _fichier) { - getMainMenuBar().addRecentFile(_fichier.getPath(),null); - MdlPreferences.MDL.writeIniFile(); - } - - /** - * Surcharge de la m\xE9thode pour pouvoir sauvegarder les pr\xE9f\xE9rences. - */ - public void exit() { - confirmExit(); - } - - /** - * Confirmation de la sortie avec ou sans sauvegarde. - */ - public boolean confirmExit() { - if (!FudaaStartupExitPreferencesPanel.isExitConfirmed() || - question(BuResource.BU.getString("Quitter"), BuResource.BU - .getString("Voulez-vous vraiment quitter ce logiciel ?"))) { - return saveAndCloseProjet(new Runnable() { - // Lanc\xE9 apr\xE8s la sauvegarde, si op\xE9ration de sauvegarde concluante ou si pas de sauvegarde demand\xE9e. - public void run() { - savePreferencesAndTerminate(); - } - }); - } - return true; - } - - /** - * Action "Creer" un nouveau projet. - */ - public void create() { - saveAndCloseProjet(new Runnable() { - public void run() { - createProject(true); - } - }); - } - - /** - * Action "Fermer" le projet en cours. - */ - public void close() { - saveAndCloseProjet(null); - updateActionsState(); - } - - protected String getAideIndexUrl() { - return getHelpDir() + "modeleur/index.html"; - } - - public BuPreferences getApplicationPreferences() { - return null; - } - - public BuInformationsSoftware getInformationsSoftware() { - return informationsSoftware(); - } - - /** - * Action "Ouvrir" un nouveau projet. Peut demander la sauvegarde du projet pr\xE9c\xE9demment ouvert si - * existant. - * @param _f Le fichier projet \xE0 ouvrir. null, si le fichier doit etre choisi par l'utilisateur. - */ - public void ouvrir(final File _f) { - if (isProjectModified()) { - saveAndCloseProjet(new Runnable() { - - public void run() { - ouvrir(_f); - } - }); - return; - } - - closeProject(); - - final File f = CtuluLibFile.exists(_f) ? _f : chooseFile(false); - if (f==null) return; // Abandon utilisateur. - - createProject(false); - setGlassPaneStop(); - new CtuluRunnable(BuResource.BU.getString("Ouvrir"), MdlImplementation.this) { - - public boolean run(ProgressionInterface _proj) { - project_.setOpening(true); - Runnable r = null; - try { - try { - FudaaSaveZipLoader loader=new FudaaSaveZipLoader(f); - // Recup des infos pour utilisateur. - BuInformationsSoftware is=FudaaSaveProject.getSoftwareInfos(loader); - FuLog.warning("File version : "+(is.version==null ? "Undefined":is.version)); - - r= FudaaSaveLib.restoreFille(MdlImplementation.this, mdl2dFrame_, _proj,loader); - } catch (final IOException _evt) { - FuLog.error(_evt); - - } - - project_.setParamFile(f); - - } finally { - - final Runnable swingRun = r; - BuLib.invokeLater(new Runnable() { - - public void run() { - try { - addInternalFrame(mdl2dFrame_); - - if (swingRun != null) swingRun.run(); - - // Met a jour la fenetre 1d - FudaaSaveZipLoader loader=null; - try { - loader=new FudaaSaveZipLoader(f); - mdl1dFrame_.restoreFrom(loader, null); - } - catch (IOException _exc) {} - finally { - if (loader!=null) { - try { loader.close(); } catch (IOException _exc) {} - } - } - - // le projet a ete install\xE9: on enl\xE8ve les flag de modification - project_.setOpening(false); - project_.setSaved(); - if (swingRun == null) { - MdlImplementation.this.warn(BuResource.BU.getString("Ouvrir"), FSigResource.FSIG - .getString("Le projet n'a pas \xE9t\xE9 ouvert!")); - } - else { - updateRecentFiles(project_.getParamsFile()); - } - } finally { - unsetGlassPaneStop(); - - } - } - - }); - - } - return r != null; - } - }.run(); - } - - /** - * Action "Enregistrer" le projet. - */ - public void save() { - if (project_.getParamsFile() != null) { - CtuluRunnable act = new CtuluRunnable(FudaaSaveLib.getActionSaveTitle(), this) { - - public boolean run(ProgressionInterface _proj) { - if (FSigProjectPersistence.saveProject(MdlImplementation.this, project_, project_.getParamsFile(), _proj)) { - updateRecentFiles(project_.getParamsFile()); - return true; - } - return false; - } - }; - act.setAfterRunnable(getSaveSwingRunnable(project_.getParamsFile()), true); - act.run(); - } else - saveAs(); - } - - /** - * Action "Enregistrer sous" le projet. - */ - public void saveAs() { - final File f = chooseNewFile(true); - if (f == null) return; - - CtuluRunnable act = new CtuluRunnable(FudaaSaveLib.getActionSaveTitle(), this) { - - public boolean run(ProgressionInterface _proj) { - if (FSigProjectPersistence.saveProject(MdlImplementation.this, project_, f, _proj)) { - updateRecentFiles(f); - return true; - } - return false; - } - }; - act.setAfterRunnable(getSaveSwingRunnable(f), true); - act.run(); - } - - protected boolean isProjectModified() { - return project_ != null - && (project_.getProjectState().isParamsModified() || project_.getProjectState().isUIModified()); - } - - public void importProject() { - MdlProjectImportPanel pn=new MdlProjectImportPanel(); - if (CtuluDialogPanel.isOkResponse(pn.afficheModale(getFrame(), "Import d'un projet"))) { - File f=pn.getFile(); - try { - FudaaSaveZipLoader loader = new FudaaSaveZipLoader(f); - String[] ignoredLayers=pn.getIgnoredLayers(); - for (String s : ignoredLayers) { - loader.setOption(CtuluArkLoader.OPTION_LAYER_IGNORE+s,CtuluLibString.toString(true)); - } - - final CtuluTaskDelegate createTask = createTask("Import d'un projet"); -// FIXME BM: Suppression de la tache dans un thread diff\xE9rent, car l'appli se bloque -// Probable pb de deadlock. -// createTask.start(new Runnable() { -// public void run() { - FudaaSaveLib.restoreAndLaunch(MdlImplementation.this, mdl2dFrame_, createTask.getStateReceiver(), loader); -// } -// }); - - // Liberation du fichier. - loader.close(); - } catch (final IOException _evt) { - FuLog.error(_evt); - - } - } - } - - /** - * Dans le thread swing.... - * - * @param _relaunch l'exe a lancer apr\xE8s: si l'utilisateur a accept\xE9 la fermeture du projet - */ - public boolean saveAndCloseProjet(final Runnable _relaunch) { - final Runnable r = new Runnable() { - - public void run() { - closeProject(); - if (_relaunch != null) _relaunch.run(); - } - }; - boolean save = false; - if (isProjectModified()) { - final int i = CtuluLibDialog.confirmExitIfProjectisModified(getFrame()); - // l'utilisateur veut annuler l'op\xE9ration - if (i == JOptionPane.CANCEL_OPTION) { - FuLog.debug("FSI: close operation cancelled by user"); - return false; - } - save = (i == JOptionPane.OK_OPTION); - } - - FuLog.debug("FSI: close operation accepted and save option= " + save); - // pas de sauvegarde: on lance l'op\xE9ration suivante: - if (!save) { - r.run(); - } else { - // on initilialise le fichier de dest si n\xE9cessaire - setFileIfNeeded(); - if (project_.getParamsFile()==null) return false; - CtuluRunnable act = new CtuluRunnable(FudaaSaveLib.getActionSaveTitle(), this) { - - public boolean run(ProgressionInterface _prog) { - // le fichier peut etre null si l'utilisateur a refuse de pr\xE9ciser un fichier - // dans ce cas, on ne sauvegarde pas. - if (project_.getParamsFile() != null) { - setGlassPaneStop(); - FSigProjectPersistence.saveProject(MdlImplementation.this, project_, - project_.getParamsFile(), _prog); - updateRecentFiles(project_.getParamsFile()); - - unsetGlassPaneStop(); - return true; - } - else return false; - } - }; - // le r sera lance apres et dans le thread swing - act.setAfterRunnable(r, true); - act.run(); - return false; - } - return true; - } - - protected Runnable getSaveSwingRunnable(final File _paramFile) { - return new Runnable() { - - public void run() { - if (_paramFile != null) project_.setParamFile(_paramFile); - project_.setSaved(); - - } - }; - } - - /** - * Construit le menu projet. - * @return Le menu projet. - */ - protected BuMenu buildProjectMenu() { - BuMenu mn=new BuMenu(FudaaResource.FUDAA.getString("Projet"),"mnPROJECT"); - mn.add(new MdlShow2DFrameAction(this)); - mn.add(new MdlShow1DFrameAction(this)); - - mn.setVisible(false); - return mn; - } - - /** - * Methode surcharg\xE9e pour les panneau de pr\xE9f\xE9rence. - */ - protected void buildPreferences(final List<BuAbstractPreferencesPanel> _frAddTab) { - _frAddTab.add(new BuUserPreferencesPanel(this)); - _frAddTab.add(new BuLanguagePreferencesPanel(this)); - _frAddTab.add(new BuDesktopPreferencesPanel(this)); - _frAddTab.add(new FudaaStartupExitPreferencesPanel(true)); - _frAddTab.add(new FudaaLookPreferencesPanel(this)); - _frAddTab.add(new BuBrowserPreferencesPanel(this)); - _frAddTab.add(new EbliMiseEnPagePreferencesPanel()); - } - - /** - * Cr\xE9ation du panneau des taches, dans la colonne de droite. - */ - protected void buildTaskView() { - final BuMainPanel mp = getMainPanel(); - final BuColumn lc = mp.getLeftColumn(); - lc.setFocusable(false); - final BuColumn rc = mp.getRightColumn(); - rc.setFocusable(false); - lc.setBorder(null); - // rc.setBorder(new EmptyBorder(0,2,0,2)); - BuTaskView taches = new BuTaskView(); - taches.setToolTipText(TrResource.getS("Les t\xE2ches en cours")); - final BuScrollPane sp = new BuScrollPane(taches); - sp.setPreferredSize(new Dimension(150, 80)); - sp.setToolTipText(TrResource.getS("Les t\xE2ches en cours")); - rc.addToggledComponent(BuResource.BU.getString("T\xE2ches"), "TOGGLE_TACHE", BuResource.BU.getToolIcon("tache"), sp, - true, this).setToolTipText(TrResource.getS("Cacher/Afficher les t\xE2ches")); - mp.setTaskView(taches); - } - - /** - * Sauvegarde des pr\xE9f\xE9rences de l'appli \xE0 la sortie. - * - * Remarque importante : Certaines infos sauv\xE9es par cette m\xE9thode sont relues - * par d'autres applications Fudaa, qui risquent alors de s'afficher de facon - * inattendue. - */ - protected void savePreferencesAndTerminate() { - final Point p = getFrame().getLocation(); - final Dimension d = getFrame().getSize(); - BuPreferences.BU.putIntegerProperty("window.x", p.x); - BuPreferences.BU.putIntegerProperty("window.y", p.y); - BuPreferences.BU.putIntegerProperty("window.w", d.width); - BuPreferences.BU.putIntegerProperty("window.h", d.height); - BuPreferences.BU.writeIniFile(); - - BuRegistry.unregister(this.getFrame()); - } - - /** - * Mise en place de l'application ava,nt affichage. - */ - public void init() { - super.init(); - // Pour forcer l'activation du command listener. - getUndoCmdListener(); - - removeUnusedActions(); - final BuMenuBar mb = getMainMenuBar(); - // on enleve le menu des look and feel : moche car tout n'est pas mis a jour -/* Issu de Fudaa-Prepro - final BuMenu mAide = (BuMenu) b.getMenu("MENU_AIDE"); - - mAide.add(TrLib.buildAideContextItem(this), 0); - TrLib.addJavawsForJnlp(mAide); - TrLib.addJava3DJMFTest(mAide);*/ - - setEnabledForAction("QUITTER", true); - setEnabledForAction("PREFERENCE", true); - setEnabledForAction("CREER", true); - setEnabledForAction("OUVRIR", true); - setEnabledForAction("IMPORTER", true); - setEnabledForAction("EXPORTER", true); - - BuMenuRecentFiles mr= (BuMenuRecentFiles)mb.getMenu("REOUVRIR"); - if (mr != null) { - mr.setPreferences(MdlPreferences.MDL); - mr.setResource(MdlResource.MDL); - mr.setEnabled(true); - } - -/* setEnabledForAction("MAJ", true); - setEnabledForAction("SEND_COMMENT", true); - setEnabledForAction("LAUNCH_JAVAWS", true); - final BuMenu mFichier = (BuMenu) b.getMenu("MENU_FICHIER"); - mFichier.addMenuItem(TrResource.getS("Fermer toutes les applications"), "CLOSE_ALL", BuResource.BU - .getIcon("fermer"), true, 0); - final BuToolBar tb = getMainToolBar(); - if (!isSupervisor()) { - - tb.addToolButton(TrResource.getSupervisorName(), TrResource.getS("ouvrir le superviseur"), "SUPERVISEUR", - TrResource.getSupervisorIcon(), true).setVisible(true); - - }*/ - // les menus exporter et importer sont construit dynamiquement -// b.getMenu(getExporterCmd()).addItemListener(this); - BuMenu mmImport = (BuMenu) mb.getMenu("IMPORTER"); - BuMenu mnExport = (BuMenu) mb.getMenu("EXPORTER"); - -// menu.addMenuItem(FSigImageImportAction.getCommonTitle(), "IMPORT_IMAGE", FSigImageImportAction.getCommonImage(), -// this).setEnabled(false); - mmImport.addMenuItem(FudaaLib.getS("Importer un projet"), "IMPORT_PROJECT", BuResource.BU.getMenuIcon("importer"), this) - .setEnabled(false); -// menu.addItemListener(this); - setEnabledForAction("IMPORT_PROJECT", true); - mmImport.setEnabled(true); - - BuMenuItem itExportData = new BuMenuItem(); - super.initExportDataButton(itExportData); - mnExport.add(itExportData); - - BuMenu mnProject=buildProjectMenu(); - mb.addMenu(mnProject); - -/* setEnabledForAction("RANGERICONES", true); - if (!isSupervisor()) { - final JComponent cp = getMainPanel().getMiddleComponent(); - if (cp instanceof JScrollPane) { - ScrollPaneSelector.installScrollPaneSelector((JScrollPane) cp); - } - }*/ - buildTaskView(); - } - - /** - * Suppression des commandes par d\xE9faut dans Fudaa. - */ - protected void removeUnusedActions() { -/* Issu de Fudaa-Prepro - final BuMenu r = (BuMenu) getMainMenuBar().getMenu("MENU_EDITION"); - if (r != null) { - r.removeAll(); - r.addMenuItem(BuResource.BU.getString("D\xE9faire"), "DEFAIRE", false, KeyEvent.VK_Z); - r.addMenuItem(BuResource.BU.getString("Refaire"), "REFAIRE", false).setAccelerator( - KeyStroke.getKeyStroke(KeyEvent.VK_Z, InputEvent.CTRL_MASK | InputEvent.SHIFT_MASK)); - // normalement Ctrl-Y - // r.addSeparator(); - // - r.addMenuItem(BuResource.BU.getString("Copier"), "COPIER", false, KeyEvent.VK_C); - r.addMenuItem(BuResource.BU.getString("Couper"), "COUPER", false, KeyEvent.VK_X); - r.addMenuItem(BuResource.BU.getString("Coller"), "COLLER", false, KeyEvent.VK_V); - // r.addMenuItem(BuResource.BU.getString("Dupliquer" ),"DUPLIQUER" ,false) - // .setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_V,KeyEvent.CTRL_MASK|KeyEvent.SHIFT_MASK)); - r.addSeparator(); - FSigLib.addSelectionAction(r, null); - // r.addMenuItem(BuResource.BU.getString("Remplacer..." ),"REMPLACER" - // ,false,KeyEvent.VK_R); - r.addSeparator(); - r.addMenuItem(BuResource.BU.getString("Pr\xE9f\xE9rences"), "PREFERENCE", false, KeyEvent.VK_F2); - addConsoleMenu(r); - final BuToolBar tb = getMainToolBar(); - BuActionRemover.removeAction(tb, "COUPER"); - BuActionRemover.removeAction(tb, "COLLER"); - BuActionRemover.removeAction(tb, "COPIER"); - BuActionRemover.removeAction(tb, "DUPLIQUER"); - BuActionRemover.removeAction(tb, "RANGERICONES"); - // BuActionRemover.removeAction(tb, "TOUTSELECTIONNER"); - BuActionRemover.removeAction(tb, "REMPLACER"); - - }*/ - /* - * removeAction("COUPER"); removeAction("COLLER"); removeAction("COPIER"); removeAction("DUPLIQUER"); - * removeAction("TOUTSELECTIONNER"); removeAction("REMPLACER"); - */ - removeAction("ASSISTANT"); -// removeAction("ASTUCE"); - removeAction("POINTEURAIDE"); - removeAction("INDEX_THEMA"); - removeAction("INDEX_ALPHA"); - removeAction("PROPRIETE"); - removeAction("PLEINECRAN"); - removeAction("VISIBLE_LEFTCOLUMN"); - } - - public void start() { - super.start(); - super.addFrameListLeft(); - createProject(true); - } - -} Copied: tags/FudaaModeleur_0_11/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlImplementation.java (from rev 4419, branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlImplementation.java) =================================================================== --- tags/FudaaModeleur_0_11/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlImplementation.java (rev 0) +++ tags/FudaaModeleur_0_11/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlImplementation.java 2009-01-28 14:47:05 UTC (rev 4420) @@ -0,0 +1,809 @@ +/* + * @creation 7 juin 07 + * @license GNU General Public License 2 + * @copyright (c)1998-2001 CETMEF 2 bd Gambetta F-60231 Compiegne + * @mail de...@fu... + */ +package org.fudaa.fudaa.modeleur; + +import java.awt.Dimension; +import java.awt.Point; +import java.awt.event.ActionEvent; +import java.beans.PropertyVetoException; +import java.io.File; +import java.io.IOException; +import java.util.List; + +import javax.swing.JComponent; +import javax.swing.JInternalFrame; +import javax.swing.JOptionPane; +import javax.swing.filechooser.FileFilter; + +import org.fudaa.ctulu.CtuluArkLoader; +import org.fudaa.ctulu.CtuluExportDataInterface; +import org.fudaa.ctulu.CtuluLibFile; +import org.fudaa.ctulu.CtuluLibString; +import org.fudaa.ctulu.CtuluRunnable; +import org.fudaa.ctulu.CtuluTaskDelegate; +import org.fudaa.ctulu.ProgressionInterface; +import org.fudaa.ctulu.gui.CtuluDialogPanel; +import org.fudaa.ctulu.gui.CtuluFileChooserTestWritable; +import org.fudaa.ctulu.gui.CtuluLibDialog; +import org.fudaa.ebli.impression.EbliMiseEnPagePreferencesPanel; +import org.fudaa.ebli.ressource.EbliResource; +import org.fudaa.fudaa.commun.FudaaLib; +import org.fudaa.fudaa.commun.FudaaProjectStateListener; +import org.fudaa.fudaa.commun.FudaaProjetStateInterface; +import org.fudaa.fudaa.commun.impl.FudaaCommonImplementation; +import org.fudaa.fudaa.commun.impl.FudaaGuiLib; +import org.fudaa.fudaa.commun.impl.FudaaLookPreferencesPanel; +import org.fudaa.fudaa.commun.impl.FudaaStartupExitPreferencesPanel; +import org.fudaa.fudaa.commun.save.FudaaSaveLib; +import org.fudaa.fudaa.commun.save.FudaaSaveProject; +import org.fudaa.fudaa.commun.save.FudaaSaveZipLoader; +import org.fudaa.fudaa.modeleur.action.MdlShow1DFrameAction; +import org.fudaa.fudaa.modeleur.action.MdlShow2DFrameAction; +import org.fudaa.fudaa.modeleur.modeleur1d.MdlFille1d; +import org.fudaa.fudaa.ressource.FudaaResource; +import org.fudaa.fudaa.sig.FSigProjectPersistence; +import org.fudaa.fudaa.sig.FSigResource; +import org.fudaa.fudaa.tr.common.TrResource; + +import com.memoire.bu.BuAbstractPreferencesPanel; +import com.memoire.bu.BuBrowserPreferencesPanel; +import com.memoire.bu.BuColumn; +import com.memoire.bu.BuDesktopPreferencesPanel; +import com.memoire.bu.BuInformationsSoftware; +import com.memoire.bu.BuLanguagePreferencesPanel; +import com.memoire.bu.BuLib; +import com.memoire.bu.BuMainPanel; +im... [truncated message content] |
From: <bma...@us...> - 2009-01-28 13:54:59
|
Revision: 4419 http://fudaa.svn.sourceforge.net/fudaa/?rev=4419&view=rev Author: bmarchan Date: 2009-01-28 13:54:54 +0000 (Wed, 28 Jan 2009) Log Message: ----------- Changt de version 0.10 => 0.11 Modified Paths: -------------- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlImplementation.java Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlImplementation.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlImplementation.java 2009-01-28 13:48:55 UTC (rev 4418) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlImplementation.java 2009-01-28 13:54:54 UTC (rev 4419) @@ -81,8 +81,8 @@ protected static BuInformationsSoftware isMdl_ = new BuInformationsSoftware(); static { isMdl_.name = "Modeleur"; - isMdl_.version = "0.10"; - isMdl_.date = "2009-01-12"; + isMdl_.version = "0.11"; + isMdl_.date = "2009-01-28"; isMdl_.rights = "Tous droits r\xE9serv\xE9s. CETMEF (c)1999-2009"; isMdl_.license = "GPL2"; isMdl_.languages = "fr,en"; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <emm...@us...> - 2009-01-28 13:48:57
|
Revision: 4418 http://fudaa.svn.sourceforge.net/fudaa/?rev=4418&view=rev Author: emmanuel_martin Date: 2009-01-28 13:48:55 +0000 (Wed, 28 Jan 2009) Log Message: ----------- correction d'un bug dans l'export GML Modified Paths: -------------- branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/gml/GISGMLZoneExporter.java Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/gml/GISGMLZoneExporter.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/gml/GISGMLZoneExporter.java 2009-01-28 11:58:49 UTC (rev 4417) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/gml/GISGMLZoneExporter.java 2009-01-28 13:48:55 UTC (rev 4418) @@ -128,12 +128,18 @@ throws IOException, SchemaException, IllegalAttributeException { out_ = _dest; store_ = null; + _zone.prepareExport(); process(_prog, _zone); } private void process(final ProgressionInterface _prog, final GISDataModel _zone) throws IOException, SchemaException, IllegalAttributeException { + /* + * Pour que les z atomiques soient exporter correctement, il faut que + * prepareExport() est \xE9t\xE9 appel\xE9 sur la GISZoneCollection dans le + * GISDataModel. + */ stop_ = false; final TObjectIntHashMap attIdx = new TObjectIntHashMap(_zone.getNbAttributes()); final AttributeType[] atts = createAttributes(_zone, attIdx); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <emm...@us...> - 2009-01-28 12:55:31
|
Revision: 4416 http://fudaa.svn.sourceforge.net/fudaa/?rev=4416&view=rev Author: emmanuel_martin Date: 2009-01-28 11:46:22 +0000 (Wed, 28 Jan 2009) Log Message: ----------- Tache #163 : "Prise en compte des lignes de contrainte au moment du passage au 1D." Modified Paths: -------------- branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISAttributeConstants.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlVisuPanel.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/Bief.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/VueBief.java Added Paths: ----------- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/layer/MdlLayer1dLimiteStockage.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/layer/MdlModel1dLimiteStockage.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/persistence/MdlLayer1dLimiteStockageLinePersistence.java Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISAttributeConstants.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISAttributeConstants.java 2009-01-27 20:57:12 UTC (rev 4415) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISAttributeConstants.java 2009-01-28 11:46:22 UTC (rev 4416) @@ -58,6 +58,8 @@ public final static String ATT_NATURE_AH="AH"; /** Nature rive (gauche ou droite) */ public final static String ATT_NATURE_RV="RV"; + /** Nature limite de stockage */ + public final static String ATT_NATURE_LS="LS"; /** * Un attribut nom, global. Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlVisuPanel.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlVisuPanel.java 2009-01-27 20:57:12 UTC (rev 4415) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlVisuPanel.java 2009-01-28 11:46:22 UTC (rev 4416) @@ -24,6 +24,7 @@ import org.fudaa.fudaa.modeleur.action.CalqueNewCalqueAction; import org.fudaa.fudaa.modeleur.layer.MdlLayer1dAxe; import org.fudaa.fudaa.modeleur.layer.MdlLayer1dBank; +import org.fudaa.fudaa.modeleur.layer.MdlLayer1dLimiteStockage; import org.fudaa.fudaa.modeleur.layer.MdlLayer1dTrace; import org.fudaa.fudaa.modeleur.layer.MdlLayer2dCloud; import org.fudaa.fudaa.modeleur.layer.MdlLayer2dConstraintLine; @@ -294,6 +295,10 @@ cqDirect.setName(BGroupeCalque.findUniqueChildName(cqBief, cqDirect.getExtName())); cqBief.add(cqDirect); + MdlLayer1dLimiteStockage cqLimite=new MdlLayer1dLimiteStockage(getEditor()); + cqLimite.setName(BGroupeCalque.findUniqueChildName(cqBief, cqLimite.getExtName())); + cqBief.add(cqLimite); + MdlLayer2dConstraintLine cqConst=new MdlLayer2dConstraintLine(getEditor()); cqConst.setName(BGroupeCalque.findUniqueChildName(cqBief, cqConst.getExtName())); cqBief.add(cqConst); Added: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/layer/MdlLayer1dLimiteStockage.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/layer/MdlLayer1dLimiteStockage.java (rev 0) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/layer/MdlLayer1dLimiteStockage.java 2009-01-28 11:46:22 UTC (rev 4416) @@ -0,0 +1,65 @@ +/* + * @creation 28 janv. 2009 + * @modification $Date:$ + * @license GNU General Public License 2 + * @copyright (c)1998-2009 CETMEF 2 bd Gambetta F-60231 Compiegne + * @mail fud...@li... + */ +package org.fudaa.fudaa.modeleur.layer; + +import java.awt.Color; + +import org.fudaa.ebli.calque.BCalquePersistenceInterface; +import org.fudaa.ebli.calque.dessin.DeForme; +import org.fudaa.ebli.calque.edition.ZModeleLigneBriseeEditable; +import org.fudaa.ebli.trace.TraceLigne; +import org.fudaa.ebli.trace.TraceLigneModel; +import org.fudaa.fudaa.modeleur.MdlResource; +import org.fudaa.fudaa.modeleur.persistence.MdlLayer1dLimiteStockageLinePersistence; +import org.fudaa.fudaa.sig.layer.FSigEditor; + +/** + * Un calque pour le stockage et la manipulation des lignes de constraintes. + * + * @author Emmanuel MARTIN + * @version $Id:$ + * */ +public class MdlLayer1dLimiteStockage extends MdlLayer2dLine { + + /** + * Constructeur. Utilise un mod\xE8le de donn\xE9es et un editeur. + * + * @param _model + * Modele + * @param _editor + * Editeur. + */ + private MdlLayer1dLimiteStockage(ZModeleLigneBriseeEditable _model, final FSigEditor _editor) { + super(_model, _editor); + setLineModel(0, new TraceLigneModel(TraceLigne.LISSE, 1.5f, Color.green)); + setLineModelOuvert(getLineModel(0)); + setName(getExtName()); + setTitle(MdlResource.MDL.getString("Limites de stockages")); + } + + public MdlLayer1dLimiteStockage(FSigEditor _editor) { + this(new MdlModel1dLimiteStockage(_editor, _editor.getMng()), _editor); + } + + public BCalquePersistenceInterface getPersistenceMng() { + return new MdlLayer1dLimiteStockageLinePersistence(); + } + + /** + * Retourne le nom par defaut du calque. + * + * @return Le nom. + */ + public String getExtName() { + return "limiteStockage"; + } + + public boolean canAddForme(int _typeForme) { + return _typeForme==DeForme.LIGNE_BRISEE; + } +} Property changes on: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/layer/MdlLayer1dLimiteStockage.java ___________________________________________________________________ Added: svn:keywords + Id Added: svn:eol-style + native Added: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/layer/MdlModel1dLimiteStockage.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/layer/MdlModel1dLimiteStockage.java (rev 0) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/layer/MdlModel1dLimiteStockage.java 2009-01-28 11:46:22 UTC (rev 4416) @@ -0,0 +1,41 @@ +/* + * @creation 28 janv. 2009 + * @modification $Date:$ + * @license GNU General Public License 2 + * @copyright (c)1998-2009 CETMEF 2 bd Gambetta F-60231 Compiegne + * @mail fud...@li... + */ + +package org.fudaa.fudaa.modeleur.layer; + +import org.fudaa.ctulu.CtuluCommandContainer; +import org.fudaa.ctulu.gis.GISAttribute; +import org.fudaa.ctulu.gis.GISAttributeConstants; +import org.fudaa.ebli.calque.ZModelGeometryListener; + +/** + * Un mod\xE8le de calque pour le calque 2D des lignes de constraintes. Les lignes + * sont des polylignes XYZ, non ferm\xE9es. + * + * @author Emmanuel MARTIN + * @version $Id:$ + */ +public class MdlModel1dLimiteStockage extends MdlModel2dLine { + + /** + * Construction d'un modele avec pile de commandes. + * + * @param _cmd + * La pile de commandes pour le undo/redo. + */ + public MdlModel1dLimiteStockage(final ZModelGeometryListener _listener, final CtuluCommandContainer _cmd) { + super(_listener); + GISAttribute[] attrs=new GISAttribute[]{GISAttributeConstants.BATHY, GISAttributeConstants.ETAT_GEOM, + GISAttributeConstants.TITRE, GISAttributeConstants.NATURE, GISAttributeConstants.VISIBILITE}; + // Pas de container de commande pour cette op\xE9ration, sinon conserv\xE9 en + // undo/redo. + getGeomData().setAttributes(attrs, null); + getGeomData().setAttributeIsZ(GISAttributeConstants.BATHY); + getGeomData().setFixedAttributeValue(GISAttributeConstants.NATURE, GISAttributeConstants.ATT_NATURE_LS); + } +} Property changes on: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/layer/MdlModel1dLimiteStockage.java ___________________________________________________________________ Added: svn:keywords + Id Added: svn:eol-style + native Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/Bief.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/Bief.java 2009-01-27 20:57:12 UTC (rev 4415) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/Bief.java 2009-01-28 11:46:22 UTC (rev 4416) @@ -17,10 +17,13 @@ import org.fudaa.ctulu.gis.GISAttributeConstants; import org.fudaa.ctulu.gis.GISAttributeInterface; import org.fudaa.ctulu.gis.GISAttributeModel; +import org.fudaa.ctulu.gis.GISAttributeModelDoubleArray; +import org.fudaa.ctulu.gis.GISAttributeModelDoubleInterface; import org.fudaa.ctulu.gis.GISAttributeModelIntegerList; import org.fudaa.ctulu.gis.GISCoordinateSequenceContainerInterface; import org.fudaa.ctulu.gis.GISCoordinateSequenceFactory; import org.fudaa.ctulu.gis.GISPolyligne; +import org.fudaa.ctulu.gis.GISReprojectInterpolateur1DDouble; import org.fudaa.ctulu.gis.GISZoneCollection; import org.fudaa.ctulu.gis.GISZoneCollectionGeometry; import org.fudaa.ctulu.gis.GISZoneCollectionLigneBrisee; @@ -29,6 +32,7 @@ import org.fudaa.fudaa.commun.FudaaLib; import org.fudaa.fudaa.modeleur.layer.MdlModel1dAxe; import org.fudaa.fudaa.modeleur.layer.MdlModel1dBank; +import org.fudaa.fudaa.modeleur.layer.MdlModel1dLimiteStockage; import org.fudaa.fudaa.modeleur.layer.MdlModel2dConstraintLine; import org.fudaa.fudaa.modeleur.layer.MdlModel2dDirectionLine; import org.fudaa.fudaa.modeleur.layer.MdlModel2dProfile; @@ -48,6 +52,7 @@ public ZModeleLigneBrisee rives_; public ZModeleLigneBrisee limitesStockages_; public ZModeleLigneBrisee lignesDirectrices_; + public ZModeleLigneBrisee lignesContraints_; /** Le synchroniser de gis. */ private GisZoneSynchroniser gisSynchroniser_=new GisZoneSynchroniser(); @@ -61,7 +66,8 @@ profils_=new MdlModel2dProfile(null, null); normalizeProfilAttributes(profils_.getGeomData()); rives_=new MdlModel1dBank(null, null); - limitesStockages_=new MdlModel2dConstraintLine(null, null); + limitesStockages_=new MdlModel1dLimiteStockage(null, null); + lignesContraints_=new MdlModel2dConstraintLine(null, null); lignesDirectrices_=new MdlModel2dDirectionLine(null, null); } @@ -98,48 +104,53 @@ private void testAndValuateModels(ZModeleLigneBrisee[] _models) { if (_models==null) - throw new IllegalArgumentException("_models ne peut pas \xEAtre null."); + throw new IllegalArgumentException(FudaaLib.getS("Erreur programmation : _models ne peut pas \xEAtre null.")); for (int i=0; i<_models.length; i++) { if (_models[i]==null) - throw new IllegalArgumentException("_models ne doit pas contenir de valeurs null"); + throw new IllegalArgumentException(FudaaLib.getS("Erreur programmation : _models ne doit pas contenir de valeurs null")); if (_models[i].getGeomData()==null) - throw new IllegalArgumentException("Certain model n'ont pas de GSIZone."); + throw new IllegalArgumentException(FudaaLib.getS("Erreur programmation : Certain model n'ont pas de GSIZone.")); if (!(_models[i].getGeomData() instanceof GISZoneCollectionLigneBrisee)) - throw new IllegalArgumentException("Toutes les GISZone doivent \xEAtre des GISZoneCollectionLigneBrisee."); + throw new IllegalArgumentException(FudaaLib.getS("Erreur programmation : Toutes les GISZone doivent \xEAtre des GISZoneCollectionLigneBrisee.")); String nature=(String)_models[i].getGeomData().getFixedAttributValue(GISAttributeConstants.NATURE); if (nature==null) - throw new IllegalArgumentException("Une des GISZone ne contient pas l'attribut NATURE."); + throw new IllegalArgumentException(FudaaLib.getS("Un des modeles ne contient pas l'attribut NATURE.")); if (nature==GISAttributeConstants.ATT_NATURE_AH) if (axeHydraulique_!=null) - throw new IllegalArgumentException("Plusieurs models d'axe hydrauliques sont donn\xE9es."); + throw new IllegalArgumentException(FudaaLib.getS("Plusieurs models d'axe hydrauliques sont donn\xE9es.")); else if (_models[i].getGeomData().getNbGeometries()>1) - throw new IllegalArgumentException("Il ne peut pas y avoir plusieurs Axes hydrauliques dans le bief."); + throw new IllegalArgumentException(FudaaLib.getS("Il ne peut pas y avoir plusieurs Axes hydrauliques dans le bief.")); else axeHydraulique_=_models[i]; else if (nature==GISAttributeConstants.ATT_NATURE_LD) if (lignesDirectrices_!=null) - throw new IllegalArgumentException("Plusieurs models de lignes directrices sont donn\xE9es."); + throw new IllegalArgumentException(FudaaLib.getS("Plusieurs models de lignes directrices sont donn\xE9es.")); else lignesDirectrices_=_models[i]; - else if (nature==GISAttributeConstants.ATT_NATURE_LC) + else if (nature==GISAttributeConstants.ATT_NATURE_LS) if (limitesStockages_!=null) - throw new IllegalArgumentException("Plusieurs models de limites de stockage sont donn\xE9es."); + throw new IllegalArgumentException(FudaaLib.getS("Plusieurs models de limites de stockage sont donn\xE9es.")); else if (_models[i].getGeomData().getNbGeometries()>2) - throw new IllegalArgumentException("Il ne peut pas y avoir plus de 2 limites de stockage."); + throw new IllegalArgumentException(FudaaLib.getS("Il ne peut pas y avoir plus de 2 limites de stockage.")); else limitesStockages_=_models[i]; else if (nature==GISAttributeConstants.ATT_NATURE_PF) if (profils_!=null) - throw new IllegalArgumentException("Plusieurs models de profils sont donn\xE9es."); + throw new IllegalArgumentException(FudaaLib.getS("Plusieurs models de profils sont donn\xE9es.")); else profils_=_models[i]; else if (nature==GISAttributeConstants.ATT_NATURE_RV) if (rives_!=null) - throw new IllegalArgumentException("Plusieurs models de rives sont donn\xE9es."); + throw new IllegalArgumentException(FudaaLib.getS("Plusieurs models de rives sont donn\xE9es.")); else if (_models[i].getGeomData().getNbGeometries()>2) - throw new IllegalArgumentException("Il ne peut pas y avoir plus de 2 rives."); + throw new IllegalArgumentException(FudaaLib.getS("Il ne peut pas y avoir plus de 2 rives.")); else rives_=_models[i]; + else if (nature==GISAttributeConstants.ATT_NATURE_LC) + if (lignesContraints_!=null) + throw new IllegalArgumentException(FudaaLib.getS("Plusieurs models de lignes de contraintes sont donn\xE9es.")); + else + lignesContraints_=_models[i]; } // Remplissage des models vides par des ZModeles vides if (axeHydraulique_==null) @@ -149,9 +160,11 @@ if (rives_==null) rives_=new MdlModel1dBank(null, null); if (limitesStockages_==null) - limitesStockages_=new MdlModel2dConstraintLine(null, null); + limitesStockages_=new MdlModel1dLimiteStockage(null, null); if (lignesDirectrices_==null) lignesDirectrices_=new MdlModel2dDirectionLine(null, null); + if(lignesContraints_==null) + lignesContraints_=new MdlModel2dConstraintLine(null, null); } private void buildWithTrustData(ZModeleLigneBrisee[] _models) { @@ -218,6 +231,9 @@ // Cr\xE9ation des nouveaux points sur les profils \\ for (int k=0; k<profils_.getNombre(); k++) { // Ajout des points au profil si n\xE9c\xE9ssaire pour les intersections \\ + // Lignes de contraintes + for (int l=0; l<lignesContraints_.getNombre(); l++) + createPointIfNeededKeepZ(k, l, lignesContraints_); // Rives for (int l=0; l<rives_.getNombre(); l++) createPointIfNeeded(k, (GISPolyligne) rives_.getObject(l)); @@ -446,12 +462,71 @@ int previousIdx=UtilsProfil1d.getPreviousIndex(seq, coord); int nextIdx=UtilsProfil1d.getNextIndex(seq, coord); // Le point n'appartient pas au profil ou La coordonn\xE9e correspond d\xE9j\xE0 \xE0 un point - if (previousIdx==-2||nextIdx==-2||previousIdx+1==nextIdx-1||nextIdx==-1||previousIdx==-1) - return; - // La coordonn\xE9e correspond \xE0 aucun point connu - ((GISZoneCollectionGeometry)profils_.getGeomData()).addAtomic(_idxProfil, previousIdx, coord.x, coord.y, null); + if (previousIdx!=-2&&nextIdx!=-2&&previousIdx+1!=nextIdx-1&&nextIdx!=-1&&previousIdx!=-1) + // La coordonn\xE9e correspond \xE0 aucun point connu + ((GISZoneCollectionGeometry)profils_.getGeomData()).addAtomic(_idxProfil, previousIdx, coord.x, coord.y, null); } } + + /** + * Cr\xE9e un point \xE0 l'intersection du profil indiqu\xE9 par _idxProfil et de + * _ligne. Le z du point cr\xE9e prendra la valeur z du point correspondant dans + * _ligne (interpol\xE9 si n\xE9c\xE9ssaire). + */ + private void createPointIfNeededKeepZ(int _idxProfil, int _idxLigne, ZModeleLigneBrisee _modelLigne) { + GISZoneCollection zoneLigne=_modelLigne.getGeomData(); + GISZoneCollection zoneProfil=profils_.getGeomData(); + GISPolyligne ligne=(GISPolyligne) zoneLigne.getGeometry(_idxLigne); + GISPolyligne profil=(GISPolyligne) zoneProfil.getGeometry(_idxProfil); + CoordinateSequence seqLigne=zoneLigne.getCoordinateSequence(_idxLigne); + CoordinateSequence seqProfil=zoneProfil.getCoordinateSequence(_idxProfil); + Geometry intersection=ligne.intersection(profil); + if (intersection.getNumPoints()==1) { + Coordinate coordIntersection=intersection.getCoordinate(); + int previousIdx=UtilsProfil1d.getPreviousIndex(seqProfil, coordIntersection); + int nextIdx=UtilsProfil1d.getNextIndex(seqProfil, coordIntersection); + // Le point n'appartient pas au profil ou La coordonn\xE9e correspond d\xE9j\xE0 \xE0 un point + if (previousIdx!=-2&&nextIdx!=-2&&previousIdx+1!=nextIdx-1&&nextIdx!=-1&&previousIdx!=-1) { + // La coordonn\xE9e correspond \xE0 aucun point connu + ((GISZoneCollectionGeometry) zoneProfil).addAtomic(_idxProfil, previousIdx, coordIntersection.x, coordIntersection.y, null); + seqProfil=zoneProfil.getCoordinateSequence(_idxProfil); + } + // Valuation du z par la valeur de la ligne si _zLigne \xE0 vrai + if(zoneLigne.getAttributeIsZ()!=null) { + int idxPProfil=UtilsProfil1d.getIndex(seqProfil, coordIntersection); + int idxPLigne=UtilsProfil1d.getIndex(seqLigne, coordIntersection); + GISAttributeModel modelZLigne=zoneLigne.getModel(zoneLigne.getAttributeIsZ()); + double z; + // Si l'attribut est global + if(!zoneLigne.getAttributeIsZ().isAtomicValue()) + z=(Double) modelZLigne.getObjectValueAt(_idxLigne); + // Le point existe dans la ligne + else if(idxPLigne!=-1) + z=(Double) ((GISAttributeModel) modelZLigne.getObjectValueAt(_idxLigne)).getObjectValueAt(idxPLigne); + // Le point n'existe pas => interpole une valeur + else { + // Extraction des index pr\xE9c\xE9dent et suivant \\ + int idxPrevious=UtilsProfil1d.getPreviousIndex(seqLigne, coordIntersection); + if (idxPrevious==-1) idxPrevious=0; + Coordinate previous=seqLigne.getCoordinate(idxPrevious); + int idxNext=UtilsProfil1d.getNextIndex(seqLigne, coordIntersection); + if (idxNext==-1) idxNext=seqLigne.size()-1; + Coordinate next=seqLigne.getCoordinate(UtilsProfil1d.getNextIndex(seqLigne, coordIntersection)); + // Cr\xE9ation d'un model temporaire contenant les z \\ + double valZ1=(Double) ((GISAttributeModel) modelZLigne.getObjectValueAt(_idxLigne)).getObjectValueAt(idxPrevious); + double valZ2=(Double) ((GISAttributeModel) modelZLigne.getObjectValueAt(_idxLigne)).getObjectValueAt(idxNext); + GISAttributeModelDoubleInterface zModel=new GISAttributeModelDoubleArray(new double[]{valZ1, valZ2}, zoneLigne + .getAttributeIsZ()); + // Interpolation \\ + GISCoordinateSequenceFactory factory=new GISCoordinateSequenceFactory(); + z=new GISReprojectInterpolateur1DDouble(factory.create(new Coordinate[]{previous, next}), factory + .create(new Coordinate[]{previous, new Coordinate(coordIntersection.x, coordIntersection.y, 0), next}), zModel).interpol(1); + } + ((GISAttributeModel)zoneProfil.getModel(zoneProfil.getAttributeIsZ()).getObjectValueAt(_idxProfil)).setObject(idxPProfil, + z, null); + } + } + } /** * Retourne vrai si les donn\xE9es contenues dans les champs sont coh\xE9rentes. Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/VueBief.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/VueBief.java 2009-01-27 20:57:12 UTC (rev 4415) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/VueBief.java 2009-01-28 11:46:22 UTC (rev 4416) @@ -18,7 +18,7 @@ import org.fudaa.fudaa.modeleur.MdlImplementation; import org.fudaa.fudaa.modeleur.layer.MdlLayer1dAxe; import org.fudaa.fudaa.modeleur.layer.MdlLayer1dBank; -import org.fudaa.fudaa.modeleur.layer.MdlLayer2dConstraintLine; +import org.fudaa.fudaa.modeleur.layer.MdlLayer1dLimiteStockage; import org.fudaa.fudaa.modeleur.layer.MdlLayer2dDirectionLine; import org.fudaa.fudaa.modeleur.layer.MdlLayer2dProfile; import org.fudaa.fudaa.modeleur.modeleur1d.controller.ControllerBief; @@ -79,7 +79,7 @@ lignesDirectrices.modele(bief.lignesDirectrices_); groupeCalque.add(lignesDirectrices); // Ajout du calque de limites de stockage - MdlLayer2dConstraintLine limitesStockage=new MdlLayer2dConstraintLine((FSigEditor)gisEditor_); + MdlLayer1dLimiteStockage limitesStockage=new MdlLayer1dLimiteStockage((FSigEditor)gisEditor_); limitesStockage.setSelectable(false); limitesStockage.modele(bief.limitesStockages_); groupeCalque.add(limitesStockage); Added: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/persistence/MdlLayer1dLimiteStockageLinePersistence.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/persistence/MdlLayer1dLimiteStockageLinePersistence.java (rev 0) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/persistence/MdlLayer1dLimiteStockageLinePersistence.java 2009-01-28 11:46:22 UTC (rev 4416) @@ -0,0 +1,26 @@ +/* + * @creation 28 janv. 2009 + * @modification $Date:$ + * @license GNU General Public License 2 + * @copyright (c)1998-2009 CETMEF 2 bd Gambetta F-60231 Compiegne + * @mail fud...@li... + */ +package org.fudaa.fudaa.modeleur.persistence; + +import org.fudaa.fudaa.modeleur.layer.MdlLayer1dLimiteStockage; +import org.fudaa.fudaa.modeleur.layer.MdlLayer2dLine; +import org.fudaa.fudaa.sig.layer.FSigEditor; + +/** + * Gestion de la persistance pour un calque de lignes de contraintes. + * + * @author Emmanuel MARTIN + * @version $Id:$ + */ +public class MdlLayer1dLimiteStockageLinePersistence extends MdlLayer2dLinePersistence { + + @Override + protected MdlLayer2dLine createNewLayer(FSigEditor _editor) { + return new MdlLayer1dLimiteStockage(_editor); + } +} Property changes on: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/persistence/MdlLayer1dLimiteStockageLinePersistence.java ___________________________________________________________________ Added: svn:keywords + Id Added: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <emm...@us...> - 2009-01-28 12:55:26
|
Revision: 4417 http://fudaa.svn.sourceforge.net/fudaa/?rev=4417&view=rev Author: emmanuel_martin Date: 2009-01-28 11:58:49 +0000 (Wed, 28 Jan 2009) Log Message: ----------- Correction d'un bug de copier/coller Modified Paths: -------------- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlSceneEditor.java Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlSceneEditor.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlSceneEditor.java 2009-01-28 11:46:22 UTC (rev 4416) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlSceneEditor.java 2009-01-28 11:58:49 UTC (rev 4417) @@ -235,9 +235,9 @@ newData[i]=datadest; // La g\xE9om\xE9trie - if (_mldSource instanceof MdlModel2dMultiPoint) + if (_calqueDestination.modeleDonnees() instanceof MdlModel2dMultiPoint) newGeom[i]=GISGeometryFactory.INSTANCE.createMultiPoint(geoms[i].getCoordinates()); - else if (_mldSource instanceof MdlModel2dLine) { + else if (_calqueDestination.modeleDonnees() instanceof MdlModel2dLine) { CoordinateSequence coordSeq=((GISCoordinateSequenceContainerInterface) geoms[i]).getCoordinateSequence(); boolean isFerme=coordSeq.getCoordinate(0).equals(coordSeq.getCoordinate(coordSeq.size()-1)); if((_calqueDestination.canAddForme(DeForme.LIGNE_BRISEE)&&!isFerme)||!_calqueDestination.canAddForme(DeForme.POLYGONE)) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2009-01-27 20:57:19
|
Revision: 4415 http://fudaa.svn.sourceforge.net/fudaa/?rev=4415&view=rev Author: deniger Date: 2009-01-27 20:57:12 +0000 (Tue, 27 Jan 2009) Log Message: ----------- Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/commun/EbliModelInfos.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostBuilderSuiteCalcul.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceReaderComposite.java Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/commun/EbliModelInfos.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/commun/EbliModelInfos.java 2009-01-27 18:04:48 UTC (rev 4414) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/commun/EbliModelInfos.java 2009-01-27 20:57:12 UTC (rev 4415) @@ -134,25 +134,18 @@ @Override public void addTableModelListener(TableModelListener l) { - // TODO Auto-generated method stub - } @Override public Class<?> getColumnClass(int columnIndex) { - // TODO Auto-generated method stub return String.class; } - @Override public int getColumnCount() { - // TODO Auto-generated method stub return colonnes_.size(); } - @Override public void removeTableModelListener(TableModelListener l) { - // TODO Auto-generated method stub } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostBuilderSuiteCalcul.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostBuilderSuiteCalcul.java 2009-01-27 18:04:48 UTC (rev 4414) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostBuilderSuiteCalcul.java 2009-01-27 20:57:12 UTC (rev 4415) @@ -31,319 +31,318 @@ */ public class TrPostBuilderSuiteCalcul { - /** - * Action qui r\xE9alise la suite de calcul. - * - * @author Adrien Hadoux - */ - public static class ActionBuildSuite extends EbliActionSimple { + /** + * Action qui r\xE9alise la suite de calcul. + * + * @author Adrien Hadoux + */ + public static class ActionBuildSuite extends EbliActionSimple { - TrPostSource src_; - TrPostCommonImplementation impl_; + TrPostSource src_; + TrPostCommonImplementation impl_; - public ActionBuildSuite(TrPostSource src, String _name, Icon _ic, String _ac, TrPostCommonImplementation impl) { - super(_name, _ic, _ac); - // TODO Auto-generated constructor stub - src_ = src; - src_ = src; - impl_ = impl; - } + public ActionBuildSuite(TrPostSource src, String _name, Icon _ic, String _ac, TrPostCommonImplementation impl) { + super(_name, _ic, _ac); + // TODO Auto-generated constructor stub + src_ = src; + src_ = src; + impl_ = impl; + } - public void actionPerformed(ActionEvent _e) { + public void actionPerformed(ActionEvent _e) { - // -- test de comptabilit\xE9 de fichier source --// - if (!isCompatibleSuiteCalcul(src_)) { - impl_.error(TrResource.getS("Le fichier n'est pas valide.")); - return; - } + // -- test de comptabilit\xE9 de fichier source --// + if (!isCompatibleSuiteCalcul(src_)) { + impl_.error(TrResource.getS("Le fichier n'est pas valide.")); + return; + } - // -- on lance la dialog de choix des fichiers sources --// - final TrPostSource srcChoisie = impl_.getCurrentProject().getChooserMultiSources(-1); - if (srcChoisie == null) { - impl_.error(TrResource.getS(TrResource.getS("Aucune source choisie"))); - return; - } + // -- on lance la dialog de choix des fichiers sources --// + final TrPostSource srcChoisie = impl_.getCurrentProject().getChooserMultiSources(-1); + if (srcChoisie == null) { + impl_.error(TrResource.getS(TrResource.getS("Aucune source choisie"))); + return; + } - if (!isCompatibleSuiteCalcul(srcChoisie)) { - impl_.error(TrResource.getS("Le fichier n'est pas valide.")); - return; - } + if (!isCompatibleSuiteCalcul(srcChoisie)) { + impl_.error(TrResource.getS("Le fichier n'est pas valide.")); + return; + } - List<String> error = new ArrayList<String>(); + List<String> error = new ArrayList<String>(); - // -- creation de la suite de calcul --// - TrPostSource suiteCalcul = createSuiteCalcul((TrPostSourceFromReader) src_, impl_, - (TrPostSourceFromReader) srcChoisie, error); + // -- creation de la suite de calcul --// + TrPostSource suiteCalcul = createSuiteCalcul((TrPostSourceFromReader) src_, impl_, + (TrPostSourceFromReader) srcChoisie, error); - if (suiteCalcul == null) { - // -- il se passe des choses \xE9tranges.... --// - String maxiStringLeo = ""; - for (String err : error) - maxiStringLeo += err + "\n"; + if (suiteCalcul == null) { + // -- il se passe des choses \xE9tranges.... --// + String maxiStringLeo = ""; + for (String err : error) + maxiStringLeo += err + "\n"; - impl_.error(maxiStringLeo); - return; - } + impl_.error(maxiStringLeo); + return; + } - // -- on ajoute la nouvelle src r\xE9sultat comme \xE9tant une suite de calcul --// + // -- on ajoute la nouvelle src r\xE9sultat comme \xE9tant une suite de calcul --// - impl_.c_.ajouterSource(suiteCalcul,suiteCalcul.getTitle()); + impl_.c_.ajouterSource(suiteCalcul, suiteCalcul.getTitle()); - // -- on cree la vue 2d correspondante --// + // -- on cree la vue 2d correspondante --// - TrPostProjet projet = impl_.getCurrentProject(); - TrPostLayoutPanelController controller = impl_.getCurrentLayoutFille().controller_; - final CalqueLegendeWidgetAdapter legendeCalque = new CalqueLegendeWidgetAdapter(controller.getSceneCourante(), - null); - final TrPostVisuPanel pnVisu = new TrPostVisuPanel(projet.getImpl(), projet, legendeCalque, suiteCalcul); - final EbliNode node = controller.addCalque(TrResource.getS("Calque") - + (controller.getSceneCourante().getAllVue2d().size() + 1), pnVisu.getLocation(), pnVisu.getPreferredSize(), - pnVisu, legendeCalque); - // -- ajout de l INFO de la source utilis\xE9e --// - node.getWidget().getController().setDescription(suiteCalcul.getTitle()); + TrPostProjet projet = impl_.getCurrentProject(); + TrPostLayoutPanelController controller = impl_.getCurrentLayoutFille().controller_; + final CalqueLegendeWidgetAdapter legendeCalque = new CalqueLegendeWidgetAdapter(controller.getSceneCourante(), + null); + final TrPostVisuPanel pnVisu = new TrPostVisuPanel(projet.getImpl(), projet, legendeCalque, suiteCalcul); + final EbliNode node = controller.addCalque(TrResource.getS("Calque") + + (controller.getSceneCourante().getAllVue2d().size() + 1), pnVisu.getLocation(), pnVisu.getPreferredSize(), + pnVisu, legendeCalque); + // -- ajout de l INFO de la source utilis\xE9e --// + node.getWidget().getController().setDescription(suiteCalcul.getTitle()); - // -- ajout des infos de cr\xE9ation --// + // -- ajout des infos de cr\xE9ation --// - TrPostSourceReaderComposite.fillInfosWithComposite(pnVisu.infosCreation_, - (TrPostSourceReaderComposite) ((TrPostSourceFromReader) suiteCalcul).getReader()); + TrPostSourceReaderComposite.fillInfosWithComposite(pnVisu.infosCreation_, + (TrPostSourceReaderComposite) ((TrPostSourceFromReader) suiteCalcul).getReader()); - } + } - } + } - /** - * R\xE9cup\xE9rer l'interface \xE0 partir du fichier - * - * @param _f - * @param _impl - * @return - */ - public static TrPostSourceFromReader createSourceFromeFile(File _f, TrPostCommonImplementation _impl) { - TrPostSource src = TrPostSourceBuilder.activeSourceAction(_f, _impl, _impl.getMainProgression()); - if (src != null && src instanceof TrPostSourceFromReader) return ((TrPostSourceFromReader) src); - return null; + /** + * R\xE9cup\xE9rer l'interface \xE0 partir du fichier + * + * @param _f + * @param _impl + * @return + */ + public static TrPostSourceFromReader createSourceFromeFile(File _f, TrPostCommonImplementation _impl) { + TrPostSource src = TrPostSourceBuilder.activeSourceAction(_f, _impl, _impl.getMainProgression()); + if (src != null && src instanceof TrPostSourceFromReader) return ((TrPostSourceFromReader) src); + return null; - } + } - public static TrPostSource createSuiteCalcul(File _f, TrPostCommonImplementation _impl, - TrPostSourceFromReader _reader, List<String> error) { - // -- lecture de l'interface \xE0 ajouter --// - TrPostSourceFromReader srcToConcat = createSourceFromeFile(_f, _impl); - return createSuiteCalcul(_reader, _impl, srcToConcat, error); - } + public static TrPostSource createSuiteCalcul(File _f, TrPostCommonImplementation _impl, + TrPostSourceFromReader _reader, List<String> error) { + // -- lecture de l'interface \xE0 ajouter --// + TrPostSourceFromReader srcToConcat = createSourceFromeFile(_f, _impl); + return createSuiteCalcul(_reader, _impl, srcToConcat, error); + } - /** - * Algorithme de construction d'une suite de calcul. - * - * @param srcToConcat - * @param _impl - * @param _reader - * @param error - * @return - */ - public static TrPostSource createSuiteCalcul(TrPostSourceFromReader srcToConcat, TrPostCommonImplementation _impl, - TrPostSourceFromReader _reader, List<String> error) { - TrPostSourceReaderComposite suite = null; - if (srcToConcat == null) { - error.add(TrResource.getS("Le fichier n'est pas valide.")); - return null; - } + /** + * Algorithme de construction d'une suite de calcul. + * + * @param srcToConcat + * @param _impl + * @param _reader + * @param error + * @return + */ + public static TrPostSource createSuiteCalcul(TrPostSourceFromReader srcToConcat, TrPostCommonImplementation _impl, + TrPostSourceFromReader _reader, List<String> error) { - if (_reader.isRubar() || srcToConcat.isRubar()) { - error.add(TrResource.getS("Format Rubar non g\xE9r\xE9")); - return null; - } + if (srcToConcat == null) { + error.add(TrResource.getS("Le fichier n'est pas valide.")); + return null; + } - // -- comparaison des grilles --// - EfGridInterface grille = srcToConcat.getGrid(); - if (!grille.isSameStrict(_reader.getGrid(), _impl.getMainProgression(), 0.01)) { - error.add(TrResource.getS("Les grilles ne sont pas identiques")); - return null; - } + if (_reader.isRubar() || srcToConcat.isRubar()) { + error.add(TrResource.getS("Format Rubar non g\xE9r\xE9")); + return null; + } - // -- comparaison des pas de temps d\xE9but et finaux --// - double[] time1 = TrPostSourceFromReader.getTimes(_reader.getReader()); - double[] time2 = TrPostSourceFromReader.getTimes(srcToConcat.getReader()); + // -- comparaison des grilles --// + EfGridInterface grille = srcToConcat.getGrid(); + if (!grille.isSameStrict(_reader.getGrid(), _impl.getMainProgression(), 0.01)) { + error.add(TrResource.getS("Les grilles ne sont pas identiques")); + return null; + } - if (time1[time1.length - 1] != time2[0] && time2[time2.length - 1] != time1[0]) { - error.add(TrResource - .getS("Le dernier pas de temps de l'un doit \xEAtre \xE9quivalent au premier pas de temps de l'autre.")); - return null; - } + // -- comparaison des pas de temps d\xE9but et finaux --// + double[] time1 = TrPostSourceFromReader.getTimes(_reader.getReader()); + double[] time2 = TrPostSourceFromReader.getTimes(srcToConcat.getReader()); - // -- recuperation des pas de temps et des variables --// - // double[] timeTotal= new double[time1.length+time2.length-1]; - // if(time1[0]>time2[0]){ - // //-- on permute pour garder l'ordre --// - // double[] temp=time1; - // time1=time2; - // time2=temp; - // } - // for(int i=0;i<time1.length;i++) - // timeTotal[i]=time1[i]; - // for(int i=0;i<time2.length-1;i++) - // timeTotal[time1.length+i]=time2[i+1]; + if (time1[time1.length - 1] != time2[0] && time2[time2.length - 1] != time1[0]) { + error.add(TrResource + .getS("Le dernier pas de temps de l'un doit \xEAtre \xE9quivalent au premier pas de temps de l'autre.")); + return null; + } - HashSet<H2dVariableType> listeVar = new HashSet<H2dVariableType>(); - H2dVariableType[] var = null; -// for (int i = 0; i < _reader.getAvailableVar().length; i++) -// listeVar.add(_reader.getVariable(i)); -// for (int i = 0; i < srcToConcat.getAvailableVar().length; i++) -// listeVar.add(srcToConcat.getVariable(i)); - - - //-- intersection des variables des 2 fichiers --// - for (int i = 0; i < _reader.getAvailableVar().length; i++){ - boolean trouve=false; - for (int j = 0; !trouve && j < srcToConcat.getAvailableVar().length; j++) - if(srcToConcat.getVariable(j).equals(_reader.getVariable(i)) || srcToConcat.getVariable(j).getID().equals(_reader.getVariable(i).getID()) ) { - trouve=true; - listeVar.add(_reader.getVariable(i)); - } - } - - var = new H2dVariableType[listeVar.size()]; - int k = 0; - for (H2dVariableType v : listeVar) - var[k++] = v; + // -- recuperation des pas de temps et des variables --// + // double[] timeTotal= new double[time1.length+time2.length-1]; + // if(time1[0]>time2[0]){ + // //-- on permute pour garder l'ordre --// + // double[] temp=time1; + // time1=time2; + // time2=temp; + // } + // for(int i=0;i<time1.length;i++) + // timeTotal[i]=time1[i]; + // for(int i=0;i<time2.length-1;i++) + // timeTotal[time1.length+i]=time2[i+1]; - // var=srcToConcat.variable_; + HashSet<H2dVariableType> listeVar = new HashSet<H2dVariableType>(); + H2dVariableType[] var = null; + // for (int i = 0; i < _reader.getAvailableVar().length; i++) + // listeVar.add(_reader.getVariable(i)); + // for (int i = 0; i < srcToConcat.getAvailableVar().length; i++) + // listeVar.add(srcToConcat.getVariable(i)); - // -- initialisation de la liste de source --// - List<TrPostSourceReaderInterface> listeSourceInterface_ = new ArrayList<TrPostSourceReaderInterface>(); + // -- intersection des variables des 2 fichiers --// + for (int i = 0; i < _reader.getAvailableVar().length; i++) { + boolean trouve = false; + for (int j = 0; !trouve && j < srcToConcat.getAvailableVar().length; j++) + if (srcToConcat.getVariable(j).equals(_reader.getVariable(i)) + || srcToConcat.getVariable(j).getID().equals(_reader.getVariable(i).getID())) { + trouve = true; + listeVar.add(_reader.getVariable(i)); + } + } - // -- on ajoute \xE0 la liste des interfaces l'interface 1 et l'intrface 2 --// - TrPostSourceReaderInterface interface1 = _reader.reader_; - TrPostSourceReaderInterface interface2 = srcToConcat.reader_; + var = new H2dVariableType[listeVar.size()]; + int k = 0; + for (H2dVariableType v : listeVar) + var[k++] = v; - // -- attetion au cas particulier: si une interface1 est deja une suite, il faut ajouter toutes ses interfaces --// - if (interface1 instanceof TrPostSourceReaderComposite) listeSourceInterface_ - .addAll(((TrPostSourceReaderComposite) interface1).listeSourceInterface_); - else listeSourceInterface_.add(interface1); + // var=srcToConcat.variable_; - if (interface2 instanceof TrPostSourceReaderComposite) listeSourceInterface_ - .addAll(((TrPostSourceReaderComposite) interface2).listeSourceInterface_); - else listeSourceInterface_.add(interface2); + // -- initialisation de la liste de source --// + List<TrPostSourceReaderInterface> listeSourceInterface_ = new ArrayList<TrPostSourceReaderInterface>(); - // -- ajout de tous les fichiers dans la collection --// - final Collection<File> file_ = new HashSet<File>(interface1.getFiles());; - file_.addAll(interface2.getFiles()); + // -- on ajoute \xE0 la liste des interfaces l'interface 1 et l'intrface 2 --// + TrPostSourceReaderInterface interface1 = _reader.reader_; + TrPostSourceReaderInterface interface2 = srcToConcat.reader_; - // -- on trie les listes dans l'ordre des timestep --// - Collections.sort(listeSourceInterface_, new ComparateurTrPostSourceReaderInterface()); + // -- attetion au cas particulier: si une interface1 est deja une suite, il faut ajouter toutes ses interfaces --// + if (interface1 instanceof TrPostSourceReaderComposite) listeSourceInterface_ + .addAll(((TrPostSourceReaderComposite) interface1).listeSourceInterface_); + else listeSourceInterface_.add(interface1); - // - ajout des correspondances timestep/source avec nouveau timestep --// - Map<Integer, CoupleTimeStepData> mapTimeStep_ = new HashMap<Integer, CoupleTimeStepData>(); - // TODO utilise TDoubleArrayList - TDoubleArrayList times = new TDoubleArrayList(); - // int cpt = 0; - for (TrPostSourceReaderInterface data : listeSourceInterface_) { - for (int i = 0; i < data.getNbTimeStep(); i++) { - // LOGIquement, il faudrait prendre en compte les erreurs d'arrondi - // -- ICI, pour cet algo, on doit degager tout les doublons et ne conserver que des valeurs uniques --// - if (!times.contains(data.getTimeStep(i))) { - // le cpt vaut la taille des times - mapTimeStep_.put(times.size(), new CoupleTimeStepData(data, i)); - times.add(data.getTimeStep(i)); - // cpt++; - } - } - } + if (interface2 instanceof TrPostSourceReaderComposite) listeSourceInterface_ + .addAll(((TrPostSourceReaderComposite) interface2).listeSourceInterface_); + else listeSourceInterface_.add(interface2); - double[] timeTotal = times.toNativeArray(); - // -- creation de la suite de calcul - suite = new TrPostSourceReaderComposite(timeTotal, var, mapTimeStep_, - listeSourceInterface_, file_); - - TrPostSource resultat=new TrPostSourceFromReader(suite, TrResource.getS("Suite de calcul"), grille, _impl); - _impl.getCurrentProject().deliverSourceSuiteId(resultat); - // -- creation du source Reader --// - return resultat; - } + // -- ajout de tous les fichiers dans la collection --// + final Collection<File> file_ = new HashSet<File>(interface1.getFiles());; + file_.addAll(interface2.getFiles()); + // -- on trie les listes dans l'ordre des timestep --// + Collections.sort(listeSourceInterface_, new ComparateurTrPostSourceReaderInterface()); - /** - * Methode qui se charge de construire la suite de calcul a partir de la liste des id des fichiers. - * - * @param listeIdSrc - * @param projet - * @return - */ - public static TrPostSource createSuiteCalculFromPersistance(List<String> listeIdSrc,TrPostProjet projet,String idSrc){ - TrPostCommonImplementation impl=projet.getImpl(); - //- on met proprement en forme les donn\xE9es --// - List<TrPostSourceFromReader> listeReader=new ArrayList<TrPostSourceFromReader>(); - for(String id:listeIdSrc){ + // - ajout des correspondances timestep/source avec nouveau timestep --// + Map<Integer, CoupleTimeStepData> mapTimeStep_ = new HashMap<Integer, CoupleTimeStepData>(); + // TODO utilise TDoubleArrayList + TDoubleArrayList times = new TDoubleArrayList(); + // int cpt = 0; + for (TrPostSourceReaderInterface data : listeSourceInterface_) { + for (int i = 0; i < data.getNbTimeStep(); i++) { + // LOGIquement, il faudrait prendre en compte les erreurs d'arrondi + // -- ICI, pour cet algo, on doit degager tout les doublons et ne conserver que des valeurs uniques --// + if (!times.contains(data.getTimeStep(i))) { + // le cpt vaut la taille des times + mapTimeStep_.put(times.size(), new CoupleTimeStepData(data, i)); + times.add(data.getTimeStep(i)); + // cpt++; + } + } + } - final TrPostSource srcChoisie = projet.findSourceById(id); - if (srcChoisie == null) { - impl.error(TrResource.getS(TrResource.getS("Le fichier r\xE9sultat d'id "+id+" est introuvable.\n Suite de calcul interrompue"))); - return null; - } - if (!isCompatibleSuiteCalcul(srcChoisie)) { - impl.error(TrResource.getS("Le fichier d'id "+id+" n'est pas valide pour la suite de calcul.")); - return null; - } - listeReader.add((TrPostSourceFromReader) srcChoisie) ; - } + double[] timeTotal = times.toNativeArray(); + // -- creation de la suite de calcul + TrPostSourceReaderComposite suite = new TrPostSourceReaderComposite(timeTotal, var, mapTimeStep_, + listeSourceInterface_, file_); - //-- on demarre la suite de calcul --// - Iterator<TrPostSourceFromReader> it=listeReader.iterator(); - TrPostSourceFromReader suiteProgressive=it.next(); + TrPostSource resultat = new TrPostSourceFromReader(suite, TrResource.getS("Suite de calcul"), grille, _impl); + resultat.buildDefaultVarUpdateLists(); + _impl.getCurrentProject().deliverSourceSuiteId(resultat); + // -- creation du source Reader --// + return resultat; + } - List<String> error=new ArrayList<String>(); - while(it.hasNext()){ - //-- on calcule la suite progressive que l'on stocke dans la suite progressive --// - TrPostSourceFromReader suite =(TrPostSourceFromReader) TrPostBuilderSuiteCalcul.createSuiteCalcul(suiteProgressive, impl, it.next(), error); - if(suite==null){ - String maxiStringLeo = ""; - for (String err : error) - maxiStringLeo += err + "\n"; - if(suiteProgressive!=null){ - maxiStringLeo+="La suite de calcul s'arrete donc avec les fichiers "+suiteProgressive.getTitle(); - suiteProgressive.setId(idSrc); - projet.ajouterSource(suiteProgressive); - } - - impl.error(maxiStringLeo); - return suiteProgressive; - }else - suiteProgressive=suite; + /** + * Methode qui se charge de construire la suite de calcul a partir de la liste des id des fichiers. + * + * @param listeIdSrc + * @param projet + * @return + */ + public static TrPostSource createSuiteCalculFromPersistance(List<String> listeIdSrc, TrPostProjet projet, String idSrc) { + TrPostCommonImplementation impl = projet.getImpl(); + // - on met proprement en forme les donn\xE9es --// + List<TrPostSourceFromReader> listeReader = new ArrayList<TrPostSourceFromReader>(); + for (String id : listeIdSrc) { - } + final TrPostSource srcChoisie = projet.findSourceById(id); + if (srcChoisie == null) { + impl.error(TrResource.getS(TrResource.getS("Le fichier r\xE9sultat d'id " + id + + " est introuvable.\n Suite de calcul interrompue"))); + return null; + } + if (!isCompatibleSuiteCalcul(srcChoisie)) { + impl.error(TrResource.getS("Le fichier d'id " + id + " n'est pas valide pour la suite de calcul.")); + return null; + } + listeReader.add((TrPostSourceFromReader) srcChoisie); + } + // -- on demarre la suite de calcul --// + Iterator<TrPostSourceFromReader> it = listeReader.iterator(); + TrPostSourceFromReader suiteProgressive = it.next(); - //-- trigger signal modif --// - suiteProgressive.setId(idSrc); - projet.ajouterSource(suiteProgressive); - return suiteProgressive; - } + List<String> error = new ArrayList<String>(); + while (it.hasNext()) { + // -- on calcule la suite progressive que l'on stocke dans la suite progressive --// + TrPostSourceFromReader suite = (TrPostSourceFromReader) TrPostBuilderSuiteCalcul.createSuiteCalcul( + suiteProgressive, impl, it.next(), error); + if (suite == null) { + String maxiStringLeo = ""; + for (String err : error) + maxiStringLeo += err + "\n"; + if (suiteProgressive != null) { + maxiStringLeo += "La suite de calcul s'arrete donc avec les fichiers " + suiteProgressive.getTitle(); + suiteProgressive.setId(idSrc); + projet.ajouterSource(suiteProgressive); + } + impl.error(maxiStringLeo); + return suiteProgressive; + } else suiteProgressive = suite; - /** - * Methode appelee pour v\xE9rifier que ceci est bien compatible avec la suite de calcul. - * - * @param src - * @return - */ - public static boolean isCompatibleSuiteCalcul(TrPostSource src) { + } - if (src != null && src instanceof TrPostSourceFromReader) return true; - return false; - } + // -- trigger signal modif --// + suiteProgressive.setId(idSrc); + projet.ajouterSource(suiteProgressive); + return suiteProgressive; + } - public static class ComparateurTrPostSourceReaderInterface implements Comparator<TrPostSourceReaderInterface> { + /** + * Methode appelee pour v\xE9rifier que ceci est bien compatible avec la suite de calcul. + * + * @param src + * @return + */ + public static boolean isCompatibleSuiteCalcul(TrPostSource src) { - public int compare(TrPostSourceReaderInterface o1, TrPostSourceReaderInterface o2) { + if (src != null && src instanceof TrPostSourceFromReader) return true; + return false; + } - // -- on compare selon la valeur des timesteps -- - if (o1.getTimeStep(0) > o2.getTimeStep(0)) return 1; + public static class ComparateurTrPostSourceReaderInterface implements Comparator<TrPostSourceReaderInterface> { - if (o1.getTimeStep(0) < o2.getTimeStep(0)) return -1; + public int compare(TrPostSourceReaderInterface o1, TrPostSourceReaderInterface o2) { - return 0; - } + // -- on compare selon la valeur des timesteps -- + if (o1.getTimeStep(0) > o2.getTimeStep(0)) return 1; - } + if (o1.getTimeStep(0) < o2.getTimeStep(0)) return -1; + return 0; + } + + } + } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceReaderComposite.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceReaderComposite.java 2009-01-27 18:04:48 UTC (rev 4414) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceReaderComposite.java 2009-01-27 20:57:12 UTC (rev 4415) @@ -54,7 +54,6 @@ listeSourceInterface_ = listeSourceInterface; mapTimeStep_ = mapTimeStep; - } public List<TrPostSourceReaderInterface> getListeSourceInterface() { @@ -85,7 +84,6 @@ return data.data_.getInitData(_varIdx, data.timeStep_, _ptIdx); } - /** * Remplissage des informations avec l'ensemble des fichiers qui composent la suite de calcul. * @@ -110,32 +108,28 @@ } - - + public String getTitle() { -public String getTitle() { - - String title=TrResource.getS("Suite de calcul"); - title+=":"; - for(File f:file_) - title+=" "+f.getName(); - - - return title; -} + String title = TrResource.getS("Suite de calcul"); + title += ":"; + for (File f : file_) + title += " " + f.getName(); -/** - * Cas particulier: il gere lui meme ses propres ids. - */ -String id_; -public void SetId(String id) { - id_=id; -} + return title; + } -@Override -public String getId() { - // TODO Auto-generated method stub - return id_; -} + /** + * Cas particulier: il gere lui meme ses propres ids. + */ + String id_; + public void SetId(String id) { + id_ = id; + } + + public String getId() { + // TODO Auto-generated method stub + return id_; + } + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fa...@us...> - 2009-01-27 18:05:01
|
Revision: 4414 http://fudaa.svn.sourceforge.net/fudaa/?rev=4414&view=rev Author: fargeix Date: 2009-01-27 18:04:48 +0000 (Tue, 27 Jan 2009) Log Message: ----------- Mise ?\195?\160 jour de TrLauncherDefault pour prise en compte du changement de num?\195?\169ro de version de Fudaa-Prepro : 0.93 Modified Paths: -------------- trunk/fudaa_devel/fudaa/src/org/fudaa/fudaa/tr/TrLauncherDefault.java Modified: trunk/fudaa_devel/fudaa/src/org/fudaa/fudaa/tr/TrLauncherDefault.java =================================================================== --- trunk/fudaa_devel/fudaa/src/org/fudaa/fudaa/tr/TrLauncherDefault.java 2009-01-27 18:00:25 UTC (rev 4413) +++ trunk/fudaa_devel/fudaa/src/org/fudaa/fudaa/tr/TrLauncherDefault.java 2009-01-27 18:04:48 UTC (rev 4414) @@ -134,9 +134,9 @@ infoSoft = new BuInformationsSoftware(); infoSoft.name = "prepro"; - infoSoft.version = "0.92"; - infoSoft.date = "2008-11-03"; - infoSoft.rights = TrResource.getS("Tous droits r\xE9serv\xE9s") + ". CETMEF (c)2003-2008"; + infoSoft.version = "0.93"; + infoSoft.date = "2009-01-27"; + infoSoft.rights = TrResource.getS("Tous droits r\xE9serv\xE9s") + ". CETMEF (c)2003-2009"; infoSoft.contact = "fre...@fu..."; infoSoft.license = "GPL2"; infoSoft.languages = languages; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fa...@us...> - 2009-01-27 18:00:33
|
Revision: 4413 http://fudaa.svn.sourceforge.net/fudaa/?rev=4413&view=rev Author: fargeix Date: 2009-01-27 18:00:25 +0000 (Tue, 27 Jan 2009) Log Message: ----------- Correction du bug de g?\195?\169n?\195?\169ration des fichiers INP (cette modif est prise en compte dans la version 0.93 de Fudaa-Prepro) Modified Paths: -------------- trunk/fudaa_devel/dodico/src/org/fudaa/dodico/reflux/io/INPWriterAbstract.java Modified: trunk/fudaa_devel/dodico/src/org/fudaa/dodico/reflux/io/INPWriterAbstract.java =================================================================== --- trunk/fudaa_devel/dodico/src/org/fudaa/dodico/reflux/io/INPWriterAbstract.java 2009-01-27 17:12:46 UTC (rev 4412) +++ trunk/fudaa_devel/dodico/src/org/fudaa/dodico/reflux/io/INPWriterAbstract.java 2009-01-27 18:00:25 UTC (rev 4413) @@ -880,8 +880,9 @@ final Map clGroupeCL = new HashMap(nbCl / 2); CLGroup temp = new CLGroup(); final TIntObjectHashMap globIdxBc = new TIntObjectHashMap(grid_.getFrontiers().getNbTotalPt()); + int k = 0; for (AllFrontierIteratorInterface it = grid_.getFrontiers().getAllFrontierIterator(); it.hasNext();) { - final H2dRefluxBoundaryCondition cli = inter_.getConditionLimite(it.next()); + final H2dRefluxBoundaryCondition cli = inter_.getConditionLimite(k++);it.next(); globIdxBc.put(cli.getIndexPt(), cli); // h if (cli.getHType() != H2dBcType.LIBRE) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <had...@us...> - 2009-01-27 17:13:02
|
Revision: 4412 http://fudaa.svn.sourceforge.net/fudaa/?rev=4412&view=rev Author: hadouxad Date: 2009-01-27 17:12:46 +0000 (Tue, 27 Jan 2009) Log Message: ----------- - Refonte totale de l'affichage des multi-fichiers: passage en swingx table-tree + design patter observer/observable -> permet d'afficher la liste des fichier r?\195?\169sultat pour un source donn?\195?\169 (m?\195?\169ga utile pour composite) -> plus jolie -> modif des suppressions: on force l'utilisateur a choisir un r?\195?\169pertoire(noeud non feuille=trpostSource) et non un fichier(feuille= File ) - Refactorisation id: IL FAUT LE METTRE DANS LES READER ET PAS LES SOURCES!!! -> les id sont stock?\195?\169s dans les reader et les TrPostSourceFromReader vont piocher dedans (surcharge de m?\195?\169thode) -> permet pour la persistance des donn?\195?\169es de g?\195?\169rer facilement les id des fichiers du composite: ils sont dans les readers. - PERSISTANCE DES SUITES DE CALCUL -> En attendant les retours de Didier, c'est positionn?\195?\169 dans le fichier SETUP, dans la balise SUITECALCUL:$ -> principe: - liste des id des fichiers r?\195?\169sultats qui sont utilis?\195?\169s - L'ID de la suite (MEGA IMPORTANT: est utilis?\195?\169 pour rep?\195?\169rer les ebliwidgetVueCalque qui utilise notre amie la suite de calcul) - ALGORITHME utilis?\195?\169: - RECHARGE 2 par 2 les fichiers pour faire une suites - Comme cela si a un moment il y a un probl?\195?\168me (fichier foireux) cela retourne la suite de calcul partielle MAIS VALIDE ! - Trie du tableau d affichage d infos de la vue 2d - Ajout des bonnes infos pour les cr?\195?\169ation de calques - Possibilit?\195?\169 de g?\195?\169rer le fichier virtuel composite comme un src normal: -> changement du nom en suite de calcul dans les onglets -> on peut ajouter une vue2d avec la fonction classique - MODIF de l'algorithme des suite de calculs: Intersection de pas de variable et non plus union au terme ensembliste. Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZEbliCalquesPanel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostBuilderSuiteCalcul.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjet.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjetsManagerFille.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSource.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceAbstract.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceFromReader.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceReaderComposite.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceReaderFromFileAbstract.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceReaderInterface.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceReaderReflux.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceReaderSerafin.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/actions/TrPostActionChooseAndCreateCalque.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/actions/TrPostActionOpenSrc.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/actions/TrPostActionRemoveSrc.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/data/TrPostDataCreatedExpr.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/persist/TrPostPersistenceManager.java Added Paths: ----------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/commun/EbliModelInfos.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostFlecheContentExpr.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourcePersistComposite.java Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZEbliCalquesPanel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZEbliCalquesPanel.java 2009-01-27 16:38:58 UTC (rev 4411) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZEbliCalquesPanel.java 2009-01-27 17:12:46 UTC (rev 4412) @@ -23,6 +23,8 @@ import java.awt.print.PageFormat; import java.awt.print.Printable; import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -58,6 +60,7 @@ import org.fudaa.ebli.commun.EbliComponentFactory; import org.fudaa.ebli.commun.EbliFormatterInterface; import org.fudaa.ebli.commun.EbliLib; +import org.fudaa.ebli.commun.EbliModelInfos; import org.fudaa.ebli.find.EbliFindDialog; import org.fudaa.ebli.find.EbliFindable; import org.fudaa.ebli.find.EbliFindableItem; @@ -1032,91 +1035,15 @@ if(infosCreation_==null || infosCreation_.keySet()==null ||infosCreation_.keySet().size()==0) return new BuPanel(); - - String[] names=new String[]{"Nom","Valeur"};//infosCreation_.keySet().toArray(new String[infosCreation_.keySet().size()]); - String[][] data=new String[infosCreation_.keySet().size()][2]; - int i=0; - for(String key:infosCreation_.keySet()){ - data[i][0]=key; - data[i][1]=infosCreation_.get(key); - i++; - } + List<String> liste=new ArrayList<String>(infosCreation_.keySet()); + Collections.sort(liste); + List<String> col=new ArrayList<String>(); + col.add(EbliResource.EBLI.getString("Nom")); + col.add(EbliResource.EBLI.getString("Valeur")); + + EbliModelInfos modelInfos=new EbliModelInfos(liste,infosCreation_,col); + BuTable table=new BuTable(modelInfos); - DefaultTableModel modelInfos=new DefaultTableModel(data,names){ - - @Override - public int getRowCount() { - // TODO Auto-generated method stub - return infosCreation_.keySet().size()+1; - } - - @Override - public Object getValueAt(int row, int column) { - - if(row==getRowCount()-1){ - if(column==0) - return EbliResource.EBLI.getString("Editable"); - else - return EbliResource.EBLI.getString("Double-cliquez pour \xE9diter"); - }else - if(column==0) - return getKey(row); - else - return getValue(row); - - } - - @Override - public void setValueAt(Object value, int row, int column) { - - if(value==null)return; - - if(row==getRowCount()-1 && !((String)value).equals(EbliResource.EBLI.getString("Editable"))){ - //-- ajout --// - if(column==1) - infosCreation_.put("Note "+(infosCreation_.keySet().size()+1),(String)value); - else - infosCreation_.put((String)value,""); - - fireTableDataChanged(); - - }else{ - //-- modification --// - if(column==0){ - String res=infosCreation_.get(getKey(row)); - infosCreation_.remove(getKey(row)); - infosCreation_.put((String)value, res); - }else{ - infosCreation_.put(getKey(row),(String)value); - } - fireTableDataChanged(); - } - } - public String getKey(int row){ - int i=0; - if(row>=infosCreation_.keySet().size()) - return ""; - for(String key:infosCreation_.keySet()){ - if(i==row) - return key; - i++; - - } - return ""; - } - - public String getValue(int row){ - return infosCreation_.get(getKey(row)); - } - - @Override - public boolean isCellEditable(int row, int column) { - return true; - } - - }; - BuTable table=new BuTable(modelInfos); - table.getColumnModel().getColumn(0).setPreferredWidth(20); BuPanel conteneur=new BuPanel(new BorderLayout()); conteneur.add(new JScrollPane(table),BorderLayout.CENTER); @@ -1125,5 +1052,6 @@ return conteneur; } + } \ No newline at end of file Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/commun/EbliModelInfos.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/commun/EbliModelInfos.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/commun/EbliModelInfos.java 2009-01-27 17:12:46 UTC (rev 4412) @@ -0,0 +1,159 @@ +package org.fudaa.ebli.commun; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; +import java.util.Map; + +import javax.swing.event.TableModelListener; +import javax.swing.table.AbstractTableModel; +import javax.swing.table.DefaultTableModel; +import javax.swing.table.TableModel; + +import org.fudaa.ebli.ressource.EbliResource; + + +/** + * Modele de tableau qui utilise une map <str, str>. + * Affiche des couple clef/valeurs de la map tri\xE9es. + * Utilis\xE9 en particulier pour les infos de creation des extends zeblicalquePanel. + * Prend en charge l'\xE9dition dans la map. + * Organise les infos par ordre lexicographique. + * Pour changer le trie a sa guise, faire son comparator et le placer dans le bon constructeur. + * @author Adrien Hadoux + * + */ +public class EbliModelInfos extends AbstractTableModel{ + + private static final long serialVersionUID = -2080709568281587469L; + private List<String> listeKey_; + private final List<String> colonnes_; + /** + * Les infos de la table. + */ + private Map<String,String> infos_; + private final Comparator<String> comparator_; + + public EbliModelInfos(List<String> liste,Map<String,String> map,List<String> colonnes){ + + this(liste,map,colonnes,null); + } + + public EbliModelInfos(List<String> liste,Map<String,String> map,List<String> colonnes,Comparator<String> comparator){ + super(); + listeKey_=liste; + infos_=map; + comparator_=comparator; + colonnes_=colonnes; + } + + + @Override + public String getColumnName(int column) { + // TODO Auto-generated method stub + return colonnes_.get(column); + } + + public int getRowCount() { + // TODO Auto-generated method stub + return infos_.keySet().size()+1; + } + + public Object getValueAt(int row, int column) { + + if(row==getRowCount()-1){ + if(column==0) + return EbliResource.EBLI.getString("Editable"); + else + return EbliResource.EBLI.getString("Double-cliquez pour \xE9diter"); + }else + + if(column==0) + return getKey(row); + else + return getValue(row); + + } + + + public void setValueAt(Object value, int row, int column) { + + if(value==null)return; + + if(row==getRowCount()-1 && !((String)value).equals(EbliResource.EBLI.getString("Editable"))){ + //-- ajout --// + if(column==1) + infos_.put("Note "+(infos_.keySet().size()+1),(String)value); + else + infos_.put((String)value,""); + + fireTableDataChanged(); + + }else{ + //-- modification --// + if(column==0){ + String res=infos_.get(getKey(row)); + infos_.remove(getKey(row)); + infos_.put((String)value, res); + }else{ + infos_.put(getKey(row),(String)value); + } + fireTableDataChanged(); + } + } + public String getKey(int row){ + + if(row>=infos_.keySet().size()) + return ""; + return listeKey_.get(row); + } + + + + public void fireTableDataChanged() { + + //-- on modif le tableau --// + listeKey_=new ArrayList<String>(infos_.keySet()); + //-- on ordonne la liste + if(comparator_==null) + Collections.sort(listeKey_); + else + Collections.sort(listeKey_,comparator_); + super.fireTableDataChanged(); + } + + public String getValue(int row){ + return infos_.get(getKey(row)); + } + + @Override + public boolean isCellEditable(int row, int column) { + return true; + } + + @Override + public void addTableModelListener(TableModelListener l) { + // TODO Auto-generated method stub + + } + + @Override + public Class<?> getColumnClass(int columnIndex) { + // TODO Auto-generated method stub + return String.class; + } + + @Override + public int getColumnCount() { + // TODO Auto-generated method stub + return colonnes_.size(); + } + + @Override + public void removeTableModelListener(TableModelListener l) { + // TODO Auto-generated method stub + + } + +} \ No newline at end of file Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostBuilderSuiteCalcul.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostBuilderSuiteCalcul.java 2009-01-27 16:38:58 UTC (rev 4411) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostBuilderSuiteCalcul.java 2009-01-27 17:12:46 UTC (rev 4412) @@ -10,6 +10,7 @@ import java.util.Comparator; import java.util.HashMap; import java.util.HashSet; +import java.util.Iterator; import java.util.List; import java.util.Map; @@ -30,246 +31,319 @@ */ public class TrPostBuilderSuiteCalcul { - /** - * Action qui r\xE9alise la suite de calcul. - * - * @author Adrien Hadoux - */ - public static class ActionBuildSuite extends EbliActionSimple { + /** + * Action qui r\xE9alise la suite de calcul. + * + * @author Adrien Hadoux + */ + public static class ActionBuildSuite extends EbliActionSimple { - TrPostSource src_; - TrPostCommonImplementation impl_; + TrPostSource src_; + TrPostCommonImplementation impl_; - public ActionBuildSuite(TrPostSource src, String _name, Icon _ic, String _ac, TrPostCommonImplementation impl) { - super(_name, _ic, _ac); - // TODO Auto-generated constructor stub - src_ = src; - src_ = src; - impl_ = impl; - } + public ActionBuildSuite(TrPostSource src, String _name, Icon _ic, String _ac, TrPostCommonImplementation impl) { + super(_name, _ic, _ac); + // TODO Auto-generated constructor stub + src_ = src; + src_ = src; + impl_ = impl; + } - public void actionPerformed(ActionEvent _e) { + public void actionPerformed(ActionEvent _e) { - // -- test de comptabilit\xE9 de fichier source --// - if (!isCompatibleSuiteCalcul(src_)) { - impl_.error(TrResource.getS("Le fichier n'est pas valide.")); - return; - } + // -- test de comptabilit\xE9 de fichier source --// + if (!isCompatibleSuiteCalcul(src_)) { + impl_.error(TrResource.getS("Le fichier n'est pas valide.")); + return; + } - // -- on lance la dialog de choix des fichiers sources --// - final TrPostSource srcChoisie = impl_.getCurrentProject().getChooserMultiSources(-1); - if (srcChoisie == null) { - impl_.error(TrResource.getS(TrResource.getS("Aucune source choisie"))); - return; - } + // -- on lance la dialog de choix des fichiers sources --// + final TrPostSource srcChoisie = impl_.getCurrentProject().getChooserMultiSources(-1); + if (srcChoisie == null) { + impl_.error(TrResource.getS(TrResource.getS("Aucune source choisie"))); + return; + } - if (!isCompatibleSuiteCalcul(srcChoisie)) { - impl_.error(TrResource.getS("Le fichier n'est pas valide.")); - return; - } + if (!isCompatibleSuiteCalcul(srcChoisie)) { + impl_.error(TrResource.getS("Le fichier n'est pas valide.")); + return; + } - List<String> error = new ArrayList<String>(); + List<String> error = new ArrayList<String>(); - // -- creation de la suite de calcul --// - TrPostSource suiteCalcul = createSuiteCalcul((TrPostSourceFromReader) src_, impl_, - (TrPostSourceFromReader) srcChoisie, error); + // -- creation de la suite de calcul --// + TrPostSource suiteCalcul = createSuiteCalcul((TrPostSourceFromReader) src_, impl_, + (TrPostSourceFromReader) srcChoisie, error); - if (suiteCalcul == null) { - // -- il se passe des choses \xE9tranges.... --// - String maxiStringLeo = ""; - for (String err : error) - maxiStringLeo += err + "\n"; + if (suiteCalcul == null) { + // -- il se passe des choses \xE9tranges.... --// + String maxiStringLeo = ""; + for (String err : error) + maxiStringLeo += err + "\n"; - impl_.error(maxiStringLeo); - return; - } + impl_.error(maxiStringLeo); + return; + } - // -- on ajoute la nouvelle src r\xE9sultat comme \xE9tant une suite de calcul --// + // -- on ajoute la nouvelle src r\xE9sultat comme \xE9tant une suite de calcul --// - impl_.c_.ajouterSource(suiteCalcul); + impl_.c_.ajouterSource(suiteCalcul,suiteCalcul.getTitle()); - // -- on cree la vue 2d correspondante --// + // -- on cree la vue 2d correspondante --// - TrPostProjet projet = impl_.getCurrentProject(); - TrPostLayoutPanelController controller = impl_.getCurrentLayoutFille().controller_; - final CalqueLegendeWidgetAdapter legendeCalque = new CalqueLegendeWidgetAdapter(controller.getSceneCourante(), - null); - final TrPostVisuPanel pnVisu = new TrPostVisuPanel(projet.getImpl(), projet, legendeCalque, suiteCalcul); - final EbliNode node = controller.addCalque(TrResource.getS("Calque") - + (controller.getSceneCourante().getAllVue2d().size() + 1), pnVisu.getLocation(), pnVisu.getPreferredSize(), - pnVisu, legendeCalque); - // -- ajout de l INFO de la source utilis\xE9e --// - node.getWidget().getController().setDescription("Source: " + projet.formatInfoSource(srcChoisie)); + TrPostProjet projet = impl_.getCurrentProject(); + TrPostLayoutPanelController controller = impl_.getCurrentLayoutFille().controller_; + final CalqueLegendeWidgetAdapter legendeCalque = new CalqueLegendeWidgetAdapter(controller.getSceneCourante(), + null); + final TrPostVisuPanel pnVisu = new TrPostVisuPanel(projet.getImpl(), projet, legendeCalque, suiteCalcul); + final EbliNode node = controller.addCalque(TrResource.getS("Calque") + + (controller.getSceneCourante().getAllVue2d().size() + 1), pnVisu.getLocation(), pnVisu.getPreferredSize(), + pnVisu, legendeCalque); + // -- ajout de l INFO de la source utilis\xE9e --// + node.getWidget().getController().setDescription(suiteCalcul.getTitle()); - // -- ajout des infos de cr\xE9ation --// + // -- ajout des infos de cr\xE9ation --// - TrPostSourceReaderComposite.fillInfosWithComposite(pnVisu.infosCreation_, - (TrPostSourceReaderComposite) ((TrPostSourceFromReader) suiteCalcul).getReader()); + TrPostSourceReaderComposite.fillInfosWithComposite(pnVisu.infosCreation_, + (TrPostSourceReaderComposite) ((TrPostSourceFromReader) suiteCalcul).getReader()); - } + } - } + } - /** - * R\xE9cup\xE9rer l'interface \xE0 partir du fichier - * - * @param _f - * @param _impl - * @return - */ - public static TrPostSourceFromReader createSourceFromeFile(File _f, TrPostCommonImplementation _impl) { - TrPostSource src = TrPostSourceBuilder.activeSourceAction(_f, _impl, _impl.getMainProgression()); - if (src != null && src instanceof TrPostSourceFromReader) return ((TrPostSourceFromReader) src); - return null; + /** + * R\xE9cup\xE9rer l'interface \xE0 partir du fichier + * + * @param _f + * @param _impl + * @return + */ + public static TrPostSourceFromReader createSourceFromeFile(File _f, TrPostCommonImplementation _impl) { + TrPostSource src = TrPostSourceBuilder.activeSourceAction(_f, _impl, _impl.getMainProgression()); + if (src != null && src instanceof TrPostSourceFromReader) return ((TrPostSourceFromReader) src); + return null; - } + } - public static TrPostSource createSuiteCalcul(File _f, TrPostCommonImplementation _impl, - TrPostSourceFromReader _reader, List<String> error) { - // -- lecture de l'interface \xE0 ajouter --// - TrPostSourceFromReader srcToConcat = createSourceFromeFile(_f, _impl); - return createSuiteCalcul(_reader, _impl, srcToConcat, error); - } + public static TrPostSource createSuiteCalcul(File _f, TrPostCommonImplementation _impl, + TrPostSourceFromReader _reader, List<String> error) { + // -- lecture de l'interface \xE0 ajouter --// + TrPostSourceFromReader srcToConcat = createSourceFromeFile(_f, _impl); + return createSuiteCalcul(_reader, _impl, srcToConcat, error); + } - /** - * Algorithme de construction d'une suite de calcul. - * - * @param srcToConcat - * @param _impl - * @param _reader - * @param error - * @return - */ - public static TrPostSource createSuiteCalcul(TrPostSourceFromReader srcToConcat, TrPostCommonImplementation _impl, - TrPostSourceFromReader _reader, List<String> error) { - TrPostSource suiteCalcul = null; - if (srcToConcat == null) { - error.add(TrResource.getS("Le fichier n'est pas valide.")); - return null; - } + /** + * Algorithme de construction d'une suite de calcul. + * + * @param srcToConcat + * @param _impl + * @param _reader + * @param error + * @return + */ + public static TrPostSource createSuiteCalcul(TrPostSourceFromReader srcToConcat, TrPostCommonImplementation _impl, + TrPostSourceFromReader _reader, List<String> error) { + TrPostSourceReaderComposite suite = null; + if (srcToConcat == null) { + error.add(TrResource.getS("Le fichier n'est pas valide.")); + return null; + } - if (_reader.isRubar() || srcToConcat.isRubar()) { - error.add(TrResource.getS("Format Rubar non g\xE9r\xE9")); - return null; - } + if (_reader.isRubar() || srcToConcat.isRubar()) { + error.add(TrResource.getS("Format Rubar non g\xE9r\xE9")); + return null; + } - // -- comparaison des grilles --// - EfGridInterface grille = srcToConcat.getGrid(); - if (!grille.isSameStrict(_reader.getGrid(), _impl.getMainProgression(), 0.01)) { - error.add(TrResource.getS("Les grilles ne sont pas identiques")); - return null; - } + // -- comparaison des grilles --// + EfGridInterface grille = srcToConcat.getGrid(); + if (!grille.isSameStrict(_reader.getGrid(), _impl.getMainProgression(), 0.01)) { + error.add(TrResource.getS("Les grilles ne sont pas identiques")); + return null; + } - // -- comparaison des pas de temps d\xE9but et finaux --// - double[] time1 = TrPostSourceFromReader.getTimes(_reader.getReader()); - double[] time2 = TrPostSourceFromReader.getTimes(srcToConcat.getReader()); + // -- comparaison des pas de temps d\xE9but et finaux --// + double[] time1 = TrPostSourceFromReader.getTimes(_reader.getReader()); + double[] time2 = TrPostSourceFromReader.getTimes(srcToConcat.getReader()); - if (time1[time1.length - 1] != time2[0] && time2[time2.length - 1] != time1[0]) { - error.add(TrResource - .getS("Le dernier pas de temps de l'un doit \xEAtre \xE9quivalent au premier pas de temps de l'autre.")); - return null; - } + if (time1[time1.length - 1] != time2[0] && time2[time2.length - 1] != time1[0]) { + error.add(TrResource + .getS("Le dernier pas de temps de l'un doit \xEAtre \xE9quivalent au premier pas de temps de l'autre.")); + return null; + } - // -- recuperation des pas de temps et des variables --// - // double[] timeTotal= new double[time1.length+time2.length-1]; - // if(time1[0]>time2[0]){ - // //-- on permute pour garder l'ordre --// - // double[] temp=time1; - // time1=time2; - // time2=temp; - // } - // for(int i=0;i<time1.length;i++) - // timeTotal[i]=time1[i]; - // for(int i=0;i<time2.length-1;i++) - // timeTotal[time1.length+i]=time2[i+1]; + // -- recuperation des pas de temps et des variables --// + // double[] timeTotal= new double[time1.length+time2.length-1]; + // if(time1[0]>time2[0]){ + // //-- on permute pour garder l'ordre --// + // double[] temp=time1; + // time1=time2; + // time2=temp; + // } + // for(int i=0;i<time1.length;i++) + // timeTotal[i]=time1[i]; + // for(int i=0;i<time2.length-1;i++) + // timeTotal[time1.length+i]=time2[i+1]; - HashSet<H2dVariableType> listeVar = new HashSet<H2dVariableType>(); - H2dVariableType[] var = null; - for (int i = 0; i < _reader.getAvailableVar().length; i++) - listeVar.add(_reader.getVariable(i)); - for (int i = 0; i < srcToConcat.getAvailableVar().length; i++) - listeVar.add(srcToConcat.getVariable(i)); - var = new H2dVariableType[listeVar.size()]; - int k = 0; - for (H2dVariableType v : listeVar) - var[k++] = v; + HashSet<H2dVariableType> listeVar = new HashSet<H2dVariableType>(); + H2dVariableType[] var = null; +// for (int i = 0; i < _reader.getAvailableVar().length; i++) +// listeVar.add(_reader.getVariable(i)); +// for (int i = 0; i < srcToConcat.getAvailableVar().length; i++) +// listeVar.add(srcToConcat.getVariable(i)); + + + //-- intersection des variables des 2 fichiers --// + for (int i = 0; i < _reader.getAvailableVar().length; i++){ + boolean trouve=false; + for (int j = 0; !trouve && j < srcToConcat.getAvailableVar().length; j++) + if(srcToConcat.getVariable(j).equals(_reader.getVariable(i)) || srcToConcat.getVariable(j).getID().equals(_reader.getVariable(i).getID()) ) { + trouve=true; + listeVar.add(_reader.getVariable(i)); + } + } + + var = new H2dVariableType[listeVar.size()]; + int k = 0; + for (H2dVariableType v : listeVar) + var[k++] = v; - // var=srcToConcat.variable_; + // var=srcToConcat.variable_; - // -- initialisation de la liste de source --// - List<TrPostSourceReaderInterface> listeSourceInterface_ = new ArrayList<TrPostSourceReaderInterface>(); + // -- initialisation de la liste de source --// + List<TrPostSourceReaderInterface> listeSourceInterface_ = new ArrayList<TrPostSourceReaderInterface>(); - // -- on ajoute \xE0 la liste des interfaces l'interface 1 et l'intrface 2 --// - TrPostSourceReaderInterface interface1 = _reader.reader_; - TrPostSourceReaderInterface interface2 = srcToConcat.reader_; + // -- on ajoute \xE0 la liste des interfaces l'interface 1 et l'intrface 2 --// + TrPostSourceReaderInterface interface1 = _reader.reader_; + TrPostSourceReaderInterface interface2 = srcToConcat.reader_; - // -- attetion au cas particulier: si une interface1 est deja une suite, il faut ajouter toutes ses interfaces --// - if (interface1 instanceof TrPostSourceReaderComposite) listeSourceInterface_ - .addAll(((TrPostSourceReaderComposite) interface1).listeSourceInterface_); - else listeSourceInterface_.add(interface1); + // -- attetion au cas particulier: si une interface1 est deja une suite, il faut ajouter toutes ses interfaces --// + if (interface1 instanceof TrPostSourceReaderComposite) listeSourceInterface_ + .addAll(((TrPostSourceReaderComposite) interface1).listeSourceInterface_); + else listeSourceInterface_.add(interface1); - if (interface2 instanceof TrPostSourceReaderComposite) listeSourceInterface_ - .addAll(((TrPostSourceReaderComposite) interface2).listeSourceInterface_); - else listeSourceInterface_.add(interface2); + if (interface2 instanceof TrPostSourceReaderComposite) listeSourceInterface_ + .addAll(((TrPostSourceReaderComposite) interface2).listeSourceInterface_); + else listeSourceInterface_.add(interface2); - // -- ajout de tous les fichiers dans la collection --// - final Collection<File> file_ = new HashSet<File>(interface1.getFiles());; - file_.addAll(interface2.getFiles()); + // -- ajout de tous les fichiers dans la collection --// + final Collection<File> file_ = new HashSet<File>(interface1.getFiles());; + file_.addAll(interface2.getFiles()); - // -- on trie les listes dans l'ordre des timestep --// - Collections.sort(listeSourceInterface_, new ComparateurTrPostSourceReaderInterface()); + // -- on trie les listes dans l'ordre des timestep --// + Collections.sort(listeSourceInterface_, new ComparateurTrPostSourceReaderInterface()); - // - ajout des correspondances timestep/source avec nouveau timestep --// - Map<Integer, CoupleTimeStepData> mapTimeStep_ = new HashMap<Integer, CoupleTimeStepData>(); - // TODO utilise TDoubleArrayList - TDoubleArrayList times = new TDoubleArrayList(); - // int cpt = 0; - for (TrPostSourceReaderInterface data : listeSourceInterface_) { - for (int i = 0; i < data.getNbTimeStep(); i++) { - // LOGIquement, il faudrait prendre en compte les erreurs d'arrondi - // -- ICI, pour cet algo, on doit degager tout les doublons et ne conserver que des valeurs uniques --// - if (!times.contains(data.getTimeStep(i))) { - // le cpt vaut la taille des times - mapTimeStep_.put(times.size(), new CoupleTimeStepData(data, i)); - times.add(data.getTimeStep(i)); - // cpt++; - } - } - } + // - ajout des correspondances timestep/source avec nouveau timestep --// + Map<Integer, CoupleTimeStepData> mapTimeStep_ = new HashMap<Integer, CoupleTimeStepData>(); + // TODO utilise TDoubleArrayList + TDoubleArrayList times = new TDoubleArrayList(); + // int cpt = 0; + for (TrPostSourceReaderInterface data : listeSourceInterface_) { + for (int i = 0; i < data.getNbTimeStep(); i++) { + // LOGIquement, il faudrait prendre en compte les erreurs d'arrondi + // -- ICI, pour cet algo, on doit degager tout les doublons et ne conserver que des valeurs uniques --// + if (!times.contains(data.getTimeStep(i))) { + // le cpt vaut la taille des times + mapTimeStep_.put(times.size(), new CoupleTimeStepData(data, i)); + times.add(data.getTimeStep(i)); + // cpt++; + } + } + } - double[] timeTotal = times.toNativeArray(); - // -- creation de la suite de calcul - TrPostSourceReaderComposite suite = new TrPostSourceReaderComposite(timeTotal, var, mapTimeStep_, - listeSourceInterface_, file_); + double[] timeTotal = times.toNativeArray(); + // -- creation de la suite de calcul + suite = new TrPostSourceReaderComposite(timeTotal, var, mapTimeStep_, + listeSourceInterface_, file_); + + TrPostSource resultat=new TrPostSourceFromReader(suite, TrResource.getS("Suite de calcul"), grille, _impl); + _impl.getCurrentProject().deliverSourceSuiteId(resultat); + // -- creation du source Reader --// + return resultat; + } - // -- creation du source Reader --// - return new TrPostSourceFromReader(suite, TrResource.getS("Suite de calcul"), grille, _impl); - } - /** - * Methode appelee pour v\xE9rifier que ceci est bien compatible avec la suite de calcul. - * - * @param src - * @return - */ - public static boolean isCompatibleSuiteCalcul(TrPostSource src) { + /** + * Methode qui se charge de construire la suite de calcul a partir de la liste des id des fichiers. + * + * @param listeIdSrc + * @param projet + * @return + */ + public static TrPostSource createSuiteCalculFromPersistance(List<String> listeIdSrc,TrPostProjet projet,String idSrc){ + TrPostCommonImplementation impl=projet.getImpl(); + //- on met proprement en forme les donn\xE9es --// + List<TrPostSourceFromReader> listeReader=new ArrayList<TrPostSourceFromReader>(); + for(String id:listeIdSrc){ - if (src != null && src instanceof TrPostSourceFromReader) return true; - return false; - } + final TrPostSource srcChoisie = projet.findSourceById(id); + if (srcChoisie == null) { + impl.error(TrResource.getS(TrResource.getS("Le fichier r\xE9sultat d'id "+id+" est introuvable.\n Suite de calcul interrompue"))); + return null; + } + if (!isCompatibleSuiteCalcul(srcChoisie)) { + impl.error(TrResource.getS("Le fichier d'id "+id+" n'est pas valide pour la suite de calcul.")); + return null; + } + listeReader.add((TrPostSourceFromReader) srcChoisie) ; + } - public static class ComparateurTrPostSourceReaderInterface implements Comparator<TrPostSourceReaderInterface> { + //-- on demarre la suite de calcul --// + Iterator<TrPostSourceFromReader> it=listeReader.iterator(); + TrPostSourceFromReader suiteProgressive=it.next(); - public int compare(TrPostSourceReaderInterface o1, TrPostSourceReaderInterface o2) { + List<String> error=new ArrayList<String>(); + while(it.hasNext()){ + //-- on calcule la suite progressive que l'on stocke dans la suite progressive --// + TrPostSourceFromReader suite =(TrPostSourceFromReader) TrPostBuilderSuiteCalcul.createSuiteCalcul(suiteProgressive, impl, it.next(), error); + if(suite==null){ + String maxiStringLeo = ""; + for (String err : error) + maxiStringLeo += err + "\n"; + if(suiteProgressive!=null){ + maxiStringLeo+="La suite de calcul s'arrete donc avec les fichiers "+suiteProgressive.getTitle(); + suiteProgressive.setId(idSrc); + projet.ajouterSource(suiteProgressive); + } + + impl.error(maxiStringLeo); + return suiteProgressive; + }else + suiteProgressive=suite; - // -- on compare selon la valeur des timesteps -- - if (o1.getTimeStep(0) > o2.getTimeStep(0)) return 1; + } - if (o1.getTimeStep(0) < o2.getTimeStep(0)) return -1; - return 0; - } + //-- trigger signal modif --// + suiteProgressive.setId(idSrc); + projet.ajouterSource(suiteProgressive); + return suiteProgressive; + } - } + /** + * Methode appelee pour v\xE9rifier que ceci est bien compatible avec la suite de calcul. + * + * @param src + * @return + */ + public static boolean isCompatibleSuiteCalcul(TrPostSource src) { + + if (src != null && src instanceof TrPostSourceFromReader) return true; + return false; + } + + public static class ComparateurTrPostSourceReaderInterface implements Comparator<TrPostSourceReaderInterface> { + + public int compare(TrPostSourceReaderInterface o1, TrPostSourceReaderInterface o2) { + + // -- on compare selon la valeur des timesteps -- + if (o1.getTimeStep(0) > o2.getTimeStep(0)) return 1; + + if (o1.getTimeStep(0) < o2.getTimeStep(0)) return -1; + + return 0; + } + + } + } Added: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostFlecheContentExpr.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostFlecheContentExpr.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostFlecheContentExpr.java 2009-01-27 17:12:46 UTC (rev 4412) @@ -0,0 +1,165 @@ +/* + * Bnp Paribas Services + * + * $Id$ + */ +package org.fudaa.fudaa.tr.post; + +import java.util.Set; + +import org.fudaa.dodico.ef.EfData; +import org.fudaa.dodico.h2d.type.H2dVariableType; +import org.fudaa.fudaa.tr.post.data.TrPostDataCreatedExpr; +import org.fudaa.fudaa.tr.post.data.TrPostDataCreatedSaver; +import org.fudaa.fudaa.tr.post.data.TrPostDataVecteur; +import org.nfunk.jep.Variable; + +/** + * @author denf01a + * @creation 27 janv. 2009 + * @version + * + */ +public class TrPostFlecheContentExpr implements TrPostFlecheContent { + + H2dVariableType varName_; + + TrPostDataCreatedExpr vx_; + TrPostDataCreatedExpr vy_; + + private TrPostDataVecteur lastValue_; + boolean isElementData_; + + private int lastTime_; + + protected TrPostFlecheContentExpr(boolean _isElementData, H2dVariableType varName_, TrPostDataCreatedExpr vx_, + TrPostDataCreatedExpr vy_) { + super(); + this.varName_ = varName_; + this.vx_ = vx_; + this.vy_ = vy_; + isElementData_ = _isElementData; + } + + /** + * + */ + public TrPostFlecheContent changeVar(H2dVariableType _name) { + return new TrPostFlecheContentExpr(isElementData_, _name, vx_, vy_); + } + + public void clearCache() { + vx_.clearCache(); + vy_.clearCache(); + } + + public TrPostDataCreatedSaver createSaver() { + return null; + } + + public TrPostFlecheContent duplicate(TrPostSource _src) { + return new TrPostFlecheContentExpr(isElementData_, varName_, vx_.createCopy(_src), vy_.createCopy(_src)); + } + + public TrPostFlecheContent duplicate(TrPostSource _src, H2dVariableType name) { + return new TrPostFlecheContentExpr(isElementData_, name, vx_.createCopy(_src), vy_.createCopy(_src)); + } + + public void fillWhithAllUsedVar(Set _res) { + vx_.fillWhithAllUsedVar(_res); + vy_.fillWhithAllUsedVar(_res); + } + + /** + * + */ + public EfData getDataFor(int time) { + return getValues(time); + } + + public String getDescription() { + return varName_.getName(); + } + + /** + * + */ + public double getValue(int time, int object) { + return Math.hypot(vx_.getValue(time, object), vy_.getValue(time, object)); + } + + /** + * + */ + public TrPostDataVecteur getValues(int _tIdx) { + if (_tIdx != lastTime_) { + lastTime_ = _tIdx; + lastValue_ = new TrPostDataVecteur(vx_.getDataFor(_tIdx), vy_.getDataFor(_tIdx), isElementData_); + } + return lastValue_; + } + + /** + * + */ + public H2dVariableType getVar() { + return varName_; + } + + /** + * + */ + public H2dVariableType getVx() { + return null; + } + + /** + * + */ + public String getVxDesc() { + return getDescription() + " X"; + } + + /** + * + */ + public H2dVariableType getVy() { + return null; + } + + /** + * + */ + public String getVyDesc() { + return getDescription() + " Y"; + } + + /** + * + */ + public boolean isEditable() { + return true; + } + + /** + * + */ + public boolean isExpr() { + return true; + } + + /** + * + */ + public TrPostFlecheContent isFleche() { + return this; + } + + /** + * + */ + public boolean updateConstantVar(Variable _var) { + return vx_.updateConstantVar(_var) | vy_.updateConstantVar(_var); + } + +} Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjet.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjet.java 2009-01-27 16:38:58 UTC (rev 4411) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjet.java 2009-01-27 17:12:46 UTC (rev 4412) @@ -385,21 +385,28 @@ * @param _src */ public void ajouterSource(final TrPostSource _src) { - _src.addVariableListener(new VariableListener()); - if (_src.getFiles() == null || !isOneSourceLoaded(_src.getFiles())) { - listeSrc_.add(_src); - _src.buildDefaultVarUpdateLists(); + ajouterSource(_src,null); - // -- ajout du menu correspondant uniquement a partir de la 2eme --// - // if (listeSrc_.size()>1 || (menuPost_!=null &&)) - construitMenuPostSpecifiqueSource(_src); + } + + public void ajouterSource(final TrPostSource _src,String title) { + _src.addVariableListener(new VariableListener()); + if (_src.getFiles() == null || !isOneSourceLoaded(_src.getFiles())) { + listeSrc_.add(_src); + _src.buildDefaultVarUpdateLists(); - } else { - // -- messqge d erreur: le fichier est deja ouvert --// - new BuDialogMessage(impl_.getApp(), impl_.getInformationsSoftware(), "Le fichier est deja ouvert.").activate(); + // -- ajout du menu correspondant uniquement a partir de la 2eme --// + // if (listeSrc_.size()>1 || (menuPost_!=null &&)) + construitMenuPostSpecifiqueSource(_src,title); - } + } else { + // -- messqge d erreur: le fichier est deja ouvert --// + new BuDialogMessage(impl_.getApp(), impl_.getInformationsSoftware(), "Le fichier est deja ouvert.").activate(); + } + // -- notify aux observers --// + this.notifyObservers(); + } public TrPostSource findSource(final String _file) { @@ -457,6 +464,32 @@ return null; } + + /** + * Retourne toutes les sources qui ne sont pas des composites + * @return + */ + public List<TrPostSource> getAllClassicalSource(){ + List<TrPostSource> res=new ArrayList<TrPostSource>(); + for(TrPostSource src:listeSrc_){ + if(!isAsuiteCalcul(src)) + res.add(src); + } + return res; + } + /** + * Retourne toutes les sources qui sont des composites + * @return + */ + public List<TrPostSourceFromReader> getAllCCompositeSource(){ + List<TrPostSourceFromReader> res=new ArrayList<TrPostSourceFromReader>(); + for(TrPostSource src:listeSrc_){ + if(isAsuiteCalcul(src)) + res.add((TrPostSourceFromReader)src); + } + return res; + } + public boolean isSourceLoaded(final String _file) { return isSourceLoaded(new File(_file)); @@ -546,9 +579,29 @@ public String formatInfoSource(final TrPostSource _src) { // --ajout dans la liste des titres --// Collection<File> files = _src.getFiles(); + if(!isAsuiteCalcul(_src)) return formatName(_src.getTitle()) + " | Fichier: " + formatFichier(files.iterator().next()); + else{ + +// String listeFiles=""; +// for(File f:files) +// listeFiles+="| "+f.getName(); + return _src.getTitle() ;//+ listeFiles; + } } + + public boolean isAsuiteCalcul(final TrPostSource _src){ + if(_src instanceof TrPostSourceFromReader){ + TrPostSourceFromReader s=(TrPostSourceFromReader) _src; + if(s.getReader() instanceof TrPostSourceReaderComposite) + return true; + + } + + return false; + } + public String formatFichier(final File file) { if (file == null) return ""; final String nomFichier = file.getAbsolutePath(); @@ -584,11 +637,15 @@ * * @param _src */ - public void construitMenuPostSpecifiqueSource(final TrPostSource _src) { + public void construitMenuPostSpecifiqueSource(final TrPostSource _src,String title) { - final BuMenu menuSimul = new BuMenu((listeSrc_.size()) + ". " + formatFichier(_src.getFiles().iterator().next()), + BuMenu menuSimul =null; + if(title==null) + menuSimul=new BuMenu((listeSrc_.size()) + ". " + formatFichier(_src.getFiles().iterator().next()), "SIMULATION" + (listeSrc_.size())); - + else + menuSimul=new BuMenu((listeSrc_.size()) + ". " + _src.getTitle(), + "SIMULATION" + (listeSrc_.size())); // -- ajout du menu au menu post --// getMenuPost().add(menuSimul); @@ -1374,7 +1431,28 @@ return src.getId(); } + + public String deliverSourceSuiteId(TrPostSource src) { + String idString = src.getTitle(); + if (src.getId() == null) { + String uniqueId = CtuluLibGenerator.getInstance().deliverUniqueStringId(idString); + src.setId(uniqueId); + } else { + + // -- on teste si l'id de base est 'parlant' => contient le nom du ficheir --// + String nameFormate = FuLib.clean(idString); + String id = src.getId(); + if (!id.startsWith(nameFormate)) { + String uniqueId = CtuluLibGenerator.getInstance().deliverUniqueStringId(idString); + src.setId(uniqueId); + } + + } + return src.getId(); + + } + /** * genere uniquement l id. * Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjetsManagerFille.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjetsManagerFille.java 2009-01-27 16:38:58 UTC (rev 4411) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjetsManagerFille.java 2009-01-27 17:12:46 UTC (rev 4412) @@ -2,11 +2,14 @@ import java.awt.BorderLayout; import java.awt.event.ActionEvent; +import java.io.File; import java.util.Date; import java.util.Observable; import java.util.Observer; import javax.swing.BorderFactory; +import javax.swing.JComboBox; +import javax.swing.JLabel; import javax.swing.JScrollPane; import javax.swing.ListSelectionModel; import javax.swing.event.ListSelectionEvent; @@ -14,11 +17,18 @@ import javax.swing.event.TableModelListener; import javax.swing.table.AbstractTableModel; +import org.fudaa.ebli.calque.ZCalqueSondeSynchroniserFusion.SondeCouple; +import org.fudaa.ebli.calque.ZCalqueSondeSynchroniserFusion.TreeTableModelGraphe; import org.fudaa.ebli.commun.EbliActionSimple; +import org.fudaa.ebli.visuallibrary.calque.EbliWidgetVueCalque; import org.fudaa.fudaa.tr.common.TrResource; import org.fudaa.fudaa.tr.post.actions.TrPostActionOpenSrc; import org.fudaa.fudaa.tr.post.actions.TrPostActionRemoveSrc; import org.jdesktop.swingx.JXTable; +import org.jdesktop.swingx.JXTree; +import org.jdesktop.swingx.JXTreeTable; +import org.jdesktop.swingx.treetable.DefaultMutableTreeTableNode; +import org.jdesktop.swingx.treetable.DefaultTreeTableModel; import com.memoire.bu.BuButton; import com.memoire.bu.BuInternalFrame; @@ -37,109 +47,16 @@ /** * projet contenant la liste des sources. */ - TrPostProjet projet_; + final TrPostProjet projet_; /** * La liste des projet afffichage graphique. */ - public JXTable listProjets_; + public JXTreeTable listProjets_; - /** - * Classe Model de la jlist - */ - class ModelTableProjets extends AbstractTableModel { + + TreeTableModelGraphe modelList_; - TrPostProjet p; - // FIXME traduire les lignes - String[] titres_ = { "N\xB0", "Nom", "Fichier", "Date de derni\xE8re modification" }; - - public ModelTableProjets(final TrPostProjet _p) { - p = _p; - - } - - @Override - public void addTableModelListener(final TableModelListener l) {} - - @Override - public Class<?> getColumnClass(final int columnIndex) { - - switch (columnIndex) { - case 0: - return Integer.class; - case 1: - return String.class; - case 2: - return String.class; - case 3: - return Date.class; - // case 4: - // return Boolean.class; - // case 5: - // return Boolean.class; - } - return null; - } - - public int getColumnCount() { - return titres_.length; - } - - @Override - public String getColumnName(final int columnIndex) { - return titres_[columnIndex]; - } - - public int getRowCount() { - return p.listeSrc_.size(); - } - - public Object getValueAt(final int rowIndex, final int columnIndex) { - - if (columnIndex >= getColumnCount()) return null; - final TrPostSource src = p.listeSrc_.get(rowIndex); - - switch (columnIndex) { - case 0: - return rowIndex + 1; - case 1: - return p.formatName(src.getTitle()); - case 2: - return src.getFiles().iterator().next().getAbsolutePath(); - case 3: - return new Date(src.getFiles().iterator().next().lastModified()); - // case 4: - // return src.isInspectable(); - // case 5: - // return src.isRubar(); - } - return null; - } - - /** - * Format le nom du fichier - * - * @param file - * @return - */ - - @Override - public boolean isCellEditable(final int rowIndex, final int columnIndex) { - return false; - } - - @Override - public void removeTableModelListener(final TableModelListener l) {} - - @Override - public void setValueAt(final Object value, final int rowIndex, final int columnIndex) {} - - // TODO utiliser CtuluCellTextRenderer - - } - - ModelTableProjets modelList_; - BuButton boutonAjoutSrc_ = new BuButton("Ajouter un projet", BuResource.BU.getIcon("crystal_ouvrirprojet")); BuButton boutonEnleveSrc_ = new BuButton("Enlever un projet", BuResource.BU.getIcon("crystal_enlever")); // BuButton boutonChangeSrc_ = new BuButton("Changer de donn\xE9es", BuResource.BU.getIcon("crystal_valider")); @@ -156,15 +73,15 @@ projet_.getObservable().addObserver(this); // --creation de la liste graphique des projets --// - modelList_ = new ModelTableProjets(projet_); + modelList_ = constructStructureModel() ;//new TreeTableModelGraphe(); - listProjets_ = new JXTable(modelList_); + listProjets_ = new JXTreeTable(modelList_); // listProjets_.setCellRenderer(modelList_); // -- mise en forme des colonnes --// - listProjets_.getColumnModel().getColumn(0).setPreferredWidth(5); - listProjets_.getColumnModel().getColumn(1).setPreferredWidth(250); - listProjets_.getColumnModel().getColumn(2).setPreferredWidth(100); +// listProjets_.getColumnModel().getColumn(0).setPreferredWidth(5); +// listProjets_.getColumnModel().getColumn(1).setPreferredWidth(250); +// listProjets_.getColumnModel().getColumn(2).setPreferredWidth(100); listProjets_.setBorder(BorderFactory.createEtchedBorder()); @@ -173,7 +90,7 @@ // -- oblige la selection unique pour ne pas ajouter qu un seul projet a la // fois--// - listProjets_.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + // listProjets_.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); // -- selectionne par default le src courant --// // listProjets_.setSelectedValue(projet_.src_, true); @@ -230,19 +147,132 @@ public void valueChanged(final ListSelectionEvent e) { - // -- recuperation de l element selectionn\xE9 --// - // FuLog.warning("l'objet selectionne est: " + - // listProjets_.getSelectedValue()); + } + /** + * Construit le model du tableau. + * @return + */ + public TreeTableModelGraphe constructStructureModel() { + DefaultMutableTreeTableNode root = new DefaultMutableTreeTableNode("Gestion multi-fichiers"); + + for (int i = 0; i <projet_.listeSrc_.size(); i++) { + TrPostSource src= projet_.listeSrc_.get(i); + + + DefaultMutableTreeTableNode nodeCalque = new DefaultMutableTreeTableNode(src); + root.add(nodeCalque); + + //- ajout des fichiers associ\xE9s --// + for(File f:src.getFiles()) + nodeCalque.add(new DefaultMutableTreeTableNode(f)); + } + TreeTableModelGraphe model = new TreeTableModelGraphe(projet_); + model.setRoot(root); + + return model; + } + + + public class TreeTableModelGraphe extends DefaultTreeTableModel { + String[] titre_; + TrPostProjet projet; + + + + public Class<?> getColumnClass(final int columnIndex) { + + switch (columnIndex) { + case 0: + return Integer.class; + case 1: + return String.class; + } + return null; + } + + // -- data correspondant au x donn\xE9 --// + double[] dataY_ = new double[0]; + + public TreeTableModelGraphe(TrPostProjet p) { + String[] val = {"Fichiers", "Date modification" }; + titre_ = val; + projet=p; + } + + public int getColumnCount() { + + return titre_.length; + } + + @Override + public boolean isCellEditable(Object _node, int _column) { + return false; + } + + public String getColumnName(int _columnIndex) { + return titre_[_columnIndex]; + } + + public int getRowCount() { + return projet.listeSrc_.size(); + + } + + public Object getValueAt(Object node, int column) { + Object res = new DefaultMutableTreeTableNode("n/a"); + if (node instanceof DefaultMutableTreeTableNode) { + DefaultMutableTreeTableNode defNode = (DefaultMutableTreeTableNode) node; + if (defNode.getUserObject() instanceof TrPostSource) { + TrPostSource src=(TrPostSource)defNode.getUserObject(); + String label=(getRoot().getIndex(defNode)+1)+". "+ projet_.formatName(src.getTitle()); + if (column == 0) + return label; + else + return ""; + } else if (defNode.getUserObject() instanceof File) { + File fichier = (File) defNode.getUserObject(); + + if (column == 0) + return fichier.getAbsolutePath(); + else if (column == 1) + return new Date(fichier.lastModified()); + else + return ""; + } + else + return ""; + } + return res; + } + + public DefaultMutableTreeTableNode getTreeNode(int i) { + return (DefaultMutableTreeTableNode) getRoot().getChildAt(i); + + } + + public void reload() { + + this.modelSupport.fireTreeStructureChanged(listProjets_.getPathForRow(0)); + + } + + + } + public void update(final Observable o, final Object arg) { // mise a jour de la liste - modelList_.fireTableStructureChanged(); - + if(listProjets_==null)return; + listProjets_.setTreeTableModel(constructStructureModel()); + listProjets_.expandAll(); +// if(listProjets_.getModel() instanceof TreeTableModelGraphe) +// ((TreeTableModelGraphe)listProjets_.getModel()).reload(); // selection par defaut de la premiere simul listProjets_.clearSelection(); + this.revalidate(); } } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSource.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSource.java 2009-01-27 16:38:58 UTC (rev 4411) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSource.java 2009-01-27 17:12:46 UTC (rev 4412) @@ -332,4 +332,8 @@ * @param _d */ void setDefaultPaletteMinPalette(H2dVariableType[] _v, boolean[] _actived, double[] _d); + + + public void fillWithSourceCreationInfo(String _pref, Map _table) ; + } \ No newline at end of file Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceAbstract.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceAbstract.java 2009-01-27 16:38:58 UTC (rev 4411) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceAbstract.java 2009-01-27 17:12:46 UTC (rev 4412) @@ -218,7 +218,7 @@ TrPostTimeModel time_; - private final String title_; + protected final String title_; protected ObjectContainer tmpContainer_; @@ -950,7 +950,7 @@ return time_.getTimeStep(_i); } - public final String getTitle() { + public String getTitle() { return title_; } @@ -1398,13 +1398,13 @@ // return CtuluLibGenerator.getInstance().deliverUniqueStringId(); // } - public final String getId() { + public String getId() { // if(id_==null) // id_=generateId(); return id_; } - public final void setId(String id) { + public void setId(String id) { id_ = id; } @@ -1448,5 +1448,10 @@ idx++; } } + + public void fillWithSourceCreationInfo(String _pref, Map _table){ + TrPostSourceAbstractFromIdx.fillWithSourceInfo(CtuluLibString.EMPTY_STRING, _table, this); + } + } \ No newline at end of file Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceFromReader.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceFromReader.java 2009-01-27 16:38:58 UTC (rev 4411) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceFromReader.java 2009-01-27 17:12:46 UTC (rev 4412) @@ -7,7 +7,9 @@ import java.io.File; import java.io.IOException; import java.util.Collection; +import java.util.Map; +import org.fudaa.ctulu.CtuluLibString; import org.fudaa.ctulu.CtuluUI; import org.fudaa.dodico.ef.EfData; import org.fudaa.dodico.ef.EfGridInterface; @@ -20,71 +22,92 @@ */ public class TrPostSourceFromReader extends TrPostSourceAbstract{ - TrPostSourceReaderInterface reader_; + TrPostSourceReaderInterface reader_; - /** - * @param _file - * @param _titre - * @param _g - * @param _time - * @param _v - * @param _impl - */ - public TrPostSourceFromReader(TrPostSourceReaderInterface _reader, String _titre, EfGridInterface _g, CtuluUI _impl) { - super(_titre, _g, getTimes(_reader), - _reader.getInitVar().toArray(new H2dVariableType[_reader.getInitVar().size()]), _impl); - reader_=_reader; - } + /** + * @param _file + * @param _titre + * @param _g + * @param _time + * @param _v + * @param _impl + */ + public TrPostSourceFromReader(TrPostSourceReaderInterface _reader, String _titre, EfGridInterface _g, CtuluUI _impl) { + super(_titre, _g, getTimes(_reader), + _reader.getInitVar().toArray(new H2dVariableType[_reader.getInitVar().size()]), _impl); + reader_=_reader; + } - public static double[] getTimes(TrPostSourceReaderInterface _init) { - if (_init == null || _init.getNbTimeStep() == 0) return FuEmptyArrays.DOUBLE0; - double[] res = new double[_init.getNbTimeStep()]; - for (int i = 0; i < res.length; i++) { - res[i] = _init.getTimeStep(i); - } - return res; + public static double[] getTimes(TrPostSourceReaderInterface _init) { + if (_init == null || _init.getNbTimeStep() == 0) return FuEmptyArrays.DOUBLE0; + double[] res = new double[_init.getNbTimeStep()]; + for (int i = 0; i < res.length; i++) { + res[i] = _init.getTimeStep(i); + } + return res; - } - - @Override - public final void close() { - super.close(); - reader_.close(); - } - - + } - public Collection<File> getFiles() { - return reader_.getFiles(); - } + @Override + public final void close() { + super.close(); + reader_.close(); + } - /** - * @return the reader - */ - public TrPostSourceReaderInterface getReader() { - return reader_; - } - /** - * @param _reader the reader to set - */ - public void setReader(TrPostSourceReaderInterface _reader) { - reader_ = _reader; - } - @Override - public EfData getInitData(H2dVariableType _varIdx, int _timeIdx) { - return reader_.getInitData(_varIdx, _timeIdx); - } + public final String getTitle() { + if(reader_.getTitle()!=null) + return reader_.getTitle(); + return title_; + } - @Override - public double getInitData(H2dVariableType _varIdx, int _timeIdx, int _ptIdx) throws IOException { - return reader_.getInitData(_varIdx, _timeIdx, _ptIdx); - } + public Collection<File> getFiles() { + return reader_.getFiles(); + } + /** + * @return the reader + */ + public TrPostSourceReaderInterface getReader() { + return reader_; + } - public boolean isRubar() { - return false; - } + /** + * @param _reader the reader to set + */ + public void setReader(TrPostSourceReaderInterface _reader) { + reader_ = _reader; + } + @Override + public EfData getInitData(H2dVariableType _varIdx, int _timeIdx) { + return reader_.getInitData(_varIdx, _timeIdx); + } + + @Override + public double getInitData(H2dVariableType _varIdx, int _timeIdx, int _ptIdx) throws IOException { + return reader_.getInitData(_varIdx, _timeIdx, _ptIdx); + } + + + public boolean isRubar() { + return false; + } + + public void fillWithSourceCreationInfo(String _pref, Map _table){ + + if(this.getReader() instanceof TrPostSourceReaderComposite) + ((TrPostSourceReaderComposite)getReader()).fillInfosWithComposite( _table, (TrPostSourceReaderComposite)getReader()); + } + + + public String getId() { + return reader_.getId(); + } + + public void setId(String id) { + reader_.SetId(id); + } + } Added: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourcePersistComposite.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourcePersistComposite.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourcePersistComposite.java 2009-01-27 17:12:46 UTC (rev 4412) @@ -0,0 +1,52 @@ +package org.fudaa.fudaa.tr.post; + +import java.util.ArrayList; +import java.util.List; + +/** + * Persistance du TrPostSourceReader composite utilis\xE9 pour les sauvegardes suites de calcul. + * Contient plusieurs ids vers les TrPostSourceReaderInterface correspondants. + * + * @author Adrien Hadoux + */ +public class TrPostSourcePersistComposite { + + /** + * Liste des id des fichiers qui composent la suite. + */ + public List<String> listeIdFicResu; + + public String Id; + + /** + * Utiliser par la serialization. + */ + TrPostSourcePersistComposite(){ + listeIdFicResu=new ArrayList<String>(); + } + + /** + * Constructeur qui se charge de remplir les donn\x... [truncated message content] |
From: <emm...@us...> - 2009-01-27 16:39:02
|
Revision: 4411 http://fudaa.svn.sourceforge.net/fudaa/?rev=4411&view=rev Author: emmanuel_martin Date: 2009-01-27 16:38:58 +0000 (Tue, 27 Jan 2009) Log Message: ----------- Tache #159 : "Export d'un fichier .st : Ajouter le nombre de points dans l'entete de chaque profil" Modified Paths: -------------- branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/rubar/io/RubarStWriter.java Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/rubar/io/RubarStWriter.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/rubar/io/RubarStWriter.java 2009-01-27 15:46:01 UTC (rev 4410) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/rubar/io/RubarStWriter.java 2009-01-27 16:38:58 UTC (rev 4411) @@ -81,20 +81,20 @@ for (int i = 0; i < profs_.getNumGeometries(); i++) { HashMap<Integer,ArrayList<Integer>> pts2ld=bldirs?pts2lds_[i]:null; String name; + final CoordinateSequence str = ((LineString) profs_.getGeometry(i)).getCoordinateSequence(); if (isSt_) { if (attName==-1||(name=(String)profs_.getValue(attName, i))==null) name=""; writer.setSpaceBefore(false); writer.stringField(6, name); writer.stringField(5, ""); writer.doubleField(4, 0); - writer.intField(3, 0); + writer.intField(3, str.size()); writer.intField(2, 0); writer.intField(1, 0); writer.intField(0, i+1); writer.writeFields(fmtEntete); writer.setSpaceBefore(true); } - final CoordinateSequence str = ((LineString) profs_.getGeometry(i)).getCoordinateSequence(); for (int k = 0; k < str.size(); k++) { // Un m\xEAme point de profil peut \xEAtre partag\xE9 par plusieurs lignes directrices => On duplique ce point. ArrayList<Integer> idxline=bldirs?pts2ld.get(k):null; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fa...@us...> - 2009-01-27 15:46:05
|
Revision: 4410 http://fudaa.svn.sourceforge.net/fudaa/?rev=4410&view=rev Author: fargeix Date: 2009-01-27 15:46:01 +0000 (Tue, 27 Jan 2009) Log Message: ----------- Fichiers relatifs ?\195?\160 la mise ?\195?\160 jour de Fudaa-Prepro : v0.93 Modified Paths: -------------- trunk/fudaa_devel/aide/src/prepro/src/web/inc.history.en.html trunk/fudaa_devel/aide/src/prepro/src/web/inc.history.fr.html trunk/fudaa_devel/aide/src/prepro/src/web/inc.last-changelog.en.html trunk/fudaa_devel/aide/src/prepro/src/web/inc.last-changelog.fr.html trunk/fudaa_devel/aide/src/prepro/src/web/inc.news.en.html trunk/fudaa_devel/aide/src/prepro/src/web/inc.news.fr.html Modified: trunk/fudaa_devel/aide/src/prepro/src/web/inc.history.en.html =================================================================== --- trunk/fudaa_devel/aide/src/prepro/src/web/inc.history.en.html 2009-01-27 15:45:31 UTC (rev 4409) +++ trunk/fudaa_devel/aide/src/prepro/src/web/inc.history.en.html 2009-01-27 15:46:01 UTC (rev 4410) @@ -1,5 +1,6 @@ <div class="toc"> <ul> + <li><a href="#v092">Version 0.92 (2008-11-03)</a></li> <li><a href="#v091">Version 0.91 (2007-11-29)</a></li> <li><a href="#v090">Versions 0.90 (2007-09-18)</a></li> <li><a href="#v089">Versions 0.89 (2007-06-22)</a></li> @@ -37,6 +38,17 @@ </div> +<h2 id="v092">Version 0.92 (2008-11-03)</h2> + +<h3>Enhancements</h3> +<ul> +<li>TELEMAC :v5p8 dictionaries are availiable</li> +</ul> +<h3>Bugs corrected</h3> +<ul> + <li>the problem of the interpolation between vectors has been corrected</li> +</ul> + <h2 id="v091">Version 0.91 (2007-11-29) </h2> <h3>Enhancements</h3> Modified: trunk/fudaa_devel/aide/src/prepro/src/web/inc.history.fr.html =================================================================== --- trunk/fudaa_devel/aide/src/prepro/src/web/inc.history.fr.html 2009-01-27 15:45:31 UTC (rev 4409) +++ trunk/fudaa_devel/aide/src/prepro/src/web/inc.history.fr.html 2009-01-27 15:46:01 UTC (rev 4410) @@ -1,5 +1,6 @@ <div class="toc"> <ul> + <li><a href="#v092">Version 0.92 (2008-11-03)</a></li> <li><a href="#v091">Version 0.91 (2007-11-29)</a></li> <li><a href="#v090">Version 0.90 (2007-09-18)</a></li> <li><a href="#v089">Version 0.89 (2007-06-22)</a></li> @@ -44,6 +45,17 @@ </div> +<h2 id="v092">Version 0.92 (2008-11-03)</h2> +<h3>Am\xE9liorations</h3> +<ul> + <li>TELEMAC : int\xE9gration des dictionnaires v5p8</li> +<h3>Bogues corrig\xE9s</h3> +<ul> + <li>correction du probl\xE8me de l'interpolation de vecteurs</li> + +</ul> + + <h2 id="v091">Version 0.91 (2007-11-29)</h2> <h3>Bogues corrig\xE9s</h3> Modified: trunk/fudaa_devel/aide/src/prepro/src/web/inc.last-changelog.en.html =================================================================== --- trunk/fudaa_devel/aide/src/prepro/src/web/inc.last-changelog.en.html 2009-01-27 15:45:31 UTC (rev 4409) +++ trunk/fudaa_devel/aide/src/prepro/src/web/inc.last-changelog.en.html 2009-01-27 15:46:01 UTC (rev 4410) @@ -1,10 +1,8 @@ <h2>Change Log</h2> -<h3>Enhancements</h3> -<ul> -<li>TELEMAC :v5p8 dictionaries are availiable</li> -</ul> <h3>Bugs corrected</h3> <ul> - <li>the problem of the interpolation between vectors has been corrected</li> + <li>error when trying to display node numbers</li> + <li>problems to select several layers at the same time</li> + <li>error while generating INP files (Reflux chain)</li> </ul> \ No newline at end of file Modified: trunk/fudaa_devel/aide/src/prepro/src/web/inc.last-changelog.fr.html =================================================================== --- trunk/fudaa_devel/aide/src/prepro/src/web/inc.last-changelog.fr.html 2009-01-27 15:45:31 UTC (rev 4409) +++ trunk/fudaa_devel/aide/src/prepro/src/web/inc.last-changelog.fr.html 2009-01-27 15:46:01 UTC (rev 4410) @@ -1,10 +1,8 @@ <h2>Derni\xE8res modifications</h2> -<h3>Am\xE9liorations</h3> -<ul> - <li>TELEMAC : int\xE9gration des dictionnaires v5p8</li> <h3>Bogues corrig\xE9s</h3> <ul> - <li>correction du probl\xE8me de l'interpolation de vecteurs</li> - + <li>impossibilit\xE9 d'afficher les num\xE9ros de noeuds</li> + <li>impossibilit\xE9 de s\xE9lectionner plusieurs calques simultan\xE9ment</li> + <li>erreur \xE0 la g\xE9n\xE9ration de fichiers INP (chaine Reflux)</li> </ul> \ No newline at end of file Modified: trunk/fudaa_devel/aide/src/prepro/src/web/inc.news.en.html =================================================================== --- trunk/fudaa_devel/aide/src/prepro/src/web/inc.news.en.html 2009-01-27 15:45:31 UTC (rev 4409) +++ trunk/fudaa_devel/aide/src/prepro/src/web/inc.news.en.html 2009-01-27 15:46:01 UTC (rev 4410) @@ -3,7 +3,7 @@ <tr> <th colspan="1" rowspan="1"> - <p><?php preproVersionDate() ?>:</p> + <p><?php preproVersionDate() ?></p> </th> <td colspan="1" rowspan="1"> <p><a href="download.en.php">New version: <?php preproVersion() ?></a></p> @@ -11,6 +11,14 @@ </tr> <tr> <th colspan="1" rowspan="1"> + <p>2008-11-03</p> + </th> + <td colspan="1" rowspan="1"> + <p>New version: 0.92</p> + </td> + </tr> + <tr> + <th colspan="1" rowspan="1"> <p>2007-11-29</p> </th> <td colspan="1" rowspan="1"> Modified: trunk/fudaa_devel/aide/src/prepro/src/web/inc.news.fr.html =================================================================== --- trunk/fudaa_devel/aide/src/prepro/src/web/inc.news.fr.html 2009-01-27 15:45:31 UTC (rev 4409) +++ trunk/fudaa_devel/aide/src/prepro/src/web/inc.news.fr.html 2009-01-27 15:46:01 UTC (rev 4410) @@ -2,12 +2,20 @@ <tbody> <tr> <th colspan="1" rowspan="1"> - <p><?php preproVersionDate() ?>:</p> + <p><?php preproVersionDate() ?></p> </th> <td colspan="1" rowspan="1"> <p><a href="download.fr.php">Nouvelle version: <?php preproVersion() ?></a></p> </td> </tr> + <tr> + <th colspan="1" rowspan="1"> + <p>2008-11-03</p> + </th> + <td colspan="1" rowspan="1"> + <p>Nouvelle version: 0.92</p> + </td> + </tr> <tr> <th colspan="1" rowspan="1"> <p>2007-11-29</p> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fa...@us...> - 2009-01-27 15:45:37
|
Revision: 4408 http://fudaa.svn.sourceforge.net/fudaa/?rev=4408&view=rev Author: fargeix Date: 2009-01-27 15:45:30 +0000 (Tue, 27 Jan 2009) Log Message: ----------- Fichiers relatifs ?\195?\160 la mise ?\195?\160 jour de Fudaa-Prepro : v0.93 Modified Paths: -------------- trunk/fudaa_devel/fudaa-distrib/prepro/prepro.properties Modified: trunk/fudaa_devel/fudaa-distrib/prepro/prepro.properties =================================================================== --- trunk/fudaa_devel/fudaa-distrib/prepro/prepro.properties 2009-01-27 15:34:03 UTC (rev 4407) +++ trunk/fudaa_devel/fudaa-distrib/prepro/prepro.properties 2009-01-27 15:45:30 UTC (rev 4408) @@ -1,7 +1,7 @@ -@version@=0.92 -...@ve...le@=092 +@version@=0.93 +...@ve...le@=093 @exe.size@=22 Mo @jar.size@=22 Mo @jnlp.size@=13 Mo @zip.size@=22 Mo -@version.date@=2008-11-03 \ No newline at end of file +@version.date@=2009-01-27 \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <emm...@us...> - 2009-01-27 15:45:33
|
Revision: 4409 http://fudaa.svn.sourceforge.net/fudaa/?rev=4409&view=rev Author: emmanuel_martin Date: 2009-01-27 15:45:31 +0000 (Tue, 27 Jan 2009) Log Message: ----------- Tache #162 : "Import de fichiers rubar : conserver les points confondus" Modified Paths: -------------- branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/rubar/io/RubarStReader.java Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/rubar/io/RubarStReader.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/rubar/io/RubarStReader.java 2009-01-27 15:45:30 UTC (rev 4408) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/rubar/io/RubarStReader.java 2009-01-27 15:45:31 UTC (rev 4409) @@ -66,6 +66,8 @@ if (in_ == null) { return null; } + // Vrai si les points dupliqu\xE9 doivent le rester. + boolean keepDuplicatePoints=true; in_.setJumpBlankLine(true); in_.setBlankZero(true); in_.setCommentInOneField("#"); @@ -94,7 +96,7 @@ while (!isSep(first) && !isSep(sec)) { Coordinate coordinate = new Coordinate(in_.doubleField(0), in_.doubleField(1), in_.doubleField(2)); // dans les fichier st, il se peut qu'il y ait des points en double, donc on fait ce test: - if (last == null || !last.equals2D(coordinate)) { + if (last == null || keepDuplicatePoints || !last.equals2D(coordinate)) { coordinatesEnCours.add(coordinate); last = coordinate; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <emm...@us...> - 2009-01-27 15:34:05
|
Revision: 4407 http://fudaa.svn.sourceforge.net/fudaa/?rev=4407&view=rev Author: emmanuel_martin Date: 2009-01-27 15:34:03 +0000 (Tue, 27 Jan 2009) Log Message: ----------- Modifications mineurs Modified Paths: -------------- branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/rubar/io/RubarStReader.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/EbliSingleObjectEditorPanel.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZEditorDefault.java Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/rubar/io/RubarStReader.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/rubar/io/RubarStReader.java 2009-01-27 15:07:27 UTC (rev 4406) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/rubar/io/RubarStReader.java 2009-01-27 15:34:03 UTC (rev 4407) @@ -71,11 +71,11 @@ in_.setCommentInOneField("#"); in_.setJumpCommentLine(true); - final List lignes = new ArrayList(200); - final List names=new ArrayList(200); - final List coordinatesEnCours = new ArrayList(); + final List<LineString> lignes = new ArrayList<LineString>(200); + final List<String> names=new ArrayList<String>(200); + final List<Coordinate> coordinatesEnCours = new ArrayList<Coordinate>(); // Contient les listes de coordonn\xE9es pour les lignes directrices (Map<String,ArrayList<Coordinate>> en Java 1.5) - final Map mdirs=new HashMap(20); + final Map<String, List<Coordinate>> mdirs=new HashMap<String, List<Coordinate>>(20); final int[] fmt = new int[] { 13, 13, 13, 1, 3 }; final int[] fmt1Line=new int[]{6,6,6,6,13,1,42}; @@ -102,12 +102,12 @@ // Ligne directrice eventuelle. Pas de controle que la ligne directrice est bien sur tous les profils. String namedir=in_.stringField(4).trim(); if (!"".equals(namedir)) { - List coordldir=(List)mdirs.get(namedir); + List<Coordinate> coordldir=(List<Coordinate>)mdirs.get(namedir); if (coordldir==null) { - coordldir=new ArrayList(200); + coordldir=new ArrayList<Coordinate>(200); mdirs.put(namedir,coordldir); } - coordldir.add(last.clone()); + coordldir.add((Coordinate) last.clone()); } in_.readFields(fmt); @@ -172,7 +172,7 @@ String[] namedirs=(String[])mdirs.keySet().toArray(new String[0]); LineString[] ldirs=new LineString[namedirs.length]; for (int i=0; i<namedirs.length; i++) { - ldirs[i]=GISLib.createLineOrLinearFromList((List)(mdirs.get(namedirs[i]))); + ldirs[i]=GISLib.createLineOrLinearFromList((List<Coordinate>)(mdirs.get(namedirs[i]))); } zdirs.addAllLineStringClosedOrNode(ldirs, null); Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/EbliSingleObjectEditorPanel.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/EbliSingleObjectEditorPanel.java 2009-01-27 15:07:27 UTC (rev 4406) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/EbliSingleObjectEditorPanel.java 2009-01-27 15:34:03 UTC (rev 4407) @@ -648,7 +648,7 @@ tabbedPane_.add(EbliLib.getS("Courbe"), courbeRep_); add(tabbedPane_, BuBorderLayout.CENTER); } - if (zone_.getIndiceOf(zAttr)==-1) { + else { modelData_=new TableModelModeleAdapter(modeleSrc_, idx_, _xyFormatter, new CtuluCommandComposite(), _editVertexAttribut); tableRep_=new TableRepresentation(_editAttribut, _editVertexAttribut, _xyFormatter); add(tableRep_, BuBorderLayout.CENTER); @@ -697,8 +697,10 @@ public void cancel() { super.cancel(); // D\xE9active le model - modelData_.setSource(null, -1); - ((CtuluCommandComposite) modelData_.getUndoRedoContainer()).undo(); + if (modelData_!=null) { + modelData_.setSource(null, -1); + ((CtuluCommandComposite)modelData_.getUndoRedoContainer()).undo(); + } } public final CtuluCommandContainer getCmd() { Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZEditorDefault.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZEditorDefault.java 2009-01-27 15:07:27 UTC (rev 4406) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZEditorDefault.java 2009-01-27 15:34:03 UTC (rev 4407) @@ -53,9 +53,6 @@ import org.fudaa.ebli.trace.TraceIcon; import com.memoire.bu.BuDesktop; -import com.memoire.bu.BuInternalFrame; -import com.memoire.bu.BuLabel; -import com.memoire.bu.BuPopupWindow; import com.memoire.bu.BuResource; import com.memoire.fu.Fu; import com.memoire.fu.FuLog; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <emm...@us...> - 2009-01-27 15:07:33
|
Revision: 4406 http://fudaa.svn.sourceforge.net/fudaa/?rev=4406&view=rev Author: emmanuel_martin Date: 2009-01-27 15:07:27 +0000 (Tue, 27 Jan 2009) Log Message: ----------- Tache #153 : "Ajouter l'indice des sommets dans les listes de sommets pour une g?\195?\169om?\195?\169trie (fenetre d'?\195?\169dition, modeleur 1D)" Modified Paths: -------------- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/VueTableau.java Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/VueTableau.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/VueTableau.java 2009-01-27 14:45:39 UTC (rev 4405) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/VueTableau.java 2009-01-27 15:07:27 UTC (rev 4406) @@ -7,15 +7,18 @@ */ package org.fudaa.fudaa.modeleur.modeleur1d.view; +import java.awt.Component; import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.Box; import javax.swing.BoxLayout; +import javax.swing.JLabel; import javax.swing.JTable; import javax.swing.SwingUtilities; import javax.swing.event.ListSelectionListener; +import javax.swing.table.DefaultTableCellRenderer; import javax.swing.table.DefaultTableModel; import org.fudaa.ctulu.CtuluCommandComposite; @@ -53,7 +56,7 @@ protected EbliFormatterInterface formater_; public TableGeomModel(ProfilContainer _data, EbliFormatterInterface _formater){ - super(new String[]{FudaaLib.getS("Abs curv"), FudaaLib.getS("Z")}, 0); + super(new String[]{FudaaLib.getS("Index"), FudaaLib.getS("Abs curv"), FudaaLib.getS("Z")}, 0); formater_=_formater; if(_data==null) throw new IllegalArgumentException("_data ne doit pas \xEAtre null."); @@ -105,7 +108,16 @@ updateAbscisseCurvAxeHydraulique(); } + public boolean isCellEditable(int row, int column) { + if(column==0) + return false; + else + return true; + } + public Class<?> getColumnClass(int columnIndex) { + if(columnIndex==0) + return Integer.class; return Double.class; } @@ -118,6 +130,8 @@ public Object getValueAt(int rowIndex, int columnIndex) { if(columnIndex==0) + return rowIndex+1; + else if(columnIndex==1) if(formater_!=null) return formater_.getXYFormatter().format(data_.getCurv(rowIndex)); else @@ -131,7 +145,7 @@ public void setValueAt(Object value, int rowIndex, int columnIndex) { controller_.clearError(); - if(columnIndex==0) + if(columnIndex==1) try { data_.setCurv(rowIndex, (Double) value, controller_.getCommandManager()); } @@ -158,6 +172,14 @@ // Tableau modelTable_=new TableGeomModel(_data, controller_.getFormater()); table_=new CtuluTable(modelTable_); + table_.getColumnModel().getColumn(0).setCellRenderer(new DefaultTableCellRenderer(){ + public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, + int column) { + JLabel c=(JLabel) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); + c.setHorizontalAlignment(SwingUtilities.CENTER); + return c; + } + }); add(new BuScrollPane(table_), BuBorderLayout.CENTER); // Abscisse curviligne du profil sur l'axe hydraulique tfAxeHydraulique_.setHorizontalAlignment(SwingUtilities.CENTER); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |