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: <bma...@us...> - 2008-11-20 13:41:22
|
Revision: 4230 http://fudaa.svn.sourceforge.net/fudaa/?rev=4230&view=rev Author: bmarchan Date: 2008-11-20 13:41:12 +0000 (Thu, 20 Nov 2008) Log Message: ----------- Labels d'actions modifi?\195?\169s. Modified Paths: -------------- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/action/SceneShowOrientationAction.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/action/SceneInvertAction.java Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/action/SceneShowOrientationAction.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/action/SceneShowOrientationAction.java 2008-11-20 13:31:40 UTC (rev 4229) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/action/SceneShowOrientationAction.java 2008-11-20 13:41:12 UTC (rev 4230) @@ -22,14 +22,14 @@ /** * Une action pour montrer l'orientation des lignes dans les calques. * @author Emmanuel MARTIN - * @version $Id:$ + * @version $Id$ */ public class SceneShowOrientationAction extends EbliActionChangeState implements TreeModelListener { protected BArbreCalqueModel treeModel_; public SceneShowOrientationAction(BArbreCalqueModel _treeModel) { - super(EbliLib.getS("Affichage du sens des lignes"), BuResource.BU.getIcon("fleche"), "SHOW_ORIENTATION"); + super(EbliLib.getS("Afficher l'orientation des lignes"), null/*BuResource.BU.getIcon("fleche")*/, "SHOW_ORIENTATION"); treeModel_=_treeModel; treeModel_.addTreeModelListener(this); setEnabled(true); Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/action/SceneInvertAction.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/action/SceneInvertAction.java 2008-11-20 13:31:40 UTC (rev 4229) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/action/SceneInvertAction.java 2008-11-20 13:41:12 UTC (rev 4230) @@ -21,14 +21,14 @@ /** * Action permettant le changement de sens des polylignes selectionn\xE9es. * @author Emmanuel MARTIN - * @version $Id:$ + * @version $Id$ */ public class SceneInvertAction extends EbliActionSimple implements ZSelectionListener { protected MdlSceneEditor sceneEditor_; public SceneInvertAction(MdlSceneEditor _sceneEditor){ - super(EbliResource.EBLI.getString("Inverser"), null, "INVERSER"); + super(EbliResource.EBLI.getString("Inverser l'orientation"), null, "INVERSER"); sceneEditor_=_sceneEditor; sceneEditor_.getScene().addSelectionListener(this); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <emm...@us...> - 2008-11-20 13:31:45
|
Revision: 4229 http://fudaa.svn.sourceforge.net/fudaa/?rev=4229&view=rev Author: emmanuel_martin Date: 2008-11-20 13:31:40 +0000 (Thu, 20 Nov 2008) Log Message: ----------- modification du comportement de la boite de distance et correction de bug a propos des listeners de la tableau de visibilit?\195?\169. Modified Paths: -------------- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/action/SceneShowDistanceAction.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/BPaletteDistance.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/BPaletteEditVisibility.java Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/action/SceneShowDistanceAction.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/action/SceneShowDistanceAction.java 2008-11-20 13:21:24 UTC (rev 4228) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/action/SceneShowDistanceAction.java 2008-11-20 13:31:40 UTC (rev 4229) @@ -27,7 +27,7 @@ * points. * * @author Emmanuel MARTIN - * @version $Id:$ + * @version $Id$ */ public class SceneShowDistanceAction extends EbliActionPaletteSpecAbstract implements PropertyChangeListener { @@ -75,8 +75,10 @@ // Cas un autre calque que celui du zoom, du deplacement de vue et d'edition // est d\xE9gel\xE9 donc on ferme le pannel d'edition si il \xE9tait ouvert. if (_evt.getSource()!=calqueZoom_&&_evt.getSource()!=calqueDeplacementVue_&&_evt.getSource()!=calqueDistance_ - &&!((Boolean)_evt.getNewValue()).booleanValue()) { + &&!((Boolean)_evt.getNewValue()).booleanValue()&&isSelected()) { calqueDistance_.cancelEdition(); + setSelected(false); + super.changeAction(); } } Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/BPaletteDistance.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/BPaletteDistance.java 2008-11-20 13:21:24 UTC (rev 4228) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/BPaletteDistance.java 2008-11-20 13:31:40 UTC (rev 4229) @@ -30,7 +30,7 @@ /** * Palette affichant les informations de distances. * @author Emmanuel MARTIN - * @version $Id:$ + * @version $Id$ */ public class BPaletteDistance extends BuPanel implements ActionListener, BPalettePanelInterface, PropertyChangeListener { @@ -41,7 +41,7 @@ /** Le calque qui contient les informations de distance. */ protected ZCalqueDistanceInteraction calqueDistance_; /** Le bouton 'continuer'. */ - protected BuButton btContinuer_=new BuButton(EbliLib.getS("Continuer")); + protected BuButton btContinuer_=new BuButton(EbliLib.getS("Reprise")); protected EbliFormatterInterface formatter_; private ZEbliCalquesPanel calquesPanel_; Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/BPaletteEditVisibility.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/BPaletteEditVisibility.java 2008-11-20 13:21:24 UTC (rev 4228) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/BPaletteEditVisibility.java 2008-11-20 13:31:40 UTC (rev 4229) @@ -1,6 +1,6 @@ /* * @creation 23 oct. 2008 - * @modification $Date:$ + * @modification $Date$ * @license GNU General Public License 2 * @copyright (c)1998-2008 CETMEF 2 bd Gambetta F-60231 Compiegne * @mail fud...@li... @@ -215,9 +215,11 @@ boolean selected=table_.getSelectionModel().isSelectedIndex(rowIndex); if(columnIndex==0){ rows_[rowIndex][columnIndex]=value; + listenSelection=false; fireTableDataChanged(); if(selected) table_.getSelectionModel().addSelectionInterval(rowIndex, rowIndex); + listenSelection=true; } else if(columnIndex==1){ if (rows_[rowIndex][columnIndex]!=value) { @@ -232,9 +234,11 @@ for (int i=rowIndex+1; i<rows_.length; i++) newRows[i-1]=rows_[i]; rows_=newRows; + listenSelection=false; fireTableDataChanged(); if (selected) table_.getSelectionModel().addSelectionInterval(rowIndex, rowIndex); + listenSelection=true; } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bma...@us...> - 2008-11-20 13:21:27
|
Revision: 4228 http://fudaa.svn.sourceforge.net/fudaa/?rev=4228&view=rev Author: bmarchan Date: 2008-11-20 13:21:24 +0000 (Thu, 20 Nov 2008) Log Message: ----------- Report correctif pour une selection multicalques sur FudaaPrepro depuis branche trunk. Modified Paths: -------------- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/BArbreCalqueModel.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlVisuPanel.java Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/BArbreCalqueModel.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/BArbreCalqueModel.java 2008-11-20 13:15:57 UTC (rev 4227) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/BArbreCalqueModel.java 2008-11-20 13:21:24 UTC (rev 4228) @@ -97,7 +97,7 @@ */ public BArbreCalqueModel(final BGroupeCalque _calque, final boolean _listener) { selection_ = new DefaultTreeSelectionModel(); - setSelectionMultiCalques(false); + setSelectionMultiCalques(true); mustListen_ = _listener; calque_ = _calque; if ((calque_ != null) && (calque_.isGroupeCalque())) { 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 2008-11-20 13:15:57 UTC (rev 4227) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlVisuPanel.java 2008-11-20 13:21:24 UTC (rev 4228) @@ -67,6 +67,7 @@ */ public MdlVisuPanel(FudaaCommonImplementation _impl/*, boolean _createDefault*/) { super(_impl); + modelArbre_.setSelectionMultiCalques(false); initCalques(true); installLayerActions(); getScene().setRestrictedToCalqueActif(false); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bma...@us...> - 2008-11-20 13:16:03
|
Revision: 4227 http://fudaa.svn.sourceforge.net/fudaa/?rev=4227&view=rev Author: bmarchan Date: 2008-11-20 13:15:57 +0000 (Thu, 20 Nov 2008) Log Message: ----------- Correction pour une selection multicalques sur FudaaPrepro Modified Paths: -------------- trunk/fudaa_devel/ebli/src/org/fudaa/ebli/calque/BArbreCalqueModel.java trunk/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlVisuPanel.java Modified: trunk/fudaa_devel/ebli/src/org/fudaa/ebli/calque/BArbreCalqueModel.java =================================================================== --- trunk/fudaa_devel/ebli/src/org/fudaa/ebli/calque/BArbreCalqueModel.java 2008-11-20 09:16:37 UTC (rev 4226) +++ trunk/fudaa_devel/ebli/src/org/fudaa/ebli/calque/BArbreCalqueModel.java 2008-11-20 13:15:57 UTC (rev 4227) @@ -146,7 +146,7 @@ */ public BArbreCalqueModel(final BGroupeCalque _calque, final boolean _listener) { selection_ = new DefaultTreeSelectionModel(); - setSelectionMultiCalques(false); + setSelectionMultiCalques(true); mustListen_ = _listener; calque_ = _calque; if ((calque_ != null) && (calque_.isGroupeCalque())) { Modified: trunk/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlVisuPanel.java =================================================================== --- trunk/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlVisuPanel.java 2008-11-20 09:16:37 UTC (rev 4226) +++ trunk/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlVisuPanel.java 2008-11-20 13:15:57 UTC (rev 4227) @@ -58,6 +58,7 @@ */ public MdlVisuPanel(FudaaCommonImplementation _impl/*, boolean _createDefault*/) { super(_impl); + modelArbre_.setSelectionMultiCalques(false); initCalques(true); installLayerActions(); getScene().setRestrictedToCalqueActif(false); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <emm...@us...> - 2008-11-20 09:16:43
|
Revision: 4226 http://fudaa.svn.sourceforge.net/fudaa/?rev=4226&view=rev Author: emmanuel_martin Date: 2008-11-20 09:16:37 +0000 (Thu, 20 Nov 2008) Log Message: ----------- am?\195?\169lioration tache #88 Modified Paths: -------------- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZCalqueLigneBrisee.java Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZCalqueLigneBrisee.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZCalqueLigneBrisee.java 2008-11-19 09:52:12 UTC (rev 4225) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZCalqueLigneBrisee.java 2008-11-20 09:16:37 UTC (rev 4226) @@ -609,8 +609,29 @@ ptOrig.autoApplique(versEcran); ptDest.autoApplique(versEcran); // Dessin de la fleche - if(showLineOrientation_) - tl.dessineFleche(_g, (int)ptOrig.x_, (int)ptOrig.y_, (int)ptDest.x_, (int)ptDest.y_, 11, 5); + if(showLineOrientation_){ + // La point de la fleche doit petre LISSE \\ + // Calcule du vecteur entre les deux points + double vecX=ptDest.x_-ptOrig.x_; + double vecY=ptDest.y_-ptOrig.y_; + // Normalisation et rectification de l'erreur d'arrondi. Puissance et + // racine carr\xE9 entrainent des erreurs d'arrondis visible, donc + // inutilisables. + while(vecX>10||vecY>10||vecX<-10||vecY<-10){ + vecX=vecX/2; + vecY=vecY/2; + } + // Cr\xE9ation d'un point interm\xE9diare + double ptInterX=ptDest.x_-vecX; + double ptInterY=ptDest.y_-vecY; + // La barre de la fleche est normale + tl.dessineTrait(_g, ptOrig.x_, ptOrig.y_, ptInterX, ptInterY); + // La point est lisse + int typeTrait=tl.getTypeTrait(); + tl.setTypeTrait(TraceLigne.LISSE); + tl.dessineFleche(_g, (int)ptInterX, (int)ptInterY, (int)ptDest.x_, (int)ptDest.y_, 11, 5); + tl.setTypeTrait(typeTrait); + } else tl.dessineTrait(_g, ptOrig.x_, ptOrig.y_, ptDest.x_, ptDest.y_); // Dessin du reste de la ligne This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <emm...@us...> - 2008-11-19 09:52:17
|
Revision: 4225 http://fudaa.svn.sourceforge.net/fudaa/?rev=4225&view=rev Author: emmanuel_martin Date: 2008-11-19 09:52:12 +0000 (Wed, 19 Nov 2008) Log Message: ----------- bugfix #88 Modified Paths: -------------- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZCalqueLigneBrisee.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/layer/MdlModel2dLine.java Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZCalqueLigneBrisee.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZCalqueLigneBrisee.java 2008-11-18 21:54:47 UTC (rev 4224) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZCalqueLigneBrisee.java 2008-11-19 09:52:12 UTC (rev 4225) @@ -574,45 +574,55 @@ if (nbPoints <= 0) { continue; } - - final GrPoint ptOri = new GrPoint(); - modele_.point(ptOri, i, nbPoints - 1); - ptOri.autoApplique(versEcran); if (!isRapide()) initTrace(ligneModel, i); - final GrPoint ptDest = new GrPoint(); - // Dessine le premier segment avec une fleche si l'option est activ\xE9e - if(nbPoints>=2){ - modele_.point(ptDest, i, nbPoints - 2); - ptDest.autoApplique(versEcran); - // Pour les polygone \xE7a se passe plus loin - if(showLineOrientation_&&!modele_.isGeometryFermee(i)) - tl.dessineFleche(_g, (int)ptDest.x_, (int)ptDest.y_, (int)ptOri.x_, (int)ptOri.y_, 5, 3); - else - tl.dessineTrait(_g, ptOri.x_, ptOri.y_, ptDest.x_, ptDest.y_); - ptOri.initialiseAvec(ptDest); + + if(nbPoints <2) + continue; + + // Affichage de la polyligne ou polygone \\ + /* + * On part de la fin pour commencer \xE0 afficher la fleche si l'option est + * activ\xE9e. Pour \xEAtre sur que la fleche s'affiche correctement, on + * recherche deux points non confondus. + */ + GrPoint ptDest=new GrPoint(); + GrPoint ptOrig=new GrPoint(); + int j; + // Si c'est une polyligne on prend le dernier point si c'est un polygone, + // on prend le premier (le permier et le dernier doivent \xEAtre confondus). + if(modele_.isGeometryFermee(i)){ + modele_.point(ptDest, i, 0); + modele_.point(ptOrig, i, nbPoints-1); + j=nbPoints-1; } - // Dessine le reste - for (int j = nbPoints - 3; j >= 0; j--) { - // le point de dest est initialise - modele_.point(ptDest, i, j); - ptDest.autoApplique(versEcran); - tl.dessineTrait(_g, ptOri.x_, ptOri.y_, ptDest.x_, ptDest.y_); - ptOri.initialiseAvec(ptDest); + else { + modele_.point(ptDest, i, nbPoints-1); + modele_.point(ptOrig, i, nbPoints-2); + j=nbPoints-2; } - if (modele_.isGeometryFermee(i)) { - modele_.point(ptOri, i, nbPoints - 1); - ptOri.autoApplique(versEcran); - // La fl\xE8che pour les polygone - if(showLineOrientation_) - tl.dessineFleche(_g, (int)ptOri.x_, (int)ptOri.y_, (int)ptDest.x_, (int)ptDest.y_, 5, 3); - else - tl.dessineTrait(_g, ptOri.x_, ptOri.y_, ptDest.x_, ptDest.y_); + // Recherche du point pr\xE9c\xE9dent non identique + while(ptOrig.x_==ptDest.x_&&ptOrig.y_==ptDest.y_&&j>0) + modele_.point(ptOrig, i, --j); + if(j==0&&(ptOrig.x_==ptDest.x_&&ptOrig.y_==ptDest.y_)) + continue; + ptOrig.autoApplique(versEcran); + ptDest.autoApplique(versEcran); + // Dessin de la fleche + if(showLineOrientation_) + tl.dessineFleche(_g, (int)ptOrig.x_, (int)ptOrig.y_, (int)ptDest.x_, (int)ptDest.y_, 11, 5); + else + tl.dessineTrait(_g, ptOrig.x_, ptOrig.y_, ptDest.x_, ptDest.y_); + // Dessin du reste de la ligne + j--; + for(;j>=0;j--){ + ptDest.initialiseAvec(ptOrig); + modele_.point(ptOrig, i, j); + ptOrig.autoApplique(versEcran); + tl.dessineTrait(_g, ptOrig.x_, ptOrig.y_, ptDest.x_, ptDest.y_); } - modele_.point(ptOri, i, nbPoints - 1); - ptOri.autoApplique(versEcran); } - + // on trace les icones apres pour qu'ils soient dessin\xE9s au-dessus des lignes. if (icone != null && !isRapide()) { for (int i = nombre - 1; i >= 0; i--) { Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/layer/MdlModel2dLine.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/layer/MdlModel2dLine.java 2008-11-18 21:54:47 UTC (rev 4224) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/layer/MdlModel2dLine.java 2008-11-19 09:52:12 UTC (rev 4225) @@ -16,6 +16,7 @@ import org.fudaa.ctulu.CtuluListSelection; import org.fudaa.ctulu.CtuluListSelectionInterface; import org.fudaa.ctulu.CtuluNamedCommand; +import org.fudaa.ctulu.gis.GISAttributeModel; import org.fudaa.ctulu.gis.GISGeometryFactory; import org.fudaa.ctulu.gis.GISPolyligne; import org.fudaa.ctulu.gis.GISZoneCollectionLigneBrisee; @@ -262,6 +263,8 @@ * @param _cmd Le container de commandes. */ public void invertOrientation(final int _idxGeom, CtuluCommandContainer _cmd){ + CtuluCommandComposite cmd=new CtuluCommandComposite(); + // Inversion des coordonn\xE9es LineString geom=(LineString)getGeomData().getGeometry(_idxGeom); CoordinateSequence seq=geom.getCoordinateSequence(); for(int i=0;i<seq.size()/2;i++) @@ -270,9 +273,21 @@ seq.setOrdinate(i, j, seq.getOrdinate(seq.size()-1-i, j)); seq.setOrdinate(seq.size()-1-i, j, valTmp); } + // Inversion des attributs + for(int i=0;i<getAttributeNb();i++) + if(getAttribute(i).isAtomicValue()){ + GISAttributeModel values=(GISAttributeModel) getDataModel(i).getObjectValueAt(_idxGeom); + for(int j=0;j<values.getSize()/2;j++){ + Object valTmp=values.getObjectValueAt(j); + values.setObject(j, values.getObjectValueAt(values.getSize()-1-j), cmd); + values.setObject(values.getSize()-1-j, valTmp, cmd); + } + } + // Fires fireModelAction(_idxGeom, geom, ZModelListener.GEOMETRY_ACTION_MODIFY); - if (_cmd!=null) - _cmd.addCmd(new CtuluNamedCommand() { + fireAttributeValueChangeAction(this, -1, null, _idxGeom, null); + if (_cmd!=null){ + cmd.addCmd(new CtuluNamedCommand() { public void redo() { invertOrientation(_idxGeom, null); } @@ -283,5 +298,7 @@ return FudaaLib.getS("Inversion de l'orientation"); } }); + _cmd.addCmd(cmd.getSimplify()); + } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bma...@us...> - 2008-11-18 21:54:51
|
Revision: 4224 http://fudaa.svn.sourceforge.net/fudaa/?rev=4224&view=rev Author: bmarchan Date: 2008-11-18 21:54:47 +0000 (Tue, 18 Nov 2008) Log Message: ----------- Correction import projet pour d?\195?\169locker les fichiers lus. Modified Paths: -------------- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlImplementation.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlProjectImportPanel.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 2008-11-18 17:25:33 UTC (rev 4223) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlImplementation.java 2008-11-18 21:54:47 UTC (rev 4224) @@ -23,9 +23,11 @@ import javax.swing.JOptionPane; import javax.swing.filechooser.FileFilter; +import org.fudaa.ctulu.CtuluArkLoader; import org.fudaa.ctulu.CtuluExportDataInterface; import org.fudaa.ctulu.CtuluLib; 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; @@ -437,18 +439,25 @@ public void importProject() { MdlProjectImportPanel pn=new MdlProjectImportPanel(); if (CtuluDialogPanel.isOkResponse(pn.afficheModale(getFrame(), "Import d'un projet"))) { - FudaaSaveZipLoader loader = null; + File f=pn.getFile(); try { - loader = pn.getLoader(); - final FudaaSaveZipLoader finalLoader = loader; + 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, currentFrame_, createTask.getStateReceiver(), finalLoader); + FudaaSaveLib.restoreAndLaunch(MdlImplementation.this, currentFrame_, createTask.getStateReceiver(), loader); // } // }); + + // Liberation du fichier. + loader.close(); } catch (final IOException _evt) { FuLog.error(_evt); Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlProjectImportPanel.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlProjectImportPanel.java 2008-11-18 17:25:33 UTC (rev 4223) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlProjectImportPanel.java 2008-11-18 21:54:47 UTC (rev 4224) @@ -35,36 +35,29 @@ import javax.swing.tree.TreeCellRenderer; import javax.swing.tree.TreePath; -import com.memoire.bu.BuButton; -import com.memoire.bu.BuCheckBox; -import com.memoire.bu.BuHorizontalLayout; -import com.memoire.bu.BuLabel; -import com.memoire.bu.BuRadioButton; -import com.memoire.bu.BuResource; -import com.memoire.bu.BuVerticalLayout; - -import org.fudaa.ctulu.CtuluArkLoader; import org.fudaa.ctulu.CtuluLib; -import org.fudaa.ctulu.CtuluLibString; import org.fudaa.ctulu.gui.CtuluCellRenderer; import org.fudaa.ctulu.gui.CtuluDialogPanel; import org.fudaa.ctulu.gui.CtuluFileChooserPanel; - -import org.fudaa.ebli.calque.BCalquePersistenceGroupe; - -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.MdlImplementation.MdlFileFilter; import org.fudaa.fudaa.modeleur.MdlProjectImportTreeModel.LayerNode; import org.fudaa.fudaa.sig.FSigLib; -import org.fudaa.fudaa.tr.common.TrProjectPersistence; import org.fudaa.fudaa.tr.common.TrResource; +import com.memoire.bu.BuInformationsSoftware; +import com.memoire.bu.BuLabel; +import com.memoire.bu.BuRadioButton; +import com.memoire.bu.BuResource; +import com.memoire.bu.BuVerticalLayout; +import com.memoire.fu.FuLog; + /** * @author fred deniger * @version $Id: MdlProjectImportPanel.java,v 1.1.2.1 2008/05/13 12:10:21 bmarchan Exp $ */ -public class MdlProjectImportPanel extends CtuluDialogPanel implements DocumentListener { +public class MdlProjectImportPanel extends CtuluDialogPanel { public static class CellRenderer extends JLabel implements TreeCellRenderer { @@ -113,6 +106,7 @@ MdlFileFilter flt_; JTree trLayers_; FudaaSaveZipLoader loader_=null; + String[] ignoredLayers=new String[0]; public MdlProjectImportPanel() { ActionListener rbListener=new ActionListener() { @@ -133,7 +127,7 @@ public void caretUpdate(CaretEvent e) { if (!filename_.equals(pn_.getTf().getText())) { filename_=pn_.getTf().getText(); - loader_=null; + closeLoader(); rbAllLayers_.doClick(); setErrorText(null); } @@ -172,7 +166,6 @@ add(sp); rbAllLayers_.doClick(); - pn_.getTf().getDocument().addDocumentListener(this); } @@ -190,13 +183,26 @@ } } - for (LayerNode nd : nds) { - loader_.setOption(CtuluArkLoader.OPTION_LAYER_IGNORE+nd.name_,CtuluLibString.toString(true)); + ignoredLayers=new String[nds.size()]; + for (int i=0; i<ignoredLayers.length; i++) { + ignoredLayers[i]=nds.get(i).name_; } } + closeLoader(); return true; } + public void cancel() { + closeLoader(); + } + + private void closeLoader() { + if (loader_!=null) { + try { loader_.close(); } catch (IOException _exc) {} + } + loader_=null; + } + private List<LayerNode> getChildrenLeafs(LayerNode _nd) { List<LayerNode> r=new ArrayList<LayerNode>(); int nb=_nd.getChildCount(); @@ -214,7 +220,7 @@ } private boolean isFileOK() { - loader_=null; + closeLoader(); final File f = pn_.getFile(); if (f == null || !f.exists()) { setErrorText(CtuluLib.getS("Le fichier n'existe pas")); @@ -234,48 +240,21 @@ try { // if (isFileOK()) { loader_=new FudaaSaveZipLoader(pn_.getFile()); + BuInformationsSoftware is=FudaaSaveProject.getSoftwareInfos(loader_); + FuLog.warning("File version : "+(is.version==null ? "Undefined":is.version)); // } } catch (IOException _exc) { setErrorText(TrResource.getS("Le fichier n'est pas accessible")); } return loader_; -// trLayers_.setModel(new MdlProjectImportTreeModel(loader_)); -// trLayers_.setVisible(true); - -// rbSelectedLayers_.setEnabled(loader_!=null); -// rbAllLayers_.setEnabled(loader_!=null); } - public void changedUpdate(final DocumentEvent _e) { -// valide(); + public File getFile() { + return pn_.getFile(); } - - public void insertUpdate(final DocumentEvent _e) { -// valide(); + + public String[] getIgnoredLayers() { + return ignoredLayers; } - - public void removeUpdate(final DocumentEvent _e) { -// valide(); - } - - public FudaaSaveZipLoader getLoader() throws IOException { -// if (cbNoNewCalque_.isSelected()) { -// res.setOption("option.inNewLayers", CtuluLibString.toString(false)); -// res.setOption(BCalquePersistenceGroupe.getNoLayerOpt(), CtuluLibString.toString(true)); -// } -// if (cbNoGeom_.isSelected()) { -// res.setOption(FudaaSaveLib.getNoGeogLayerOpt(), CtuluLibString.toString(true)); -// } - return loader_; - } - -// boolean isAcceptable(final File _f) { -// if (_f != null && _f.exists() && _f.isFile()) { -// final String name = _f.getName(); -// return name.endsWith(TrProjectPersistence.getPostProjectExt()) -// || name.endsWith(TrProjectPersistence.getPreProjectExt()); -// } -// return false; -// } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bma...@us...> - 2008-11-18 17:25:36
|
Revision: 4223 http://fudaa.svn.sourceforge.net/fudaa/?rev=4223&view=rev Author: bmarchan Date: 2008-11-18 17:25:33 +0000 (Tue, 18 Nov 2008) Log Message: ----------- Enregistrement du num?\195?\169ro de version software dans le fichier projet. Modified Paths: -------------- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZScene.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZEditorDefault.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/commun/save/FudaaSaveProject.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlImplementation.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/sig/FSigProjectPersistence.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/test/org/fudaa/fudaa/all/TestJProjectSave.java Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZScene.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZScene.java 2008-11-18 17:19:43 UTC (rev 4222) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZScene.java 2008-11-18 17:25:33 UTC (rev 4223) @@ -706,9 +706,6 @@ * @param _calque Peut \xEAtre null. */ public void setCalqueActif(BCalque _calque) { - if (FuLog.isTrace()) { - FuLog.trace("EBL: calque actif=" + (_calque == null ? "null" : _calque.getTitle())); - } boolean sendEvent=false; @@ -804,7 +801,6 @@ * @see javax.swing.event.TreeModelListener#treeNodesInserted(javax.swing.event.TreeModelEvent) */ public void treeNodesInserted(TreeModelEvent e) { - FuLog.warning("ZScene.treeNodesInserted"); refreshRequested(); } @@ -812,7 +808,6 @@ * @see javax.swing.event.TreeModelListener#treeNodesRemoved(javax.swing.event.TreeModelEvent) */ public void treeNodesRemoved(TreeModelEvent e) { - FuLog.warning("ZScene.treeNodesRemoved"); refreshRequested(); } @@ -820,7 +815,6 @@ * @see javax.swing.event.TreeModelListener#treeStructureChanged(javax.swing.event.TreeModelEvent) */ public void treeStructureChanged(TreeModelEvent e) { - FuLog.warning("ZScene.treeStructureChanged"); refreshRequested(); } 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 2008-11-18 17:19:43 UTC (rev 4222) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZEditorDefault.java 2008-11-18 17:25:33 UTC (rev 4223) @@ -704,9 +704,6 @@ } updatePalette(); activeCurrentState(); - if (FuLog.isTrace()) { - FuLog.trace("EBL:target=" + _o); - } } public final void setDesktop(final BuDesktop _desktop) { Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/commun/save/FudaaSaveProject.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/commun/save/FudaaSaveProject.java 2008-11-18 17:19:43 UTC (rev 4222) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/commun/save/FudaaSaveProject.java 2008-11-18 17:25:33 UTC (rev 4223) @@ -22,6 +22,7 @@ import com.memoire.bu.BuIcon; import com.memoire.bu.BuInformationsDocument; +import com.memoire.bu.BuInformationsSoftware; import com.memoire.bu.BuLib; import com.memoire.fu.FuLog; @@ -45,10 +46,10 @@ private FudaaSaveProject() {} /** - * Enregistre les informations fichier (version, format, etc.) sur le flux courant. + * Enregistre les informations li\xE9es au syst\xE8me de mod\xE9lisation (syst\xE8me, version, etc.) sur le flux courant. * * @param _writer Le flux pour l'ecriture. - * @param _soft Les informations fichier. + * @param _soft Les informations syst\xE8me de mod\xE9lisation. Peut \xEAtre null. * @throws IOException En cas d'erreur d'\xE9criture dans le zip. */ public static void saveIn(final FudaaSaveZipWriter _writer, final FileFormatSoftware _soft) throws IOException { @@ -64,15 +65,17 @@ } } + /** - * Enregistre les donn\xE9es g\xE9n\xE9rales du projet sur le flux courant. Le nom de l'auteur, le titre, etc. + * Enregistre les donn\xE9es g\xE9n\xE9rales du document sur le flux courant. Le nom de l'auteur, le titre, etc. * @param _writer Le flux pour l'ecriture. - * @param _soft Les donn\xE9es g\xE9n\xE9rales. + * @param _doc Les donn\xE9es g\xE9n\xE9rales du document. Peut \xEAtre null. + * @param _soft Les infos du soft qui a g\xE9n\xE9r\xE9 le document. Peut \xEAtre null. * @throws IOException En cas d'erreur d'\xE9criture dans le zip. */ - public static void saveIn(final FudaaSaveZipWriter _writer, final BuInformationsDocument _soft) throws IOException { - if (_soft != null) { + public static void saveIn(final FudaaSaveZipWriter _writer, final BuInformationsDocument _doc, final BuInformationsSoftware _soft) throws IOException { + if (_doc != null) { String logo = null; _writer.startEntry("project.xml"); final CtuluXmlWriter writer = new CtuluXmlWriter(_writer.getOutStream()); @@ -81,38 +84,51 @@ writer.setMainTag("document"); writer.writeComment("Dernier enregistrement"); writer.writeComment("Last save session"); - writer.writeEntry("date", FudaaLib.getDefaultDateFormat().format(new Date())); - if (_soft.name != null) { + + // Infos sur le software. + if (_soft!=null) { + if (_soft.name!=null) { + writer.writeComment("Nom de l'application"); + writer.writeComment("Software name"); + writer.writeEntry("software.name", _soft.name); + } + if (_soft.version!=null) { + writer.writeComment("Version de l'application"); + writer.writeComment("Software version"); + writer.writeEntry("software.version", _soft.version); + } + } + if (_doc.name != null) { writer.writeComment("Le nom du projet"); writer.writeComment("The title of the project"); - writer.writeEntry("title", _soft.name); + writer.writeEntry("title", _doc.name); } writer.write(CtuluLibString.LINE_SEP); writer.writeComment("Le responsable"); writer.writeComment("The author"); writer.write(CtuluLibString.LINE_SEP); - if (_soft.author != null) { + if (_doc.author != null) { writer.writeComment("Le responsable du projet"); writer.writeComment("The responsable of the author"); - writer.writeEntry("author", _soft.author); + writer.writeEntry("author", _doc.author); } - if (_soft.organization != null) { + if (_doc.organization != null) { writer.writeComment("L'organisation du responsable"); writer.writeComment("The author's organization"); - writer.writeEntry("organization", _soft.organization); + writer.writeEntry("organization", _doc.organization); } - if (_soft.department != null) { + if (_doc.department != null) { writer.writeComment("Le d\xE9partement du responsable"); writer.writeComment("The author's department"); - writer.writeEntry("department", _soft.department); + writer.writeEntry("department", _doc.department); } - if (_soft.contact != null) { + if (_doc.contact != null) { writer.writeComment("Un contact pour le responsable (email, tel, ..)"); writer.writeComment("how to contact the author (email, phone, ...)"); - writer.writeEntry("contact", _soft.contact); + writer.writeEntry("contact", _doc.contact); } - if (_soft.logo != null) { + if (_doc.logo != null) { writer.writeComment("Le nom du fichier image contenant le logo ( present dans l'archive)"); writer.writeComment("The filename of the logo"); logo = "author-logo.png"; @@ -121,20 +137,21 @@ writer.write(CtuluLibString.LINE_SEP); writer.writeComment("Description du projet"); writer.writeComment("Project's description"); - if (_soft.comment != null) { + if (_doc.comment != null) { writer.writeComment("Description g\xE9n\xE9ral sur le projet"); writer.writeComment("General description of the project"); - writer.writeEntry("description", _soft.comment); + writer.writeEntry("description", _doc.comment); } writer.write(CtuluLibString.LINE_SEP); - final Object o = _soft.data; + final Object o = _doc.data; if (o != null && o instanceof FudaaCommentModel) { ((FudaaCommentModel) o).writeIn(writer); } writer.finish(); + if (logo != null) { _writer.startEntry(logo); - ImageIO.write(BuLib.convert(_soft.logo.getImage()), "png", _writer.getOutStream()); + ImageIO.write(BuLib.convert(_doc.logo.getImage()), "png", _writer.getOutStream()); _writer.getOutStream().flush(); } } @@ -185,6 +202,40 @@ } /** + * Charge les infos software du projet depuis le flux courant. Le nom de l'application, la version, etc. + * @param _loader Le flux pour le chargement. + * @return Les infos software. + * @throws IOException En cas d'erreur de lecture, si le fichier n'est pas pr\xE9sent dans le zip. + */ + public static BuInformationsSoftware getSoftwareInfos(final FudaaSaveZipLoader _loader) throws IOException { + if (_loader == null) { + return null; + } + final InputStream in = _loader.getInputStream("project.xml"); + if (in == null) { + return null; + } + CtuluXmlReaderHelper reader = null; + try { + reader = new CtuluXmlReaderHelper(in); + } catch (final SAXException _evt) { + FuLog.error(_evt); + + } catch (final ParserConfigurationException _evt) { + FuLog.error(_evt); + + } + if (reader == null) { + return null; + } + final BuInformationsSoftware soft = new BuInformationsSoftware(); + soft.name = reader.getTrimTextFor("software.name"); + soft.version = reader.getTrimTextFor("software.version"); + return soft; + + } + + /** * Charge les informations fichier (version, format, etc.) depuis le flux courant. * @param _loader Le flux pour le chargement. * @return Les informations fichier. 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 2008-11-18 17:19:43 UTC (rev 4222) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlImplementation.java 2008-11-18 17:25:33 UTC (rev 4223) @@ -46,6 +46,7 @@ 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.sig.FSigLib; import org.fudaa.fudaa.sig.FSigProjectPersistence; @@ -86,7 +87,7 @@ protected static BuInformationsSoftware isMdl_ = new BuInformationsSoftware(); static { isMdl_.name = "Modeleur"; - isMdl_.version = "0.07"; + isMdl_.version = "0.08-alpha"; isMdl_.date = "2008-11-12"; isMdl_.rights = "Tous droits r\xE9serv\xE9s. CETMEF (c)1999-2008"; isMdl_.license = "GPL2"; @@ -156,8 +157,6 @@ * Mise \xE0 jour de l'\xE9tat des boutons. */ void updateActionsState() { - FuLog.trace("Project state change"); - boolean bprjOpen=project_!=null; boolean bprjModPar=bprjOpen && project_.getProjectState().isParamsModified(); boolean buiMod=bprjOpen && project_.getProjectState().isUIModified(); @@ -346,7 +345,18 @@ project_.setOpening(true); Runnable r = null; try { - r = FudaaSaveLib.restoreFille(MdlImplementation.this, currentFrame_, _proj, f); + 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, currentFrame_, _proj,loader); + } catch (final IOException _evt) { + FuLog.error(_evt); + + } + project_.setParamFile(f); } finally { Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/sig/FSigProjectPersistence.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/sig/FSigProjectPersistence.java 2008-11-18 17:19:43 UTC (rev 4222) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/sig/FSigProjectPersistence.java 2008-11-18 17:25:33 UTC (rev 4223) @@ -68,7 +68,7 @@ writer = new FudaaSaveZipWriter(zipFile); FSigLib.addReadmeFile(writer); FudaaSaveProject.saveIn(writer, _proj.getSystemVersion()); - FudaaSaveProject.saveIn(writer, _proj.getInformationsDocument()); + FudaaSaveProject.saveIn(writer, _proj.getInformationsDocument(), _impl.getInformationsSoftware()); final ObjectContainer cont = writer.getDb(); // final FudaaSaveMainData data = new FudaaSaveMainData(); // data.infoDoc_ = _proj.getInformationsDocument(); Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/test/org/fudaa/fudaa/all/TestJProjectSave.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/test/org/fudaa/fudaa/all/TestJProjectSave.java 2008-11-18 17:19:43 UTC (rev 4222) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/test/org/fudaa/fudaa/all/TestJProjectSave.java 2008-11-18 17:25:33 UTC (rev 4223) @@ -13,6 +13,7 @@ import junit.framework.TestCase; import com.memoire.bu.BuInformationsDocument; +import com.memoire.bu.BuInformationsSoftware; import org.fudaa.ctulu.CtuluXmlReaderHelper; import org.fudaa.ctulu.CtuluXmlWriter; @@ -64,12 +65,15 @@ f = File.createTempFile("toto", ".fzip"); assertNotNull(f); final BuInformationsDocument doc = new BuInformationsDocument(null); + final BuInformationsSoftware soft=new BuInformationsSoftware(); + soft.name="TesterSoft"; + soft.version="0.01"; doc.author = "Auteur"; doc.comment = "commentaires\n sur des lignes"; // doc.logo = FudaaResource.FUDAA.getIcon("fudaa-logo.png"); doc.data = createComment(); final FudaaSaveZipWriter writer = new FudaaSaveZipWriter(f); - FudaaSaveProject.saveIn(writer, doc); + FudaaSaveProject.saveIn(writer, doc,soft); writer.close(); final FudaaSaveZipLoader loader = new FudaaSaveZipLoader(f); final BuInformationsDocument doc2 = FudaaSaveProject.loadInfo(loader); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <emm...@us...> - 2008-11-18 17:19:48
|
Revision: 4222 http://fudaa.svn.sourceforge.net/fudaa/?rev=4222&view=rev Author: emmanuel_martin Date: 2008-11-18 17:19:43 +0000 (Tue, 18 Nov 2008) Log Message: ----------- Tache #24 :"Outil de distance inexistant." Modified Paths: -------------- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/sig/layer/FSigVisuPanel.java Added Paths: ----------- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/action/SceneShowDistanceAction.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/BPaletteDistance.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZCalqueDistanceInteraction.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/ressource/curseur_distance.gif Added: branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/action/SceneShowDistanceAction.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/action/SceneShowDistanceAction.java (rev 0) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/action/SceneShowDistanceAction.java 2008-11-18 17:19:43 UTC (rev 4222) @@ -0,0 +1,88 @@ +/* + * @creation 17 nov. 2008 + * @modification $Date:$ + * @license GNU General Public License 2 + * @copyright (c)1998-2008 CETMEF 2 bd Gambetta F-60231 Compiegne + * @mail fud...@li... + */ +package org.fudaa.ebli.calque.action; + +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; + +import javax.swing.event.InternalFrameEvent; + +import org.fudaa.ebli.calque.BCalqueInteraction; +import org.fudaa.ebli.calque.ZEbliCalquesPanel; +import org.fudaa.ebli.calque.edition.BPaletteDistance; +import org.fudaa.ebli.calque.edition.ZCalqueDistanceInteraction; +import org.fudaa.ebli.calque.edition.ZEditorDefault; +import org.fudaa.ebli.commun.BPalettePanelInterface; +import org.fudaa.ebli.commun.EbliActionPaletteSpecAbstract; +import org.fudaa.ebli.commun.EbliFormatterInterface; +import org.fudaa.ebli.ressource.EbliResource; + +/** + * Une action pour afficher une palette indiquant la distance entre une s\xE9rie de + * points. + * + * @author Emmanuel MARTIN + * @version $Id:$ + */ +public class SceneShowDistanceAction extends EbliActionPaletteSpecAbstract implements PropertyChangeListener { + + private ZEbliCalquesPanel calquesPanel_; + // Calque ne fermant pas l'edition \\ + private BCalqueInteraction calqueZoom_; + private BCalqueInteraction calqueDeplacementVue_; + /** Le calque contenant les informations de distance. */ + private ZCalqueDistanceInteraction calqueDistance_; + protected EbliFormatterInterface formatter_; + + public SceneShowDistanceAction(final ZEditorDefault _editor, EbliFormatterInterface _formatter) { + super(EbliResource.EBLI.getString("Distance"), EbliResource.EBLI.getToolIcon("bu_scrollpane_corner"), "PALETTE_DISTANCE"); + formatter_=_formatter; + calquesPanel_=_editor.getPanel(); + calquesPanel_.getController().addPropertyChangeListener("gele", this); + calqueZoom_=calquesPanel_.getController().getCalqueInteraction("cqAGRANDIR"); + calqueDeplacementVue_=calquesPanel_.getController().getCalqueInteraction("cqDEPLACEMENT_VUE-I"); + calqueDistance_=new ZCalqueDistanceInteraction(); + calqueDistance_.setGele(true); + calquesPanel_.addCalqueInteraction(calqueDistance_); + calqueDistance_.addPropertyChangeListener("gele", this); + setResizable(true); + setEnabled(true); + } + + @Override + public void changeAction() { + super.changeAction(); + if (isSelected()) + calquesPanel_.setCalqueInteractionActif(calqueDistance_); + else{ + calqueDistance_.cancelEdition(); + calquesPanel_.unsetCalqueInteractionActif(calqueDistance_); + if (calquesPanel_.getController().getCqSelectionI()!=null) + calquesPanel_.getController().getCqSelectionI().setGele(false); + } + } + + protected BPalettePanelInterface buildPaletteContent() { + return new BPaletteDistance(calqueDistance_, formatter_, calquesPanel_); + } + + public void propertyChange(PropertyChangeEvent _evt) { + // Cas un autre calque que celui du zoom, du deplacement de vue et d'edition + // est d\xE9gel\xE9 donc on ferme le pannel d'edition si il \xE9tait ouvert. + if (_evt.getSource()!=calqueZoom_&&_evt.getSource()!=calqueDeplacementVue_&&_evt.getSource()!=calqueDistance_ + &&!((Boolean)_evt.getNewValue()).booleanValue()) { + calqueDistance_.cancelEdition(); + } + } + + public void internalFrameClosing(InternalFrameEvent e) { + calqueDistance_.cancelEdition(); + if (calquesPanel_.getController().getCqSelectionI()!=null) + calquesPanel_.getController().getCqSelectionI().setGele(false); + } +} \ No newline at end of file Property changes on: branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/action/SceneShowDistanceAction.java ___________________________________________________________________ Added: svn:keywords + Id Added: svn:eol-style + native Added: branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/BPaletteDistance.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/BPaletteDistance.java (rev 0) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/BPaletteDistance.java 2008-11-18 17:19:43 UTC (rev 4222) @@ -0,0 +1,110 @@ +/* + * @creation 18 nov. 2008 + * @modification $Date:$ + * @license GNU General Public License 2 + * @copyright (c)1998-2008 CETMEF 2 bd Gambetta F-60231 Compiegne + * @mail fud...@li... + */ +package org.fudaa.ebli.calque.edition; + +import java.awt.BorderLayout; +import java.awt.Container; +import java.awt.GridLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; + +import javax.swing.BorderFactory; +import javax.swing.JComponent; + +import org.fudaa.ebli.calque.ZEbliCalquesPanel; +import org.fudaa.ebli.commun.BPalettePanelInterface; +import org.fudaa.ebli.commun.EbliFormatterInterface; +import org.fudaa.ebli.commun.EbliLib; + +import com.memoire.bu.BuButton; +import com.memoire.bu.BuLabel; +import com.memoire.bu.BuPanel; + +/** + * Palette affichant les informations de distances. + * @author Emmanuel MARTIN + * @version $Id:$ + */ +public class BPaletteDistance extends BuPanel implements ActionListener, BPalettePanelInterface, PropertyChangeListener { + + /** Label affichant la distance cumul\xE9e. */ + protected BuLabel lblDistanceCumulee_=new BuLabel(); + /** Label affichant la distance en cours. */ + protected BuLabel lblDistanceEnCours_=new BuLabel(); + /** Le calque qui contient les informations de distance. */ + protected ZCalqueDistanceInteraction calqueDistance_; + /** Le bouton 'continuer'. */ + protected BuButton btContinuer_=new BuButton(EbliLib.getS("Continuer")); + protected EbliFormatterInterface formatter_; + private ZEbliCalquesPanel calquesPanel_; + + public BPaletteDistance(ZCalqueDistanceInteraction _calqueDistance, EbliFormatterInterface _formatter, ZEbliCalquesPanel _calquesPanel){ + calquesPanel_=_calquesPanel; + calqueDistance_=_calqueDistance; + calqueDistance_.addDistanceChangeListener(this); + calqueDistance_.addPropertyChangeListener("gele", this); + formatter_=_formatter; + // Construction du panel \\ + setLayout(new BorderLayout()); + // Titre + BuLabel lblTitre=new BuLabel("<html><b>"+EbliLib.getS("Distance")+"</b></html>"); + lblTitre.setHorizontalAlignment(BuLabel.CENTER); + add(lblTitre, BorderLayout.NORTH); + // Contenu + Container body=new Container(); + body.setLayout(new GridLayout(2, 2, 2, 2)); + body.add(new BuLabel("En cours : ")); + body.add(lblDistanceEnCours_); + body.add(new BuLabel("Cumul\xE9e : ")); + body.add(lblDistanceCumulee_); + add(body, BorderLayout.CENTER); + // Bouton reprise + add(btContinuer_, BorderLayout.SOUTH); + btContinuer_.addActionListener(this); + // Affichage + setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2)); + setVisible(true); + // Valeurs \\ + updateValues(); + } + + /** Met \xE0 jours les valeurs des labels de distance. */ + protected void updateValues(){ + lblDistanceEnCours_.setText(formatter_.getXYFormatter().format(calqueDistance_.getDistanceVariable())); + lblDistanceCumulee_.setText(formatter_.getXYFormatter().format(calqueDistance_.getDistanceCumulee())); + } + + public JComponent getComponent() { + return this; + } + + public boolean setPalettePanelTarget(Object _target) { + return false; + } + + public void paletteDeactivated() {} + + public void doAfterDisplay() {} + + public void propertyChange(PropertyChangeEvent evt) { + if(evt.getPropertyName().equals("gele")) + btContinuer_.setEnabled((Boolean) evt.getNewValue()); + else if(evt.getPropertyName().equals("distance")) + updateValues(); + } + + /* (non-Javadoc) + * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) + */ + public void actionPerformed(ActionEvent e) { + calquesPanel_.setCalqueInteractionActif(calqueDistance_); + } + +} Property changes on: branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/BPaletteDistance.java ___________________________________________________________________ Added: svn:keywords + Id Added: svn:eol-style + native Added: branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZCalqueDistanceInteraction.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZCalqueDistanceInteraction.java (rev 0) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZCalqueDistanceInteraction.java 2008-11-18 17:19:43 UTC (rev 4222) @@ -0,0 +1,234 @@ +/* + * @creation 17 nov. 2008 + * @modification $Date:$ + * @license GNU General Public License 2 + * @copyright (c)1998-2008 CETMEF 2 bd Gambetta F-60231 Compiegne + * @mail fud...@li... + */ +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 java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import java.util.ArrayList; +import java.util.List; + +import org.fudaa.ebli.calque.BCalqueInteraction; +import org.fudaa.ebli.geometrie.GrPoint; +import org.fudaa.ebli.ressource.EbliResource; +import org.fudaa.ebli.trace.TraceLigne; + +import com.memoire.bu.BuResource; +import com.vividsolutions.jts.geom.Coordinate; + +/** + * Permet de visionner des distances. + * + * @author Emmanuel MARTIN + * @version $Id:$ + */ +public class ZCalqueDistanceInteraction extends BCalqueInteraction implements MouseListener, MouseMotionListener { + + /** Liste des points composant le chemin affich\xE9. Se sont des coordonn\xE9s r\xE9els. */ + protected List<Coordinate> chemin_=new ArrayList<Coordinate>(); + /** La coordonn\xE9e correspondant \xE0 la position de la souris. C'est une coordonn\xE9s \xE9cran. */ + protected Coordinate coordSouris_=new Coordinate(); + /** Indique si un chemin est dessin\xE9 \xE0 l'\xE9cran. */ + private boolean cheminIsPaint_=false; + /** Indique si la partie variable (du dernier point \xE0 la souris) est dessin\xE9e \xE0 l'\xE9cran. */ + private boolean variableIsPaint_=false; + /** Traceur de ligne. */ + private TraceLigne traceLigne_=new TraceLigne(TraceLigne.LISSE, 1.5f, Color.RED); + /** Indique si la saisie du chemin est termin\xE9e. */ + protected boolean cheminComplet_=false; + /** Indique si la touche 'CTRL' est active. */ + protected boolean ctrlActif_=false; + /** Listener des distances. */ + private List<PropertyChangeListener> listeners_=new ArrayList<PropertyChangeListener>(); + + public ZCalqueDistanceInteraction(){ + setName("cqInteractifDistance"); + } + + // M\xE9thodes utilitaires \\ + + /** Converti une coordonn\xE9e reel en coordonn\xE9e \xE9cran. */ + protected Coordinate reelToEcran(Coordinate coord){ + GrPoint tmp=new GrPoint(coord.x, coord.y, 0); + tmp.autoApplique(getVersEcran()); + return new Coordinate(tmp.x_, tmp.y_); + } + + /** Converti une coordonn\xE9e reel en coordonn\xE9e \xE9cran. */ + protected Coordinate ecranToReel(Coordinate coord){ + GrPoint tmp=new GrPoint(coord.x, coord.y, 0); + tmp.autoApplique(getVersReel()); + return new Coordinate(tmp.x_, tmp.y_); + } + + /** Dessine un trait en mode XOR \xE0 l'\xE9cran entre les deux coordonn\xE9es fournies. */ + private void dessineTrait(Graphics2D _g, Coordinate coor1, Coordinate coord2){ + _g.setXORMode(getBackground()); + traceLigne_.dessineTrait(_g, coor1.x, coor1.y, coord2.x, coord2.y); + } + + // M\xE9thodes d\xE9riv\xE9es \\ + + public Cursor getSpecificCursor() { + return EbliResource.EBLI.getCursor("curseur_distance", -1, new Point(2, 2)); + } + + public boolean alwaysPaint() { + return true; + } + + public String getDescription() { + return BuResource.BU.getString("Distance"); + } + + public void paintComponent(final Graphics _g) { + effaceChemin(); + super.paintComponent(_g); + // Affichage du chemin avec le graphics pass\xE9 en param\xE8tre + if(chemin_.size()>1){ + for(int i=1; i<chemin_.size();i++) + dessineTrait((Graphics2D) _g, reelToEcran(chemin_.get(i-1)), reelToEcran(chemin_.get(i))); + cheminIsPaint_=true; + } + } + + // M\xE9thodes de base de dessin du chemin \\ + + /** Dessine tout le chemin \xE0 l'\xE9cran sauf la partie variable (du dernier point \xE0 la souris). */ + protected void afficheChemin(){ + if(!cheminIsPaint_&&chemin_.size()>1){ + for(int i=1; i<chemin_.size();i++) + dessineTrait((Graphics2D) getGraphics(), reelToEcran(chemin_.get(i-1)), reelToEcran(chemin_.get(i))); + cheminIsPaint_=true; + } + } + /** Efface tout le chemin \xE0 l'\xE9cran sauf la partie cariable (du dernier point \xE0 la souris).*/ + protected void effaceChemin(){ + if(cheminIsPaint_&&chemin_.size()>1){ + for(int i=1; i<chemin_.size();i++) + dessineTrait((Graphics2D) getGraphics(), reelToEcran(chemin_.get(i-1)), reelToEcran(chemin_.get(i))); + cheminIsPaint_=false; + } + } + /** Dessine la partie variable (du dernier point \xE0 la souris) \xE0 l'\xE9cran. */ + protected void afficheVariable(){ + if(!variableIsPaint_&&chemin_.size()>=1){ + dessineTrait((Graphics2D) getGraphics(), reelToEcran(chemin_.get(chemin_.size()-1)), coordSouris_); + variableIsPaint_=true; + } + } + /** Efface la partie variable (du dernier point \xE0 la souris) \xE0 l'\xE9cran. */ + protected void effaceVariable(){ + if(variableIsPaint_&&chemin_.size()>=1){ + dessineTrait((Graphics2D) getGraphics(), reelToEcran(chemin_.get(chemin_.size()-1)), coordSouris_); + variableIsPaint_=false; + } + } + + // M\xE9thodes de controle ext\xE9rieur et de r\xE9cup\xE9ration d'informations. \\ + + /** Annule l'\xE9dition en cours. */ + public void cancelEdition() { + effaceChemin(); + effaceVariable(); + chemin_.clear(); + cheminComplet_=true; + repaint(); + } + + /** @return retourne la distance totale. */ + public double getDistanceCumulee(){ + double distance=getDistanceVariable(); + for(int i=1; i<chemin_.size();i++) + distance+=chemin_.get(i-1).distance(chemin_.get(i)); + return distance; + } + + /** @return retourne la distance variable (du dernier point \xE0 la souris). */ + public double getDistanceVariable(){ + if(chemin_.size()>=1) + return chemin_.get(chemin_.size()-1).distance(ecranToReel(coordSouris_)); + else + return 0; + } + + public void addDistanceChangeListener(PropertyChangeListener _listener){ + if(!listeners_.contains(_listener)) + listeners_.add(_listener); + } + + public void removeDistanceChangeListener(PropertyChangeListener _listener){ + if(listeners_.contains(_listener)) + listeners_.remove(_listener); + } + + protected void fireDistanceChangeListener(){ + for(PropertyChangeListener listener:listeners_) + listener.propertyChange(new PropertyChangeEvent(this, "distance", null, null)); + } + + // M\xE9thodes g\xE9rant les \xE9v\xE9nements. \\ + + public void mouseClicked(final MouseEvent _evt) { + } + + public void mouseEntered(final MouseEvent _evt) { + // Affichage du chemin sans XOR pour r\xE9afficher correctement la forme apr\xE8s un d\xE9placement des fen\xEAtre + for(int i=1; i<chemin_.size();i++) + traceLigne_.dessineTrait((Graphics2D) getGraphics(), reelToEcran(chemin_.get(i-1)).x, reelToEcran(chemin_.get(i-1)).y, reelToEcran(chemin_.get(i)).x, reelToEcran(chemin_.get(i)).y); + } + + public void mousePressed(final MouseEvent _evt) { + } + + public void mouseDragged(final MouseEvent _evt) { + mouseMoved(_evt); + } + + public void mouseExited(final MouseEvent _evt) { + effaceVariable(); + } + + /** Met \xE0 jour la partie variable du chemin. */ + public void mouseMoved(final MouseEvent _evt) { + if(!isGele()&&!cheminComplet_){ + effaceVariable(); + coordSouris_.x=_evt.getX(); + coordSouris_.y=_evt.getY(); + afficheVariable(); + fireDistanceChangeListener(); + } + } + + public void mouseReleased(final MouseEvent _evt) { + if (!isGele()&&_evt.getButton()==MouseEvent.BUTTON1) { + effaceChemin(); + effaceVariable(); + coordSouris_.x=_evt.getX(); + coordSouris_.y=_evt.getY(); + // Si le chemin \xE9tait d\xE9j\xE0 complet, on reprend \xE0 0 + if(cheminComplet_){ + chemin_.clear(); + cheminComplet_=false; + repaint(); + } + chemin_.add(ecranToReel(new Coordinate(_evt.getX(), _evt.getY()))); + // Si c'est le dernier point, le chemin est termin\xE9 + cheminComplet_=chemin_.size()>1&&getDistanceCumulee()>0&&(_evt.getClickCount()>=2||_evt.isControlDown()); + afficheChemin(); + fireDistanceChangeListener(); + } + } +} Property changes on: branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZCalqueDistanceInteraction.java ___________________________________________________________________ Added: svn:keywords + Id Added: svn:eol-style + native Added: branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/ressource/curseur_distance.gif =================================================================== (Binary files differ) Property changes on: branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/ressource/curseur_distance.gif ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: svn:keywords + Id Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/sig/layer/FSigVisuPanel.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/sig/layer/FSigVisuPanel.java 2008-11-17 14:54:27 UTC (rev 4221) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/sig/layer/FSigVisuPanel.java 2008-11-18 17:19:43 UTC (rev 4222) @@ -28,7 +28,7 @@ import org.fudaa.ebli.calque.action.SceneRotationAction; import org.fudaa.ebli.calque.action.SceneSelectNextAction; import org.fudaa.ebli.calque.action.SceneSelectPreviousAction; -import org.fudaa.ebli.calque.action.SceneShowOrientationAction; +import org.fudaa.ebli.calque.action.SceneShowDistanceAction; import org.fudaa.ebli.calque.edition.ZCalqueDeplacement; import org.fudaa.ebli.calque.edition.ZCalqueEditionGroup; import org.fudaa.ebli.calque.edition.ZEditorDefault; @@ -179,6 +179,7 @@ arrayList.add(new SceneRotationAction(getArbreCalqueModel().getTreeSelectionModel(), gisEditor_, gisEditor_.getSceneEditor(),getEbliFormatter())); arrayList.add(new SceneDeplacementAction(getArbreCalqueModel().getTreeSelectionModel(), gisEditor_.getSceneEditor(),getEbliFormatter(), getCalqueDeplacement())); arrayList.add(new EditVisibilityAction(getArbreCalqueModel(), getScene(), mng_)); + arrayList.add(new SceneShowDistanceAction(gisEditor_, getEbliFormatter())); return (EbliActionInterface[]) arrayList.toArray(new EbliActionInterface[arrayList.size()]); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <emm...@us...> - 2008-11-17 14:54:33
|
Revision: 4221 http://fudaa.svn.sourceforge.net/fudaa/?rev=4221&view=rev Author: emmanuel_martin Date: 2008-11-17 14:54:27 +0000 (Mon, 17 Nov 2008) Log Message: ----------- tache #88 (CDC 11.3.1) : "Inverser des profils" Modified Paths: -------------- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZCalqueLigneBrisee.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlEditionManager.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlSceneEditor.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/layer/MdlModel2dLine.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/sig/layer/FSigVisuPanel.java Added Paths: ----------- branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/com/memoire/bu/fleche.png branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/action/SceneShowOrientationAction.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/action/SceneInvertAction.java Added: branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/com/memoire/bu/fleche.png =================================================================== (Binary files differ) Property changes on: branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/com/memoire/bu/fleche.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: svn:keywords + Id Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZCalqueLigneBrisee.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZCalqueLigneBrisee.java 2008-11-16 20:34:00 UTC (rev 4220) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZCalqueLigneBrisee.java 2008-11-17 14:54:27 UTC (rev 4221) @@ -124,6 +124,8 @@ protected EbliListeSelectionMulti selectionMulti_; /** Pour le trac\xE9 de la selection en mode atomique. */ protected ZSelectionTrace traceAtomic_; + /** On dessine une fl\xE8che sur chaque ligne pour indiquer le sens de celle-ci. */ + protected boolean showLineOrientation_; /** * @@ -142,9 +144,20 @@ iconModel_ = new TraceIconModel(TraceIcon.CARRE_PLEIN, 2, Color.BLACK); ligneModelOuvert_ = new TraceLigneModel(ligneModel_); iconeModelOuvert_ = new TraceIconModel(iconModel_); + showLineOrientation_=false; + } + public boolean getShowLineOrientation(){ + return showLineOrientation_; } - + + public void setShowLineOrientation(boolean _value){ + if(showLineOrientation_!=_value){ + showLineOrientation_=_value; + repaint(); + } + } + protected EbliListeSelectionMulti creeSelectionMulti() { return new EbliListeSelectionMulti(modeleDonnees().getNombre() / 2); } @@ -568,7 +581,19 @@ if (!isRapide()) initTrace(ligneModel, i); final GrPoint ptDest = new GrPoint(); - for (int j = nbPoints - 2; j >= 0; j--) { + // Dessine le premier segment avec une fleche si l'option est activ\xE9e + if(nbPoints>=2){ + modele_.point(ptDest, i, nbPoints - 2); + ptDest.autoApplique(versEcran); + // Pour les polygone \xE7a se passe plus loin + if(showLineOrientation_&&!modele_.isGeometryFermee(i)) + tl.dessineFleche(_g, (int)ptDest.x_, (int)ptDest.y_, (int)ptOri.x_, (int)ptOri.y_, 5, 3); + else + tl.dessineTrait(_g, ptOri.x_, ptOri.y_, ptDest.x_, ptDest.y_); + ptOri.initialiseAvec(ptDest); + } + // Dessine le reste + for (int j = nbPoints - 3; j >= 0; j--) { // le point de dest est initialise modele_.point(ptDest, i, j); ptDest.autoApplique(versEcran); @@ -578,7 +603,11 @@ if (modele_.isGeometryFermee(i)) { modele_.point(ptOri, i, nbPoints - 1); ptOri.autoApplique(versEcran); - tl.dessineTrait(_g, ptOri.x_, ptOri.y_, ptDest.x_, ptDest.y_); + // La fl\xE8che pour les polygone + if(showLineOrientation_) + tl.dessineFleche(_g, (int)ptOri.x_, (int)ptOri.y_, (int)ptDest.x_, (int)ptDest.y_, 5, 3); + else + tl.dessineTrait(_g, ptOri.x_, ptOri.y_, ptDest.x_, ptDest.y_); } modele_.point(ptOri, i, nbPoints - 1); ptOri.autoApplique(versEcran); Added: branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/action/SceneShowOrientationAction.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/action/SceneShowOrientationAction.java (rev 0) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/action/SceneShowOrientationAction.java 2008-11-17 14:54:27 UTC (rev 4221) @@ -0,0 +1,80 @@ +/* + * @creation 14 nov. 2008 + * @modification $Date:$ + * @license GNU General Public License 2 + * @copyright (c)1998-2008 CETMEF 2 bd Gambetta F-60231 Compiegne + * @mail fud...@li... + */ +package org.fudaa.ebli.calque.action; + +import javax.swing.event.TreeModelEvent; +import javax.swing.event.TreeModelListener; + +import org.fudaa.ebli.calque.BArbreCalqueModel; +import org.fudaa.ebli.calque.BCalque; +import org.fudaa.ebli.calque.BCalqueVisitor; +import org.fudaa.ebli.calque.ZCalqueLigneBrisee; +import org.fudaa.ebli.commun.EbliActionChangeState; +import org.fudaa.ebli.commun.EbliLib; + +import com.memoire.bu.BuResource; + +/** + * Une action pour montrer l'orientation des lignes dans les calques. + * @author Emmanuel MARTIN + * @version $Id:$ + */ +public class SceneShowOrientationAction extends EbliActionChangeState implements TreeModelListener { + + protected BArbreCalqueModel treeModel_; + + public SceneShowOrientationAction(BArbreCalqueModel _treeModel) { + super(EbliLib.getS("Affichage du sens des lignes"), BuResource.BU.getIcon("fleche"), "SHOW_ORIENTATION"); + treeModel_=_treeModel; + treeModel_.addTreeModelListener(this); + setEnabled(true); + } + + private void applyConf(){ + treeModel_.getRootCalque().apply(new BCalqueVisitor(){ + public boolean visit(BCalque _cq) { + if(_cq instanceof ZCalqueLigneBrisee) + ((ZCalqueLigneBrisee) _cq).setShowLineOrientation(isSelected()); + return true; + } + }); + } + + /* (non-Javadoc) + * @see javax.swing.event.TreeModelListener#treeNodesChanged(javax.swing.event.TreeModelEvent) + */ + public void treeNodesChanged(TreeModelEvent e) { + } + + /* (non-Javadoc) + * @see javax.swing.event.TreeModelListener#treeNodesInserted(javax.swing.event.TreeModelEvent) + */ + public void treeNodesInserted(TreeModelEvent e) { + applyConf(); + } + + /* (non-Javadoc) + * @see javax.swing.event.TreeModelListener#treeNodesRemoved(javax.swing.event.TreeModelEvent) + */ + public void treeNodesRemoved(TreeModelEvent e) { + } + + /* (non-Javadoc) + * @see javax.swing.event.TreeModelListener#treeStructureChanged(javax.swing.event.TreeModelEvent) + */ + public void treeStructureChanged(TreeModelEvent e) { + } + + /* (non-Javadoc) + * @see org.fudaa.ebli.commun.EbliActionChangeState#changeAction() + */ + @Override + public void changeAction() { + applyConf(); + } +} Property changes on: branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/action/SceneShowOrientationAction.java ___________________________________________________________________ Added: svn:keywords + Id Added: svn:eol-style + native Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlEditionManager.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlEditionManager.java 2008-11-16 20:34:00 UTC (rev 4220) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlEditionManager.java 2008-11-17 14:54:27 UTC (rev 4221) @@ -29,6 +29,7 @@ import org.fudaa.fudaa.commun.FudaaLib; import org.fudaa.fudaa.modeleur.action.SceneDecimationAction; import org.fudaa.fudaa.modeleur.action.SceneInterpolationAction; +import org.fudaa.fudaa.modeleur.action.SceneInvertAction; import org.fudaa.fudaa.modeleur.action.SceneMoveInLayerAction; import org.fudaa.fudaa.modeleur.action.SceneProjectionAction; import org.fudaa.fudaa.modeleur.action.SceneRefinementAction; @@ -70,6 +71,7 @@ acts.add(new SceneMoveInLayerAction((MdlSceneEditor)sceneEditor_)); acts.add(new SceneDecimationAction((MdlSceneEditor)sceneEditor_)); acts.add(new SceneRefinementAction((MdlSceneEditor)sceneEditor_)); + acts.add(new SceneInvertAction((MdlSceneEditor)sceneEditor_)); acts.add(new SceneProjectionAction((MdlSceneEditor)sceneEditor_)); getSceneEditor().setActions(acts.toArray(new EbliActionAbstract[0])); } 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 2008-11-16 20:34:00 UTC (rev 4220) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlSceneEditor.java 2008-11-17 14:54:27 UTC (rev 4221) @@ -19,7 +19,9 @@ import javax.swing.JDialog; import javax.swing.JPanel; +import org.fudaa.ctulu.CtuluCommand; import org.fudaa.ctulu.CtuluCommandComposite; +import org.fudaa.ctulu.CtuluCommandContainer; import org.fudaa.ctulu.CtuluListSelection; import org.fudaa.ctulu.CtuluListSelectionInterface; import org.fudaa.ctulu.gis.GISAttributeConstants; @@ -454,4 +456,20 @@ } } } + + /** + * Inverse le sens de la polyligne. + */ + public void invertOrientationSelectedGeometries() { + CtuluCommandComposite cmd=new CtuluCommandComposite(FudaaLib.getS("Inversion de l'orientation")); + int[] geoms=getScene().getSelectionHelper().getSelectedIndexes(); + for (int i=0; i<geoms.length; i++) { + ZModeleDonnees mdld=getScene().getLayerForId(geoms[i]).modeleDonnees(); + if (mdld instanceof MdlModel2dLine) + ((MdlModel2dLine)mdld).invertOrientation(getScene().sceneId2LayerId(geoms[i]), cmd); + } + super.getScene().clearSelection(); + if (getMng()!=null) + getMng().addCmd(cmd.getSimplify()); + } } 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 2008-11-16 20:34:00 UTC (rev 4220) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlVisuPanel.java 2008-11-17 14:54:27 UTC (rev 4221) @@ -9,11 +9,16 @@ import javax.swing.Action; +import org.fudaa.ebli.calque.BArbreCalque; import org.fudaa.ebli.calque.BGroupeCalque; import org.fudaa.ebli.calque.ZSelectionEvent; import org.fudaa.ebli.calque.ZSelectionListener; +import org.fudaa.ebli.calque.action.SceneSelectNextAction; +import org.fudaa.ebli.calque.action.SceneSelectPreviousAction; +import org.fudaa.ebli.calque.action.SceneShowOrientationAction; import org.fudaa.ebli.commun.EbliActionInterface; import org.fudaa.ebli.commun.EbliActionMap; +import org.fudaa.ebli.commun.EbliComponentFactory; import org.fudaa.ebli.ressource.EbliResource; import org.fudaa.fudaa.commun.FudaaLib; import org.fudaa.fudaa.commun.impl.FudaaCommonImplementation; @@ -39,6 +44,8 @@ import org.fudaa.fudaa.sig.layer.FSigVisuPanel; import org.fudaa.fudaa.tr.common.TrResource; +import com.memoire.bu.BuMenu; + /** * Le panneau de visu 2D des donn\xE9es du modeleur au travers des calques. Contient le composant vue * des calques + le composant d'affichage des coordonn\xE9es + le composant d'affichage du mode de selection @@ -70,6 +77,15 @@ mng_=editor.getMng(); return editor; } + + protected EbliActionInterface[] getActionsInterface(){ + EbliActionInterface[] actions=super.getActionsInterface(); + EbliActionInterface[] allActions=new EbliActionInterface[actions.length+1]; + for(int i=0;i<actions.length;i++) + allActions[i]=actions[i]; + allActions[allActions.length-1]=new SceneShowOrientationAction(gisEditor_.getPanel().getArbreCalqueModel()); + return allActions; + } public FSigLayerGroup getGroupGIS() { return /*parent_*/null; Added: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/action/SceneInvertAction.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/action/SceneInvertAction.java (rev 0) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/action/SceneInvertAction.java 2008-11-17 14:54:27 UTC (rev 4221) @@ -0,0 +1,66 @@ +/* + * @creation 14 nov. 2008 + * @modification $Date:$ + * @license GNU General Public License 2 + * @copyright (c)1998-2008 CETMEF 2 bd Gambetta F-60231 Compiegne + * @mail fud...@li... + */ +package org.fudaa.fudaa.modeleur.action; + +import java.awt.event.ActionEvent; + +import org.fudaa.ebli.calque.ZScene; +import org.fudaa.ebli.calque.ZSelectionEvent; +import org.fudaa.ebli.calque.ZSelectionListener; +import org.fudaa.ebli.calque.ZScene.SceneSelectionHelper; +import org.fudaa.ebli.commun.EbliActionSimple; +import org.fudaa.ebli.ressource.EbliResource; +import org.fudaa.fudaa.modeleur.MdlSceneEditor; +import org.fudaa.fudaa.modeleur.layer.MdlLayer2dLine; + +/** + * Action permettant le changement de sens des polylignes selectionn\xE9es. + * @author Emmanuel MARTIN + * @version $Id:$ + */ +public class SceneInvertAction extends EbliActionSimple implements ZSelectionListener { + + protected MdlSceneEditor sceneEditor_; + + public SceneInvertAction(MdlSceneEditor _sceneEditor){ + super(EbliResource.EBLI.getString("Inverser"), null, "INVERSER"); + sceneEditor_=_sceneEditor; + sceneEditor_.getScene().addSelectionListener(this); + } + + public void actionPerformed(final ActionEvent _e) { + sceneEditor_.invertOrientationSelectedGeometries(); + } + + /** + * Autoris\xE9e si 1 ou plusieurs g\xE9om\xE9tries sont compl\xE8tes. + */ + public void updateForSelectionChanged() { + ZScene scn=sceneEditor_.getScene(); + SceneSelectionHelper hlp=sceneEditor_.getScene().getSelectionHelper(); + + boolean mdlLayer2dLine=true; + int i=-1; + int[] geom=hlp.getSelectedIndexes(); + while(mdlLayer2dLine&&++i<geom.length) + mdlLayer2dLine=scn.getLayerForId(geom[i]) instanceof MdlLayer2dLine; + + super.setEnabled(!scn.isSelectionEmpty()&&!scn.isAtomicMode()&&mdlLayer2dLine); + } + + public String getEnableCondition() { + return EbliResource.EBLI.getString("<p>En mode global, un ou plusieurs objet(s) de type polyligne ou polygone.</p>"); + } + + /* (non-Javadoc) + * @see org.fudaa.ebli.calque.ZSelectionListener#selectionChanged(org.fudaa.ebli.calque.ZSelectionEvent) + */ + public void selectionChanged(ZSelectionEvent _evt) { + updateForSelectionChanged(); + } +} Property changes on: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/action/SceneInvertAction.java ___________________________________________________________________ Added: svn:keywords + Id Added: svn:eol-style + native Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/layer/MdlModel2dLine.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/layer/MdlModel2dLine.java 2008-11-16 20:34:00 UTC (rev 4220) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/layer/MdlModel2dLine.java 2008-11-17 14:54:27 UTC (rev 4221) @@ -15,11 +15,14 @@ import org.fudaa.ctulu.CtuluCommandContainer; import org.fudaa.ctulu.CtuluListSelection; import org.fudaa.ctulu.CtuluListSelectionInterface; +import org.fudaa.ctulu.CtuluNamedCommand; import org.fudaa.ctulu.gis.GISGeometryFactory; import org.fudaa.ctulu.gis.GISPolyligne; import org.fudaa.ctulu.gis.GISZoneCollectionLigneBrisee; import org.fudaa.ebli.calque.ZModelGeometryListener; +import org.fudaa.ebli.calque.ZModelListener; import org.fudaa.ebli.calque.edition.ZModeleLigneBriseeEditable; +import org.fudaa.fudaa.commun.FudaaLib; import com.vividsolutions.jts.geom.Coordinate; import com.vividsolutions.jts.geom.CoordinateSequence; @@ -252,4 +255,33 @@ _cmd.addCmd(cmd.getSimplify()); return true; } + + /** + * Inverse le sens de la polyligne. + * @param _idxGeom index de la g\xE9om\xE9trie \xE0 inverser. + * @param _cmd Le container de commandes. + */ + public void invertOrientation(final int _idxGeom, CtuluCommandContainer _cmd){ + LineString geom=(LineString)getGeomData().getGeometry(_idxGeom); + CoordinateSequence seq=geom.getCoordinateSequence(); + for(int i=0;i<seq.size()/2;i++) + for(int j=0;j<3;j++){ + double valTmp=seq.getOrdinate(i, j); + seq.setOrdinate(i, j, seq.getOrdinate(seq.size()-1-i, j)); + seq.setOrdinate(seq.size()-1-i, j, valTmp); + } + fireModelAction(_idxGeom, geom, ZModelListener.GEOMETRY_ACTION_MODIFY); + if (_cmd!=null) + _cmd.addCmd(new CtuluNamedCommand() { + public void redo() { + invertOrientation(_idxGeom, null); + } + public void undo() { + invertOrientation(_idxGeom, null); + } + public String getName() { + return FudaaLib.getS("Inversion de l'orientation"); + } + }); + } } Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/sig/layer/FSigVisuPanel.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/sig/layer/FSigVisuPanel.java 2008-11-16 20:34:00 UTC (rev 4220) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/sig/layer/FSigVisuPanel.java 2008-11-17 14:54:27 UTC (rev 4221) @@ -14,12 +14,9 @@ import javax.swing.JComponent; -import com.memoire.bu.BuMenu; - import org.fudaa.ctulu.CtuluCommandManager; import org.fudaa.ctulu.CtuluLib; import org.fudaa.ctulu.CtuluUndoRedoInterface; - import org.fudaa.ebli.calque.BArbreCalque; import org.fudaa.ebli.calque.BGroupeCalque; import org.fudaa.ebli.calque.ZCalqueGrille; @@ -29,8 +26,9 @@ import org.fudaa.ebli.calque.action.EditVisibilityAction; import org.fudaa.ebli.calque.action.SceneDeplacementAction; import org.fudaa.ebli.calque.action.SceneRotationAction; +import org.fudaa.ebli.calque.action.SceneSelectNextAction; import org.fudaa.ebli.calque.action.SceneSelectPreviousAction; -import org.fudaa.ebli.calque.action.SceneSelectNextAction; +import org.fudaa.ebli.calque.action.SceneShowOrientationAction; import org.fudaa.ebli.calque.edition.ZCalqueDeplacement; import org.fudaa.ebli.calque.edition.ZCalqueEditionGroup; import org.fudaa.ebli.calque.edition.ZEditorDefault; @@ -38,10 +36,11 @@ import org.fudaa.ebli.commun.EbliComponentFactory; import org.fudaa.ebli.commun.EbliFormatter; import org.fudaa.ebli.commun.EbliSelectionMode; - import org.fudaa.fudaa.commun.impl.FudaaCommonImplementation; import org.fudaa.fudaa.sig.FSigAttibuteTypeManager; +import com.memoire.bu.BuMenu; + /** * Le panneau de visualisation 2D g\xE9rant les calques. Cette classe ajoute la gestion * les calques SIG et des services associ\xE9s. @@ -120,16 +119,24 @@ return editor; } + /** + * @return un tableau contenant les actions sp\xE9cifiques \xE0 l'application qui + * seront dans le menu Vue2D. + */ + protected EbliActionInterface[] getActionsInterface(){ + return new EbliActionInterface[] { + null, + new SceneSelectPreviousAction(gisEditor_.getSceneEditor()), + new SceneSelectNextAction(gisEditor_.getSceneEditor()) + }; + } + protected BuMenu[] createSpecificMenus(final String _title) { final BuMenu[] res = new BuMenu[2]; res[0] = new BuMenu(_title, "LAYER"); res[0].setIcon(null); res[0].add(BArbreCalque.buildZNormalMenu(modelArbre_)); - EbliComponentFactory.INSTANCE.addActionsToMenu(new EbliActionInterface[] { - null, - new SceneSelectPreviousAction(gisEditor_.getSceneEditor()), - new SceneSelectNextAction(gisEditor_.getSceneEditor()) - },res[0]); + EbliComponentFactory.INSTANCE.addActionsToMenu(getActionsInterface(),res[0]); fillMenuWithToolsActions(res[0]); res[1] = getThemeMenu(); res[1].setMnemonic(res[1].getText().charAt(0)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bma...@us...> - 2008-11-16 20:34:06
|
Revision: 4220 http://fudaa.svn.sourceforge.net/fudaa/?rev=4220&view=rev Author: bmarchan Date: 2008-11-16 20:34:00 +0000 (Sun, 16 Nov 2008) Log Message: ----------- Restitution de la position de la fenetre Vue 2D lors de l'ouverture d'un projet. Modified Paths: -------------- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/commun/save/FilleVisuSaver.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/commun/save/FudaaFilleVisuPersistence.java Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/commun/save/FilleVisuSaver.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/commun/save/FilleVisuSaver.java 2008-11-14 15:53:13 UTC (rev 4219) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/commun/save/FilleVisuSaver.java 2008-11-16 20:34:00 UTC (rev 4220) @@ -15,22 +15,33 @@ /** * Une classe contenant les propri\xE9t\xE9s de la vue calque. Faire tres attention lors de la modification de cette classe. NE PAS - * CHANGER LE NOM CAR ENREGISTRER DANS DES FICHIERS DE PARAMETRES. + * CHANGER LE NOM CAR ENREGISTRER DANS DES FICHIERS DE PARAMETRES.<p> + * Remarque : Des champs peuvent \xEAtre ajout\xE9s, mais non retir\xE9s (ou db4o ne sait pas restaurer l'objet). * * @author Fred Deniger * @version $Id: FilleVisuSaver.java,v 1.7.4.1 2008-04-01 07:20:53 bmarchan Exp $ */ public final class FilleVisuSaver { + /** Le nom de la fenetre */ + String name_; + /** La localisation de la fenetre */ Point ifLocation_; - String name_; + /** La dimension de la fenetre */ Dimension ifDim_; + /** Contient les infos calque de donn\xE9es */ BCalqueSaverInterface props_; + /** Le nom du calque selectionne */ String selectedLayer_; + /** Le min X viewport de la fenetre en espace reel */ double ptMinX_; + /** Le min Y viewport de la fenetre en espace reel */ double ptMinY_; + /** Le max X viewport de la fenetre en espace reel */ double ptMaxX_ = -1; + /** Le max Y viewport de la fenetre en espace reel */ double ptMaxY_ = -1; + /** Les propri\xE9t\xE9s pour le calque de l\xE9gende */ EbliUIProperties legendUI_; public FilleVisuSaver() { Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/commun/save/FudaaFilleVisuPersistence.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/commun/save/FudaaFilleVisuPersistence.java 2008-11-14 15:53:13 UTC (rev 4219) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/commun/save/FudaaFilleVisuPersistence.java 2008-11-16 20:34:00 UTC (rev 4220) @@ -179,6 +179,9 @@ if (_saveData.ifDim_ != null) { visu_.setSize(_saveData.ifDim_); } + if (_saveData.ifLocation_ != null) { + visu_.setLocation(_saveData.ifLocation_); + } if (_saveData.ptMaxX_ > _saveData.ptMinX_ && _saveData.ptMaxY_ > _saveData.ptMinY_) { final GrBoite b = new GrBoite(); b.ajuste(_saveData.ptMaxX_, _saveData.ptMaxY_, 0); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bma...@us...> - 2008-11-14 15:53:17
|
Revision: 4219 http://fudaa.svn.sourceforge.net/fudaa/?rev=4219&view=rev Author: bmarchan Date: 2008-11-14 15:53:13 +0000 (Fri, 14 Nov 2008) Log Message: ----------- Axes hydrauliques sans Z. Modified Paths: -------------- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/layer/MdlModel1dAxe.java Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/layer/MdlModel1dAxe.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/layer/MdlModel1dAxe.java 2008-11-14 14:50:16 UTC (rev 4218) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/layer/MdlModel1dAxe.java 2008-11-14 15:53:13 UTC (rev 4219) @@ -25,7 +25,6 @@ public MdlModel1dAxe(final ZModelGeometryListener _listener) { super(_listener); GISAttribute[] attrs=new GISAttribute[]{ - GISAttributeConstants.BATHY, GISAttributeConstants.ETAT_GEOM, GISAttributeConstants.TITRE, GISAttributeConstants.NATURE, @@ -33,7 +32,6 @@ }; // 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_AH); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bma...@us...> - 2008-11-14 14:50:27
|
Revision: 4218 http://fudaa.svn.sourceforge.net/fudaa/?rev=4218&view=rev Author: bmarchan Date: 2008-11-14 14:50:16 +0000 (Fri, 14 Nov 2008) Log Message: ----------- D?\195?\169placement des classes de lecture Mascaret de mascaret -> marscaret.io. Modified Paths: -------------- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/sig/wizard/FSigFileLoaderMascaret.java Added Paths: ----------- branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/mascaret/io/ branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/mascaret/io/MascaretFileFormat.java branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/mascaret/io/MascaretReader.java Removed Paths: ------------- branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/mascaret/MascaretFileFormat.java branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/mascaret/MascaretReader.java Property Changed: ---------------- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/sig/wizard/FSigFileLoaderMascaret.java Deleted: branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/mascaret/MascaretFileFormat.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/mascaret/MascaretFileFormat.java 2008-11-14 14:43:52 UTC (rev 4217) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/mascaret/MascaretFileFormat.java 2008-11-14 14:50:16 UTC (rev 4218) @@ -1,38 +0,0 @@ -/* - * @creation 13 nov. 2008 - * @modification $Date:$ - * @license GNU General Public License 2 - * @copyright (c)1998-2008 CETMEF 2 bd Gambetta F-60231 Compiegne - * @mail fud...@li... - */ -package org.fudaa.dodico.mascaret; - -import org.fudaa.ctulu.fileformat.FileFormatUnique; -import org.fudaa.ctulu.fileformat.FileReadOperationAbstract; -import org.fudaa.ctulu.fileformat.FileWriteOperationAbstract; - -/** - * @author Emmanuel MARTIN - * @version $Id:$ - */ -public class MascaretFileFormat extends FileFormatUnique { - - public MascaretFileFormat() { - super(1); - } - - /* (non-Javadoc) - * @see org.fudaa.ctulu.fileformat.FileFormatVersionInterface#createReader() - */ - public FileReadOperationAbstract createReader() { - return new MascaretReader(); - } - - /* (non-Javadoc) - * @see org.fudaa.ctulu.fileformat.FileFormatVersionInterface#createWriter() - */ - public FileWriteOperationAbstract createWriter() { - return null; - } - -} Deleted: branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/mascaret/MascaretReader.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/mascaret/MascaretReader.java 2008-11-14 14:43:52 UTC (rev 4217) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/mascaret/MascaretReader.java 2008-11-14 14:50:16 UTC (rev 4218) @@ -1,307 +0,0 @@ -/* - * @creation 13 nov. 2008 - * @modification $Date:$ - * @license GNU General Public License 2 - * @copyright (c)1998-2008 CETMEF 2 bd Gambetta F-60231 Compiegne - * @mail fud...@li... - */ -package org.fudaa.dodico.mascaret; - -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileReader; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import org.fudaa.ctulu.CtuluAnalyze; -import org.fudaa.ctulu.fileformat.FileReadOperationAbstract; -import org.fudaa.ctulu.fileformat.FortranInterface; -import org.fudaa.ctulu.gis.GISAttributeConstants; -import org.fudaa.ctulu.gis.GISAttributeInterface; -import org.fudaa.ctulu.gis.GISPolyligne; -import org.fudaa.ctulu.gis.GISZoneCollectionLigneBrisee; -import org.fudaa.dodico.commun.DodicoLib; - -import com.vividsolutions.jts.geom.impl.CoordinateArraySequence; - -/** - * Parser du format Mascaret. (versions 6.0 et pr\xE9c\xE9dentes) - * @author Emmanuel MARTIN - * @version $Id$ - */ -public class MascaretReader extends FileReadOperationAbstract { - - /** - * Container des informations relative \xE0 un profil. - */ - private class Profil{ - public String nomBief; - public String nomProfil; - public List<Double> coordZ=new ArrayList<Double>(); // Bathy ou Topo - public List<Character> bathyOuTopo=new ArrayList<Character>(); // B ou T - // Info sp\xE9cifique 1D - public double abscisseCurvilingeAxeHydraulique; - public List<Double> coordCurviligneProfil=new ArrayList<Double>(); - // Info sp\xE9cifique 2D - public List<double[]> coordXYTraceProfil=new ArrayList<double[]>(); - public double[] coordIntersectionAxeHydraulique; - public List<double[]> coordXYProfil=new ArrayList<double[]>(); - - /** @return vrai si seul des informations 1d sont pr\xE9sentes. */ - public boolean is1d(){ - return coordCurviligneProfil.size()>0&&coordXYTraceProfil.size()==0&&coordIntersectionAxeHydraulique==null - &&coordXYProfil.size()==0; - } - - /** @return vrai si les informations 2d sont pr\xE9sentes. (les infos 1d peuvent \xEAtre \xE9galement pr\xE9sentes) */ - public boolean is2d(){ - return (coordXYTraceProfil.size()!=0||coordIntersectionAxeHydraulique!=null&&coordIntersectionAxeHydraulique.length!=0||coordXYProfil - .size()!=0); - } - - /** Check les attributs communs \xE0 1d et 2d. */ - private boolean checkCommon(){ - boolean check=nomBief.length()>0&&nomProfil.length()>0&&coordZ.size()>0&&bathyOuTopo.size()==coordZ.size(); - int i=-1; - // Verifi que bathyOuTopo ne comporte que B ou T - while(check&&++i<bathyOuTopo.size()) - check=bathyOuTopo.get(i).equals('T')||bathyOuTopo.get(i).equals('B'); - return check; - } - - /** @return vrai si les informations utile 1D sont compl\xE8tes et coh\xE9rentes. */ - public boolean check1D(){ - boolean check=checkCommon()&&abscisseCurvilingeAxeHydraulique>=0&&coordCurviligneProfil.size()==coordZ.size(); - int i=0; - // Verifi que l'ordre des coordonn\xE9es est croissant. - while(check&&++i<coordCurviligneProfil.size()) - check=coordCurviligneProfil.get(i-1)<=coordCurviligneProfil.get(i); - return check; - } - - /** @return vrai si les informations utile 2D sont compl\xE8tes et coh\xE9rentes. */ - public boolean check2D(){ - boolean check=checkCommon()&&coordXYTraceProfil.size()>=2&&coordXYTraceProfil.size()<=4 - &&coordIntersectionAxeHydraulique.length==2&&coordXYProfil.size()==coordZ.size(); - // Verification de la taille des coordonn\xE9es XY du profile - int i=-1; - while(check&&++i<coordXYProfil.size()) - check=coordXYProfil.get(i).length==2; - return check; - } - } - - /** Exception lev\xE9e quand une probl\xE8me est trouv\xE9 pendant le parsing. */ - private class ParseError extends Exception{ - public ParseError(String _message){ - super(_message); - } - } - - /** Le fichier \xE0 lire */ - private FileReader rawData_; - private String fileName_; - /** Les caract\xE8res de 's\xE9paration' */ - private char[] charSeparation_=new char[]{' ', '\t'}; - private char charSeparationNewLigne_='\n'; - /** Profiles extraits */ - List<Profil> profils_=new ArrayList<Profil>(); - - public MascaretReader() { - rawData_=null; - } - - /** - * Retourne vrai si _element est dans _tabElements - * @param _element - * @param _tabElements - * @return retourne vrai si _element est dans _tabElements - */ - private boolean in(final char _element, final char[] _tabElements){ - boolean found=false; - int i=-1; - while(!found&&++i<_tabElements.length) - found=_element==_tabElements[i]; - return found; - } - - /** - * @return token dont le caract\xE8re de s\xE9paration est le retour \xE0 la ligne. Null si rien \xE0 lire. - */ - private StringBuffer nextLineToken(){ - StringBuffer token=new StringBuffer(); - int currentRawChar; - try { - currentRawChar=rawData_.read(); - // Lecture du token : lecture tant qu'un caract\xE8re de s\xE9paration n'est pas - // trouv\xE9. - while (currentRawChar!=-1&&((char)currentRawChar)!=charSeparationNewLigne_) { - token.append((char)currentRawChar); - currentRawChar=rawData_.read(); - } - } - catch (IOException _exc) { - // Erreur dans un des rawData_.read() - _exc.printStackTrace(); - } - // Retour du token - return token.length()==0 ? null:token; - } - - /** - * Retourne le token suivant dans le flux (liste de caract\xE8re jusqu'au - * caract\xE8re de s\xE9paration suivant). - * @return le token ou null si il n'y en a pas. - */ - private String nextWordToken(StringBuffer _lineToken) { - StringBuffer token=new StringBuffer(); - // Elimination des caract\xE8res de s\xE9paration avant le token - while (_lineToken.length()>0&&in(_lineToken.charAt(0), charSeparation_)) - _lineToken.deleteCharAt(0); - // Lecture du token : lecture tant qu'un caract\xE8re de s\xE9paration n'est pas - // trouv\xE9. - while (_lineToken.length()>0&&!in(_lineToken.charAt(0), charSeparation_)) { - token.append(_lineToken.charAt(0)); - _lineToken.deleteCharAt(0); - } - // Retour du token - return token.toString().length()==0 ? null:token.toString(); - } - - /* (non-Javadoc) - * @see org.fudaa.ctulu.fileformat.FileReadOperationAbstract#internalRead() - */ - @Override - protected Object internalRead() { - try { - StringBuffer lineToken=nextLineToken(); - if(lineToken==null) - throw new ParseError(fileName_+DodicoLib.getS(" : le fichier est vide.")); - /* - * Boucle principale : une it\xE9ration par profil - */ - String token=nextWordToken(lineToken); - while (lineToken!=null&&token.equalsIgnoreCase("profil")) { - Profil profil=new Profil(); - - // Premi\xE8re ligne \\ - // Extraction des informations commune \xE0 1d et 2d - profil.nomBief=nextWordToken(lineToken); - profil.nomProfil=nextWordToken(lineToken); - profil.abscisseCurvilingeAxeHydraulique=Double.parseDouble(nextWordToken(lineToken)); - // Coordonn\xE9es de trace de profile : non pr\xE9sent dans les fichiers 1d - token=nextWordToken(lineToken); - while (token!=null&&!token.equals("AXE")) { - profil.coordXYTraceProfil.add(new double[]{Double.parseDouble(token), Double.parseDouble(nextWordToken(lineToken))}); - token=nextWordToken(lineToken); - } - // Coordonn\xE9e d'intersection du profile et de l'axe hydraulique - if (token!=null&&token.equals("AXE")) - profil.coordIntersectionAxeHydraulique=new double[]{Double.parseDouble(nextWordToken(lineToken)), - Double.parseDouble(nextWordToken(lineToken))}; - - // Lignes suivantes : coordonn\xE9es du profile \\ - lineToken=nextLineToken(); - while (lineToken!=null&&!(token=nextWordToken(lineToken)).equalsIgnoreCase("profil")) { - profil.coordCurviligneProfil.add(Double.parseDouble(token)); - profil.coordZ.add(Double.parseDouble(nextWordToken(lineToken))); - profil.bathyOuTopo.add(nextWordToken(lineToken).charAt(0)); - // Coordonn\xE9es XY : non pr\xE9sent dans les fichiers 1d - token=nextWordToken(lineToken); - if (token!=null) - profil.coordXYProfil.add(new double[]{Double.parseDouble(token), Double.parseDouble(nextWordToken(lineToken))}); - lineToken=nextLineToken(); - } - // Verification de la coh\xE9rance des informations - if (profil.is1d()) - throw new ParseError(fileName_+DodicoLib.getS(" : les profils 1D ne sont pas g\xE9r\xE9s")); - else if (!(profil.is2d()&&profil.check2D())) - throw new ParseError(fileName_+DodicoLib.getS(" : le fichier source comporte des erreurs.")); - // Ajout du profile \xE0 la liste et traitement du profile suivant - profils_.add(profil); - } - // G\xE9n\xE9ration d'un GISZoneCollection avec les informations extraites et - // retour de celle-ci - return generateGIS(); - } - catch (ParseError _exc) { - analyze_.addFatalError(_exc.getMessage()); - } - catch (NumberFormatException _exc){ - analyze_.addFatalError(fileName_+DodicoLib.getS(" : le fichier source comporte des erreurs.")); - } - catch (NullPointerException _exc){ - analyze_.addFatalError(fileName_+DodicoLib.getS(" : le fichier source comporte des erreurs.")); - } - return null; - } - - private GISZoneCollectionLigneBrisee generateGIS(){ - progress_.setDesc(DodicoLib.getS("Lecture de ")+fileName_); - // Cr\xE9ation de la GISZoneCollectionLigneBrisee - GISZoneCollectionLigneBrisee zone=new GISZoneCollectionLigneBrisee(); - zone.setAttributes(new GISAttributeInterface[]{GISAttributeConstants.TITRE, GISAttributeConstants.NATURE}, null); - // G\xE9n\xE9ration des profiles et des traces de profiles \\ - for(int k=0;k<profils_.size();k++){ - progress_.setProgression((int)((float)k/profils_.size()*100)); - Profil profil=profils_.get(k); - CoordinateArraySequence coordSeq=new CoordinateArraySequence(profil.coordXYTraceProfil.size()); - // Trace profil - for(int i=0;i<profil.coordXYTraceProfil.size();i++){ - coordSeq.setOrdinate(i, 0, profil.coordXYTraceProfil.get(i)[0]); - coordSeq.setOrdinate(i, 1, profil.coordXYTraceProfil.get(i)[1]); - } - zone.addGeometry(new GISPolyligne(coordSeq), new Object[]{profil.nomProfil, GISAttributeConstants.ATT_NATURE_TP}, null); - // Profil - coordSeq=new CoordinateArraySequence(profil.coordXYProfil.size()); - for(int i=0;i<profil.coordXYProfil.size();i++){ - coordSeq.setOrdinate(i, 0, profil.coordXYProfil.get(i)[0]); - coordSeq.setOrdinate(i, 1, profil.coordXYProfil.get(i)[1]); - coordSeq.setOrdinate(i, 2, profil.coordZ.get(i)); - } - zone.addGeometry(new GISPolyligne(coordSeq), new Object[]{profil.nomProfil, GISAttributeConstants.ATT_NATURE_PF}, null); - } - if (profils_.size()>1) { - // G\xE9n\xE9ration de l'axe hydraulique \\ - CoordinateArraySequence coordSeq=new CoordinateArraySequence(profils_.size()); - for (int i=0; i<profils_.size(); i++) { - coordSeq.setOrdinate(i, 0, profils_.get(i).coordIntersectionAxeHydraulique[0]); - coordSeq.setOrdinate(i, 1, profils_.get(i).coordIntersectionAxeHydraulique[1]); - } - zone.addGeometry(new GISPolyligne(coordSeq), new Object[]{null, GISAttributeConstants.ATT_NATURE_AH}, null); - } - else - analyze_.addInfo(fileName_+DodicoLib.getS(" : le fichier ne comporte qu'un profil, aucun axe hydraulique ne sera g\xE9n\xE9r\xE9.")); - return zone; - } - - /* (non-Javadoc) - * @see org.fudaa.ctulu.fileformat.FileOperationAbstract#getFortranInterface() - */ - @Override - protected FortranInterface getFortranInterface() { - return new FortranInterface() { - public void close() throws IOException{ - if (rawData_ != null) - rawData_.close(); - } - }; - } - - /* (non-Javadoc) - * @see org.fudaa.ctulu.fileformat.FileOperationAbstract#setFile(java.io.File) - */ - @Override - public void setFile(File _f) { - fileName_=_f.getName(); - analyze_ = new CtuluAnalyze(); - analyze_.setResource(_f.getAbsolutePath()); - try { - rawData_=new FileReader(_f); - } - catch (FileNotFoundException _exc) { - } - } - -} Copied: branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/mascaret/io/MascaretFileFormat.java (from rev 4216, branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/mascaret/MascaretFileFormat.java) =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/mascaret/io/MascaretFileFormat.java (rev 0) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/mascaret/io/MascaretFileFormat.java 2008-11-14 14:50:16 UTC (rev 4218) @@ -0,0 +1,38 @@ +/* + * @creation 13 nov. 2008 + * @modification $Date:$ + * @license GNU General Public License 2 + * @copyright (c)1998-2008 CETMEF 2 bd Gambetta F-60231 Compiegne + * @mail fud...@li... + */ +package org.fudaa.dodico.mascaret.io; + +import org.fudaa.ctulu.fileformat.FileFormatUnique; +import org.fudaa.ctulu.fileformat.FileReadOperationAbstract; +import org.fudaa.ctulu.fileformat.FileWriteOperationAbstract; + +/** + * @author Emmanuel MARTIN + * @version $Id$ + */ +public class MascaretFileFormat extends FileFormatUnique { + + public MascaretFileFormat() { + super(1); + } + + /* (non-Javadoc) + * @see org.fudaa.ctulu.fileformat.FileFormatVersionInterface#createReader() + */ + public FileReadOperationAbstract createReader() { + return new MascaretReader(); + } + + /* (non-Javadoc) + * @see org.fudaa.ctulu.fileformat.FileFormatVersionInterface#createWriter() + */ + public FileWriteOperationAbstract createWriter() { + return null; + } + +} Property changes on: branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/mascaret/io/MascaretFileFormat.java ___________________________________________________________________ Added: svn:keywords + Date Revision Author URL Id Added: svn:mergeinfo + /branches/Br_FudaaModeleur_TF/fudaa_devel/dodico/src/org/fudaa/dodico/mascaret/MascaretFileFormat.java:3445-3850 /branches/FudaaModeleur_TC1/fudaa_devel/dodico/src/org/fudaa/dodico/mascaret/MascaretFileFormat.java:3861-3891 Added: svn:eol-style + native Copied: branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/mascaret/io/MascaretReader.java (from rev 4217, branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/mascaret/MascaretReader.java) =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/mascaret/io/MascaretReader.java (rev 0) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/mascaret/io/MascaretReader.java 2008-11-14 14:50:16 UTC (rev 4218) @@ -0,0 +1,307 @@ +/* + * @creation 13 nov. 2008 + * @modification $Date:$ + * @license GNU General Public License 2 + * @copyright (c)1998-2008 CETMEF 2 bd Gambetta F-60231 Compiegne + * @mail fud...@li... + */ +package org.fudaa.dodico.mascaret.io; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +import org.fudaa.ctulu.CtuluAnalyze; +import org.fudaa.ctulu.fileformat.FileReadOperationAbstract; +import org.fudaa.ctulu.fileformat.FortranInterface; +import org.fudaa.ctulu.gis.GISAttributeConstants; +import org.fudaa.ctulu.gis.GISAttributeInterface; +import org.fudaa.ctulu.gis.GISPolyligne; +import org.fudaa.ctulu.gis.GISZoneCollectionLigneBrisee; +import org.fudaa.dodico.commun.DodicoLib; + +import com.vividsolutions.jts.geom.impl.CoordinateArraySequence; + +/** + * Parser du format Mascaret. (versions 6.0 et pr\xE9c\xE9dentes) + * @author Emmanuel MARTIN + * @version $Id$ + */ +public class MascaretReader extends FileReadOperationAbstract { + + /** + * Container des informations relative \xE0 un profil. + */ + private class Profil{ + public String nomBief; + public String nomProfil; + public List<Double> coordZ=new ArrayList<Double>(); // Bathy ou Topo + public List<Character> bathyOuTopo=new ArrayList<Character>(); // B ou T + // Info sp\xE9cifique 1D + public double abscisseCurvilingeAxeHydraulique; + public List<Double> coordCurviligneProfil=new ArrayList<Double>(); + // Info sp\xE9cifique 2D + public List<double[]> coordXYTraceProfil=new ArrayList<double[]>(); + public double[] coordIntersectionAxeHydraulique; + public List<double[]> coordXYProfil=new ArrayList<double[]>(); + + /** @return vrai si seul des informations 1d sont pr\xE9sentes. */ + public boolean is1d(){ + return coordCurviligneProfil.size()>0&&coordXYTraceProfil.size()==0&&coordIntersectionAxeHydraulique==null + &&coordXYProfil.size()==0; + } + + /** @return vrai si les informations 2d sont pr\xE9sentes. (les infos 1d peuvent \xEAtre \xE9galement pr\xE9sentes) */ + public boolean is2d(){ + return (coordXYTraceProfil.size()!=0||coordIntersectionAxeHydraulique!=null&&coordIntersectionAxeHydraulique.length!=0||coordXYProfil + .size()!=0); + } + + /** Check les attributs communs \xE0 1d et 2d. */ + private boolean checkCommon(){ + boolean check=nomBief.length()>0&&nomProfil.length()>0&&coordZ.size()>0&&bathyOuTopo.size()==coordZ.size(); + int i=-1; + // Verifi que bathyOuTopo ne comporte que B ou T + while(check&&++i<bathyOuTopo.size()) + check=bathyOuTopo.get(i).equals('T')||bathyOuTopo.get(i).equals('B'); + return check; + } + + /** @return vrai si les informations utile 1D sont compl\xE8tes et coh\xE9rentes. */ + public boolean check1D(){ + boolean check=checkCommon()&&abscisseCurvilingeAxeHydraulique>=0&&coordCurviligneProfil.size()==coordZ.size(); + int i=0; + // Verifi que l'ordre des coordonn\xE9es est croissant. + while(check&&++i<coordCurviligneProfil.size()) + check=coordCurviligneProfil.get(i-1)<=coordCurviligneProfil.get(i); + return check; + } + + /** @return vrai si les informations utile 2D sont compl\xE8tes et coh\xE9rentes. */ + public boolean check2D(){ + boolean check=checkCommon()&&coordXYTraceProfil.size()>=2&&coordXYTraceProfil.size()<=4 + &&coordIntersectionAxeHydraulique.length==2&&coordXYProfil.size()==coordZ.size(); + // Verification de la taille des coordonn\xE9es XY du profile + int i=-1; + while(check&&++i<coordXYProfil.size()) + check=coordXYProfil.get(i).length==2; + return check; + } + } + + /** Exception lev\xE9e quand une probl\xE8me est trouv\xE9 pendant le parsing. */ + private class ParseError extends Exception{ + public ParseError(String _message){ + super(_message); + } + } + + /** Le fichier \xE0 lire */ + private FileReader rawData_; + private String fileName_; + /** Les caract\xE8res de 's\xE9paration' */ + private char[] charSeparation_=new char[]{' ', '\t'}; + private char charSeparationNewLigne_='\n'; + /** Profiles extraits */ + List<Profil> profils_=new ArrayList<Profil>(); + + public MascaretReader() { + rawData_=null; + } + + /** + * Retourne vrai si _element est dans _tabElements + * @param _element + * @param _tabElements + * @return retourne vrai si _element est dans _tabElements + */ + private boolean in(final char _element, final char[] _tabElements){ + boolean found=false; + int i=-1; + while(!found&&++i<_tabElements.length) + found=_element==_tabElements[i]; + return found; + } + + /** + * @return token dont le caract\xE8re de s\xE9paration est le retour \xE0 la ligne. Null si rien \xE0 lire. + */ + private StringBuffer nextLineToken(){ + StringBuffer token=new StringBuffer(); + int currentRawChar; + try { + currentRawChar=rawData_.read(); + // Lecture du token : lecture tant qu'un caract\xE8re de s\xE9paration n'est pas + // trouv\xE9. + while (currentRawChar!=-1&&((char)currentRawChar)!=charSeparationNewLigne_) { + token.append((char)currentRawChar); + currentRawChar=rawData_.read(); + } + } + catch (IOException _exc) { + // Erreur dans un des rawData_.read() + _exc.printStackTrace(); + } + // Retour du token + return token.length()==0 ? null:token; + } + + /** + * Retourne le token suivant dans le flux (liste de caract\xE8re jusqu'au + * caract\xE8re de s\xE9paration suivant). + * @return le token ou null si il n'y en a pas. + */ + private String nextWordToken(StringBuffer _lineToken) { + StringBuffer token=new StringBuffer(); + // Elimination des caract\xE8res de s\xE9paration avant le token + while (_lineToken.length()>0&&in(_lineToken.charAt(0), charSeparation_)) + _lineToken.deleteCharAt(0); + // Lecture du token : lecture tant qu'un caract\xE8re de s\xE9paration n'est pas + // trouv\xE9. + while (_lineToken.length()>0&&!in(_lineToken.charAt(0), charSeparation_)) { + token.append(_lineToken.charAt(0)); + _lineToken.deleteCharAt(0); + } + // Retour du token + return token.toString().length()==0 ? null:token.toString(); + } + + /* (non-Javadoc) + * @see org.fudaa.ctulu.fileformat.FileReadOperationAbstract#internalRead() + */ + @Override + protected Object internalRead() { + try { + StringBuffer lineToken=nextLineToken(); + if(lineToken==null) + throw new ParseError(fileName_+DodicoLib.getS(" : le fichier est vide.")); + /* + * Boucle principale : une it\xE9ration par profil + */ + String token=nextWordToken(lineToken); + while (lineToken!=null&&token.equalsIgnoreCase("profil")) { + Profil profil=new Profil(); + + // Premi\xE8re ligne \\ + // Extraction des informations commune \xE0 1d et 2d + profil.nomBief=nextWordToken(lineToken); + profil.nomProfil=nextWordToken(lineToken); + profil.abscisseCurvilingeAxeHydraulique=Double.parseDouble(nextWordToken(lineToken)); + // Coordonn\xE9es de trace de profile : non pr\xE9sent dans les fichiers 1d + token=nextWordToken(lineToken); + while (token!=null&&!token.equals("AXE")) { + profil.coordXYTraceProfil.add(new double[]{Double.parseDouble(token), Double.parseDouble(nextWordToken(lineToken))}); + token=nextWordToken(lineToken); + } + // Coordonn\xE9e d'intersection du profile et de l'axe hydraulique + if (token!=null&&token.equals("AXE")) + profil.coordIntersectionAxeHydraulique=new double[]{Double.parseDouble(nextWordToken(lineToken)), + Double.parseDouble(nextWordToken(lineToken))}; + + // Lignes suivantes : coordonn\xE9es du profile \\ + lineToken=nextLineToken(); + while (lineToken!=null&&!(token=nextWordToken(lineToken)).equalsIgnoreCase("profil")) { + profil.coordCurviligneProfil.add(Double.parseDouble(token)); + profil.coordZ.add(Double.parseDouble(nextWordToken(lineToken))); + profil.bathyOuTopo.add(nextWordToken(lineToken).charAt(0)); + // Coordonn\xE9es XY : non pr\xE9sent dans les fichiers 1d + token=nextWordToken(lineToken); + if (token!=null) + profil.coordXYProfil.add(new double[]{Double.parseDouble(token), Double.parseDouble(nextWordToken(lineToken))}); + lineToken=nextLineToken(); + } + // Verification de la coh\xE9rance des informations + if (profil.is1d()) + throw new ParseError(fileName_+DodicoLib.getS(" : les profils 1D ne sont pas g\xE9r\xE9s")); + else if (!(profil.is2d()&&profil.check2D())) + throw new ParseError(fileName_+DodicoLib.getS(" : le fichier source comporte des erreurs.")); + // Ajout du profile \xE0 la liste et traitement du profile suivant + profils_.add(profil); + } + // G\xE9n\xE9ration d'un GISZoneCollection avec les informations extraites et + // retour de celle-ci + return generateGIS(); + } + catch (ParseError _exc) { + analyze_.addFatalError(_exc.getMessage()); + } + catch (NumberFormatException _exc){ + analyze_.addFatalError(fileName_+DodicoLib.getS(" : le fichier source comporte des erreurs.")); + } + catch (NullPointerException _exc){ + analyze_.addFatalError(fileName_+DodicoLib.getS(" : le fichier source comporte des erreurs.")); + } + return null; + } + + private GISZoneCollectionLigneBrisee generateGIS(){ + progress_.setDesc(DodicoLib.getS("Lecture de ")+fileName_); + // Cr\xE9ation de la GISZoneCollectionLigneBrisee + GISZoneCollectionLigneBrisee zone=new GISZoneCollectionLigneBrisee(); + zone.setAttributes(new GISAttributeInterface[]{GISAttributeConstants.TITRE, GISAttributeConstants.NATURE}, null); + // G\xE9n\xE9ration des profiles et des traces de profiles \\ + for(int k=0;k<profils_.size();k++){ + progress_.setProgression((int)((float)k/profils_.size()*100)); + Profil profil=profils_.get(k); + CoordinateArraySequence coordSeq=new CoordinateArraySequence(profil.coordXYTraceProfil.size()); + // Trace profil + for(int i=0;i<profil.coordXYTraceProfil.size();i++){ + coordSeq.setOrdinate(i, 0, profil.coordXYTraceProfil.get(i)[0]); + coordSeq.setOrdinate(i, 1, profil.coordXYTraceProfil.get(i)[1]); + } + zone.addGeometry(new GISPolyligne(coordSeq), new Object[]{profil.nomProfil, GISAttributeConstants.ATT_NATURE_TP}, null); + // Profil + coordSeq=new CoordinateArraySequence(profil.coordXYProfil.size()); + for(int i=0;i<profil.coordXYProfil.size();i++){ + coordSeq.setOrdinate(i, 0, profil.coordXYProfil.get(i)[0]); + coordSeq.setOrdinate(i, 1, profil.coordXYProfil.get(i)[1]); + coordSeq.setOrdinate(i, 2, profil.coordZ.get(i)); + } + zone.addGeometry(new GISPolyligne(coordSeq), new Object[]{profil.nomProfil, GISAttributeConstants.ATT_NATURE_PF}, null); + } + if (profils_.size()>1) { + // G\xE9n\xE9ration de l'axe hydraulique \\ + CoordinateArraySequence coordSeq=new CoordinateArraySequence(profils_.size()); + for (int i=0; i<profils_.size(); i++) { + coordSeq.setOrdinate(i, 0, profils_.get(i).coordIntersectionAxeHydraulique[0]); + coordSeq.setOrdinate(i, 1, profils_.get(i).coordIntersectionAxeHydraulique[1]); + } + zone.addGeometry(new GISPolyligne(coordSeq), new Object[]{null, GISAttributeConstants.ATT_NATURE_AH}, null); + } + else + analyze_.addInfo(fileName_+DodicoLib.getS(" : le fichier ne comporte qu'un profil, aucun axe hydraulique ne sera g\xE9n\xE9r\xE9.")); + return zone; + } + + /* (non-Javadoc) + * @see org.fudaa.ctulu.fileformat.FileOperationAbstract#getFortranInterface() + */ + @Override + protected FortranInterface getFortranInterface() { + return new FortranInterface() { + public void close() throws IOException{ + if (rawData_ != null) + rawData_.close(); + } + }; + } + + /* (non-Javadoc) + * @see org.fudaa.ctulu.fileformat.FileOperationAbstract#setFile(java.io.File) + */ + @Override + public void setFile(File _f) { + fileName_=_f.getName(); + analyze_ = new CtuluAnalyze(); + analyze_.setResource(_f.getAbsolutePath()); + try { + rawData_=new FileReader(_f); + } + catch (FileNotFoundException _exc) { + } + } + +} Property changes on: branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/mascaret/io/MascaretReader.java ___________________________________________________________________ Added: svn:keywords + Date Revision Author URL Id Added: svn:mergeinfo + /branches/Br_FudaaModeleur_TF/fudaa_devel/dodico/src/org/fudaa/dodico/mascaret/MascaretReader.java:3445-3850 /branches/FudaaModeleur_TC1/fudaa_devel/dodico/src/org/fudaa/dodico/mascaret/MascaretReader.java:3861-3891 Added: svn:eol-style + native Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/sig/wizard/FSigFileLoaderMascaret.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/sig/wizard/FSigFileLoaderMascaret.java 2008-11-14 14:43:52 UTC (rev 4217) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/sig/wizard/FSigFileLoaderMascaret.java 2008-11-14 14:50:16 UTC (rev 4218) @@ -16,7 +16,7 @@ import org.fudaa.ctulu.gis.GISDataModelAttributeAdapter; import org.fudaa.ctulu.gis.GISLib; import org.fudaa.ctulu.gis.GISZoneCollectionLigneBrisee; -import org.fudaa.dodico.mascaret.MascaretFileFormat; +import org.fudaa.dodico.mascaret.io.MascaretFileFormat; import com.memoire.bu.BuFileFilter; Property changes on: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/sig/wizard/FSigFileLoaderMascaret.java ___________________________________________________________________ Modified: svn:keywords - Id + Date Revision Author URL Id This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bma...@us...> - 2008-11-14 14:43:58
|
Revision: 4217 http://fudaa.svn.sourceforge.net/fudaa/?rev=4217&view=rev Author: bmarchan Date: 2008-11-14 14:43:52 +0000 (Fri, 14 Nov 2008) Log Message: ----------- Correction des messages a l'utilisateur. Modified Paths: -------------- branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/mascaret/MascaretReader.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/sig/wizard/FSigFileLoaderMascaret.java Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/mascaret/MascaretReader.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/mascaret/MascaretReader.java 2008-11-14 11:10:52 UTC (rev 4216) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/mascaret/MascaretReader.java 2008-11-14 14:43:52 UTC (rev 4217) @@ -28,7 +28,7 @@ /** * Parser du format Mascaret. (versions 6.0 et pr\xE9c\xE9dentes) * @author Emmanuel MARTIN - * @version $Id:$ + * @version $Id$ */ public class MascaretReader extends FileReadOperationAbstract { @@ -41,22 +41,22 @@ public List<Double> coordZ=new ArrayList<Double>(); // Bathy ou Topo public List<Character> bathyOuTopo=new ArrayList<Character>(); // B ou T // Info sp\xE9cifique 1D - public double abscisseCurvilingeAxeHydrolique; + public double abscisseCurvilingeAxeHydraulique; public List<Double> coordCurviligneProfil=new ArrayList<Double>(); // Info sp\xE9cifique 2D public List<double[]> coordXYTraceProfil=new ArrayList<double[]>(); - public double[] coordIntersectionAxeHydrolique; + public double[] coordIntersectionAxeHydraulique; public List<double[]> coordXYProfil=new ArrayList<double[]>(); /** @return vrai si seul des informations 1d sont pr\xE9sentes. */ public boolean is1d(){ - return coordCurviligneProfil.size()>0&&coordXYTraceProfil.size()==0&&coordIntersectionAxeHydrolique==null + return coordCurviligneProfil.size()>0&&coordXYTraceProfil.size()==0&&coordIntersectionAxeHydraulique==null &&coordXYProfil.size()==0; } /** @return vrai si les informations 2d sont pr\xE9sentes. (les infos 1d peuvent \xEAtre \xE9galement pr\xE9sentes) */ public boolean is2d(){ - return (coordXYTraceProfil.size()!=0||coordIntersectionAxeHydrolique!=null&&coordIntersectionAxeHydrolique.length!=0||coordXYProfil + return (coordXYTraceProfil.size()!=0||coordIntersectionAxeHydraulique!=null&&coordIntersectionAxeHydraulique.length!=0||coordXYProfil .size()!=0); } @@ -72,7 +72,7 @@ /** @return vrai si les informations utile 1D sont compl\xE8tes et coh\xE9rentes. */ public boolean check1D(){ - boolean check=checkCommon()&&abscisseCurvilingeAxeHydrolique>=0&&coordCurviligneProfil.size()==coordZ.size(); + boolean check=checkCommon()&&abscisseCurvilingeAxeHydraulique>=0&&coordCurviligneProfil.size()==coordZ.size(); int i=0; // Verifi que l'ordre des coordonn\xE9es est croissant. while(check&&++i<coordCurviligneProfil.size()) @@ -83,7 +83,7 @@ /** @return vrai si les informations utile 2D sont compl\xE8tes et coh\xE9rentes. */ public boolean check2D(){ boolean check=checkCommon()&&coordXYTraceProfil.size()>=2&&coordXYTraceProfil.size()<=4 - &&coordIntersectionAxeHydrolique.length==2&&coordXYProfil.size()==coordZ.size(); + &&coordIntersectionAxeHydraulique.length==2&&coordXYProfil.size()==coordZ.size(); // Verification de la taille des coordonn\xE9es XY du profile int i=-1; while(check&&++i<coordXYProfil.size()) @@ -127,7 +127,7 @@ } /** - * @returnun token dont le caract\xE8re de s\xE9paration est le retour \xE0 la ligne. Null si rien \xE0 lire. + * @return token dont le caract\xE8re de s\xE9paration est le retour \xE0 la ligne. Null si rien \xE0 lire. */ private StringBuffer nextLineToken(){ StringBuffer token=new StringBuffer(); @@ -189,16 +189,16 @@ // Extraction des informations commune \xE0 1d et 2d profil.nomBief=nextWordToken(lineToken); profil.nomProfil=nextWordToken(lineToken); - profil.abscisseCurvilingeAxeHydrolique=Double.parseDouble(nextWordToken(lineToken)); + profil.abscisseCurvilingeAxeHydraulique=Double.parseDouble(nextWordToken(lineToken)); // Coordonn\xE9es de trace de profile : non pr\xE9sent dans les fichiers 1d token=nextWordToken(lineToken); while (token!=null&&!token.equals("AXE")) { profil.coordXYTraceProfil.add(new double[]{Double.parseDouble(token), Double.parseDouble(nextWordToken(lineToken))}); token=nextWordToken(lineToken); } - // Coordonn\xE9e d'intersection du profile et de l'axe hydrolique + // Coordonn\xE9e d'intersection du profile et de l'axe hydraulique if (token!=null&&token.equals("AXE")) - profil.coordIntersectionAxeHydrolique=new double[]{Double.parseDouble(nextWordToken(lineToken)), + profil.coordIntersectionAxeHydraulique=new double[]{Double.parseDouble(nextWordToken(lineToken)), Double.parseDouble(nextWordToken(lineToken))}; // Lignes suivantes : coordonn\xE9es du profile \\ @@ -215,7 +215,7 @@ } // Verification de la coh\xE9rance des informations if (profil.is1d()) - throw new ParseError(fileName_+DodicoLib.getS(" : les profiles 1D ne sont pas g\xE9r\xE9s")); + throw new ParseError(fileName_+DodicoLib.getS(" : les profils 1D ne sont pas g\xE9r\xE9s")); else if (!(profil.is2d()&&profil.check2D())) throw new ParseError(fileName_+DodicoLib.getS(" : le fichier source comporte des erreurs.")); // Ajout du profile \xE0 la liste et traitement du profile suivant @@ -263,16 +263,16 @@ zone.addGeometry(new GISPolyligne(coordSeq), new Object[]{profil.nomProfil, GISAttributeConstants.ATT_NATURE_PF}, null); } if (profils_.size()>1) { - // G\xE9n\xE9ration de l'axe hydrolique \\ + // G\xE9n\xE9ration de l'axe hydraulique \\ CoordinateArraySequence coordSeq=new CoordinateArraySequence(profils_.size()); for (int i=0; i<profils_.size(); i++) { - coordSeq.setOrdinate(i, 0, profils_.get(i).coordIntersectionAxeHydrolique[0]); - coordSeq.setOrdinate(i, 1, profils_.get(i).coordIntersectionAxeHydrolique[1]); + coordSeq.setOrdinate(i, 0, profils_.get(i).coordIntersectionAxeHydraulique[0]); + coordSeq.setOrdinate(i, 1, profils_.get(i).coordIntersectionAxeHydraulique[1]); } zone.addGeometry(new GISPolyligne(coordSeq), new Object[]{null, GISAttributeConstants.ATT_NATURE_AH}, null); } else - analyze_.addInfo(fileName_+DodicoLib.getS(" : le fichier ne comporte qu'un profile, aucun axe hydrolique ne sera g\xE9n\xE9r\xE9.")); + analyze_.addInfo(fileName_+DodicoLib.getS(" : le fichier ne comporte qu'un profil, aucun axe hydraulique ne sera g\xE9n\xE9r\xE9.")); return zone; } Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/sig/wizard/FSigFileLoaderMascaret.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/sig/wizard/FSigFileLoaderMascaret.java 2008-11-14 11:10:52 UTC (rev 4216) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/sig/wizard/FSigFileLoaderMascaret.java 2008-11-14 14:43:52 UTC (rev 4217) @@ -21,17 +21,17 @@ import com.memoire.bu.BuFileFilter; /** - * Loader des fichiers mascaret (extension : geomref). + * Loader des fichiers mascaret (extension : georef). * * @author Emmanuel MARTIN - * @version $Id:$ + * @version $Id$ */ public class FSigFileLoaderMascaret implements FSigFileLoaderI { private BuFileFilter filter_; public FSigFileLoaderMascaret(){ - filter_=new BuFileFilter(new String[]{"geo", "georef"}, "Fichier mascaret"); + filter_=new BuFileFilter(new String[]{"geo", "georef"}, "Mascaret"); } private FSigFileLoaderMascaret(final BuFileFilter _filter){ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <emm...@us...> - 2008-11-14 11:10:57
|
Revision: 4216 http://fudaa.svn.sourceforge.net/fudaa/?rev=4216&view=rev Author: emmanuel_martin Date: 2008-11-14 11:10:52 +0000 (Fri, 14 Nov 2008) Log Message: ----------- Tache #82 : "Import de fichier Mascaret avec r?\195?\169f?\195?\169rence 2D." Modified Paths: -------------- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/commun/impl/FudaaCommonImplementation.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/sig/wizard/FSigWizardFileMng.java Added Paths: ----------- branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/mascaret/MascaretFileFormat.java branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/mascaret/MascaretReader.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/sig/wizard/FSigFileLoaderMascaret.java Added: branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/mascaret/MascaretFileFormat.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/mascaret/MascaretFileFormat.java (rev 0) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/mascaret/MascaretFileFormat.java 2008-11-14 11:10:52 UTC (rev 4216) @@ -0,0 +1,38 @@ +/* + * @creation 13 nov. 2008 + * @modification $Date:$ + * @license GNU General Public License 2 + * @copyright (c)1998-2008 CETMEF 2 bd Gambetta F-60231 Compiegne + * @mail fud...@li... + */ +package org.fudaa.dodico.mascaret; + +import org.fudaa.ctulu.fileformat.FileFormatUnique; +import org.fudaa.ctulu.fileformat.FileReadOperationAbstract; +import org.fudaa.ctulu.fileformat.FileWriteOperationAbstract; + +/** + * @author Emmanuel MARTIN + * @version $Id:$ + */ +public class MascaretFileFormat extends FileFormatUnique { + + public MascaretFileFormat() { + super(1); + } + + /* (non-Javadoc) + * @see org.fudaa.ctulu.fileformat.FileFormatVersionInterface#createReader() + */ + public FileReadOperationAbstract createReader() { + return new MascaretReader(); + } + + /* (non-Javadoc) + * @see org.fudaa.ctulu.fileformat.FileFormatVersionInterface#createWriter() + */ + public FileWriteOperationAbstract createWriter() { + return null; + } + +} Property changes on: branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/mascaret/MascaretFileFormat.java ___________________________________________________________________ Added: svn:keywords + Id Added: svn:eol-style + native Added: branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/mascaret/MascaretReader.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/mascaret/MascaretReader.java (rev 0) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/mascaret/MascaretReader.java 2008-11-14 11:10:52 UTC (rev 4216) @@ -0,0 +1,307 @@ +/* + * @creation 13 nov. 2008 + * @modification $Date:$ + * @license GNU General Public License 2 + * @copyright (c)1998-2008 CETMEF 2 bd Gambetta F-60231 Compiegne + * @mail fud...@li... + */ +package org.fudaa.dodico.mascaret; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +import org.fudaa.ctulu.CtuluAnalyze; +import org.fudaa.ctulu.fileformat.FileReadOperationAbstract; +import org.fudaa.ctulu.fileformat.FortranInterface; +import org.fudaa.ctulu.gis.GISAttributeConstants; +import org.fudaa.ctulu.gis.GISAttributeInterface; +import org.fudaa.ctulu.gis.GISPolyligne; +import org.fudaa.ctulu.gis.GISZoneCollectionLigneBrisee; +import org.fudaa.dodico.commun.DodicoLib; + +import com.vividsolutions.jts.geom.impl.CoordinateArraySequence; + +/** + * Parser du format Mascaret. (versions 6.0 et pr\xE9c\xE9dentes) + * @author Emmanuel MARTIN + * @version $Id:$ + */ +public class MascaretReader extends FileReadOperationAbstract { + + /** + * Container des informations relative \xE0 un profil. + */ + private class Profil{ + public String nomBief; + public String nomProfil; + public List<Double> coordZ=new ArrayList<Double>(); // Bathy ou Topo + public List<Character> bathyOuTopo=new ArrayList<Character>(); // B ou T + // Info sp\xE9cifique 1D + public double abscisseCurvilingeAxeHydrolique; + public List<Double> coordCurviligneProfil=new ArrayList<Double>(); + // Info sp\xE9cifique 2D + public List<double[]> coordXYTraceProfil=new ArrayList<double[]>(); + public double[] coordIntersectionAxeHydrolique; + public List<double[]> coordXYProfil=new ArrayList<double[]>(); + + /** @return vrai si seul des informations 1d sont pr\xE9sentes. */ + public boolean is1d(){ + return coordCurviligneProfil.size()>0&&coordXYTraceProfil.size()==0&&coordIntersectionAxeHydrolique==null + &&coordXYProfil.size()==0; + } + + /** @return vrai si les informations 2d sont pr\xE9sentes. (les infos 1d peuvent \xEAtre \xE9galement pr\xE9sentes) */ + public boolean is2d(){ + return (coordXYTraceProfil.size()!=0||coordIntersectionAxeHydrolique!=null&&coordIntersectionAxeHydrolique.length!=0||coordXYProfil + .size()!=0); + } + + /** Check les attributs communs \xE0 1d et 2d. */ + private boolean checkCommon(){ + boolean check=nomBief.length()>0&&nomProfil.length()>0&&coordZ.size()>0&&bathyOuTopo.size()==coordZ.size(); + int i=-1; + // Verifi que bathyOuTopo ne comporte que B ou T + while(check&&++i<bathyOuTopo.size()) + check=bathyOuTopo.get(i).equals('T')||bathyOuTopo.get(i).equals('B'); + return check; + } + + /** @return vrai si les informations utile 1D sont compl\xE8tes et coh\xE9rentes. */ + public boolean check1D(){ + boolean check=checkCommon()&&abscisseCurvilingeAxeHydrolique>=0&&coordCurviligneProfil.size()==coordZ.size(); + int i=0; + // Verifi que l'ordre des coordonn\xE9es est croissant. + while(check&&++i<coordCurviligneProfil.size()) + check=coordCurviligneProfil.get(i-1)<=coordCurviligneProfil.get(i); + return check; + } + + /** @return vrai si les informations utile 2D sont compl\xE8tes et coh\xE9rentes. */ + public boolean check2D(){ + boolean check=checkCommon()&&coordXYTraceProfil.size()>=2&&coordXYTraceProfil.size()<=4 + &&coordIntersectionAxeHydrolique.length==2&&coordXYProfil.size()==coordZ.size(); + // Verification de la taille des coordonn\xE9es XY du profile + int i=-1; + while(check&&++i<coordXYProfil.size()) + check=coordXYProfil.get(i).length==2; + return check; + } + } + + /** Exception lev\xE9e quand une probl\xE8me est trouv\xE9 pendant le parsing. */ + private class ParseError extends Exception{ + public ParseError(String _message){ + super(_message); + } + } + + /** Le fichier \xE0 lire */ + private FileReader rawData_; + private String fileName_; + /** Les caract\xE8res de 's\xE9paration' */ + private char[] charSeparation_=new char[]{' ', '\t'}; + private char charSeparationNewLigne_='\n'; + /** Profiles extraits */ + List<Profil> profils_=new ArrayList<Profil>(); + + public MascaretReader() { + rawData_=null; + } + + /** + * Retourne vrai si _element est dans _tabElements + * @param _element + * @param _tabElements + * @return retourne vrai si _element est dans _tabElements + */ + private boolean in(final char _element, final char[] _tabElements){ + boolean found=false; + int i=-1; + while(!found&&++i<_tabElements.length) + found=_element==_tabElements[i]; + return found; + } + + /** + * @returnun token dont le caract\xE8re de s\xE9paration est le retour \xE0 la ligne. Null si rien \xE0 lire. + */ + private StringBuffer nextLineToken(){ + StringBuffer token=new StringBuffer(); + int currentRawChar; + try { + currentRawChar=rawData_.read(); + // Lecture du token : lecture tant qu'un caract\xE8re de s\xE9paration n'est pas + // trouv\xE9. + while (currentRawChar!=-1&&((char)currentRawChar)!=charSeparationNewLigne_) { + token.append((char)currentRawChar); + currentRawChar=rawData_.read(); + } + } + catch (IOException _exc) { + // Erreur dans un des rawData_.read() + _exc.printStackTrace(); + } + // Retour du token + return token.length()==0 ? null:token; + } + + /** + * Retourne le token suivant dans le flux (liste de caract\xE8re jusqu'au + * caract\xE8re de s\xE9paration suivant). + * @return le token ou null si il n'y en a pas. + */ + private String nextWordToken(StringBuffer _lineToken) { + StringBuffer token=new StringBuffer(); + // Elimination des caract\xE8res de s\xE9paration avant le token + while (_lineToken.length()>0&&in(_lineToken.charAt(0), charSeparation_)) + _lineToken.deleteCharAt(0); + // Lecture du token : lecture tant qu'un caract\xE8re de s\xE9paration n'est pas + // trouv\xE9. + while (_lineToken.length()>0&&!in(_lineToken.charAt(0), charSeparation_)) { + token.append(_lineToken.charAt(0)); + _lineToken.deleteCharAt(0); + } + // Retour du token + return token.toString().length()==0 ? null:token.toString(); + } + + /* (non-Javadoc) + * @see org.fudaa.ctulu.fileformat.FileReadOperationAbstract#internalRead() + */ + @Override + protected Object internalRead() { + try { + StringBuffer lineToken=nextLineToken(); + if(lineToken==null) + throw new ParseError(fileName_+DodicoLib.getS(" : le fichier est vide.")); + /* + * Boucle principale : une it\xE9ration par profil + */ + String token=nextWordToken(lineToken); + while (lineToken!=null&&token.equalsIgnoreCase("profil")) { + Profil profil=new Profil(); + + // Premi\xE8re ligne \\ + // Extraction des informations commune \xE0 1d et 2d + profil.nomBief=nextWordToken(lineToken); + profil.nomProfil=nextWordToken(lineToken); + profil.abscisseCurvilingeAxeHydrolique=Double.parseDouble(nextWordToken(lineToken)); + // Coordonn\xE9es de trace de profile : non pr\xE9sent dans les fichiers 1d + token=nextWordToken(lineToken); + while (token!=null&&!token.equals("AXE")) { + profil.coordXYTraceProfil.add(new double[]{Double.parseDouble(token), Double.parseDouble(nextWordToken(lineToken))}); + token=nextWordToken(lineToken); + } + // Coordonn\xE9e d'intersection du profile et de l'axe hydrolique + if (token!=null&&token.equals("AXE")) + profil.coordIntersectionAxeHydrolique=new double[]{Double.parseDouble(nextWordToken(lineToken)), + Double.parseDouble(nextWordToken(lineToken))}; + + // Lignes suivantes : coordonn\xE9es du profile \\ + lineToken=nextLineToken(); + while (lineToken!=null&&!(token=nextWordToken(lineToken)).equalsIgnoreCase("profil")) { + profil.coordCurviligneProfil.add(Double.parseDouble(token)); + profil.coordZ.add(Double.parseDouble(nextWordToken(lineToken))); + profil.bathyOuTopo.add(nextWordToken(lineToken).charAt(0)); + // Coordonn\xE9es XY : non pr\xE9sent dans les fichiers 1d + token=nextWordToken(lineToken); + if (token!=null) + profil.coordXYProfil.add(new double[]{Double.parseDouble(token), Double.parseDouble(nextWordToken(lineToken))}); + lineToken=nextLineToken(); + } + // Verification de la coh\xE9rance des informations + if (profil.is1d()) + throw new ParseError(fileName_+DodicoLib.getS(" : les profiles 1D ne sont pas g\xE9r\xE9s")); + else if (!(profil.is2d()&&profil.check2D())) + throw new ParseError(fileName_+DodicoLib.getS(" : le fichier source comporte des erreurs.")); + // Ajout du profile \xE0 la liste et traitement du profile suivant + profils_.add(profil); + } + // G\xE9n\xE9ration d'un GISZoneCollection avec les informations extraites et + // retour de celle-ci + return generateGIS(); + } + catch (ParseError _exc) { + analyze_.addFatalError(_exc.getMessage()); + } + catch (NumberFormatException _exc){ + analyze_.addFatalError(fileName_+DodicoLib.getS(" : le fichier source comporte des erreurs.")); + } + catch (NullPointerException _exc){ + analyze_.addFatalError(fileName_+DodicoLib.getS(" : le fichier source comporte des erreurs.")); + } + return null; + } + + private GISZoneCollectionLigneBrisee generateGIS(){ + progress_.setDesc(DodicoLib.getS("Lecture de ")+fileName_); + // Cr\xE9ation de la GISZoneCollectionLigneBrisee + GISZoneCollectionLigneBrisee zone=new GISZoneCollectionLigneBrisee(); + zone.setAttributes(new GISAttributeInterface[]{GISAttributeConstants.TITRE, GISAttributeConstants.NATURE}, null); + // G\xE9n\xE9ration des profiles et des traces de profiles \\ + for(int k=0;k<profils_.size();k++){ + progress_.setProgression((int)((float)k/profils_.size()*100)); + Profil profil=profils_.get(k); + CoordinateArraySequence coordSeq=new CoordinateArraySequence(profil.coordXYTraceProfil.size()); + // Trace profil + for(int i=0;i<profil.coordXYTraceProfil.size();i++){ + coordSeq.setOrdinate(i, 0, profil.coordXYTraceProfil.get(i)[0]); + coordSeq.setOrdinate(i, 1, profil.coordXYTraceProfil.get(i)[1]); + } + zone.addGeometry(new GISPolyligne(coordSeq), new Object[]{profil.nomProfil, GISAttributeConstants.ATT_NATURE_TP}, null); + // Profil + coordSeq=new CoordinateArraySequence(profil.coordXYProfil.size()); + for(int i=0;i<profil.coordXYProfil.size();i++){ + coordSeq.setOrdinate(i, 0, profil.coordXYProfil.get(i)[0]); + coordSeq.setOrdinate(i, 1, profil.coordXYProfil.get(i)[1]); + coordSeq.setOrdinate(i, 2, profil.coordZ.get(i)); + } + zone.addGeometry(new GISPolyligne(coordSeq), new Object[]{profil.nomProfil, GISAttributeConstants.ATT_NATURE_PF}, null); + } + if (profils_.size()>1) { + // G\xE9n\xE9ration de l'axe hydrolique \\ + CoordinateArraySequence coordSeq=new CoordinateArraySequence(profils_.size()); + for (int i=0; i<profils_.size(); i++) { + coordSeq.setOrdinate(i, 0, profils_.get(i).coordIntersectionAxeHydrolique[0]); + coordSeq.setOrdinate(i, 1, profils_.get(i).coordIntersectionAxeHydrolique[1]); + } + zone.addGeometry(new GISPolyligne(coordSeq), new Object[]{null, GISAttributeConstants.ATT_NATURE_AH}, null); + } + else + analyze_.addInfo(fileName_+DodicoLib.getS(" : le fichier ne comporte qu'un profile, aucun axe hydrolique ne sera g\xE9n\xE9r\xE9.")); + return zone; + } + + /* (non-Javadoc) + * @see org.fudaa.ctulu.fileformat.FileOperationAbstract#getFortranInterface() + */ + @Override + protected FortranInterface getFortranInterface() { + return new FortranInterface() { + public void close() throws IOException{ + if (rawData_ != null) + rawData_.close(); + } + }; + } + + /* (non-Javadoc) + * @see org.fudaa.ctulu.fileformat.FileOperationAbstract#setFile(java.io.File) + */ + @Override + public void setFile(File _f) { + fileName_=_f.getName(); + analyze_ = new CtuluAnalyze(); + analyze_.setResource(_f.getAbsolutePath()); + try { + rawData_=new FileReader(_f); + } + catch (FileNotFoundException _exc) { + } + } + +} Property changes on: branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/mascaret/MascaretReader.java ___________________________________________________________________ Added: svn:keywords + Id Added: svn:eol-style + native Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/commun/impl/FudaaCommonImplementation.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/commun/impl/FudaaCommonImplementation.java 2008-11-13 10:39:29 UTC (rev 4215) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/commun/impl/FudaaCommonImplementation.java 2008-11-14 11:10:52 UTC (rev 4216) @@ -979,9 +979,12 @@ } error(_analyze.getDesc(), deb, false); return true; - } else if (_analyze.containsErrors()) { + } else if (_analyze.containsErrors()) error(_analyze.getDesc(), CtuluAnalyze.getResume(_analyze.getErrorCanal(), 5), false); - } + else if (_analyze.containsInfos()) + message(FudaaLib.getS("Informations"), CtuluAnalyze.getResume(_analyze.getInfoCanal(), 20), false); + else if (_analyze.containsWarnings()) + warn(FudaaLib.getS("Attention"), CtuluAnalyze.getResume(_analyze.getWarnCanal(), 20), false); return false; } Added: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/sig/wizard/FSigFileLoaderMascaret.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/sig/wizard/FSigFileLoaderMascaret.java (rev 0) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/sig/wizard/FSigFileLoaderMascaret.java 2008-11-14 11:10:52 UTC (rev 4216) @@ -0,0 +1,78 @@ +/* + * @creation 13 nov. 2008 + * @modification $Date:$ + * @license GNU General Public License 2 + * @copyright (c)1998-2008 CETMEF 2 bd Gambetta F-60231 Compiegne + * @mail fud...@li... + */ +package org.fudaa.fudaa.sig.wizard; + +import java.io.File; + +import org.fudaa.ctulu.CtuluAnalyze; +import org.fudaa.ctulu.CtuluIOOperationSynthese; +import org.fudaa.ctulu.ProgressionInterface; +import org.fudaa.ctulu.gis.GISAttributeConstants; +import org.fudaa.ctulu.gis.GISDataModelAttributeAdapter; +import org.fudaa.ctulu.gis.GISLib; +import org.fudaa.ctulu.gis.GISZoneCollectionLigneBrisee; +import org.fudaa.dodico.mascaret.MascaretFileFormat; + +import com.memoire.bu.BuFileFilter; + +/** + * Loader des fichiers mascaret (extension : geomref). + * + * @author Emmanuel MARTIN + * @version $Id:$ + */ +public class FSigFileLoaderMascaret implements FSigFileLoaderI { + + private BuFileFilter filter_; + + public FSigFileLoaderMascaret(){ + filter_=new BuFileFilter(new String[]{"geo", "georef"}, "Fichier mascaret"); + } + + private FSigFileLoaderMascaret(final BuFileFilter _filter){ + filter_=_filter; + } + + /* (non-Javadoc) + * @see org.fudaa.fudaa.sig.wizard.FSigFileLoaderI#createNew() + */ + public FSigFileLoaderI createNew() { + return new FSigFileLoaderMascaret(filter_); + } + + /* (non-Javadoc) + * @see org.fudaa.fudaa.sig.wizard.FSigFileLoaderI#getFileFilter() + */ + public BuFileFilter getFileFilter() { + return filter_; + } + + /* (non-Javadoc) + * @see org.fudaa.fudaa.sig.wizard.FSigFileLoaderI#setInResult(org.fudaa.fudaa.sig.wizard.FSigFileLoadResult, java.io.File, java.lang.String, org.fudaa.ctulu.ProgressionInterface, org.fudaa.ctulu.CtuluAnalyze) + */ + public void setInResult(FSigFileLoadResult _r, File _f, String _origine, ProgressionInterface _prog, CtuluAnalyze _analyze) { + final CtuluIOOperationSynthese op=new MascaretFileFormat().read(_f, _prog); + // En cas d'erreur, fin d'import. + if(op.containsMessages()&&op.getAnalyze().containsFatalError()||op.getAnalyze().containsErrors()||op.getAnalyze().containsInfos()||op.getAnalyze().containsWarnings()) + _analyze.merge(op.getAnalyze()); + if(op.containsMessages()&&op.getAnalyze().containsFatalError()) + return; + + GISZoneCollectionLigneBrisee lines=(GISZoneCollectionLigneBrisee)op.getSource(); + _r.nbPointTotal_+=lines.getNumPoints(); + _r.nbPolylignes_+=lines.getNumGeometries(); + // Ajout de l'attribut ETAT_GEOM + _r.findOrCreateAttribute(GISAttributeConstants.ETAT_GEOM.getID(), String.class, false); + GISDataModelAttributeAdapter adapter = new GISDataModelAttributeAdapter(lines); + adapter.addAttribut(GISAttributeConstants.ETAT_GEOM, _origine); + // + _r.ligneModel_.add(adapter); + _r.addUsedAttributes(GISLib.getAttributeFrom(lines)); + } + +} Property changes on: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/sig/wizard/FSigFileLoaderMascaret.java ___________________________________________________________________ Added: svn:keywords + Id Added: svn:eol-style + native Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/sig/wizard/FSigWizardFileMng.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/sig/wizard/FSigWizardFileMng.java 2008-11-13 10:39:29 UTC (rev 4215) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/sig/wizard/FSigWizardFileMng.java 2008-11-14 11:10:52 UTC (rev 4216) @@ -155,6 +155,8 @@ addLoader(r, fmtLoader, new FSigFileLoaderReflucadPRO()); // reflux solution addLoader(r, fmtLoader, new FSigFileLoaderRefluxRefondeResult()); + // Mascaret + addLoader(r, fmtLoader, new FSigFileLoaderMascaret()); // les maillages addGridList(r, fmtLoader); final BuFileFilter[] filters = new BuFileFilter[r.size()]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <emm...@us...> - 2008-11-13 10:39:38
|
Revision: 4215 http://fudaa.svn.sourceforge.net/fudaa/?rev=4215&view=rev Author: emmanuel_martin Date: 2008-11-13 10:39:29 +0000 (Thu, 13 Nov 2008) Log Message: ----------- bugfix #20 Modified Paths: -------------- branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISZoneCollectionLigneBrisee.java Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISZoneCollectionLigneBrisee.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISZoneCollectionLigneBrisee.java 2008-11-13 10:09:54 UTC (rev 4214) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISZoneCollectionLigneBrisee.java 2008-11-13 10:39:29 UTC (rev 4215) @@ -230,7 +230,7 @@ // Raccourci si tous les sommets sont s\xE9lectionn\xE9s. int nbSel=_sel.getNbSelectedIndex(); - if (nbSel==nbPt) { + if (nbSel==nbPt||(nbSel+1==nbPt&&(geometry_.getValueAt(_idxGeom) instanceof GISPolygone))) { removeGeometries(new int[]{_idxGeom}, _cmd); return true; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <emm...@us...> - 2008-11-13 10:09:56
|
Revision: 4214 http://fudaa.svn.sourceforge.net/fudaa/?rev=4214&view=rev Author: emmanuel_martin Date: 2008-11-13 10:09:54 +0000 (Thu, 13 Nov 2008) Log Message: ----------- #60 bis Modified Paths: -------------- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/action/CalqueGISEditionAction.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/BPaletteEdition.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlEditionManager.java Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/action/CalqueGISEditionAction.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/action/CalqueGISEditionAction.java 2008-11-12 17:09:52 UTC (rev 4213) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/action/CalqueGISEditionAction.java 2008-11-13 10:09:54 UTC (rev 4214) @@ -92,7 +92,7 @@ if (target_ != newTarget) { target_ = newTarget; if (isSelected()) { - setPaletteTarget(target_ == null ? null : editor_); + setPaletteTarget(editor_); } else { setEnabled(isTargetValid(null)); } Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/BPaletteEdition.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/BPaletteEdition.java 2008-11-12 17:09:52 UTC (rev 4213) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/BPaletteEdition.java 2008-11-13 10:09:54 UTC (rev 4214) @@ -308,7 +308,7 @@ _target.add(bt); } - final static String ATOM_ACTION = "MODE_ATOME"; + public final static String ATOM_ACTION = "MODE_ATOME"; /** * Envoie les commandes au receveur suite \xE0 un click sur un bouton. Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlEditionManager.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlEditionManager.java 2008-11-12 17:09:52 UTC (rev 4213) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlEditionManager.java 2008-11-13 10:09:54 UTC (rev 4214) @@ -13,7 +13,6 @@ import javax.swing.AbstractButton; -import org.fudaa.ctulu.CtuluCommandManager; import org.fudaa.ctulu.CtuluIOOperationSynthese; import org.fudaa.ctulu.CtuluRunnable; import org.fudaa.ctulu.ProgressionInterface; @@ -21,26 +20,21 @@ import org.fudaa.ctulu.gui.CtuluLibSwing; import org.fudaa.ebli.calque.BCalque; import org.fudaa.ebli.calque.BGroupeCalque; -import org.fudaa.ebli.calque.ZCalqueAffichageDonnees; import org.fudaa.ebli.calque.action.SceneSplitAction; import org.fudaa.ebli.calque.dessin.DeForme; +import org.fudaa.ebli.calque.edition.BPaletteEdition; import org.fudaa.ebli.calque.edition.ZCalqueEditable; import org.fudaa.ebli.commun.EbliActionAbstract; import org.fudaa.ebli.commun.EbliActionInterface; import org.fudaa.fudaa.commun.FudaaLib; -import org.fudaa.fudaa.modeleur.action.CalqueNewCalqueAction; import org.fudaa.fudaa.modeleur.action.SceneDecimationAction; import org.fudaa.fudaa.modeleur.action.SceneInterpolationAction; import org.fudaa.fudaa.modeleur.action.SceneMoveInLayerAction; import org.fudaa.fudaa.modeleur.action.SceneProjectionAction; import org.fudaa.fudaa.modeleur.action.SceneRefinementAction; -import org.fudaa.fudaa.modeleur.layer.MdlLayerFactory; -import org.fudaa.fudaa.modeleur.layer.MdlLayerInterface; -import org.fudaa.fudaa.ressource.FudaaResource; import org.fudaa.fudaa.sig.layer.FSigEditor; import org.fudaa.fudaa.sig.layer.FSigLayerExporter; import org.fudaa.fudaa.sig.layer.FSigLayerFilter; -import org.fudaa.fudaa.sig.layer.FSigLayerGroup; import org.fudaa.fudaa.sig.layer.FSigVisuPanel; import com.memoire.bu.BuWizardDialog; @@ -150,10 +144,43 @@ } + @Override public void updatePalette() { - super.updatePalette(); - if(palette_!=null) - palette_.setEnable("MODE_ATOME", true); + if (palette_ == null) { + return; + } + if (target_ == null) { + palette_.setAllEnable(false); + palette_.setEnable(BPaletteEdition.ATOM_ACTION, true); + boolean atomic = palette_.isAtomicMode(); + getSupport().setAtomicMode(atomic); + palette_.setAtomeEnable(getSupport().canUseAtomicMode(), getSupport().isAtomicMode()); + palette_.checkEnableAndCheckBt(); + changeState(null); + } else { + palette_.setAllEnable(true); + boolean atomic = palette_.isAtomicMode(); + getSupport().setAtomicMode(atomic); + palette_.setAtomeEnable(getSupport().canUseAtomicMode(), getSupport().isAtomicMode()); + boolean isModifiable = true; + if(target_.getModelEditable()!=null) + if (target_.getModelEditable().getGeomData() != null) + isModifiable = target_.getModelEditable().getGeomData().isGeomModifiable(); + palette_.setEnable("GLOBAL_ADD_POINT", target_.canAddForme(DeForme.POINT) && isModifiable); + palette_.setEnable("GLOBAL_ADD_POLYLIGNE", target_.canAddForme(DeForme.LIGNE_BRISEE) && isModifiable); + palette_.setEnable("GLOBAL_ADD_RECTANGLE", target_.canAddForme(DeForme.RECTANGLE) && isModifiable); + palette_.setEnable("GLOBAL_ADD_ELLIPSE", target_.canAddForme(DeForme.ELLIPSE) && isModifiable); + palette_.setEnable("GLOBAL_ADD_POLYGONE", target_.canAddForme(DeForme.POLYGONE) && isModifiable); + palette_.setEnable("GLOBAL_ADD_SEMIS", target_.canAddForme(DeForme.MULTI_POINT) && isModifiable); + + } + palette_.checkEnableAndCheckBt(); + final AbstractButton bt = palette_.getSelectedButton(); + if (bt == null) { + changeState(null); + } else { + changeState(bt.getActionCommand()); + } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <emm...@us...> - 2008-11-12 17:10:00
|
Revision: 4213 http://fudaa.svn.sourceforge.net/fudaa/?rev=4213&view=rev Author: emmanuel_martin Date: 2008-11-12 17:09:52 +0000 (Wed, 12 Nov 2008) Log Message: ----------- bugfix : #58, #60 Modified Paths: -------------- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZEbliCalquesPanel.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZScene.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/action/CalqueGISEditionAction.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZEditorDefault.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlEditionManager.java Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZEbliCalquesPanel.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZEbliCalquesPanel.java 2008-11-12 16:24:11 UTC (rev 4212) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZEbliCalquesPanel.java 2008-11-12 17:09:52 UTC (rev 4213) @@ -392,7 +392,7 @@ controller_ = _controller; controller_.setView(this); - scene_=new ZScene(gcDonnees_,controller_.getCqSelectionI()); + scene_=new ZScene(modelArbre_,controller_.getCqSelectionI()); scene_.setRestrictedToCalqueActif(true); scene_.addSelectionListener(this); modelArbre_.addTreeModelListener(scene_); Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZScene.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZScene.java 2008-11-12 16:24:11 UTC (rev 4212) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZScene.java 2008-11-12 17:09:52 UTC (rev 4213) @@ -335,9 +335,8 @@ } - protected BCalque cqRoot_=null; + protected BArbreCalqueModel treeModel_=null; protected ZCalqueAffichageDonneesInterface[] cqs_; - protected BCalque cqActif_=null; /** Le calque de selection interactif */ protected ZCalqueSelectionInteractionAbstract cqSelectionI_=null; protected SceneListSelection selection_=null; @@ -359,8 +358,8 @@ * Cr\xE9ation a partir d'un groupe de calques racine. * @param _root Le groupe de calque racine. */ - public ZScene(BGroupeCalque _root, ZCalqueSelectionInteractionAbstract _cqSelectionI) { - cqRoot_=_root; + public ZScene(BArbreCalqueModel _treeModel, ZCalqueSelectionInteractionAbstract _cqSelectionI) { + treeModel_=_treeModel; cqSelectionI_=_cqSelectionI; cqSelectionI_.setScene(this); initSelection(); @@ -711,31 +710,28 @@ FuLog.trace("EBL: calque actif=" + (_calque == null ? "null" : _calque.getTitle())); } - if (_calque != cqActif_) { boolean sendEvent=false; - if (cqActif_ instanceof ZCalqueAffichageDonneesInterface && isRestrictedToCalqueActif()) { - ((ZCalqueAffichageDonneesInterface)cqActif_).clearSelection(); + if (treeModel_.getSelectedCalque() instanceof ZCalqueAffichageDonneesInterface && isRestrictedToCalqueActif()) { + ((ZCalqueAffichageDonneesInterface)treeModel_.getSelectedCalque()).clearSelection(); // selection_=null; // Pour que la selection se remette a jour. sendEvent=true; } - cqActif_ = _calque; - if (!(cqActif_ instanceof ZCalqueAffichageDonneesInterface)) { + if (!(treeModel_.getSelectedCalque() instanceof ZCalqueAffichageDonneesInterface)) { cqSelectionI_.modificateur_.setSpecial(false); } else { - cqSelectionI_.modificateur_.setSpecial(((ZCalqueAffichageDonneesInterface)cqActif_).isSpecialSelectionAllowed()); + cqSelectionI_.modificateur_.setSpecial(((ZCalqueAffichageDonneesInterface)treeModel_.getSelectedCalque()).isSpecialSelectionAllowed()); } cqSelectionI_.repaint(); if (sendEvent) fireSelectionEvent(); - } } public BCalque getCalqueActif() { - return cqActif_; + return treeModel_.getSelectedCalque(); } public boolean isCalqueActifEditable() { - return cqActif_ instanceof ZCalqueEditable; + return treeModel_.getSelectedCalque() instanceof ZCalqueEditable; } /** @@ -764,8 +760,8 @@ private ZCalqueAffichageDonneesInterface[] getTargetLayers() { if (!isRestrictedToCalqueActif()) return getAllLayers(); - else if (cqActif_ instanceof ZCalqueAffichageDonneesInterface) - return new ZCalqueAffichageDonneesInterface[]{(ZCalqueAffichageDonneesInterface)cqActif_}; + else if (treeModel_.getSelectedCalque() instanceof ZCalqueAffichageDonneesInterface) + return new ZCalqueAffichageDonneesInterface[]{(ZCalqueAffichageDonneesInterface)treeModel_.getSelectedCalque()}; else return new ZCalqueAffichageDonneesInterface[0]; } @@ -773,7 +769,7 @@ public ZCalqueAffichageDonneesInterface[] getAllLayers() { if (brefreshRequested_) { ArrayList<BCalque> lcqs=new ArrayList<BCalque>(); - for ( BCalque cq : cqRoot_.getTousCalques()) { + for ( BCalque cq : treeModel_.getRootCalque().getTousCalques()) { if (cq instanceof ZCalqueAffichageDonneesInterface) lcqs.add(cq); } cqs_=lcqs.toArray(new ZCalqueAffichageDonneesInterface[0]); Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/action/CalqueGISEditionAction.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/action/CalqueGISEditionAction.java 2008-11-12 16:24:11 UTC (rev 4212) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/action/CalqueGISEditionAction.java 2008-11-12 17:09:52 UTC (rev 4213) @@ -89,22 +89,15 @@ */ protected void setTarget(final Object _o) { final Object newTarget=(_o instanceof ZCalqueEditable)?_o:null; - /* - * On n'utilise pas 'isTargetValid' dans cette m\xE9thode car elle est, entre - * autre, appell\xE9e quand la s\xE9lection dans l'arbre est modifi\xE9e; or dans - * ce cas 'CalqueGISEditionAction' est pr\xE9venu avant 'ZScene' de cette - * modification. Donc l'utilisation de 'isTargetValid' est incoh\xE9rente. - */ - boolean valide=scene_!=null && (!scene_.isRestrictedToCalqueActif() || newTarget!=null); if (target_ != newTarget) { target_ = newTarget; if (isSelected()) { setPaletteTarget(target_ == null ? null : editor_); } else { - setEnabled(valide); + setEnabled(isTargetValid(null)); } } - setDisableWhenHide_ = !valide; + setDisableWhenHide_ = !isTargetValid(null); if (editor_ != null) { editor_.setActivated(newTarget, (BPaletteEdition) palette_); } 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 2008-11-12 16:24:11 UTC (rev 4212) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZEditorDefault.java 2008-11-12 17:09:52 UTC (rev 4213) @@ -108,7 +108,7 @@ ZCalqueClickInteraction nodeAdd_; - BPaletteEdition palette_; + protected BPaletteEdition palette_; ZEbliCalquesPanel panel_; @@ -136,7 +136,7 @@ CommandSaisieMultiple saisie_; - ZCalqueEditable target_; + protected ZCalqueEditable target_; /** * @return l'interface utilisateur Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlEditionManager.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlEditionManager.java 2008-11-12 16:24:11 UTC (rev 4212) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlEditionManager.java 2008-11-12 17:09:52 UTC (rev 4213) @@ -11,6 +11,8 @@ import java.util.ArrayList; import java.util.Arrays; +import javax.swing.AbstractButton; + import org.fudaa.ctulu.CtuluCommandManager; import org.fudaa.ctulu.CtuluIOOperationSynthese; import org.fudaa.ctulu.CtuluRunnable; @@ -21,6 +23,7 @@ import org.fudaa.ebli.calque.BGroupeCalque; import org.fudaa.ebli.calque.ZCalqueAffichageDonnees; import org.fudaa.ebli.calque.action.SceneSplitAction; +import org.fudaa.ebli.calque.dessin.DeForme; import org.fudaa.ebli.calque.edition.ZCalqueEditable; import org.fudaa.ebli.commun.EbliActionAbstract; import org.fudaa.ebli.commun.EbliActionInterface; @@ -146,4 +149,11 @@ }.run(); } + + public void updatePalette() { + super.updatePalette(); + if(palette_!=null) + palette_.setEnable("MODE_ATOME", true); + } + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bma...@us...> - 2008-11-12 16:24:14
|
Revision: 4212 http://fudaa.svn.sourceforge.net/fudaa/?rev=4212&view=rev Author: bmarchan Date: 2008-11-12 16:24:11 +0000 (Wed, 12 Nov 2008) Log Message: ----------- Nouveau calque Axe Hydralique. Modified Paths: -------------- branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISAttributeConstants.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZModeleGeometry.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/layer/MdlLayerFactory.java Added Paths: ----------- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/layer/MdlLayer1dAxe.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/layer/MdlModel1dAxe.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/persistence/MdlLayer1dAxePersistence.java Property Changed: ---------------- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/layer/MdlLayerFactory.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 2008-11-12 15:06:29 UTC (rev 4211) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISAttributeConstants.java 2008-11-12 16:24:11 UTC (rev 4212) @@ -55,6 +55,8 @@ public final static String ATT_NATURE_ZN="ZN"; /** Nature Contour d'\xE9tude */ public final static String ATT_NATURE_CE="CE"; + /** Nature axe hydraulique */ + public final static String ATT_NATURE_AH="AH"; /** * Un attribut nom, global. Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZModeleGeometry.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZModeleGeometry.java 2008-11-12 15:06:29 UTC (rev 4211) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZModeleGeometry.java 2008-11-12 16:24:11 UTC (rev 4212) @@ -13,7 +13,8 @@ import org.fudaa.ebli.geometrie.GrPoint; /** - * Un mod\xE8le contenant toutes sortes de GIS g\xE9om\xE9tries (non sp\xE9cialis\xE9). + * Un mod\xE8le contenant toutes sortes de GIS g\xE9om\xE9tries (non sp\xE9cialis\xE9). Les modifications + * apport\xE9es au mod\xE8le peuvent \xEAtre \xE9cout\xE9es. * @see org.fudaa.ebli.calque.ZCalqueGeometry * @author Bertrand Marchand * @version $Id$ @@ -78,7 +79,15 @@ */ public boolean isGeometryVisible(int _idxGeom); + /** + * Ajoute un listener \xE9coutant les modifications apport\xE9es au mod\xE8le. + * @param _listener Le listener. + */ public void addModelListener(ZModelGeometryListener _listener); + /** + * Supprime le listener \xE9coutant les modifications apport\xE9es au mod\xE8le. + * @param _listener Le listener. + */ public void removeModelListener(ZModelGeometryListener _listener); } 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 2008-11-12 15:06:29 UTC (rev 4211) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlVisuPanel.java 2008-11-12 16:24:11 UTC (rev 4212) @@ -19,6 +19,7 @@ import org.fudaa.fudaa.commun.impl.FudaaCommonImplementation; import org.fudaa.fudaa.modeleur.action.CalqueDeleteCalqueAction; import org.fudaa.fudaa.modeleur.action.CalqueNewCalqueAction; +import org.fudaa.fudaa.modeleur.layer.MdlLayer1dAxe; import org.fudaa.fudaa.modeleur.layer.MdlLayer1dTrace; import org.fudaa.fudaa.modeleur.layer.MdlLayer2dCloud; import org.fudaa.fudaa.modeleur.layer.MdlLayer2dConstraintLine; @@ -106,6 +107,10 @@ EbliActionInterface actNewDir=new CalqueNewCalqueAction(FudaaLib.getS("Nouveau calque lignes directions"),FudaaResource.FUDAA.getIcon("ajouter"),MdlLayerFactory.LAYER2D_DIR_LINE,cqSing_,getGisEditor()); cqSing_.setActions(new EbliActionInterface[] { actNewZone, actNewCnt, actNewConst, actNewDir}); + EbliActionInterface actNewTrace=new CalqueNewCalqueAction(FudaaLib.getS("Nouveau calque trace de profils"),FudaaResource.FUDAA.getIcon("ajouter"),MdlLayerFactory.LAYER1D_TRACE,cqMdl1d_,getGisEditor()); + EbliActionInterface actNewAxe=new CalqueNewCalqueAction(FudaaLib.getS("Nouveau calque axes hydrauliques"),FudaaResource.FUDAA.getIcon("ajouter"),MdlLayerFactory.LAYER1D_AXE,cqMdl1d_,getGisEditor()); + cqMdl1d_.setActions(new EbliActionInterface[] { actNewTrace, actNewAxe}); + EbliActionInterface actImport = new FSigImageImportAction(this, cqImg_); cqImg_.setActions(new EbliActionInterface[] { actImport }); @@ -196,6 +201,10 @@ MdlLayer1dTrace cqTrace=new MdlLayer1dTrace(getGisEditor()); cqTrace.setName(BGroupeCalque.findUniqueChildName(cqMdl1d_, cqTrace.getExtName())); cqMdl1d_.add(cqTrace); + + MdlLayer1dAxe cqAxe=new MdlLayer1dAxe(getGisEditor()); + cqAxe.setName(BGroupeCalque.findUniqueChildName(cqMdl1d_, cqAxe.getExtName())); + cqMdl1d_.add(cqAxe); } /** Added: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/layer/MdlLayer1dAxe.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/layer/MdlLayer1dAxe.java (rev 0) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/layer/MdlLayer1dAxe.java 2008-11-12 16:24:11 UTC (rev 4212) @@ -0,0 +1,60 @@ +/* + * @creation 20 janv. 08 + * @modification $Date$ + * @license GNU General Public License 2 + * @copyright (c)1998-2008 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.MdlLayer1dAxePersistence; +import org.fudaa.fudaa.sig.layer.FSigEditor; + +/** + * Un calque pour le stockage et la manipulation des donn\xE9es 1d. + * @author Bertrand Marchand + * @version $Id$ + */ +public class MdlLayer1dAxe extends MdlLayer2dLine { + + /** + * Constructeur. Utilise un mod\xE8le de donn\xE9es et un editeur. + * @param _model Modele + * @param _editor Editeur. + */ + private MdlLayer1dAxe(ZModeleLigneBriseeEditable _model, final FSigEditor _editor) { + super(_model,_editor); + setLineModel(0, new TraceLigneModel(TraceLigne.POINTILLE, 2f, new Color(0,125,0))); + setLineModelOuvert(getLineModel(0)); + setName(getExtName()); + setTitle(MdlResource.MDL.getString("Axes hydrauliques")); + } + + public MdlLayer1dAxe(FSigEditor _editor) { + this(new MdlModel1dAxe(_editor),_editor); + } + + public BCalquePersistenceInterface getPersistenceMng() { + return new MdlLayer1dAxePersistence(); + } + + /** + * Retourne le nom par defaut du calque. + * @return Le nom. + */ + public String getExtName() { + return "axe"; + } + + 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/MdlLayer1dAxe.java ___________________________________________________________________ Added: svn:keywords + Date Revision Author URL Id Added: svn:eol-style + native Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/layer/MdlLayerFactory.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/layer/MdlLayerFactory.java 2008-11-12 15:06:29 UTC (rev 4211) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/layer/MdlLayerFactory.java 2008-11-12 16:24:11 UTC (rev 4212) @@ -1,20 +1,19 @@ /* * @creation 20 janv. 08 - * @modification $Date: 2008/05/13 12:10:43 $ + * @modification $Date$ * @license GNU General Public License 2 * @copyright (c)1998-2008 CETMEF 2 bd Gambetta F-60231 Compiegne * @mail fud...@li... */ package org.fudaa.fudaa.modeleur.layer; -import org.fudaa.ebli.calque.BCalque; import org.fudaa.ebli.calque.ZCalqueAffichageDonnees; import org.fudaa.fudaa.sig.layer.FSigEditor; /** * Une fabrique de calques. * @author Bertrand Marchand - * @version $Id: MdlLayer2dProfile.java,v 1.1.2.5 2008/05/13 12:10:43 bmarchan Exp $ + * @version $Id$ */ public class MdlLayerFactory { public final static int LAYER2D_CLOUD =1; @@ -25,6 +24,7 @@ public final static int LAYER2D_ZONE =6; public final static int LAYER2D_CONTOUR =7; public final static int LAYER1D_TRACE =8; + public final static int LAYER1D_AXE =9; private static MdlLayerFactory factory_=new MdlLayerFactory(); @@ -64,6 +64,8 @@ return new MdlLayer2dContour(_editor); case LAYER1D_TRACE: return new MdlLayer1dTrace(_editor); + case LAYER1D_AXE: + return new MdlLayer1dAxe(_editor); default: throw new IllegalArgumentException("Bad type"); } Property changes on: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/layer/MdlLayerFactory.java ___________________________________________________________________ Added: svn:keywords + Date Revision Author URL Id Added: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/layer/MdlModel1dAxe.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/layer/MdlModel1dAxe.java (rev 0) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/layer/MdlModel1dAxe.java 2008-11-12 16:24:11 UTC (rev 4212) @@ -0,0 +1,39 @@ +/* + * @creation 20 janv. 08 + * @modification $Date$ + * @license GNU General Public License 2 + * @copyright (c)1998-2008 CETMEF 2 bd Gambetta F-60231 Compiegne + * @mail fud...@li... + */ +package org.fudaa.fudaa.modeleur.layer; + +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 1D des axes hydrauliques. Les axes sont des polylignes XYZ. + * + * @author Bertrand Marchand + * @version $Id$ + */ +public class MdlModel1dAxe extends MdlModel2dLine { + + /** + * Construction d'un modele d'axes. + */ + public MdlModel1dAxe(final ZModelGeometryListener _listener) { + 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_AH); + } +} Property changes on: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/layer/MdlModel1dAxe.java ___________________________________________________________________ Added: svn:keywords + Date Revision Author URL Id Added: svn:eol-style + native Added: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/persistence/MdlLayer1dAxePersistence.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/persistence/MdlLayer1dAxePersistence.java (rev 0) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/persistence/MdlLayer1dAxePersistence.java 2008-11-12 16:24:11 UTC (rev 4212) @@ -0,0 +1,27 @@ +/* + * @creation 20 janv. 08 + * @modification $Date$ + * @license GNU General Public License 2 + * @copyright (c)1998-2008 CETMEF 2 bd Gambetta F-60231 Compiegne + * @mail fud...@li... + */ +package org.fudaa.fudaa.modeleur.persistence; + +import org.fudaa.fudaa.modeleur.layer.MdlLayer1dAxe; +import org.fudaa.fudaa.modeleur.layer.MdlLayer2dLine; +import org.fudaa.fudaa.modeleur.layer.MdlLayer2dProfile; +import org.fudaa.fudaa.sig.layer.FSigEditor; + +/** + * Gestion de la persistance pour un calque multipoint. + * @author Bertrand Marchand + * @version $Id$ + * @see MdlLayer1dAxe + */ +public class MdlLayer1dAxePersistence extends MdlLayer2dLinePersistence { + + @Override + protected MdlLayer2dLine createNewLayer(FSigEditor _editor) { + return new MdlLayer1dAxe(_editor); + } +} Property changes on: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/persistence/MdlLayer1dAxePersistence.java ___________________________________________________________________ Added: svn:keywords + Date Revision Author URL 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...> - 2008-11-12 15:06:31
|
Revision: 4211 http://fudaa.svn.sourceforge.net/fudaa/?rev=4211&view=rev Author: emmanuel_martin Date: 2008-11-12 15:06:29 +0000 (Wed, 12 Nov 2008) Log Message: ----------- bugfix #58 Modified Paths: -------------- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/action/CalqueGISEditionAction.java Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/action/CalqueGISEditionAction.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/action/CalqueGISEditionAction.java 2008-11-12 13:36:43 UTC (rev 4210) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/action/CalqueGISEditionAction.java 2008-11-12 15:06:29 UTC (rev 4211) @@ -89,15 +89,22 @@ */ protected void setTarget(final Object _o) { final Object newTarget=(_o instanceof ZCalqueEditable)?_o:null; + /* + * On n'utilise pas 'isTargetValid' dans cette m\xE9thode car elle est, entre + * autre, appell\xE9e quand la s\xE9lection dans l'arbre est modifi\xE9e; or dans + * ce cas 'CalqueGISEditionAction' est pr\xE9venu avant 'ZScene' de cette + * modification. Donc l'utilisation de 'isTargetValid' est incoh\xE9rente. + */ + boolean valide=scene_!=null && (!scene_.isRestrictedToCalqueActif() || newTarget!=null); if (target_ != newTarget) { target_ = newTarget; if (isSelected()) { setPaletteTarget(target_ == null ? null : editor_); } else { - setEnabled(isTargetValid(null)); + setEnabled(valide); } } - setDisableWhenHide_ = !isTargetValid(null); + setDisableWhenHide_ = !valide; if (editor_ != null) { editor_.setActivated(newTarget, (BPaletteEdition) palette_); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <emm...@us...> - 2008-11-12 13:36:45
|
Revision: 4210 http://fudaa.svn.sourceforge.net/fudaa/?rev=4210&view=rev Author: emmanuel_martin Date: 2008-11-12 13:36:43 +0000 (Wed, 12 Nov 2008) Log Message: ----------- bugfix : #92, #96 et #101 Modified Paths: -------------- branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISCollection.java 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/ZModeleLigneBriseeDefault.java Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISCollection.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISCollection.java 2008-11-12 13:33:41 UTC (rev 4209) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISCollection.java 2008-11-12 13:36:43 UTC (rev 4210) @@ -44,6 +44,10 @@ GISCollection.this.fireGeometryAdded(_newIdx, (Geometry) _newGeom); } + protected void fireObjectChanged(int _idx, Object _geom){ + fireObjectModified(_idx, _geom); + } + protected void fireObjectModified(int _oldIdx, Object _oldGeom) { GISCollection.this.geometryChanged(); GISCollection.this.fireGeometryModified(_oldIdx, (Geometry) _oldGeom); 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 2008-11-12 13:33:41 UTC (rev 4209) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZEditorDefault.java 2008-11-12 13:36:43 UTC (rev 4210) @@ -757,7 +757,7 @@ pn=GISGuiBuilder.buildForGlobAtt(calque.getModelEditable().getGeomData(), calque.getLayerSelection().getSelectedIndex(), getMng()); if (pn==null) - getUi().message(calque.getTitle(), EbliLib.getS("Aucune donn\xE9e \xE0 \xE9diter"), true); + getUi().message(calque.getTitle(), EbliLib.getS("Aucune donn\xE9e \xE0 \xE9diter"), false); else pn.afficheModale(getFrame(), calque.getTitle()); } Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZModeleLigneBriseeDefault.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZModeleLigneBriseeDefault.java 2008-11-12 13:33:41 UTC (rev 4209) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZModeleLigneBriseeDefault.java 2008-11-12 13:36:43 UTC (rev 4210) @@ -296,7 +296,7 @@ final Coordinate c=((LineString)getGeomData().getGeometry(idxPoly)).getCoordinateSequence().getCoordinate(idxPt); _d.put("X:", Double.toString(c.x)); _d.put("Y:", Double.toString(c.y)); - fillWithAtomicInfo(idxPoly, idxPoly, _d); + fillWithAtomicInfo(idxPoly, idxPt, _d); } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bma...@us...> - 2008-11-12 13:33:46
|
Revision: 4209 http://fudaa.svn.sourceforge.net/fudaa/?rev=4209&view=rev Author: bmarchan Date: 2008-11-12 13:33:41 +0000 (Wed, 12 Nov 2008) Log Message: ----------- A nouveau tag FudaaModeleur_0_07 (apr?\195?\168s qq pb de distribution). Added Paths: ----------- tags/FudaaModeleur_0_07/ tags/FudaaModeleur_0_07/fudaa_devel/ctulu/src/com/memoire/bu/crystal_descendre.png tags/FudaaModeleur_0_07/fudaa_devel/ctulu/src/com/memoire/bu/crystal_monter.png tags/FudaaModeleur_0_07/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/BPaletteEditVisibility.java Removed Paths: ------------- tags/FudaaModeleur_0_07/fudaa_devel/ctulu/src/com/memoire/bu/crystal22_descendre.png tags/FudaaModeleur_0_07/fudaa_devel/ctulu/src/com/memoire/bu/crystal22_monter.png tags/FudaaModeleur_0_07/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/BPaletteEditVisibility.java Property changes on: tags/FudaaModeleur_0_07 ___________________________________________________________________ Added: svn:ignore + eclipse_projects Added: svn:mergeinfo + /branches/Br_FudaaModeleur_TF:3445-3850 /branches/FudaaModeleur_TC1:3861-3891 Deleted: tags/FudaaModeleur_0_07/fudaa_devel/ctulu/src/com/memoire/bu/crystal22_descendre.png =================================================================== (Binary files differ) Deleted: tags/FudaaModeleur_0_07/fudaa_devel/ctulu/src/com/memoire/bu/crystal22_monter.png =================================================================== (Binary files differ) Copied: tags/FudaaModeleur_0_07/fudaa_devel/ctulu/src/com/memoire/bu/crystal_descendre.png (from rev 4207, branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/com/memoire/bu/crystal_descendre.png) =================================================================== (Binary files differ) Copied: tags/FudaaModeleur_0_07/fudaa_devel/ctulu/src/com/memoire/bu/crystal_monter.png (from rev 4207, branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/com/memoire/bu/crystal_monter.png) =================================================================== (Binary files differ) Deleted: tags/FudaaModeleur_0_07/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/BPaletteEditVisibility.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/BPaletteEditVisibility.java 2008-11-12 11:02:46 UTC (rev 4206) +++ tags/FudaaModeleur_0_07/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/BPaletteEditVisibility.java 2008-11-12 13:33:41 UTC (rev 4209) @@ -1,704 +0,0 @@ -/* - * @creation 23 oct. 2008 - * @modification $Date:$ - * @license GNU General Public License 2 - * @copyright (c)1998-2008 CETMEF 2 bd Gambetta F-60231 Compiegne - * @mail fud...@li... - */ -package org.fudaa.ebli.calque.edition; - -import java.awt.Color; -import java.awt.Component; -import java.awt.Container; -import java.awt.Dimension; -import java.awt.FlowLayout; -import java.awt.GridLayout; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.EventObject; - -import javax.swing.AbstractCellEditor; -import javax.swing.BorderFactory; -import javax.swing.JComponent; -import javax.swing.JPanel; -import javax.swing.JTable; -import javax.swing.SwingConstants; -import javax.swing.UIManager; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; -import javax.swing.event.ListSelectionEvent; -import javax.swing.event.ListSelectionListener; -import javax.swing.event.TreeModelEvent; -import javax.swing.event.TreeModelListener; -import javax.swing.table.AbstractTableModel; -import javax.swing.table.TableCellEditor; -import javax.swing.table.TableCellRenderer; - -import org.fudaa.ctulu.CtuluCommandManager; -import org.fudaa.ctulu.gis.GISAttributeConstants; -import org.fudaa.ctulu.gis.GISAttributeInterface; -import org.fudaa.ctulu.gis.GISZoneCollection; -import org.fudaa.ctulu.gui.CtuluTable; -import org.fudaa.ebli.calque.BArbreCalqueModel; -import org.fudaa.ebli.calque.ZModelGeometryListener; -import org.fudaa.ebli.calque.ZScene; -import org.fudaa.ebli.calque.ZSelectionEvent; -import org.fudaa.ebli.calque.ZSelectionListener; -import org.fudaa.ebli.commun.BPalettePanelInterface; -import org.fudaa.ebli.commun.EbliLib; - -import com.memoire.bu.BuBorderLayout; -import com.memoire.bu.BuButton; -import com.memoire.bu.BuCheckBox; -import com.memoire.bu.BuComboBox; -import com.memoire.bu.BuLabel; -import com.memoire.bu.BuPanel; -import com.memoire.bu.BuResource; -import com.memoire.bu.BuScrollPane; -import com.vividsolutions.jts.geom.Geometry; - -/** - * Cette palette a pour but de permettre de modifier la visibilit\xE9 de toutes les - * g\xE9om\xE9tries. Concr\xE8trement un tableau listant les g\xE9om\xE9tries propose de cocher - * ou d\xE9cocher une checkbox correspondant \xE0 la valeur de visibilit\xE9 de la - * g\xE9om\xE9trie et r\xE9percute imm\xE9diatement le changement effectu\xE9. - * - * De plus deux boutons permettent de changer l'ordre des g\xE9om\xE9tries dans le - * tableau et dans le model les contenant. - * - * @author Emmanuel MARTIN - * @version $Id: BPaletteEditVisibility.java 4172 2008-11-05 14:49:55Z - * emmanuel_martin $ - */ -public class BPaletteEditVisibility extends BuPanel implements ListSelectionListener, ZSelectionListener, ZModelGeometryListener, TreeModelListener, BPalettePanelInterface, ActionListener, ChangeListener { - - /** Calques disponible pour l'utilisateur. */ - protected ZCalqueEditable[] calques_; - /** Models en cours d'\xE9coute. */ - protected ZModeleEditable[] listenModels_; - protected final String allCalquesEntry_=EbliLib.getS("Tous les calques"); - /** - * vrai quand une modification de la selection dans le tableau ou dans le - * calque est en cours. Permet d'\xE9viter des r\xE9cursions \xE0 cause des listeners de - * selections. - */ - protected boolean listenSelection=true; - /** Vrai quand la visibilit\xE9 n'est pas en train d'\xEAtre chang\xE9 par le panel. */ - protected boolean listenVisibility=true; - protected CtuluCommandManager cmd_; - protected ZScene scene_; - // Composants graphiques - protected final BuComboBox calque_; - protected boolean onlyInvisible_; - protected final CtuluTable table_; - protected BuButton btUp_; - protected BuButton btDown_; - - /** - * @param _treeModel - * utile pour avoir connaissance de la cr\xE9ation et de la suppression - * de calque. - * @param _scene - * utile pour l'\xE9coute des selections. - */ - public BPaletteEditVisibility(BArbreCalqueModel _treeModel, ZScene _scene, CtuluCommandManager _cmd){ - cmd_=_cmd; - scene_=_scene; - calques_=new ZCalqueEditable[0]; - listenModels_=new ZModeleEditable[0]; - _treeModel.addTreeModelListener(this); - scene_.addSelectionListener(this); - // Configuration du panel \\ - setLayout(new BuBorderLayout()); - setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2)); - setPreferredSize(new Dimension(210, 350)); - Container headContainer=new Container(); - headContainer.setLayout(new BuBorderLayout(5, 5)); - // Ajout du titre \\ - BuLabel titre=new BuLabel("<html><b>"+EbliLib.getS("Visibilit\xE9")+"</b></html>"); - titre.setHorizontalAlignment(SwingConstants.CENTER); - headContainer.add(titre, BuBorderLayout.NORTH); - // Ajout des composants de configuration \\ - Container config=new Container(); - config.setLayout(new GridLayout(2, 2, 2, 2)); - headContainer.add(config, BuBorderLayout.CENTER); - add(headContainer, BuBorderLayout.NORTH); - // Calque - config.add(new BuLabel(EbliLib.getS("Calque"))); - calque_=new BuComboBox(); - config.add(calque_); - // Only invisible - config.add(new BuLabel(EbliLib.getS("Invisible uniquement"))); - Container cont=new Container(); - cont.setLayout(new FlowLayout(FlowLayout.CENTER, 0, 0)); - BuCheckBox cb=new BuCheckBox("", false); - cont.add(cb); - config.add(cont); - // Ajout du tableau de geom\xE9tries \\ - table_=new CtuluTable(); - table_.getSelectionModel().addListSelectionListener(this); - add(new BuScrollPane(table_), BuBorderLayout.CENTER); - // Ajout des boutons de d\xE9placement des g\xE9om\xE9tries \\ - Container btCont=new Container(); - btCont.setLayout(new FlowLayout(FlowLayout.CENTER, 0, 0)); - btUp_=new BuButton(BuResource.BU.getIcon("crystal22_monter")); - btUp_.setToolTipText(EbliLib.getS("D\xE9cr\xE9menter l'index de la g\xE9om\xE9trie")); - btDown_=new BuButton(BuResource.BU.getIcon("crystal22_descendre")); - btDown_.setToolTipText(EbliLib.getS("Incr\xE9menter l'index de la g\xE9om\xE9trie")); - btUp_.addActionListener(this); - btDown_.addActionListener(this); - btCont.add(btUp_); - btCont.add(btDown_); - add(btCont, BuBorderLayout.SOUTH); - // Ajout des informations \\ - fillCalqueComboBox(); - calque_.addActionListener(this); - cb.addChangeListener(this); - fillTableGeometry(); - updateBtMovement(); - } - - /** - * Le modele de la table qui liste les g\xE9om\xE9tries. Il contient \xE9galement le - * calque d'origine de et l'index de la g\xE9om\xE9trie dans ce calque pour pouvoir - * r\xE9percuter le changement. - * - * @author Emmanuel MARTIN - * @version $Id$ - */ - protected class GeomTableModel extends AbstractTableModel { - - private String[] titreColonnes_; - private Object[][] rows_; - - public GeomTableModel(String[] _titreColonnes, Object[][] _rows){ - if(_titreColonnes.length!=2) - throw new IllegalArgumentException("Il doit y avoir deux titres de colonnes."); - for(int i=0;i<_rows.length;i++) - if(_rows[i].length!=4) - throw new IllegalArgumentException("Au moins une ligne n'a pas exactement 4 informations."); - titreColonnes_=_titreColonnes; - rows_=_rows; - } - - public Class<?> getColumnClass(int columnIndex) { - switch(columnIndex){ - case 0: return String.class; - case 1: return Boolean.class; - default: return null; - } - } - - public int getColumnCount() { - return 2; - } - - public String getColumnName(int columnIndex) { - return titreColonnes_[columnIndex]; - } - - public int getRowCount() { - return rows_.length; - } - - public Object getValueAt(int rowIndex, int columnIndex) { - return rows_[rowIndex][columnIndex]; - } - - public boolean isCellEditable(int rowIndex, int columnIndex) { - return columnIndex==1; - } - - public void setValueAt(Object value, int rowIndex, int columnIndex) { - boolean selected=table_.getSelectionModel().isSelectedIndex(rowIndex); - if(columnIndex==0){ - rows_[rowIndex][columnIndex]=value; - fireTableDataChanged(); - if(selected) - table_.getSelectionModel().addSelectionInterval(rowIndex, rowIndex); - } - else if(columnIndex==1){ - if (rows_[rowIndex][columnIndex]!=value) { - rows_[rowIndex][columnIndex]=value; - changeVisibility((Integer)rows_[rowIndex][3], (ZModeleEditable)rows_[rowIndex][2], (Boolean)rows_[rowIndex][1]); - // Dans le cas o\xF9 on n'affiche que les g\xE9om\xE9tries invisibles, on - // enl\xE8ve celle qu'on passe \xE0 visible. - if (onlyInvisible_&&((Boolean)rows_[rowIndex][1])==true) { - Object[][] newRows=new Object[rows_.length-1][]; - for (int i=0; i<rowIndex; i++) - newRows[i]=rows_[i]; - for (int i=rowIndex+1; i<rows_.length; i++) - newRows[i-1]=rows_[i]; - rows_=newRows; - fireTableDataChanged(); - if (selected) - table_.getSelectionModel().addSelectionInterval(rowIndex, rowIndex); - } - } - } - } - } - - protected class GeomTableRenderer implements TableCellRenderer { - public Component getTableCellRendererComponent(JTable _table, Object _value, boolean _isSelected, boolean _hasFocus, int _row, - int _column) { - Color selectionBackground = UIManager.getColor("Table.selectionBackground"); - JPanel pn=new JPanel(); - pn.setLayout(new FlowLayout(FlowLayout.CENTER, 0, 0)); - if(_isSelected) - pn.setBackground(selectionBackground); - else - pn.setBackground(Color.WHITE); - if (_value instanceof Boolean) { - BuCheckBox cb=new BuCheckBox("", (Boolean)_value); - if(_isSelected) - cb.setBackground(selectionBackground); - else - cb.setBackground(Color.WHITE); - pn.add(cb); - } - else{ - BuLabel lbl =new BuLabel(_value.toString()); - if(_isSelected) - lbl.setBackground(selectionBackground); - else - lbl.setBackground(Color.WHITE); - pn.add(lbl); - } - return pn; - } - } - - protected class GeomTableEditor extends AbstractCellEditor implements TableCellEditor, ChangeListener { - - private boolean value; - /** Compteur d'\xE9v\xE9nement. */ - private int a=1; - - /* (non-Javadoc) - * @see - * javax.swing.table.TableCellEditor#getTableCellEditorComponent(javax.swing - * .JTable, java.lang.Object, boolean, int, int) - */ - public Component getTableCellEditorComponent(JTable _table, Object _value, boolean _isSelected, int _row, int _column) { - value=(Boolean)_value; - JPanel pn=new JPanel(); - pn.setLayout(new FlowLayout(FlowLayout.CENTER, 0, 0)); - pn.setBackground(Color.WHITE); - BuCheckBox cb=new BuCheckBox("", (Boolean)_value); - cb.addChangeListener(this); - cb.setBackground(Color.WHITE); - pn.add(cb); - return pn; - } - - /* (non-Javadoc) - * @see javax.swing.CellEditor#getCellEditorValue() - */ - public Object getCellEditorValue() { - return value; - } - - public boolean shouldSelectCell(EventObject anEvent){ - return false; - } - - /* (non-Javadoc) - * @see javax.swing.event.ChangeListener#stateChanged(javax.swing.event.ChangeEvent) - */ - public void stateChanged(ChangeEvent e) { - value=!value; - // Un hack : il semble que la checkbox envoie 5 \xE9v\xE9nements \xE0 chaque click. - // Pour arr\xEAter l'\xE9dition automatiquement au bout d'un click, on teste sur - // le compteur de click. - if(a==0) - stopCellEditing(); - a=(a+1)%5; - } - } - - /** - * Place dans le comboBox de choix des calques les calques qui peuvent \xEAtre - * choisis ainsi que l'entr\xE9e sp\xE9ciale 'tout les calques'. - */ - protected void fillCalqueComboBox(){ - // Changement du contenu de la comboBox - Object selectedItem=calque_.getSelectedItem(); - calque_.removeAllItems(); - // R\xE9cup\xE9ration des calques - calques_=scene_.getEditableLayers(); - // Ajout des noms dans le comboBox - calque_.addItem(allCalquesEntry_); - for(int i=0;i<calques_.length;i++) - calque_.addItem(calques_[i].getTitle()); - if(selectedItem!=null) - calque_.setSelectedItem(selectedItem); - else - calque_.setSelectedIndex(0); - updateListen(); - } - - /** - * Met \xE0 jour l'\xE9coute des models - */ - protected void updateListen(){ - // Suppression de l'\xE9coute de tout les models - for(int i=0;i<listenModels_.length;i++) - listenModels_[i].removeModelListener(this); - // Mise a jour du tableau de listeners - if(calque_.getSelectedItem()==allCalquesEntry_){ - listenModels_=new ZModeleEditable[calques_.length]; - for(int i=0;i<calques_.length;i++) - listenModels_[i]=calques_[i].getModelEditable(); - } - else{ - boolean found=false; - int i=-1; - while(!found&&++i<calques_.length) - found=calques_[i].getTitle().equals(calque_.getSelectedItem()); - if(found) - listenModels_=new ZModeleEditable[]{calques_[i].getModelEditable()}; - else - listenModels_=new ZModeleEditable[0]; - } - // Ajout de l'\xE9coute de tout les calques - for(int i=0;i<listenModels_.length;i++){ - listenModels_[i].addModelListener(this); - } - } - - /** - * Rempli le tableau avec toutes les g\xE9o\xE9mtries contenus dans le calque - * selectionn\xE9 dans combobox. Si la checkbox indiquant que seules les - * g\xE9om\xE9tries invisibles sont affich\xE9s est coch\xE9, cette restriction est prise - * en compte ici. - * Le model du tableau est r\xE9instanc\xE9, donc la s\xE9l\xE9ction est - * perdu, ce qui peut entrainer un comportement non voulu. Il est donc - * recommand\xE9 de n'utiliser cette m\xE9thode que pour le premier remplissage du - * tableau. - */ - protected void fillTableGeometry(){ - listenSelection=false; - // Remplissage du tableau - ArrayList<Object[]> rows=new ArrayList<Object[]>(); - for(int i=0;i<calques_.length;i++){ - if(calques_[i].getTitle().equals(calque_.getSelectedItem())||calque_.getSelectedItem()==allCalquesEntry_){ - ZModeleEditable model = calques_[i].getModelEditable(); - // Extraction des donn\xE9es utiles - GISZoneCollection zone=model.getGeomData(); - int indexTitre=zone.getIndiceOf(GISAttributeConstants.TITRE); - int indexVisibility=zone.getIndiceOf(GISAttributeConstants.VISIBILITE); - if(indexTitre!=-1&&indexVisibility!=-1) - for(int j=0;j<zone.getNbGeometries();j++) - if(!onlyInvisible_||zone.getValue(indexVisibility, j)==GISAttributeConstants.ATT_VAL_FALSE) - if(j<zone.getModel(indexVisibility).getSize()&&j<zone.getModel(indexTitre).getSize()) - rows.add(new Object[]{zone.getValue(indexTitre, j), zone.getValue(indexVisibility, j).equals(GISAttributeConstants.ATT_VAL_TRUE)?true:false, model, scene_.layerId2SceneId(calques_[i], j)}); - } - } - table_.setModel(new GeomTableModel(new String[]{EbliLib.getS("Nom"), EbliLib.getS("Visibilit\xE9")}, rows.toArray(new Object[0][]))); - table_.getColumnModel().getColumn(0).setCellRenderer(new GeomTableRenderer()); - table_.getColumnModel().getColumn(1).setCellRenderer(new GeomTableRenderer()); - table_.getColumnModel().getColumn(1).setPreferredWidth(25); - table_.getColumnModel().getColumn(1).setCellEditor(new GeomTableEditor()); - // Mise \xE0 jour de la selection - updateTableSelection(); - listenSelection=true; - } - - /** - * Cette m\xE9thode effectue un changement de visibilit\xE9 sur la g\xE9om\xE9trie - * indiqu\xE9e en param\xE8tre. - * - * @param _numGeom - * l'index de la g\xE9om\xE9trie dans le calque - * @param _calque - * le calque dans lequel se trouve la g\xE9o\xE9mtrie - * @param _visibility - * la nouvelle valeur de visibilit\xE9 - */ - protected void changeVisibility(int _numGeom, ZModeleEditable _model, boolean _visibility) { - listenVisibility=false; - GISZoneCollection zone=_model.getGeomData(); - int indexVisibility=zone.getIndiceOf(GISAttributeConstants.VISIBILITE); - if (indexVisibility!=-1) - zone.getModel(indexVisibility).setObject(scene_.sceneId2LayerId(_numGeom), _visibility==true ? GISAttributeConstants.ATT_VAL_TRUE:GISAttributeConstants.ATT_VAL_FALSE, cmd_); - listenVisibility=true; - } - - /** - * Met \xE0 jour la selection dans le tableau pour qu'elle corresponde \xE0 la selection dans les calques. - */ - protected void updateTableSelection() { - int[] selection=scene_.getLayerSelection().getSelectedIndex(); - for(int i=0;i<table_.getRowCount();i++) - // Si la g\xE9om\xE9trie n'est pas s\xE9lectionn\xE9e dans le calque mais dans le tableau => d\xE9s\xE9lectionne - if(!in(((Integer) table_.getModel().getValueAt(i, 3)).intValue(), selection)&&table_.getSelectionModel().isSelectedIndex(i)) - table_.getSelectionModel().removeSelectionInterval(i, i); - // Si la g\xE9om\xE9trie est selectionn\xE9 dans le calque mais pas dans le tableau => s\xE9lection - else if(in(((Integer) table_.getModel().getValueAt(i, 3)).intValue(), selection)&&!table_.getSelectionModel().isSelectedIndex(i)) - table_.getSelectionModel().addSelectionInterval(i, i); - } - - /** - * Met \xE0 jour la selection dans le(s) calque(s) pour qu'elle corresponde \xE0 la selection dans le tableau. - */ - protected void updateCalqueSelection() { - // Conversion des indices de lignes selectionn\xE9es en index globals de g\xE9om\xE9tries - int[] selection=table_.getSelectedRows(); - int[] selectedIdx=new int[selection.length]; - for(int i=0;i<selectedIdx.length;i++) - selectedIdx[i]=((Integer) table_.getModel().getValueAt(selection[i], 3)).intValue(); - scene_.setSelection(selectedIdx); - } - - /** - * Active ou d\xE9active les deux boutons de mouvement - */ - protected void updateBtMovement(){ - boolean enableUp=false; - boolean enableDown=false; - if(calque_.getSelectedItem()!=allCalquesEntry_&&table_.getSelectedRowCount()>0){ - // Verification qu'il est possible de d\xE9placer la s\xE9lection vers le haut - int i=0; - while(!enableUp&&++i<table_.getRowCount()) - enableUp=!table_.getSelectionModel().isSelectedIndex(i-1)&&table_.getSelectionModel().isSelectedIndex(i); - // V\xE9rification qu'il est possible de d\xE9placer la selection vers le bas - i=table_.getRowCount()-1; - while(!enableDown&&--i>=0) - enableDown=!table_.getSelectionModel().isSelectedIndex(i+1)&&table_.getSelectionModel().isSelectedIndex(i); - } - btUp_.setEnabled(enableUp); - btDown_.setEnabled(enableDown); - } - - /** - * Retourne vrai si _value est dans _table - * @param _value - * @param _table - * @return - */ - private boolean in(int _value, int[] _table){ - boolean found=false; - int i=-1; - while(!found&&++i<_table.length) - found=_table[i]==_value; - return found; - } - - /** - * "remonte" d'1 les g\xE9om\xE9tries selectionn\xE9es dans leur calque. C'est \xE0 dire - * que si une g\xE9om\xE9trie \xE9tait \xE0 l'index 6, elle passe \xE0 l'index 5 (l'ancienne - * g\xE9om\xE9trie \xE0 5 passe \xE0 6). - */ - protected void moveUpSelectedGeometies(){ - int[] selection=table_.getSelectedRows(); - ArrayList<Integer> newSelection=new ArrayList<Integer>(); - Arrays.sort(selection); - int lastIndexCompute=-1; - for(int i=0;i<selection.length;i++){ - // Si la place du dessus est libre, on monte - if(selection[i]>0&&(!in(selection[i]-1, selection)||selection[i]-1==lastIndexCompute)){ - newSelection.add(selection[i]-1); - lastIndexCompute=selection[i]; - ZModeleEditable model=(ZModeleEditable) table_.getModel().getValueAt(selection[i], 2); - int indexGeom=((Integer) table_.getModel().getValueAt(selection[i], 3)).intValue(); - model.getGeomData().switchGeometries(scene_.sceneId2LayerId(indexGeom), scene_.sceneId2LayerId(indexGeom-1), cmd_); - } - else - newSelection.add(selection[i]); - } - // R\xE9tablissement de la selection dans le tableau - table_.getSelectionModel().clearSelection(); - for(int i=0;i<newSelection.size();i++) - table_.getSelectionModel().addSelectionInterval(newSelection.get(i), newSelection.get(i)); - } - - /** - * "descend" d'1 les g\xE9om\xE9tries selectionn\xE9es dans leur calque. C'est \xE0 dire - * que si une g\xE9om\xE9trie \xE9tait \xE0 l'index 5, elle passe \xE0 l'index 6 (l'ancienne - * g\xE9om\xE9trie \xE0 6 passe \xE0 5). - */ - protected void moveDownSelectedGeometies(){ - int[] selection=table_.getSelectedRows(); - ArrayList<Integer> newSelection=new ArrayList<Integer>(); - Arrays.sort(selection); - int lastIndexCompute=-1; - for(int i=selection.length-1;i>=0;i--){ - // Si la place du dessous est libre, on descend - if(selection[i]<(table_.getRowCount()-1)&&(!in(selection[i]+1, selection)||selection[i]+1==lastIndexCompute)){ - newSelection.add(selection[i]+1); - lastIndexCompute=selection[i]; - ZModeleEditable model=(ZModeleEditable) table_.getModel().getValueAt(selection[i], 2); - int indexGeom=((Integer) table_.getModel().getValueAt(selection[i], 3)).intValue(); - model.getGeomData().switchGeometries(scene_.sceneId2LayerId(indexGeom), scene_.sceneId2LayerId(indexGeom+1), cmd_); - } - else - newSelection.add(selection[i]); - } - // R\xE9tablissement de la selection dans le tableau - table_.getSelectionModel().clearSelection(); - for(int i=0;i<newSelection.size();i++) - table_.getSelectionModel().addSelectionInterval(newSelection.get(i), newSelection.get(i)); - } - - /** - * Est appel\xE9e par EditVisibilityAction quand la palette est d\xE9couverte. - */ - public void doShow(){ - updateListen(); - fillCalqueComboBox(); - fillTableGeometry(); - updateBtMovement(); - } - - /** - * Est appel\xE9e par EditVisibilityAction quand la palette est cach\xE9e. - */ - public void doHide(){ - // Suppression de l'\xE9coute de tout les calques - for(int i=0;i<listenModels_.length;i++) - listenModels_[i].removeModelListener(this); - // Mise a jour du tableau de listeners - listenModels_=new ZModeleEditable[0]; - } - - /* (non-Javadoc) - * @see org.fudaa.ebli.commun.BPalettePanelInterface#doAfterDisplay() - */ - public void doAfterDisplay() { - } - - /* (non-Javadoc) - * @see org.fudaa.ebli.commun.BPalettePanelInterface#getComponent() - */ - public JComponent getComponent() { - return this; - } - - /* (non-Javadoc) - * @see org.fudaa.ebli.commun.BPalettePanelInterface#paletteDeactivated() - */ - public void paletteDeactivated() { - } - - /* (non-Javadoc) - * @see org.fudaa.ebli.commun.BPalettePanelInterface#setPalettePanelTarget(java.lang.Object) - */ - public boolean setPalettePanelTarget(Object _target) { - return false; - } - - // Changement dans le comboBox des calques ou dans les boutons de d\xE9placements \\ - - public void actionPerformed(ActionEvent e) { - if(e.getSource()==calque_){ - updateListen(); - fillTableGeometry(); - updateBtMovement(); - } - else if(e.getSource()==btUp_) - moveUpSelectedGeometies(); - else if(e.getSource()==btDown_) - moveDownSelectedGeometies(); - } - - //Changement dans le checkBox onlyInvisible \\ - - public void stateChanged(ChangeEvent e) { - onlyInvisible_=!onlyInvisible_; - fillTableGeometry(); - } - - // Changement dans l'arbre des calques \\ - - public void treeNodesChanged(TreeModelEvent e) { - fillCalqueComboBox(); - } - - public void treeNodesInserted(TreeModelEvent e) { - fillCalqueComboBox(); - } - - public void treeNodesRemoved(TreeModelEvent e) { - fillCalqueComboBox(); - } - - public void treeStructureChanged(TreeModelEvent e) { - fillCalqueComboBox(); - } - - // Modification dans le ou les model(s) \xE9cout\xE9(s). - - public void attributeAction(Object _source, int att, GISAttributeInterface _att, int _action) { - fillTableGeometry(); - } - - public void attributeValueChangeAction(Object _source, int att, GISAttributeInterface _att, int _geom, Object _value) { - if(listenVisibility&&(_att==GISAttributeConstants.TITRE||_att==GISAttributeConstants.VISIBILITE||_att==null)){ - // Recherche le calque contenant le model - boolean foundCalque=false; - int j=-1; - ZCalqueEditable[] calques=scene_.getEditableLayers(); - while (!foundCalque&&++j<calques.length) - foundCalque=calques[j].getModelEditable()==_source; - if (foundCalque) { - if (_geom>=0) { - int idxGeom=scene_.layerId2SceneId(calques[j], _geom); - // Mise \xE0 jour seulement de la g\xE9om\xE9trie. - boolean found=false; - int i=-1; - while (!found&&++i<table_.getModel().getRowCount()) { - ZModeleEditable model=(ZModeleEditable)table_.getModel().getValueAt(i, 2); - Integer indexGeom=(Integer)table_.getModel().getValueAt(i, 3); - found=(model==_source)&&(indexGeom==idxGeom); - } - if (found) - if (_att==GISAttributeConstants.TITRE) - table_.getModel().setValueAt(_value, i, 0); - else if (_att==GISAttributeConstants.VISIBILITE) - table_.getModel().setValueAt(_value.equals(GISAttributeConstants.ATT_VAL_TRUE) ? true:false, i, 1); - else { - GISZoneCollection zone=((ZModeleEditable)_source).getGeomData(); - table_.getModel().setValueAt( - ((ZModeleEditable)_source).getGeomData().getValue(zone.getIndiceOf(GISAttributeConstants.TITRE), _geom), i, 0); - table_.getModel().setValueAt( - ((ZModeleEditable)_source).getGeomData().getValue(zone.getIndiceOf(GISAttributeConstants.VISIBILITE), _geom) - .equals(GISAttributeConstants.ATT_VAL_TRUE) ? true:false, i, 1); - } - } - else - // Mise \xE0 jour de toutes les g\xE9om\xE9tries. - fillTableGeometry(); - } - } - } - - public void geometryAction(Object _source, int geom, Geometry _geom, int _action) { - if(_action!=GEOMETRY_ACTION_MODIFY) - fillTableGeometry(); - } - - // La selection dans un calque \xE0 chang\xE9e \\ - - public void selectionChanged(ZSelectionEvent _evt) { - if (listenSelection) { - listenSelection=false; - updateTableSelection(); - updateBtMovement(); - listenSelection=true; - } - } - - // La selection dans le tableau \xE0 chang\xE9e \\ - - public void valueChanged(ListSelectionEvent _e) { - if (listenSelection) { - listenSelection=false; - updateCalqueSelection(); - updateBtMovement(); - listenSelection=true; - } - } -} Copied: tags/FudaaModeleur_0_07/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/BPaletteEditVisibility.java (from rev 4207, branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/BPaletteEditVisibility.java) =================================================================== --- tags/FudaaModeleur_0_07/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/BPaletteEditVisibility.java (rev 0) +++ tags/FudaaModeleur_0_07/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/BPaletteEditVisibility.java 2008-11-12 13:33:41 UTC (rev 4209) @@ -0,0 +1,704 @@ +/* + * @creation 23 oct. 2008 + * @modification $Date:$ + * @license GNU General Public License 2 + * @copyright (c)1998-2008 CETMEF 2 bd Gambetta F-60231 Compiegne + * @mail fud...@li... + */ +package org.fudaa.ebli.calque.edition; + +import java.awt.Color; +import java.awt.Component; +import java.awt.Container; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.GridLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.EventObject; + +import javax.swing.AbstractCellEditor; +import javax.swing.BorderFactory; +import javax.swing.JComponent; +import javax.swing.JPanel; +import javax.swing.JTable; +import javax.swing.SwingConstants; +import javax.swing.UIManager; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import javax.swing.event.ListSelectionEvent; +import javax.swing.event.ListSelectionListener; +import javax.swing.event.TreeModelEvent; +import javax.swing.event.TreeModelListener; +import javax.swing.table.AbstractTableModel; +import javax.swing.table.TableCellEditor; +import javax.swing.table.TableCellRenderer; + +import org.fudaa.ctulu.CtuluCommandManager; +import org.fudaa.ctulu.gis.GISAttributeConstants; +import org.fudaa.ctulu.gis.GISAttributeInterface; +import org.fudaa.ctulu.gis.GISZoneCollection; +import org.fudaa.ctulu.gui.CtuluTable; +import org.fudaa.ebli.calque.BArbreCalqueModel; +import org.fudaa.ebli.calque.ZModelGeometryListener; +import org.fudaa.ebli.calque.ZScene; +import org.fudaa.ebli.calque.ZSelectionEvent; +import org.fudaa.ebli.calque.ZSelectionListener; +import org.fudaa.ebli.commun.BPalettePanelInterface; +import org.fudaa.ebli.commun.EbliLib; + +import com.memoire.bu.BuBorderLayout; +import com.memoire.bu.BuButton; +import com.memoire.bu.BuCheckBox; +import com.memoire.bu.BuComboBox; +import com.memoire.bu.BuLabel; +import com.memoire.bu.BuPanel; +import com.memoire.bu.BuResource; +import com.memoire.bu.BuScrollPane; +import com.vividsolutions.jts.geom.Geometry; + +/** + * Cette palette a pour but de permettre de modifier la visibilit\xE9 de toutes les + * g\xE9om\xE9tries. Concr\xE8trement un tableau listant les g\xE9om\xE9tries propose de cocher + * ou d\xE9cocher une checkbox correspondant \xE0 la valeur de visibilit\xE9 de la + * g\xE9om\xE9trie et r\xE9percute imm\xE9diatement le changement effectu\xE9. + * + * De plus deux boutons permettent de changer l'ordre des g\xE9om\xE9tries dans le + * tableau et dans le model les contenant. + * + * @author Emmanuel MARTIN + * @version $Id: BPaletteEditVisibility.java 4172 2008-11-05 14:49:55Z + * emmanuel_martin $ + */ +public class BPaletteEditVisibility extends BuPanel implements ListSelectionListener, ZSelectionListener, ZModelGeometryListener, TreeModelListener, BPalettePanelInterface, ActionListener, ChangeListener { + + /** Calques disponible pour l'utilisateur. */ + protected ZCalqueEditable[] calques_; + /** Models en cours d'\xE9coute. */ + protected ZModeleEditable[] listenModels_; + protected final String allCalquesEntry_=EbliLib.getS("Tous les calques"); + /** + * vrai quand une modification de la selection dans le tableau ou dans le + * calque est en cours. Permet d'\xE9viter des r\xE9cursions \xE0 cause des listeners de + * selections. + */ + protected boolean listenSelection=true; + /** Vrai quand la visibilit\xE9 n'est pas en train d'\xEAtre chang\xE9 par le panel. */ + protected boolean listenVisibility=true; + protected CtuluCommandManager cmd_; + protected ZScene scene_; + // Composants graphiques + protected final BuComboBox calque_; + protected boolean onlyInvisible_; + protected final CtuluTable table_; + protected BuButton btUp_; + protected BuButton btDown_; + + /** + * @param _treeModel + * utile pour avoir connaissance de la cr\xE9ation et de la suppression + * de calque. + * @param _scene + * utile pour l'\xE9coute des selections. + */ + public BPaletteEditVisibility(BArbreCalqueModel _treeModel, ZScene _scene, CtuluCommandManager _cmd){ + cmd_=_cmd; + scene_=_scene; + calques_=new ZCalqueEditable[0]; + listenModels_=new ZModeleEditable[0]; + _treeModel.addTreeModelListener(this); + scene_.addSelectionListener(this); + // Configuration du panel \\ + setLayout(new BuBorderLayout()); + setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2)); + setPreferredSize(new Dimension(210, 350)); + Container headContainer=new Container(); + headContainer.setLayout(new BuBorderLayout(5, 5)); + // Ajout du titre \\ + BuLabel titre=new BuLabel("<html><b>"+EbliLib.getS("Visibilit\xE9")+"</b></html>"); + titre.setHorizontalAlignment(SwingConstants.CENTER); + headContainer.add(titre, BuBorderLayout.NORTH); + // Ajout des composants de configuration \\ + Container config=new Container(); + config.setLayout(new GridLayout(2, 2, 2, 2)); + headContainer.add(config, BuBorderLayout.CENTER); + add(headContainer, BuBorderLayout.NORTH); + // Calque + config.add(new BuLabel(EbliLib.getS("Calque"))); + calque_=new BuComboBox(); + config.add(calque_); + // Only invisible + config.add(new BuLabel(EbliLib.getS("Invisible uniquement"))); + Container cont=new Container(); + cont.setLayout(new FlowLayout(FlowLayout.CENTER, 0, 0)); + BuCheckBox cb=new BuCheckBox("", false); + cont.add(cb); + config.add(cont); + // Ajout du tableau de geom\xE9tries \\ + table_=new CtuluTable(); + table_.getSelectionModel().addListSelectionListener(this); + add(new BuScrollPane(table_), BuBorderLayout.CENTER); + // Ajout des boutons de d\xE9placement des g\xE9om\xE9tries \\ + Container btCont=new Container(); + btCont.setLayout(new FlowLayout(FlowLayout.CENTER, 0, 0)); + btUp_=new BuButton(BuResource.BU.getIcon("monter")); + btUp_.setToolTipText(EbliLib.getS("D\xE9cr\xE9menter l'index de la g\xE9om\xE9trie")); + btDown_=new BuButton(BuResource.BU.getIcon("descendre")); + btDown_.setToolTipText(EbliLib.getS("Incr\xE9menter l'index de la g\xE9om\xE9trie")); + btUp_.addActionListener(this); + btDown_.addActionListener(this); + btCont.add(btUp_); + btCont.add(btDown_); + add(btCont, BuBorderLayout.SOUTH); + // Ajout des informations \\ + fillCalqueComboBox(); + calque_.addActionListener(this); + cb.addChangeListener(this); + fillTableGeometry(); + updateBtMovement(); + } + + /** + * Le modele de la table qui liste les g\xE9om\xE9tries. Il contient \xE9galement le + * calque d'origine de et l'index de la g\xE9om\xE9trie dans ce calque pour pouvoir + * r\xE9percuter le changement. + * + * @author Emmanuel MARTIN + * @version $Id$ + */ + protected class GeomTableModel extends AbstractTableModel { + + private String[] titreColonnes_; + private Object[][] rows_; + + public GeomTableModel(String[] _titreColonnes, Object[][] _rows){ + if(_titreColonnes.length!=2) + throw new IllegalArgumentException("Il doit y avoir deux titres de colonnes."); + for(int i=0;i<_rows.length;i++) + if(_rows[i].length!=4) + throw new IllegalArgumentException("Au moins une ligne n'a pas exactement 4 informations."); + titreColonnes_=_titreColonnes; + rows_=_rows; + } + + public Class<?> getColumnClass(int columnIndex) { + switch(columnIndex){ + case 0: return String.class; + case 1: return Boolean.class; + default: return null; + } + } + + public int getColumnCount() { + return 2; + } + + public String getColumnName(int columnIndex) { + return titreColonnes_[columnIndex]; + } + + public int getRowCount() { + return rows_.length; + } + + public Object getValueAt(int rowIndex, int columnIndex) { + return rows_[rowIndex][columnIndex]; + } + + public boolean isCellEditable(int rowIndex, int columnIndex) { + return columnIndex==1; + } + + public void setValueAt(Object value, int rowIndex, int columnIndex) { + boolean selected=table_.getSelectionModel().isSelectedIndex(rowIndex); + if(columnIndex==0){ + rows_[rowIndex][columnIndex]=value; + fireTableDataChanged(); + if(selected) + table_.getSelectionModel().addSelectionInterval(rowIndex, rowIndex); + } + else if(columnIndex==1){ + if (rows_[rowIndex][columnIndex]!=value) { + rows_[rowIndex][columnIndex]=value; + changeVisibility((Integer)rows_[rowIndex][3], (ZModeleEditable)rows_[rowIndex][2], (Boolean)rows_[rowIndex][1]); + // Dans le cas o\xF9 on n'affiche que les g\xE9om\xE9tries invisibles, on + // enl\xE8ve celle qu'on passe \xE0 visible. + if (onlyInvisible_&&((Boolean)rows_[rowIndex][1])==true) { + Object[][] newRows=new Object[rows_.length-1][]; + for (int i=0; i<rowIndex; i++) + newRows[i]=rows_[i]; + for (int i=rowIndex+1; i<rows_.length; i++) + newRows[i-1]=rows_[i]; + rows_=newRows; + fireTableDataChanged(); + if (selected) + table_.getSelectionModel().addSelectionInterval(rowIndex, rowIndex); + } + } + } + } + } + + protected class GeomTableRenderer implements TableCellRenderer { + public Component getTableCellRendererComponent(JTable _table, Object _value, boolean _isSelected, boolean _hasFocus, int _row, + int _column) { + Color selectionBackground = UIManager.getColor("Table.selectionBackground"); + JPanel pn=new JPanel(); + pn.setLayout(new FlowLayout(FlowLayout.CENTER, 0, 0)); + if(_isSelected) + pn.setBackground(selectionBackground); + else + pn.setBackground(Color.WHITE); + if (_value instanceof Boolean) { + BuCheckBox cb=new BuCheckBox("", (Boolean)_value); + if(_isSelected) + cb.setBackground(selectionBackground); + else + cb.setBackground(Color.WHITE); + pn.add(cb); + } + else{ + BuLabel lbl =new BuLabel(_value.toString()); + if(_isSelected) + lbl.setBackground(selectionBackground); + else + lbl.setBackground(Color.WHITE); + pn.add(lbl); + } + return pn; + } + } + + protected class GeomTableEditor extends AbstractCellEditor implements TableCellEditor, ChangeListener { + + private boolean value; + /** Compteur d'\xE9v\xE9nement. */ + private int a=1; + + /* (non-Javadoc) + * @see + * javax.swing.table.TableCellEditor#getTableCellEditorComponent(javax.swing + * .JTable, java.lang.Object, boolean, int, int) + */ + public Component getTableCellEditorComponent(JTable _table, Object _value, boolean _isSelected, int _row, int _column) { + value=(Boolean)_value; + JPanel pn=new JPanel(); + pn.setLayout(new FlowLayout(FlowLayout.CENTER, 0, 0)); + pn.setBackground(Color.WHITE); + BuCheckBox cb=new BuCheckBox("", (Boolean)_value); + cb.addChangeListener(this); + cb.setBackground(Color.WHITE); + pn.add(cb); + return pn; + } + + /* (non-Javadoc) + * @see javax.swing.CellEditor#getCellEditorValue() + */ + public Object getCellEditorValue() { + return value; + } + + public boolean shouldSelectCell(EventObject anEvent){ + return false; + } + + /* (non-Javadoc) + * @see javax.swing.event.ChangeListener#stateChanged(javax.swing.event.ChangeEvent) + */ + public void stateChanged(ChangeEvent e) { + value=!value; + // Un hack : il semble que la checkbox envoie 5 \xE9v\xE9nements \xE0 chaque click. + // Pour arr\xEAter l'\xE9dition automatiquement au bout d'un click, on teste sur + // le compteur de click. + if(a==0) + stopCellEditing(); + a=(a+1)%5; + } + } + + /** + * Place dans le comboBox de choix des calques les calques qui peuvent \xEAtre + * choisis ainsi que l'entr\xE9e sp\xE9ciale 'tout les calques'. + */ + protected void fillCalqueComboBox(){ + // Changement du contenu de la comboBox + Object selectedItem=calque_.getSelectedItem(); + calque_.removeAllItems(); + // R\xE9cup\xE9ration des calques + calques_=scene_.getEditableLayers(); + // Ajout des noms dans le comboBox + calque_.addItem(allCalquesEntry_); + for(int i=0;i<calques_.length;i++) + calque_.addItem(calques_[i].getTitle()); + if(selectedItem!=null) + calque_.setSelectedItem(selectedItem); + else + calque_.setSelectedIndex(0); + updateListen(); + } + + /** + * Met \xE0 jour l'\xE9coute des models + */ + protected void updateListen(){ + // Suppression de l'\xE9coute de tout les models + for(int i=0;i<listenModels_.length;i++) + listenModels_[i].removeModelListener(this); + // Mise a jour du tableau de listeners + if(calque_.getSelectedItem()==allCalquesEntry_){ + listenModels_=new ZModeleEditable[calques_.length]; + for(int i=0;i<calques_.length;i++) + listenModels_[i]=calques_[i].getModelEditable(); + } + else{ + boolean found=false; + int i=-1; + while(!found&&++i<calques_.length) + found=calques_[i].getTitle().equals(calque_.getSelectedItem()); + if(found) + listenModels_=new ZModeleEditable[]{calques_[i].getModelEditable()}; + else + listenModels_=new ZModeleEditable[0]; + } + // Ajout de l'\xE9coute de tout les calques + for(int i=0;i<listenModels_.length;i++){ + listenModels_[i].addModelListener(this); + } + } + + /** + * Rempli le tableau avec toutes les g\xE9o\xE9mtries contenus dans le calque + * selectionn\xE9 dans combobox. Si la checkbox indiquant que seules les + * g\xE9om\xE9tries invisibles sont affich\xE9s est coch\xE9, cette restriction est prise + * en compte ici. + * Le model du tableau est r\xE9instanc\xE9, donc la s\xE9l\xE9ction est + * perdu, ce qui peut entrainer un comportement non voulu. Il est donc + * recommand\xE9 de n'utiliser cette m\xE9thode que pour le premier remplissage du + * tableau. + */ + protected void fillTableGeometry(){ + listenSelection=false; + // Remplissage du tableau + ArrayList<Object[]> rows=new ArrayList<Object[]>(); + for(int i=0;i<calques_.length;i++){ + if(calques_[i].getTitle().equals(calque_.getSelectedItem())||calque_.getSelectedItem()==allCalquesEntry_){ + ZModeleEditable model = calques_[i].getModelEditable(); + // Extraction des donn\xE9es utiles + GISZoneCollection zone=model.getGeomData(); + int indexTitre=zone.getIndiceOf(GISAttributeConstants.TITRE); + int indexVisibility=zone.getIndiceOf(GISAttributeConstants.VISIBILITE); + if(indexTitre!=-1&&indexVisibility!=-1) + for(int j=0;j<zone.getNbGeometries();j++) + if(!onlyInvisible_||zone.getValue(indexVisibility, j)==GISAttributeConstants.ATT_VAL_FALSE) + if(j<zone.getModel(indexVisibility).getSize()&&j<zone.getModel(indexTitre).getSize()) + rows.add(new Object[]{zone.getValue(indexTitre, j), zone.getValue(indexVisibility, j).equals(GISAttributeConstants.ATT_VAL_TRUE)?true:false, model, scene_.layerId2SceneId(calques_[i], j)}); + } + } + table_.setModel(new GeomTableModel(new String[]{EbliLib.getS("Nom"), EbliLib.getS("Visibilit\xE9")}, rows.toArray(new Object[0][]))); + table_.getColumnModel().getColumn(0).setCellRenderer(new GeomTableRenderer()); + table_.getColumnModel().getColumn(1).setCellRenderer(new GeomTableRenderer()); + table_.getColumnModel().getColumn(1).setPreferredWidth(25); + table_.getColumnModel().getColumn(1).setCellEditor(new GeomTableEditor()); + // Mise \xE0 jour de la selection + updateTableSelection(); + listenSelection=true; + } + + /** + * Cette m\xE9thode effectue un changement de visibilit\xE9 sur la g\xE9om\xE9trie + * indiqu\xE9e en param\xE8tre. + * + * @param _numGeom + * l'index de la g\xE9om\xE9trie dans le calque + * @param _calque + * le calque dans lequel se trouve la g\xE9o\xE9mtrie + * @param _visibility + * la nouvelle valeur de visibilit\xE9 + */ + protected void changeVisibility(int _numGeom, ZModeleEditable _model, boolean _visibility) { + listenVisibility=false; + GISZoneCollection zone=_model.getGeomData(); + int indexVisibility=zone.getIndiceOf(GISAttributeConstants.VISIBILITE); + if (indexVisibility!=-1) + zone.getModel(indexVisibility).setObject(scene_.sceneId2LayerId(_numGeom), _visibility==true ? GISAttributeConstants.ATT_VAL_TRUE:GISAttributeConstants.ATT_VAL_FALSE, cmd_); + listenVisibility=true; + } + + /** + * Met \xE0 jour la selection dans le tableau pour qu'elle corresponde \xE0 la selection dans les calques. + */ + protected void updateTableSelection() { + int[] selection=scene_.getLayerSelection().getSelectedIndex(); + for(int i=0;i<table_.getRowCount();i++) + // Si la g\xE9om\xE9trie n'est pas s\xE9lectionn\xE9e dans le calque mais dans le tableau => d\xE9s\xE9lectionne + if(!in(((Integer) table_.getModel().getValueAt(i, 3)).intValue(), selection)&&table_.getSelectionModel().isSelectedIndex(i)) + table_.getSelectionModel().removeSelectionInterval(i, i); + // Si la g\xE9om\xE9trie est selectionn\xE9 dans le calque mais pas dans le tableau => s\xE9lection + else if(in(((Integer) table_.getModel().getValueAt(i, 3)).intValue(), selection)&&!table_.getSelectionModel().isSelectedIndex(i)) + table_.getSelectionModel().addSelectionInterval(i, i); + } + + /** + * Met \xE0 jour la selection dans le(s) calque(s) pour qu'elle corresponde \xE0 la selection dans le tableau. + */ + protected void updateCalqueSelection() { + // Conversion des indices de lignes selectionn\xE9es en index globals de g\xE9om\xE9tries + int[] selection=table_.getSelectedRows(); + int[] selectedIdx=new int[selection.length]; + for(int i=0;i<selectedIdx.length;i++) + selectedIdx[i]=((Integer) table_.getModel().getValueAt(selection[i], 3)).intValue(); + scene_.setSelection(selectedIdx); + } + + /** + * Active ou d\xE9active les deux boutons de mouvement + */ + protected void updateBtMovement(){ + boolean enableUp=false; + boolean enableDown=false; + if(calque_.getSelectedItem()!=allCalquesEntry_&&table_.getSelectedRowCount()>0){ + // Verification qu'il est possible de d\xE9placer la s\xE9lection vers le haut + int i=0; + while(!enableUp&&++i<table_.getRowCount()) + enableUp=!table_.getSelectionModel().isSelectedIndex(i-1)&&table_.getSelectionModel().isSelectedIndex(i); + // V\xE9rification qu'il est possible de d\xE9placer la selection vers le bas + i=table_.getRowCount()-1; + while(!enableDown&&--i>=0) + enableDown=!table_.getSelectionModel().isSelectedIndex(i+1)&&table_.getSelectionModel().isSelectedIndex(i); + } + btUp_.setEnabled(enableUp); + btDown_.setEnabled(enableDown); + } + + /** + * Retourne vrai si _value est dans _table + * @param _value + * @param _table + * @return + */ + private boolean in(int _value, int[] _table){ + boolean found=false; + int i=-1; + while(!found&&++i<_table.length) + found=_table[i]==_value; + return found; + } + + /** + * "remonte" d'1 les g\xE9om\xE9tries selectionn\xE9es dans leur calque. C'est \xE0 dire + * que si une g\xE9om\xE9trie \xE9tait \xE0 l'index 6, elle passe \xE0 l'index 5 (l'ancienne + * g\xE9om\xE9trie \xE0 5 passe \xE0 6). + */ + protected void moveUpSelectedGeometies(){ + int[] selection=table_.getSelectedRows(); + ArrayList<Integer> newSelection=new ArrayList<Integer>(); + Arrays.sort(selection); + int lastIndexCompute=-1; + for(int i=0;i<selection.length;i++){ + // Si la place du dessus est libre, on monte + if(selection[i]>0&&(!in(selection[i]-1, selection)||selection[i]-1==lastIndexCompute)){ + newSelection.add(selection[i]-1); + lastIndexCompute=selection[i]; + ZModeleEditable model=(ZModeleEditable) table_.getModel().getValueAt(selection[i], 2); + int indexGeom=((Integer) table_.getModel().getValueAt(selection[i], 3)).intValue(); + model.getGeomData().switchGeometries(scene_.sceneId2LayerId(indexGeom), scene_.sceneId2LayerId(indexGeom-1), cmd_); + } + else + newSelection.add(selection[i]); + } + // R\xE9tablissement de la selection dans le tableau + table_.getSelectionModel().clearSelection(); + for(int i=0;i<newSelection.size();i++) + table_.getSelectionModel().addSelectionInterval(newSelection.get(i), newSelection.get(i)); + } + + /** + * "descend" d'1 les g\xE9om\xE9tries selectionn\xE9es dans leur calque. C'est \xE0 dire + * que si une g\xE9om\xE9trie \xE9tait \xE0 l'index 5, elle passe \xE0 l'index 6 (l'ancienne + * g\xE9om\xE9trie \xE0 6 passe \xE0 5). + */ + protected void moveDownSelectedGeometies(){ + int[] selection=table_.getSelectedRows(); + ArrayList<Integer> newSelection=new ArrayList<Integer>(); + Arrays.sort(selection); + int lastIndexCompute=-1; + for(int i=selection.length-1;i>=0;i--){ + // Si la place du dessous est libre, on descend + if(selection[i]<(table_.getRowCount()-1)&&(!in(selection[i]+1, selection)||selection[i]+1==lastIndexCompute)){ + newSelection.add(selection[i]+1); + lastIndexCompute=selection[i]; + ZModeleEditable model=(ZModeleEditable) table_.getModel().getValueAt(selection[i], 2); + int indexGeom=((Integer) table_.getModel().getValueAt(selection[i], 3)).intValue(); + model.getGeomData().switchGeometries(scene_.sceneId2LayerId(indexGeom), scene_.sceneId2LayerId(indexGeom+1), cmd_); + } + else + newSelection.add(selection[i]); + } + // R\xE9tablissement de la selection dans le tableau + table_.getSelectionModel().clearSelection(); + for(int i=0;i<newSelection.size();i++) + table_.getSelectionModel().addSelectionInterval(newSelection.get(i), newSelection.get(i)); + } + + /** + * Est appel\xE9e par EditVisibilityAction quand la palette est d\xE9couverte. + */ + public void doShow(){ + updateListen(); + fillCalqueComboBox(); + fillTableGeometry(); + updateBtMovement(); + } + + /** + * Est appel\xE9e par EditVisibilityAction quand la palette est cach\xE9e. + */ + public void doHide(){ + // Suppression de l'\xE9coute de tout les calques + for(int i=0;i<listenModels_.length;i++) + listenModels_[i].removeModelListener(this); + // Mise a jour du tableau de listeners + listenModels_=new ZModeleEditable[0]; + } + + /* (non-Javadoc) + * @see org.fudaa.ebli.commun.BPalettePanelInterface#doAfterDisplay() + */ + public void doAfterDisplay() { + } + + /* (non-Javadoc) + * @see org.fudaa.ebli.commun.BPalettePanelInterface#getComponent() + */ + public JComponent getComponent() { + return this; + } + + /* (non-Javadoc) + * @see org.fudaa.ebli.commun.BPalettePanelInterface#paletteDeactivated() + */ + public void paletteDeactivated() { + } + + /* (non-Javadoc) + * @see org.fudaa.ebli.commun.BPalettePanelInterface#setPalettePanelTarget(java.lang.Object) + */ + public boolean setPalettePanelTarget(Object _target) { + return false; + } + + // Changement dans le comboBox des calques ou dans les boutons de d\xE9placements \\ + + public void actionPerformed(ActionEvent e) { + if(e.getSource()==calque_){ + updateListen(); + fillTableGeometry(); + updateBtMovement(); + } + else if(e.getSource()==btUp_) + moveUpSelectedGeometies(); + else if(e.getSource()==btDown_) + moveDownSelectedGeometies(); + } + + //Changement dans le checkBox onlyInvisible \\ + + public void stateChanged(ChangeEvent e) { + onlyInvisible_=!onlyInvisible_; + fillTableGeometry(); + } + + // Changement dans l'arbre des calques \\ + + public void treeNodesChanged(TreeModelEvent e) { + fillCalqueComboBox(); + } + + public void treeNodesInserted(TreeModelEvent e) { + fillCalqueComboBox(); + } + + public void treeNodesRemoved(TreeModelEvent e) { + fillCalqueComboBox(); + } + + public void treeStructureChanged(TreeModelEvent e) { + fillCalqueComboBox(); + } + + // Modification dans le ou les model(s) \xE9cout\xE9(s). + + public void attributeAction(Object _source, int att, GISAttributeInterface _att, int _action) { + fillTableGeometry(); + } + + public void attributeValueChangeAction(Object _source, int att, GISAttributeInterface _att, int _geom, Object _value) { + if(listenVisibility&&(_att==GISAttributeConstants.TITRE||_att==GISAttributeConstants.VISIBILITE||_att==null)){ + // Recherche le calque contenant le model + boolean foundCalque=false; + int j=-1; + ZCalqueEditable[] calques=scene_.getEditableLayers(); + while (!foundCalque&&++j<calques.length) + foundCalque=calques[j].getModelEditable()==_source; + if (foundCalque) { + if (_geom>=0) { + int idxGeom=scene_.layerId2SceneId(calques[j], _geom); + // Mise \xE0 jour seulement de la g\xE9om\xE9trie. + boolean found=false; + int i=-1; + while (!found&&++i<table_.getModel().getRowCount()) { + ZModeleEditable model=(ZModeleEditable)table_.getModel().getValueAt(i, 2); + Integer indexGeom=(Integer)table_.getModel().getValueAt(i, 3); + found=(model==_source)&&(indexGeom==idxGeom); + } + if (found) + if (_att==GISAttributeConstants.TITRE) + table_.getModel().setValueAt(_value, i, 0); + else if (_att==GISAttributeConstants.VISIBILITE) + table_.getModel().setValueAt(_value.equals(GISAttributeConstants.ATT_VAL_TRUE) ? true:false, i, 1); + else { + GISZoneCollection zone=((ZModeleEditable)_source).getGeomData(); + table_.getModel().setValueAt( + ((ZModeleEditable)_source).getGeomData().getValue(zone.getIndiceOf(GISAttributeConstants.TITRE), _geom), i, 0); + table_.getModel().setValueAt( + ((ZModeleEditable)_source).getGeomData().getValue(zone.getIndiceOf(GISAttributeConstants.VISIBILITE), _geom) + .equals(GISAttributeConstants.ATT_VAL_TRUE) ? true:false, i, 1); + } + } + else + // Mise \xE0 jour de toutes les g\xE9om\xE9tries. + fillTableGeometry(); + } + } + } + + public void geometryAction(Object _source, int geom, Geometry _geom, int _action) { + if(_action!=GEOMETRY_ACTION_MODIFY) + fillTableGeometry(); + } + + // La selection dans un calque \xE0 chang\xE9e \\ + + public void selectionChanged(ZSelectionEvent _evt) { + if (listenSelection) { + listenSelection=false; + updateTableSelection(); + updateBtMovement(); + listenSelection=true; + } + } + + // La selection dans le tableau \xE0 chang\xE9e \\ + + public void valueChanged(ListSelectionEvent _e) { + if (listenSelection) { + listenSelection=false; + updateCalqueSelection(); + updateBtMovement(); + listenSelection=true; + } + } +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bma...@us...> - 2008-11-12 13:32:35
|
Revision: 4208 http://fudaa.svn.sourceforge.net/fudaa/?rev=4208&view=rev Author: bmarchan Date: 2008-11-12 13:32:33 +0000 (Wed, 12 Nov 2008) Log Message: ----------- Deleted directory FudaaModeleur_0_07. Removed Paths: ------------- tags/FudaaModeleur_0_07/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bma...@us...> - 2008-11-12 12:22:04
|
Revision: 4207 http://fudaa.svn.sourceforge.net/fudaa/?rev=4207&view=rev Author: bmarchan Date: 2008-11-12 11:34:10 +0000 (Wed, 12 Nov 2008) Log Message: ----------- Chgt d'icones, pas transf?\195?\169r?\195?\169s dans la distrib. Modified Paths: -------------- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/BPaletteEditVisibility.java Added Paths: ----------- branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/com/memoire/bu/crystal_descendre.png branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/com/memoire/bu/crystal_monter.png Removed Paths: ------------- branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/com/memoire/bu/crystal22_descendre.png branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/com/memoire/bu/crystal22_monter.png Property Changed: ---------------- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/BPaletteEditVisibility.java Deleted: branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/com/memoire/bu/crystal22_descendre.png =================================================================== (Binary files differ) Deleted: branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/com/memoire/bu/crystal22_monter.png =================================================================== (Binary files differ) Added: branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/com/memoire/bu/crystal_descendre.png =================================================================== (Binary files differ) Property changes on: branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/com/memoire/bu/crystal_descendre.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: svn:keywords + Date Revision Author URL Id Added: branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/com/memoire/bu/crystal_monter.png =================================================================== (Binary files differ) Property changes on: branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/com/memoire/bu/crystal_monter.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: svn:keywords + Date Revision Author URL Id Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/BPaletteEditVisibility.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/BPaletteEditVisibility.java 2008-11-12 11:02:46 UTC (rev 4206) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/BPaletteEditVisibility.java 2008-11-12 11:34:10 UTC (rev 4207) @@ -143,9 +143,9 @@ // Ajout des boutons de d\xE9placement des g\xE9om\xE9tries \\ Container btCont=new Container(); btCont.setLayout(new FlowLayout(FlowLayout.CENTER, 0, 0)); - btUp_=new BuButton(BuResource.BU.getIcon("crystal22_monter")); + btUp_=new BuButton(BuResource.BU.getIcon("monter")); btUp_.setToolTipText(EbliLib.getS("D\xE9cr\xE9menter l'index de la g\xE9om\xE9trie")); - btDown_=new BuButton(BuResource.BU.getIcon("crystal22_descendre")); + btDown_=new BuButton(BuResource.BU.getIcon("descendre")); btDown_.setToolTipText(EbliLib.getS("Incr\xE9menter l'index de la g\xE9om\xE9trie")); btUp_.addActionListener(this); btDown_.addActionListener(this); Property changes on: branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/BPaletteEditVisibility.java ___________________________________________________________________ Modified: svn:keywords - Id + Date Revision Author URL Id This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <emm...@us...> - 2008-11-12 11:02:52
|
Revision: 4206 http://fudaa.svn.sourceforge.net/fudaa/?rev=4206&view=rev Author: emmanuel_martin Date: 2008-11-12 11:02:46 +0000 (Wed, 12 Nov 2008) Log Message: ----------- rollback 4204 Modified Paths: -------------- branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISCollection.java Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISCollection.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISCollection.java 2008-11-12 10:51:03 UTC (rev 4205) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISCollection.java 2008-11-12 11:02:46 UTC (rev 4206) @@ -44,10 +44,6 @@ GISCollection.this.fireGeometryAdded(_newIdx, (Geometry) _newGeom); } - protected void fireObjectChanged(int _idx, Object _geom){ - fireObjectModified(_idx, _geom); - } - protected void fireObjectModified(int _oldIdx, Object _oldGeom) { GISCollection.this.geometryChanged(); GISCollection.this.fireGeometryModified(_oldIdx, (Geometry) _oldGeom); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |