From: <emm...@us...> - 2009-01-29 09:53:09
|
Revision: 4424 http://fudaa.svn.sourceforge.net/fudaa/?rev=4424&view=rev Author: emmanuel_martin Date: 2009-01-29 09:53:07 +0000 (Thu, 29 Jan 2009) Log Message: ----------- Am?\195?\169lioration de la stabilit?\195?\169 du modeleur1d Modified Paths: -------------- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/controller/Controller1d.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/controller/ControllerBief.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/Bief.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/BiefSet.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/UtilsProfil1d.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/VueModuleGestionBief.java Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/controller/Controller1d.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/controller/Controller1d.java 2009-01-28 22:44:24 UTC (rev 4423) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/controller/Controller1d.java 2009-01-29 09:53:07 UTC (rev 4424) @@ -409,12 +409,10 @@ @Override public void internalFrameActivated(InternalFrameEvent e) { + controllerBief_.removeAllBiefs(); controllerBief_.updateFrom2d(); } - /* (non-Javadoc) - * @see javax.swing.event.InternalFrameAdapter#internalFrameDeactivated(javax.swing.event.InternalFrameEvent) - */ @Override public void internalFrameDeactivated(InternalFrameEvent e) { mng_.clean(); Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/controller/ControllerBief.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/controller/ControllerBief.java 2009-01-28 22:44:24 UTC (rev 4423) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/controller/ControllerBief.java 2009-01-29 09:53:07 UTC (rev 4424) @@ -74,7 +74,12 @@ * Se r\xE9g\xE9n\xE8re par rapport aux 2d. */ public void updateFrom2d(){ - importBiefsFrom2d(controller1d_.getImplementation().get2dFrame().getVisuPanel().getArbreCalqueModel().getRootCalque().getCalqueParNom("gcBiefs")); + try { + importBiefsFrom2d(controller1d_.getImplementation().get2dFrame().getVisuPanel().getArbreCalqueModel().getRootCalque().getCalqueParNom("gcBiefs")); + } + catch(IllegalArgumentException _exp) { + controller1d_.getImplementation().error(FudaaLib.getS("Erreur dans l'import depuis le 2d"), _exp.getMessage()); + } } /** @@ -107,6 +112,7 @@ biefSet_.removeBief(names[i], null); BCalque[] calques=_rootCalque.getCalques(); // It\xE9ration du chaque bief + StringBuilder errors=new StringBuilder(); for (int i=0; i<calques.length; i++) { BCalque calqueBief=calques[i]; List<ZModeleLigneBrisee> modelsDuFutureBief=new ArrayList<ZModeleLigneBrisee>(); @@ -116,13 +122,21 @@ if (sousCalques[j] instanceof FSigLayerLineEditable) modelsDuFutureBief.add(((FSigLayerLineEditable)sousCalques[j]).getModele()); // Ajout du bief - biefSet_.addBief(calqueBief.getTitle(), modelsDuFutureBief.toArray(new ZModeleLigneBrisee[0]), null); + try { + biefSet_.addBief(calqueBief.getTitle(), modelsDuFutureBief.toArray(new ZModeleLigneBrisee[0]), null); + } + catch (IllegalArgumentException _exp) { + errors.append(FudaaLib.getS("Bief \"")+calqueBief.getTitle()+"\" : "+_exp.getMessage()+"\n"); + } } // Ajout d'une selection if(biefSet_.getNbBief()>selectedValue&&selectedValue!=-1) biefSelectionModel_.addSelectionInterval(selectedValue, selectedValue); else if(biefSet_.getNbBief()>0&&selectedValue==-1) biefSelectionModel_.addSelectionInterval(0, 0); + // Traitement des erreurs + if(errors.length()>0) + throw new IllegalArgumentException(errors.toString()); } /** @@ -159,12 +173,36 @@ public void removeBief(int[] _idx){ Arrays.sort(_idx); CtuluCommandComposite cmd=new CtuluCommandComposite(FudaaLib.getS("Suppression de biefs")); - for(int i=_idx.length-1;i>=0;i--) + for(int i=_idx.length-1;i>=0;i--) { + if(biefSelectionModel_.getSelectedBief()==_idx[i]) + biefSelectionModel_.clearSelection(); biefSet_.removeBief(biefSet_.getBiefName(_idx[i]), cmd); + } getCommandManager().addCmd(cmd.getSimplify()); } /** + * Supprime tous les biefs. + */ + public void removeAllBiefs() { + int[] idx=new int[biefSet_.getNbBief()]; + for(int i=0;i<idx.length;i++) + idx[i]=i; + removeBief(idx); + } + + /** + * Supprime le bief selectionn\xE9. + */ + public void removeSelectedBief() { + int idxBief=biefSelectionModel_.getSelectedBief(); + if(idxBief!=-1) { + biefSelectionModel_.clearSelection(); + biefSet_.removeBief(biefSet_.getBiefName(idxBief), getCommandManager()); + } + } + + /** * Fusion de deux biefs. */ public void fusionnerBiefs(int _idxBief1, int _idxBief2){ @@ -373,9 +411,11 @@ public BiefSelectionModel getBiefSelectionModel() { return biefSelectionModel_; } - + /** - * Retourne le biefContainer, c'est \xE0 dire le conteneur de tout les biefs. + * Retourne le biefContainer, c'est \xE0 dire le conteneur de tous les biefs. + * Attention, pour la suppression de biefs, mieux vaut passer par le + * controller, sinon des incoh\xE9rences avec la selection peuvent apparaitre. */ public BiefSet getBiefSet(){ return biefSet_; Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/Bief.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/Bief.java 2009-01-28 22:44:24 UTC (rev 4423) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/Bief.java 2009-01-29 09:53:07 UTC (rev 4424) @@ -56,9 +56,11 @@ /** Le synchroniser de gis. */ private GisZoneSynchroniser gisSynchroniser_=new GisZoneSynchroniser(); - + /** * Les models de bases sont instanci\xE9s, le synchronizer n'est pas lanc\xE9. + * Attention le modele d'axe hydraulique ne contient pas d'axe hydraulique. Il + * est donc invalide. */ public Bief(){ axeHydraulique_=new MdlModel1dAxe(null); @@ -109,7 +111,7 @@ if (_models[i]==null) throw new IllegalArgumentException(FudaaLib.getS("Erreur programmation : _models ne doit pas contenir de valeurs null")); if (_models[i].getGeomData()==null) - throw new IllegalArgumentException(FudaaLib.getS("Erreur programmation : Certain model n'ont pas de GSIZone.")); + throw new IllegalArgumentException(FudaaLib.getS("Erreur programmation : Certain model n'ont pas de GSIZoneCollection.")); if (!(_models[i].getGeomData() instanceof GISZoneCollectionLigneBrisee)) throw new IllegalArgumentException(FudaaLib.getS("Erreur programmation : Toutes les GISZone doivent \xEAtre des GISZoneCollectionLigneBrisee.")); String nature=(String)_models[i].getGeomData().getFixedAttributValue(GISAttributeConstants.NATURE); @@ -119,7 +121,9 @@ if (axeHydraulique_!=null) throw new IllegalArgumentException(FudaaLib.getS("Plusieurs models d'axe hydrauliques sont donn\xE9es.")); else if (_models[i].getGeomData().getNbGeometries()>1) - throw new IllegalArgumentException(FudaaLib.getS("Il ne peut pas y avoir plusieurs Axes hydrauliques dans le bief.")); + throw new IllegalArgumentException(FudaaLib.getS("Il ne peut pas y avoir plusieurs axes hydrauliques dans le bief.")); + else if (_models[i].getGeomData().getNbGeometries()==0) + throw new IllegalArgumentException(FudaaLib.getS("Il doit y avoir au moins un axe hydraulique dans le bief.")); else axeHydraulique_=_models[i]; else if (nature==GISAttributeConstants.ATT_NATURE_LD) @@ -131,7 +135,7 @@ if (limitesStockages_!=null) throw new IllegalArgumentException(FudaaLib.getS("Plusieurs models de limites de stockage sont donn\xE9es.")); else if (_models[i].getGeomData().getNbGeometries()>2) - throw new IllegalArgumentException(FudaaLib.getS("Il ne peut pas y avoir plus de 2 limites de stockage.")); + throw new IllegalArgumentException(FudaaLib.getS("Il ne peut pas y avoir plus de 2 limites de stockages.")); else limitesStockages_=_models[i]; else if (nature==GISAttributeConstants.ATT_NATURE_PF) @@ -184,89 +188,83 @@ int idxAttlsDroite=zone.getIndiceOf(GISAttributeConstants.INTERSECTION_LIMITE_STOCKAGE_DROITE); int idxAttLignesDirectrices=zone.getIndiceOf(GISAttributeConstants.INTERSECTIONS_LIGNES_DIRECTRICES); - if (axeHydraulique_.getNombre()==0) - for (int i=0; i<profils_.getNombre(); i++) { - profils_.getGeomData().setAttributValue(idxAttRiveGauche, i, null, null); - profils_.getGeomData().setAttributValue(idxAttRiveDroite, i, null, null); - profils_.getGeomData().setAttributValue(idxAttlsGauche, i, null, null); - profils_.getGeomData().setAttributValue(idxAttlsDroite, i, null, null); - GISAttributeModelIntegerList attrModel=new GISAttributeModelIntegerList(0, GISAttributeConstants.INTERSECTIONS_LIGNES_DIRECTRICES); - attrModel.setListener(profils_.getGeomData()); - profils_.getGeomData().setAttributValue(idxAttLignesDirectrices, i, attrModel, null); + Geometry axeHydraulique=(Geometry)axeHydraulique_.getObject(0); + CoordinateSequence seqAxeHydraulique=((GISCoordinateSequenceContainerInterface)axeHydraulique).getCoordinateSequence(); + orderProfils(-1, null); + // Normalise le sens du profil \\ + for (int k=0; k<profils_.getNombre(); k++) { + Geometry profil=zone.getGeometry(k); + CoordinateSequence seqProfil=((GISCoordinateSequenceContainerInterface)profil).getCoordinateSequence(); + // Normalisation du sens (gauche/droite) du profil \\ + Coordinate interAxeProfil=profil.intersection(axeHydraulique).getCoordinate(); + // Cr\xE9ation du vecteur contenant le sens de l'axe hydraulique + Coordinate vAxeH; + int idxPrevious=UtilsProfil1d.getPreviousIndex(seqAxeHydraulique, interAxeProfil); + int idxNext=UtilsProfil1d.getNextIndex(seqAxeHydraulique, interAxeProfil); + if (idxPrevious!=-1) + vAxeH=new Coordinate(interAxeProfil.x-seqAxeHydraulique.getCoordinate(idxPrevious).x, interAxeProfil.y + -seqAxeHydraulique.getCoordinate(idxPrevious).y, 0); + else + vAxeH=new Coordinate(seqAxeHydraulique.getCoordinate(idxNext).x-interAxeProfil.x, + seqAxeHydraulique.getCoordinate(idxNext).y-interAxeProfil.y, 0); + // Cr\xE9ation du vecteur contenant le sens du profil + Coordinate vProfilH; + idxPrevious=UtilsProfil1d.getPreviousIndex(seqProfil, interAxeProfil); + idxNext=UtilsProfil1d.getNextIndex(seqProfil, interAxeProfil); + if (idxPrevious!=-1) + vProfilH=new Coordinate(interAxeProfil.x-seqProfil.getCoordinate(idxPrevious).x, interAxeProfil.y + -seqProfil.getCoordinate(idxPrevious).y, 0); + else + vProfilH=new Coordinate(seqProfil.getCoordinate(idxNext).x-interAxeProfil.x, seqProfil.getCoordinate(idxNext).y + -interAxeProfil.y, 0); + // Inversion du sens du profil si besoin + double produitVectorielCoordZ=vAxeH.x*vProfilH.y-vAxeH.y*vProfilH.x; + if (produitVectorielCoordZ>0) { + inverseProfil(k); + profil=(Geometry)profils_.getGeomData().getGeometry(k); + seqProfil=((GISCoordinateSequenceContainerInterface)profil).getCoordinateSequence(); } - if (axeHydraulique_.getNombre()==1) { - Geometry axeHydraulique=(Geometry)axeHydraulique_.getObject(0); - CoordinateSequence seqAxeHydraulique=((GISCoordinateSequenceContainerInterface)axeHydraulique).getCoordinateSequence(); - orderProfils(-1, null); - // Normalise le sens du profil \\ - for (int k=0; k<profils_.getNombre(); k++) { - Geometry profil=zone.getGeometry(k); - CoordinateSequence seqProfil=((GISCoordinateSequenceContainerInterface)profil).getCoordinateSequence(); - // Normalisation du sens (gauche/droite) du profil \\ - Coordinate interAxeProfil=profil.intersection(axeHydraulique).getCoordinate(); - // Cr\xE9ation du vecteur contenant le sens de l'axe hydraulique - Coordinate vAxeH; - int idxPrevious=UtilsProfil1d.getPreviousIndex(seqAxeHydraulique, interAxeProfil); - int idxNext=UtilsProfil1d.getNextIndex(seqAxeHydraulique, interAxeProfil); - if(idxPrevious!=-1) - vAxeH=new Coordinate(interAxeProfil.x-seqAxeHydraulique.getCoordinate(idxPrevious).x, interAxeProfil.y-seqAxeHydraulique.getCoordinate(idxPrevious).y, 0); - else - vAxeH=new Coordinate(seqAxeHydraulique.getCoordinate(idxNext).x-interAxeProfil.x, seqAxeHydraulique.getCoordinate(idxNext).y-interAxeProfil.y, 0); - // Cr\xE9ation du vecteur contenant le sens du profil - Coordinate vProfilH; - idxPrevious=UtilsProfil1d.getPreviousIndex(seqProfil, interAxeProfil); - idxNext=UtilsProfil1d.getNextIndex(seqProfil, interAxeProfil); - if(idxPrevious!=-1) - vProfilH=new Coordinate(interAxeProfil.x-seqProfil.getCoordinate(idxPrevious).x, interAxeProfil.y-seqProfil.getCoordinate(idxPrevious).y, 0); - else - vProfilH=new Coordinate(seqProfil.getCoordinate(idxNext).x-interAxeProfil.x, seqProfil.getCoordinate(idxNext).y-interAxeProfil.y, 0); - // Inversion du sens du profil si besoin - double produitVectorielCoordZ=vAxeH.x*vProfilH.y-vAxeH.y*vProfilH.x; - if (produitVectorielCoordZ>0) { - inverseProfil(k); - profil=(Geometry)profils_.getGeomData().getGeometry(k); - seqProfil=((GISCoordinateSequenceContainerInterface)profil).getCoordinateSequence(); - } - } - // Cr\xE9ation des nouveaux points sur les profils \\ - for (int k=0; k<profils_.getNombre(); k++) { - // Ajout des points au profil si n\xE9c\xE9ssaire pour les intersections \\ - // Lignes de contraintes - for (int l=0; l<lignesContraints_.getNombre(); l++) - createPointIfNeededKeepZ(k, l, lignesContraints_); - // Rives - for (int l=0; l<rives_.getNombre(); l++) - createPointIfNeeded(k, (GISPolyligne) rives_.getObject(l)); - // Limites de stockages - for (int l=0; l<limitesStockages_.getNombre(); l++) - createPointIfNeeded(k, (GISPolyligne) limitesStockages_.getObject(l)); - // Lignes directrices - for (int l=0; l<lignesDirectrices_.getNombre(); l++) - createPointIfNeeded(k, (GISPolyligne) lignesDirectrices_.getObject(l)); - } - // Valuation des attributs simple d'intersection (rives et limites) \\ - for(int k=0;k<profils_.getNombre();k++) { - Geometry profil=zone.getGeometry(k); - CoordinateSequence seqProfil=((GISCoordinateSequenceContainerInterface)profil).getCoordinateSequence(); - Coordinate interAxeProfil=profil.intersection(axeHydraulique).getCoordinate(); - double abscisseCurvIntersectionAxe=UtilsProfil1d.abscisseCurviligne(seqProfil, interAxeProfil); - // Valuation des attributs avec les index des points des intersections \\ - // Rives - zone.setAttributValue(idxAttRiveGauche, k, 0, null); - zone.setAttributValue(idxAttRiveDroite, k, seqProfil.size()-1, null); - for (int l=0; l<rives_.getNombre(); l++) - valuateProfilIntersection(k, (Geometry) rives_.getObject(l), idxAttRiveGauche, idxAttRiveDroite, abscisseCurvIntersectionAxe); - // D\xE9tection des croisements zones de stockages droite et gauche \\ - // Limites de stockages - zone.setAttributValue(idxAttlsGauche, k, 0, null); - zone.setAttributValue(idxAttlsDroite, k, seqProfil.size()-1, null); - for (int l=0; l<limitesStockages_.getNombre(); l++) - valuateProfilIntersection(k, (Geometry) limitesStockages_.getObject(l), idxAttlsGauche, idxAttlsDroite, abscisseCurvIntersectionAxe); - } - // Valuation des attributs composites d'intersection (lignes directrices) \\ - // Lignes directrices \\ - valuateProfilIntersection(idxAttLignesDirectrices); } + // Cr\xE9ation des nouveaux points sur les profils \\ + for (int k=0; k<profils_.getNombre(); k++) { + // Ajout des points au profil si n\xE9c\xE9ssaire pour les intersections \\ + // Lignes de contraintes + for (int l=0; l<lignesContraints_.getNombre(); l++) + createPointIfNeededKeepZ(k, l, lignesContraints_); + // Rives + for (int l=0; l<rives_.getNombre(); l++) + createPointIfNeeded(k, (GISPolyligne)rives_.getObject(l)); + // Limites de stockages + for (int l=0; l<limitesStockages_.getNombre(); l++) + createPointIfNeeded(k, (GISPolyligne)limitesStockages_.getObject(l)); + // Lignes directrices + for (int l=0; l<lignesDirectrices_.getNombre(); l++) + createPointIfNeeded(k, (GISPolyligne)lignesDirectrices_.getObject(l)); + } + // Valuation des attributs simple d'intersection (rives et limites) \\ + for (int k=0; k<profils_.getNombre(); k++) { + Geometry profil=zone.getGeometry(k); + CoordinateSequence seqProfil=((GISCoordinateSequenceContainerInterface)profil).getCoordinateSequence(); + Coordinate interAxeProfil=profil.intersection(axeHydraulique).getCoordinate(); + double abscisseCurvIntersectionAxe=UtilsProfil1d.abscisseCurviligne(seqProfil, interAxeProfil); + // Valuation des attributs avec les index des points des intersections \\ + // Rives + zone.setAttributValue(idxAttRiveGauche, k, 0, null); + zone.setAttributValue(idxAttRiveDroite, k, seqProfil.size()-1, null); + for (int l=0; l<rives_.getNombre(); l++) + valuateProfilIntersection(k, (Geometry)rives_.getObject(l), idxAttRiveGauche, idxAttRiveDroite, abscisseCurvIntersectionAxe); + // D\xE9tection des croisements zones de stockages droite et gauche \\ + // Limites de stockages + zone.setAttributValue(idxAttlsGauche, k, 0, null); + zone.setAttributValue(idxAttlsDroite, k, seqProfil.size()-1, null); + for (int l=0; l<limitesStockages_.getNombre(); l++) + valuateProfilIntersection(k, (Geometry)limitesStockages_.getObject(l), idxAttlsGauche, idxAttlsDroite, + abscisseCurvIntersectionAxe); + } + // Valuation des attributs composites d'intersection (lignes directrices) \\ + // Lignes directrices \\ + valuateProfilIntersection(idxAttLignesDirectrices); + // Valuation des attributs sp\xE9cifique au 1d pour l'axe hydraulique \\ normalizeAxeHydrauliqueAttributes(axeHydraulique_.getGeomData()); // Activation du synchroniser @@ -612,8 +610,10 @@ Object[][] idxAbsCurv=new Object[profils_.getNombre()][]; for(int j=0;j<profils_.getNombre();j++) { Geometry intersection=axeHydraulique.intersection((Geometry) profils_.getObject(j)); - if(intersection.getNumPoints()!=1) - throw new IllegalArgumentException("Au moins un des profils est coup\xE9 plusieurs fois ou jamais."); + if(intersection.getNumPoints()==0) + throw new IllegalArgumentException("Au moins un des profils ne coupe jamais l'axe hydraulique."); + if(intersection.getNumPoints()>1) + throw new IllegalArgumentException("Au moins un des profils coupe plusieurs fois l'axe hydraulique."); idxAbsCurv[j]=new Object[]{j, UtilsProfil1d.abscisseCurviligne(seqAxeHydraulique, intersection.getCoordinate())}; } // Tri en fonction des abcsisses curvilignes Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/BiefSet.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/BiefSet.java 2009-01-28 22:44:24 UTC (rev 4423) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/BiefSet.java 2009-01-29 09:53:07 UTC (rev 4424) @@ -13,6 +13,7 @@ import java.util.Map; import org.fudaa.ctulu.CtuluCommand; +import org.fudaa.ctulu.CtuluCommandComposite; import org.fudaa.ctulu.CtuluCommandContainer; import org.fudaa.ctulu.CtuluNamedCommand; import org.fudaa.ebli.calque.ZModeleLigneBrisee; @@ -49,9 +50,9 @@ */ public void addBief(String _nom, ZModeleLigneBrisee[] _models, CtuluCommandContainer _cmd) { if(_nom==null||_models==null) - throw new IllegalArgumentException("Ni _nom ni _models ne peuvent \xEAtre null."); + throw new IllegalArgumentException(FudaaLib.getS("Ni _nom ni _models ne peuvent \xEAtre null.")); if(biefs_.containsKey(_nom)) - throw new IllegalArgumentException("Ce nom de profil est d\xE9j\xE0 utilis\xE9."); + throw new IllegalArgumentException(FudaaLib.getS("Ce nom de profil est d\xE9j\xE0 utilis\xE9.")); class AddBiefCtuluCommand implements CtuluCommand, CtuluNamedCommand { public String nom_; public Bief bief_; @@ -60,6 +61,7 @@ public void undo() {removeBief(nom_, null);} public String getName() {return FudaaLib.getS("Ajouter bief");} }; + // Transformation des du tableau de models en bief Bief newBief=new Bief(_models); biefs_.put(_nom, newBief); listNoms_.add(_nom); @@ -93,6 +95,18 @@ } /** + * Supprime tous les biefs du container. + */ + public void removeAllBiefs(CtuluCommandContainer _cmd) { + CtuluCommandComposite cmd=new CtuluCommandComposite(FudaaLib.getS("Suppression de tous les biefs")); + String[] names=getBiefNames(); + for(int i=0;i<names.length;i++) + removeBief(names[i], cmd); + if(_cmd!=null) + _cmd.addCmd(cmd.getSimplify()); + } + + /** * Supprime le bief dont le nom est donn\xE9 en param\xE8tre. */ public void removeBief(String _nomBief, CtuluCommandContainer _cmd) { Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/UtilsProfil1d.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/UtilsProfil1d.java 2009-01-28 22:44:24 UTC (rev 4423) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/UtilsProfil1d.java 2009-01-29 09:53:07 UTC (rev 4424) @@ -212,7 +212,7 @@ * Retourne -2 si la coordonn\xE9e n'appartient pas \xE0 la g\xE9om\xE9trie. */ static public int getPreviousIndex(CoordinateSequence _geom, Coordinate _point) { - if(_point==null||_geom.size()<=0||egal(_point, _geom.getCoordinate(0))) + if(_point==null||_geom.size()<=0||egalSansZ(_point, _geom.getCoordinate(0))) return -1; boolean fini=false; int i=-1; @@ -232,7 +232,7 @@ * Retourne -2 si la coordonn\xE9e n'appartient pas \xE0 la g\xE9om\xE9trie. */ static public int getNextIndex(CoordinateSequence _geom, Coordinate _point) { - if(_point==null||_geom.size()<=0||egal(_point, _geom.getCoordinate(_geom.size()-1))) + if(_point==null||_geom.size()<=0||egalSansZ(_point, _geom.getCoordinate(_geom.size()-1))) return -1; boolean fini=false; int i=_geom.size(); Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/VueModuleGestionBief.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/VueModuleGestionBief.java 2009-01-28 22:44:24 UTC (rev 4423) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/VueModuleGestionBief.java 2009-01-29 09:53:07 UTC (rev 4424) @@ -26,7 +26,6 @@ import org.fudaa.fudaa.modeleur.modeleur1d.controller.ControllerBief; import org.fudaa.fudaa.modeleur.modeleur1d.model.BiefSet; import org.fudaa.fudaa.modeleur.modeleur1d.model.BiefSetListener; -import org.fudaa.fudaa.modeleur.modeleur1d.model.UtilsProfil1d; import com.memoire.bu.BuBorderLayout; import com.memoire.bu.BuButton; @@ -97,9 +96,6 @@ int[] idx=new int[idxSupp.size()]; for(int i=0;i<idx.length;i++) idx[i]=idxSupp.get(i); - // D\xE9selection si besoin du bief en cours de manipulation - if(UtilsProfil1d.in(controllerBief_.getBiefSelectionModel().getMaxSelectionIndex(), idx)) - controllerBief_.getBiefSelectionModel().clearSelection(); // Suppression des biefs controllerBief_.removeBief(idx); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |