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...> - 2009-01-07 18:22:18
|
Revision: 4330 http://fudaa.svn.sourceforge.net/fudaa/?rev=4330&view=rev Author: bmarchan Date: 2009-01-07 18:22:13 +0000 (Wed, 07 Jan 2009) Log Message: ----------- Notification de l'appli que les Data ou UI 1D ont ?\195?\169t?\195?\169 modifi?\195?\169s. 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/MdlProjet.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/MdlFille1d.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/controller/Controller1d.java Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlImplementation.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlImplementation.java 2009-01-07 13:34:28 UTC (rev 4329) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlImplementation.java 2009-01-07 18:22:13 UTC (rev 4330) @@ -190,6 +190,13 @@ } /** + * @return La vue 1D, ou null si inexistante. + */ + public MdlFille1d get1dFrame() { + return mdl1dFrame_; + } + + /** * @return La vue 2D, ou null si inexistante. */ public MdlFille2d get2dFrame() { @@ -419,6 +426,8 @@ try { addInternalFrame(mdl2dFrame_); + if (swingRun != null) swingRun.run(); + // Met a jour la fenetre 1d FudaaSaveZipLoader loader=null; try { @@ -431,8 +440,6 @@ try { loader.close(); } catch (IOException _exc) {} } } - - if (swingRun != null) swingRun.run(); // le projet a ete install\xE9: on enl\xE8ve les flag de modification project_.setOpening(false); Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlProjet.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlProjet.java 2009-01-07 13:34:28 UTC (rev 4329) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlProjet.java 2009-01-07 18:22:13 UTC (rev 4330) @@ -100,6 +100,7 @@ public void install(MdlImplementation _impl) { _impl.get2dFrame().getArbreCalqueModel().getObservable().addObserver(this); + _impl.get1dFrame().getController().getVueBief().getArbreCalqueModel().getObservable().addObserver(this); state_.addListener(new FudaaProjectStateFrameListener(_impl.getFrame(), this)); state_.addListener(_impl); state_.clearStates(); @@ -116,7 +117,10 @@ public void update(Observable _o, Object _arg) { if (opening_ || !isInstalled_) return; - state_.setParamModified(true); + if ((_arg instanceof String) && ((String)_arg).equals("UI")) + state_.setUiModified(true); + else + state_.setParamModified(true); } } Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/MdlFille1d.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/MdlFille1d.java 2009-01-07 13:34:28 UTC (rev 4329) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/MdlFille1d.java 2009-01-07 18:22:13 UTC (rev 4330) @@ -58,7 +58,7 @@ /** Le controller 1d */ private Controller1d controller_; /** L'implementation */ - private BuCommonImplementation impl_=null; + private MdlImplementation impl_=null; public MdlFille1d(MdlImplementation _appli) { super("", true, false, true, true, _appli, null); @@ -114,6 +114,10 @@ public String getComponentTitle() { return FudaaLib.getS("Modules"); } + + public Controller1d getController() { + return controller_; + } public void majComponent(Object _o) { } @@ -257,8 +261,8 @@ private void restoreSpecificProps(final Properties _props) { if (_props==null) return; - SwingUtilities.invokeLater(new Runnable() { - public void run() { +// SwingUtilities.invokeLater(new Runnable() { +// public void run() { // Taille des vues try { int w=Integer.parseInt(_props.getProperty("viewBief.width")); @@ -299,7 +303,7 @@ controller_.getControllerProfil().getProfilSelectionModel().setSelectedProfil(idx); } catch (NumberFormatException _exc) {} - } - }); +// } +// }); } } 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-07 13:34:28 UTC (rev 4329) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/controller/Controller1d.java 2009-01-07 18:22:13 UTC (rev 4330) @@ -11,6 +11,8 @@ import java.util.ArrayList; import java.util.HashSet; import java.util.List; +import java.util.Observable; +import java.util.Observer; import javax.swing.Action; import javax.swing.DefaultListModel; @@ -61,6 +63,12 @@ */ public class Controller1d extends InternalFrameAdapter implements ZSelectionListener, ListSelectionListener, CtuluListSelectionListener { + class SpecialObservable extends Observable { + protected synchronized void setChanged() { + super.setChanged(); + } + } + // Les vues \\ /** La vue d'un profil par tableau. */ private VueTableau vueTableau_; @@ -83,6 +91,9 @@ /** Le commande manager pour le undo/redo */ private CtuluCommandManager mng_; + /** La classe d\xE9l\xE9gu\xE9e servant d'observable */ + private SpecialObservable delegateObs=new SpecialObservable(); + // Controllers \\ /** Le controller des Biefs */ private ControllerBief controllerBief_; @@ -364,4 +375,18 @@ mng_.clean(); controllerBief_.disableSynchronisers(); } + + public Observable getObservable() { + return delegateObs; + } + + public void fireUIChanged() { + delegateObs.setChanged(); + delegateObs.notifyObservers("UI"); + } + + public void fireDataChanged() { + delegateObs.setChanged(); + delegateObs.notifyObservers("Params"); + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bma...@us...> - 2009-01-07 13:34:34
|
Revision: 4329 http://fudaa.svn.sourceforge.net/fudaa/?rev=4329&view=rev Author: bmarchan Date: 2009-01-07 13:34:28 +0000 (Wed, 07 Jan 2009) Log Message: ----------- Sauvegarde/restituion de la fenetre 1d, position, taille, bief selectionn?\195?\169, etc. Modified Paths: -------------- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/commun/save/FudaaSaveLib.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlImplementation.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/MdlFille1d.java 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/controller/ControllerProfil.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/VueBief.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/VueCourbe.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/VueTableau.java Added Paths: ----------- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/commun/save/FilleSaver.java Added: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/commun/save/FilleSaver.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/commun/save/FilleSaver.java (rev 0) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/commun/save/FilleSaver.java 2009-01-07 13:34:28 UTC (rev 4329) @@ -0,0 +1,101 @@ +/* + * @creation 5 janv. 2009 + * @modification $Date:$ + * @license GNU General Public License 2 + * @copyright (c)1998-2009 CETMEF 2 bd Gambetta F-60231 Compiegne + * @mail fud...@li... + */ +package org.fudaa.fudaa.commun.save; + +import java.awt.Component; +import java.awt.Dimension; +import java.awt.Point; +import java.beans.PropertyVetoException; +import java.util.Properties; + +import com.memoire.bu.BuDesktop; +import com.memoire.bu.BuInternalFrame; + +/** + * Un saver pour une fenetre interne, sauvegard\xE9 en db4o. Ne peut pas \xEAtre d\xE9riv\xE9. Si la fenetre sauvegarde des infos particuli\xE8res, + * elles peuvent \xEAtre mises dans le tableau des propri\xE9t\xE9s. + * @author Bertrand Marchand + * @version $Id:$ + */ +public final class FilleSaver { + + /** Le nom de la fenetre */ + protected String name_; + /** La localisation de la fenetre */ + protected Point ifLocation_; + /** La dimension de la fenetre */ + protected Dimension ifDim_; + /** Est-elle contenue par le desktop ? */ + protected boolean isVisible_; + /** Est-elle iconifie ? */ + protected boolean isIconified_; + /** Est-elle selectionn\xE9e ? */ + protected boolean isSelected_; + /** Proprietes autres (specifiques de la fenetre) */ + protected Properties props_; + + /** + * + */ + public FilleSaver() { + super(); + } + + /** + * Sauvegarde les propri\xE9t\xE9s standards, la taille, la position, etc. + * @param _f La fenetre + * @param _dk Le desktop. + */ + public void setStandardData(final BuInternalFrame _f, final BuDesktop _dk) { + name_ = _f.getName(); + ifDim_ = _f.getSize(); + ifLocation_ = _f.getLocation(); + isIconified_=_f.isIcon(); + // On verifie que la fenetre est contenue par le desktop. Sinon, visibilt\xE9 a false, pour ne pas la + // reafficher \xE0 la restitution. + if (!isIconified_) { + isVisible_=false; + for (Component c : _dk.getComponents()) { + if (c==_f) { + isVisible_=true; + break; + } + } + } + else { + isVisible_=true; + } + + isSelected_=_f.isSelected(); + } + + /** + * Restitue les propri\xE9t\xE9s standards. La fenetre doit exister. Elle peut \xEAtre + * contenue ou non par le desktop. + * @param _f La fenetre + * @param _dk Le desktop. + */ + public void restoreStandardData(final BuInternalFrame _f, final BuDesktop _dk) { + _f.setSize(ifDim_); + _f.setLocation(ifLocation_); + _f.setVisible(isVisible_); + try { + _f.setIcon(isIconified_); + _f.setSelected(isSelected_); + } + catch (PropertyVetoException _exc) {} + } + + public Properties getSpecificProps() { + return props_; + } + + public void setSpecificProps(Properties _props) { + props_=_props; + } +} \ No newline at end of file Property changes on: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/commun/save/FilleSaver.java ___________________________________________________________________ Added: svn:keywords + Id Added: svn:eol-style + native Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/commun/save/FudaaSaveLib.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/commun/save/FudaaSaveLib.java 2009-01-06 20:21:36 UTC (rev 4328) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/commun/save/FudaaSaveLib.java 2009-01-07 13:34:28 UTC (rev 4329) @@ -127,6 +127,11 @@ return q.execute().size(); } + /** + * Supprime tous les objets d'une classe donn\xE9e + * @param _db La base de donn\xE9es. + * @param _c La classe des objets a supprimer. + */ public static void deleteAll(final ObjectContainer _db, final Class _c) { if (_db == null) { return; @@ -136,6 +141,11 @@ deleteAll(_db, q); } + /** + * Supprime tous les objets d'un set resultant. + * @param _db La base de donn\xE9es + * @param _set Le set. + */ public static void deleteAll(final ObjectContainer _db, final ObjectSet _set) { if (_db == null) { return; @@ -145,6 +155,11 @@ } } + /** + * Supprime tous les objets d'une requete. + * @param _db La base de donn\xE9es + * @param _q La requete. + */ public static void deleteAll(final ObjectContainer _db, final Query _q) { if (_db != null) { for (final ObjectSet s = _q.execute(); s.hasNext();) { @@ -338,7 +353,7 @@ * @param _visu La fille des calques. * @param _prog L'interface de progression de tache. * @param _loader Le zip loader contenant l'\xE9tat du projet. - * @return The thread de tache. + * @return The thread qui remettra a jour les propri\xE9t\xE9s graphiques de la fenetre, tout a la fin. */ public static Runnable restoreFille(final BuCommonImplementation _impl, final ZEbliFilleCalques _visu, final ProgressionInterface _prog, final FudaaSaveZipLoader _loader) { @@ -348,7 +363,8 @@ final FudaaFilleVisuPersistence fudaaFilleVisuPersistence = new FudaaFilleVisuPersistence(_visu); res = fudaaFilleVisuPersistence.restore(_impl, _loader, _prog); - } finally { + } + finally { if (_loader != null) { try { _loader.close(); Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlImplementation.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlImplementation.java 2009-01-06 20:21:36 UTC (rev 4328) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlImplementation.java 2009-01-07 13:34:28 UTC (rev 4329) @@ -181,6 +181,15 @@ } /** + * Creation de la vue 1D. Ajout a la demande. + */ + void createNew1dFrame() { + if (mdl1dFrame_==null) { + mdl1dFrame_=new MdlFille1d(this); + } + } + + /** * @return La vue 2D, ou null si inexistante. */ public MdlFille2d get2dFrame() { @@ -191,9 +200,6 @@ * Installe la vue 1d sur le desktop, et la rend active. */ public void install1dFrame() { - if (mdl1dFrame_==null) { - mdl1dFrame_ = new MdlFille1d(this); - } boolean alreadyInstalled=false; for (JInternalFrame f: getAllInternalFrames()) { if (f.equals(mdl1dFrame_)) { @@ -201,8 +207,10 @@ break; } } - if (!alreadyInstalled) addInternalFrame(mdl1dFrame_); - activateInternalFrame(mdl1dFrame_); + if (!alreadyInstalled) + addInternalFrame(mdl1dFrame_); + else + activateInternalFrame(mdl1dFrame_); } protected boolean buildExportDataToolIcon() { @@ -226,6 +234,7 @@ project_.close(); try { mdl2dFrame_.setClosed(true); + mdl1dFrame_.setClosed(true); } catch (PropertyVetoException _evt) { FuLog.error(_evt); @@ -244,6 +253,7 @@ project_.setOpening(true); if (_add) createNew2dFrame(); else ((MdlVisuPanel)mdl2dFrame_.getVisuPanel()).initCalques(false); + createNew1dFrame(); project_.install(this); BuLib.invokeLater(new Runnable() { @@ -408,6 +418,20 @@ public void run() { try { addInternalFrame(mdl2dFrame_); + + // Met a jour la fenetre 1d + FudaaSaveZipLoader loader=null; + try { + loader=new FudaaSaveZipLoader(f); + mdl1dFrame_.restoreFrom(loader, null); + } + catch (IOException _exc) {} + finally { + if (loader!=null) { + try { loader.close(); } catch (IOException _exc) {} + } + } + if (swingRun != null) swingRun.run(); // le projet a ete install\xE9: on enl\xE8ve les flag de modification Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/MdlFille1d.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/MdlFille1d.java 2009-01-06 20:21:36 UTC (rev 4328) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/MdlFille1d.java 2009-01-07 13:34:28 UTC (rev 4329) @@ -10,23 +10,37 @@ import java.awt.Dimension; import java.awt.Graphics; import java.awt.print.PageFormat; +import java.io.IOException; +import java.util.Properties; import javax.swing.JComponent; import javax.swing.JSplitPane; +import javax.swing.SwingUtilities; import org.fudaa.ctulu.CtuluCommandManager; import org.fudaa.ctulu.CtuluExportDataInterface; import org.fudaa.ctulu.CtuluUI; import org.fudaa.ctulu.CtuluUndoRedoInterface; +import org.fudaa.ctulu.ProgressionInterface; import org.fudaa.ctulu.gui.CtuluFilleWithComponent; +import org.fudaa.ebli.geometrie.GrBoite; import org.fudaa.ebli.impression.EbliFilleImprimable; import org.fudaa.fudaa.commun.FudaaLib; +import org.fudaa.fudaa.commun.save.FilleSaver; +import org.fudaa.fudaa.commun.save.FudaaSavable; +import org.fudaa.fudaa.commun.save.FudaaSaveZipLoader; +import org.fudaa.fudaa.commun.save.FudaaSaveZipWriter; import org.fudaa.fudaa.modeleur.MdlImplementation; import org.fudaa.fudaa.modeleur.modeleur1d.controller.Controller1d; import org.fudaa.fudaa.sig.FSigResource; +import com.db4o.ObjectContainer; +import com.db4o.ObjectSet; +import com.db4o.query.Query; import com.memoire.bu.BuBorderLayout; +import com.memoire.bu.BuCommonImplementation; import com.memoire.bu.BuUndoRedoInterface; +import com.memoire.fu.FuLog; /** * La fenetre interne vue 2D des donn\xE9es du modeleur. Elle construit le composant arbre de @@ -39,17 +53,20 @@ * @version $Id$ */ public class MdlFille1d extends EbliFilleImprimable implements BuUndoRedoInterface, CtuluFilleWithComponent, - CtuluUndoRedoInterface, CtuluExportDataInterface { + CtuluUndoRedoInterface, CtuluExportDataInterface, FudaaSavable { /** Le controller 1d */ private Controller1d controller_; + /** L'implementation */ + private BuCommonImplementation impl_=null; public MdlFille1d(MdlImplementation _appli) { super("", true, false, true, true, _appli, null); + impl_=_appli; + // Configuration de la fen\xEAtre 1d \\ setName("mdlFille1d"); setTitle(FSigResource.FSIG.getString("Vue 1D")); - setPreferredSize(new Dimension(500, 400)); setClosable(true); controller_=new Controller1d(_appli, this); // Construction des vues contenues dans la fen\xEAtre. \\ @@ -57,7 +74,7 @@ add(new JSplitPane(JSplitPane.VERTICAL_SPLIT, controller_.getVueBief(), new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, controller_.getVueTableau(), controller_.getVueCourbe())), BuBorderLayout.CENTER); add(controller_.getVueError(), BuBorderLayout.SOUTH); setPreferredSize(new Dimension(500, 500)); - setSize(getPreferredSize()); + pack(); } /* (non-Javadoc) @@ -126,4 +143,163 @@ public void startExport(CtuluUI _impl) { controller_.export(); } + + /** + * Recupere l'objet de la base stockant les propri\xE9t\xE9s pour cette fenetre. + * @param _db La base. + * @return Les propri\xE9t\xE9s pour la fenetre. + */ + private FilleSaver findDataInDb(final ObjectContainer _db) { + if (_db == null) { + return null; + } + final Query q = _db.query(); + q.constrain(FilleSaver.class); + q.descend("name_").constrain(getName()); + final ObjectSet set = q.execute(); + + FilleSaver saveData=null; + if (set.size() == 1) { + saveData = (FilleSaver) set.next(); + } + return saveData; + } + + /* (non-Javadoc) + * @see org.fudaa.fudaa.commun.save.FudaaSavable#saveIn(com.db4o.ObjectContainer, org.fudaa.ctulu.ProgressionInterface) + */ + public void saveIn(ObjectContainer _db, ProgressionInterface _prog) { + if (_db == null) { + return; + } + FilleSaver saveData=findDataInDb(_db); + if (saveData==null) + saveData = new FilleSaver(); + + saveData.setStandardData(this,impl_.getMainPanel().getDesktop()); + saveData.setSpecificProps(fillSpecificProps()); + _db.set(saveData); + _db.commit(); + } + + /* (non-Javadoc) + * @see org.fudaa.fudaa.commun.save.FudaaSavable#saveIn(org.fudaa.fudaa.commun.save.FudaaSaveZipWriter, org.fudaa.ctulu.ProgressionInterface) + */ + public void saveIn(FudaaSaveZipWriter _writer, ProgressionInterface _prog) { + try { + saveIn(_writer.getDb(), _prog); + } catch (final IOException _evt) { + FuLog.error(_evt); + } + } + + /** + * Restaure la fenetre (donn\xE9es et propri\xE9t\xE9s) depuis le fichier projet. + * @param _loader Le fichier projet. + * @param _prog La progression de la tache. + */ + public void restoreFrom(FudaaSaveZipLoader _loader, ProgressionInterface _prog) { + restoreFrom(_loader.getDb(), _prog); + } + + /** + * Restaure les propri\xE9t\xE9s de la fenetre, depuis la bd contenue dans le fichier projet. + * @param _db La bd. + * @param _prog La progression de la tache. + */ + public void restoreFrom(ObjectContainer _db, ProgressionInterface _prog) { + FilleSaver saveData=findDataInDb(_db); + if (saveData==null) return; + + saveData.restoreStandardData(this,impl_.getMainPanel().getDesktop()); + restoreSpecificProps(saveData.getSpecificProps()); + // Si les propri\xE9t\xE9s restitu\xE9es indiquent que la fenetre est visible, alors elle est ajout\xE9e au desktop. + if (isVisible()) impl_.addInternalFrame(this); + } + + /** + * Remplit le tableau des propri\xE9t\xE9s sp\xE9cifiques de cette fenetre + * @return Les propri\xE9t\xE9s + */ + private Properties fillSpecificProps() { + Properties props=new Properties(); + + // Taille des vues + Dimension vuesize=controller_.getVueBief().getSize(); + props.setProperty("viewBief.width",Integer.toString(vuesize.width)); + props.setProperty("viewBief.height",Integer.toString(vuesize.height)); + vuesize=controller_.getVueTableau().getSize(); + props.setProperty("viewTableau.width",Integer.toString(vuesize.width)); + props.setProperty("viewTableau.height",Integer.toString(vuesize.height)); + + // Viewport du bief + final GrBoite b = controller_.getVueBief().getVueCalque().getViewBoite(); + props.setProperty("viewBief.xmin",Double.toString(b.o_.x_)); + props.setProperty("viewBief.ymin",Double.toString(b.o_.y_)); + props.setProperty("viewBief.xmax",Double.toString(b.e_.x_)); + props.setProperty("viewBief.ymax",Double.toString(b.e_.y_)); + + // Bief selectionne + int idx=controller_.getControllerBief().getBiefSelectionModel().getSelectedBief(); + props.setProperty("selectedBief",Integer.toString(idx)); + + // Profil selectionne + idx=controller_.getControllerProfil().getProfilSelectionModel().getSelectedProfil(); + props.setProperty("selectedProfil",Integer.toString(idx)); + + return props; + } + + /** + * Restaure les propri\xE9t\xE9s sp\xE9cifiques de la fenetre. + * @param _props Les propri\xE9t\xE9s + */ + private void restoreSpecificProps(final Properties _props) { + if (_props==null) return; + + SwingUtilities.invokeLater(new Runnable() { + public void run() { + // Taille des vues + try { + int w=Integer.parseInt(_props.getProperty("viewBief.width")); + int h=Integer.parseInt(_props.getProperty("viewBief.height")); + ((JSplitPane)controller_.getVueBief().getParent()).setDividerLocation(h); + } + catch (NumberFormatException _exc) {} + try { + int w=Integer.parseInt(_props.getProperty("viewTableau.width")); + int h=Integer.parseInt(_props.getProperty("viewTableau.height")); + ((JSplitPane)controller_.getVueTableau().getParent()).setDividerLocation(w); + } + catch (NumberFormatException _exc) {} + + // Viewport du bief + try { + double xmin=Double.parseDouble(_props.getProperty("viewBief.xmin", "null")); + double ymin=Double.parseDouble(_props.getProperty("viewBief.ymin", "null")); + double xmax=Double.parseDouble(_props.getProperty("viewBief.xmax", "null")); + double ymax=Double.parseDouble(_props.getProperty("viewBief.ymax", "null")); + GrBoite bt=new GrBoite(); + bt.ajuste(xmin, ymin, 0); + bt.ajuste(xmax, ymax, 0); + controller_.getVueBief().getVueCalque().changeRepere(this, bt); + } + catch (NumberFormatException _exc) {} + + // Bief selectionne + try { + int idx=Integer.parseInt(_props.getProperty("selectedBief", "-1")); + controller_.getControllerBief().getBiefSelectionModel().setSelectedBief(idx); + } + catch (NumberFormatException _exc) {} + + // Profil selectionne + try { + int idx=Integer.parseInt(_props.getProperty("selectedProfil", "-1")); + controller_.getControllerProfil().getProfilSelectionModel().setSelectedProfil(idx); + } + catch (NumberFormatException _exc) {} + } + }); + } } 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-06 20:21:36 UTC (rev 4328) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/controller/Controller1d.java 2009-01-07 13:34:28 UTC (rev 4329) @@ -155,6 +155,14 @@ return appli_; } + public ControllerBief getControllerBief() { + return controllerBief_; + } + + public ControllerProfil getControllerProfil() { + return controllerProfil_; + } + // Gestion de l'affichage des erreurs. \\ public void showError(String _message){ 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-06 20:21:36 UTC (rev 4328) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/controller/ControllerBief.java 2009-01-07 13:34:28 UTC (rev 4329) @@ -217,6 +217,20 @@ } /** + * Retourne le bief selectionn\xE9. + */ + public int getSelectedBief() { + return getMinSelectionIndex(); + } + + /** + * Selectionne un bief d'indice donn\xE9. + */ + public void setSelectedBief(int _idx) { + setSelectionInterval(_idx,_idx); + } + + /** * Met \xE0 jour dataGeomAdapter_ pour qu'il tienne compte de la nouvelle selection. */ private void updateBief() { Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/controller/ControllerProfil.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/controller/ControllerProfil.java 2009-01-06 20:21:36 UTC (rev 4328) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/controller/ControllerProfil.java 2009-01-07 13:34:28 UTC (rev 4329) @@ -113,6 +113,10 @@ return getMinSelectionIndex(); } + public void setSelectedProfil(int _idx) { + setSelectionInterval(_idx,_idx); + } + public void valueChanged(ListSelectionEvent e) { // Le bief selectionn\xE9 \xE0 chang\xE9. \\ clearSelection(); Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/VueBief.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/VueBief.java 2009-01-06 20:21:36 UTC (rev 4328) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/VueBief.java 2009-01-07 13:34:28 UTC (rev 4329) @@ -53,7 +53,6 @@ public String edit() {return null;} }); setPreferredSize(new Dimension(200, 200)); - setSize(getPreferredSize()); generateCalques(); } Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/VueCourbe.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/VueCourbe.java 2009-01-06 20:21:36 UTC (rev 4328) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/VueCourbe.java 2009-01-07 13:34:28 UTC (rev 4329) @@ -363,7 +363,6 @@ add(containerCourbe_, BuBorderLayout.CENTER); setPreferredSize(new Dimension(200, 200)); - setSize(getPreferredSize()); } /** Ajout un listener \xE0 la selection dans le tableau. */ Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/VueTableau.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/VueTableau.java 2009-01-06 20:21:36 UTC (rev 4328) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/VueTableau.java 2009-01-07 13:34:28 UTC (rev 4329) @@ -138,7 +138,6 @@ add(absCurv, BuBorderLayout.SOUTH); // Taille setPreferredSize(new Dimension(200, 200)); - setSize(getPreferredSize()); } /** Ajout un listener \xE0 la selection dans le tableau. */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <had...@us...> - 2009-01-06 20:21:37
|
Revision: 4328 http://fudaa.svn.sourceforge.net/fudaa/?rev=4328&view=rev Author: hadouxad Date: 2009-01-06 20:21:36 +0000 (Tue, 06 Jan 2009) Log Message: ----------- corrections/ameliorations Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeAddVariableAction.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeBuilder.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeTreeModel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSource.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostTrajectoireLineLayer.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostVisuPanelPersistManager.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/actions/TrPostActionFusionCalques.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/persist/TrPostPersistenceManager.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/persist/TrPostSourcePersist.java Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeAddVariableAction.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeAddVariableAction.java 2009-01-06 20:18:57 UTC (rev 4327) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeAddVariableAction.java 2009-01-06 20:21:36 UTC (rev 4328) @@ -39,10 +39,10 @@ //TODO a modifier class TrPostCourbeAddVariableAction extends EbliActionSimple { - final FudaaCommonImplementation impl_; + final TrPostCommonImplementation impl_; final EGGraphe model_; - public TrPostCourbeAddVariableAction(final FudaaCommonImplementation _impl, final EGGraphe _model) { + public TrPostCourbeAddVariableAction(final TrPostCommonImplementation _impl, final EGGraphe _model) { super(CtuluLib.getS("Ajouter des variables"), BuResource.BU.getToolIcon("ajouter"), "ADD_VARIALBES"); impl_ = _impl; model_ = _model; @@ -61,18 +61,56 @@ return null; } + + public static int selectSource(final Object[] _init, final String _title, final Component _parent) { + Arrays.sort(_init, FuComparator.STRING_COMPARATOR); + final BuList l = CtuluLibSwing.createBuList(_init); + final CtuluDialogPanel pn = new CtuluDialogPanel(false); + pn.setLayout(new BuBorderLayout()); + pn.setBorder(BuBorders.EMPTY3333); + pn.add(new BuLabel(CtuluLib.getS("S\xE9lectionner le fichier r\xE9sultat")), BuBorderLayout.NORTH); + pn.add(new BuScrollPane(l)); + if (CtuluDialogPanel.isOkResponse(pn.afficheModale(_parent, _title))) { return l.getSelectedIndex(); } + return -1; + } + @Override public void actionPerformed(final ActionEvent _e) { final TrPostCourbeTreeModel model = (TrPostCourbeTreeModel) model_.getModel(); - final EGCourbe selectedComponent = model_.getSelectedComponent(); + //final EGCourbe selectedComponent = model_.getSelectedComponent(); + // final EGCourbe selectedComponent = model_.getModel().getCourbes()[0]; TrPostSource src = null; - if (selectedComponent != null && selectedComponent.getModel() instanceof TrPostCourbeModel) { - src = ((TrPostCourbeModel) selectedComponent.getModel()).getSource(); - } +// if (selectedComponent != null && selectedComponent.getModel() instanceof TrPostCourbeModel) { +// src = ((TrPostCourbeModel) selectedComponent.getModel()).getSource(); +// } + + + //-- creation d'un lister de fichier source --// + final String[] values = impl_.c_.formattageDonnees(false); + + final int selectedSource = selectSource(values, (String) getValue(Action.NAME), impl_.getFrame()); + if(selectedSource !=-1) + src=impl_.c_.getSource(selectedSource); + + if (src == null) return; final TrPostSource finalSrc = src; + + + final Set var = new HashSet(Arrays.asList(src.getAllVariablesNonVec())); + if(model.varSupported_!=null) var.removeAll(model.varSupported_); + + + if(model.objIdx_==null){ + model.objIdx_=new int[src.getTime().getNbTimeStep()]; + for(int i=0;i<src.getTime().getNbTimeStep();i++) + model.objIdx_[i]=i; + } + if(model.intepolPt_==null) + model.intepolPt_ = new HashSet(); + final H2dVariableType[] vars = (H2dVariableType[]) var.toArray(new H2dVariableType[var.size()]); final Object[] selected = select(vars, (String) getValue(Action.NAME), impl_.getFrame()); if (!CtuluLibArray.isEmpty(selected)) { Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeBuilder.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeBuilder.java 2009-01-06 20:18:57 UTC (rev 4327) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeBuilder.java 2009-01-06 20:21:36 UTC (rev 4328) @@ -123,7 +123,7 @@ } - public static EbliActionInterface[] getSpecActions(final EGGraphe _g, final FudaaCommonImplementation _impl, + public static EbliActionInterface[] getSpecActions(final EGGraphe _g, final TrPostCommonImplementation _impl, final TrPostVisuPanel _vue2d) { return new EbliActionInterface[] { new TrPostCourbeAddVariableAction(_impl, _g), new TrPostCourbeRemoveVariableAction(_impl, _g), new TrPostCourbeAddPointsAction(_impl, _g, _vue2d) }; Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeTreeModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeTreeModel.java 2009-01-06 20:18:57 UTC (rev 4327) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeTreeModel.java 2009-01-06 20:21:36 UTC (rev 4328) @@ -332,7 +332,19 @@ protected void addVariables(final TrPostSource _src, final List _var, final ProgressionInterface _prog, final CtuluCommandContainer _cmd) { // buildTimeSteps(); + + + //-- Attention cas particulier, il faut conserver le groupe sans variable pour le rajouter a la fin --// +// EGGroup groupeSansVariables =null; +// if(existGroupFor(H2dVariableType.SANS)) +// groupeSansVariables=getGroupFor(H2dVariableType.SANS); + startUpdating(); + + if(varSupported_==null) + varSupported_= new HashSet(); + + // fusion graphes _var.removeAll(varSupported_); final int nbPt = objIdx_.length; @@ -391,6 +403,13 @@ _cmd.addCmd(cmp); } + + + //-- on ajoute de le groupe sans variable si il existait avant les modif: --// +// if(groupeSansVariables!=null){ +// add(groupeSansVariables); +// fireStructureChanged(); +// } } @@ -637,6 +656,20 @@ return group; } + public boolean existGroupFor(final H2dVariableType _t) { + if (_t == null) { return false; } + H2dVariableType parent = _t.getParentVariable(); + if (parent == null) { + parent = _t; + } + EGGroup group = (EGGroup) varGroup_.get(parent); + if (group == null) { + return false; + } + return true; + } + + public Set getIntepolPt() { return intepolPt_; } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSource.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSource.java 2009-01-06 20:18:57 UTC (rev 4327) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSource.java 2009-01-06 20:21:36 UTC (rev 4328) @@ -301,6 +301,9 @@ void updateUserValue(final H2dVariableTypeCreated _old, final H2dVariableTypeCreated _new, final TrPostDataCreated _newData, final CtuluCommandContainer _cmd); + + + /** * @param _analyze permet d'initialise la base temporaire. */ Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostTrajectoireLineLayer.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostTrajectoireLineLayer.java 2009-01-06 20:18:57 UTC (rev 4327) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostTrajectoireLineLayer.java 2009-01-06 20:21:36 UTC (rev 4328) @@ -159,6 +159,8 @@ } protected String getSelectedAttributeName() { + if(attSelectionModel_.getMaxSelectionIndex()==-1) + return ""; return attList_.get(attSelectionModel_.getMaxSelectionIndex()).getName(); } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostVisuPanelPersistManager.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostVisuPanelPersistManager.java 2009-01-06 20:18:57 UTC (rev 4327) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostVisuPanelPersistManager.java 2009-01-06 20:21:36 UTC (rev 4328) @@ -5,6 +5,7 @@ import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; +import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -39,7 +40,7 @@ boolean simplified; String idSource; GrBoite zoom_; - + TrPostVisuPanelPersistManager() { } @@ -108,6 +109,14 @@ TrPostVisuPanel newPanel = new TrPostVisuPanel(projet.getImpl(), projet, legendeCalque, src); + + //-- on verifie si il faut charger les donnees zippees ou laisser tout se recalculer --// + final List<String> listeReloadSource=(List<String>) parameters.get("RELOAD"); + + + if(listeReloadSource!=null && listeReloadSource.contains(idSource)){ + + }else{ // -- restorer les donn\xE9es --// FudaaSaveZipLoader loader = null; try { @@ -119,7 +128,7 @@ } finally { if (loader != null) loader.safeClose(); } - + } // -- restoration du zoom --// // if(zoom_!=null) // newPanel.getVueCalque().changeRepere(newPanel, zoom_); Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/actions/TrPostActionFusionCalques.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/actions/TrPostActionFusionCalques.java 2009-01-06 20:18:57 UTC (rev 4327) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/actions/TrPostActionFusionCalques.java 2009-01-06 20:21:36 UTC (rev 4328) @@ -209,7 +209,7 @@ /** * Methode qui: merge le calque choisi dans la combo avec el ndoe actuel degage le node choisi de la scene remet a - * jour al combo actuelle + * jour la combo actuelle */ private void mergeCalques() { @@ -225,11 +225,23 @@ // --Ajout du noeud --// listeToMerge.add(nodeToMerge); + + + if(((EbliWidgetVueCalque)nodeToMerge.getWidget().getIntern()).getCalqueController().hasLegende() ){ + EbliNode nodeLegende=((EbliWidgetVueCalque)nodeToMerge.getWidget().getIntern()).nodeLegende; + EbliScene scene=nodeToMerge.getWidget().getEbliScene(); + scene.removeNode(nodeLegende); + scene.refresh(); + + } } // -- ajout du node initial --// listeToMerge.add(nodeCalque_); + + + // --ajout de la courbe au widget de base --// // new CtuluTaskOperationGUI(projet_.impl_, TrResource.getS("Fusion avec un autre calque")) { // Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/persist/TrPostPersistenceManager.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/persist/TrPostPersistenceManager.java 2009-01-06 20:18:57 UTC (rev 4327) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/persist/TrPostPersistenceManager.java 2009-01-06 20:21:36 UTC (rev 4328) @@ -603,7 +603,7 @@ * @throws IOException * @throws ClassNotFoundException */ - public boolean loadSource(final File file) { + public boolean loadSource(final File file, final HashMap<String, Object> parametres) { boolean reussite=true; // -- outputstream du xstream --// @@ -626,7 +626,14 @@ //-- lecture de la liste des objets source perssitant --// final List<TrPostSourcePersist> listeCouplesIdSources = (List<TrPostSourcePersist>) in.readObject(); + //-- liste qui contient l'ensemble des fichiers \xE0 recharger pour les vues 2d et vues 1d + final List<String> listeReloadSource=new ArrayList<String>(); + parametres.put("RELOAD", listeReloadSource); for (int i = 0; i < nbSources; i++) { + + + if(listeCouplesIdSources.get(i).rechargerLesLiens) + listeReloadSource.add(listeCouplesIdSources.get(i).IdSource); // -- tentative de lecture du path relatif --// String path = CtuluLibFile.getAbsolutePathnameTo(projet_, new File(listeCouplesIdSources.get(i).pathRelatifSource)).getPath(); @@ -656,7 +663,7 @@ trprojet_.getImpl().warn(TrLib.getString("Solution d\xE9j\xE0 charg\xE9e"), TrLib.getString("Le fichier source existe d\xE9j\xE0 et ne peut \xEAtre ajout\xE9 au projet.")); - //--ACHTUNG !!! --// + //--ACHTUNG !!! --// //-- mise a jour de l'ID necessaire afin de charger correctement la suite --// trprojet_.findSource(path).setId(listeCouplesIdSources.get(i).IdSource); } else { @@ -930,7 +937,10 @@ managerError.clear(); //-- on elimine les doublons potentiels des frames layouts --// ui_.elimineDoublonNomsLayout(); - + + // -- creation des params pour les datas --// + final HashMap<String, Object> parametres = new HashMap<String, Object>(); + progression("Lecture du r\xE9pertoire", 10); // -- etape 1 lecture du repertoire global ou du fichier param --// @@ -947,7 +957,7 @@ // -- etape 2 sauvegarde du fichier contenant tous les sources ouverts progression("Chargement du fichier descripteur de sources", 15); file = new File(projet_.getAbsolutePath() + File.separator + setupProject); - if(! loadSource(file)){ + if(! loadSource(file,parametres)){ managerError.addMessageError("Veuillez corriger les chemins des fichiers r\xE9sultats dans le fichier setup et r\xE9it\xE9rez l'op\xE9ration."); managerError.showDialog(ui_); return false; @@ -963,8 +973,7 @@ // -- etape 4 chargement des ebliscene unitairement --// progression("Cr\xE9ation des fichiers layout", 40); - // -- creation des params pour les datas --// - final HashMap<String, Object> parametres = new HashMap<String, Object>(); + parametres.put("path", projet_.getAbsolutePath()); parametres.put("ui", ui_); parametres.put("TrPostProjet", trprojet_); Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/persist/TrPostSourcePersist.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/persist/TrPostSourcePersist.java 2009-01-06 20:18:57 UTC (rev 4327) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/persist/TrPostSourcePersist.java 2009-01-06 20:21:36 UTC (rev 4328) @@ -22,6 +22,7 @@ String IdSource; String pathSource; String pathRelatifSource; + boolean rechargerLesLiens=false; public TrPostSourcePersist(){} /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <had...@us...> - 2009-01-06 20:18:59
|
Revision: 4327 http://fudaa.svn.sourceforge.net/fudaa/?rev=4327&view=rev Author: hadouxad Date: 2009-01-06 20:18:57 +0000 (Tue, 06 Jan 2009) Log Message: ----------- corrections/ameliorations Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGFillePanel.java Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGFillePanel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGFillePanel.java 2009-01-06 18:07:57 UTC (rev 4326) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGFillePanel.java 2009-01-06 20:18:57 UTC (rev 4327) @@ -229,7 +229,7 @@ } // en dernier - if (getModel().canAddCourbe()) { + if (getModel().canAddCourbe()){ r.add(null); final EbliActionSimple addAction = new EbliActionSimple(EbliLib.getS("Ajouter une courbe"), BuResource.BU .getToolIcon("creer"), "NEW_CURVE") { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <emm...@us...> - 2009-01-06 18:07:59
|
Revision: 4326 http://fudaa.svn.sourceforge.net/fudaa/?rev=4326&view=rev Author: emmanuel_martin Date: 2009-01-06 18:07:57 +0000 (Tue, 06 Jan 2009) Log Message: ----------- modeleur 1d : Les intersections sont d?\195?\169placables, les modifications des gis de rives et de limites de stockages sont r?\195?\169percut?\195?\169es dans le 2d ; plus divers autres trucs Modified Paths: -------------- branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/collection/CtuluCollectionObjectAbstract.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISAttributeConstants.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZModeleLigneBriseeEditable.java 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/controller/ControllerProfil.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/UtilsProfil1d.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/VueTableau.java Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/collection/CtuluCollectionObjectAbstract.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/collection/CtuluCollectionObjectAbstract.java 2009-01-06 18:04:41 UTC (rev 4325) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/collection/CtuluCollectionObjectAbstract.java 2009-01-06 18:07:57 UTC (rev 4326) @@ -186,9 +186,8 @@ */ public final boolean set(final int _i, final Object _newObj, final CtuluCommandContainer _c) { // verif basique - if (_i < 0 || _i > getSize() || getValueAt(_i) == _newObj) { + if (_i < 0 || _i >= getSize() || getValueAt(_i) == _newObj) return false; - } final Object old = getValueAt(_i); internalSet(_i, _newObj); fireObjectChanged(_i, _newObj); Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISAttributeConstants.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISAttributeConstants.java 2009-01-06 18:04:41 UTC (rev 4325) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISAttributeConstants.java 2009-01-06 18:07:57 UTC (rev 4326) @@ -266,12 +266,12 @@ } // Attributs 1D \\ - + /** - * Attribut contenant la coordonn\xE9e de l'intersection entre une rive gauche et - * un profil. La donn\xE9e sauvgard\xE9e est une coordonn\xE9e (Coordinate). + * Attribut contenant l'index du point correspondant \xE0 l'intersection entre + * une rive gauche et un profil. */ - public final static GISAttribute INTERSECTION_RIVE_GAUCHE=new GISAttribute(null, CtuluLib.getS("Intersection rive gauche"), false){ + public final static GISAttributeInteger INTERSECTION_RIVE_GAUCHE=new GISAttributeInteger(CtuluLib.getS("Intersection rive gauche"), false){ @Override public String getID() { return "ATTRIBUTE_INTERSECTION_RIVE_GAUCHE"; @@ -279,10 +279,10 @@ }; /** - * Attribut contenant la coordonn\xE9e de l'intersection entre une rive droite et - * un profil. La donn\xE9e sauvgard\xE9e est une coordonn\xE9e (Coordinate). + * Attribut contenant l'index du point correspondant \xE0 l'intersection entre + * une rive droite et un profil. */ - public final static GISAttribute INTERSECTION_RIVE_DROITE=new GISAttribute(null, CtuluLib.getS("Intersection rive droite"), false){ + public final static GISAttributeInteger INTERSECTION_RIVE_DROITE=new GISAttributeInteger(CtuluLib.getS("Intersection rive droite"), false){ @Override public String getID() { return "ATTRIBUTE_INTERSECTION_RIVE_DROITE"; @@ -290,11 +290,10 @@ }; /** - * Attribut contenant la coordonn\xE9e de l'intersection entre une limite de - * stockage gauche et un profil. La donn\xE9e sauvgard\xE9e est une coordonn\xE9e - * (Coordinate). + * Attribut contenant l'index du point correspondant \xE0 l'intersection entre + * une limite de stockage gauche et un profil. */ - public final static GISAttribute INTERSECTION_LIMITE_STOCKAGE_GAUCHE=new GISAttribute(null, CtuluLib + public final static GISAttributeInteger INTERSECTION_LIMITE_STOCKAGE_GAUCHE=new GISAttributeInteger(CtuluLib .getS("Intersection limite stockage gauche"), false){ @Override public String getID() { @@ -303,11 +302,10 @@ }; /** - * Attribut contenant la coordonn\xE9e de l'intersection entre une limite de - * stockage droite et un profil. La donn\xE9e sauvgard\xE9e est une coordonn\xE9e - * (Coordinate). + * Attribut contenant l'index du point correspondant \xE0 l'intersection entre + * une limite de stockage droite et un profil. */ - public final static GISAttribute INTERSECTION_LIMITE_STOCKAGE_DROITE=new GISAttribute(null, CtuluLib + public final static GISAttributeInteger INTERSECTION_LIMITE_STOCKAGE_DROITE=new GISAttributeInteger(CtuluLib .getS("Intersection limite stockage droite"), false){ @Override public String getID() { Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZModeleLigneBriseeEditable.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZModeleLigneBriseeEditable.java 2009-01-06 18:04:41 UTC (rev 4325) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZModeleLigneBriseeEditable.java 2009-01-06 18:07:57 UTC (rev 4326) @@ -564,7 +564,7 @@ if (zAtt!=null) { if (getGeomData().getModel(zAtt)!=null) { Object oldvalue=getGeomData().getModel(zAtt).getObjectValueAt(i); - Object newvalue=zAtt.createDataForGeom(oldvalue, geometries_.getGeometry(i).getNumPoints()); + Object newvalue=zAtt.createDataForGeom(oldvalue, getGeomData().getGeometry(i).getNumPoints()); if (oldvalue instanceof GISAttributeModelDoubleArray) { GISAttributeModelDoubleArray newvals=(GISAttributeModelDoubleArray)newvalue; GISAttributeModelDoubleArray oldvals=(GISAttributeModelDoubleArray)oldvalue; 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-06 18:04:41 UTC (rev 4325) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/controller/Controller1d.java 2009-01-06 18:07:57 UTC (rev 4326) @@ -67,7 +67,7 @@ /** La vue d'un profil via une courbe. */ private VueCourbe vueCourbe_; /** Un label pour afficher les erreurs. */ - private BuLabel vueError_; + private BuLabel vueError_=new BuLabel(); /** La vue des modules contenu dans la colonne \xE0 droite. */ private VueContainerModules vueContainerModules_; /** La frame contenant tous les widgets 1d. */ @@ -118,7 +118,6 @@ vueCourbe_=new VueCourbe(this, controllerProfil_.getDataGeometry()); vueCourbe_.addSelectionListener(this); // Vue error - vueError_=new BuLabel(); vueError_.setForeground(Color.RED); vueError_.setHorizontalAlignment(JLabel.CENTER); clearError(); @@ -346,7 +345,15 @@ @Override public void internalFrameActivated(InternalFrameEvent e) { - mng_.clean(); controllerBief_.updateFrom2d(); } + + /* (non-Javadoc) + * @see javax.swing.event.InternalFrameAdapter#internalFrameDeactivated(javax.swing.event.InternalFrameEvent) + */ + @Override + public void internalFrameDeactivated(InternalFrameEvent e) { + mng_.clean(); + controllerBief_.disableSynchronisers(); + } } 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-06 18:04:41 UTC (rev 4325) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/controller/ControllerBief.java 2009-01-06 18:07:57 UTC (rev 4326) @@ -61,6 +61,15 @@ } /** + * D\xE9sactive tous les synchroniseurs. + */ + public void disableSynchronisers() { + String[] names=biefSet_.getBiefNames(); + for(int i=0;i<names.length;i++) + biefSet_.getBief(names[i]).enableSynchroniser(false); + } + + /** * Importe les biefs du 2d vers le 1d. */ private void importBiefsFrom2d(BCalque _rootCalque) { Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/controller/ControllerProfil.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/controller/ControllerProfil.java 2009-01-06 18:04:41 UTC (rev 4325) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/controller/ControllerProfil.java 2009-01-06 18:07:57 UTC (rev 4326) @@ -21,7 +21,7 @@ /** * Controller permettant de g\xE9rer (cr\xE9er, modifier, supprimer, selectionner) les profils. * @author Emmanuel MARTIN - * @version $Id:$ + * @version $Id$ */ public class ControllerProfil { @@ -122,11 +122,12 @@ * Met \xE0 jour dataGeomAdapter_ pour qu'il tienne compte de la nouvelle selection. */ private void updateProfil() { + controller1d_.clearError(); try { profilContainerAdapter_.setSelectedProfil(getMinSelectionIndex()); } catch (ProfilContainerException _exc) { - _exc.printStackTrace(); + controller1d_.showError(_exc.getMessage()); } } 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-06 18:04:41 UTC (rev 4325) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/Bief.java 2009-01-06 18:07:57 UTC (rev 4326) @@ -7,8 +7,10 @@ */ package org.fudaa.fudaa.modeleur.modeleur1d.model; +import java.util.ArrayList; import java.util.Arrays; import java.util.Comparator; +import java.util.List; import org.fudaa.ctulu.gis.GISAttributeConstants; import org.fudaa.ctulu.gis.GISAttributeInterface; @@ -16,8 +18,11 @@ import org.fudaa.ctulu.gis.GISCoordinateSequenceFactory; import org.fudaa.ctulu.gis.GISPolyligne; import org.fudaa.ctulu.gis.GISZoneCollection; +import org.fudaa.ctulu.gis.GISZoneCollectionGeometry; import org.fudaa.ctulu.gis.GISZoneCollectionLigneBrisee; +import org.fudaa.ebli.calque.ZModelGeometryListener; import org.fudaa.ebli.calque.ZModeleLigneBrisee; +import org.fudaa.ebli.calque.edition.ZModeleLigneBriseeEditable; import org.fudaa.fudaa.modeleur.layer.MdlModel1dAxe; import org.fudaa.fudaa.modeleur.layer.MdlModel1dBank; import org.fudaa.fudaa.modeleur.layer.MdlModel2dConstraintLine; @@ -40,6 +45,9 @@ public ZModeleLigneBrisee limitesStockages_; public ZModeleLigneBrisee lignesDirectrices_; + /** Le synchroniser de gis. */ + private GisZoneSynchroniser gisSynchroniser_=new GisZoneSynchroniser(); + public Bief(){} public Bief(ZModeleLigneBrisee[] _models){ @@ -214,58 +222,81 @@ seqProfil=((GISCoordinateSequenceContainerInterface)profil).getCoordinateSequence(); } double abscisseCurvIntersectionAxe=UtilsProfil1d.abscisseCurviligne(seqProfil, interAxeProfil); - // D\xE9tection des croisements rives gauches et rives droites \\ - // valeur par defaut - zone.setAttributValue(idxAttRiveGauche, k, seqProfil.getCoordinate(0), null); - zone.setAttributValue(idxAttRiveDroite, k, seqProfil.getCoordinate(seqProfil.size()-1), null); - for (int l=0; l<rives_.getNombre(); l++) { - Geometry inter=((Geometry)rives_.getObject(l)).intersection(profil); - if (inter.getNumPoints()>0) - if (abscisseCurvIntersectionAxe>UtilsProfil1d.abscisseCurviligne(seqProfil, inter.getCoordinate())) - zone.setAttributValue(idxAttRiveGauche, k, inter.getCoordinate(), null); - else - zone.setAttributValue(idxAttRiveDroite, k, inter.getCoordinate(), null); - } - // D\xE9tection des croisements zones de stockage droite et gauche \\ - // Valeur par defaut - zone.setAttributValue(idxAttlsGauche, k, seqProfil.getCoordinate(0), null); - zone.setAttributValue(idxAttlsDroite, k, seqProfil.getCoordinate(seqProfil.size()-1), null); - for (int l=0; l<limitesStockages_.getNombre(); l++) { - Geometry inter=((Geometry)limitesStockages_.getObject(l)).intersection(profil); - if (inter.getNumPoints()>0) - if (abscisseCurvIntersectionAxe>UtilsProfil1d.abscisseCurviligne(seqProfil, inter.getCoordinate())) - zone.setAttributValue(idxAttlsGauche, k, inter.getCoordinate(), null); - else - zone.setAttributValue(idxAttlsDroite, k, inter.getCoordinate(), null); - } + // Ajout des points au profil si n\xE9c\xE9ssaire pour les intersections \\ + // 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)); + profil=(Geometry)profils_.getGeomData().getGeometry(k); + seqProfil=((GISCoordinateSequenceContainerInterface)profil).getCoordinateSequence(); + // Valuation des attributs avec les index des points des intersections \\ + // Rives + zone.setAttributValue(idxAttRiveGauche, k, seqProfil.size()-1, null); + zone.setAttributValue(idxAttRiveDroite, k, 0, 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, seqProfil.size()-1, null); + zone.setAttributValue(idxAttlsDroite, k, 0, null); + for (int l=0; l<limitesStockages_.getNombre(); l++) + valuateProfilIntersection(k, (Geometry) limitesStockages_.getObject(l), idxAttlsGauche, idxAttlsDroite, abscisseCurvIntersectionAxe); } } - // Simplification des rives \\ - rives_=new MdlModel1dBank(null, null); - Coordinate[] riveGauche=new Coordinate[profils_.getNombre()]; - Coordinate[] riveDroite=new Coordinate[profils_.getNombre()]; - for (int i=0; i<profils_.getNombre(); i++) { - riveGauche[i]=(Coordinate)zone.getValue(idxAttRiveGauche, i); - riveDroite[i]=(Coordinate)zone.getValue(idxAttRiveDroite, i); + // Suppression des anciennes g\xE9om\xE9tries de rives, limites de stockage et lignes directrices \\ + int[] idxRives=new int[rives_.getNombre()]; + for(int i=0;i<rives_.getNombre();i++) + idxRives[i]=i; + ((ZModeleLigneBriseeEditable) rives_).removeLigneBrisee(idxRives, null); + int[] idxLimiteStockage=new int[limitesStockages_.getNombre()]; + for(int i=0;i<limitesStockages_.getNombre();i++) + idxLimiteStockage[i]=i; + limitesStockages_.getGeomData().removeGeometries(idxLimiteStockage, null); + // Activation du synchroniser + gisSynchroniser_.enable(); + } + + /** + * Valuation des attributs *gauche et *droite des profils. + * + * @param _idxProfil l'index du profil concern\xE9. + * @param _ligne la ligne qui est sens\xE9 crois\xE9 le profil. + * @param _idxAttrGauche l'index de l'attribut gauche o\xF9 sera mit l'information en cas de croisement \xE0 gauche. + * @param _idxAttrDroite l'index de l'attribut gauche o\xF9 sera mit l'information en cas de croisement \xE0 droite. + * @param _absCurvAxeHydrau la valeur de l'abscisse curviligne de l'axe hydrau sur le profil. + */ + private void valuateProfilIntersection(int _idxProfil, Geometry _ligne, int _idxAttrGauche, int _idxAttrDroite, + double _absCurvAxeHydrau) { + Geometry inter=_ligne.intersection((Geometry)profils_.getObject(_idxProfil)); + if (inter.getNumPoints()==1) { + Coordinate coord= inter.getCoordinate(); + int idxIntersection=UtilsProfil1d.getIndex(profils_.getGeomData().getCoordinateSequence(_idxProfil), coord); + if (_absCurvAxeHydrau>UtilsProfil1d.abscisseCurviligne(profils_.getGeomData().getCoordinateSequence(_idxProfil), coord)) + profils_.getGeomData().setAttributValue(_idxAttrDroite, _idxProfil, idxIntersection, null); + else + profils_.getGeomData().setAttributValue(_idxAttrGauche, _idxProfil, idxIntersection, null); } - if (riveGauche.length>1&&riveGauche[0]!=null) - rives_.getGeomData().addGeometry(new GISPolyligne(new GISCoordinateSequenceFactory().create(riveGauche)), null, null); - if (riveDroite.length>1&&riveDroite[0]!=null) - rives_.getGeomData().addGeometry(new GISPolyligne(new GISCoordinateSequenceFactory().create(riveDroite)), null, null); - // Simplification des zones de stockages \\ - limitesStockages_=new MdlModel2dConstraintLine(null, null); - Coordinate[] lsGauche=new Coordinate[profils_.getNombre()]; - Coordinate[] lsDroite=new Coordinate[profils_.getNombre()]; - for (int i=0; i<profils_.getNombre(); i++) { - lsGauche[i]=(Coordinate)zone.getValue(idxAttlsGauche, i); - lsDroite[i]=(Coordinate)zone.getValue(idxAttlsDroite, i); + } + + /** + * Cr\xE9e un point \xE0 l'intersection du profil indiqu\xE9 par _idxProfil et de + * _ligne. + */ + private void createPointIfNeeded(int _idxProfil, GISPolyligne _ligne) { + Geometry inter=_ligne.intersection((Geometry)profils_.getObject(_idxProfil)); + CoordinateSequence seq=profils_.getGeomData().getCoordinateSequence(_idxProfil); + if (inter.getNumPoints()==1) { + Coordinate coord=inter.getCoordinate(); + int previousIdx=UtilsProfil1d.getPreviousIndex(seq, coord); + int nextIdx=UtilsProfil1d.getNextIndex(seq, coord); + // Le point n'appartient pas au profil ou La coordonn\xE9e correspond d\xE9j\xE0 \xE0 un point + if (previousIdx==-2||nextIdx==-2||previousIdx+1==nextIdx-1||previousIdx==seq.size()-2&&nextIdx==-1||previousIdx==-1&&nextIdx==1) + return; + // La coordonn\xE9e correspond \xE0 aucun point connu + ((GISZoneCollectionGeometry)profils_.getGeomData()).addAtomic(_idxProfil, previousIdx, coord.x, coord.y, null); } - if (lsGauche.length>0&&lsGauche[0]!=null) - limitesStockages_.getGeomData() - .addGeometry(new GISPolyligne(new GISCoordinateSequenceFactory().create(lsGauche)), null, null); - if (lsDroite.length>0&&lsDroite[0]!=null) - limitesStockages_.getGeomData() - .addGeometry(new GISPolyligne(new GISCoordinateSequenceFactory().create(lsDroite)), null, null); } /** @@ -309,5 +340,212 @@ // Tout est ok return true; } + + /** + * Active ou d\xE9active la synchronisation des gis. (G\xE9n\xE9ration et r\xE9g\xE9n\xE9ration + * des g\xE9om\xE9tries volatiles du type rives, limites et lignes directrices). + */ + public void enableSynchroniser(boolean _bool) { + if(_bool) + gisSynchroniser_.enable(); + else + gisSynchroniser_.disable(); + } + + /** + * Indique au synchroniser que les models du bief ont potentiellement chang\xE9. + * L'appelle \xE0 cette m\xE9thode active automatiquement le synchroniser. + * Note : + * Une fois activ\xE9 le synchroniser met automatiquement \xE0 jour les gis. Cette + * m\xE9thode n'est utile que si les instances des models ont \xE9t\xE9 manuellement + * chang\xE9, auquel cas le synchroniser continuea sa synchronisation sur les + * anciens models. + */ + public void updateSynchroniser() { + gisSynchroniser_.enable(); + } + /** + * Cette classe g\xE8re la g\xE9n\xE9ration et r\xE9g\xE9n\xE9ration des g\xE9om\xE9tries volatiles + * (comme les rives, les limites de stockages et des lignes directrices). + */ + protected class GisZoneSynchroniser implements ZModelGeometryListener { + /** Le model de profil \xE9cout\xE9. */ + private ZModeleLigneBrisee profilsListen_; + /** Le model de rives modifi\xE9. */ + private ZModeleLigneBrisee rivesModified_; + /** Le model de limites de stockages modifi\xE9. */ + private ZModeleLigneBrisee limitesStockagsesModified_; + /** Le model de lignes directrices modifi\xE9. */ + private ZModeleLigneBrisee lignesDirectricesModified_; + // Les index des g\xE9om\xE9tries. \\ + private int idxRiveGauche_=-1; + private int idxRiveDroite_=-1; + private int idxLimiteStockageGauche_=-1; + private int idxLimiteStockageDroite_=-1; + private List<Integer> idxLignesDirectrices_=new ArrayList<Integer>(); + // Les index des attributs \\ + private int idxAttRiveGauche_=-1; + private int idxAttRiveDroite_=-1; + private int idxAttlsGauche_=-1; + private int idxAttlsDroite_=-1; + // TODO lignes directrices + + /** + * Active/met \xE0 jour le synchroniser. + */ + public void enable() { + if(profilsListen_!=null&&profilsListen_!=profils_) + profilsListen_.removeModelListener(this); + if(profils_!=null) { + profils_.addModelListener(this); + profilsListen_=profils_; + rivesModified_=rives_; + limitesStockagsesModified_=limitesStockages_; + lignesDirectricesModified_=lignesDirectrices_; + idxAttRiveGauche_=profilsListen_.getGeomData().getIndiceOf(GISAttributeConstants.INTERSECTION_RIVE_GAUCHE); + idxAttRiveDroite_=profilsListen_.getGeomData().getIndiceOf(GISAttributeConstants.INTERSECTION_RIVE_DROITE); + idxAttlsGauche_=profilsListen_.getGeomData().getIndiceOf(GISAttributeConstants.INTERSECTION_LIMITE_STOCKAGE_GAUCHE); + idxAttlsDroite_=profilsListen_.getGeomData().getIndiceOf(GISAttributeConstants.INTERSECTION_LIMITE_STOCKAGE_DROITE); + // TODO lignes directrices + } + regenerateAll(); + } + + /** + * D\xE9active le synchroniser. + */ + public void disable() { + if(profilsListen_!=null) { + profilsListen_.removeModelListener(this); + profilsListen_=null; + rivesModified_=null; + limitesStockagsesModified_=null; + lignesDirectricesModified_=null; + idxRiveGauche_=-1; + idxRiveDroite_=-1; + idxLimiteStockageGauche_=-1; + idxLimiteStockageDroite_=-1; + idxLignesDirectrices_.clear(); + idxAttRiveGauche_=-1; + idxAttRiveDroite_=-1; + idxAttlsGauche_=-1; + idxAttlsDroite_=-1; + // TODO lignes directrices + } + } + + public void attributeAction(Object _source, int att, GISAttributeInterface _att, int _action) {} + + public void attributeValueChangeAction(Object _source, int att, GISAttributeInterface _att, int _idxGeom, Object value) { + if(_att==GISAttributeConstants.INTERSECTION_RIVE_GAUCHE) + updateGeom(_idxGeom, rivesModified_, idxRiveGauche_, idxAttRiveGauche_); + else if(_att==GISAttributeConstants.INTERSECTION_RIVE_DROITE) + updateGeom(_idxGeom, rivesModified_, idxRiveDroite_, idxAttRiveDroite_); + else if(_att==GISAttributeConstants.INTERSECTION_LIMITE_STOCKAGE_GAUCHE) + updateGeom(_idxGeom, limitesStockagsesModified_, idxLimiteStockageGauche_, idxAttlsGauche_); + else if(_att==GISAttributeConstants.INTERSECTION_LIMITE_STOCKAGE_DROITE) + updateGeom(_idxGeom, limitesStockagsesModified_, idxLimiteStockageDroite_, idxAttlsDroite_); + // TODO lignes directrices + } + + public void geometryAction(Object _source, int _idxGeom, Geometry _geom, int _action) { + if(_action==ZModelGeometryListener.GEOMETRY_ACTION_MODIFY) { + updateGeom(_idxGeom, rivesModified_, idxRiveGauche_, idxAttRiveGauche_); + updateGeom(_idxGeom, rivesModified_, idxRiveDroite_, idxAttRiveDroite_); + updateGeom(_idxGeom, limitesStockagsesModified_, idxLimiteStockageGauche_, idxAttlsGauche_); + updateGeom(_idxGeom, limitesStockagsesModified_, idxLimiteStockageDroite_, idxAttlsDroite_); + // TODO lignes directrices + } + } + + /** + * R\xE9g\xE9n\xE8re toutes les g\xE9om\xE9tries volatiles. + */ + private void regenerateAll() { + GISZoneCollection zone=profilsListen_.getGeomData(); + // Suppression des anciennes g\xE9om\xE9tries \\ + // Rives + int[] idxRives=new int[0]; + if(idxRiveGauche_!=-1&&idxRiveDroite_!=-1) + idxRives=new int[]{idxRiveGauche_, idxRiveDroite_}; + else if(idxRiveGauche_!=-1) + idxRives=new int[]{idxRiveGauche_}; + else if(idxRiveDroite_!=-1) + idxRives=new int[]{idxRiveDroite_}; + rivesModified_.getGeomData().removeGeometries(idxRives, null); + idxRiveGauche_=-1; + idxRiveDroite_=-1; + // Limites stockages + int[] idxLimiteStockages=new int[0]; + if(idxLimiteStockageGauche_!=-1&&idxLimiteStockageDroite_!=-1) + idxLimiteStockages=new int[]{idxLimiteStockageGauche_, idxLimiteStockageDroite_}; + else if(idxLimiteStockageGauche_!=-1) + idxLimiteStockages=new int[]{idxLimiteStockageGauche_}; + else if(idxLimiteStockageDroite_!=-1) + idxLimiteStockages=new int[]{idxLimiteStockageDroite_}; + limitesStockagsesModified_.getGeomData().removeGeometries(idxLimiteStockages, null); + idxLimiteStockageGauche_=-1; + idxLimiteStockageDroite_=-1; + // Lignes directrices + if (idxLignesDirectrices_.size()>0) { + int[] idxLD=new int[idxLignesDirectrices_.size()]; + for (int i=0; i<idxLignesDirectrices_.size(); i++) + idxLD[i]=idxLignesDirectrices_.get(i); + lignesDirectricesModified_.getGeomData().removeGeometries(idxLD, null); + idxLignesDirectrices_.clear(); + } + // Cr\xE9ation des nouvelles g\xE9om\xE9tries \\ + // Rives + Coordinate[] riveGauche=new Coordinate[profilsListen_.getNombre()]; + Coordinate[] riveDroite=new Coordinate[profilsListen_.getNombre()]; + for (int i=0; i<profilsListen_.getNombre(); i++) { + riveGauche[i]=zone.getCoordinateSequence(i).getCoordinate((Integer)zone.getValue(idxAttRiveGauche_, i)); + riveDroite[i]=zone.getCoordinateSequence(i).getCoordinate((Integer)zone.getValue(idxAttRiveDroite_, i)); + } + // Limites de stockages + Coordinate[] lsGauche=new Coordinate[profilsListen_.getNombre()]; + Coordinate[] lsDroite=new Coordinate[profilsListen_.getNombre()]; + for (int i=0; i<profilsListen_.getNombre(); i++) { + lsGauche[i]=zone.getCoordinateSequence(i).getCoordinate((Integer)zone.getValue(idxAttlsGauche_, i)); + lsDroite[i]=zone.getCoordinateSequence(i).getCoordinate((Integer)zone.getValue(idxAttlsDroite_, i)); + } + // Lignes directrices + //TODO + // Ajout des nouvelles g\xE9o\xE9mtries \\ + //Rives + if (riveGauche.length>1&&riveGauche[0]!=null&&rivesModified_!=null) + idxRiveGauche_=rivesModified_.getGeomData().addGeometry(new GISPolyligne(new GISCoordinateSequenceFactory().create(riveGauche)), null, null); + if (riveDroite.length>1&&riveDroite[0]!=null&&rivesModified_!=null) + idxRiveDroite_=rivesModified_.getGeomData().addGeometry(new GISPolyligne(new GISCoordinateSequenceFactory().create(riveDroite)), null, null); + // Limites de stockages + if (lsGauche.length>0&&lsGauche[0]!=null&&limitesStockagsesModified_!=null) + idxLimiteStockageGauche_=limitesStockagsesModified_.getGeomData().addGeometry( + new GISPolyligne(new GISCoordinateSequenceFactory().create(lsGauche)), null, null); + if (lsDroite.length>0&&lsDroite[0]!=null&&limitesStockagsesModified_!=null) + idxLimiteStockageDroite_=limitesStockagsesModified_.getGeomData().addGeometry( + new GISPolyligne(new GISCoordinateSequenceFactory().create(lsDroite)), null, null); + // Lignes directrices + // TODO + } + + /** + * Met \xE0 jour la geometrie volatile indiqu\xE9. Le param\xE8tre pass\xE9 est l'index du point \xE0 + * mettre \xE0 jour (qui correspond \xE9galement \xE0 la g\xE9om\xE9trie modifi\xE9). + */ + private void updateGeom(int _idxPoint, ZModeleLigneBrisee _model, int _idxGeomVolatile, int _idxAtt) { + if(_idxGeomVolatile==-1||_idxAtt==-1) + return; + CoordinateSequence seqGeomV=_model.getGeomData().getCoordinateSequence(_idxGeomVolatile); + CoordinateSequence seqProf=profilsListen_.getGeomData().getCoordinateSequence(_idxPoint); + Coordinate coord=seqProf.getCoordinate((Integer) profilsListen_.getGeomData().getValue(_idxAtt, _idxPoint)); + if (!UtilsProfil1d.egal(seqGeomV.getCoordinate(_idxPoint), coord)) { + seqGeomV.setOrdinate(_idxPoint, 0, coord.x); + seqGeomV.setOrdinate(_idxPoint, 1, coord.y); + seqGeomV.setOrdinate(_idxPoint, 2, coord.z); + _model.getGeomData().setCoordinateSequence(_idxGeomVolatile, seqGeomV, null); + } + } + } + } 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-06 18:04:41 UTC (rev 4325) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/UtilsProfil1d.java 2009-01-06 18:07:57 UTC (rev 4326) @@ -23,6 +23,9 @@ */ public class UtilsProfil1d { + /** Tol\xE9rance pour les calcules de comparaison avec des doubles. */ + static private double tolerance_=0.0001; + /** * Retourne vrai si le profil est correct. */ @@ -140,36 +143,66 @@ _a.z=_a.z/normeA; return _a; } - + /** - * Compars les deux vecteurs avec la tol\xE9rance donn\xE9e. - * Le dernier param\xE8tre indique si un normalisation des - * deux vecteurs doit \xEAtre faite avec la comparaison. - * Les vecteurs ne sont pas modif\xE9s dans l'op\xE9ration. + * Compars les deux vecteurs avec la tol\xE9rance donn\xE9e. Le dernier param\xE8tre + * indique si un normalisation des deux vecteurs doit \xEAtre faite avec la + * comparaison. Les vecteurs ne sont pas modif\xE9s dans l'op\xE9ration. _testZ doit + * \xEAtre mit \xE0 vrai pour que la comparaison tienne compte du z. */ - static public boolean egal(Coordinate _a, Coordinate _b, double _tolerance, boolean _normalisation) { + static public boolean egal(Coordinate _a, Coordinate _b, double _tolerance, boolean _normalisation, boolean _testZ) { if(_normalisation){ normalisation(_a); normalisation(_b); } Coordinate diff=vec(_a, _b); - return Math.abs(diff.x)<_tolerance&&Math.abs(diff.y)<_tolerance&&Math.abs(diff.z)<_tolerance; + return Math.abs(diff.x)<_tolerance&&Math.abs(diff.y)<_tolerance&&(!_testZ||Math.abs(diff.z)<_tolerance); } /** + * Comme 'egal' sauf que _tolerance _normalisation et _testZ sont valu\xE9s. + */ + static public boolean egalSansZ(Coordinate _a, Coordinate _b) { + return egal(_a, _b, tolerance_, false, false); + } + + /** + * Comme 'egal' sans l'attribut _testZ qui est mit \xE0 vrai. + */ + static public boolean egal(Coordinate _a, Coordinate _b, double _tolerance, boolean _normalisation) { + return egal(_a, _b, _tolerance, _normalisation, true); + } + + /** + * Comme 'egal' sans le dernier param\xE8tre qui n'a de sens que lorsque les + * Coordinates sont des vecteurs. + */ + static public boolean egal(Coordinate _a, Coordinate _b, double _tolerance) { + return egal(_a, _b, _tolerance, false); + } + + /** + * Comme 'egal' sans la tolerance (la tolerance par defaut est utilis\xE9) ni la + * normalisation. + */ + static public boolean egal(Coordinate _a, Coordinate _b) { + return egal(_a, _b, tolerance_); + } + + /** * Retourne l'index du point pr\xE9c\xE9dent la coordonn\xE9e indiqu\xE9e sur la coordinateSequence donn\xE9e. * Retourne -1 si la coordonn\xE9e donn\xE9e correspond \xE0 l'index 0. * 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||_point.equals(_geom.getCoordinate(0))) + if(_point==null||_geom.size()<=0||egal(_point, _geom.getCoordinate(0))) return -1; boolean fini=false; int i=-1; GISPoint point=new GISPoint(_point); while (!fini&&++i<_geom.size()-1) fini=(GISGeometryFactory.INSTANCE - .createLineString(new Coordinate[]{_geom.getCoordinate(i), _geom.getCoordinate(i+1)})).distance(point)<0.0001; + .createLineString(new Coordinate[]{_geom.getCoordinate(i), _geom.getCoordinate(i+1)})).distance(point)<tolerance_; if(!fini) return -2; else @@ -182,19 +215,35 @@ * 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||_point.equals(_geom.getCoordinate(_geom.size()-1))) + if(_point==null||_geom.size()<=0||egal(_point, _geom.getCoordinate(_geom.size()-1))) return -1; boolean fini=false; - int i=_geom.size()-1; + int i=_geom.size(); GISPoint point=new GISPoint(_point); while (!fini&&--i>0) fini=(GISGeometryFactory.INSTANCE - .createLineString(new Coordinate[]{_geom.getCoordinate(i-1), _geom.getCoordinate(i)})).distance(point)<0.0001; + .createLineString(new Coordinate[]{_geom.getCoordinate(i-1), _geom.getCoordinate(i)})).distance(point)<tolerance_; if(!fini) return -2; else return i; } + + /** + * Retourne l'index de la coordonn\xE9e pass\xE9e en param\xE8tre. Si le point n'existe + * pas -1 est retourn\xE9. + */ + static public int getIndex(CoordinateSequence _geom, Coordinate _point) { + if(_geom==null||_point==null) + return -1; + boolean found=false; + int i=-1; + while(!found&&++i<_geom.size()) + found=egalSansZ(_geom.getCoordinate(i), _point); + if(found) + return i; + return -1; + } /** * Retourne l'abscisse curviligne du point '_point' de la polyligne '_geom'. Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/VueTableau.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/VueTableau.java 2009-01-06 18:04:41 UTC (rev 4325) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/VueTableau.java 2009-01-06 18:07:57 UTC (rev 4326) @@ -57,7 +57,7 @@ } /** - * Met \xE0 jour l'affichage de l'abscisse curviligne d + * Met \xE0 jour l'affichage de l'abscisse curviligne du profil sur l'axe hydraulique. */ private void updateAbscisseCurvAxeHydraulique() { double abscCurv=data_.getAbsCurvProfilOnAxeHydraulique(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <emm...@us...> - 2009-01-06 18:04:46
|
Revision: 4325 http://fudaa.svn.sourceforge.net/fudaa/?rev=4325&view=rev Author: emmanuel_martin Date: 2009-01-06 18:04:41 +0000 (Tue, 06 Jan 2009) Log Message: ----------- Corrige un bug lors de la manipulation d'une coordinate sequence. Modified Paths: -------------- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/ProfilContainerAdapter.java Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/ProfilContainerAdapter.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/ProfilContainerAdapter.java 2009-01-06 14:22:00 UTC (rev 4324) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/ProfilContainerAdapter.java 2009-01-06 18:04:41 UTC (rev 4325) @@ -73,7 +73,7 @@ if(oldZone_==biefContainer_.getZoneProfils()&&oldIdxGeom_==idxProfilSelected_) { if(updateZ_) updateCacheZ(); if(updateCurv_) updateCacheCurv(); - fireProfilContainerDataModifiedd(); + fireProfilContainerDataModified(); } } @@ -300,7 +300,7 @@ idxProfilSelected_=-1; z_=null; curv_=null; - fireProfilContainerDataModifiedd(); + fireProfilContainerDataModified(); // Propagation de l'exception throw _exp; } @@ -308,7 +308,7 @@ else throw new IllegalArgumentException(FudaaLib.getS("Les arguments sont invalides.")); // Fin des verifications, tous est ok => accept\xE9 - fireProfilContainerDataModifiedd(); + fireProfilContainerDataModified(); } public GISZoneCollection getGISZoneCollection(){ @@ -326,9 +326,12 @@ return biefContainer_.getZoneProfils().getGeometry(idxProfilSelected_).getNumPoints(); } - private Coordinate getValueOf(GISAttributeInterface attr_) { + /** + * Retourne la valeur de l'attribut d'intersection demand\xE9. C'est donc un index de point qui est renvoy\xE9. + */ + private int getValueOf(GISAttributeInterface attr_) { int idxAtt=biefContainer_.getZoneProfils().getIndiceOf(attr_); - return (Coordinate) biefContainer_.getZoneProfils().getValue(idxAtt, idxProfilSelected_); + return (Integer) biefContainer_.getZoneProfils().getValue(idxAtt, idxProfilSelected_); } private CoordinateSequence getCoordSeq() { @@ -339,25 +342,25 @@ public double getAbsCurvRiveGauche() { if(idxProfilSelected_==-1) return -1; - return UtilsProfil1d.abscisseCurviligne(getCoordSeq(), getValueOf(GISAttributeConstants.INTERSECTION_RIVE_GAUCHE)); + return UtilsProfil1d.abscisseCurviligne(getCoordSeq(), getCoordSeq().getCoordinate(getValueOf(GISAttributeConstants.INTERSECTION_RIVE_GAUCHE))); } public double getAbsCurvRiveDroite() { if(idxProfilSelected_==-1) return -1; - return UtilsProfil1d.abscisseCurviligne(getCoordSeq(), getValueOf(GISAttributeConstants.INTERSECTION_RIVE_DROITE)); + return UtilsProfil1d.abscisseCurviligne(getCoordSeq(), getCoordSeq().getCoordinate(getValueOf(GISAttributeConstants.INTERSECTION_RIVE_DROITE))); } public double getAbsCurvLimiteStockageGauche() { if(idxProfilSelected_==-1) return -1; - return UtilsProfil1d.abscisseCurviligne(getCoordSeq(), getValueOf(GISAttributeConstants.INTERSECTION_LIMITE_STOCKAGE_GAUCHE)); + return UtilsProfil1d.abscisseCurviligne(getCoordSeq(), getCoordSeq().getCoordinate(getValueOf(GISAttributeConstants.INTERSECTION_LIMITE_STOCKAGE_GAUCHE))); } public double getAbsCurvLimiteStockageDroite() { if(idxProfilSelected_==-1) return -1; - return UtilsProfil1d.abscisseCurviligne(getCoordSeq(), getValueOf(GISAttributeConstants.INTERSECTION_LIMITE_STOCKAGE_DROITE)); + return UtilsProfil1d.abscisseCurviligne(getCoordSeq(), getCoordSeq().getCoordinate(getValueOf(GISAttributeConstants.INTERSECTION_LIMITE_STOCKAGE_DROITE))); } public double getAbsCurvProfilOnAxeHydraulique() { @@ -384,7 +387,15 @@ throw new IllegalArgumentException("Cet index n'existe pas."); // Extraction des coordonn\xE9es de la g\xE9om\xE9trie pour pouvoir les modifier par la suite CoordinateSequence seq=((GISCoordinateSequenceContainerInterface)biefContainer_.getZoneProfils().getGeometry(idxProfilSelected_)).getCoordinateSequence(); - Coordinate[] coords=seq.toCoordinateArray(); + Coordinate[] coords=seq.toCoordinateArray().clone(); + /* + * A propos de coords : le tableau retourn\xE9 est r\xE9f\xE9renc\xE9 (via une weak + * reference) par le cache de la coordinate sequence dont il est issu. Donc, + * pour \xE9viter des probl\xE8mes de point fantome, il faut le clon\xE9. Cependant + * les coordinantes qu'il contient doivent \xE9galement \xEAtre clon\xE9 sinon \xE7a ne + * sert a rien. Pour ne pas trop perdre en performance, seul les coordonn\xE9es + * modifi\xE9es sont clon\xE9es. + */ // Les nouvelles valeurs du points \xE0 d\xE9placer double newX; double newY; @@ -427,8 +438,7 @@ newX=seq.getX(idx1); newY=seq.getY(idx1)+sign*valCurv; } - coords[_idxPoint].x=newX; - coords[_idxPoint].y=newY; + coords[_idxPoint]=new Coordinate(newX, newY, coords[_idxPoint].z); // Mise a jour de la table des valeurs curvilignes if (_idxPoint==0) for (int i=1; i<curv_.size(); i++) @@ -581,7 +591,7 @@ * Test de croisement entre les deux axes modifi\xE9s et l'axe avant. l'axe * a, newP a normalement un point d'intersectino (a). */ - GISPolyligne axeTest=GISGeometryFactory.INSTANCE.createLineString(new Coordinate[]{coords[0], coords[idxPtdeb]}); + GISPolyligne axeTest=GISGeometryFactory.INSTANCE.createLineString(new Coordinate[]{new Coordinate(coords[0]), new Coordinate(coords[idxPtdeb])}); noCut=axe1.intersection(axeTest).getNumPoints()==1; noCut=noCut&&!axe2.intersects(axeTest); } @@ -590,7 +600,7 @@ * Test de croisement entre les deux axes modifi\xE9s et l'axe avant. l'axe * newP, b a normalement un point d'intersectino (b). */ - GISPolyligne axeTest=GISGeometryFactory.INSTANCE.createLineString(new Coordinate[]{coords[idxPtFin], coords[coords.length-1]}); + GISPolyligne axeTest=GISGeometryFactory.INSTANCE.createLineString(new Coordinate[]{new Coordinate(coords[idxPtFin]), new Coordinate(coords[coords.length-1])}); noCut=noCut&&axe2.intersection(axeTest).getNumPoints()==1; noCut=noCut&&!axe1.intersects(axeTest); } @@ -598,8 +608,7 @@ if(!noCut) throw new ProfilContainerException(FudaaLib.getS("Ce d\xE9placement est impossible sans obtenir un profil dont des axes se coupent.")); // Enregistrement du nouveau point C' et de la nouvelle valeur curviligne - coords[_idxPoint].x=newX; - coords[_idxPoint].y=newY; + coords[_idxPoint]=new Coordinate(newX, newY, coords[_idxPoint].z); // Mise a jour de la table des valeurs curvilignes curv_.set(_idxPoint, _value); @@ -620,17 +629,16 @@ if (Math.abs(coords[idxFin].x-coords[idxDeb].x)>tolerance) { double sign=Math.signum(coords[idxFin].x-coords[idxDeb].x); double newCoefDirecteur=(coords[idxFin].y-coords[idxDeb].y)/(coords[idxFin].x-coords[idxDeb].x); - for(int i=idxDeb+1;i<idxFin;i++){ - coords[i].x=coords[idxDeb].x+sign*(curv_.get(i)-curv_.get(idxDeb))/Math.sqrt(1+newCoefDirecteur*newCoefDirecteur); - coords[i].y=coords[idxDeb].y+newCoefDirecteur*(coords[i].x-coords[idxDeb].x); - } + for (int i=idxDeb+1; i<idxFin; i++) + coords[i]=new Coordinate(coords[idxDeb].x+sign*(curv_.get(i)-curv_.get(idxDeb)) + /Math.sqrt(1+newCoefDirecteur*newCoefDirecteur), coords[i].y=coords[idxDeb].y+newCoefDirecteur*(coords[i].x-coords[idxDeb].x), coords[i].z); } else { // Cas du bout de profil vertical double sign=Math.signum(coords[idxFin].y-coords[idxDeb].y); - for(int i=idxDeb+1;i<idxFin;i++){ - coords[i].x=coords[idxDeb].x; - coords[i].y=coords[idxDeb].y+sign*(curv_.get(i)-curv_.get(idxDeb)); - } + for (int i=idxDeb+1; i<idxFin; i++) + coords[i]=new Coordinate(coords[idxDeb].x, coords[i].y=coords[idxDeb].y+sign*(curv_.get(i)-curv_.get(idxDeb)), + coords[i].z); + } } } @@ -641,14 +649,14 @@ if(_cmd!=null) _cmd.addCmd(new DGCommandUndoRedo(cmd, false, true)); // Notification des changements de valeurs - fireProfilContainerDataModifiedd(); + fireProfilContainerDataModified(); } public void setZ(int _idxPoint, double _value, CtuluCommandContainer _cmd) { if (z_==null||_idxPoint<0||_idxPoint>=z_.getSize()) throw new IllegalArgumentException("Cet index n'existe pas."); - CtuluCommandComposite cmd=new CtuluCommandComposite("Changement abs. curviligne"); + CtuluCommandComposite cmd=new CtuluCommandComposite("Changement z"); // Mise \xE0 jour du z \\ z_.setObject(_idxPoint, _value, cmd); // Gestion du undo/redo \\ @@ -661,7 +669,7 @@ idxZMax_=_idxPoint; else if (_value<(Double)z_.getObjectValueAt(idxZMin_)) idxZMin_=_idxPoint; - fireProfilContainerDataModifiedd(); + fireProfilContainerDataModified(); } public double getCurvMax() { @@ -736,7 +744,7 @@ // Mise \xE0 jour de idxZMin_ et idxZMax_ if (_idxPoint==idxZMax_||_idxPoint==idxZMin_) updateCacheZ(); - fireProfilContainerDataModifiedd(); + fireProfilContainerDataModified(); } // Gestion des listeners \\ @@ -758,7 +766,7 @@ listeners_.remove(_listener); } - protected void fireProfilContainerDataModifiedd(){ + protected void fireProfilContainerDataModified(){ for(ProfilContainerListener listener:listeners_) listener.profilContainerDataModified(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <emm...@us...> - 2009-01-06 14:22:02
|
Revision: 4324 http://fudaa.svn.sourceforge.net/fudaa/?rev=4324&view=rev Author: emmanuel_martin Date: 2009-01-06 14:22:00 +0000 (Tue, 06 Jan 2009) Log Message: ----------- Correction d'un bug : lors d'une suppression de plusieurs g?\195?\169om?\195?\169tries les attributs associ?\195?\169s ?\195?\160 ces attributs n'?\195?\169taient pas n?\195?\169c?\195?\169ssairement supprim?\195?\169s. (Si le CtuluCommandContainer ?\195?\169tait null, logique...) Modified Paths: -------------- branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/collection/CtuluCollectionDoubleEditAbstract.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/collection/CtuluListObject.java Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/collection/CtuluCollectionDoubleEditAbstract.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/collection/CtuluCollectionDoubleEditAbstract.java 2009-01-05 19:02:06 UTC (rev 4323) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/collection/CtuluCollectionDoubleEditAbstract.java 2009-01-06 14:22:00 UTC (rev 4324) @@ -363,9 +363,8 @@ */ public final boolean set(final int _i, final double _newV, final CtuluCommandContainer _c) { // verif basique - if (_i < 0 || _i > getSize() || getValue(_i) == _newV) { + if (_i < 0 || _i >= getSize() || getValue(_i) == _newV) return false; - } final double old = getValue(_i); internalSet(_i, _newV); fireObjectChanged(_i, _newV); Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/collection/CtuluListObject.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/collection/CtuluListObject.java 2009-01-05 19:02:06 UTC (rev 4323) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/collection/CtuluListObject.java 2009-01-06 14:22:00 UTC (rev 4324) @@ -570,8 +570,8 @@ } else { commandComposite.addCmd(new CommandRemoveDangerous(oldV, iToRemove)); } - internActionPointRemoved(iToRemove, commandComposite); } + internActionPointRemoved(iToRemove, commandComposite); fireObjectRemoved(-1, null); if (_cmd != null && commandComposite != null) { _cmd.addCmd(commandComposite.getSimplify()); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <had...@us...> - 2009-01-05 19:02:11
|
Revision: 4323 http://fudaa.svn.sourceforge.net/fudaa/?rev=4323&view=rev Author: hadouxad Date: 2009-01-05 19:02:06 +0000 (Mon, 05 Jan 2009) Log Message: ----------- Corrections partielles retour 15/12/2008 Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCommonImplementation.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjet.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/actions/TrPostActionOpenSrc.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/persist/TrPostPersistenceManager.java Added Paths: ----------- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostFusionProjet.java Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCommonImplementation.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCommonImplementation.java 2009-01-05 15:46:50 UTC (rev 4322) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCommonImplementation.java 2009-01-05 19:02:06 UTC (rev 4323) @@ -24,6 +24,7 @@ import org.fudaa.fudaa.tr.common.TrCommonImplementation; import org.fudaa.fudaa.tr.common.TrLib; import org.fudaa.fudaa.tr.common.TrResource; +import org.fudaa.fudaa.tr.post.actions.TrPostActionChooseAndCreateCalque; import com.memoire.bu.BuLib; import com.memoire.bu.BuMenu; @@ -34,256 +35,279 @@ */ public abstract class TrPostCommonImplementation extends TrCommonImplementation { - TrPostProjet c_; + TrPostProjet c_; - public final TrPostProjet getCurrentProject() { - return c_; - } + public final TrPostProjet getCurrentProject() { + return c_; + } - /** - * @return toutes les fenetres de PostLayout - */ - public List<TrPostLayoutFille> getAllLayoutFille() { - final JInternalFrame[] allInternalFrames = getAllInternalFrames(); - if (allInternalFrames == null) return Collections.emptyList(); - final List<TrPostLayoutFille> res = new ArrayList<TrPostLayoutFille>(allInternalFrames.length); - for (int i = 0; i < allInternalFrames.length; i++) { - final JInternalFrame internalFrame = allInternalFrames[i]; - if (internalFrame instanceof TrPostLayoutFille) { - res.add((TrPostLayoutFille) internalFrame); - } - } - return res; - } + /** + * @return toutes les fenetres de PostLayout + */ + public List<TrPostLayoutFille> getAllLayoutFille() { + final JInternalFrame[] allInternalFrames = getAllInternalFrames(); + if (allInternalFrames == null) return Collections.emptyList(); + final List<TrPostLayoutFille> res = new ArrayList<TrPostLayoutFille>(allInternalFrames.length); + for (int i = 0; i < allInternalFrames.length; i++) { + final JInternalFrame internalFrame = allInternalFrames[i]; + if (internalFrame instanceof TrPostLayoutFille) { + res.add((TrPostLayoutFille) internalFrame); + } + } + return res; + } - - public void elimineDoublonNomsLayout(){ - List<TrPostLayoutFille> liste=getAllLayoutFille(); - - for(int i=0;i<liste.size();i++){ - int cpt=1; - for(int j=i; j<liste.size();j++){ - if(liste.get(j).previousTitleFrame.equals(liste.get(i).previousTitleFrame)){ - - liste.get(j).previousTitleFrame+="_"+(cpt++); - } + + public void elimineDoublonNomsLayout(){ + List<TrPostLayoutFille> liste=getAllLayoutFille(); + + for(int i=0;i<liste.size();i++){ + int cpt=1; + for(int j=i; j<liste.size();j++){ + if(liste.get(j).previousTitleFrame.equals(liste.get(i).previousTitleFrame)){ + + liste.get(j).previousTitleFrame+="_"+(cpt++); + } } - - } - - } - - /** - * @return la fenetre layout active. - */ - public TrPostLayoutFille getCurrentLayoutFille() { - final JInternalFrame currentInternalFrame = getCurrentInternalFrame(); - return currentInternalFrame instanceof TrPostLayoutFille ? (TrPostLayoutFille) currentInternalFrame : null; - } - /** - * @return la fenetre layout active ou la premiere des LayoutFille de cette application - */ - public TrPostLayoutFille getCurrentLayoutFilleOrFirst() { - TrPostLayoutFille current = getCurrentLayoutFille(); - if (current == null) { - final List<TrPostLayoutFille> allLayoutFille = getAllLayoutFille(); - if (!allLayoutFille.isEmpty()) current = allLayoutFille.get(0); - } - return current; - } + } - @Override - public void init() { - super.init(); - final BuMenu menu = (BuMenu) getMainMenuBar().getMenu("IMPORTER"); - menu.addMenuItem(TrResource.getS("Autres r\xE9sultats"), getImportResultsAct()); - } + } - String getImportResultsAct() { - return "IMPORT_RESULTS"; - } + /** + * @return la fenetre layout active. + */ + public TrPostLayoutFille getCurrentLayoutFille() { + final JInternalFrame currentInternalFrame = getCurrentInternalFrame(); + return currentInternalFrame instanceof TrPostLayoutFille ? (TrPostLayoutFille) currentInternalFrame : null; + } - @Override - public void close() { - if (c_ != null) { - c_.close(); - } - removeInternalFrames(getAllInternalFrames()); - } + /** + * @return la fenetre layout active ou la premiere des LayoutFille de cette application + */ + public TrPostLayoutFille getCurrentLayoutFilleOrFirst() { + TrPostLayoutFille current = getCurrentLayoutFille(); + if (current == null) { + final List<TrPostLayoutFille> allLayoutFille = getAllLayoutFille(); + if (!allLayoutFille.isEmpty()) current = allLayoutFille.get(0); + } + return current; + } - public void setProjet(final TrPostProjet _c) { - if (c_ == _c) { return; } - new CtuluTaskOperationGUI(null, CtuluLibString.EMPTY_STRING) { + @Override + public void init() { + super.init(); + final BuMenu menu = (BuMenu) getMainMenuBar().getMenu("IMPORTER"); + menu.addMenuItem(TrResource.getS("Autres r\xE9sultats"), getImportResultsAct()); + } - @Override - public void act() { - saveAndCloseProjet(createProgressionInterface(this)); - c_ = _c; - if (c_ != null) { - c_.active(TrPostCommonImplementation.this); - BuLib.invokeNowOrLater(new Runnable() { - public void run() { - setEnabledForAction("ENREGISTRER", true); - setEnabledForAction("ENREGISTRERSOUS", true); - setEnabledForAction("IMPORTER", true); - setEnabledForAction(getImportResultsAct(), true); - setEnabledForAction("IMPORT_PROJECT", true); - } - }); - } - } - }.start(); + String getImportResultsAct() { + return "IMPORT_RESULTS"; + } - } + @Override + public void close() { + if (c_ != null) { + c_.close(); + } + removeInternalFrames(getAllInternalFrames()); + } - public boolean saveAndCloseProjet(final ProgressionInterface _interface) { - if (c_ != null) { - - // -- enregistrement sauce widget --// - final int i = CtuluLibDialog.confirmExitIfProjectisModified(getFrame()); - if (i == JOptionPane.CANCEL_OPTION) { - return false; - } - if (i != JOptionPane.NO_OPTION) { - c_.getManager().saveProject(false); - //c_.save(this, _interface); - } - - c_.close(); - c_ = null; - SwingUtilities.invokeLater(new Runnable() { + public void setProjet(final TrPostProjet _c) { + if (c_ == _c) { return; } + new CtuluTaskOperationGUI(null, CtuluLibString.EMPTY_STRING) { - public void run() { + @Override + public void act() { + saveAndCloseProjet(createProgressionInterface(this)); + c_ = _c; + if (c_ != null) { + c_.active(TrPostCommonImplementation.this); + BuLib.invokeNowOrLater(new Runnable() { + public void run() { + setEnabledForAction("CREER", true); + setEnabledForAction("ENREGISTRER", true); + setEnabledForAction("ENREGISTRERSOUS", true); + setEnabledForAction("IMPORTER", true); + setEnabledForAction(getImportResultsAct(), true); + setEnabledForAction("IMPORT_PROJECT", true); + } + }); + } + } + }.start(); - setEnabledForAction("ENREGISTRER", false); - setEnabledForAction("IMPORTER", false); - setEnabledForAction(getImportResultsAct(), false); - setEnabledForAction("IMPORT_PROJECT", false); - } - }); - } - - - - return true; - } + } - @Override - public boolean confirmExit() { - final boolean b = super.confirmExit(); - if (b && c_ != null && !saveAndCloseProjet(null)) { return false; } - return b; - } + public boolean saveAndCloseProjet(final ProgressionInterface _interface) { + if (c_ != null) { - @Override - public void actionPerformed(final ActionEvent _evt) { - final String com = _evt.getActionCommand(); + // -- enregistrement sauce widget --// + final int i = CtuluLibDialog.confirmExitIfProjectisModified(getFrame()); + if (i == JOptionPane.CANCEL_OPTION) { + return false; + } + if (i != JOptionPane.NO_OPTION) { + c_.getManager().saveProject(false); + //c_.save(this, _interface); + } - if ("OUVRIR".equals(com)) { - // -- ouverture d un nouveau projet --// - final int reponse = JOptionPane - .showConfirmDialog( - this.getParentComponent(), - TrResource - .getS("Voulez vous fermer le projet courant?\n Cliquez non si vous voulez ajouter le nouveau projet au projet existant.")); - if (reponse == JOptionPane.CANCEL_OPTION) { return; } - if (reponse == JOptionPane.OK_OPTION) { - c_.getManager().clearProject(); - } - c_.getManager().loadProject(false, null); + c_.close(); + c_ = null; + SwingUtilities.invokeLater(new Runnable() { - } else + public void run() { + setEnabledForAction("CREER", true); + setEnabledForAction("ENREGISTRER", false); + setEnabledForAction("IMPORTER", false); + setEnabledForAction(getImportResultsAct(), false); + setEnabledForAction("IMPORT_PROJECT", false); + } + }); + } - if ("FERMER".equals(com)) { - new CtuluTaskOperationGUI(this, TrResource.getS("Fermer")) { - @Override - public void act() { - saveAndCloseProjet(createProgressionInterface(this)); - } - }.start(); - } else if ("ENREGISTRER".equals(com) && c_ != null) { - new CtuluTaskOperationGUI(this, TrResource.getS("Enregistrement")) { - @Override - public void act() { - // c_.save(TrPostCommonImplementation.this, createProgressionInterface(this)); + return true; + } - // -- enregistrement sauce widget --// - c_.getManager().saveProject(false); + @Override + public boolean confirmExit() { + final boolean b = super.confirmExit(); + if (b && c_ != null && !saveAndCloseProjet(null)) { return false; } + return b; + } - } - }.start(); - } else if ("ENREGISTRERSOUS".equals(com) && c_ != null) { - new CtuluTaskOperationGUI(this, TrResource.getS("Enregistrement Sous")) { + @Override + public void actionPerformed(final ActionEvent _evt) { + final String com = _evt.getActionCommand(); - @Override - public void act() { - // c_.save(TrPostCommonImplementation.this, createProgressionInterface(this)); + if ("CREER".equals(com)) { + final int reponse = JOptionPane.showConfirmDialog(this.getParentComponent(),TrResource.getS("Le projet courant va \xEAtre ferm\xE9. \n Voulez vous sauvegarder le projet courant avant sa fermeture?")); + if (reponse == JOptionPane.CANCEL_OPTION) { return; } + if (reponse == JOptionPane.OK_OPTION) { + c_.getManager().saveProject(false); + } + //-- nettoyage du projet pr\xE9c\xE9dent --// + c_.getManager().clearProject(); - // -- enregistrement sauce widget --// - c_.getManager().saveProject(true); + //-- ouverture d'un fichier r\xE9sultat qui sera automatiquement ajout\xE9 dans la layout courante --// + c_.createNewLayoutFrame(); + //-- ouverture d'un fichier r\xE9sultat --// + TrPostActionChooseAndCreateCalque chooserSource= new TrPostActionChooseAndCreateCalque(c_,c_.getImpl().getCurrentLayoutFille().controller_); + chooserSource.actionPerformed(null); - } - }.start(); - } - // else if (getImportResultsAct().equals(com) && c_ != null) { - // c_.importerVars(); - // } - else { - super.actionPerformed(_evt); - } - } - @Override - protected void ouvrir() { - cmdOuvrirFile(super.ouvrirFileChooser(TrResource.getS("Fichier post"), null)); - } + }else + if ("OUVRIR".equals(com)) { + // -- ouverture d un nouveau projet --// - @Override - public String getHelpDir() { - return getInformationsSoftware().man + "post/"; - } - /** - * Methode appelee pour creer un projet .POST - * - * @param _f - */ - public void cmdOuvrirLayoutFile(final File _f) { - if (c_ == null) { - // setProjet(new TrPostProjet(TrPostCommonImplementation.this)); - c_ = new TrPostProjet(TrPostCommonImplementation.this); - c_.active(TrPostCommonImplementation.this); - BuLib.invokeNowOrLater(new Runnable() { - public void run() { - setEnabledForAction("ENREGISTRER", true); - setEnabledForAction("ENREGISTRERSOUS", true); - setEnabledForAction("IMPORTER", true); - setEnabledForAction(getImportResultsAct(), true); - setEnabledForAction("IMPORT_PROJECT", true); - } - }); - } - BuLib.invokeLater(new Runnable() { - public void run() { - c_.getManager().loadProject(true, _f); - } - }); + final int reponse = JOptionPane.showConfirmDialog(this.getParentComponent(),TrResource.getS("Le projet courant va \xEAtre ferm\xE9. \n Voulez vous sauvegarder le projet courant avant sa fermeture?")); + if (reponse == JOptionPane.CANCEL_OPTION) { return; } + if (reponse == JOptionPane.OK_OPTION) { + c_.getManager().saveProject(false); + } - } + //-- nettoyage du projet pr\xE9c\xE9dent --// + c_.getManager().clearProject(); - @Override - public void cmdOuvrirFile(final File _f) { - final TrPostCommonImplementation alreadyOpen = getLauncher().findPostWithOpenedFile(_f); - if (alreadyOpen == null) { - TrPostMultiSourceActivator.activeFile(_f, this); - } else { - error(TrLib.getMessageAlreadyOpen(_f)); - alreadyOpen.getFrame().toFront(); - } - } + c_.getManager().loadProject(false, null); + //new TrPostFusionProjet(c_); + + } else + + if ("FERMER".equals(com)) { + new CtuluTaskOperationGUI(this, TrResource.getS("Fermer")) { + + @Override + public void act() { + saveAndCloseProjet(createProgressionInterface(this)); + } + }.start(); + } else if ("ENREGISTRER".equals(com) && c_ != null) { + new CtuluTaskOperationGUI(this, TrResource.getS("Enregistrement")) { + + @Override + public void act() { + // c_.save(TrPostCommonImplementation.this, createProgressionInterface(this)); + + // -- enregistrement sauce widget --// + c_.getManager().saveProject(false); + + } + }.start(); + } else if ("ENREGISTRERSOUS".equals(com) && c_ != null) { + new CtuluTaskOperationGUI(this, TrResource.getS("Enregistrement Sous")) { + + @Override + public void act() { + // c_.save(TrPostCommonImplementation.this, createProgressionInterface(this)); + + // -- enregistrement sauce widget --// + c_.getManager().saveProject(true); + + } + }.start(); + } + + // else if (getImportResultsAct().equals(com) && c_ != null) { + // c_.importerVars(); + // } + else { + super.actionPerformed(_evt); + } + } + + @Override + protected void ouvrir() { + cmdOuvrirFile(super.ouvrirFileChooser(TrResource.getS("Fichier post"), null)); + } + + @Override + public String getHelpDir() { + return getInformationsSoftware().man + "post/"; + } + + /** + * Methode appelee pour creer un projet .POST + * + * @param _f + */ + public void cmdOuvrirLayoutFile(final File _f) { + if (c_ == null) { + // setProjet(new TrPostProjet(TrPostCommonImplementation.this)); + c_ = new TrPostProjet(TrPostCommonImplementation.this); + c_.active(TrPostCommonImplementation.this); + BuLib.invokeNowOrLater(new Runnable() { + public void run() { + setEnabledForAction("ENREGISTRER", true); + setEnabledForAction("ENREGISTRERSOUS", true); + setEnabledForAction("IMPORTER", true); + setEnabledForAction(getImportResultsAct(), true); + setEnabledForAction("IMPORT_PROJECT", true); + } + }); + } + BuLib.invokeLater(new Runnable() { + public void run() { + c_.getManager().loadProject(true, _f); + } + }); + + } + + @Override + public void cmdOuvrirFile(final File _f) { + final TrPostCommonImplementation alreadyOpen = getLauncher().findPostWithOpenedFile(_f); + if (alreadyOpen == null) { + TrPostMultiSourceActivator.activeFile(_f, this); + } else { + error(TrLib.getMessageAlreadyOpen(_f)); + alreadyOpen.getFrame().toFront(); + } + } + } \ No newline at end of file Added: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostFusionProjet.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostFusionProjet.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostFusionProjet.java 2009-01-05 19:02:06 UTC (rev 4323) @@ -0,0 +1,176 @@ +package org.fudaa.fudaa.tr.post; + +import java.awt.BorderLayout; +import java.awt.FlowLayout; +import java.awt.GridLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +import javax.swing.BorderFactory; +import javax.swing.ButtonGroup; +import javax.swing.JButton; +import javax.swing.JCheckBox; +import javax.swing.JComponent; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JRadioButton; +import javax.swing.ListSelectionModel; + +import org.fudaa.ebli.ressource.EbliResource; +import org.fudaa.fudaa.tr.common.TrResource; +import org.fudaa.fudaa.tr.post.actions.TrPostActionChooseAndCreateCalque; + +import com.memoire.bu.BuCommonInterface; +import com.memoire.bu.BuDialog; +import com.memoire.bu.BuDialogMessage; +import com.memoire.bu.BuInformationsSoftware; +import com.memoire.bu.BuScrollPane; + +/** + * Classe qui gere le panel de configuration de fusion du projet actuel avec un nouveau projet. + * CLASSE NON UTILISEE + * @author Adrien Hadoux + * + */ +public class TrPostFusionProjet extends BuDialogMessage{ + + TrPostProjet projet_; + + public TrPostFusionProjet(TrPostProjet _projet) { + super(_projet.impl_.getApp(), _projet.impl_.getInformationsSoftware(), TrResource + .getS("Ouvrir un projet")); + // TODO Auto-generated constructor stub + projet_=_projet; + content_ = constructPanelOuvrir(); + setContentPane(content_); + setSize(550, 250); + setModal(true); + setTitle(TrResource.getS("Ouvrir un projet")); + // setLocation(widgetGraphe_.getLocation()); + activate(); + + } + + //-- true si le projet a charger est de type post --// + boolean typePost_=true; + + //-- indique si l'on conserve le precedent projet --// + boolean conservPreviousProject_=false; + + + /** + * Construit le panel d'ouverture du projet + * @return + */ + JComponent constructPanelOuvrir() { + + + final JLabel labelPost=new JLabel(""); + final JLabel labelSource=new JLabel(""); + + final JPanel content = new JPanel(new BorderLayout()); + // content.add(new JLabel(TrResource.getS("Ouvrir un projet")), BorderLayout.NORTH); + JPanel container=new JPanel(new GridLayout(2,1)); + content.add(container,BorderLayout.CENTER); + + //-- panel choix ouverture projet --// + final JPanel content1 = new JPanel(new GridLayout(2,1)); + content1.setBorder(BorderFactory.createTitledBorder(TrResource.getS("Type de projet"))); + + ButtonGroup group = new ButtonGroup(); + JRadioButton postButton = new JRadioButton(TrResource.getS("Projet POST")); + postButton.setSelected(true); + postButton.addActionListener(new ActionListener() { + public void actionPerformed(final ActionEvent _e) { + typePost_=true; + } }); + JRadioButton sourceButton = new JRadioButton(TrResource.getS("Fichier r\xE9sultat")); + sourceButton.setSelected(false); + sourceButton.addActionListener(new ActionListener() { + public void actionPerformed(final ActionEvent _e) { + typePost_=false; + } }); + group.add(postButton); + group.add(sourceButton); + + + JPanel ligne1=new JPanel(new FlowLayout(FlowLayout.LEFT)); + ligne1.add(postButton); + ligne1.add(labelPost); + + JPanel ligne2=new JPanel(new FlowLayout(FlowLayout.LEFT)); + ligne2.add(sourceButton); + ligne2.add(labelSource); + content1.add(ligne1); + content1.add(ligne2); + + + final JPanel content2 =new JPanel(new GridLayout(3,1)); + content2.setBorder(BorderFactory.createTitledBorder(TrResource.getS("Propri\xE9t\xE9s"))); + + final JCheckBox conservPrevious=new JCheckBox(TrResource.getS("Conserver le projet pr\xE9c\xE8dent ?")); + conservPrevious.setSelected(conservPreviousProject_); + conservPrevious.addActionListener(new ActionListener() { + public void actionPerformed(final ActionEvent _e) { + if(conservPrevious.isSelected()) + conservPreviousProject_=true; + else + conservPreviousProject_=false; + } }); + content2.add(conservPrevious); + content2.add(new JLabel(TrResource.getS("Dans le cas d'une ouverture d'un fichier r\xE9sultat, le nom du projet sera demand\xE9 \xE0 la sauvegarde."))); + content2.add(new JLabel(TrResource.getS("Dans le cas d'une ouverture d'un fichier POST, le pr\xE9c\xE9dent projet sera sauv\xE9 avec celui-ci \xE0 la sauvegarde."))); + + + container.add(content1); + container.add(content2); + + + + final JButton valide = new JButton(TrResource.getS("Valider"), EbliResource.EBLI + .getIcon("crystal_valider")); + valide.addActionListener(new ActionListener() { + public void actionPerformed(final ActionEvent _e) { + dispose(); + //-- realisation des operations --// + if(!conservPreviousProject_) + projet_.getManager().clearProject(); + if(typePost_){ + projet_.getManager().loadProject(false, null); + }else{ + + //-- verification qu'il existe une fenetre layout dispo sinon creation --// + if(projet_.getImpl().getCurrentLayoutFille()==null){ + projet_.createNewLayoutFrame(); + } + //-- ouverture d'un fichier r\xE9sultat --// + TrPostActionChooseAndCreateCalque chooserSource= new TrPostActionChooseAndCreateCalque(projet_,projet_.getImpl().getCurrentLayoutFille().controller_); + chooserSource.actionPerformed(null); + + + + } + + } }); + + final JButton annule = new JButton(TrResource.getS("Annuler"), EbliResource.EBLI + .getIcon("crystal_annuler")); + annule.addActionListener(new ActionListener() { + public void actionPerformed(final ActionEvent _e) { + //--annulation --// + dispose(); + } + + }); + final JPanel operations = new JPanel(new FlowLayout(FlowLayout.CENTER)); + operations.add(valide); + operations.add(annule); + content.add(operations, BorderLayout.SOUTH); + + return content; + } + + + + +} Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjet.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjet.java 2009-01-05 15:46:50 UTC (rev 4322) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjet.java 2009-01-05 19:02:06 UTC (rev 4323) @@ -25,6 +25,7 @@ import javax.swing.JInternalFrame; import javax.swing.JMenu; +import javax.swing.JOptionPane; import javax.swing.JTable; import javax.swing.WindowConstants; import javax.swing.event.InternalFrameEvent; @@ -666,7 +667,24 @@ } }); + getMenuPost().addMenuItem(TrResource.getS(("Fusionner avec un autre projet POST")), "FUSIONPOST", + CtuluResource.CTULU.getIcon("crystal_ajouter"), new ActionListener() { + public void actionPerformed(final ActionEvent _e) { + + final int reponse = JOptionPane.showConfirmDialog(getImpl().getParentComponent(),TrResource.getS("Le projet courant va \xEAtre ferm\xE9. \n Voulez vous sauvegarder le projet courant avant sa fermeture?")); + if (reponse == JOptionPane.CANCEL_OPTION) { return; } + if (reponse == JOptionPane.OK_OPTION) { + getManager().saveProject(false); + } + + getManager().loadProject(false, null); + //-- on reinitialise le nom path du projet a null pour qu'il soit redemand\xE9 lors de la nouvelle sauvegarde --// + getManager().setProjet_(null); + + } + }); + getMenuPost().addSeparator(TrResource.getS("Gestion")); // -- ajout de l action de gestion des simus dans post --// final BuMenuItem item = new BuMenuItem(TrResource.getS("Gestion Multi-Fichiers r\xE9sultats")); Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/actions/TrPostActionOpenSrc.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/actions/TrPostActionOpenSrc.java 2009-01-05 15:46:50 UTC (rev 4322) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/actions/TrPostActionOpenSrc.java 2009-01-05 19:02:06 UTC (rev 4323) @@ -2,9 +2,13 @@ import java.awt.event.ActionEvent; import java.io.File; +import java.util.ArrayList; import java.util.Iterator; +import java.util.List; +import org.fudaa.ctulu.fileformat.FileFormat; import org.fudaa.ebli.commun.EbliActionSimple; +import org.fudaa.fudaa.tr.common.TrFileFormatManager; import org.fudaa.fudaa.tr.common.TrLib; import org.fudaa.fudaa.tr.common.TrResource; import org.fudaa.fudaa.tr.post.TrPostMultiSourceActivator; @@ -49,11 +53,19 @@ // --chargement du fichier source correspondant et ajout dans le projet // --// - final File fichierAbsolu = projet_.getImpl().ouvrirFileChooser(TrResource.getS("Fichier post"), null); + List<String> extensions=new ArrayList<String>(); + + FileFormat[] listeFormats= TrFileFormatManager.getAllGridFormat(); + + for(int i=0;i<listeFormats.length;i++) + for(int j=0;j<listeFormats[i].getExtensions().length;j++) + extensions.add(listeFormats[i].getExtensions()[j]); + + final File fichierAbsolu = projet_.getImpl().ouvrirFileChooser(TrResource.getS("S\xE9lectionnez le Fichier r\xE9sultat"), extensions.toArray(new String[extensions.size()])); // -- verification que le fichier n est pas deja ouvert --// if (projet_.isSourceLoaded(fichierAbsolu.getAbsolutePath())) { - projet_.getImpl().warn(TrLib.getString("Solution d\xE9j\xE0 charg\xE9e"), + projet_.getImpl().warn(TrLib.getString("Fichier r\xE9sultat d\xE9j\xE0 charg\xE9 dans le projet"), TrLib.getString("Le fichier source existe d\xE9j\xE0 et ne peut \xEAtre ajout\xE9 au projet.")); return; } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/persist/TrPostPersistenceManager.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/persist/TrPostPersistenceManager.java 2009-01-05 15:46:50 UTC (rev 4322) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/persist/TrPostPersistenceManager.java 2009-01-05 19:02:06 UTC (rev 4323) @@ -116,9 +116,17 @@ ProgressionInterface prog_; File projet_; - TrPostCommonImplementation ui_; + public File getProjet_() { + return projet_; +} +public void setProjet_(File projet_) { + this.projet_ = projet_; +} +TrPostCommonImplementation ui_; + + TrPostPersistanceErrorManager managerError=new TrPostPersistanceErrorManager(); @@ -629,6 +637,11 @@ if (trprojet_.isSourceLoaded(path)) { trprojet_.getImpl().warn(TrLib.getString("Solution d\xE9j\xE0 charg\xE9e"), TrLib.getString("Le fichier source existe d\xE9j\xE0 et ne peut \xEAtre ajout\xE9 au projet.")); + + //--ACHTUNG !!! --// + //-- mise a jour de l'ID necessaire afin de charger correctement la suite --// + trprojet_.findSource(path).setId(listeCouplesIdSources.get(i).IdSource); + } else { // -- tentative de chargement du source dans le multi-projet --// multiProjectActivator.active(f, trprojet_.impl_,listeCouplesIdSources.get(i).IdSource); @@ -642,6 +655,10 @@ if (trprojet_.isSourceLoaded(path)) { trprojet_.getImpl().warn(TrLib.getString("Solution d\xE9j\xE0 charg\xE9e"), TrLib.getString("Le fichier source existe d\xE9j\xE0 et ne peut \xEAtre ajout\xE9 au projet.")); + + //--ACHTUNG !!! --// + //-- mise a jour de l'ID necessaire afin de charger correctement la suite --// + trprojet_.findSource(path).setId(listeCouplesIdSources.get(i).IdSource); } else { // -- tentative de chargement du source dans le multi-projet --// multiProjectActivator.active(f, trprojet_.impl_, listeCouplesIdSources.get(i).IdSource); @@ -744,6 +761,9 @@ for (final JInternalFrame frame : trprojet_.getImpl().getAllInternalFrames()) { frame.dispose(); } + + //-- retire le nom de fichier du precedent projet POST --// + projet_=null; } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <emm...@us...> - 2009-01-05 15:46:54
|
Revision: 4322 http://fudaa.svn.sourceforge.net/fudaa/?rev=4322&view=rev Author: emmanuel_martin Date: 2009-01-05 15:46:50 +0000 (Mon, 05 Jan 2009) Log Message: ----------- Ajout de la visualisation de l'abscisse curviligne du profil sur l'axe hydraulique. 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/model/ProfilContainer.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/ProfilContainerAdapter.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/UtilsProfil1d.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/VueTableau.java Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/controller/Controller1d.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/controller/Controller1d.java 2009-01-05 15:05:39 UTC (rev 4321) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/controller/Controller1d.java 2009-01-05 15:46:50 UTC (rev 4322) @@ -306,8 +306,10 @@ MascaretWriter mascaretWriter=new MascaretWriter(); mascaretWriter.setFile(vueExport.getFile()); Bief bief=controllerBief_.getSelectedBief(); - if(bief==null) + if(bief==null) { + appli_.warn(FudaaLib.getS("Attention"), FudaaLib.getS("Il n'y a pas de bief \xE0 exporter.")); return; + } Object[] zones=new Object[]{bief.axeHydraulique_.getGeomData(), bief.lignesDirectrices_.getGeomData(), bief.limitesStockages_.getGeomData(), bief.profils_.getGeomData(), bief.rives_.getGeomData()}; MascaretWriter.FunctorSelectProfil functorSelectProfil=new MascaretWriter.FunctorSelectProfil() { Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/ProfilContainer.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/ProfilContainer.java 2009-01-05 15:05:39 UTC (rev 4321) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/ProfilContainer.java 2009-01-05 15:46:50 UTC (rev 4322) @@ -76,4 +76,7 @@ /** Supprime le point indiqu\xE9 en param\xE8tre. */ public void remove(int _idxPoint, CtuluCommandContainer _cmd) throws ProfilContainerException; + + /** Retourne l'abscisse curviligne du profil sur l'axe hydraulique. -1 si inexistant. */ + public double getAbsCurvProfilOnAxeHydraulique(); } Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/ProfilContainerAdapter.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/ProfilContainerAdapter.java 2009-01-05 15:05:39 UTC (rev 4321) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/ProfilContainerAdapter.java 2009-01-05 15:46:50 UTC (rev 4322) @@ -360,6 +360,13 @@ return UtilsProfil1d.abscisseCurviligne(getCoordSeq(), getValueOf(GISAttributeConstants.INTERSECTION_LIMITE_STOCKAGE_DROITE)); } + public double getAbsCurvProfilOnAxeHydraulique() { + if(idxProfilSelected_==-1||biefContainer_.getZoneAxeHydraulique().getNbGeometries()==0) + return -1; + return UtilsProfil1d.abscisseCurviligne(((GISCoordinateSequenceContainerInterface)biefContainer_.getZoneAxeHydraulique().getGeometry(0)) + .getCoordinateSequence(), getCoordSeq()); + } + public double getCurv(int _idxPoint) { if(curv_==null||_idxPoint<0||_idxPoint>=curv_.size()) throw new IllegalArgumentException("Cet index n'existe pas."); @@ -760,4 +767,5 @@ for(ProfilContainerListener listener:listeners_) listener.profilContainerSelectedChanged(_idxOldProfil, _idxNewProfil); } + } 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-05 15:05:39 UTC (rev 4321) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/UtilsProfil1d.java 2009-01-05 15:46:50 UTC (rev 4322) @@ -214,4 +214,16 @@ valueCurviligne+=_geom.getCoordinate(i).distance(_point); return valueCurviligne; } + + /** + * Retourne l'abscisse curviligne sur geom1 du croisement entre geom1 et geom2. + * Si les geometries ne se croisent pas ou se croisent en plusieurs endroits, -1 est retourn\xE9. + */ + static public double abscisseCurviligne(CoordinateSequence _geom1, CoordinateSequence _geom2){ + Geometry intersection=GISGeometryFactory.INSTANCE.createLineString(_geom1).intersection(GISGeometryFactory.INSTANCE.createLineString(_geom2)); + if(intersection.getNumPoints()!=1) + return -1; + else + return abscisseCurviligne(_geom1, intersection.getCoordinate()); + } } Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/VueTableau.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/VueTableau.java 2009-01-05 15:05:39 UTC (rev 4321) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/VueTableau.java 2009-01-05 15:46:50 UTC (rev 4322) @@ -9,6 +9,8 @@ import java.awt.Dimension; +import javax.swing.Box; +import javax.swing.BoxLayout; import javax.swing.JTable; import javax.swing.event.ListSelectionListener; import javax.swing.table.DefaultTableModel; @@ -22,6 +24,7 @@ import org.fudaa.fudaa.modeleur.modeleur1d.model.ProfilContainerListener; import com.memoire.bu.BuBorderLayout; +import com.memoire.bu.BuLabel; import com.memoire.bu.BuPanel; import com.memoire.bu.BuScrollPane; @@ -53,12 +56,25 @@ data_.addProfilContainerListener(this); } + /** + * Met \xE0 jour l'affichage de l'abscisse curviligne d + */ + private void updateAbscisseCurvAxeHydraulique() { + double abscCurv=data_.getAbsCurvProfilOnAxeHydraulique(); + if(abscCurv==-1) + lblAxeHydraulique_.setText(" - "); + else + lblAxeHydraulique_.setText(formater_.getXYFormatter().format(abscCurv)); + } + public void profilContainerDataModified() { fireTableDataChanged(); + updateAbscisseCurvAxeHydraulique(); } public void profilContainerSelectedChanged(int _idxOldProfil, int _idxNewProfil){ fireTableDataChanged(); + updateAbscisseCurvAxeHydraulique(); } public Class<?> getColumnClass(int columnIndex) { @@ -105,13 +121,22 @@ private JTable table_; /** Le model du tableau affich\xE9 par le panel. */ private DefaultTableModel modelTable_; + /** L'abscisse curviligne du profil sur l'axe hydraulique. */ + private BuLabel lblAxeHydraulique_=new BuLabel(); public VueTableau(Controller1d _controller, ProfilContainer _data){ controller_=_controller; setLayout(new BuBorderLayout(2, 2)); + // Tableau modelTable_=new TableGeomModel(_data, controller_.getFormater()); table_=new CtuluTable(modelTable_); - add(new BuScrollPane(table_)); + add(new BuScrollPane(table_), BuBorderLayout.CENTER); + // Abscisse curviligne du profil sur l'axe hydraulique + Box absCurv=new Box(BoxLayout.X_AXIS); + absCurv.add(new BuLabel(FudaaLib.getS("Abscisse Curviligne : "))); + absCurv.add(lblAxeHydraulique_); + add(absCurv, BuBorderLayout.SOUTH); + // Taille setPreferredSize(new Dimension(200, 200)); setSize(getPreferredSize()); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <emm...@us...> - 2009-01-05 15:05:44
|
Revision: 4321 http://fudaa.svn.sourceforge.net/fudaa/?rev=4321&view=rev Author: emmanuel_martin Date: 2009-01-05 15:05:39 +0000 (Mon, 05 Jan 2009) Log Message: ----------- Lors de l'export 1d le radioBox correspondant ?\195?\160 l'extension ?\195?\169crite est automatiquement selectionn?\195?\169e. 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/view/VueExport.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-05 12:46:28 UTC (rev 4320) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/controller/Controller1d.java 2009-01-05 15:05:39 UTC (rev 4321) @@ -306,6 +306,8 @@ MascaretWriter mascaretWriter=new MascaretWriter(); mascaretWriter.setFile(vueExport.getFile()); Bief bief=controllerBief_.getSelectedBief(); + if(bief==null) + return; Object[] zones=new Object[]{bief.axeHydraulique_.getGeomData(), bief.lignesDirectrices_.getGeomData(), bief.limitesStockages_.getGeomData(), bief.profils_.getGeomData(), bief.rives_.getGeomData()}; MascaretWriter.FunctorSelectProfil functorSelectProfil=new MascaretWriter.FunctorSelectProfil() { Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/VueExport.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/VueExport.java 2009-01-05 12:46:28 UTC (rev 4320) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/VueExport.java 2009-01-05 15:05:39 UTC (rev 4321) @@ -12,6 +12,8 @@ import javax.swing.ButtonGroup; import javax.swing.JPanel; +import javax.swing.event.DocumentEvent; +import javax.swing.event.DocumentListener; import org.fudaa.ctulu.CtuluLib; import org.fudaa.ctulu.CtuluLibFile; @@ -28,31 +30,46 @@ import com.memoire.bu.BuVerticalLayout; /** - * GUI de l'exporteur des donn\xE9es 1d. Il se contante de faire apparaitre un + * GUI de l'exporteur des donn\xE9es 1d. Il se contente de faire apparaitre une * fen\xEAtre modale (via la m\xE9thode 'run') puis met \xE0 disposition les * informations. Il ne fait aucun traitement par lui m\xEAme. * * @author Emmanuel MARTIN - * @version $Id:$ + * @version $Id$ */ public class VueExport extends CtuluDialogPanel { private CtuluFileChooserPanel fileChooser_; - private BuFileFilter[] filters_; private BuRadioButton mascaret1d_; private BuRadioButton mascaret2d_; private CtuluUI ui_; + private BuFileFilter filtre1d_; + private BuFileFilter filtre2d_; public VueExport(CtuluUI _ui) { ui_=_ui; - filters_=new BuFileFilter[]{new BuFileFilter("georef", FSigLib.getS("Fichier Mascaret"))}; + filtre1d_=new BuFileFilter("geo", FSigLib.getS("Fichier Mascaret 1d")); + filtre2d_=new BuFileFilter("georef", FSigLib.getS("Fichier Mascaret 2d")); setLayout(new BuVerticalLayout(5, true, true)); final String title=FSigLib.getS("Fichier d'exportation"); fileChooser_=new CtuluFileChooserPanel(title); fileChooser_.setAllFileFilter(false); fileChooser_.setWriteMode(true); - fileChooser_.setFilter(filters_); + fileChooser_.setFilter(new BuFileFilter[]{filtre1d_, filtre2d_}); + fileChooser_.getTf().getDocument().addDocumentListener(new DocumentListener(){ + private void updateRb() { + // Selection automatique du checkbox correspondant \xE0 l'extension + String name=fileChooser_.getTf().getText(); + if(filtre1d_.accept(name)) + mascaret1d_.setSelected(true); + else if(filtre2d_.accept(name)) + mascaret2d_.setSelected(true); + } + public void changedUpdate(DocumentEvent e) {updateRb();} + public void insertUpdate(DocumentEvent e) {updateRb();} + public void removeUpdate(DocumentEvent e) {updateRb();} + }); BuLabel lbFile=new BuLabel(title); JPanel pnFile=new JPanel(); @@ -93,14 +110,12 @@ setErrorText(CtuluLib.getS("Donnez un nom au fichier d'exportation")); return false; } - boolean bextok=false; - for (int i=0; i<filters_.length; i++) - if (filters_[i].accept(f)) - bextok=true; - if (!bextok) { + // Verification de l'extension + if(!filtre1d_.accept(f)&&!filtre2d_.accept(f)) { setErrorText(TrResource.getS("Le fichier choisi a une extension inconnue")); return false; } + // Verification de l'\xE9crasement if(f.exists()&&!ui_.question(CtuluLib.getS("Attention"), CtuluLib.getS("Le fichier {0} existe d\xE9j\xE0. Voulez-vous l'\xE9craser?", CtuluLibFile.getSansExtension(f.getName())))) return false; if (CtuluLibFile.getExtension(CtuluLibFile.getSansExtension(f.getName()))!=null) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bma...@us...> - 2009-01-05 12:46:41
|
Revision: 4320 http://fudaa.svn.sourceforge.net/fudaa/?rev=4320&view=rev Author: bmarchan Date: 2009-01-05 12:46:28 +0000 (Mon, 05 Jan 2009) Log Message: ----------- Regroupement des actions dans le menu contextuel par nature. Modified Paths: -------------- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlEditionManager.java 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-12-31 12:30:46 UTC (rev 4319) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlEditionManager.java 2009-01-05 12:46:28 UTC (rev 4320) @@ -70,6 +70,8 @@ EbliActionInterface[] actSuper=sceneEditor_.getActions(); if (actSuper!=null) acts.addAll(Arrays.asList(actSuper)); + acts.add(new SceneMoveInLayerAction((MdlSceneEditor)sceneEditor_, getPanel().getArbreCalqueModel())); + acts.add(null); acts.addAll(Arrays.asList(getEditAction())); acts.add(null); acts.add(new SceneJoinAction(sceneEditor_)); @@ -79,12 +81,13 @@ acts.add(new SceneRefinementAction((MdlSceneEditor)sceneEditor_)); acts.add(null); acts.add(new SceneInterpolationAction((MdlSceneEditor)sceneEditor_)); - acts.add(new SceneMoveInLayerAction((MdlSceneEditor)sceneEditor_, getPanel().getArbreCalqueModel())); acts.add(new SceneInvertAction((MdlSceneEditor)sceneEditor_)); acts.add(new SceneProjectionAction((MdlSceneEditor)sceneEditor_)); acts.add(new SceneProfilInterpolation((MdlSceneEditor)sceneEditor_)); acts.add(new SceneLinearisePolyligneAction((MdlSceneEditor) sceneEditor_)); + acts.add(null); acts.add(new SceneAbscisseCurviligneAction(this)); + acts.add(null); getSceneEditor().setActions(acts.toArray(new EbliActionAbstract[0])); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <emm...@us...> - 2008-12-31 12:30:50
|
Revision: 4319 http://fudaa.svn.sourceforge.net/fudaa/?rev=4319&view=rev Author: emmanuel_martin Date: 2008-12-31 12:30:46 +0000 (Wed, 31 Dec 2008) Log Message: ----------- Ajout de la visualisation des intersections rive et limites de stockage via les labels. Quelques autres modifications mineures. Modified Paths: -------------- 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/ProfilContainer.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/ProfilContainerAdapter.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/UtilsProfil1d.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/VueCourbe.java 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 2008-12-31 12:16:36 UTC (rev 4318) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/controller/ControllerBief.java 2008-12-31 12:30:46 UTC (rev 4319) @@ -84,9 +84,11 @@ // Ajout du bief biefSet_.addBief(calqueBief.getTitle(), modelsDuFutureBief.toArray(new ZModeleLigneBrisee[0]), null); } - // Selection d'office du premier Bief si il y en a un - if(biefSet_.getNbBief()>0&&selectedValue!=-1) + // 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); } /** 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 2008-12-31 12:16:36 UTC (rev 4318) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/Bief.java 2008-12-31 12:30:46 UTC (rev 4319) @@ -153,7 +153,7 @@ throw new IllegalArgumentException("Au moins un des profils est coup\xE9 plusieurs fois ou jamais."); idxAbsCurv[j]=new Object[]{j, UtilsProfil1d.abscisseCurviligne(seqAxeHydraulique, intersection.getCoordinate())}; } - // Tri en fonctino des abcsisses curvilignes + // Tri en fonction des abcsisses curvilignes Arrays.sort((Object[])idxAbsCurv, new Comparator<Object>(){ public int compare(Object o1, Object o2) { double absCurvO1=(Double)((Object[])o1)[1]; Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/ProfilContainer.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/ProfilContainer.java 2008-12-31 12:16:36 UTC (rev 4318) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/ProfilContainer.java 2008-12-31 12:30:46 UTC (rev 4319) @@ -44,6 +44,18 @@ /** Retourne la valeur minimal de z. */ public double getZMin(); + /** Retourne l'abscisse curviligne de l'intersection avec la rive gauche. -1 si inexistant. */ + public double getAbsCurvRiveGauche(); + + /** Retourne l'abscisse curviligne de l'intersection avec la rive droite. -1 si inexistant. */ + public double getAbsCurvRiveDroite(); + + /** Retourne l'abscisse curviligne de l'intersection avec la limite de stockage gauche. -1 si inexistant. */ + public double getAbsCurvLimiteStockageGauche(); + + /** Retourne l'abscisse curviligne de l'intersection avec la limite de stockage droite. -1 si inexistant. */ + public double getAbsCurvLimiteStockageDroite(); + /** * Enregistre l'abcisse curviligne du point indiqu\xE9 en param\xE8tre. * Ce changement d'abscisse curviligne fonctionne sur tout les points. Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/ProfilContainerAdapter.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/ProfilContainerAdapter.java 2008-12-31 12:16:36 UTC (rev 4318) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/ProfilContainerAdapter.java 2008-12-31 12:30:46 UTC (rev 4319) @@ -16,6 +16,8 @@ import org.fudaa.ctulu.CtuluListSelection; import org.fudaa.ctulu.CtuluNamedCommand; import org.fudaa.ctulu.collection.CtuluCollection; +import org.fudaa.ctulu.gis.GISAttributeConstants; +import org.fudaa.ctulu.gis.GISAttributeInterface; import org.fudaa.ctulu.gis.GISCoordinateSequenceContainerInterface; import org.fudaa.ctulu.gis.GISGeometryFactory; import org.fudaa.ctulu.gis.GISPolyligne; @@ -324,6 +326,40 @@ return biefContainer_.getZoneProfils().getGeometry(idxProfilSelected_).getNumPoints(); } + private Coordinate getValueOf(GISAttributeInterface attr_) { + int idxAtt=biefContainer_.getZoneProfils().getIndiceOf(attr_); + return (Coordinate) biefContainer_.getZoneProfils().getValue(idxAtt, idxProfilSelected_); + } + + private CoordinateSequence getCoordSeq() { + return ((GISCoordinateSequenceContainerInterface)biefContainer_.getZoneProfils().getGeometry(idxProfilSelected_)) + .getCoordinateSequence(); + } + + public double getAbsCurvRiveGauche() { + if(idxProfilSelected_==-1) + return -1; + return UtilsProfil1d.abscisseCurviligne(getCoordSeq(), getValueOf(GISAttributeConstants.INTERSECTION_RIVE_GAUCHE)); + } + + public double getAbsCurvRiveDroite() { + if(idxProfilSelected_==-1) + return -1; + return UtilsProfil1d.abscisseCurviligne(getCoordSeq(), getValueOf(GISAttributeConstants.INTERSECTION_RIVE_DROITE)); + } + + public double getAbsCurvLimiteStockageGauche() { + if(idxProfilSelected_==-1) + return -1; + return UtilsProfil1d.abscisseCurviligne(getCoordSeq(), getValueOf(GISAttributeConstants.INTERSECTION_LIMITE_STOCKAGE_GAUCHE)); + } + + public double getAbsCurvLimiteStockageDroite() { + if(idxProfilSelected_==-1) + return -1; + return UtilsProfil1d.abscisseCurviligne(getCoordSeq(), getValueOf(GISAttributeConstants.INTERSECTION_LIMITE_STOCKAGE_DROITE)); + } + public double getCurv(int _idxPoint) { if(curv_==null||_idxPoint<0||_idxPoint>=curv_.size()) throw new IllegalArgumentException("Cet index n'existe pas."); 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 2008-12-31 12:16:36 UTC (rev 4318) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/UtilsProfil1d.java 2008-12-31 12:30:46 UTC (rev 4319) @@ -162,7 +162,7 @@ * Retourne -2 si la coordonn\xE9e n'appartient pas \xE0 la g\xE9om\xE9trie. */ static public int getPreviousIndex(CoordinateSequence _geom, Coordinate _point) { - if(_geom.size()>0&&_point.equals(_geom.getCoordinate(0))) + if(_point==null||_geom.size()<=0||_point.equals(_geom.getCoordinate(0))) return -1; boolean fini=false; int i=-1; @@ -182,7 +182,7 @@ * Retourne -2 si la coordonn\xE9e n'appartient pas \xE0 la g\xE9om\xE9trie. */ static public int getNextIndex(CoordinateSequence _geom, Coordinate _point) { - if(_geom.size()>0&&_point.equals(_geom.getCoordinate(_geom.size()-1))) + if(_point==null||_geom.size()<=0||_point.equals(_geom.getCoordinate(_geom.size()-1))) return -1; boolean fini=false; int i=_geom.size()-1; Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/VueCourbe.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/VueCourbe.java 2008-12-31 12:16:36 UTC (rev 4318) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/VueCourbe.java 2008-12-31 12:30:46 UTC (rev 4319) @@ -82,11 +82,33 @@ data_.addProfilContainerListener(this); } + private void updateLabels() { + courbe_.removeLabels(); + // Rive gauche + double absCurv=data_.getAbsCurvRiveGauche(); + if(absCurv!=-1) + courbe_.addLabel(absCurv, "RG"); + // Rive droite + absCurv=data_.getAbsCurvRiveDroite(); + if(absCurv!=-1) + courbe_.addLabel(absCurv, "RD"); + // Limite stockage gauche + absCurv=data_.getAbsCurvLimiteStockageGauche(); + if(absCurv!=-1) + courbe_.addLabel(absCurv, "LG"); + // Limite stockage droite + absCurv=data_.getAbsCurvLimiteStockageDroite(); + if(absCurv!=-1) + courbe_.addLabel(absCurv, "LD"); + } + public void profilContainerDataModified() { + updateLabels(); grapheVue_.structureChanged(); } public void profilContainerSelectedChanged(int _idxOldProfil, int _idxNewProfil){ + updateLabels(); grapheVue_.structureChanged(); grapheVue_.restore(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <emm...@us...> - 2008-12-31 12:16:40
|
Revision: 4318 http://fudaa.svn.sourceforge.net/fudaa/?rev=4318&view=rev Author: emmanuel_martin Date: 2008-12-31 12:16:36 +0000 (Wed, 31 Dec 2008) Log Message: ----------- Ajout du support des labels sur les courbes. Modified Paths: -------------- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/courbe/EGCourbe.java Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/courbe/EGCourbe.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/courbe/EGCourbe.java 2008-12-30 17:02:04 UTC (rev 4317) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/courbe/EGCourbe.java 2008-12-31 12:16:36 UTC (rev 4318) @@ -18,14 +18,13 @@ import java.awt.Shape; import java.awt.Stroke; import java.beans.PropertyChangeListener; +import java.util.ArrayList; import java.util.Arrays; import java.util.List; import javax.swing.SwingConstants; import javax.swing.tree.TreeNode; -import com.vividsolutions.jts.geom.Envelope; - import org.fudaa.ctulu.CtuluLib; import org.fudaa.ctulu.CtuluLibArray; import org.fudaa.ctulu.CtuluLibGeometrie; @@ -33,7 +32,6 @@ import org.fudaa.ctulu.CtuluListSelectionInterface; import org.fudaa.ctulu.CtuluRange; import org.fudaa.ctulu.gui.CtuluLibSwing; - import org.fudaa.ebli.commun.EbliLib; import org.fudaa.ebli.controle.BConfigurableComposite; import org.fudaa.ebli.controle.BConfigurableInterface; @@ -51,6 +49,8 @@ import org.fudaa.ebli.trace.TraceLigne; import org.fudaa.ebli.trace.TraceLigneModel; +import com.vividsolutions.jts.geom.Envelope; + /** * Cette Courbe suppose que tous les x du mod\xE8le sont rang\xE9es dans l'ordre croissant. * @@ -387,6 +387,8 @@ final int minX = _t.getMinEcranX(); final int adjust = 3; _g.setClip(minX - adjust, 0, _t.getMaxEcranX() - minX + adjust * 2, _t.getH()); + // Dessin des labels + traceLabels(_g, _t); final int nbPt = model_.getNbValues(); double xi, yi, xie, yie; boolean xiVisible; @@ -441,6 +443,82 @@ traceTitle(_g, _t, rangeDisplayed); } + /** Cette list contient les labels a afficher. les paires contenus sont : [double x, String label]. */ + private List<Object[]> labels_=new ArrayList<Object[]>(); + + /** + * Ajout un label \xE0 la courbe. + * _label peut \xEAtre null. + */ + public void addLabel(double _x, String _label) { + if(_label==null) + _label=""; + labels_.add(new Object[]{_x, _label}); + } + + /** + * Retourne tous les labels sous la forme d'un tableau de paires (double x, String label). + */ + public Object[][] getLabels() { + return (Object[][]) labels_.toArray(); + } + + /** + * Supprime tous les labels ayant pour x _x. + */ + public void removeLabel(double _x) { + int i=-1; + while (++i<labels_.size()) + if ((Double)labels_.get(i)[0]==_x) + labels_.remove(i); + else + i++; + } + + /** + * Supprime tous les labels ayant pour label _label. + */ + public void removeLabel(String _label) { + int i=-1; + while (++i<labels_.size()) + if (((String)labels_.get(i)[1]).equals(_label)) + labels_.remove(i); + else + i++; + } + + /** + * Supprime tous les labels. + */ + public void removeLabels(){ + labels_.clear(); + } + + /** + * Dessine les labels configur\xE9s. Un label est repr\xE9sent\xE9 par une barre vertical (contrairement aux marks). + * @author Emmanuel Martin + */ + private void traceLabels(final Graphics2D _g, final EGRepere _t) { + // Configuration du traceur de boite + initTraceBox(); + tbox_.setColorBoite(tLigneMarqueur_.getCouleur()); + // Boucle sue les labels configur\xE9s + for (int i=0; i<labels_.size(); i++) { + int xLine=_t.getXEcran((Double) labels_.get(i)[0]); + // Dessin de la ligne verticale + getLineMarkeur().dessineTrait(_g, xLine, _t.getMinEcranY(), xLine, _t.getMaxEcranY()); + // Dessin de la boite et du label + int xBox; + if(xLine==_t.getMinEcranX()) + xBox=xLine; + else if(xLine==_t.getMaxEcranX()) + xBox=xLine-_g.getFontMetrics().stringWidth((String) labels_.get(i)[1])-3; + else + xBox=xLine-_g.getFontMetrics().stringWidth((String) labels_.get(i)[1])/2-2; + tbox_.paintBox(_g, xBox, _t.getMinEcranY(), (String) labels_.get(i)[1]); + } + } + public void enDernier() { getEGParent().enDernier(this); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <emm...@us...> - 2008-12-30 17:02:15
|
Revision: 4317 http://fudaa.svn.sourceforge.net/fudaa/?rev=4317&view=rev Author: emmanuel_martin Date: 2008-12-30 17:02:04 +0000 (Tue, 30 Dec 2008) Log Message: ----------- correction du test unitaire Added Paths: ----------- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/test/testModeleur1d/TestProfilContainerAdapter.java Removed Paths: ------------- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/test/testModeleur1d/TestDataGeometryAdapter.java Deleted: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/test/testModeleur1d/TestDataGeometryAdapter.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/test/testModeleur1d/TestDataGeometryAdapter.java 2008-12-30 15:19:53 UTC (rev 4316) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/test/testModeleur1d/TestDataGeometryAdapter.java 2008-12-30 17:02:04 UTC (rev 4317) @@ -1,914 +0,0 @@ -/* - * @creation 16 d\xE9c. 2008 - * @modification $Date:$ - * @license GNU General Public License 2 - * @copyright (c)1998-2008 CETMEF 2 bd Gambetta F-60231 Compiegne - * @mail fud...@li... - */ -package testModeleur1d; - -import junit.framework.TestCase; - -import org.fudaa.ctulu.gis.GISAttributeConstants; -import org.fudaa.ctulu.gis.GISAttributeInterface; -import org.fudaa.ctulu.gis.GISGeometryFactory; -import org.fudaa.ctulu.gis.GISPolyligne; -import org.fudaa.ctulu.gis.GISZoneCollectionLigneBrisee; -import org.fudaa.fudaa.modeleur.modeleur1d.model.DataGeometryAdapter; -import org.fudaa.fudaa.modeleur.modeleur1d.model.DataGeometryException; -import org.fudaa.fudaa.modeleur.modeleur1d.model.DataGeometryListener; - -import com.vividsolutions.jts.geom.Coordinate; - -/** - * Test pour DataGeometryAdapter. - * @author Emmanuel MARTIN - * @version $Id$ - */ -public class TestDataGeometryAdapter extends TestCase { - - /** Tolerance pour les comparaisons de doubles. */ - private double tolerance=0.000001; - private DataGeometryAdapter geomAdapter_; - private GISZoneCollectionLigneBrisee zone0_; - private GISZoneCollectionLigneBrisee zone1_; - private GISZoneCollectionLigneBrisee zone3_; - private GISZoneCollectionLigneBrisee zone4_; - private GISZoneCollectionLigneBrisee zone5_; - private GISZoneCollectionLigneBrisee zone6_; - - /* - * (non-Javadoc) - * - * @see junit.framework.TestCase#setUp() - */ - @Override - protected void setUp() throws Exception { - super.setUp(); - geomAdapter_=new DataGeometryAdapter(null, -1); - // Zone6_ \\ - // Attribut z non d\xE9fini - zone6_=new GISZoneCollectionLigneBrisee(); - zone6_.setAttributes(new GISAttributeInterface[]{GISAttributeConstants.BATHY}, null); - zone6_.addPolyligne(GISGeometryFactory.INSTANCE.getCoordinateSequenceFactory().create( - new Coordinate[]{new Coordinate(0, 0, 0), new Coordinate(-10, -20, -20), - new Coordinate(50, 10, 10)}), null, null); - // Zone0_ \\ - // Quelconque - zone0_=new GISZoneCollectionLigneBrisee(); - zone0_.setAttributes(new GISAttributeInterface[]{GISAttributeConstants.BATHY}, null); - zone0_.setAttributeIsZ(GISAttributeConstants.BATHY); - zone0_.addPolyligne(GISGeometryFactory.INSTANCE.getCoordinateSequenceFactory().create( - new Coordinate[]{new Coordinate(0, 0, 0), new Coordinate(-10, -20, -20), - new Coordinate(50, 10, 10)}), null, null); - // Zone1_ \\ - // Quelconque - zone1_=new GISZoneCollectionLigneBrisee(); - zone1_.setAttributes(new GISAttributeInterface[]{GISAttributeConstants.BATHY}, null); - zone1_.setAttributeIsZ(GISAttributeConstants.BATHY); - zone1_.addPolyligne(GISGeometryFactory.INSTANCE.getCoordinateSequenceFactory() - .create( - new Coordinate[]{new Coordinate(8, 6, 0), new Coordinate(5.052590034554651, 6.559262456806686, 0), - new Coordinate(3, 2, 0)}), null, null); - // Zone3_ \\ - // Quelconque - zone3_=new GISZoneCollectionLigneBrisee(); - zone3_.setAttributes(new GISAttributeInterface[]{GISAttributeConstants.BATHY}, null); - zone3_.setAttributeIsZ(GISAttributeConstants.BATHY); - zone3_.addPolyligne(GISGeometryFactory.INSTANCE.getCoordinateSequenceFactory().create( - new Coordinate[]{new Coordinate(0, 0, 0), new Coordinate(-10, -20, -20), new Coordinate(50, 10, 10), - new Coordinate(30, 5, 5), new Coordinate(10, 0, 0)}), null, null); - zone3_.addPolyligne(GISGeometryFactory.INSTANCE.getCoordinateSequenceFactory().create( - new Coordinate[]{new Coordinate(5, 0, 0), new Coordinate(-15, -20, -20), new Coordinate(55, 10, 10), - new Coordinate(35, 5, -20), new Coordinate(15, 0, -20)}), null, null); - // zone4_ \\ - zone4_=new GISZoneCollectionLigneBrisee(); - zone4_.setAttributes(new GISAttributeInterface[]{GISAttributeConstants.BATHY}, null); - zone4_.setAttributeIsZ(GISAttributeConstants.BATHY); - // 0 : Points confondus - zone4_.addPolyligne(GISGeometryFactory.INSTANCE.getCoordinateSequenceFactory().create( - new Coordinate[]{new Coordinate(0, 0, 0), new Coordinate(-10, -20, -20), new Coordinate(-10, -20, -20), - new Coordinate(-20, -40, -40), new Coordinate(-30, -60, -60)}), null, null); - // 1 : nb ruptures > 2 - zone4_.addPolyligne(GISGeometryFactory.INSTANCE.getCoordinateSequenceFactory().create( - new Coordinate[]{new Coordinate(0, 0, 0), new Coordinate(10, 20, 5), new Coordinate(11, 100, 8), new Coordinate(41, 5, 9), new Coordinate(41, 0, 8)}), null, null); - // 2 : nb ruptures = 1 - zone4_.addPolyligne(GISGeometryFactory.INSTANCE.getCoordinateSequenceFactory().create( - new Coordinate[]{new Coordinate(0, 0, 0), new Coordinate(11, 100, 8), new Coordinate(12, 101, 10), new Coordinate(13, 102, -5)}), null, null); - // 3 : nb ruptures = 0 - zone4_.addPolyligne(GISGeometryFactory.INSTANCE.getCoordinateSequenceFactory().create( - new Coordinate[]{new Coordinate(0, 0, 0), new Coordinate(10, 20, 5), new Coordinate(20, 40, 8)}), null, null); - // 4 : nb ruptures = 2 - zone4_.addPolyligne(GISGeometryFactory.INSTANCE.getCoordinateSequenceFactory().create( - new Coordinate[]{new Coordinate(10, 10, 0), new Coordinate(20, 10, 5), new Coordinate(20, 20, 8), new Coordinate(25, 20, 8), new Coordinate(30, 20, 8)}), null, null); - // 5 : axes crois\xE9s - zone4_.addPolyligne(GISGeometryFactory.INSTANCE.getCoordinateSequenceFactory().create( - new Coordinate[]{new Coordinate(10, 10, 0), new Coordinate(20, 10, 5), new Coordinate(20, 20, 8), new Coordinate(10, 5, 8)}), null, null); - // Zone5_ \\ - zone5_=new GISZoneCollectionLigneBrisee(); - zone5_.setAttributes(new GISAttributeInterface[]{GISAttributeConstants.BATHY}, null); - zone5_.setAttributeIsZ(GISAttributeConstants.BATHY); - // 0 : 2 points align\xE9s (cas g\xE9n\xE9ral) - zone5_.addPolyligne(GISGeometryFactory.INSTANCE.getCoordinateSequenceFactory().create( - new Coordinate[]{new Coordinate(0, 0, 0), new Coordinate(10, 5, -4)}), null, null); - // 1 : 2 points align\xE9s parall\xE8le \xE0 l'axe des X - zone5_.addPolyligne(GISGeometryFactory.INSTANCE.getCoordinateSequenceFactory().create( - new Coordinate[]{new Coordinate(5, 10, 3), new Coordinate(20, 10, -7)}), null, null); - // 2 : 2 points align\xE9s parall\xE8le \xE0 l'axe des Y - zone5_.addPolyligne(GISGeometryFactory.INSTANCE.getCoordinateSequenceFactory().create( - new Coordinate[]{new Coordinate(5, 0, 0), new Coordinate(5, 10, 88)}), null, null); - // 3 : 3 points align\xE9s (cas g\xE9n\xE9ral) - zone5_.addPolyligne(GISGeometryFactory.INSTANCE.getCoordinateSequenceFactory().create( - new Coordinate[]{new Coordinate(0, 0, -2), new Coordinate(11, 5, 7), new Coordinate(16.5, 7.5, 0)}), null, null); - // 4 : 3 points align\xE9s parall\xE8le \xE0 l'axe des X - zone5_.addPolyligne(GISGeometryFactory.INSTANCE.getCoordinateSequenceFactory().create( - new Coordinate[]{new Coordinate(-5, 10, 3), new Coordinate(20, 10, 6), new Coordinate(20.4, 10, 2)}), null, null); - // 5 : 3 points align\xE9s parall\xE8le \xE0 l'axe des Y - zone5_.addPolyligne(GISGeometryFactory.INSTANCE.getCoordinateSequenceFactory().create( - new Coordinate[]{new Coordinate(-5, 10, 8), new Coordinate(-5, -2, -2), new Coordinate(-5, -50, 50)}), null, null); - // 6 : 4 points align\xE9s (cas g\xE9n\xE9ral) - zone5_.addPolyligne(GISGeometryFactory.INSTANCE.getCoordinateSequenceFactory().create( - new Coordinate[]{new Coordinate(1, 1, 0), new Coordinate(2, 1, 3), new Coordinate(8, 5, -9), new Coordinate(40, 25, 99)}), null, null); - // 7 : 4 points align\xE9s parall\xE8le \xE0 l'axe des X - zone5_.addPolyligne(GISGeometryFactory.INSTANCE.getCoordinateSequenceFactory().create( - new Coordinate[]{new Coordinate(1, 2.56, -2), new Coordinate(10, 2.56, 0), new Coordinate(99, 2.56, 84), new Coordinate(100.5, 2.56, 100)}), null, null); - // 8 : 4 points align\xE9s parall\xE8le \xE0 l'axe des Y - zone5_.addPolyligne(GISGeometryFactory.INSTANCE.getCoordinateSequenceFactory().create( - new Coordinate[]{new Coordinate(-9.1, 88, 0), new Coordinate(-9.1, 50, 8), new Coordinate(-9.1, 0, -87), new Coordinate(-9.1, -10, -10)}), null, null); - // 9 : 3 points avec un point de rupture - zone5_.addPolyligne(GISGeometryFactory.INSTANCE.getCoordinateSequenceFactory().create( - new Coordinate[]{new Coordinate(0, 0, 0), new Coordinate(10, 5, 2), new Coordinate(10, -5, 9)}), null, null); - // 10 : 4 points avec un point de rupture (deux points sur le premier axe) - zone5_.addPolyligne(GISGeometryFactory.INSTANCE.getCoordinateSequenceFactory().create( - new Coordinate[]{new Coordinate(0, 0, -2), new Coordinate(11, 5, 7), new Coordinate(16.5, 7.5, 0), new Coordinate(50, 60, 70)}), null, null); - // 11 : 5 points avec un point de rupture (deux points sur chaque axe) - zone5_.addPolyligne(GISGeometryFactory.INSTANCE.getCoordinateSequenceFactory().create( - new Coordinate[]{new Coordinate(0, 0, -2), new Coordinate(11, 5, 7), new Coordinate(16.5, 7.5, 0), new Coordinate(33, 3.75, 9), new Coordinate(11, 1.25, 9)}), null, null); - // 12 : 4 points avec deux points de ruptures - zone5_.addPolyligne(GISGeometryFactory.INSTANCE.getCoordinateSequenceFactory().create( - new Coordinate[]{new Coordinate(0, 0, 0), new Coordinate(10, 5, 2), new Coordinate(10, -5, 9), new Coordinate(20, 0, 0)}), null, null); - // 13 : 5 points avec deux points de ruptures (deux points sur le premier axe) - zone5_.addPolyligne(GISGeometryFactory.INSTANCE.getCoordinateSequenceFactory().create( - new Coordinate[]{new Coordinate(0, 0, 0), new Coordinate(5, 2.5, 88), new Coordinate(10, 5, 2), new Coordinate(10, -5, 9), new Coordinate(20, 0, 0)}), null, null); - // 14 : 6 points avec deux points de ruptures (deux points sur les deux premiers axes) - zone5_.addPolyligne(GISGeometryFactory.INSTANCE.getCoordinateSequenceFactory().create( - new Coordinate[]{new Coordinate(0, 0, 0), new Coordinate(5, 2.5, 88), new Coordinate(10, 5, 2), new Coordinate(10, 0, 44), new Coordinate(10, -5, 9), new Coordinate(20, 0, 0)}), null, null); - // 15 : 7 points avec deux points de ruptures (deux points sur chacun des axes) - zone5_.addPolyligne(GISGeometryFactory.INSTANCE.getCoordinateSequenceFactory().create( - new Coordinate[]{new Coordinate(0, 0, 0), new Coordinate(5, 2.5, 88), new Coordinate(10, 5, 2), new Coordinate(10, 0, 44), new Coordinate(10, -5, 9), new Coordinate(15, -2.5, 2), new Coordinate(20, 0, 0)}), null, null); - // 16 : 10 points avec deux points de ruptures (trois points sur chacun des axes) - zone5_.addPolyligne(GISGeometryFactory.INSTANCE.getCoordinateSequenceFactory().create( - new Coordinate[]{new Coordinate(0, 0, 0), new Coordinate(2.5, 1.25, 44), new Coordinate(5, 2.5, 88), new Coordinate(10, 5, 2), new Coordinate(10, 0, 44), new Coordinate(10, -2, 0), new Coordinate(10, -5, 9), new Coordinate(10/2., -5/2., 2), new Coordinate(10/4., -5/4., 0), new Coordinate(10/8., -5/8., 0)}), null, null); - // 17 : 3 points avec un point de rupture et le premier et le dernier points sont sur le m\xEAme axe des y - zone5_.addPolyligne(GISGeometryFactory.INSTANCE.getCoordinateSequenceFactory().create( - new Coordinate[]{new Coordinate(5, 5, -9), new Coordinate(10, 10, 0), new Coordinate(5, 20, 0)}), null, null); - // 18 : 3 points avec un point de rupture et le premier et le dernier points sont sur le m\xEAme axe des x - zone5_.addPolyligne(GISGeometryFactory.INSTANCE.getCoordinateSequenceFactory().create( - new Coordinate[]{new Coordinate(5, 5, -9), new Coordinate(10, 10, 0), new Coordinate(20, 5, 0)}), null, null); - } - - public void testDataGeometryAdapter() throws IllegalArgumentException, DataGeometryException { - // Points confondus - try { - new DataGeometryAdapter(zone4_, 0); - fail(); - } - catch (IllegalArgumentException _exc) { - fail(); - } - catch (DataGeometryException _exc) {} - // nb points > 2 - try { - new DataGeometryAdapter(zone4_, 1); - fail(); - } - catch (IllegalArgumentException _exc) { - fail(); - } - catch (DataGeometryException _exc) {} - // nb ruptures = 1 - try { - new DataGeometryAdapter(zone4_, 2); - } - catch (IllegalArgumentException _exc) { - fail(); - } - catch (DataGeometryException _exc) { - fail(); - } - // nb ruptures = 0 - try { - new DataGeometryAdapter(zone4_, 3); - } - catch (IllegalArgumentException _exc) { - fail(); - } - catch (DataGeometryException _exc) { - fail(); - } - // nb ruptures = 2 - try { - new DataGeometryAdapter(zone4_, 4); - } - catch (IllegalArgumentException _exc) { - fail(); - } - catch (DataGeometryException _exc) { - fail(); - } - // axes crois\xE9s - try { - new DataGeometryAdapter(zone4_, 5); - fail(); - } - catch (IllegalArgumentException _exc) { - fail(); - } - catch (DataGeometryException _exc) { - } - // aguments invalide - geomAdapter_=new DataGeometryAdapter(null, -1); - assertNull(geomAdapter_.getGISZoneCollection()); - assertEquals(-1, geomAdapter_.getIdxGeom()); - // aguments invalide - try { - geomAdapter_=new DataGeometryAdapter(null, 0); - fail(); - } - catch (IllegalArgumentException _exc) { - assertNull(geomAdapter_.getGISZoneCollection()); - assertEquals(-1, geomAdapter_.getIdxGeom()); - } - catch (DataGeometryException _exc) { - fail(); - } - // aguments invalide - try { - geomAdapter_=new DataGeometryAdapter(null, 1); - fail(); - } - catch (IllegalArgumentException _exc) { - assertNull(geomAdapter_.getGISZoneCollection()); - assertEquals(-1, geomAdapter_.getIdxGeom()); - } - catch (DataGeometryException _exc) { - fail(); - } - // aguments invalide - try { - geomAdapter_=new DataGeometryAdapter(zone4_, -1); - fail(); - } - catch (IllegalArgumentException _exc) { - assertNull(geomAdapter_.getGISZoneCollection()); - assertEquals(-1, geomAdapter_.getIdxGeom()); - } - catch (DataGeometryException _exc) { - fail(); - } - // aguments invalide - try { - geomAdapter_=new DataGeometryAdapter(zone4_, -10); - fail(); - } - catch (IllegalArgumentException _exc) { - assertNull(geomAdapter_.getGISZoneCollection()); - assertEquals(-1, geomAdapter_.getIdxGeom()); - } - catch (DataGeometryException _exc) { - fail(); - } - // aguments invalide - try { - geomAdapter_=new DataGeometryAdapter(zone4_, zone4_.getNbGeometries()); - fail(); - } - catch (IllegalArgumentException _exc) { - assertNull(geomAdapter_.getGISZoneCollection()); - assertEquals(-1, geomAdapter_.getIdxGeom()); - } - catch (DataGeometryException _exc) { - fail(); - } - // aguments invalide - try { - geomAdapter_=new DataGeometryAdapter(zone4_, zone4_.getNbGeometries()+1); - fail(); - } - catch (IllegalArgumentException _exc) { - assertNull(geomAdapter_.getGISZoneCollection()); - assertEquals(-1, geomAdapter_.getIdxGeom()); - } - catch (DataGeometryException _exc) { - fail(); - } - // aguments valide - try { - new DataGeometryAdapter(zone3_, zone3_.getNbGeometries()-1); - } - catch (IllegalArgumentException _exc) { - fail(); - } - catch (DataGeometryException _exc) { - fail(); - } - } - - public void testSetData() throws IllegalArgumentException, DataGeometryException { - // Zone sans attribut Z d\xE9fini - try{ - geomAdapter_.setData(zone6_, 0); - } - catch (DataGeometryException _exc) { - fail(); - } - catch(IllegalArgumentException _exc){} - // Points confondus - try { - new DataGeometryAdapter(zone4_, 0); - fail(); - } - catch (IllegalArgumentException _exc) { - fail(); - } - catch (DataGeometryException _exc) {} - // nb points > 2 - try { - new DataGeometryAdapter(zone4_, 1); - fail(); - } - catch (IllegalArgumentException _exc) { - fail(); - } - catch (DataGeometryException _exc) {} - // nb ruptures = 1 - try { - new DataGeometryAdapter(zone4_, 2); - } - catch (IllegalArgumentException _exc) { - fail(); - } - catch (DataGeometryException _exc) { - fail(); - } - // nb ruptures = 0 - try { - new DataGeometryAdapter(zone4_, 3); - } - catch (IllegalArgumentException _exc) { - fail(); - } - catch (DataGeometryException _exc) { - fail(); - } - // nb ruptures = 2 - try { - new DataGeometryAdapter(zone4_, 4); - } - catch (IllegalArgumentException _exc) { - fail(); - } - catch (DataGeometryException _exc) { - fail(); - } - // axes crois\xE9s - try { - new DataGeometryAdapter(zone4_, 5); - fail(); - } - catch (IllegalArgumentException _exc) { - fail(); - } - catch (DataGeometryException _exc) { - } - // aguments invalide - geomAdapter_=new DataGeometryAdapter(null, -1); - assertNull(geomAdapter_.getGISZoneCollection()); - assertEquals(-1, geomAdapter_.getIdxGeom()); - // aguments invalide - try { - geomAdapter_=new DataGeometryAdapter(null, 0); - fail(); - } - catch (IllegalArgumentException _exc) { - assertNull(geomAdapter_.getGISZoneCollection()); - assertEquals(-1, geomAdapter_.getIdxGeom()); - } - catch (DataGeometryException _exc) { - fail(); - } - // aguments invalide - try { - geomAdapter_=new DataGeometryAdapter(null, 1); - fail(); - } - catch (IllegalArgumentException _exc) { - assertNull(geomAdapter_.getGISZoneCollection()); - assertEquals(-1, geomAdapter_.getIdxGeom()); - } - catch (DataGeometryException _exc) { - fail(); - } - // aguments invalide - try { - geomAdapter_=new DataGeometryAdapter(zone4_, -1); - fail(); - } - catch (IllegalArgumentException _exc) { - assertNull(geomAdapter_.getGISZoneCollection()); - assertEquals(-1, geomAdapter_.getIdxGeom()); - } - catch (DataGeometryException _exc) { - fail(); - } - // aguments invalide - try { - geomAdapter_=new DataGeometryAdapter(zone4_, -10); - fail(); - } - catch (IllegalArgumentException _exc) { - assertNull(geomAdapter_.getGISZoneCollection()); - assertEquals(-1, geomAdapter_.getIdxGeom()); - } - catch (DataGeometryException _exc) { - fail(); - } - // aguments invalide - try { - geomAdapter_=new DataGeometryAdapter(zone4_, zone4_.getNbGeometries()); - fail(); - } - catch (IllegalArgumentException _exc) { - assertNull(geomAdapter_.getGISZoneCollection()); - assertEquals(-1, geomAdapter_.getIdxGeom()); - } - catch (DataGeometryException _exc) { - fail(); - } - // aguments invalide - try { - geomAdapter_=new DataGeometryAdapter(zone4_, zone4_.getNbGeometries()+1); - fail(); - } - catch (IllegalArgumentException _exc) { - assertNull(geomAdapter_.getGISZoneCollection()); - assertEquals(-1, geomAdapter_.getIdxGeom()); - } - catch (DataGeometryException _exc) { - fail(); - } - // aguments valide - try { - new DataGeometryAdapter(zone3_, zone3_.getNbGeometries()-1); - } - catch (IllegalArgumentException _exc) { - fail(); - } - catch (DataGeometryException _exc) { - fail(); - } - } - - public void testGetGISZoneCollection() throws IllegalArgumentException, DataGeometryException { - geomAdapter_.setData(zone0_, 0); - assertEquals(zone0_, geomAdapter_.getGISZoneCollection()); - geomAdapter_.setData(zone1_, 0); - assertEquals(zone1_, geomAdapter_.getGISZoneCollection()); - geomAdapter_.setData(null, -1); - assertEquals(null, geomAdapter_.getGISZoneCollection()); - } - - public void testGetIdxGeom() throws IllegalArgumentException, DataGeometryException { - geomAdapter_.setData(zone0_, 0); - assertEquals(0, geomAdapter_.getIdxGeom()); - geomAdapter_.setData(zone3_, 0); - assertEquals(0, geomAdapter_.getIdxGeom()); - geomAdapter_.setData(zone3_, 1); - assertEquals(1, geomAdapter_.getIdxGeom()); - geomAdapter_.setData(null, -1); - assertEquals(-1, geomAdapter_.getIdxGeom()); - geomAdapter_.setData(zone0_, zone0_.getNbGeometries()-1); - assertEquals(zone0_.getNbGeometries()-1, geomAdapter_.getIdxGeom()); - } - - public void testGetNbPoint() throws IllegalArgumentException, DataGeometryException { - geomAdapter_.setData(zone0_, 0); - assertEquals(3, geomAdapter_.getNbPoint()); - geomAdapter_.setData(zone1_, 0); - assertEquals(3, geomAdapter_.getNbPoint()); - geomAdapter_.setData(zone3_, 0); - assertEquals(5, geomAdapter_.getNbPoint()); - geomAdapter_.setData(zone3_, 1); - assertEquals(5, geomAdapter_.getNbPoint()); - geomAdapter_.setData(null, -1); - assertEquals(0, geomAdapter_.getNbPoint()); - } - - public void testGetCurv() throws IllegalArgumentException, DataGeometryException { - // Cas limits - geomAdapter_.setData(null, -1); - try { - geomAdapter_.getCurv(0); - fail(); - } - catch (IllegalArgumentException _exc) {} - geomAdapter_.setData(zone0_, 0); - try { - geomAdapter_.getCurv(-1); - fail(); - } - catch (IllegalArgumentException _exc) {} - try { - geomAdapter_.getCurv(-5); - fail(); - } - catch (IllegalArgumentException _exc) {} - try { - geomAdapter_.getCurv(geomAdapter_.getNbPoint()); - fail(); - } - catch (IllegalArgumentException _exc) {} - // Cas g\xE9n\xE9rals - assertEquals(0, geomAdapter_.getCurv(0), tolerance); - assertEquals(Math.sqrt(10*10+20*20), geomAdapter_.getCurv(1), tolerance); - assertEquals(Math.sqrt(10*10+20*20)+Math.sqrt((50+10)*(50+10)+(10+20)*(10+20)), geomAdapter_.getCurv(2), tolerance); - } - - public void testGetZ() throws IllegalArgumentException, DataGeometryException { - geomAdapter_.setData(zone0_, 0); - assertEquals(0, geomAdapter_.getZ(0), tolerance); - assertEquals(-20, geomAdapter_.getZ(1), tolerance); - assertEquals(10, geomAdapter_.getZ(2), tolerance); - geomAdapter_.setData(null, -1); - try { - geomAdapter_.getZ(0); - fail(); - } - catch(IllegalArgumentException ex){} - geomAdapter_.setData(zone0_, 0); - try { - geomAdapter_.getZ(-1); - fail(); - } - catch (IllegalArgumentException _exc) { - } - geomAdapter_.setData(zone0_, 0); - try { - geomAdapter_.getZ(100); - fail(); - } - catch (IllegalArgumentException _exc) { - } - } - - public void testSetCurv() throws Exception { - // Cas limits - geomAdapter_.setData(null, -1); - try{ - geomAdapter_.setCurv(0, 0, null); - fail(); - } - catch(IllegalArgumentException _exc) {} - try{ - geomAdapter_.setCurv(-1, 0, null); - fail(); - } - catch(IllegalArgumentException _exc) {} - geomAdapter_.setData(zone1_, 0); - try{ - geomAdapter_.setCurv(-1, 0, null); - fail(); - } - catch(IllegalArgumentException _exc) {} - try{ - geomAdapter_.setCurv(zone1_.getGeometry(0).getNumPoints(), 0, null); - fail(); - } - catch(IllegalArgumentException _exc) {} - try{ - geomAdapter_.setCurv(zone1_.getGeometry(0).getNumPoints()+1, 0, null); - fail(); - } - catch(IllegalArgumentException _exc) {} - // Une abcisse curviligne peut \xEAtre donn\xE9 pour le premier point, seulement pour lui - geomAdapter_.setData(zone5_, 0); - try{ - geomAdapter_.setCurv(0, -1, null); - } - catch(Exception exc){ - fail(); - } - try{ - geomAdapter_.setCurv(1, -1, null); - fail(); - } - catch(DataGeometryException exc){} - try{ - geomAdapter_.setCurv(geomAdapter_.getNbPoint()-1, -1, null); - fail(); - } - catch(DataGeometryException exc){} - setUp(); - // Test sur le d\xE9placement d'un point au del\xE0 d'un autre ou au niveau d'un autre - geomAdapter_.setData(zone5_, 0); - try{ - geomAdapter_.setCurv(0, Math.sqrt(10*10+5*5)+1, null); - fail(); - } - catch(DataGeometryException exc){} - try{ - geomAdapter_.setCurv(1, 0, null); - fail(); - } - catch(DataGeometryException exc){} - geomAdapter_.setData(zone5_, 6); - try{ - geomAdapter_.setCurv(2, geomAdapter_.getCurv(1)-0.1, null); - fail(); - } - catch(DataGeometryException exc){} - geomAdapter_.setData(zone5_, 11); - try{ // Tentative de se placer sur un point de rupture - geomAdapter_.setCurv(3, geomAdapter_.getCurv(2), null); - fail(); - } - catch(DataGeometryException exc){} - try{ // Tentative d'un point de rupture de d\xE9pacer un point adjacent - geomAdapter_.setCurv(2, geomAdapter_.getCurv(3)+1, null); - fail(); - } - catch(DataGeometryException exc){} - - // D\xE9placement des points extr\xE9mit\xE9s \\ - // Cas g\xE9n\xE9ral, d\xE9placement d\xE9but - geomAdapter_.setData(zone5_, 0); - double curvOld=geomAdapter_.getCurv(1); - geomAdapter_.setCurv(0, Math.sqrt(5*5+2.5*2.5), null); - assertEquals(curvOld-Math.sqrt(5*5+2.5*2.5), geomAdapter_.getCurv(1), tolerance); - assertEquals(5, zone5_.getGeometry(0).getCoordinates()[0].x, tolerance); - assertEquals(2.5, zone5_.getGeometry(0).getCoordinates()[0].y, tolerance); - setUp(); - // Cas g\xE9n\xE9ral, d\xE9placement fin avec point de ruptures - geomAdapter_.setData(zone5_, 16); - curvOld=geomAdapter_.getCurv(9); - geomAdapter_.setCurv(9, geomAdapter_.getCurv(8)+Math.sqrt((10/4.-10/16.)*(10/4.-10/16.)+(-5/4.+5/16.)*(-5/4.+5/16.)), null); - assertEquals(geomAdapter_.getCurv(8)+Math.sqrt((10/4.-10/16.)*(10/4.-10/16.)+(-5/4.+5/16.)*(-5/4.+5/16.)), geomAdapter_.getCurv(9), tolerance); - assertEquals(10/16., zone5_.getGeometry(16).getCoordinates()[9].x, tolerance); - assertEquals(-5/16., zone5_.getGeometry(16).getCoordinates()[9].y, tolerance); - setUp(); - // Cas particulier parall\xE8le \xE0 l'axe des x - geomAdapter_.setData(zone5_, 1); - curvOld=geomAdapter_.getCurv(1); - geomAdapter_.setCurv(0, -5, null); - assertEquals(curvOld+5, geomAdapter_.getCurv(1), tolerance); - assertEquals(0, zone5_.getGeometry(1).getCoordinates()[0].x, tolerance); - assertEquals(10, zone5_.getGeometry(1).getCoordinates()[0].y, tolerance); - setUp(); - // Cas particulier parall\xE8le \xE0 l'axe des y - geomAdapter_.setData(zone5_, 8); - curvOld=geomAdapter_.getCurv(2); - geomAdapter_.setCurv(0, -5, null); - assertEquals(curvOld+5, geomAdapter_.getCurv(2), tolerance); - assertEquals(-9.1, zone5_.getGeometry(8).getCoordinates()[0].x, tolerance); - assertEquals(93, zone5_.getGeometry(8).getCoordinates()[0].y, tolerance); - setUp(); - // D\xE9placement de points non extr\xE9mit\xE9 non de rupture \\ - // Cas g\xE9n\xE9ral : d\xE9placement d'un point au centre ; axe sans point de ruptures et parall\xE8le \xE0 l'axe des x - geomAdapter_.setData(zone5_, 4); - curvOld=geomAdapter_.getCurv(1); - double curvOld2=geomAdapter_.getCurv(2); - geomAdapter_.setCurv(1, geomAdapter_.getCurv(1)-5, null); - assertEquals(curvOld-5, geomAdapter_.getCurv(1), tolerance); - assertEquals(curvOld2, geomAdapter_.getCurv(2), tolerance); - assertEquals(15, zone5_.getGeometry(4).getCoordinates()[1].x, tolerance); - assertEquals(10, zone5_.getGeometry(4).getCoordinates()[1].y, tolerance); - setUp(); - // Cas g\xE9n\xE9ral : d\xE9placement d'un point au centre avec 2 points de ruptures - geomAdapter_.setData(zone5_, 15); - curvOld=geomAdapter_.getCurv(3); - curvOld2=geomAdapter_.getCurv(1); - geomAdapter_.setCurv(3, geomAdapter_.getCurv(3)-2, null); - assertEquals(curvOld-2, geomAdapter_.getCurv(3), tolerance); - assertEquals(curvOld2, geomAdapter_.getCurv(1), tolerance); - assertEquals(10, zone5_.getGeometry(15).getCoordinates()[3].x, tolerance); - assertEquals(2, zone5_.getGeometry(15).getCoordinates()[3].y, tolerance); - setUp(); - - // Cas sp\xE9cial : d\xE9placement d'un point de rupture \\ - // Cas classique : d\xE9placement d'un point de rupture sur un axe en ayant deux et des points un peut partout - geomAdapter_.setData(zone5_, 14); - double[] absCurv=new double[6]; - for(int i=0;i<6;i++) - absCurv[i]=geomAdapter_.getCurv(i); - geomAdapter_.setCurv(2,geomAdapter_.getCurv(2)-2, null); - absCurv[2]=absCurv[2]-2; - // R\xE9instancier un nouvel adapter va verifier si il n'y a pas de nouveaux points de ruptures qui sont apparux ou qu'il y ai pas des axes qui se croisent - DataGeometryAdapter testAdapter=null; - try{ - testAdapter=new DataGeometryAdapter(zone5_, 14); - } - catch(Exception exc){ - fail(); - } - assertEquals(6, testAdapter.getNbPoint()); - // test des nouvelles abs curviligne - for(int i=0;i<6;i++) - assertEquals(absCurv[i], testAdapter.getCurv(i), tolerance); - setUp(); - // Test sur les coordonn\xE9es g\xE9n\xE9r\xE9es - geomAdapter_.setData(zone1_, 0); - geomAdapter_.setCurv(1, 5, null); - assertEquals(5.0, geomAdapter_.getCurv(1), tolerance); - Coordinate p=((GISPolyligne)zone1_.getGeometry(0)).getCoordinateSequence().getCoordinate(1); - assertEquals(3.1013705223595296, p.x, tolerance); - assertEquals(4.998286847050588, p.y, tolerance); - } - - public void testSetZ() throws IllegalArgumentException, DataGeometryException { - geomAdapter_.setData(zone0_, 0); - geomAdapter_.setZ(0, 20, null); - assertEquals(20, geomAdapter_.getZ(0), tolerance); - geomAdapter_.setZ(2, -2, null); - assertEquals(-2, geomAdapter_.getZ(2), tolerance); - // Cas limits - try{ - geomAdapter_.setZ(-11, -2, null); - fail(); - }catch(IllegalArgumentException _exc){} - try { - geomAdapter_.setZ(1000, -2, null); - fail(); - } - catch (IllegalArgumentException _exc){} - // Cas limits - geomAdapter_.setData(null, -1); - try { - geomAdapter_.setZ(0, 10, null); - fail(); - } - catch(IllegalArgumentException _exc){} - } - - public void testGetCurvMax() throws IllegalArgumentException, DataGeometryException { - geomAdapter_.setData(zone0_, 0); - assertEquals(Math.sqrt(10*10+20*20)+Math.sqrt((50+10)*(50+10)+(10+20)*(10+20)), geomAdapter_.getCurvMax(), tolerance); - geomAdapter_.setData(null, -1); - assertEquals(0, geomAdapter_.getCurvMax(), tolerance); - } - - public void testGetCurvMin() throws IllegalArgumentException, DataGeometryException { - geomAdapter_.setData(zone0_, 0); - assertEquals(0, geomAdapter_.getCurvMin(), tolerance); - geomAdapter_.setData(null, -1); - assertEquals(0, geomAdapter_.getCurvMin(), tolerance); - } - - public void testGetZMax() throws IllegalArgumentException, DataGeometryException { - geomAdapter_.setData(zone0_, 0); - assertEquals(10, geomAdapter_.getZMax(), tolerance); - geomAdapter_.setData(zone1_, 0); - assertEquals(0, geomAdapter_.getZMax(), tolerance); - geomAdapter_.setZ(0, 20, null); - assertEquals(20, geomAdapter_.getZMax(), tolerance); - geomAdapter_.setZ(0, -5, null); - assertEquals(0, geomAdapter_.getZMax(), tolerance); - } - - public void testGetZMin() throws IllegalArgumentException, DataGeometryException { - geomAdapter_.setData(zone0_, 0); - assertEquals(-20, geomAdapter_.getZMin(), tolerance); - geomAdapter_.setData(zone1_, 0); - assertEquals(0, geomAdapter_.getZMin(), tolerance); - geomAdapter_.setZ(0, -20, null); - assertEquals(-20, geomAdapter_.getZMin(), tolerance); - geomAdapter_.setZ(0, 10, null); - assertEquals(0, geomAdapter_.getZMin(), tolerance); - } - - public void testSetValues() throws IllegalArgumentException, DataGeometryException { - // Test rapide reprit de setCurv ; les cas sont d\xE9j\xE0 test\xE9 dans setZ et setCurv - geomAdapter_.setData(zone5_, 14); - double[] absCurv=new double[6]; - for(int i=0;i<6;i++) - absCurv[i]=geomAdapter_.getCurv(i); - geomAdapter_.setValues(2,geomAdapter_.getCurv(2)-2, 60, null); - assertEquals(60, geomAdapter_.getZ(2), tolerance); - absCurv[2]=absCurv[2]-2; - // R\xE9instancier un nouvel adapter va verifier si il n'y a pas de nouveaux points de ruptures qui sont apparux ou qu'il y ai pas des axes qui se croisent - DataGeometryAdapter testAdapter=null; - try{ - testAdapter=new DataGeometryAdapter(zone5_, 14); - } - catch(Exception exc){ - fail(); - } - assertEquals(6, testAdapter.getNbPoint()); - // test des nouvelles abs curviligne - for(int i=0;i<6;i++) - assertEquals(absCurv[i], testAdapter.getCurv(i), tolerance); - } - - public void testRemove() throws IllegalArgumentException, DataGeometryException { - // Un cas g\xE9n\xE9ral - geomAdapter_.setData(zone0_, 0); - geomAdapter_.remove(0, null); - assertEquals(2, geomAdapter_.getNbPoint()); - assertEquals(-20, geomAdapter_.getZ(0), tolerance); - assertEquals(0, geomAdapter_.getCurv(0), tolerance); - assertEquals(Math.sqrt((50+10)*(50+10)+(10+20)*(10+20)), geomAdapter_.getCurv(1), tolerance); - // On ne peut pas descendre en dessous de 2 points - try { - geomAdapter_.remove(0, null); - fail(); - } - catch(DataGeometryException _exc){ - assertEquals(2, geomAdapter_.getNbPoint()); - } - // Cas limits - geomAdapter_.setData(null, -1); - try { - geomAdapter_.remove(0, null); - fail(); - } - catch(IllegalArgumentException _exc){} - // Un cas g\xE9n\xE9ral - geomAdapter_.setData(zone3_, 1); - geomAdapter_.remove(4, null); - geomAdapter_.remove(2, null); - geomAdapter_.remove(1, null); - assertEquals(2, geomAdapter_.getNbPoint()); - assertEquals(0, geomAdapter_.getZ(0), tolerance); - assertEquals(0, geomAdapter_.getCurv(0), tolerance); - assertEquals(-20, geomAdapter_.getZ(1), tolerance); - assertEquals(Math.sqrt((35-5)*(35-5)+5*5), geomAdapter_.getCurv(1), tolerance); - } - - public void testAddDataGeometryListener() throws DataGeometryException { - // Initialisation du test - class MyDataGeometryListener implements DataGeometryListener { - public boolean callChanged=false; - public boolean callNewGeom=false; - public void dataGeometryChanged() {callChanged=true;} - public void dataGeometryNewGeom() {callNewGeom=true;} - }; - MyDataGeometryListener listener=new MyDataGeometryListener(); - geomAdapter_.addDataGeometryListener(listener); - // Test dataGeometryNewGeom - geomAdapter_.setData(null, -1); - assertTrue(listener.callNewGeom); - listener.callNewGeom=false; - geomAdapter_.setData(zone1_, 0); - assertTrue(listener.callNewGeom); - listener.callNewGeom=false; - // Test dataGeometryChanged - geomAdapter_.setZ(0, 10, null); - assertTrue(listener.callChanged); - listener.callChanged=false; - geomAdapter_.setCurv(1, (geomAdapter_.getCurv(2)-geomAdapter_.getCurv(0))/2, null); - assertTrue(listener.callChanged); - listener.callChanged=false; - geomAdapter_.setValues(0, 0, 20, null); - assertTrue(listener.callChanged); - listener.callChanged=false; - try { - geomAdapter_.addDataGeometryListener(null); - fail(); - } - catch (IllegalArgumentException _exc){} - } - - public void testRemoveDataGeometryListener() throws DataGeometryException { - // Initialisation du test - class MyDataGeometryListener implements DataGeometryListener { - public boolean callChanged=false; - public boolean callNewGeom=false; - public void dataGeometryChanged() {callChanged=true;} - public void dataGeometryNewGeom() {callNewGeom=true;} - }; - MyDataGeometryListener listener=new MyDataGeometryListener(); - geomAdapter_.addDataGeometryListener(listener); - geomAdapter_.removeDataGeometryListener(listener); - // Test dataGeometryNewGeom - geomAdapter_.setData(null, -1); - assertFalse(listener.callNewGeom); - listener.callNewGeom=false; - geomAdapter_.setData(zone1_, 0); - assertFalse(listener.callNewGeom); - listener.callNewGeom=false; - // Test dataGeometryChanged - geomAdapter_.setZ(0, 10, null); - assertFalse(listener.callChanged); - listener.callChanged=false; - geomAdapter_.setCurv(1, (geomAdapter_.getCurv(2)-geomAdapter_.getCurv(0))/2, null); - assertFalse(listener.callChanged); - listener.callChanged=false; - geomAdapter_.setValues(0, 0, 20, null); - assertFalse(listener.callChanged); - listener.callChanged=false; - try { - geomAdapter_.removeDataGeometryListener(null); - fail(); - } - catch (IllegalArgumentException _exc){} - } -} Copied: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/test/testModeleur1d/TestProfilContainerAdapter.java (from rev 4312, branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/test/testModeleur1d/TestDataGeometryAdapter.java) =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/test/testModeleur1d/TestProfilContainerAdapter.java (rev 0) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/test/testModeleur1d/TestProfilContainerAdapter.java 2008-12-30 17:02:04 UTC (rev 4317) @@ -0,0 +1,776 @@ +/* + * @creation 16 d\xE9c. 2008 + * @modification $Date:$ + * @license GNU General Public License 2 + * @copyright (c)1998-2008 CETMEF 2 bd Gambetta F-60231 Compiegne + * @mail fud...@li... + */ +package testModeleur1d; + +import junit.framework.TestCase; + +import org.fudaa.ctulu.gis.GISAttributeConstants; +import org.fudaa.ctulu.gis.GISAttributeInterface; +import org.fudaa.ctulu.gis.GISGeometryFactory; +import org.fudaa.ctulu.gis.GISPolyligne; +import org.fudaa.ebli.calque.ZModeleLigneBrisee; +import org.fudaa.fudaa.modeleur.layer.MdlModel2dProfile; +import org.fudaa.fudaa.modeleur.modeleur1d.model.BiefContainerAdapter; +import org.fudaa.fudaa.modeleur.modeleur1d.model.BiefSet; +import org.fudaa.fudaa.modeleur.modeleur1d.model.ProfilContainerAdapter; +import org.fudaa.fudaa.modeleur.modeleur1d.model.ProfilContainerException; +import org.fudaa.fudaa.modeleur.modeleur1d.model.ProfilContainerListener; + +import com.vividsolutions.jts.geom.Coordinate; + +/** + * Test pour ProfilContainerAdapter. + * @author Emmanuel MARTIN + * @version $Id$ + */ +public class TestProfilContainerAdapter extends TestCase { + + /** Tolerance pour les comparaisons de doubles. */ + private double tolerance=0.000001; + private BiefContainerAdapter biefContainer; + private ProfilContainerAdapter geomAdapter_; + private MdlModel2dProfile zone0_; + private MdlModel2dProfile zone1_; + private MdlModel2dProfile zone3_; + private MdlModel2dProfile zone4_; + private MdlModel2dProfile zone5_; + private MdlModel2dProfile zone6_; + + /* + * (non-Javadoc) + * + * @see junit.framework.TestCase#setUp() + */ + @Override + protected void setUp() throws Exception { + super.setUp(); + // Zone6_ \\ + // Attribut z non d\xE9fini + zone6_=new MdlModel2dProfile(null, null); + zone6_.getGeomData().setAttributes(new GISAttributeInterface[]{GISAttributeConstants.BATHY}, null); + zone6_.getGeomData().addPolyligne(GISGeometryFactory.INSTANCE.getCoordinateSequenceFactory().create( + new Coordinate[]{new Coordinate(0, 0, 0), new Coordinate(-10, -20, -20), + new Coordinate(50, 10, 10)}), null, null); + // Zone0_ \\ + // Quelconque + zone0_=new MdlModel2dProfile(null, null); + zone0_.getGeomData().setAttributes(new GISAttributeInterface[]{GISAttributeConstants.BATHY}, null); + zone0_.getGeomData().setAttributeIsZ(GISAttributeConstants.BATHY); + zone0_.getGeomData().addPolyligne(GISGeometryFactory.INSTANCE.getCoordinateSequenceFactory().create( + new Coordinate[]{new Coordinate(0, 0, 0), new Coordinate(-10, -20, -20), + new Coordinate(50, 10, 10)}), null, null); + // Zone1_ \\ + // Quelconque + zone1_=new MdlModel2dProfile(null, null); + zone1_.getGeomData().setAttributes(new GISAttributeInterface[]{GISAttributeConstants.BATHY}, null); + zone1_.getGeomData().setAttributeIsZ(GISAttributeConstants.BATHY); + zone1_.getGeomData().addPolyligne(GISGeometryFactory.INSTANCE.getCoordinateSequenceFactory() + .create( + new Coordinate[]{new Coordinate(8, 6, 0), new Coordinate(5.052590034554651, 6.559262456806686, 0), + new Coordinate(3, 2, 0)}), null, null); + // Zone3_ \\ + // Quelconque + zone3_=new MdlModel2dProfile(null, null); + zone3_.getGeomData().setAttributes(new GISAttributeInterface[]{GISAttributeConstants.BATHY}, null); + zone3_.getGeomData().setAttributeIsZ(GISAttributeConstants.BATHY); + zone3_.getGeomData().addPolyligne(GISGeometryFactory.INSTANCE.getCoordinateSequenceFactory().create( + new Coordinate[]{new Coordinate(0, 0, 0), new Coordinate(-10, -20, -20), new Coordinate(50, 10, 10), + new Coordinate(30, 5, 5), new Coordinate(10, 0, 0)}), null, null); + zone3_.getGeomData().addPolyligne(GISGeometryFactory.INSTANCE.getCoordinateSequenceFactory().create( + new Coordinate[]{new Coordinate(5, 0, 0), new Coordinate(-15, -20, -20), new Coordinate(55, 10, 10), + new Coordinate(35, 5, -20), new Coordinate(15, 0, -20)}), null, null); + // zone4_ \\ + zone4_=new MdlModel2dProfile(null, null); + zone4_.getGeomData().setAttributes(new GISAttributeInterface[]{GISAttributeConstants.BATHY}, null); + zone4_.getGeomData().setAttributeIsZ(GISAttributeConstants.BATHY); + // 0 : Points confondus + zone4_.getGeomData().addPolyligne(GISGeometryFactory.INSTANCE.getCoordinateSequenceFactory().create( + new Coordinate[]{new Coordinate(0, 0, 0), new Coordinate(-10, -20, -20), new Coordinate(-10, -20, -20), + new Coordinate(-20, -40, -40), new Coordinate(-30, -60, -60)}), null, null); + // 1 : nb ruptures > 2 + zone4_.getGeomData().addPolyligne(GISGeometryFactory.INSTANCE.getCoordinateSequenceFactory().create( + new Coordinate[]{new Coordinate(0, 0, 0), new Coordinate(10, 20, 5), new Coordinate(11, 100, 8), new Coordinate(41, 5, 9), new Coordinate(41, 0, 8)}), null, null); + // 2 : nb ruptures = 1 + zone4_.getGeomData().addPolyligne(GISGeometryFactory.INSTANCE.getCoordinateSequenceFactory().create( + new Coordinate[]{new Coordinate(0, 0, 0), new Coordinate(11, 100, 8), new Coordinate(12, 101, 10), new Coordinate(13, 102, -5)}), null, null); + // 3 : nb ruptures = 0 + zone4_.getGeomData().addPolyligne(GISGeometryFactory.INSTANCE.getCoordinateSequenceFactory().create( + new Coordinate[]{new Coordinate(0, 0, 0), new Coordinate(10, 20, 5), new Coordinate(20, 40, 8)}), null, null); + // 4 : nb ruptures = 2 + zone4_.getGeomData().addPolyligne(GISGeometryFactory.INSTANCE.getCoordinateSequenceFactory().create( + new Coordinate[]{new Coordinate(10, 10, 0), new Coordinate(20, 10, 5), new Coordinate(20, 20, 8), new Coordinate(25, 20, 8), new Coordinate(30, 20, 8)}), null, null); + // 5 : axes crois\xE9s + zone4_.getGeomData().addPolyligne(GISGeometryFactory.INSTANCE.getCoordinateSequenceFactory().create( + new Coordinate[]{new Coordinate(10, 10, 0), new Coordinate(20, 10, 5), new Coordinate(20, 20, 8), new Coordinate(10, 5, 8)}), null, null); + // Zone5_ \\ + zone5_=new MdlModel2dProfile(null, null); + zone5_.getGeomData().setAttributes(new GISAttributeInterface[]{GISAttributeConstants.BATHY}, null); + zone5_.getGeomData().setAttributeIsZ(GISAttributeConstants.BATHY); + // 0 : 2 points align\xE9s (cas g\xE9n\xE9ral) + zone5_.getGeomData().addPolyligne(GISGeometryFactory.INSTANCE.getCoordinateSequenceFactory().create( + new Coordinate[]{new Coordinate(0, 0, 0), new Coordinate(10, 5, -4)}), null, null); + // 1 : 2 points align\xE9s parall\xE8le \xE0 l'axe des X + zone5_.getGeomData().addPolyligne(GISGeometryFactory.INSTANCE.getCoordinateSequenceFactory().create( + new Coordinate[]{new Coordinate(5, 10, 3), new Coordinate(20, 10, -7)}), null, null); + // 2 : 2 points align\xE9s parall\xE8le \xE0 l'axe des Y + zone5_.getGeomData().addPolyligne(GISGeometryFactory.INSTANCE.getCoordinateSequenceFactory().create( + new Coordinate[]{new Coordinate(5, 0, 0), new Coordinate(5, 10, 88)}), null, null); + // 3 : 3 points align\xE9s (cas g\xE9n\xE9ral) + zone5_.getGeomData().addPolyligne(GISGeometryFactory.INSTANCE.getCoordinateSequenceFactory().create( + new Coordinate[]{new Coordinate(0, 0, -2), new Coordinate(11, 5, 7), new Coordinate(16.5, 7.5, 0)}), null, null); + // 4 : 3 points align\xE9s parall\xE8le \xE0 l'axe des X + zone5_.getGeomData().addPolyligne(GISGeometryFactory.INSTANCE.getCoordinateSequenceFactory().create( + new Coordinate[]{new Coordinate(-5, 10, 3), new Coordinate(20, 10, 6), new Coordinate(20.4, 10, 2)}), null, null); + // 5 : 3 points align\xE9s parall\xE8le \xE0 l'axe des Y + zone5_.getGeomData().addPolyligne(GISGeometryFactory.INSTANCE.getCoordinateSequenceFactory().create( + new Coordinate[]{new Coordinate(-5, 10, 8), new Coordinate(-5, -2, -2), new Coordinate(-5, -50, 50)}), null, null); + // 6 : 4 points align\xE9s (cas g\xE9n\xE9ral) + zone5_.getGeomData().addPolyligne(GISGeometryFactory.INSTANCE.getCoordinateSequenceFactory().create( + new Coordinate[]{new Coordinate(1, 1, 0), new Coordinate(2, 1, 3), new Coordinate(8, 5, -9), new Coordinate(40, 25, 99)}), null, null); + // 7 : 4 points align\xE9s parall\xE8le \xE0 l'axe des X + zone5_.getGeomData().addPolyligne(GISGeometryFactory.INSTANCE.getCoordinateSequenceFactory().create( + new Coordinate[]{new Coordinate(1, 2.56, -2), new Coordinate(10, 2.56, 0), new Coordinate(99, 2.56, 84), new Coordinate(100.5, 2.56, 100)}), null, null); + // 8 : 4 points align\xE9s parall\xE8le \xE0 l'axe des Y + zone5_.getGeomData().addPolyligne(GISGeometryFactory.INSTANCE.getCoordinateSequenceFactory().create( + new Coordinate[]{new Coordinate(-9.1, 88, 0), new Coordinate(-9.1, 50, 8), new Coordinate(-9.1, 0, -87), new Coordinate(-9.1, -10, -10)}), null, null); + // 9 : 3 points avec un point de rupture + zone5_.getGeomData().addPolyligne(GISGeometryFactory.INSTANCE.getCoordinateSequenceFactory().create( + new Coordinate[]{new Coordinate(0, 0, 0), new Coordinate(10, 5, 2), new Coordinate(10, -5, 9)}), null, null); + // 10 : 4 points avec un point de rupture (deux points sur le premier axe) + zone5_.getGeomData().addPolyligne(GISGeometryFactory.INSTANCE.getCoordinateSequenceFactory().create( + new Coordinate[]{new Coordinate(0, 0, -2), new Coordinate(11, 5, 7), new Coordinate(16.5, 7.5, 0), new Coordinate(50, 60, 70)}), null, null); + // 11 : 5 points avec un point de rupture (deux points sur chaque axe) + zone5_.getGeomData().addPolyligne(GISGeometryFactory.INSTANCE.getCoordinateSequenceFactory().create( + new Coordinate[]{new Coordinate(0, 0, -2), new Coordinate(11, 5, 7), new Coordinate(16.5, 7.5, 0), new Coordinate(33, 3.75, 9), new Coordinate(11, 1.25, 9)}), null, null); + // 12 : 4 points avec deux points de ruptures + zone5_.getGeomData().addPolyligne(GISGeometryFactory.INSTANCE.getCoordinateSequenceFactory().create( + new Coordinate[]{new Coordinate(0, 0, 0), new Coordinate(10, 5, 2), new Coordinate(10, -5, 9), new Coordinate(20, 0, 0)}), null, null); + // 13 : 5 points avec deux points de ruptures (deux points sur le premier axe) + zone5_.getGeomData().addPolyligne(GISGeometryFactory.INSTANCE.getCoordinateSequenceFactory().create( + new Coordinate[]{new Coordinate(0, 0, 0), new Coordinate(5, 2.5, 88), new Coordinate(10, 5, 2), new Coordinate(10, -5, 9), new Coordinate(20, 0, 0)}), null, null); + // 14 : 6 points avec deux points de ruptures (deux points sur les deux premiers axes) + zone5_.getGeomData().addPolyligne(GISGeometryFactory.INSTANCE.getCoordinateSequenceFactory().create( + new Coordinate[]{new Coordinate(0, 0, 0), new Coordinate(5, 2.5, 88), new Coordinate(10, 5, 2), new Coordinate(10, 0, 44), new Coordinate(10, -5, 9), new Coordinate(20, 0, 0)}), null, null); + // 15 : 7 points avec deux points de ruptures (deux points sur chacun des axes) + zone5_.getGeomData().addPolyligne(GISGeometryFactory.INSTANCE.getCoordinateSequenceFactory().create( + new Coordinate[]{new Coordinate(0, 0, 0), new Coordinate(5, 2.5, 88), new Coordinate(10, 5, 2), new Coordinate(10, 0, 44), new Coordinate(10, -5, 9), new Coordinate(15, -2.5, 2), new Coordinate(20, 0, 0)}), null, null); + // 16 : 10 points avec deux points de ruptures (trois points sur chacun des axes) + zone5_.getGeomData().addPolyligne(GISGeometryFactory.INSTANCE.getCoordinateSequenceFactory().create( + new Coordinate[]{new Coordinate(0, 0, 0), new Coordinate(2.5, 1.25, 44), new Coordinate(5, 2.5, 88), new Coordinate(10, 5, 2), new Coordinate(10, 0, 44), new Coordinate(10, -2, 0), new Coordinate(10, -5, 9), new Coordinate(10/2., -5/2., 2), new Coordinate(10/4., -5/4., 0), new Coordinate(10/8., -5/8., 0)}), null, null); + // 17 : 3 points avec un point de rupture et le premier et le dernier points sont sur le m\xEAme axe des y + zone5_.getGeomData().addPolyligne(GISGeometryFactory.INSTANCE.getCoordinateSequenceFactory().create( + new Coordinate[]{new Coordinate(5, 5, -9), new Coordinate(10, 10, 0), new Coordinate(5, 20, 0)}), null, null); + // 18 : 3 points avec un point de rupture et le premier et le dernier points sont sur le m\xEAme axe des x + zone5_.getGeomData().addPolyligne(GISGeometryFactory.INSTANCE.getCoordinateSequenceFactory().create( + new Coordinate[]{new Coordinate(5, 5, -9), new Coordinate(10, 10, 0), new Coordinate(20, 5, 0)}), null, null); + + BiefSet biefSet_=new BiefSet(); + biefSet_.addBief("zone0_", new ZModeleLigneBrisee[]{zone0_}, null); + biefSet_.addBief("zone1_", new ZModeleLigneBrisee[]{zone1_}, null); + biefSet_.addBief("zone3_", new ZModeleLigneBrisee[]{zone3_}, null); + biefSet_.addBief("zone4_", new ZModeleLigneBrisee[]{zone4_}, null); + biefSet_.addBief("zone5_", new ZModeleLigneBrisee[]{zone5_}, null); + biefSet_.addBief("zone6_", new ZModeleLigneBrisee[]{zone6_}, null); + biefContainer=new BiefContainerAdapter(biefSet_); + biefContainer.setSelectedBief("zone0_"); + geomAdapter_=new ProfilContainerAdapter(biefContainer); + } + + public void testProfilContainerAdapter() throws IllegalArgumentException, ProfilContainerException { + // Points confondus + try { + biefContainer.setSelectedBief("zone4_"); + geomAdapter_.setSelectedProfil(0); + fail(); + } + catch (IllegalArgumentException _exc) { + fail(); + } + catch (ProfilContainerException _exc) {} + // nb points > 2 + try { + biefContainer.setSelectedBief("zone4_"); + geomAdapter_.setSelectedProfil(1); + fail(); + } + catch (IllegalArgumentException _exc) { + fail(); + } + catch (ProfilContainerException _exc) {} + // nb ruptures = 1 + try { + biefContainer.setSelectedBief("zone4_"); + geomAdapter_.setSelectedProfil(2); + } + catch (IllegalArgumentException _exc) { + fail(); + } + catch (ProfilContainerException _exc) { + fail(); + } + // nb ruptures = 0 + try { + biefContainer.setSelectedBief("zone4_"); + geomAdapter_.setSelectedProfil(3); + } + catch (IllegalArgumentException _exc) { + fail(); + } + catch (ProfilContainerException _exc) { + fail(); + } + // nb ruptures = 2 + try { + biefContainer.setSelectedBief("zone4_"); + geomAdapter_.setSelectedProfil(4); + } + catch (IllegalArgumentException _exc) { + fail(); + } + catch (ProfilContainerException _exc) { + fail(); + } + // axes crois\xE9s + try { + biefContainer.setSelectedBief("zone4_"); + geomAdapter_.setSelectedProfil(5); + fail(); + } + catch (IllegalArgumentException _exc) { + fail(); + } + catch (ProfilContainerException _exc) { + } + // aguments invalide + try { + geomAdapter_.setSelectedProfil(-2); + fail(); + } + catch (IllegalArgumentException _exc) { + } + catch (ProfilContainerException _exc) { + fail(); + } + // aguments invalide + try { + geomAdapter_.setSelectedProfil(100); + fail(); + } + catch (IllegalArgumentException _exc) { + } + catch (ProfilContainerException _exc) { + fail(); + } + // aguments invalide + try { + geomAdapter_.setSelectedProfil(zone4_.getGeomData().getNbGeometries()); + fail(); + } + catch (IllegalArgumentException _exc) { + } + catch (ProfilContainerException _exc) { + fail(); + } + // aguments invalide + try { + geomAdapter_.setSelectedProfil(zone4_.getGeomData().getNbGeometries()+1); + fail(); + } + catch (IllegalArgumentException _exc) { + } + catch (ProfilContainerException _exc) { + fail(); + } + // aguments valide + try { + biefContainer.setSelectedBief("zone3_"); + geomAdapter_.setSelectedProfil(zone3_.getGeomData().getNbGeometries()-1); + } + catch (IllegalArgumentException _exc) { + fail(); + } + catch (ProfilContainerException _exc) { + fail(); + } + } + + public void testGetGISZoneCollection() throws IllegalArgumentException, ProfilContainerException { + biefContainer.setSelectedBief("zone0_"); + geomAdapter_.setSelectedProfil(0); + assertEquals(zone0_.getGeomData(), geomAdapter_.getGISZoneCollection()); + biefContainer.setSelectedBief("zone1_"); + geomAdapter_.setSelectedProfil(0); + assertEquals(zone1_.getGeomData(), geomAdapter_.getGISZoneCollection()); + } + + public void testGetIdxGeom() throws IllegalArgumentException, ProfilContainerException { + biefContainer.setSelectedBief("zone0_"); + geomAdapter_.setSelectedProfil(0); + assertEquals(0, geomAdapter_.getIdxGeom()); + biefContainer.setSelectedBief("zone3_"); + geomAdapter_.setSelectedProfil(0); + assertEquals(0, geomAdapter_.getIdxGeom()); + biefContainer.setSelectedBief("zone3_"); + geomAdapter_.setSelectedProfil(1); + assertEquals(1, geomAdapter_.getIdxGeom()); + biefContainer.setSelectedBief("zone0_"); + geomAdapter_.setSelectedProfil(zone0_.getGeomData().getNbGeometries()-1); + assertEquals(zone0_.getGeomData().getNbGeometries()-1, geomAdapter_.getIdxGeom()); + biefContainer.setSelectedBief(null); + geomAdapter_.setSelectedProfil(-1); + assertEquals(-1, geomAdapter_.getIdxGeom()); + } + + public void testGetNbPoint() throws IllegalArgumentException, ProfilContainerException { + biefContainer.setSelectedBief("zone0_"); + geomAdapter_.setSelectedProfil(0); + assertEquals(3, geomAdapter_.getNbPoint()); + biefContainer.setSelectedBief("zone1_"); + geomAdapter_.setSelectedProfil(0); + assertEquals(3, geomAdapter_.getNbPoint()); + biefContainer.setSelectedBief("zone3_"); + geomAdapter_.setSelectedProfil(0); + assertEquals(5, geomAdapter_.getNbPoint()); + biefContainer.setSelectedBief("zone3_"); + geomAdapter_.setSelectedProfil(1); + assertEquals(5, geomAdapter_.getNbPoint()); + biefContainer.setSelectedBief(null); + geomAdapter_.setSelectedProfil(-1); + assertEquals(0, geomAdapter_.getNbPoint()); + } + + public void testGetCurv() throws IllegalArgumentException, ProfilContainerException { + // Cas limits + biefContainer.setSelectedBief(null); + geomAdapter_.setSelectedProfil(-1); + try { + geomAdapter_.getCurv(0); + fail(); + } + catch (IllegalArgumentException _exc) {} + biefContainer.setSelectedBief("zone0_"); + geomAdapter_.setSelectedProfil(0); + try { + geomAdapter_.getCurv(-1); + fail(); + } + catch (IllegalArgumentException _exc) {} + try { + geomAdapter_.getCurv(-5); + fail(); + } + catch (IllegalArgumentException _exc) {} + try { + geomAdapter_.getCurv(geomAdapter_.getNbPoint()); + fail(); + } + catch (IllegalArgumentException _exc) {} + // Cas g\xE9n\xE9rals + assertEquals(0, geomAdapter_.getCurv(0), tolerance); + assertEquals(Math.sqrt(10*10+20*20), geomAdapter_.getCurv(1), tolerance); + assertEquals(Math.sqrt(10*10+20*20)+Math.sqrt((50+10)*(50+10)+(10+20)*(10+20)), geomAdapter_.getCurv(2), tolerance); + } + + public void testGetZ() throws IllegalArgumentException, ProfilContainerException { + biefContainer.setSelectedBief("zone0_"); + geomAdapter_.setSelectedProfil(0); + assertEquals(0, geomAdapter_.getZ(0), tolerance); + assertEquals(-20, geomAdapter_.getZ(1), tolerance); + assertEquals(10, geomAdapter_.getZ(2), tolerance); + biefContainer.setSelectedBief(null); + geomAdapter_.setSelectedProfil(-1); + try { + geomAdapter_.getZ(0); + fail(); + } + catch(IllegalArgumentException ex){} + biefContainer.setSelectedBief("zone0_"); + geomAdapter_.setSelectedProfil(0); + try { + geomAdapter_.getZ(-1); + fail(); + } + catch (IllegalArgumentException _exc) { + } + biefContainer.setSelectedBief("zone0_"); + geomAdapter_.setSelectedProfil(0); + try { + geomAdapter_.getZ(100); + fail(); + } + catch (IllegalArgumentException _exc) { + } + } + + public void testSetCurv() throws Exception { + // Cas limits + biefContainer.setSelectedBief(null); + geomAdapter_.setSelectedProfil(-1); + try{ + geomAdapter_.setCurv(0, 0, null); + fail(); + } + catch(IllegalArgumentException _exc) {} + try{ + geomAdapter_.setCurv(-1, 0, null); + fail(); + } + catch(IllegalArgumentException _exc) {} + biefContainer.setSelectedBief("zone1_"); + geomAdapter_.setSelectedProfil(0); + try{ + geomAdapter_.setCurv(-1, 0, null); + fail(); + } + catch(IllegalArgumentException _exc) {} + try{ + geomAdapter_.setCurv(zone1_.getGeomData().getGeometry(0).getNumPoints(), 0, null); + fail(); + } + catch(IllegalArgumentException _exc) {} + try{ + geomAdapter_.setCurv(zone1_.getGeomData().getGeometry(0).getNumPoints()+1, 0, null); + fail(); + } + catch(IllegalArgumentException _exc) {} + // Une abcisse curviligne peut \xEAtre donn\xE9 pour le premier point, seulement pour lui + biefContainer.setSelectedBief("zone5_"); + geomAdapter_.setSelectedProfil(0); + try{ + geomAdapter_.setCurv(0, -1, null); + } + catch(Exception exc){ + fail(); + } + try{ + geomAdapter_.setCurv(1, -1, null); + fail(); + } + catch(ProfilContainerException exc){} + try{ + geomAdapter_.setCurv(geomAdapter_.getNbPoint()-1, -1, null); + fail(); + } + catch(ProfilContainerException exc){} + setUp(); + // Test sur le d\xE9placement d'un point au del\xE0 d'un autre ou au niveau d'un autre + biefContainer.setSe... [truncated message content] |
From: <emm...@us...> - 2008-12-30 15:19:57
|
Revision: 4316 http://fudaa.svn.sourceforge.net/fudaa/?rev=4316&view=rev Author: emmanuel_martin Date: 2008-12-30 15:19:53 +0000 (Tue, 30 Dec 2008) Log Message: ----------- L'import des rives gauches et droites et des limites de stockages gauches et droites depuis le 2d est fait correctement. Une simplification pour le 1d est fait, sans d?\195?\169truire les donn?\195?\169es 2d. Des modifications dans la partie 2d entrainent une mise ?\195?\160 jour dans la partie 1d. ATTENTION actuellement la mise ?\195?\160 jour depuis la partie 2d provoque la destruction de toutes les modifications faites dans la partie 1D ! Un comportement plus fin sera mise en place dans un commit ult?\195?\169rieur. Modified Paths: -------------- branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISAttributeConstants.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlVisuPanel.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/action/SceneAbscisseCurviligneAction.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/layer/MdlLayer1dBank.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/ProfilContainerAdapter.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/VueBief.java Added Paths: ----------- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/persistence/MdlLayer2dBankPersistence.java Removed Paths: ------------- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/layer/MdlLayer2dStorageLimit.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/layer/MdlModel1dStorageLimit.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-12-24 15:09:43 UTC (rev 4315) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISAttributeConstants.java 2008-12-30 15:19:53 UTC (rev 4316) @@ -56,8 +56,6 @@ public final static String ATT_NATURE_CE="CE"; /** Nature axe hydraulique */ public final static String ATT_NATURE_AH="AH"; - /** Nature limite de stockage (gauche ou droite) */ - public final static String ATT_NATURE_LS="LS"; /** Nature rive (gauche ou droite) */ public final static String ATT_NATURE_RV="RV"; 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-12-24 15:09:43 UTC (rev 4315) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlVisuPanel.java 2008-12-30 15:19:53 UTC (rev 4316) @@ -23,6 +23,7 @@ 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.MdlLayer1dBank; import org.fudaa.fudaa.modeleur.layer.MdlLayer1dTrace; import org.fudaa.fudaa.modeleur.layer.MdlLayer2dCloud; import org.fudaa.fudaa.modeleur.layer.MdlLayer2dConstraintLine; @@ -296,6 +297,10 @@ MdlLayer2dConstraintLine cqConst=new MdlLayer2dConstraintLine(getEditor()); cqConst.setName(BGroupeCalque.findUniqueChildName(cqBief, cqConst.getExtName())); cqBief.add(cqConst); + + MdlLayer1dBank cqBank=new MdlLayer1dBank(getEditor()); + cqBank.setName(BGroupeCalque.findUniqueChildName(cqBief, cqBank.getExtName())); + cqBief.add(cqBank); } /** Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/action/SceneAbscisseCurviligneAction.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/action/SceneAbscisseCurviligneAction.java 2008-12-24 15:09:43 UTC (rev 4315) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/action/SceneAbscisseCurviligneAction.java 2008-12-30 15:19:53 UTC (rev 4316) @@ -160,11 +160,9 @@ */ public Coordinate coordinateClicked(Coordinate _coord, double tolerance){ Point ptClick=new GeometryFactory().createPoint(_coord); - boolean returnValue=false; if (selectedGeometry_!=null&&selectedGeometry_.distance(ptClick)<tolerance) { // Recherche de l'index du dernier point de la polyligne \xE0 prendre en // compte. - returnValue=true; boolean fini=false; int i=-1; CoordinateSequence coordSeq=selectedGeometry_.getCoordinateSequence(); Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/layer/MdlLayer1dBank.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/layer/MdlLayer1dBank.java 2008-12-24 15:09:43 UTC (rev 4315) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/layer/MdlLayer1dBank.java 2008-12-30 15:19:53 UTC (rev 4316) @@ -15,13 +15,13 @@ import org.fudaa.ebli.trace.TraceLigne; import org.fudaa.ebli.trace.TraceLigneModel; import org.fudaa.fudaa.modeleur.MdlResource; -import org.fudaa.fudaa.modeleur.persistence.MdlLayer2dDirectionLinePersistence; +import org.fudaa.fudaa.modeleur.persistence.MdlLayer2dBankPersistence; import org.fudaa.fudaa.sig.layer.FSigEditor; /** * Un calque pour le stockage et la manipulation des rives. * @author Emmanuel MARTIN - * @version $Id:$ + * @version $Id$ */ public class MdlLayer1dBank extends MdlLayer2dLine { @@ -43,7 +43,7 @@ } public BCalquePersistenceInterface getPersistenceMng() { - return new MdlLayer2dDirectionLinePersistence(); + return new MdlLayer2dBankPersistence(); } /** Deleted: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/layer/MdlLayer2dStorageLimit.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/layer/MdlLayer2dStorageLimit.java 2008-12-24 15:09:43 UTC (rev 4315) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/layer/MdlLayer2dStorageLimit.java 2008-12-30 15:19:53 UTC (rev 4316) @@ -1,60 +0,0 @@ -/* - * @creation 23 d\xE9c. 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.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.MdlLayer2dDirectionLinePersistence; -import org.fudaa.fudaa.sig.layer.FSigEditor; - -/** - * Un calque pour le stockage et la manipulation des limites de stockage. - * @author Emmanuel MARTIN - * @version $Id$ - */ -public class MdlLayer2dStorageLimit extends MdlLayer2dLine { - - /** - * Constructeur. Utilise un mod\xE8le de donn\xE9es et un editeur. - * @param _model Modele - * @param _editor Editeur. - */ - private MdlLayer2dStorageLimit(ZModeleLigneBriseeEditable _model, final FSigEditor _editor) { - super(_model,_editor); - setLineModel(0, new TraceLigneModel(TraceLigne.LISSE, 1.5f, new Color(102,102,255))); - setLineModelOuvert(getLineModel(0)); - setName(getExtName()); - setTitle(MdlResource.MDL.getString("Limites de stockage")); - } - - public MdlLayer2dStorageLimit(FSigEditor _editor) { - this(new MdlModel1dStorageLimit(_editor,_editor.getMng()),_editor); - } - - public BCalquePersistenceInterface getPersistenceMng() { - return new MdlLayer2dDirectionLinePersistence(); - } - - /** - * Retourne le nom par defaut du calque. - * @return Le nom. - */ - public String getExtName() { - return "stockage"; - } - - public boolean canAddForme(int _typeForme) { - return _typeForme==DeForme.LIGNE_BRISEE; - } -} Deleted: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/layer/MdlModel1dStorageLimit.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/layer/MdlModel1dStorageLimit.java 2008-12-24 15:09:43 UTC (rev 4315) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/layer/MdlModel1dStorageLimit.java 2008-12-30 15:19:53 UTC (rev 4316) @@ -1,40 +0,0 @@ -/* - * @creation 23 d\xE9c. 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.layer; - -import org.fudaa.ctulu.CtuluCommandContainer; -import org.fudaa.ctulu.gis.GISAttribute; -import org.fudaa.ctulu.gis.GISAttributeConstants; -import org.fudaa.ebli.calque.ZModelGeometryListener; - -/** - * Un mod\xE8le de gestion de limite de stockage. - * @author Emmanuel MARTIN - * @version $Id:$ - */ -public class MdlModel1dStorageLimit extends MdlModel2dLine { - - /** - * Construction d'un modele de profil avec pile de commandes. - * @param _cmd La pile de commandes pour le undo/redo. - */ - public MdlModel1dStorageLimit(final ZModelGeometryListener _listener, final CtuluCommandContainer _cmd) { - super(_listener); - GISAttribute[] attrs=new GISAttribute[]{ - GISAttributeConstants.BATHY, - GISAttributeConstants.ETAT_GEOM, - GISAttributeConstants.TITRE, - GISAttributeConstants.NATURE, - GISAttributeConstants.VISIBILITE - }; - // Pas de container de commande pour cette op\xE9ration, sinon conserv\xE9 en undo/redo. - getGeomData().setAttributes(attrs, null); - getGeomData().setAttributeIsZ(GISAttributeConstants.BATHY); - getGeomData().setFixedAttributeValue(GISAttributeConstants.NATURE, GISAttributeConstants.ATT_NATURE_LS); - } -} \ No newline at end of file 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 2008-12-24 15:09:43 UTC (rev 4315) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/controller/ControllerBief.java 2008-12-30 15:19:53 UTC (rev 4316) @@ -26,7 +26,7 @@ /** * Controller permettant de g\xE9rer (cr\xE9er, modifier, supprimer, selectionner) les biefs. * @author Emmanuel MARTIN - * @version $Id:$ + * @version $Id$ */ public class ControllerBief { @@ -57,20 +57,20 @@ * Se r\xE9g\xE9n\xE8re par rapport aux 2d. */ public void updateFrom2d(){ - // Suppression des biefs pr\xE9c\xE9dents - String[] names=biefSet_.getBiefNames(); - for(int i=0;i<names.length;i++) - biefSet_.removeBief(names[i], null); - // Ajout des nouveaux importBiefsFrom2d(controller1d_.getImplementation().get2dFrame().getVisuPanel().getArbreCalqueModel().getRootCalque().getCalqueParNom("gcBiefs")); } /** - * Import les biefs du 2d vers le 1d. + * Importe les biefs du 2d vers le 1d. */ private void importBiefsFrom2d(BCalque _rootCalque) { if (_rootCalque==null) return; + int selectedValue=biefSelectionModel_.getMinSelectionIndex(); + // Suppression des biefs pr\xE9c\xE9dents + String[] names=biefSet_.getBiefNames(); + for(int i=0;i<names.length;i++) + biefSet_.removeBief(names[i], null); BCalque[] calques=_rootCalque.getCalques(); // It\xE9ration du chaque bief for (int i=0; i<calques.length; i++) { @@ -82,11 +82,11 @@ if (sousCalques[j] instanceof FSigLayerLineEditable) modelsDuFutureBief.add(((FSigLayerLineEditable)sousCalques[j]).getModele()); // Ajout du bief - biefSet_.addBief(calqueBief.getTitle(), modelsDuFutureBief.toArray(new ZModeleLigneBrisee[0]), controller1d_.getCommandManager()); + biefSet_.addBief(calqueBief.getTitle(), modelsDuFutureBief.toArray(new ZModeleLigneBrisee[0]), null); } // Selection d'office du premier Bief si il y en a un - if(biefSet_.getNbBief()>0) - biefSelectionModel_.addSelectionInterval(0, 0); + if(biefSet_.getNbBief()>0&&selectedValue!=-1) + biefSelectionModel_.addSelectionInterval(selectedValue, selectedValue); } /** 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 2008-12-24 15:09:43 UTC (rev 4315) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/Bief.java 2008-12-30 15:19:53 UTC (rev 4316) @@ -7,19 +7,31 @@ */ package org.fudaa.fudaa.modeleur.modeleur1d.model; +import java.util.Arrays; +import java.util.Comparator; + import org.fudaa.ctulu.gis.GISAttributeConstants; +import org.fudaa.ctulu.gis.GISAttributeInterface; +import org.fudaa.ctulu.gis.GISCoordinateSequenceContainerInterface; +import org.fudaa.ctulu.gis.GISCoordinateSequenceFactory; +import org.fudaa.ctulu.gis.GISPolyligne; +import org.fudaa.ctulu.gis.GISZoneCollection; import org.fudaa.ctulu.gis.GISZoneCollectionLigneBrisee; import org.fudaa.ebli.calque.ZModeleLigneBrisee; import org.fudaa.fudaa.modeleur.layer.MdlModel1dAxe; import org.fudaa.fudaa.modeleur.layer.MdlModel1dBank; -import org.fudaa.fudaa.modeleur.layer.MdlModel1dStorageLimit; +import org.fudaa.fudaa.modeleur.layer.MdlModel2dConstraintLine; import org.fudaa.fudaa.modeleur.layer.MdlModel2dDirectionLine; import org.fudaa.fudaa.modeleur.layer.MdlModel2dProfile; +import com.vividsolutions.jts.geom.Coordinate; +import com.vividsolutions.jts.geom.CoordinateSequence; +import com.vividsolutions.jts.geom.Geometry; + /** * Contient les informations relatives \xE0 un bief. * @author Emmanuel MARTIN - * @version $Id:$ + * @version $Id$ */ public class Bief { public ZModeleLigneBrisee axeHydraulique_; @@ -31,39 +43,47 @@ public Bief(){} public Bief(ZModeleLigneBrisee[] _models){ - if(_models==null) + if (_models==null) throw new IllegalArgumentException("_models ne peut pas \xEAtre null."); - for(int i=0;i<_models.length;i++) { - if(_models[i]==null) + for (int i=0; i<_models.length; i++) { + if (_models[i]==null) throw new IllegalArgumentException("_models ne doit pas contenir de valeurs null"); - if(_models[i].getGeomData()==null) + if (_models[i].getGeomData()==null) throw new IllegalArgumentException("Certain model n'ont pas de GSIZone."); - if(!(_models[i].getGeomData() instanceof GISZoneCollectionLigneBrisee)) - throw new IllegalArgumentException("Toutes les GISZOne doivent \xEAtre des GISZoneCollectionLigneBrisee."); - String nature=(String) _models[i].getGeomData().getFixedAttributValue(GISAttributeConstants.NATURE); - if(nature==GISAttributeConstants.ATT_NATURE_AH) - if(axeHydraulique_!=null) + if (!(_models[i].getGeomData() instanceof GISZoneCollectionLigneBrisee)) + throw new IllegalArgumentException("Toutes les GISZone doivent \xEAtre des GISZoneCollectionLigneBrisee."); + String nature=(String)_models[i].getGeomData().getFixedAttributValue(GISAttributeConstants.NATURE); + if (nature==null) + throw new IllegalArgumentException("Une des GISZone ne contient pas l'attribut NATURE."); + if (nature==GISAttributeConstants.ATT_NATURE_AH) + if (axeHydraulique_!=null) throw new IllegalArgumentException("Plusieurs models d'axe hydrauliques sont donn\xE9es."); + else if (_models[i].getGeomData().getNbGeometries()>1) + throw new IllegalArgumentException("Il ne peut pas y avoir plusieurs Axes hydrauliques dans le bief."); else axeHydraulique_=_models[i]; - else if(nature==GISAttributeConstants.ATT_NATURE_LD) - if(lignesDirectrices_!=null) + else if (nature==GISAttributeConstants.ATT_NATURE_LD) + if (lignesDirectrices_!=null) throw new IllegalArgumentException("Plusieurs models de lignes directrices sont donn\xE9es."); else lignesDirectrices_=_models[i]; - else if(nature==GISAttributeConstants.ATT_NATURE_LS) - if(limitesStockages_!=null) + else if (nature==GISAttributeConstants.ATT_NATURE_LC) + if (limitesStockages_!=null) throw new IllegalArgumentException("Plusieurs models de limites de stockage sont donn\xE9es."); + else if (_models[i].getGeomData().getNbGeometries()>2) + throw new IllegalArgumentException("Il ne peut pas y avoir plus de 2 limites de stockage."); else limitesStockages_=_models[i]; - else if(nature==GISAttributeConstants.ATT_NATURE_PF) - if(profils_!=null) + else if (nature==GISAttributeConstants.ATT_NATURE_PF) + if (profils_!=null) throw new IllegalArgumentException("Plusieurs models de profils sont donn\xE9es."); else profils_=_models[i]; - else if(nature==GISAttributeConstants.ATT_NATURE_RV) - if(rives_!=null) + else if (nature==GISAttributeConstants.ATT_NATURE_RV) + if (rives_!=null) throw new IllegalArgumentException("Plusieurs models de rives sont donn\xE9es."); + else if (_models[i].getGeomData().getNbGeometries()>2) + throw new IllegalArgumentException("Il ne peut pas y avoir plus de 2 rives."); else rives_=_models[i]; } @@ -75,15 +95,184 @@ if (rives_==null) rives_=new MdlModel1dBank(null, null); if (limitesStockages_==null) - limitesStockages_=new MdlModel1dStorageLimit(null, null); + limitesStockages_=new MdlModel2dConstraintLine(null, null); if (lignesDirectrices_==null) lignesDirectrices_=new MdlModel2dDirectionLine(null, null); + // Valuation des attributs sp\xE9cifiques au 1d \\ + // Verification de la pr\xE9sences des attributs + GISZoneCollection zone=profils_.getGeomData(); + int attToAdd=0; + int idxIlsd=zone.getIndiceOf(GISAttributeConstants.INTERSECTION_LIMITE_STOCKAGE_DROITE); + if (idxIlsd==-1) + attToAdd++; + int idxIlsg=zone.getIndiceOf(GISAttributeConstants.INTERSECTION_LIMITE_STOCKAGE_GAUCHE); + if (idxIlsg==-1) + attToAdd++; + int idxRd=zone.getIndiceOf(GISAttributeConstants.INTERSECTION_RIVE_DROITE); + if (idxRd==-1) + attToAdd++; + int idxRg=zone.getIndiceOf(GISAttributeConstants.INTERSECTION_RIVE_GAUCHE); + if (idxRg==-1) + attToAdd++; + // Ajout des attributs manquant \\ + if (attToAdd>0) { + GISAttributeInterface[] atts=new GISAttributeInterface[zone.getNbAttributes()+attToAdd]; + int k=0; + for (k=0; k<zone.getNbAttributes(); k++) + atts[k]=zone.getAttribute(k); + if (idxIlsd==-1) + atts[k++]=GISAttributeConstants.INTERSECTION_LIMITE_STOCKAGE_DROITE; + if (idxIlsg==-1) + atts[k++]=GISAttributeConstants.INTERSECTION_LIMITE_STOCKAGE_GAUCHE; + if (idxRd==-1) + atts[k++]=GISAttributeConstants.INTERSECTION_RIVE_DROITE; + if (idxRg==-1) + atts[k++]=GISAttributeConstants.INTERSECTION_RIVE_GAUCHE; + zone.setAttributes(atts, null); + } + int idxAttRiveGauche=zone.getIndiceOf(GISAttributeConstants.INTERSECTION_RIVE_GAUCHE); + int idxAttRiveDroite=zone.getIndiceOf(GISAttributeConstants.INTERSECTION_RIVE_DROITE); + int idxAttlsGauche=zone.getIndiceOf(GISAttributeConstants.INTERSECTION_LIMITE_STOCKAGE_GAUCHE); + int idxAttlsDroite=zone.getIndiceOf(GISAttributeConstants.INTERSECTION_LIMITE_STOCKAGE_DROITE); + 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); + } + if (axeHydraulique_.getNombre()==1) { + Geometry axeHydraulique=(Geometry)axeHydraulique_.getObject(0); + CoordinateSequence seqAxeHydraulique=((GISCoordinateSequenceContainerInterface)axeHydraulique).getCoordinateSequence(); + // R\xE9ordonnancement des profils selon leur placement sur l'axe hydaulique (abs curv) \\ + // Calcul des abscisses curvilignes + 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."); + idxAbsCurv[j]=new Object[]{j, UtilsProfil1d.abscisseCurviligne(seqAxeHydraulique, intersection.getCoordinate())}; + } + // Tri en fonctino des abcsisses curvilignes + Arrays.sort((Object[])idxAbsCurv, new Comparator<Object>(){ + public int compare(Object o1, Object o2) { + double absCurvO1=(Double)((Object[])o1)[1]; + double absCurvO2=(Double)((Object[])o2)[1]; + if(absCurvO1<absCurvO2) return -1; + if(absCurvO1==absCurvO2) return 0; + else return 1; + } + }); + // R\xE9odonnancement en fonction du nouvel ordre + for (int i=0; i<idxAbsCurv.length; i++) { + if(i!=(Integer)idxAbsCurv[i][0]) { + // Mise \xE0 jour de la table de correspondance + boolean found=false; + int k=i; + while(!found&&++k<idxAbsCurv.length) + found=(Integer) idxAbsCurv[k][0]==i; + if(found) + idxAbsCurv[k][0]=idxAbsCurv[i][0]; + // Mise \xE0 jour de la gis + profils_.getGeomData().switchGeometries((Integer) idxAbsCurv[i][0], i, null); + + } + } + // Construction des rives et limites de stockages \\ + 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) { + Coordinate[] coords=((Geometry)profil).getCoordinates(); + for (int l=0; l<coords.length/2; l++) { + Coordinate tmp=coords[l]; + coords[l]=coords[coords.length-1-l]; + coords[coords.length-1-l]=tmp; + } + zone.setCoordinateSequence(k, new GISCoordinateSequenceFactory().create(coords), null); + profil=(Geometry)profils_.getGeomData().getGeometry(k); + seqProfil=((GISCoordinateSequenceContainerInterface)profil).getCoordinateSequence(); + } + double abscisseCurvIntersectionAxe=UtilsProfil1d.abscisseCurviligne(seqProfil, interAxeProfil); + // D\xE9tection des croisements rives gauches et rives droites \\ + // valeur par defaut + zone.setAttributValue(idxAttRiveGauche, k, seqProfil.getCoordinate(0), null); + zone.setAttributValue(idxAttRiveDroite, k, seqProfil.getCoordinate(seqProfil.size()-1), null); + for (int l=0; l<rives_.getNombre(); l++) { + Geometry inter=((Geometry)rives_.getObject(l)).intersection(profil); + if (inter.getNumPoints()>0) + if (abscisseCurvIntersectionAxe>UtilsProfil1d.abscisseCurviligne(seqProfil, inter.getCoordinate())) + zone.setAttributValue(idxAttRiveGauche, k, inter.getCoordinate(), null); + else + zone.setAttributValue(idxAttRiveDroite, k, inter.getCoordinate(), null); + } + // D\xE9tection des croisements zones de stockage droite et gauche \\ + // Valeur par defaut + zone.setAttributValue(idxAttlsGauche, k, seqProfil.getCoordinate(0), null); + zone.setAttributValue(idxAttlsDroite, k, seqProfil.getCoordinate(seqProfil.size()-1), null); + for (int l=0; l<limitesStockages_.getNombre(); l++) { + Geometry inter=((Geometry)limitesStockages_.getObject(l)).intersection(profil); + if (inter.getNumPoints()>0) + if (abscisseCurvIntersectionAxe>UtilsProfil1d.abscisseCurviligne(seqProfil, inter.getCoordinate())) + zone.setAttributValue(idxAttlsGauche, k, inter.getCoordinate(), null); + else + zone.setAttributValue(idxAttlsDroite, k, inter.getCoordinate(), null); + } + } + } + // Simplification des rives \\ + rives_=new MdlModel1dBank(null, null); + Coordinate[] riveGauche=new Coordinate[profils_.getNombre()]; + Coordinate[] riveDroite=new Coordinate[profils_.getNombre()]; + for (int i=0; i<profils_.getNombre(); i++) { + riveGauche[i]=(Coordinate)zone.getValue(idxAttRiveGauche, i); + riveDroite[i]=(Coordinate)zone.getValue(idxAttRiveDroite, i); + } + if (riveGauche.length>1&&riveGauche[0]!=null) + rives_.getGeomData().addGeometry(new GISPolyligne(new GISCoordinateSequenceFactory().create(riveGauche)), null, null); + if (riveDroite.length>1&&riveDroite[0]!=null) + rives_.getGeomData().addGeometry(new GISPolyligne(new GISCoordinateSequenceFactory().create(riveDroite)), null, null); + // Simplification des zones de stockages \\ + limitesStockages_=new MdlModel2dConstraintLine(null, null); + Coordinate[] lsGauche=new Coordinate[profils_.getNombre()]; + Coordinate[] lsDroite=new Coordinate[profils_.getNombre()]; + for (int i=0; i<profils_.getNombre(); i++) { + lsGauche[i]=(Coordinate)zone.getValue(idxAttlsGauche, i); + lsDroite[i]=(Coordinate)zone.getValue(idxAttlsDroite, i); + } + if (lsGauche.length>0&&lsGauche[0]!=null) + limitesStockages_.getGeomData() + .addGeometry(new GISPolyligne(new GISCoordinateSequenceFactory().create(lsGauche)), null, null); + if (lsDroite.length>0&&lsDroite[0]!=null) + limitesStockages_.getGeomData() + .addGeometry(new GISPolyligne(new GISCoordinateSequenceFactory().create(lsDroite)), null, null); } /** * Retourne vrai si les donn\xE9es contenues dans les champs sont coh\xE9rentes. */ public boolean checkCoherence(){ + // TODO ajouter la verification de la pr\xE9sences des attribtus n\xE9c\xE9ssaires if (axeHydraulique_==null||profils_==null||rives_==null||limitesStockages_==null||lignesDirectrices_==null) return false; // Axe hydraulique @@ -101,7 +290,7 @@ // Limite de stockage if (limitesStockages_.getGeomData()==null||!(limitesStockages_.getGeomData() instanceof GISZoneCollectionLigneBrisee)) return false; - if ((String)limitesStockages_.getGeomData().getFixedAttributValue(GISAttributeConstants.NATURE)!=GISAttributeConstants.ATT_NATURE_LS) + if ((String)limitesStockages_.getGeomData().getFixedAttributValue(GISAttributeConstants.NATURE)!=GISAttributeConstants.ATT_NATURE_LC) return false; if(limitesStockages_.getNbPolyligne()>2) return false; Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/ProfilContainerAdapter.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/ProfilContainerAdapter.java 2008-12-24 15:09:43 UTC (rev 4315) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/ProfilContainerAdapter.java 2008-12-30 15:19:53 UTC (rev 4316) @@ -100,12 +100,12 @@ private CtuluCollection z_; private List<Double> curv_; // Caches \\ - int idxZMax_; - int idxZMin_; + private int idxZMax_; + private int idxZMin_; // Le profil est potentiellement coup\xE9 en trois, les deux indices qui suivent // indique l'index de chacune de ces ruptures. - int idxRupture1_; - int idxRupture2_; + private int idxRupture1_; + private int idxRupture2_; public ProfilContainerAdapter(BiefContainer _biefContainer) { biefContainer_=_biefContainer; @@ -514,14 +514,14 @@ Coordinate aZ0=new Coordinate(a.x, a.y, 0); Coordinate bZ0=new Coordinate(b.x, b.y, 0); Coordinate cZ0=new Coordinate(c.x, c.y, 0); - Coordinate vecReference=vec(cZ0, proj(cZ0, aZ0, bZ0)); - Coordinate cProj=proj(new Coordinate(x1, y1, 0), aZ0, bZ0); - assert(egal(cProj, proj(new Coordinate(x2, y2, 0), aZ0, bZ0), 0.0001, false)); - if(egal(vecReference, vec(new Coordinate(x1, y1, 0), cProj), 0.0001, true)){ + Coordinate vecReference=UtilsProfil1d.vec(cZ0, UtilsProfil1d.proj(cZ0, aZ0, bZ0)); + Coordinate cProj=UtilsProfil1d.proj(new Coordinate(x1, y1, 0), aZ0, bZ0); + assert(UtilsProfil1d.egal(cProj, UtilsProfil1d.proj(new Coordinate(x2, y2, 0), aZ0, bZ0), 0.0001, false)); + if(UtilsProfil1d.egal(vecReference, UtilsProfil1d.vec(new Coordinate(x1, y1, 0), cProj), 0.0001, true)){ newX=x1; newY=y1; } - else if(egal(vecReference, vec(new Coordinate(x2, y2, 0), cProj), 0.0001, true)) { + else if(UtilsProfil1d.egal(vecReference, UtilsProfil1d.vec(new Coordinate(x2, y2, 0), cProj), 0.0001, true)) { newX=x2; newY=y2; } @@ -724,55 +724,4 @@ for(ProfilContainerListener listener:listeners_) listener.profilContainerSelectedChanged(_idxOldProfil, _idxNewProfil); } - - // Quelques fonctions m\xE9th\xE9matiques \\ - - /** - * retourne le vecteur _a, _b sous forme de Coordinate. - */ - private Coordinate vec(Coordinate _a, Coordinate _b){ - return new Coordinate(_b.x-_a.x, _b.y-_a.y, _b.z-_a.z); - } - - /** - * Retourne la projection de _a sur la droite _b_c. - * Attention : Il s'agit bien d'une projection sur une - * droite et non un segment de droite : le r\xE9sultat - * peut \xEAtre en dehors de [_b, _c] - */ - private Coordinate proj(Coordinate _a, Coordinate _b, Coordinate _c){ - Coordinate vBC=vec(_b, _c); - Coordinate vBA=vec(_b, _a); - double normeBC=Math.sqrt(vBC.x*vBC.x+vBC.y*vBC.y+vBC.z*vBC.z); - double produitScalaireBCBA=vBC.x*vBA.x+vBC.y*vBA.y+vBC.z*vBA.z; - double rapportSurBC=produitScalaireBCBA/(normeBC*normeBC); - return new Coordinate(vBC.x*rapportSurBC+_b.x, vBC.y*rapportSurBC+_b.y, vBC.z*rapportSurBC+_b.z); - } - - /** - * Normalise le vecteur pass\xE9 en param\xE8tre. - */ - private Coordinate normalisation(Coordinate _a){ - double normeA=Math.sqrt(_a.x*_a.x+_a.y*_a.y+_a.z*_a.z); - _a.x=_a.x/normeA; - _a.y=_a.y/normeA; - _a.z=_a.z/normeA; - return _a; - } - - /** - * Compars les deux vecteurs avec la tol\xE9rance donn\xE9e. - * Le dernier param\xE8tre indique si un normalisation des - * deux vecteurs doit \xEAtre faite avec la comparaison. - * Les vecteurs ne sont pas modif\xE9s dans l'op\xE9ration. - */ - private boolean egal(Coordinate _a, Coordinate _b, double _tolerance, boolean _normalisation) { - if(_normalisation){ - normalisation(_a); - normalisation(_b); - } - Coordinate diff=vec(_a, _b); - return Math.abs(diff.x)<_tolerance&&Math.abs(diff.y)<_tolerance&&Math.abs(diff.z)<_tolerance; - } - } 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 2008-12-24 15:09:43 UTC (rev 4315) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/UtilsProfil1d.java 2008-12-30 15:19:53 UTC (rev 4316) @@ -9,6 +9,7 @@ import org.fudaa.ctulu.gis.GISCoordinateSequenceContainerInterface; import org.fudaa.ctulu.gis.GISGeometryFactory; +import org.fudaa.ctulu.gis.GISPoint; import org.fudaa.ctulu.gis.GISZoneCollectionLigneBrisee; import com.vividsolutions.jts.geom.Coordinate; @@ -18,7 +19,7 @@ /** * Quelques fonctions aidant pour la manipulation des profils en 1d. * @author Emmanuel MARTIN - * @version $Id:$ + * @version $Id$ */ public class UtilsProfil1d { @@ -105,4 +106,112 @@ return true; } + // Quelques fonctions m\xE9th\xE9matiques \\ + + /** + * retourne le vecteur _a, _b sous forme de Coordinate. + */ + static public Coordinate vec(Coordinate _a, Coordinate _b){ + return new Coordinate(_b.x-_a.x, _b.y-_a.y, _b.z-_a.z); + } + + /** + * Retourne la projection de _a sur la droite _b_c. + * Attention : Il s'agit bien d'une projection sur une + * droite et non un segment de droite : le r\xE9sultat + * peut \xEAtre en dehors de [_b, _c] + */ + static public Coordinate proj(Coordinate _a, Coordinate _b, Coordinate _c){ + Coordinate vBC=vec(_b, _c); + Coordinate vBA=vec(_b, _a); + double normeBC=Math.sqrt(vBC.x*vBC.x+vBC.y*vBC.y+vBC.z*vBC.z); + double produitScalaireBCBA=vBC.x*vBA.x+vBC.y*vBA.y+vBC.z*vBA.z; + double rapportSurBC=produitScalaireBCBA/(normeBC*normeBC); + return new Coordinate(vBC.x*rapportSurBC+_b.x, vBC.y*rapportSurBC+_b.y, vBC.z*rapportSurBC+_b.z); + } + + /** + * Normalise le vecteur pass\xE9 en param\xE8tre. + */ + static public Coordinate normalisation(Coordinate _a){ + double normeA=Math.sqrt(_a.x*_a.x+_a.y*_a.y+_a.z*_a.z); + _a.x=_a.x/normeA; + _a.y=_a.y/normeA; + _a.z=_a.z/normeA; + return _a; + } + + /** + * Compars les deux vecteurs avec la tol\xE9rance donn\xE9e. + * Le dernier param\xE8tre indique si un normalisation des + * deux vecteurs doit \xEAtre faite avec la comparaison. + * Les vecteurs ne sont pas modif\xE9s dans l'op\xE9ration. + */ + static public boolean egal(Coordinate _a, Coordinate _b, double _tolerance, boolean _normalisation) { + if(_normalisation){ + normalisation(_a); + normalisation(_b); + } + Coordinate diff=vec(_a, _b); + return Math.abs(diff.x)<_tolerance&&Math.abs(diff.y)<_tolerance&&Math.abs(diff.z)<_tolerance; + } + + /** + * Retourne l'index du point pr\xE9c\xE9dent la coordonn\xE9e indiqu\xE9e sur la coordinateSequence donn\xE9e. + * Retourne -1 si la coordonn\xE9e donn\xE9e correspond \xE0 l'index 0. + * Retourne -2 si la coordonn\xE9e n'appartient pas \xE0 la g\xE9om\xE9trie. + */ + static public int getPreviousIndex(CoordinateSequence _geom, Coordinate _point) { + if(_geom.size()>0&&_point.equals(_geom.getCoordinate(0))) + return -1; + boolean fini=false; + int i=-1; + GISPoint point=new GISPoint(_point); + while (!fini&&++i<_geom.size()-1) + fini=(GISGeometryFactory.INSTANCE + .createLineString(new Coordinate[]{_geom.getCoordinate(i), _geom.getCoordinate(i+1)})).distance(point)<0.0001; + if(!fini) + return -2; + else + return i; + } + + /** + * Retourne l'index du point suivant la coordonn\xE9e indiqu\xE9e sur la coordinateSequence donn\xE9e. + * Retourne -1 si la coordonn\xE9e donn\xE9e correspond au dernier l'index. + * Retourne -2 si la coordonn\xE9e n'appartient pas \xE0 la g\xE9om\xE9trie. + */ + static public int getNextIndex(CoordinateSequence _geom, Coordinate _point) { + if(_geom.size()>0&&_point.equals(_geom.getCoordinate(_geom.size()-1))) + return -1; + boolean fini=false; + int i=_geom.size()-1; + GISPoint point=new GISPoint(_point); + while (!fini&&--i>0) + fini=(GISGeometryFactory.INSTANCE + .createLineString(new Coordinate[]{_geom.getCoordinate(i-1), _geom.getCoordinate(i)})).distance(point)<0.0001; + if(!fini) + return -2; + else + return i; + } + + /** + * Retourne l'abscisse curviligne du point '_point' de la polyligne '_geom'. + * Si la coordonn\xE9e n'appartient pas \xE0 la geometry, -1 est retourn\xE9. + */ + static public double abscisseCurviligne(CoordinateSequence _geom, Coordinate _point){ + int i=getPreviousIndex(_geom, _point); + if(i==-1) + return 0; + if(i==-2) + return -1; + // Calcule de l'abscisse curviligne + double valueCurviligne=0; + for (int j=1; j<=i; j++) + valueCurviligne+=_geom.getCoordinate(j).distance(_geom.getCoordinate(j-1)); + // Mise \xE0 jour de l'abscisse curviligne + valueCurviligne+=_geom.getCoordinate(i).distance(_point); + return valueCurviligne; + } } Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/VueBief.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/VueBief.java 2008-12-24 15:09:43 UTC (rev 4315) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/VueBief.java 2008-12-30 15:19:53 UTC (rev 4316) @@ -18,9 +18,9 @@ import org.fudaa.fudaa.modeleur.MdlImplementation; import org.fudaa.fudaa.modeleur.layer.MdlLayer1dAxe; import org.fudaa.fudaa.modeleur.layer.MdlLayer1dBank; +import org.fudaa.fudaa.modeleur.layer.MdlLayer2dConstraintLine; import org.fudaa.fudaa.modeleur.layer.MdlLayer2dDirectionLine; import org.fudaa.fudaa.modeleur.layer.MdlLayer2dProfile; -import org.fudaa.fudaa.modeleur.layer.MdlLayer2dStorageLimit; import org.fudaa.fudaa.modeleur.modeleur1d.controller.ControllerBief; import org.fudaa.fudaa.modeleur.modeleur1d.model.Bief; import org.fudaa.fudaa.sig.layer.FSigEditor; @@ -78,7 +78,7 @@ lignesDirectrices.modele(bief.lignesDirectrices_); groupeCalque.add(lignesDirectrices); // Ajout du calque de limites de stockage - MdlLayer2dStorageLimit limitesStockage=new MdlLayer2dStorageLimit((FSigEditor)gisEditor_); + MdlLayer2dConstraintLine limitesStockage=new MdlLayer2dConstraintLine((FSigEditor)gisEditor_); limitesStockage.modele(bief.limitesStockages_); groupeCalque.add(limitesStockage); // Ajout du calque de profils Added: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/persistence/MdlLayer2dBankPersistence.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/persistence/MdlLayer2dBankPersistence.java (rev 0) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/persistence/MdlLayer2dBankPersistence.java 2008-12-30 15:19:53 UTC (rev 4316) @@ -0,0 +1,30 @@ +/* + * @creation 29 d\xE9c. 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.persistence; + +import org.fudaa.fudaa.modeleur.layer.MdlLayer1dBank; +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 de lignes de rive. + * @author Emmanuel MARTIN + * @see MdlLayer2dProfile + */ +public class MdlLayer2dBankPersistence extends MdlLayer2dLinePersistence { + + /* (non-Javadoc) + * @see org.fudaa.fudaa.modeleur.persistence.MdlLayer2dLinePersistence#createNewLayer(org.fudaa.fudaa.sig.layer.FSigEditor) + */ + @Override + protected MdlLayer2dLine createNewLayer(FSigEditor _editor) { + return new MdlLayer1dBank(_editor); + } + +} Property changes on: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/persistence/MdlLayer2dBankPersistence.java ___________________________________________________________________ Added: svn:keywords + Id Added: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <emm...@us...> - 2008-12-24 15:09:48
|
Revision: 4315 http://fudaa.svn.sourceforge.net/fudaa/?rev=4315&view=rev Author: emmanuel_martin Date: 2008-12-24 15:09:43 +0000 (Wed, 24 Dec 2008) Log Message: ----------- Ajout de la base de la gestion multi-bief ; ajout de la base d'un module de gestion de profil ; mise ?\195?\160 jour par rapport au 2d chaque fois que la fen?\195?\170tre 1d prendre le focus. 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/view/VueBief.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/VueCourbe.java 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/VueModuleGestionProfil.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/VueTableau.java Added Paths: ----------- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/layer/MdlLayer1dBank.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/layer/MdlLayer2dStorageLimit.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/layer/MdlModel1dBank.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/layer/MdlModel1dStorageLimit.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/controller/ControllerProfil.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/BiefContainer.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/BiefContainerAdapter.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/BiefContainerListener.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/BiefSetListener.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/ProfilContainer.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/ProfilContainerAdapter.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/ProfilContainerException.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/ProfilContainerListener.java Removed Paths: ------------- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/DataGeometry.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/DataGeometryAdapter.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/DataGeometryException.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/DataGeometryListener.java Copied: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/layer/MdlLayer1dBank.java (from rev 4312, branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/DataGeometryListener.java) =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/layer/MdlLayer1dBank.java (rev 0) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/layer/MdlLayer1dBank.java 2008-12-24 15:09:43 UTC (rev 4315) @@ -0,0 +1,60 @@ +/* + * @creation 23 d\xE9c. 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.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.MdlLayer2dDirectionLinePersistence; +import org.fudaa.fudaa.sig.layer.FSigEditor; + +/** + * Un calque pour le stockage et la manipulation des rives. + * @author Emmanuel MARTIN + * @version $Id:$ + */ +public class MdlLayer1dBank extends MdlLayer2dLine { + + /** + * Constructeur. Utilise un mod\xE8le de donn\xE9es et un editeur. + * @param _model Modele + * @param _editor Editeur. + */ + private MdlLayer1dBank(ZModeleLigneBriseeEditable _model, final FSigEditor _editor) { + super(_model,_editor); + setLineModel(0, new TraceLigneModel(TraceLigne.LISSE, 1.5f, new Color(102,102,255))); + setLineModelOuvert(getLineModel(0)); + setName(getExtName()); + setTitle(MdlResource.MDL.getString("Rives")); + } + + public MdlLayer1dBank(FSigEditor _editor) { + this(new MdlModel1dBank(_editor,_editor.getMng()),_editor); + } + + public BCalquePersistenceInterface getPersistenceMng() { + return new MdlLayer2dDirectionLinePersistence(); + } + + /** + * Retourne le nom par defaut du calque. + * @return Le nom. + */ + public String getExtName() { + return "rives"; + } + + public boolean canAddForme(int _typeForme) { + return _typeForme==DeForme.LIGNE_BRISEE; + } +} \ No newline at end of file Property changes on: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/layer/MdlLayer1dBank.java ___________________________________________________________________ Added: svn:keywords + Id Added: svn:mergeinfo + /branches/Br_FudaaModeleur_TF/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/DataGeometryListener.java:3445-3850 /branches/FudaaModeleur_TC1/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/DataGeometryListener.java:3861-3891 Added: svn:eol-style + native Copied: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/layer/MdlLayer2dStorageLimit.java (from rev 4312, branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/DataGeometryListener.java) =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/layer/MdlLayer2dStorageLimit.java (rev 0) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/layer/MdlLayer2dStorageLimit.java 2008-12-24 15:09:43 UTC (rev 4315) @@ -0,0 +1,60 @@ +/* + * @creation 23 d\xE9c. 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.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.MdlLayer2dDirectionLinePersistence; +import org.fudaa.fudaa.sig.layer.FSigEditor; + +/** + * Un calque pour le stockage et la manipulation des limites de stockage. + * @author Emmanuel MARTIN + * @version $Id$ + */ +public class MdlLayer2dStorageLimit extends MdlLayer2dLine { + + /** + * Constructeur. Utilise un mod\xE8le de donn\xE9es et un editeur. + * @param _model Modele + * @param _editor Editeur. + */ + private MdlLayer2dStorageLimit(ZModeleLigneBriseeEditable _model, final FSigEditor _editor) { + super(_model,_editor); + setLineModel(0, new TraceLigneModel(TraceLigne.LISSE, 1.5f, new Color(102,102,255))); + setLineModelOuvert(getLineModel(0)); + setName(getExtName()); + setTitle(MdlResource.MDL.getString("Limites de stockage")); + } + + public MdlLayer2dStorageLimit(FSigEditor _editor) { + this(new MdlModel1dStorageLimit(_editor,_editor.getMng()),_editor); + } + + public BCalquePersistenceInterface getPersistenceMng() { + return new MdlLayer2dDirectionLinePersistence(); + } + + /** + * Retourne le nom par defaut du calque. + * @return Le nom. + */ + public String getExtName() { + return "stockage"; + } + + 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/MdlLayer2dStorageLimit.java ___________________________________________________________________ Added: svn:keywords + Id Added: svn:mergeinfo + /branches/Br_FudaaModeleur_TF/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/DataGeometryListener.java:3445-3850 /branches/FudaaModeleur_TC1/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/DataGeometryListener.java:3861-3891 Added: svn:eol-style + native Added: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/layer/MdlModel1dBank.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/layer/MdlModel1dBank.java (rev 0) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/layer/MdlModel1dBank.java 2008-12-24 15:09:43 UTC (rev 4315) @@ -0,0 +1,40 @@ +/* + * @creation 23 d\xE9c. 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.layer; + +import org.fudaa.ctulu.CtuluCommandContainer; +import org.fudaa.ctulu.gis.GISAttribute; +import org.fudaa.ctulu.gis.GISAttributeConstants; +import org.fudaa.ebli.calque.ZModelGeometryListener; + +/** + * Un mod\xE8le de gestion de rive. + * @author Emmanuel MARTIN + * @version $Id:$ + */ +public class MdlModel1dBank extends MdlModel2dLine { + + /** + * Construction d'un modele de profil avec pile de commandes. + * @param _cmd La pile de commandes pour le undo/redo. + */ + public MdlModel1dBank(final ZModelGeometryListener _listener, final CtuluCommandContainer _cmd) { + super(_listener); + GISAttribute[] attrs=new GISAttribute[]{ + GISAttributeConstants.BATHY, + GISAttributeConstants.ETAT_GEOM, + GISAttributeConstants.TITRE, + GISAttributeConstants.NATURE, + GISAttributeConstants.VISIBILITE + }; + // Pas de container de commande pour cette op\xE9ration, sinon conserv\xE9 en undo/redo. + getGeomData().setAttributes(attrs, null); + getGeomData().setAttributeIsZ(GISAttributeConstants.BATHY); + getGeomData().setFixedAttributeValue(GISAttributeConstants.NATURE, GISAttributeConstants.ATT_NATURE_RV); + } +} Property changes on: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/layer/MdlModel1dBank.java ___________________________________________________________________ Added: svn:keywords + Id Added: svn:eol-style + native Added: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/layer/MdlModel1dStorageLimit.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/layer/MdlModel1dStorageLimit.java (rev 0) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/layer/MdlModel1dStorageLimit.java 2008-12-24 15:09:43 UTC (rev 4315) @@ -0,0 +1,40 @@ +/* + * @creation 23 d\xE9c. 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.layer; + +import org.fudaa.ctulu.CtuluCommandContainer; +import org.fudaa.ctulu.gis.GISAttribute; +import org.fudaa.ctulu.gis.GISAttributeConstants; +import org.fudaa.ebli.calque.ZModelGeometryListener; + +/** + * Un mod\xE8le de gestion de limite de stockage. + * @author Emmanuel MARTIN + * @version $Id:$ + */ +public class MdlModel1dStorageLimit extends MdlModel2dLine { + + /** + * Construction d'un modele de profil avec pile de commandes. + * @param _cmd La pile de commandes pour le undo/redo. + */ + public MdlModel1dStorageLimit(final ZModelGeometryListener _listener, final CtuluCommandContainer _cmd) { + super(_listener); + GISAttribute[] attrs=new GISAttribute[]{ + GISAttributeConstants.BATHY, + GISAttributeConstants.ETAT_GEOM, + GISAttributeConstants.TITRE, + GISAttributeConstants.NATURE, + GISAttributeConstants.VISIBILITE + }; + // Pas de container de commande pour cette op\xE9ration, sinon conserv\xE9 en undo/redo. + getGeomData().setAttributes(attrs, null); + getGeomData().setAttributeIsZ(GISAttributeConstants.BATHY); + getGeomData().setFixedAttributeValue(GISAttributeConstants.NATURE, GISAttributeConstants.ATT_NATURE_LS); + } +} \ No newline at end of file Property changes on: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/layer/MdlModel1dStorageLimit.java ___________________________________________________________________ Added: svn:keywords + Id Added: svn:eol-style + native 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 2008-12-22 15:13:02 UTC (rev 4314) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/controller/Controller1d.java 2008-12-24 15:09:43 UTC (rev 4315) @@ -29,7 +29,6 @@ import org.fudaa.ctulu.gis.GISAttributeConstants; import org.fudaa.ctulu.gis.GISZoneCollectionLigneBrisee; import org.fudaa.dodico.mascaret.io.MascaretWriter; -import org.fudaa.ebli.calque.BArbreCalqueModel; import org.fudaa.ebli.calque.ZCalqueAffichageDonneesInterface; import org.fudaa.ebli.calque.ZScene; import org.fudaa.ebli.calque.ZSelectionEvent; @@ -42,15 +41,12 @@ import org.fudaa.fudaa.commun.FudaaLib; import org.fudaa.fudaa.modeleur.MdlImplementation; import org.fudaa.fudaa.modeleur.modeleur1d.MdlFille1d; -import org.fudaa.fudaa.modeleur.modeleur1d.model.DataGeometryAdapter; -import org.fudaa.fudaa.modeleur.modeleur1d.model.DataGeometryException; +import org.fudaa.fudaa.modeleur.modeleur1d.model.Bief; import org.fudaa.fudaa.modeleur.modeleur1d.model.UtilsProfil1d; import org.fudaa.fudaa.modeleur.modeleur1d.view.VueBief; import org.fudaa.fudaa.modeleur.modeleur1d.view.VueContainerModules; import org.fudaa.fudaa.modeleur.modeleur1d.view.VueCourbe; import org.fudaa.fudaa.modeleur.modeleur1d.view.VueExport; -import org.fudaa.fudaa.modeleur.modeleur1d.view.VueModuleGestionBief; -import org.fudaa.fudaa.modeleur.modeleur1d.view.VueModuleGestionProfil; import org.fudaa.fudaa.modeleur.modeleur1d.view.VueTableau; import com.memoire.bu.BuDesktop; @@ -65,8 +61,7 @@ */ public class Controller1d extends InternalFrameAdapter implements ZSelectionListener, ListSelectionListener, CtuluListSelectionListener { - /** La vue du bief. */ - private VueBief vueBief_; + // Les vues \\ /** La vue d'un profil par tableau. */ private VueTableau vueTableau_; /** La vue d'un profil via une courbe. */ @@ -75,25 +70,25 @@ private BuLabel vueError_; /** La vue des modules contenu dans la colonne \xE0 droite. */ private VueContainerModules vueContainerModules_; - /** La vue du module de gestion des biefs. */ - private VueModuleGestionBief vueModuleGestionBief_; - /** La vue du module de gestion des Profils. */ - private VueModuleGestionProfil vueModuleGestionProfil_; - - /** Le lien avec le reste de l'application. */ - private MdlImplementation appli_; /** La frame contenant tous les widgets 1d. */ private MdlFille1d frame1d_; + // Donn\xE9es sp\xE9ciales \\ + /** Le lien avec le reste de l'application. */ + private MdlImplementation appli_; /** Indique si on doit \xE9couter les \xE9venements de selection. */ private boolean listenEventSelection_=true; /** Formater */ private EbliFormatterInterface formater_=new EbliFormatter(); - /** Le commande manager pour le undo/redo */ private CtuluCommandManager mng_; - /** L'adapter des donn\xE9es de la geometry en cours de manipulation. */ - private DataGeometryAdapter dataGeomAdapter_; + + // Controllers \\ + /** Le controller des Biefs */ + private ControllerBief controllerBief_; + private ControllerProfil controllerProfil_; + + // Models \\ /** Le container des modules contenus \xE0 droite. */ private DefaultListModel modelContainerModules_; @@ -105,42 +100,34 @@ frame1d_.addInternalFrameListener(this); mng_=new CtuluCommandManager(); // Instanciation des Models \\ - try { - dataGeomAdapter_=new DataGeometryAdapter(null, -1); - } - catch (DataGeometryException _exc) { - _exc.printStackTrace(); - } modelContainerModules_=new DefaultListModel(); + // Instanciation des controllers \\ + controllerBief_=new ControllerBief(this); + controllerProfil_=new ControllerProfil(controllerBief_.getBiefSelectionModel(), controllerBief_.getBiefContainer(), this); // Instanciation des Vues \\ // Modules vueContainerModules_=new VueContainerModules(modelContainerModules_); - vueModuleGestionBief_=new VueModuleGestionBief(); - addVueModule(vueModuleGestionBief_); - vueModuleGestionProfil_=new VueModuleGestionProfil(); - addVueModule(vueModuleGestionProfil_); + addVueModule(controllerBief_.getVueModuleGestionBief()); + addVueModule(controllerProfil_.getVueModuleGestionProfil()); // Vue Bief - vueBief_=new VueBief(appli_, this); - vueBief_.getScene().addSelectionListener(this); + controllerBief_.getVueBief().getScene().addSelectionListener(this); // Vue tableau - vueTableau_=new VueTableau(this, dataGeomAdapter_); + vueTableau_=new VueTableau(this, controllerProfil_.getDataGeometry()); vueTableau_.addSelectionListener(this); // Vue courbe - vueCourbe_=new VueCourbe(this, dataGeomAdapter_); + vueCourbe_=new VueCourbe(this, controllerProfil_.getDataGeometry()); vueCourbe_.addSelectionListener(this); // Vue error vueError_=new BuLabel(); vueError_.setForeground(Color.RED); vueError_.setHorizontalAlignment(JLabel.CENTER); clearError(); - // Autre - treeModel_=vueBief_.getArbreCalqueModel(); } // Getters des vues \\ public VueBief getVueBief(){ - return vueBief_; + return controllerBief_.getVueBief(); } public VueTableau getVueTableau(){ return vueTableau_; @@ -200,27 +187,7 @@ public void removeVueModule(JComponent _vueModule){ modelContainerModules_.removeElement(_vueModule); } - - // Gestion de l'arbre \\ - - /** Le model de l'arbre des calques. */ - @Deprecated - private BArbreCalqueModel treeModel_; - - /** Retourne le model de l'abre des calques. */ - @Deprecated - public BArbreCalqueModel getTreeModel(){ - return treeModel_; - } - /** - * Mise \xE0 jour de l'arbre des calques a chaque activation de la fen\xEAtre 1d. La - * mise \xE0 jour s'effectue en fonction des calques 2d. - */ - public void internalFrameActivated(InternalFrameEvent e) { - vueBief_.updateTree(); - } - // Gestion des actions \\ /** Les action \xE0 la fen\xEAtre 1d. */ @@ -238,7 +205,7 @@ BuDesktop buJ=null; if (j instanceof BuDesktop) buJ=(BuDesktop)j; - List<EbliActionInterface> actionAbs=vueBief_.getController().getActions(); + List<EbliActionInterface> actionAbs=controllerBief_.getVueBief().getController().getActions(); // Selection des actions String[] tmpAction=new String[]{"RECTANGLE_SELECTION", "POLYGON_SELECTION", "RESTORE", "ZOOM", "ZOOM_ON_SELECTED", "LAST_VIEW", "MOVE_VIEW", "CHANGE_REFERENCE", "NAVIGATE"}; @@ -271,12 +238,11 @@ */ public void selectionChanged(ZSelectionEvent _evt) { clearError(); - ZScene scene=vueBief_.getScene(); + ZScene scene=controllerBief_.getVueBief().getScene(); int sceneIdSelected=scene.getSelectionHelper().getUniqueSelectedIdx(); boolean ok=true; // Indique si tout s'est bien pass\xE9. if (sceneIdSelected==-1) - try {dataGeomAdapter_.setData(null, -1);} - catch (DataGeometryException _exc) {_exc.printStackTrace();} + controllerProfil_.getProfilSelectionModel().clearSelection(); else { int idSelected=scene.sceneId2LayerId(sceneIdSelected); // Extraction des diff\xE9rentes informations n\xE9c\xE9ssaires au changement de @@ -286,12 +252,7 @@ GISZoneCollectionLigneBrisee zone=((ZModeleLigneBriseeEditable)calque.modeleDonnees()).getGeomData(); if (zone.getIndiceOf(GISAttributeConstants.NATURE)!=-1) { if (zone.getValue(zone.getIndiceOf(GISAttributeConstants.NATURE), idSelected)==GISAttributeConstants.ATT_NATURE_PF) { - try { - dataGeomAdapter_.setData(zone, idSelected); - } - catch (DataGeometryException _exc) { - showError(_exc.getMessage()); - } + controllerProfil_.getProfilSelectionModel().setSelectionInterval(idSelected, idSelected); } else // On a pas selectionn\xE9 un profil, on annule la selection @@ -308,6 +269,7 @@ if(!ok) { //dataGeomAdapter_.setData(null, -1); scene.clearSelection(); + controllerProfil_.getProfilSelectionModel().clearSelection(); showError(FudaaLib.getS("Seuls les profils sont selectionnables.")); } } @@ -340,13 +302,22 @@ VueExport vueExport=new VueExport(appli_); if(!vueExport.run()) return; + // Configuration du mascaretWriter MascaretWriter mascaretWriter=new MascaretWriter(); mascaretWriter.setFile(vueExport.getFile()); - CtuluIOOperationSynthese result=mascaretWriter.write(new Object[]{"Sans_nom", vueBief_.getZonesForExport(), new MascaretWriter.FunctorSelectProfil(){ + Bief bief=controllerBief_.getSelectedBief(); + Object[] zones=new Object[]{bief.axeHydraulique_.getGeomData(), bief.lignesDirectrices_.getGeomData(), + bief.limitesStockages_.getGeomData(), bief.profils_.getGeomData(), bief.rives_.getGeomData()}; + MascaretWriter.FunctorSelectProfil functorSelectProfil=new MascaretWriter.FunctorSelectProfil() { public boolean exportProfil(GISZoneCollectionLigneBrisee _zone, int _idxProfil) { return UtilsProfil1d.isProfilCorrect(_zone, _idxProfil); } - }, vueExport.isMascaret1d()?"1d":"2d"}); + }; + CtuluIOOperationSynthese result=mascaretWriter.write(new Object[]{ + controllerBief_.getSelectedBiefName(), + zones, + functorSelectProfil, + vueExport.isMascaret1d()?"1d":"2d"}); // Gestion des erreurs String message=""; if (result.containsFatalError()) @@ -368,4 +339,10 @@ else if(result.containsMessages()) appli_.message(message); } + + @Override + public void internalFrameActivated(InternalFrameEvent e) { + mng_.clean(); + controllerBief_.updateFrom2d(); + } } Copied: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/controller/ControllerBief.java (from rev 4312, branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/DataGeometryListener.java) =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/controller/ControllerBief.java (rev 0) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/controller/ControllerBief.java 2008-12-24 15:09:43 UTC (rev 4315) @@ -0,0 +1,271 @@ +/* + * @creation 22 d\xE9c. 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.modeleur1d.controller; + +import java.util.ArrayList; +import java.util.List; + +import javax.swing.DefaultListSelectionModel; +import javax.swing.event.ListSelectionListener; + +import org.fudaa.ebli.calque.BCalque; +import org.fudaa.ebli.calque.ZModeleLigneBrisee; +import org.fudaa.fudaa.modeleur.modeleur1d.model.Bief; +import org.fudaa.fudaa.modeleur.modeleur1d.model.BiefContainer; +import org.fudaa.fudaa.modeleur.modeleur1d.model.BiefContainerAdapter; +import org.fudaa.fudaa.modeleur.modeleur1d.model.BiefSet; +import org.fudaa.fudaa.modeleur.modeleur1d.view.VueBief; +import org.fudaa.fudaa.modeleur.modeleur1d.view.VueModuleGestionBief; +import org.fudaa.fudaa.sig.layer.FSigLayerLineEditable; + +/** + * Controller permettant de g\xE9rer (cr\xE9er, modifier, supprimer, selectionner) les biefs. + * @author Emmanuel MARTIN + * @version $Id:$ + */ +public class ControllerBief { + + /** Le controller principal. */ + protected Controller1d controller1d_; + /** Le nom du bief selectionn\xE9. */ + protected String nomSelectedBief_=null; + /** l'ensemble de biefs. */ + protected BiefSet biefSet_=new BiefSet(); + /** Le container de bief. */ + BiefContainerAdapter biefContainerAdapter_; + /** Le model de selection des biefs. */ + protected BiefSelectionModel biefSelectionModel_; + /** La vue du module de gestion des biefs. */ + protected VueModuleGestionBief vueModuleGestionBief_; + /** La vue sur les biefs. */ + protected VueBief vueBief_; + + public ControllerBief(Controller1d _controller1d) { + controller1d_=_controller1d; + biefContainerAdapter_=new BiefContainerAdapter(biefSet_); + biefSelectionModel_=new BiefSelectionModel(); + vueModuleGestionBief_=new VueModuleGestionBief(this); + vueBief_=new VueBief(controller1d_.getImplementation(), this); + } + + /** + * Se r\xE9g\xE9n\xE8re par rapport aux 2d. + */ + public void updateFrom2d(){ + // Suppression des biefs pr\xE9c\xE9dents + String[] names=biefSet_.getBiefNames(); + for(int i=0;i<names.length;i++) + biefSet_.removeBief(names[i], null); + // Ajout des nouveaux + importBiefsFrom2d(controller1d_.getImplementation().get2dFrame().getVisuPanel().getArbreCalqueModel().getRootCalque().getCalqueParNom("gcBiefs")); + } + + /** + * Import les biefs du 2d vers le 1d. + */ + private void importBiefsFrom2d(BCalque _rootCalque) { + if (_rootCalque==null) + return; + BCalque[] calques=_rootCalque.getCalques(); + // It\xE9ration du chaque bief + for (int i=0; i<calques.length; i++) { + BCalque calqueBief=calques[i]; + List<ZModeleLigneBrisee> modelsDuFutureBief=new ArrayList<ZModeleLigneBrisee>(); + // Iteration sur chaque calque + BCalque[] sousCalques=calqueBief.getCalques(); + for (int j=0; j<sousCalques.length; j++) + if (sousCalques[j] instanceof FSigLayerLineEditable) + modelsDuFutureBief.add(((FSigLayerLineEditable)sousCalques[j]).getModele()); + // Ajout du bief + biefSet_.addBief(calqueBief.getTitle(), modelsDuFutureBief.toArray(new ZModeleLigneBrisee[0]), controller1d_.getCommandManager()); + } + // Selection d'office du premier Bief si il y en a un + if(biefSet_.getNbBief()>0) + biefSelectionModel_.addSelectionInterval(0, 0); + } + + /** + * Retourne le bief container. + */ + public BiefContainer getBiefContainer(){ + return biefContainerAdapter_; + } + + /** + * Retourne la vue du module de gestion des biefs. + */ + public VueModuleGestionBief getVueModuleGestionBief(){ + return vueModuleGestionBief_; + } + + /** + * Retourne la vue sur les biefs + */ + public VueBief getVueBief() { + return vueBief_; + } + + /** + * Supprime le bief selectionn\xE9. + */ + public void removeSelectedBief(){ + String name=biefSelectionModel_.getSelectedName(); + if(name!=null) + biefSet_.removeBief(name, controller1d_.getCommandManager()); + } + + /** + * Importation d'un bief. + */ + public void importBief(){ + //TODO + } + + /** + * Fusion de deux biefs. + */ + public void fusionnerBiefs(){ + //TODO + } + + /** + * Duplique le bief selectionn\xE9. + */ + public void dupliquerSelectedBief() { + //TODO + } + + /** + * Renomme un bief. + */ + public void renameBief(String _currentName, String _newName) { + biefSet_.renameBief(_currentName, _newName, controller1d_.getCommandManager()); + } + + // Gestion de la selection de bief \\ + + /** + * Retourne vrai si un bief est selectionn\xE9. + */ + public boolean isBiefSelected() { + return biefSelectionModel_.getSelectedName()!=null; + } + + /** + * Retourne le nom du bief selectionn\xE9. + */ + public String getSelectedBiefName(){ + return biefSelectionModel_.getSelectedName(); + } + + /** + * Retourne une ListSelectionModel permettant de g\xE9rer la selection des biefs. + */ + public BiefSelectionModel getBiefSelectionModel() { + return biefSelectionModel_; + } + + /** + * Retourne le biefContainer, c'est \xE0 dire le conteneur de tout les biefs. + */ + public BiefSet getBiefSet(){ + return biefSet_; + } + + /** + * Retourne le Bief selectionn\xE9. + */ + public Bief getSelectedBief(){ + return biefSet_.getBief(getSelectedBiefName()); + } + + // Le model de selection concernant les biefs \\ + + /** + * Cette classe a pour objectif de g\xE9rer avec le m\xEAme model de selection tous + * les endroits ayant besoin de savoir quel bief est selectionn\xE9. + */ + public class BiefSelectionModel extends DefaultListSelectionModel { + + public BiefSelectionModel(){ + super.setSelectionMode(SINGLE_SELECTION); + } + + /** + * Retourne le nom du bief selectionn\xE9. + */ + public String getSelectedName() { + if(getMinSelectionIndex()==-1) + return null; + return biefSet_.getBiefName(getMinSelectionIndex()); + } + + /** + * Met \xE0 jour dataGeomAdapter_ pour qu'il tienne compte de la nouvelle selection. + */ + private void updateBief() { + if(getMinSelectionIndex()==-1) + biefContainerAdapter_.setSelectedBief(null); + else + biefContainerAdapter_.setSelectedBief(biefSet_.getBiefName(getMinSelectionIndex())); + } + + public void addListSelectionListener(ListSelectionListener x) { + super.addListSelectionListener(x); + updateBief(); + } + + public void addSelectionInterval(int index0, int index1) { + super.addSelectionInterval(index0, index1); + updateBief(); + } + + public void clearSelection() { + super.clearSelection(); + updateBief(); + } + + public void insertIndexInterval(int index, int length, boolean before) { + super.insertIndexInterval(index, length, before); + updateBief(); + } + + public void removeIndexInterval(int index0, int index1) { + super.removeIndexInterval(index0, index1); + updateBief(); + } + + public void removeSelectionInterval(int index0, int index1) { + super.removeSelectionInterval(index0, index1); + updateBief(); + } + + public void setAnchorSelectionIndex(int index) { + super.setAnchorSelectionIndex(index); + updateBief(); + } + + public void setLeadSelectionIndex(int index) { + super.setLeadSelectionIndex(index); + updateBief(); + } + + public void setSelectionInterval(int index0, int index1) { + super.setSelectionInterval(index0, index1); + updateBief(); + } + + /** + * Le mode de selection est bloqu\xE9 \xE0 SINGLE_SELECTION. + */ + public void setSelectionMode(int selectionMode) { + if(selectionMode!=SINGLE_SELECTION) + throw new IllegalArgumentException("Le mode est bloqu\xE9 \xE0 SINGLE_SELECTION"); + } + } +} Property changes on: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/controller/ControllerBief.java ___________________________________________________________________ Added: svn:keywords + Id Added: svn:mergeinfo + /branches/Br_FudaaModeleur_TF/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/DataGeometryListener.java:3445-3850 /branches/FudaaModeleur_TC1/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/DataGeometryListener.java:3861-3891 Added: svn:eol-style + native Copied: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/controller/ControllerProfil.java (from rev 4312, branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/DataGeometryListener.java) =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/controller/ControllerProfil.java (rev 0) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/controller/ControllerProfil.java 2008-12-24 15:09:43 UTC (rev 4315) @@ -0,0 +1,186 @@ +/* + * @creation 22 d\xE9c. 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.modeleur1d.controller; + +import javax.swing.DefaultListSelectionModel; +import javax.swing.event.ListSelectionEvent; +import javax.swing.event.ListSelectionListener; + +import org.fudaa.fudaa.modeleur.modeleur1d.controller.ControllerBief.BiefSelectionModel; +import org.fudaa.fudaa.modeleur.modeleur1d.model.BiefContainer; +import org.fudaa.fudaa.modeleur.modeleur1d.model.ProfilContainer; +import org.fudaa.fudaa.modeleur.modeleur1d.model.ProfilContainerAdapter; +import org.fudaa.fudaa.modeleur.modeleur1d.model.ProfilContainerException; +import org.fudaa.fudaa.modeleur.modeleur1d.view.VueModuleGestionProfil; + +/** + * Controller permettant de g\xE9rer (cr\xE9er, modifier, supprimer, selectionner) les profils. + * @author Emmanuel MARTIN + * @version $Id:$ + */ +public class ControllerProfil { + + /** Le controller principal. */ + protected Controller1d controller1d_; + /** Le model commun de selection de profils. */ + private ProfilSelectionModel profilSelectionModel_; + /** L'adapter des donn\xE9es de la geometry en cours de manipulation. */ + private ProfilContainerAdapter profilContainerAdapter_; + /** le conteneur du bief. */ + private BiefContainer biefContainer_; + /** La vue du module de gestion des profils. */ + protected VueModuleGestionProfil vueModuleGestionProfil_; + + public ControllerProfil(BiefSelectionModel _biefSelectionModel, BiefContainer _biefContainer, Controller1d _controller1d){ + controller1d_=_controller1d; + biefContainer_=_biefContainer; + profilSelectionModel_=new ProfilSelectionModel(_biefSelectionModel); + profilContainerAdapter_=new ProfilContainerAdapter(biefContainer_); + vueModuleGestionProfil_=new VueModuleGestionProfil(this); + } + + public ProfilContainer getDataGeometry(){ + return profilContainerAdapter_; + } + + public ProfilSelectionModel getProfilSelectionModel(){ + return profilSelectionModel_; + } + + public BiefContainer getBiefContainer() { + return biefContainer_; + } + + /** + * Retourne la vue du module de gestion des profils. + */ + public VueModuleGestionProfil getVueModuleGestionProfil(){ + return vueModuleGestionProfil_; + } + + /** + * Cr\xE9ation ou ajout d'un nouveau profil. + */ + public void ajoutProfil(){ + //TODO + } + + /** + * Supprime le profil selectionn\xE9. + */ + public void supprimerSelectedProfil(){ + if(profilSelectionModel_.getSelectedProfil()!=-1) + biefContainer_.removeProfil(profilSelectionModel_.getSelectedProfil(), controller1d_.getCommandManager()); + } + + /** + * Fusionne deux profils. + */ + public void fusionnerProfil(){ + + } + + /** + * Renommer un profil. + */ + public void renameProfil(int _idxProfil, String _newName) { + biefContainer_.renameProfil(_idxProfil, _newName, controller1d_.getCommandManager()); + } + + //Le model de selection concernant les biefs \\ + + /** + * Cette classe a pour objectif de g\xE9rer avec le m\xEAme model de selection tous + * les endroits ayant besoin de savoir quels profils sont selectionn\xE9s. + */ + public class ProfilSelectionModel extends DefaultListSelectionModel implements ListSelectionListener { + + /** La liste de selection des biefs. */ + private BiefSelectionModel biefSelectionModel_; + + public ProfilSelectionModel(BiefSelectionModel _biefSelectionModel){ + biefSelectionModel_=_biefSelectionModel; + biefSelectionModel_.addListSelectionListener(this); + super.setSelectionMode(SINGLE_SELECTION); + } + + public int getSelectedProfil(){ + return getMinSelectionIndex(); + } + + public void valueChanged(ListSelectionEvent e) { + // Le bief selectionn\xE9 \xE0 chang\xE9. \\ + clearSelection(); + } + + /** + * Met \xE0 jour dataGeomAdapter_ pour qu'il tienne compte de la nouvelle selection. + */ + private void updateProfil() { + try { + profilContainerAdapter_.setSelectedProfil(getMinSelectionIndex()); + } + catch (ProfilContainerException _exc) { + _exc.printStackTrace(); + } + } + + public void addListSelectionListener(ListSelectionListener x) { + super.addListSelectionListener(x); + updateProfil(); + } + + public void addSelectionInterval(int index0, int index1) { + super.addSelectionInterval(index0, index1); + updateProfil(); + } + + public void clearSelection() { + super.clearSelection(); + updateProfil(); + } + + public void insertIndexInterval(int index, int length, boolean before) { + super.insertIndexInterval(index, length, before); + updateProfil(); + } + + public void removeIndexInterval(int index0, int index1) { + super.removeIndexInterval(index0, index1); + updateProfil(); + } + + public void removeSelectionInterval(int index0, int index1) { + super.removeSelectionInterval(index0, index1); + updateProfil(); + } + + public void setAnchorSelectionIndex(int index) { + super.setAnchorSelectionIndex(index); + updateProfil(); + } + + public void setLeadSelectionIndex(int index) { + super.setLeadSelectionIndex(index); + updateProfil(); + } + + public void setSelectionInterval(int index0, int index1) { + super.setSelectionInterval(index0, index1); + updateProfil(); + } + + /** + * Le mode de selection est bloqu\xE9 \xE0 SINGLE_SELECTION. + */ + public void setSelectionMode(int selectionMode) { + if(selectionMode!=SINGLE_SELECTION) + throw new IllegalArgumentException("Le mode est bloqu\xE9 \xE0 SINGLE_SELECTION"); + } + } +} Property changes on: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/controller/ControllerProfil.java ___________________________________________________________________ Added: svn:keywords + Id Added: svn:mergeinfo + /branches/Br_FudaaModeleur_TF/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/DataGeometryListener.java:3445-3850 /branches/FudaaModeleur_TC1/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/DataGeometryListener.java:3861-3891 Added: svn:eol-style + native Added: 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 (rev 0) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/Bief.java 2008-12-24 15:09:43 UTC (rev 4315) @@ -0,0 +1,124 @@ +/* + * @creation 22 d\xE9c. 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.modeleur1d.model; + +import org.fudaa.ctulu.gis.GISAttributeConstants; +import org.fudaa.ctulu.gis.GISZoneCollectionLigneBrisee; +import org.fudaa.ebli.calque.ZModeleLigneBrisee; +import org.fudaa.fudaa.modeleur.layer.MdlModel1dAxe; +import org.fudaa.fudaa.modeleur.layer.MdlModel1dBank; +import org.fudaa.fudaa.modeleur.layer.MdlModel1dStorageLimit; +import org.fudaa.fudaa.modeleur.layer.MdlModel2dDirectionLine; +import org.fudaa.fudaa.modeleur.layer.MdlModel2dProfile; + +/** + * Contient les informations relatives \xE0 un bief. + * @author Emmanuel MARTIN + * @version $Id:$ + */ +public class Bief { + public ZModeleLigneBrisee axeHydraulique_; + public ZModeleLigneBrisee profils_; + public ZModeleLigneBrisee rives_; + public ZModeleLigneBrisee limitesStockages_; + public ZModeleLigneBrisee lignesDirectrices_; + + public Bief(){} + + public Bief(ZModeleLigneBrisee[] _models){ + if(_models==null) + throw new IllegalArgumentException("_models ne peut pas \xEAtre null."); + for(int i=0;i<_models.length;i++) { + if(_models[i]==null) + throw new IllegalArgumentException("_models ne doit pas contenir de valeurs null"); + if(_models[i].getGeomData()==null) + throw new IllegalArgumentException("Certain model n'ont pas de GSIZone."); + if(!(_models[i].getGeomData() instanceof GISZoneCollectionLigneBrisee)) + throw new IllegalArgumentException("Toutes les GISZOne doivent \xEAtre des GISZoneCollectionLigneBrisee."); + String nature=(String) _models[i].getGeomData().getFixedAttributValue(GISAttributeConstants.NATURE); + if(nature==GISAttributeConstants.ATT_NATURE_AH) + if(axeHydraulique_!=null) + throw new IllegalArgumentException("Plusieurs models d'axe hydrauliques sont donn\xE9es."); + else + axeHydraulique_=_models[i]; + else if(nature==GISAttributeConstants.ATT_NATURE_LD) + if(lignesDirectrices_!=null) + throw new IllegalArgumentException("Plusieurs models de lignes directrices sont donn\xE9es."); + else + lignesDirectrices_=_models[i]; + else if(nature==GISAttributeConstants.ATT_NATURE_LS) + if(limitesStockages_!=null) + throw new IllegalArgumentException("Plusieurs models de limites de stockage sont donn\xE9es."); + else + limitesStockages_=_models[i]; + else if(nature==GISAttributeConstants.ATT_NATURE_PF) + if(profils_!=null) + throw new IllegalArgumentException("Plusieurs models de profils sont donn\xE9es."); + else + profils_=_models[i]; + else if(nature==GISAttributeConstants.ATT_NATURE_RV) + if(rives_!=null) + throw new IllegalArgumentException("Plusieurs models de rives sont donn\xE9es."); + else + rives_=_models[i]; + } + // Remplissage des models vides par des ZModeles vides + if (axeHydraulique_==null) + axeHydraulique_=new MdlModel1dAxe(null); + if (profils_==null) + profils_=new MdlModel2dProfile(null, null); + if (rives_==null) + rives_=new MdlModel1dBank(null, null); + if (limitesStockages_==null) + limitesStockages_=new MdlModel1dStorageLimit(null, null); + if (lignesDirectrices_==null) + lignesDirectrices_=new MdlModel2dDirectionLine(null, null); + } + + /** + * Retourne vrai si les donn\xE9es contenues dans les champs sont coh\xE9rentes. + */ + public boolean checkCoherence(){ + if (axeHydraulique_==null||profils_==null||rives_==null||limitesStockages_==null||lignesDirectrices_==null) + return false; + // Axe hydraulique + if (axeHydraulique_.getGeomData()==null||!(axeHydraulique_.getGeomData() instanceof GISZoneCollectionLigneBrisee)) + return false; + if ((String)axeHydraulique_.getGeomData().getFixedAttributValue(GISAttributeConstants.NATURE)!=GISAttributeConstants.ATT_NATURE_AH) + return false; + if(axeHydraulique_.getNbPolyligne()>1) + return false; + // Lignes directrices + if (lignesDirectrices_.getGeomData()==null||!(lignesDirectrices_.getGeomData() instanceof GISZoneCollectionLigneBrisee)) + return false; + if ((String)lignesDirectrices_.getGeomData().getFixedAttributValue(GISAttributeConstants.NATURE)!=GISAttributeConstants.ATT_NATURE_LD) + return false; + // Limite de stockage + if (limitesStockages_.getGeomData()==null||!(limitesStockages_.getGeomData() instanceof GISZoneCollectionLigneBrisee)) + return false; + if ((String)limitesStockages_.getGeomData().getFixedAttributValue(GISAttributeConstants.NATURE)!=GISAttributeConstants.ATT_NATURE_LS) + return false; + if(limitesStockages_.getNbPolyligne()>2) + return false; + // Profil + if (profils_.getGeomData()==null||!(profils_.getGeomData() instanceof GISZoneCollectionLigneBrisee)) + return false; + if ((String)profils_.getGeomData().getFixedAttributValue(GISAttributeConstants.NATURE)!=GISAttributeConstants.ATT_NATURE_PF) + return false; + // rives + if (rives_.getGeomData()==null||!(rives_.getGeomData() instanceof GISZoneCollectionLigneBrisee)) + return false; + if ((String)rives_.getGeomData().getFixedAttributValue(GISAttributeConstants.NATURE)!=GISAttributeConstants.ATT_NATURE_RV) + return false; + if(rives_.getNbPolyligne()>2) + return false; + // Tout est ok + return true; + } + +} Property changes on: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/Bief.java ___________________________________________________________________ Added: svn:keywords + Id Added: svn:eol-style + native Added: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/BiefContainer.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/BiefContainer.java (rev 0) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/BiefContainer.java 2008-12-24 15:09:43 UTC (rev 4315) @@ -0,0 +1,59 @@ +/* + * @creation 23 d\xE9c. 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.modeleur1d.model; + +import org.fudaa.ctulu.CtuluCommandContainer; +import org.fudaa.ctulu.gis.GISZoneCollectionLigneBrisee; + +/** + * Une interface permettant d'acc\xE9der aux informations du bief selectionn\xE9. + * + * @author Emmanuel MARTIN + * @version $Id:$ + */ +public interface BiefContainer { + + /** Retourne vrai si l'index pass\xE9 en param\xE8tre correspond \xE0 un profil. */ + public boolean hasProfil(int _idxProfil); + + /** Ajout d'un nouveau listener. */ + public void addBiefContainerListener(BiefContainerListener _listener); + + /** Supprime le listener. */ + public void removeBiefContainerListener(BiefContainerListener _listener); + + /** Retourne les zones contenant les g\xE9om\xE9tries. */ + public GISZoneCollectionLigneBrisee[] getZones(); + + /** Retourne la zone contenant l'axe hydraulique. */ + public GISZoneCollectionLigneBrisee getZoneAxeHydraulique(); + + /** Retourne la zone contenant les profils. */ + public GISZoneCollectionLigneBrisee getZoneProfils(); + + /** Retourne la zone contenant les rives. */ + public GISZoneCollectionLigneBrisee getZoneRives(); + + /** Retourne la zone contenant les limites de stockages. */ + public GISZoneCollectionLigneBrisee getZoneLimitesStockages(); + + /** Retourne la zone contenant les lignes directrices. */ + public GISZoneCollectionLigneBrisee getZoneLignesDirectrices(); + + /** Retourne ne nombre de profils de ce bief. */ + public int getNbProfil(); + + /** Retourne le nom du profil choisi par sont index. */ + public String getNomProfil(int _idxProfil); + + /** Renomme le profil. */ + public void renameProfil(int _idxProfil, String _newName, CtuluCommandContainer _cmd); + + /** Supprime un profil. */ + public void removeProfil(int _idxProfil, CtuluCommandContainer _cmd); +} Property changes on: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/BiefContainer.java ___________________________________________________________________ Added: svn:keywords + Id Added: svn:eol-style + native Copied: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/BiefContainerAdapter.java (from rev 4312, branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/DataGeometryListener.java) =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/BiefContainerAdapter.java (rev 0) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/BiefContainerAdapter.java 2008-12-24 15:09:43 UTC (rev 4315) @@ -0,0 +1,217 @@ +/* + * @creation 23 d\xE9c. 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.modeleur1d.model; + +import java.util.ArrayList; +import java.util.List; + +import org.fudaa.ctulu.CtuluCommand; +import org.fudaa.ctulu.CtuluCommandComposite; +import org.fudaa.ctulu.CtuluCommandContainer; +import org.fudaa.ctulu.CtuluNamedCommand; +import org.fudaa.ctulu.gis.GISAttributeConstants; +import org.fudaa.ctulu.gis.GISZoneCollectionLigneBrisee; +import org.fudaa.fudaa.commun.FudaaLib; + +/** + * Cette classe permet d'adapter une BiefColleciton en un model manipulable + * simplement. Il n'affiche que le bief selectionn\xE9. + * + * @author Emmanuel MARTIN + * @version $Id:$ + */ +public class BiefContainerAdapter implements BiefContainer, BiefSetListener { + + /** Le container de tous les biefs. */ + private BiefSet biefSet_; + /** Le nom du bief selectionn\xE9. */ + private String nomBiefSelected_; + /** Liste des listeners de cette instance. */ + private List<BiefContainerListener> listeners_=new ArrayList<BiefContainerListener>(); + + public BiefContainerAdapter(BiefSet _biefSet) { + biefSet_=_biefSet; + biefSet_.addBiefSetListener(this); + } + + public boolean hasProfil(int _idxProfil) { + if(_idxProfil>=0&&getZoneProfils()!=null&&_idxProfil<getZoneProfils().getNumGeometries()) + return true; + return false; + } + + /** + * Selectionner un des biefs. Pour n'en selectionner aucun, _nomBief doit + * valloir null. + */ + public void setSelectedBief(String _nomBief) { + if(_nomBief!=null&&!biefSet_.hasBief(_nomBief)) + throw new IllegalArgumentException("Bief : "+_nomBief+" inconnu."); + if(_nomBief!=nomBiefSelected_) { + nomBiefSelected_=_nomBief; + fireBiefSelectedChanged(_nomBief); + } + } + + public GISZoneCollectionLigneBrisee getZoneAxeHydraulique() { + if(nomBiefSelected_==null) + return null; + return (GISZoneCollectionLigneBrisee)biefSet_.getBief(nomBiefSelected_).axeHydraulique_.getGeomData(); + } + + public GISZoneCollectionLigneBrisee getZoneLignesDirectrices() { + if(nomBiefSelected_==null) + return null; + return (GISZoneCollectionLigneBrisee)biefSet_.getBief(nomBiefSelected_).lignesDirectrices_.getGeomData(); + } + + public GISZoneCollectionLigneBrisee getZoneLimitesStockages() { + if(nomBiefSelected_==null) + return null; + return (GISZoneCollectionLigneBrisee)biefSet_.getBief(nomBiefSelected_).limitesStockages_.getGeomData(); + } + + public GISZoneCollectionLigneBrisee getZoneProfils() { + if(nomBiefSelected_==null) + return null; + return (GISZoneCollectionLigneBrisee)biefSet_.getBief(nomBiefSelected_).profils_.getGeomData(); + } + + public GISZoneCollectionLigneBrisee getZoneRives() { + if(nomBiefSelected_==null) + return null; + return (GISZoneCollectionLigneBrisee)biefSet_.getBief(nomBiefSelected_).rives_.getGeomData(); + } + + public GISZoneCollectionLigneBrisee[] getZones() { + if(nomBiefSelected_==null) + return null; + return new GISZoneCollectionLigneBrisee[]{getZoneAxeHydraulique(), getZoneLignesDirectrices(), getZoneLimitesStockages(), + getZoneProfils(), getZoneRives()}; + } + + // Raccourcis de gestion des profils \\ + + public int getNbProfil() { + if(nomBiefSelected_==null) + return 0; + return getZoneProfils().getNbGeometries(); + } + + public String getNomProfil(int _idxProfil) { + if(_idxProfil<0||_idxProfil>=getZoneProfils().getNbGeometries()) + throw new IllegalArgumentException("Le profil "+_idxProfil+" n'existe pas"); + return (String) getZoneProfils().getValue(getZoneProfils().getIndiceOf(GISAttributeConstants.TITRE), _idxProfil); + } + + public void removeProfil(int _idxProfil, CtuluCommandContainer _cmd) { + if(_idxProfil<0||_idxProfil>=getZoneProfils().getNbGeometries()) + throw new IllegalArgumentException("Le profil "+_idxProfil+" n'existe pas"); + class RemoveProfilCtuluCommand implements CtuluCommand, CtuluNamedCommand{ + private int idxProfil_; + private CtuluCommandComposite cmd_; + public RemoveProfilCtuluCommand(int _idxProfil, CtuluCommandComposite _cmd) { + idxProfil_=_idxProfil;cmd_=_cmd; + } + public void redo() { + cmd_.redo(); + fireProfilAdded(idxProfil_); + } + public void undo() { + cmd_.undo(); + fireProfilRemoved(idxProfil_); + } + public String getName() {return FudaaLib.getS("supprimer profil");} + } + CtuluCommandComposite cmdComp=new CtuluCommandComposite(); + getZoneProfils().removeGeometries(new int[]{_idxProfil}, cmdComp); + if(_cmd!=null) + _cmd.addCmd(new RemoveProfilCtuluCommand(_idxProfil, cmdComp)); + fireProfilRemoved(_idxProfil); + } + + public void renameProfil(int _idxProfil, String _newName, CtuluCommandContainer _cmd) { + if(_idxProfil<0||_idxProfil>=getZoneProfils().getNbGeometries()) + throw new IllegalArgumentException("Le profil "+_idxProfil+" n'existe pas"); + if(_newName==null||_newName.length()==0) + throw new IllegalArgumentException("Un nom doit \xEAtre donn\xE9"); + class RenameProfilCtuluCommand implements CtuluCommand, CtuluNamedCommand { + private int idxProfil_; + private String oldName_; + private String newName_; + public RenameProfilCtuluCommand(int _idxProfil, String _oldName, String _newName){ + idxProfil_=_idxProfil;oldName_=_oldName;newName_=_newName; + } + public void redo() {renameProfil(idxProfil_, newName_, null);} + public void undo() {renameProfil(idxProfil_, oldName_, null);} + public String getName() {return FudaaLib.getS("renommer profil");} + } + String oldName=(String) getZoneProfils().getValue(getZoneProfils().getIndiceOf(GISAttributeConstants.TITRE), _idxProfil); + getZoneProfils().setAttributValue(getZoneProfils().getIndiceOf(GISAttributeConstants.TITRE), _idxProfil, _newName, null); + if(_cmd!=null) + _cmd.addCmd(new RenameProfilCtuluCommand(_idxProfil, oldName, _newName)); + fireProfilRenamed(_idxProfil, oldName, _newName); + } + + // R\xE9action aux modifications dans le BiefCollection \\ + + public void addedBief(String _name) {} + + public void removedBief(String _name) { + if(_name==nomBiefSelected_) { + nomBiefSelected_=null; + fireBiefSelectedChanged(null); + } + } + + public void renamedBief(String _oldName, String _newName) { + if(_oldName==nomBiefSelected_) { + nomBiefSelected_=_newName; + fireBiefSelectedRenamed(_oldName, _newName); + } + } + + // Gestion des listeners \\ + + /** + * Ajoute un listener r\xE9agissant au modification des donn\xE9es. + */ + public void addBiefContainerListener(BiefContainerListener _listener) { + if(_listener!=null&&!listeners_.contains(_listener)) + listeners_.add(_listener); + } + + /** + * Supprime le listener de la liste. + */ + public void removeBiefContainerListener(BiefContainerListener _listener) { + if(_listener!=null&&listeners_.contains(_listener)) + listeners_.remove(_listener); + } + + protected void fireBiefSelectedChanged(String _newName) { + for(BiefContainerListener listener: listeners_) + listener.biefSelectedChanged(_newName); + } + protected void fireBiefSelectedRenamed(String _oldName, String _newName) { + for(BiefContainerListener listener: listeners_) + listener.biefSelectedRenamed(_oldName, _newName); + } + protected void fireProfilRemoved(int _idxProfil){ + for(BiefContainerListener listener: listeners_) + listener.profilRemoved(_idxProfil); + } + protected void fireProfilRenamed(int _idxProfil, String _oldName, String _newName){ + for(BiefContainerListener listener: listeners_) + listener.profilRenamed(_idxProfil, _oldName, _newName); + } + protected void fireProfilAdded(int _idxProfil) { + for(BiefContainerListener listener: listeners_) + listener.profilAdded(_idxProfil); + } +} Property changes on: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/BiefContainerAdapter.java ___________________________________________________________________ Added: svn:keywords + Id Added: svn:mergeinfo + /branches/Br_FudaaModeleur_TF/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/DataGeometryListener.java:3445-3850 /branches/FudaaModeleur_TC1/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/DataGeometryListener.java:3861-3891 Added: svn:eol-style + native Added: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/BiefContainerListener.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/BiefContainerListener.java (rev 0) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/BiefContainerListener.java 2008-12-24 15:09:43 UTC (rev 4315) @@ -0,0 +1,21 @@ +/* + * @creation 23 d\xE9c. 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.modeleur1d.model; + +/** + * Interface permettant de ce maintenir \xE0 jour du contenu du BiefContainer + * @author Emmanuel MARTIN + * @version $Id:$ + */ +public interface BiefContainerListener { + public void biefSelectedRenamed(String _oldName, String _newName); + public void biefSelectedChanged(String _newName); + public void profilRemoved(int _idxProfil); + public void profilRenamed(int _idxProfil, St... [truncated message content] |
From: <bma...@us...> - 2008-12-22 15:13:05
|
Revision: 4314 http://fudaa.svn.sourceforge.net/fudaa/?rev=4314&view=rev Author: bmarchan Date: 2008-12-22 15:13:02 +0000 (Mon, 22 Dec 2008) Log Message: ----------- Chgt de version => 0.09 Modified Paths: -------------- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlImplementation.java Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlImplementation.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlImplementation.java 2008-12-22 15:11:04 UTC (rev 4313) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlImplementation.java 2008-12-22 15:13:02 UTC (rev 4314) @@ -81,8 +81,8 @@ protected static BuInformationsSoftware isMdl_ = new BuInformationsSoftware(); static { isMdl_.name = "Modeleur"; - isMdl_.version = "0.08"; - isMdl_.date = "2008-12-05"; + isMdl_.version = "0.09"; + isMdl_.date = "2008-12-22"; isMdl_.rights = "Tous droits r\xE9serv\xE9s. CETMEF (c)1999-2008"; isMdl_.license = "GPL2"; isMdl_.languages = "fr,en"; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bma...@us...> - 2008-12-22 15:11:14
|
Revision: 4313 http://fudaa.svn.sourceforge.net/fudaa/?rev=4313&view=rev Author: bmarchan Date: 2008-12-22 15:11:04 +0000 (Mon, 22 Dec 2008) Log Message: ----------- Created tag FudaaModeleur_0_09. Modified Paths: -------------- tags/FudaaModeleur_0_09/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlImplementation.java Added Paths: ----------- tags/FudaaModeleur_0_09/ tags/FudaaModeleur_0_09/fudaa_devel/ctulu/src/com/memoire/bu/BuDesktop.java Removed Paths: ------------- tags/FudaaModeleur_0_09/fudaa_devel/ctulu/src/com/memoire/bu/BuDesktop.java Property changes on: tags/FudaaModeleur_0_09 ___________________________________________________________________ Added: svn:ignore + eclipse_projects Added: svn:mergeinfo + /branches/Br_FudaaModeleur_TF:3445-3850 /branches/FudaaModeleur_TC1:3861-3891 Deleted: tags/FudaaModeleur_0_09/fudaa_devel/ctulu/src/com/memoire/bu/BuDesktop.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/com/memoire/bu/BuDesktop.java 2008-12-19 12:13:30 UTC (rev 4310) +++ tags/FudaaModeleur_0_09/fudaa_devel/ctulu/src/com/memoire/bu/BuDesktop.java 2008-12-22 15:11:04 UTC (rev 4313) @@ -1,1263 +0,0 @@ -/** - * @modification $Date: 2007-03-30 15:34:39 $ - * @statut unstable - * @file BuDesktop.java - * @version 0.43 - * @author Guillaume Desnoix - * @email gui...@de... - * @license GNU General Public License 2 (GPL2) - * @copyright 1998-2005 Guillaume Desnoix - */ - -package com.memoire.bu; - -import java.awt.*; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.MouseEvent; -import java.awt.event.MouseListener; -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; -import java.beans.PropertyVetoException; - -import javax.swing.*; -import javax.swing.border.Border; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; -import javax.swing.plaf.ColorUIResource; - -import com.memoire.fu.FuLog; - -/** - * A DesktopPane with a few additional services. Auto-resizing, optionnaly tabbed, custom-friendly, icons management, - * ... - */ -public class BuDesktop extends JDesktopPane implements MouseListener, ActionListener { - public static final int LEFT_MARGIN = 31; - - public static final int SNAPX = Math.max(4, BuPreferences.BU.getIntegerProperty("desktop.snapx", 37)); - - public static final int SNAPY = Math.max(4, BuPreferences.BU.getIntegerProperty("desktop.snapy", 37)); - - public static final int BLOCK_LAYER = JLayeredPane.DEFAULT_LAYER.intValue() - 100; - - public BuDesktop() { - super(); - - setName("buDESKTOP"); - setDesktopManager(createDesktopManager()); - setBackgroundPainter(createBackgroundPainter()); - - addMouseListener(this); - - if (isTabbed()) { - setToolTipText("..."); - setLayout(new Layout()); - } - } - - public final boolean isPalette(JComponent _f) { - return (DEFAULT_LAYER.intValue() != getLayer(_f)) - && Boolean.TRUE.equals(_f.getClientProperty("JInternalFrame.isPalette")); - } - - protected String _(String _s) { - return BuResource.BU.getString(_s); - } - - // Anti-aliasing - - public void paint(Graphics _g) { - BuLib.setAntialiasing(this, _g); - super.paint(_g); - } - - // Snap - - public final void snapXY(JComponent _f) { - if (BuPreferences.BU.getBooleanProperty("desktop.snap", false) && !isTabbed() && !isPalette(_f) - && (_f instanceof JInternalFrame)) { - Point p = _f.getLocation(); - boolean b = false; - if (p.x % SNAPX != 0) { - p.x = p.x - p.x % SNAPX; - b = true; - } - if (p.y % SNAPY != 0) { - p.y = p.y - p.y % SNAPY; - b = true; - } - if (b) _f.setLocation(p); - } - } - - public final void snapWH(JComponent _f) { - if (BuPreferences.BU.getBooleanProperty("desktop.snap", false) && !isTabbed() && !isPalette(_f) - && (_f instanceof JInternalFrame)) { - Dimension d = _f.getSize(); - boolean b = false; - if (((JInternalFrame) _f).isResizable()) { - if (d.width % SNAPX != 0) { - d.width = d.width + SNAPX - d.width % SNAPX; - b = true; - } - if (d.height % SNAPY != 0) { - d.height = d.height + SNAPY - d.height % SNAPY; - b = true; - } - } - if (b) _f.setSize(d); - } - } - - protected DesktopManager createDesktopManager() { - return new BuDesktopManager(this); - } - - protected BuBackgroundPainter createBackgroundPainter() { - BuBackgroundPainter bp = new BuBackgroundPainter(); - if (isBlocked()) { - bp.setBar(true); - bp.setBarHeight(BuLib.isMetal() ? 8 + BuResource.BU.getDefaultFrameSize() : 0); - - /* - * (BuLib.isSlaf() ? 10+BuResource.BU.getDefaultFrameSize() : 0)); - */ - } - return bp; - } - - public boolean isFocusCycleRoot() { - return true; - } - - /* - * public void moveToFront(JInternalFrame _f) { _f.moveToFront(); JInternalFrame[] frames=getAllFrames(); int - * l=frames.length; for(int i=0;i<l;i++) if(isPalette(frames[i])&&frames[i].isVisible()) frames[i].moveToFront(); } - */ - - public boolean isOpaque() { - return Boolean.TRUE.equals(UIManager.get("Desktop.opaque")); - } - - protected void addImpl(Component _c, Object _constraints, int _index) { - if (_c instanceof JInternalFrame.JDesktopIcon) { - JInternalFrame.JDesktopIcon i = (JInternalFrame.JDesktopIcon) _c; - - i.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); - putLayer(i, BLOCK_LAYER); - - if (isBlocked()) { - Component[] c = i.getComponents(); - - if (BuLib.isMetal()) { - if (i.getComponentCount() == 2) { - i.remove(c[1]); - i.setBorder(BuBorders.EMPTY0000); - if (c[0] instanceof JButton) { - ((JButton) c[0]).setHorizontalAlignment(SwingConstants.LEFT); - ((JButton) c[0]).setMargin(BuInsets.INSETS1111); - ((JButton) c[0]).getModel().setRollover(false); - } - } - } else if (BuLib.isSlaf()) { - if (c.length == 2) { - i.setBorder(BuBorders.EMPTY1111); - i.setLayout(new BorderLayout(2, 0)); - i.add(c[0], BorderLayout.CENTER); // text - i.add(c[1], BorderLayout.WEST); // icon - if (c[0] instanceof JLabel) ((JLabel) c[0]).setHorizontalAlignment(SwingConstants.LEFT); - } - } - Dimension ps = i.getPreferredSize(); - if (BuLib.isMotif()) ; - else if (BuLib.isMetal()) ps.width = SNAPX * 4; - // else if(BuLib.isSlaf ()) ps.width=SNAPX*3; - else - ps.width = SNAPX * 3; - // if(ps.width %37!=0) ps.width =ps.width +37-ps.width %37; - // if(ps.height%37!=0) ps.height=ps.height+37-ps.height%37; - i.setPreferredSize(ps); - i.setSize(ps); - - JInternalFrame f = i.getInternalFrame(); - f.addPropertyChangeListener(new PropertyChangeListener() { - public void propertyChange(PropertyChangeEvent _evt) { - if (Boolean.TRUE.equals(_evt.getNewValue()) && "selected".equals(_evt.getPropertyName())) { - final JInternalFrame fintern = (JInternalFrame) _evt.getSource(); - if (fintern.isIcon()) { - try { - fintern.setIcon(false); - } catch (PropertyVetoException ex) {} - } - } - } - }); - } - } - - if (_c instanceof JComponent) { - snapXY((JComponent) _c); - snapWH((JComponent) _c); - } - - super.addImpl(_c, _constraints, _index); - - boolean b = isBlocked() && (_c instanceof JInternalFrame.JDesktopIcon); - if (b) arrangeIcons0(); - } - - public void remove(int _index) { - Component c = getComponent(_index); - Rectangle r = c.getBounds(); - boolean b = isBlocked() && (c instanceof JInternalFrame.JDesktopIcon); - - super.remove(_index); - repaint(r); - if (b) arrangeIcons0(); - } - - // Paint - - public/* synchronized */void paintComponent(Graphics _g) { - JInternalFrame[] frames = getAllFrames(); - - if (!isTabbed() || (frames.length == 0)) { - Rectangle clip = _g.getClipBounds(); - // Dimension dd =getSize(); - - BuBackgroundPainter bp = getBackgroundPainter(); - if (bp != null) bp.paintBackground(this, _g); - - if (logo_ != null) { - Rectangle ri = new Rectangle(5, - // dd.width-5-logo_.getIconWidth(), - 5, logo_.getIconWidth(), logo_.getIconHeight()); - if (ri.intersects(clip)) logo_.paintIcon(this, _g, ri.x, ri.y); - } - } else { - Dimension dd = getSize(); - Color pbg = UIManager.getColor("Panel.background"); - Color dbg = getBackground(); - - _g.setColor(pbg); - _g.fillRect(0, 0, dd.width, dd.height); // LM+4 - - // JInternalFrame[] frames=getAllFrames(); - int y, l; - - sortFramesByTitle(frames); - - l = frames.length; - y = 0; - for (int i = 0; i < l; i++) { - if (frames[i].isClosed()) continue; - if (!frames[i].isVisible()) continue; - - // if(isPalette(frames[i])) continue; - - _g.setColor(pbg); - _g.draw3DRect(0, y, LEFT_MARGIN - 1, LEFT_MARGIN - 1, false); - - if (isPalette(frames[i])) _g.setColor(pbg); - else if (frames[i].isSelected()) _g.setColor(dbg.brighter()); - else - _g.setColor(dbg); - _g.fill3DRect(1, y + 1, LEFT_MARGIN - 2, LEFT_MARGIN - 2, true); - - Icon icon = frames[i].getFrameIcon(); - if (icon == null) icon = UIManager.getIcon("InternalFrame.icon"); - if (icon != null) { - int w = icon.getIconWidth(); - int h = icon.getIconHeight(); - icon.paintIcon(this, _g, (LEFT_MARGIN - w) / 2, y + (LEFT_MARGIN - h) / 2); - } - - y += LEFT_MARGIN; - } - } - } - - public void paintChildren(Graphics _g) { - /* - * if(isTabbed()) { JInternalFrame[] frames=getAllFrames(); } else - */ - - super.paintChildren(_g); - } - - public String getToolTipText() { - return null; - } - - public/* synchronized */String getToolTipText(MouseEvent _evt) { - if (isTabbed()) { - int xe = _evt.getX(); - int ye = _evt.getY(); - - JInternalFrame[] frames = getAllFrames(); - int l = frames.length; - - if ((xe < LEFT_MARGIN) && (ye < LEFT_MARGIN * l)) { - sortFramesByTitle(frames); - JInternalFrame f = frames[ye / LEFT_MARGIN]; - String r = f.getTitle(); - if ("".equals(r)) r = null; - if (r == null) r = "" + (1 + ye / LEFT_MARGIN); - return r; - } - } - - return super.getToolTipText(_evt); - } - - public/* synchronized */Point getToolTipLocation(MouseEvent _evt) { - if (isTabbed()) { - int xe = _evt.getX(); - int ye = _evt.getY(); - - JInternalFrame[] frames = getAllFrames(); - int l = frames.length; - - if ((xe < LEFT_MARGIN) && (ye < LEFT_MARGIN * l)) { - sortFramesByTitle(frames); - // return new Point(0,(ye/LEFT_MARGIN+1)*LEFT_MARGIN); - return new Point(LEFT_MARGIN + 2, (ye / LEFT_MARGIN) * LEFT_MARGIN + 1); - } - } - - return super.getToolTipLocation(_evt); - } - - // Proprietes - - private String title_; - - public String getTitle() { - return title_; - } - - public void setTitle(String _title) { - title_ = _title; - } - - private boolean outline_ = BuPreferences.BU.getBooleanProperty("desktop.outline", true); - - public boolean isOutline() { - return outline_; - } - - // public void setOutline(boolean _outline) { outline_=_outline; } - - /* - * if(FuLib.jdk()<1.2) { if(outline) putClientProperty("JDesktopPane.dragMode","outline"); else - * putClientProperty("JDesktopPane.dragMode","faster"); } else { if(outline) setDragMode(OUTLINE_DRAG_MODE); else - * setDragMode(LIVE_DRAG_MODE); } - */ - - private boolean tabbed_ = BuPreferences.BU.getBooleanProperty("desktop.tabbed", false); - - public boolean isTabbed() { - return tabbed_; - } - - // public void setTabbed(boolean _tabbed) { tabbed_=_tabbed; } - - private boolean blocked_ = BuPreferences.BU.getBooleanProperty("desktop.blocked", true); - - public boolean isBlocked() { - return blocked_; - } - - // public void setBlocked(boolean _blocked) { blocked_=_blocked; } - - private Icon logo_; - - public Icon getLogo() { - return logo_; - } - - public void setLogo(Icon _logo) { - logo_ = _logo; - repaint(); - } - - private BuBackgroundPainter bp_; - - public BuBackgroundPainter getBackgroundPainter() { - return bp_; - } - - public void setBackgroundPainter(BuBackgroundPainter _bp) { - bp_ = _bp; - invalidate(); - repaint(); - } - - private Insets margins_ = createHardMargins(); - - protected Insets createHardMargins() { - return new Insets(0, 0, 0, 0); - } - - public Insets getHardMargins() { - Insets r = new Insets(margins_.top, margins_.left, margins_.bottom, margins_.right); - - BuBackgroundPainter bp = getBackgroundPainter(); - if (bp != null) r.bottom = Math.max(r.bottom, bp.getBarHeight()); - - return r; - } - - public void setHardMargins(Insets _margins) { - margins_ = _margins; - invalidate(); - repaint(); - } - - // Filles - - public void addInternalFrame(JInternalFrame _f) { - if (!SwingUtilities.isEventDispatchThread()) throw new RuntimeException("Not in swing thread. " - + "Use Implementation.addInternalFrame() instead"); - - // System.err.println(_f.getName()+":"+_f.getDesktopPane()); - - if (_f.getDesktopPane() == null) { - if (_f.isSelected()) { - try { - _f.setSelected(false); - } catch (PropertyVetoException ex) {} - } - - Point pf = _f.getLocation(); - if ((pf.x == 0) && (pf.y == 0)) { - Container cp = getParent(); - if (cp instanceof JViewport) { - Rectangle vr = ((JViewport) cp).getViewRect(); - Dimension df = _f.getSize(); - - pf.x = vr.x + (vr.width - df.width) / 2; - pf.y = vr.y + (vr.height - df.height) / 2; - _f.setLocation(pf); - } - } - - // SwingUtilities.updateComponentTreeUI(_f); - add(_f); - checkInternalFrame(_f); - // doLayout(); - // validate(); - - snapXY(_f); - snapWH(_f); - // repaint(); // @GDX ??? - } - - activateInternalFrame(_f); - } - - public void removeInternalFrame(JInternalFrame _f) { - if (!SwingUtilities.isEventDispatchThread()) throw new RuntimeException("Not in swing thread. " - + "Use Implementation.removeInternalFrame() instead"); - - if (_f != null && _f.getDesktopPane() == this) { - deactivateInternalFrame(_f); - remove(_f); - } - - adjustSize(); - } - - public void checkInternalFrame(JInternalFrame _f) { - if (!SwingUtilities.isEventDispatchThread()) throw new RuntimeException("Not in swing thread."); - - Dimension dd = getSize(); - Point pf = _f.getLocation(); - Dimension df = _f.getSize(); - - if (_f.isResizable()) { - if (df.width > dd.width) df.width = dd.width; - if (df.height > dd.height) df.height = dd.height; - if (!df.equals(getSize())) _f.setSize(df); - } - - if (pf.x + df.width > dd.width) pf.x = dd.width - df.width; - if (pf.y + df.height > dd.height) pf.y = dd.height - df.height; - if (pf.x < 0) pf.x = 0; - if (pf.y < 0) pf.y = 0; - - if (isTabbed() && isPalette(_f) && (pf.x < LEFT_MARGIN + 4)) pf.x = LEFT_MARGIN + 4; - - if (!pf.equals(getLocation())) _f.setLocation(pf); - - adjustSize(); - } - - public void activateInternalFrame(JInternalFrame _f) { - if (!SwingUtilities.isEventDispatchThread()) throw new RuntimeException("Not in swing thread. " - + "Use Implementation.activateInternalFrame() instead"); - - if (!_f.isVisible()) { - _f.setVisible(true); - } - - if (_f.isClosed()) { - try { - _f.setClosed(false); - } catch (PropertyVetoException ex) {} - } - - checkInternalFrame(_f); - - if (_f.isIcon()) { - try { - _f.setIcon(false); - } catch (PropertyVetoException ex) {} - } - - // if(!isPalette(_f)) - { - moveToFront(_f); - if (!_f.isSelected() && !isPalette(_f)) { - try { - _f.setSelected(true); - } catch (PropertyVetoException ex) {} - } - } - } - - public void deactivateInternalFrame(JInternalFrame _f) { - if (!SwingUtilities.isEventDispatchThread()) throw new RuntimeException("Not in swing thread."); - - checkInternalFrame(_f); - - if (_f.isSelected()) { - try { - _f.setSelected(false); - } catch (PropertyVetoException ex) {} - } - } - - public/* synchronized */JInternalFrame getCurrentInternalFrame() { - JInternalFrame[] frames = getAllFrames(); - JInternalFrame r = null; - - for (int i = 0; i < frames.length; i++) - if (frames[i].isSelected()) { - r = frames[i]; - break; - } - - return r; - } - - public/* synchronized */JInternalFrame[] getNormalFrames() { - JInternalFrame[] frames = getAllFrames(); - int l, n, i, j; - - l = frames.length; - n = 0; - - for (i = 0; i < l; i++) - if (!frames[i].isIcon() && !isPalette(frames[i])) n++; - - JInternalFrame[] r = new JInternalFrame[n]; - - j = 0; - for (i = 0; i < l; i++) - if (!frames[i].isIcon() && !isPalette(frames[i])) { - r[j] = frames[i]; - j++; - } - - return r; - } - - public/* synchronized */JInternalFrame[] getNotIconifiedFrames() { - JInternalFrame[] frames = getAllFrames(); - int l, n, i, j; - - l = frames.length; - n = 0; - - for (i = 0; i < l; i++) - if (!frames[i].isIcon()) n++; - - JInternalFrame[] r = new JInternalFrame[n]; - - j = 0; - for (i = 0; i < l; i++) - if (!frames[i].isIcon()) { - r[j] = frames[i]; - j++; - } - - return r; - } - - public/* synchronized */JInternalFrame[] getIconifiedFrames() { - JInternalFrame[] frames = getAllFrames(); - int l, n, i, j; - - l = frames.length; - n = 0; - - for (i = 0; i < l; i++) - if (frames[i].isIcon()) n++; - - JInternalFrame[] r = new JInternalFrame[n]; - - j = 0; - for (i = 0; i < l; i++) - if (frames[i].isIcon()) { - r[j] = frames[i]; - j++; - } - - return r; - } - - public/* synchronized */JInternalFrame[] getPalettes() { - JInternalFrame[] frames = getAllFrames(); - int l, n, i, j; - - l = frames.length; - n = 0; - - for (i = 0; i < l; i++) - if (isPalette(frames[i])) n++; - - JInternalFrame[] r = new JInternalFrame[n]; - - j = 0; - for (i = 0; i < l; i++) - if (isPalette(frames[i])) { - r[j] = frames[i]; - j++; - } - - return r; - } - - public int getNormalFramesCount() { - return getNormalFrames().length; - } - - public int getNotIconifiedFramesCount() { - return getNotIconifiedFrames().length; - } - - public int getIconifiedFramesCount() { - return getIconifiedFrames().length; - } - - public int getPalettesCount() { - return getPalettes().length; - } - - public JInternalFrame getSelectedFrame() { - JInternalFrame r = null; - - if (BuLib.swing() >= 1.2) { - r = super.getSelectedFrame(); - } else { - JInternalFrame[] f = getNormalFrames(); - for (int i = 0; i < f.length; i++) - if (f[i].isSelected()) { - r = f[i]; - break; - } - } - - return r; - } - - // Reorganisation - - protected void sortFramesByTitle(JInternalFrame[] _frames) { - JInternalFrame tmp; - int i, l; - - l = _frames.length; - for (i = 0; i + 1 < l; i++) { - String t1 = _frames[i].getTitle(); - String t2 = _frames[i + 1].getTitle(); - if ((t1 != null) && (t2 != null) && (t1.compareTo(t2) > 0)) { - tmp = _frames[i]; - _frames[i] = _frames[i + 1]; - _frames[i + 1] = tmp; - i--; - if (i >= 0) i--; - } - } - } - - protected void sortFramesByHeight(JInternalFrame[] _frames) { - sortFramesByTitle(_frames); - - JInternalFrame tmp; - int i, l; - - l = _frames.length; - for (i = 0; i + 1 < l; i++) - if (_frames[i].getHeight() > _frames[i + 1].getHeight()) { - tmp = _frames[i]; - _frames[i] = _frames[i + 1]; - _frames[i + 1] = tmp; - i--; - if (i >= 0) i--; - } - } - - protected void sortFramesByWidth(JInternalFrame[] _frames) { - sortFramesByTitle(_frames); - - JInternalFrame tmp; - int i, l; - - l = _frames.length; - for (i = 0; i + 1 < l; i++) - if (_frames[i].getWidth() < _frames[i + 1].getWidth()) { - tmp = _frames[i]; - _frames[i] = _frames[i + 1]; - _frames[i + 1] = tmp; - i--; - if (i >= 0) i--; - } - } - - public/* synchronized */void waterfall() { - if (isTabbed()) return; - - JInternalFrame[] frames = getNormalFrames(); - int i, l, x, y; - - l = frames.length; - if (l > 0) { - sortFramesByTitle(frames); - - x = 74; - y = 0; // y=5; - for (i = l - 1; i >= 0; i--) { - frames[i].setLocation(x, y); - moveToFront(frames[i]); - checkInternalFrame(frames[i]); - x += SNAPX;// x+=25; - y += SNAPY;// y+=25; - } - } - } - - public/* synchronized */void tile() { - if (isTabbed()) return; - - JInternalFrame[] frames = getNormalFrames(); - int i, l, x, y, h, wd/* ,hd */; - - l = frames.length; - if (l > 0) { - sortFramesByHeight(frames); - - wd = getWidth(); // getSize().width; - // hd=getHeight(); // getSize().height; - wd = (wd < 200 ? 200 : wd); - // hd=(hd<200 ? 200 : hd-60); - - x = 0; - y = 0; - h = 0; - for (i = 0; i < l; i++) { - int wf = frames[i].getWidth(); // Size().width; - int hf = frames[i].getHeight(); // Size().height; - if (x + wf > wd) { - x = 0; - y += h; - h = 0; - } - frames[i].setLocation(x, y); - x += wf; - h = Math.max(h, hf); - moveToFront(frames[i]); - checkInternalFrame(frames[i]); - } - } - } - - public void arrangeIcons() { - arrangeIcons0(); - adjustSize(); - } - - protected/* synchronized */final void arrangeIcons0() { - if (isTabbed()) return; - - JInternalFrame[] frames; - int i, l, x, y, wd, hd, bh; - - wd = getWidth(); // getSize().width; - hd = getHeight(); // getSize().height; - bh = 0; - - frames = getIconifiedFrames(); - l = frames.length; - - if (l > 0) { - sortFramesByTitle(frames); - - x = 0; - y = hd; - - Border b = UIManager.getBorder("StatusBar.border"); - if ((l > 0) && (b != null)) y -= b.getBorderInsets(this).bottom; - - for (i = 0; i < l; i++) { - JInternalFrame.JDesktopIcon dti = frames[i].getDesktopIcon(); - dti.setSize(dti.getPreferredSize()); - Dimension cs = dti.getSize(); - - if (x + cs.width >= wd) { - x = 0; - y -= cs.height; - } - - dti.setLocation(x, y - cs.height); - x += cs.width; - bh = Math.max(bh, hd - y + cs.height); - } - - if ((l > 0) && (b != null)) bh += b.getBorderInsets(this).top; - } - - /* - * frames=getNotIconifiedFrames(); l=frames.length; if(l>0) { sortFramesByWidth(frames); y=0; for(i=l-1;i>=0;i--) { - * Dimension d=frames[i].getSize(); if(d.height<32) { frames[i].setLocation(0,y); y+=d.height; } } } - */ - - if (isBlocked()) { - BuBackgroundPainter bp = getBackgroundPainter(); - if ((bp != null) && (bh != bp.getBarHeight())) { - if (bh > 0) { - bp.setBarHeight(bh); - repaint(0, hd - bh, wd, bh); - } - } - } - } - - public/* synchronized */void arrangePalettes() { - // if(isTabbed()) return; - - JInternalFrame[] frames; - int i, l, x, y/* ,wd */, hd, wmax; - - // wd=getWidth(); // getSize().width; - hd = getHeight(); // getSize().height; - - frames = getAllFrames(); - l = frames.length; - - if (l > 0) - { - int yInit = isTabbed() ? 17 : 0; - int xInit = isTabbed() ? LEFT_MARGIN + 1 : 0; - if (!isTabbed() && getCurrentInternalFrame() != null) { - xInit = getCurrentInternalFrame().getX(); - yInit = getCurrentInternalFrame().getY(); - } - sortFramesByHeight(frames); - - wmax = 0; - x = xInit; - y = yInit; - - for (i = 0; i < l; i++) { - JInternalFrame dti = frames[i]; - if (!isPalette(dti)) continue; - - // dti.setSize(dti.getPreferredSize()); - Dimension cs = dti.getSize(); - - if (y + cs.height >= hd) { - x += wmax; - y = yInit; - wmax = 0; - } - - dti.setLocation(x, y); - y += cs.height; - wmax = Math.max(wmax, cs.width); - } - } - - adjustSize(); - } - - public void reshape(int _x, int _y, int _w, int _h) { - int ow = getWidth(); - int oh = getHeight(); - super.reshape(_x, _y, _w, _h); - - if (isBlocked() && ((ow != _w) || (oh != _h))) arrangeIcons0(); - } - - public final Dimension getDefaultPreferredSize() { - return super.getPreferredSize(); - } - - public Dimension getPreferredSize() { - Dimension r = getDefaultPreferredSize(); - - Point qmin = new Point(0, 0); - - JInternalFrame[] frames = getAllFrames(); - int i, l; - - l = frames.length; - for (i = l - 1; i >= 0; i--) { - if (isTabbed() && !isPalette(frames[i])) continue; - if (!isTabbed() && !frames[i].isIcon() && frames[i].isMaximum()) continue; - - Point q = null; - if (frames[i].isIcon()) q = frames[i].getDesktopIcon().getLocation(); - else - q = frames[i].getLocation(); - if (qmin.x > q.x) qmin.x = q.x; - if (qmin.y > q.y) qmin.y = q.y; - } - - for (i = l - 1; i >= 0; i--) { - if (isTabbed() && !isPalette(frames[i])) continue; - if (!isTabbed() && !frames[i].isIcon() && frames[i].isMaximum()) continue; - - if (frames[i].isIcon()) { - if (!isBlocked()) { - JComponent di = frames[i].getDesktopIcon(); - if (di.isVisible()) { - Point p = di.getLocation(); - p.x -= qmin.x; - p.y -= qmin.y; - di.setLocation(p); - - Dimension d = di.getSize(); - if (p.x + d.width > r.width) r.width = p.x + d.width; - if (p.y + d.height > r.height) r.height = p.y + d.height; - } - } - } else if (frames[i].isVisible()) { - Point p = frames[i].getLocation(); - p.x -= qmin.x; - p.y -= qmin.y; - frames[i].setLocation(p); - - Dimension d = frames[i].getSize(); - if (p.x + d.width > r.width) r.width = p.x + d.width; - if (p.y + d.height > r.height) r.height = p.y + d.height; - } - } - - // System.err.println("PSIZE="+r); - return r; - } - - public void adjustSize() { - SwingUtilities.invokeLater(new Runnable() { - public void run() { - Container pt = getParent(); - - /* - * Point vxy=null; Dimension os =null; if(pt instanceof JViewport) { vxy=((JViewport)pt).getViewPosition(); os - * =getSize(); } - */ - - Dimension ns = getPreferredSize(); - - if (pt != null) { - Dimension vs = pt.getSize(); - if (ns.width < vs.width) ns.width = vs.width; - if (ns.height < vs.height) ns.height = vs.height; - } - - setSize(ns); - // revalidate(); - - /* - * getParent().doLayout(); getParent().validate(); doLayout(); validate(); - */ - - /* - * if(pt instanceof JViewport) { Dimension vwh=((JViewport)pt).getExtentSize(); - * ((JViewport)pt).scrollRectToVisible (new Rectangle(vxy.x-qmin.x-Math.max(0,ns.width -os.width ), - * vxy.y-qmin.y-Math.max(0,ns.height-os.height), vwh.width,vwh.height)); } - */ - - /* - * Container cp=getParent(); if(cp instanceof JViewport) { JInternalFrame sf=getCurrentInternalFrame(); - * if((sf!=null)&&sf.isShowing()) ((JViewport)cp).scrollRectToVisible(sf.getBounds()); } - */ - } - }); - } - - public void showFrame(final JInternalFrame _f) { - Runnable runnable = new Runnable() { - public void run() { - Container cp = getParent(); - if ((cp instanceof JViewport) && (_f != null) && _f.isShowing()) { - JViewport vp = (JViewport) cp; - Point vo = vp.getViewPosition(); - Dimension es = vp.getExtentSize(); - Dimension vs = vp.getViewSize(); - Point fo = _f.getLocation(); - Dimension fs = _f.getSize(); - - if (fo.x < vo.x) vo.x = fo.x; - if (fo.y < vo.y) vo.y = fo.y; - if (fo.x + fs.width > vo.x + es.width) vo.x = Math.min(fo.x, vs.width - es.width); - if (fo.y + fs.height > vo.y + es.height) vo.y = Math.min(fo.y, vs.height - es.height); - vp.setViewPosition(vo); - } - } - }; - - if (SwingUtilities.isEventDispatchThread()) runnable.run(); - else - SwingUtilities.invokeLater(runnable); - } - - // Layout - - final class Layout implements LayoutManager2 { - public void addLayoutComponent(String _s, Component _c) { - addLayoutComponent(_c, _s); - } - - public void addLayoutComponent(Component _c, Object _o) { - // System.out.println("ADD "+_c); - if ((_c instanceof JComponent) && isPalette((JComponent) _c)) return; - - if (_c instanceof BuInternalFrame) ((BuInternalFrame) _c).simplifyTop(); - - /* - * if(_c instanceof JComponent) ((JComponent)_c).setBorder(UIManager.getBorder("TitleBorder.border")); - */ - - if (_c instanceof JInternalFrame) { - JInternalFrame f = (JInternalFrame) _c; - f.setIconifiable(false); - f.setMaximizable(false); - // f.setVisible(f.isSelected()); - } - } - - public void removeLayoutComponent(Component _c) {} - - public float getLayoutAlignmentX(Container _p) { - return 0.5f; - } - - public float getLayoutAlignmentY(Container _p) { - return 0.5f; - } - - public Dimension minimumLayoutSize(Container _p) { - return _p.getSize(); - } - - public Dimension preferredLayoutSize(Container _p) { - return _p.getSize(); - } - - public Dimension maximumLayoutSize(Container _p) { - return _p.getSize(); - } - - public void invalidateLayout(Container _p) { - Dimension ds = _p.getSize(); - // int l=p.getComponentCount(); - repaint(0, 0, LEFT_MARGIN, ds.height); // l*LEFT_MARGIN; - } - - public void layoutContainer(Container _p) { - Dimension ds = _p.getSize(); - int l = _p.getComponentCount(); - for (int i = 0; i < l; i++) { - Component c = getComponent(i); - /* - * if( (c instanceof JComponent) &&isPalette((JComponent)c)) ; else c.setBounds(LEFT_MARGIN,0, - * ds.width-LEFT_MARGIN,ds.height); - */ - if ((c instanceof JInternalFrame) && !isPalette((JComponent) c)) { - c.setBounds(LEFT_MARGIN, 0, ds.width - LEFT_MARGIN, ds.height); - } - } - - // invalidate(); - repaint(0, 0, LEFT_MARGIN, ds.height); - } - } - - // Mouse - - public void mouseDown(MouseEvent _evt) {} - - public void mouseEntered(MouseEvent _evt) {} - - public void mouseExited(MouseEvent _evt) {} - - public void mousePressed(MouseEvent _evt) {} - - public void mouseReleased(MouseEvent _evt) {} - - public void mouseUp(MouseEvent _evt) {} - - public void mouseClicked(MouseEvent _evt) { - if (BuLib.isRight(_evt)) { - popupMenu(_evt); - } else if (BuLib.isLeft(_evt) && isTabbed()) { - int xe = _evt.getX(); - int ye = _evt.getY(); - - JInternalFrame[] frames = getAllFrames(); - int l = frames.length; - - if ((xe < LEFT_MARGIN) && (ye < LEFT_MARGIN * l)) { - sortFramesByTitle(frames); - activateInternalFrame(frames[ye / LEFT_MARGIN]); - } - } - } - - protected BuPopupMenu menu_ = null; - - protected/* synchronized */BuPopupMenu createPopupMenu() { - if (menu_ != null) return menu_; - - menu_ = new BuPopupMenu(_("Bureau")); - - menu_.addCheckBox(_("Grille"), "GRILLE", BuResource.BU.getMenuIcon("aucun"), true, true); - menu_.addCheckBox(_("Points"), "POINTS", BuResource.BU.getMenuIcon("aucun"), true, true); - menu_.addCheckBox(_("Magn\xE9tisme"), "MAGNETISME", BuResource.BU.getMenuIcon("aucun"), true, true); - menu_.addSeparator(); - menu_.addMenuItem(_("Uniforme"), "DESKTOP_UNIFORME", BuResource.BU.getMenuIcon("uniforme"), true); - menu_.addMenuItem(_("D\xE9grad\xE9"), "DESKTOP_DEGRADE", BuResource.BU.getMenuIcon("degrade"), true); - menu_.addSeparator(); - - BuMenu mnTextures = new BuMenu(_("Textures"), "MENU_TEXTURES", BuResource.BU.getMenuIcon("texture")); - - // new BuTextureIcon(BuResource.BU.getImage("background_desktop_1"))); - /* - * mnTextures.addMenuItem (_("Texture")+" 1", "DESKTOP_TEXTURE1",new BuTextureIcon - * (BuResource.BU.getImage("background_desktop_1")),true); mnTextures.addMenuItem (_("Texture")+" 2", - * "DESKTOP_TEXTURE2",new BuTextureIcon (BuResource.BU.getImage("background_desktop_2")),true); - * mnTextures.addMenuItem (_("Texture")+" 3", "DESKTOP_TEXTURE3",new BuTextureIcon - * (BuResource.BU.getImage("background_desktop_3")),true); mnTextures.addMenuItem (_("Texture")+" 4", - * "DESKTOP_TEXTURE4",new BuTextureIcon (new BuIcon (BuPreferences.BU.getStringProperty - * ("desktop.image")).getImage()),true); - */ - - for (int i = 1; i <= 9; i++) { - final int indx = i; - final BuTextureIcon icon = new BuTextureIcon(); - final BuMenuItem item = mnTextures.addMenuItem(_("Texture") + " " + i, "DESKTOP_TEXTURE" + i, icon, true); - - item.addChangeListener(new ChangeListener() { - public void stateChanged(ChangeEvent _evt) { - final ChangeListener THIS = this; - - Thread t = new Thread(new Runnable() { - public void run() { - item.removeChangeListener(THIS); - FuLog.debug("Loading texture #" + indx); - Image image = BuPreferences.BU.getTexture(indx); - icon.setImage(image); - item.repaint(); - } - }, "Bu load texture " + indx); - t.setPriority(Thread.MIN_PRIORITY); - t.start(); - } - }); - } - - BuMenu mnCouleurs = new BuMenu(_("Couleurs"), "MENU_COULEURS", new BuColorIcon(new Color(128, 160, 255))); - mnCouleurs.addMenuItem(_("Rouge"), "DESKTOP_ROUGE", new BuColorIcon(BuLib.getColor(new Color(128, 64, 64))), true); - mnCouleurs.addMenuItem(_("Vert"), "DESKTOP_VERT", new BuColorIcon(BuLib.getColor(new Color(64, 129, 64))), true); - mnCouleurs.addMenuItem(_("Bleu"), "DESKTOP_BLEU", new BuColorIcon(BuLib.getColor(new Color(64, 64, 128))), true); - mnCouleurs.addMenuItem(_("Orange"), "DESKTOP_ORANGE", new BuColorIcon(BuLib.getColor(new Color(192, 128, 96))), - true); - mnCouleurs.addMenuItem(_("Similaire"), "DESKTOP_SIMILAIRE", - new BuColorIcon(UIManager.getColor("Panel.background")), true); - mnCouleurs.addMenuItem(_("D\xE9faut"), "DESKTOP_DEFAUT", new BuColorIcon(UIManager.getColor("Desktop.background")), - true); - - menu_.addSubMenu(mnTextures, true); - menu_.addSubMenu(mnCouleurs, true); - - return menu_; - } - - public void popupMenu(MouseEvent _evt) { - BuBackgroundPainter bp = getBackgroundPainter(); - BuPopupMenu pm = createPopupMenu(); - - BuActionChecker.setCheckedForAction(pm, "GRILLE", bp.isGrid()); - BuActionChecker.setCheckedForAction(pm, "POINTS", bp.isDots()); - BuActionChecker.setCheckedForAction(pm, "MAGNETISME", BuPreferences.BU.getBooleanProperty("desktop.snap", false)); - - int x = _evt.getX() - pm.getPreferredSize().width / 2; - int y = _evt.getY() + 12; - pm.show((JComponent) _evt.getSource(), x, y); - } - - public void actionPerformed(ActionEvent _evt) { - String action = _evt.getActionCommand(); - // System.err.println("BuDesktop ACTION="+action); - - BuBackgroundPainter bp = getBackgroundPainter(); - - if (action.equals("GRILLE")) { - bp.setGrid(!bp.isGrid()); - } else if (action.equals("POINTS")) { - bp.setDots(!bp.isDots()); - } else if (action.equals("MAGNETISME")) { - BuPreferences.BU.putBooleanProperty("desktop.snap", !BuPreferences.BU.getBooleanProperty("desktop.snap", false)); - } else if (action.equals("DESKTOP_UNIFORME")) { - /* - * if(bp.getIcon()!=null) { setBackground(UIManager.getColor("Desktop.background")); bp.setIcon(null); } - */ - bp.setGradient(false); - } else if (action.equals("DESKTOP_DEGRADE")) { - bp.setGradient(true); - } else if (action.startsWith("DESKTOP_TEXTURE")) { - if (BuLib.getUIBoolean("Desktop.textureAlwaysUsed")) bp.setIcon(null); - else - bp.setIcon(BuLib.filter(new BuIcon(BuPreferences.BU.getTexture(Integer.parseInt(action.substring(15)))))); - } else if (action.equals("DESKTOP_ROUGE")) { - setBackground(new ColorUIResource(BuLib.getColor(new Color(128, 64, 64)))); - bp.setIcon(null); - } else if (action.equals("DESKTOP_VERT")) { - setBackground(new ColorUIResource(BuLib.getColor(new Color(64, 128, 64)))); - bp.setIcon(null); - } else if (action.equals("DESKTOP_BLEU")) { - setBackground(new ColorUIResource(BuLib.getColor(new Color(64, 64, 128)))); - bp.setIcon(null); - } else if (action.equals("DESKTOP_ORANGE")) { - setBackground(new ColorUIResource(BuLib.getColor(new Color(192, 128, 96)))); - bp.setIcon(null); - } else if (action.equals("DESKTOP_SIMILAIRE")) { - setBackground(UIManager.getColor("Panel.background")); - bp.setIcon(null); - } else if (action.equals("DESKTOP_DEFAUT")) { - setBackground(UIManager.getColor("Desktop.background")); - bp.setIcon(null); - } - - setBackgroundPainter(bp); - } - - public void updateUI() { - if (isShowing()) setBackground(null); - super.updateUI(); - } -} Copied: tags/FudaaModeleur_0_09/fudaa_devel/ctulu/src/com/memoire/bu/BuDesktop.java (from rev 4311, branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/com/memoire/bu/BuDesktop.java) =================================================================== --- tags/FudaaModeleur_0_09/fudaa_devel/ctulu/src/com/memoire/bu/BuDesktop.java (rev 0) +++ tags/FudaaModeleur_0_09/fudaa_devel/ctulu/src/com/memoire/bu/BuDesktop.java 2008-12-22 15:11:04 UTC (rev 4313) @@ -0,0 +1,1281 @@ +/** + * @modification $Date: 2007-03-30 15:34:39 $ + * @statut unstable + * @file BuDesktop.java + * @version 0.43 + * @author Guillaume Desnoix + * @email gui...@de... + * @license GNU General Public License 2 (GPL2) + * @copyright 1998-2005 Guillaume Desnoix + */ + +package com.memoire.bu; + +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import java.beans.PropertyVetoException; + +import javax.swing.*; +import javax.swing.border.Border; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import javax.swing.plaf.ColorUIResource; + +import com.memoire.fu.FuLog; + +/** + * A DesktopPane with a few additional services. Auto-resizing, optionnaly tabbed, custom-friendly, icons management, + * ... + */ +public class BuDesktop extends JDesktopPane implements MouseListener, ActionListener { + public static final int LEFT_MARGIN = 31; + + public static final int SNAPX = Math.max(4, BuPreferences.BU.getIntegerProperty("desktop.snapx", 37)); + + public static final int SNAPY = Math.max(4, BuPreferences.BU.getIntegerProperty("desktop.snapy", 37)); + + public static final int BLOCK_LAYER = JLayeredPane.DEFAULT_LAYER.intValue() - 100; + + public BuDesktop() { + super(); + + setName("buDESKTOP"); + setDesktopManager(createDesktopManager()); + setBackgroundPainter(createBackgroundPainter()); + + addMouseListener(this); + + if (isTabbed()) { + setToolTipText("..."); + setLayout(new Layout()); + } + } + + public final boolean isPalette(JComponent _f) { + return (DEFAULT_LAYER.intValue() != getLayer(_f)) + && Boolean.TRUE.equals(_f.getClientProperty("JInternalFrame.isPalette")); + } + + protected String _(String _s) { + return BuResource.BU.getString(_s); + } + + // Anti-aliasing + + public void paint(Graphics _g) { + BuLib.setAntialiasing(this, _g); + super.paint(_g); + } + + // Snap + + public final void snapXY(JComponent _f) { + if (BuPreferences.BU.getBooleanProperty("desktop.snap", false) && !isTabbed() && !isPalette(_f) + && (_f instanceof JInternalFrame)) { + Point p = _f.getLocation(); + boolean b = false; + if (p.x % SNAPX != 0) { + p.x = p.x - p.x % SNAPX; + b = true; + } + if (p.y % SNAPY != 0) { + p.y = p.y - p.y % SNAPY; + b = true; + } + if (b) _f.setLocation(p); + } + } + + public final void snapWH(JComponent _f) { + if (BuPreferences.BU.getBooleanProperty("desktop.snap", false) && !isTabbed() && !isPalette(_f) + && (_f instanceof JInternalFrame)) { + Dimension d = _f.getSize(); + boolean b = false; + if (((JInternalFrame) _f).isResizable()) { + if (d.width % SNAPX != 0) { + d.width = d.width + SNAPX - d.width % SNAPX; + b = true; + } + if (d.height % SNAPY != 0) { + d.height = d.height + SNAPY - d.height % SNAPY; + b = true; + } + } + if (b) _f.setSize(d); + } + } + + protected DesktopManager createDesktopManager() { + return new BuDesktopManager(this); + } + + protected BuBackgroundPainter createBackgroundPainter() { + BuBackgroundPainter bp = new BuBackgroundPainter(); + if (isBlocked()) { + bp.setBar(true); + bp.setBarHeight(BuLib.isMetal() ? 8 + BuResource.BU.getDefaultFrameSize() : 0); + + /* + * (BuLib.isSlaf() ? 10+BuResource.BU.getDefaultFrameSize() : 0)); + */ + } + return bp; + } + + public boolean isFocusCycleRoot() { + return true; + } + + /* + * public void moveToFront(JInternalFrame _f) { _f.moveToFront(); JInternalFrame[] frames=getAllFrames(); int + * l=frames.length; for(int i=0;i<l;i++) if(isPalette(frames[i])&&frames[i].isVisible()) frames[i].moveToFront(); } + */ + + public boolean isOpaque() { + return Boolean.TRUE.equals(UIManager.get("Desktop.opaque")); + } + + protected void addImpl(Component _c, Object _constraints, int _index) { + if (_c instanceof JInternalFrame.JDesktopIcon) { + JInternalFrame.JDesktopIcon i = (JInternalFrame.JDesktopIcon) _c; + + i.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); + putLayer(i, BLOCK_LAYER); + + if (isBlocked()) { + Component[] c = i.getComponents(); + + if (BuLib.isMetal()) { + if (i.getComponentCount() == 2) { + i.remove(c[1]); + i.setBorder(BuBorders.EMPTY0000); + if (c[0] instanceof JButton) { + ((JButton) c[0]).setHorizontalAlignment(SwingConstants.LEFT); + ((JButton) c[0]).setMargin(BuInsets.INSETS1111); + ((JButton) c[0]).getModel().setRollover(false); + } + } + } else if (BuLib.isSlaf()) { + if (c.length == 2) { + i.setBorder(BuBorders.EMPTY1111); + i.setLayout(new BorderLayout(2, 0)); + i.add(c[0], BorderLayout.CENTER); // text + i.add(c[1], BorderLayout.WEST); // icon + if (c[0] instanceof JLabel) ((JLabel) c[0]).setHorizontalAlignment(SwingConstants.LEFT); + } + } + Dimension ps = i.getPreferredSize(); + if (BuLib.isMotif()) ; + else if (BuLib.isMetal()) ps.width = SNAPX * 4; + // else if(BuLib.isSlaf ()) ps.width=SNAPX*3; + else + ps.width = SNAPX * 3; + // if(ps.width %37!=0) ps.width =ps.width +37-ps.width %37; + // if(ps.height%37!=0) ps.height=ps.height+37-ps.height%37; + i.setPreferredSize(ps); + i.setSize(ps); + + JInternalFrame f = i.getInternalFrame(); + f.addPropertyChangeListener(new PropertyChangeListener() { + public void propertyChange(PropertyChangeEvent _evt) { + if (Boolean.TRUE.equals(_evt.getNewValue()) && "selected".equals(_evt.getPropertyName())) { + final JInternalFrame fintern = (JInternalFrame) _evt.getSource(); + if (fintern.isIcon()) { + try { + fintern.setIcon(false); + } catch (PropertyVetoException ex) {} + } + } + } + }); + } + } + + if (_c instanceof JComponent) { + snapXY((JComponent) _c); + snapWH((JComponent) _c); + } + + super.addImpl(_c, _constraints, _index); + + boolean b = isBlocked() && (_c instanceof JInternalFrame.JDesktopIcon); + if (b) arrangeIcons0(); + } + + public void remove(int _index) { + Component c = getComponent(_index); + Rectangle r = c.getBounds(); + boolean b = isBlocked() && (c instanceof JInternalFrame.JDesktopIcon); + + super.remove(_index); + repaint(r); + if (b) arrangeIcons0(); + } + + // Paint + + public/* synchronized */void paintComponent(Graphics _g) { + JInternalFrame[] frames = getAllFrames(); + + if (!isTabbed() || (frames.length == 0)) { + Rectangle clip = _g.getClipBounds(); + // Dimension dd =getSize(); + + BuBackgroundPainter bp = getBackgroundPainter(); + if (bp != null) bp.paintBackground(this, _g); + + if (logo_ != null) { + Rectangle ri = new Rectangle(5, + // dd.width-5-logo_.getIconWidth(), + 5, logo_.getIconWidth(), logo_.getIconHeight()); + if (ri.intersects(clip)) logo_.paintIcon(this, _g, ri.x, ri.y); + } + } else { + Dimension dd = getSize(); + Color pbg = UIManager.getColor("Panel.background"); + Color dbg = getBackground(); + + _g.setColor(pbg); + _g.fillRect(0, 0, dd.width, dd.height); // LM+4 + + // JInternalFrame[] frames=getAllFrames(); + int y, l; + + sortFramesByTitle(frames); + + l = frames.length; + y = 0; + for (int i = 0; i < l; i++) { + if (frames[i].isClosed()) continue; + if (!frames[i].isVisible()) continue; + + // if(isPalette(frames[i])) continue; + + _g.setColor(pbg); + _g.draw3DRect(0, y, LEFT_MARGIN - 1, LEFT_MARGIN - 1, false); + + if (isPalette(frames[i])) _g.setColor(pbg); + else if (frames[i].isSelected()) _g.setColor(dbg.brighter()); + else + _g.setColor(dbg); + _g.fill3DRect(1, y + 1, LEFT_MARGIN - 2, LEFT_MARGIN - 2, true); + + Icon icon = frames[i].getFrameIcon(); + if (icon == null) icon = UIManager.getIcon("InternalFrame.icon"); + if (icon != null) { + int w = icon.getIconWidth(); + int h = icon.getIconHeight(); + icon.paintIcon(this, _g, (LEFT_MARGIN - w) / 2, y + (LEFT_MARGIN - h) / 2); + } + + y += LEFT_MARGIN; + } + } + } + + public void paintChildren(Graphics _g) { + /* + * if(isTabbed()) { JInternalFrame[] frames=getAllFrames(); } else + */ + + super.paintChildren(_g); + } + + public String getToolTipText() { + return null; + } + + public/* synchronized */String getToolTipText(MouseEvent _evt) { + if (isTabbed()) { + int xe = _evt.getX(); + int ye = _evt.getY(); + + JInternalFrame[] frames = getAllFrames(); + int l = frames.length; + + if ((xe < LEFT_MARGIN) && (ye < LEFT_MARGIN * l)) { + sortFramesByTitle(frames); + JInternalFrame f = frames[ye / LEFT_MARGIN]; + String r = f.getTitle(); + if ("".equals(r)) r = null; + if (r == null) r = "" + (1 + ye / LEFT_MARGIN); + return r; + } + } + + return super.getToolTipText(_evt); + } + + public/* synchronized */Point getToolTipLocation(MouseEvent _evt) { + if (isTabbed()) { + int xe = _evt.getX(); + int ye = _evt.getY(); + + JInternalFrame[] frames = getAllFrames(); + int l = frames.length; + + if ((xe < LEFT_MARGIN) && (ye < LEFT_MARGIN * l)) { + sortFramesByTitle(frames); + // return new Point(0,(ye/LEFT_MARGIN+1)*LEFT_MARGIN); + return new Point(LEFT_MARGIN + 2, (ye / LEFT_MARGIN) * LEFT_MARGIN + 1); + } + } + + return super.getToolTipLocation(_evt); + } + + // Proprietes + + private String title_; + + public String getTitle() { + return title_; + } + + public void setTitle(String _title) { + title_ = _title; + } + + private boolean outline_ = BuPreferences.BU.getBooleanProperty("desktop.outline", true); + + public boolean isOutline() { + return outline_; + } + + // public void setOutline(boolean _outline) { outline_=_outline; } + + /* + * if(FuLib.jdk()<1.2) { if(outline) putClientProperty("JDesktopPane.dragMode","outline"); else + * putClientProperty("JDesktopPane.dragMode","faster"); } else { if(outline) setDragMode(OUTLINE_DRAG_MODE); else + * setDragMode(LIVE_DRAG_MODE); } + */ + + private boolean tabbed_ = BuPreferences.BU.getBooleanProperty("desktop.tabbed", false); + + public boolean isTabbed() { + return tabbed_; + } + + // public void setTabbed(boolean _tabbed) { tabbed_=_tabbed; } + + private boolean blocked_ = BuPreferences.BU.getBooleanProperty("desktop.blocked", true); + + public boolean isBlocked() { + return blocked_; + } + + // public void setBlocked(boolean _blocked) { blocked_=_blocked; } + + private Icon logo_; + + public Icon getLogo() { + return logo_; + } + + public void setLogo(Icon _logo) { + logo_ = _logo; + repaint(); + } + + private BuBackgroundPainter bp_; + + public BuBackgroundPainter getBackgroundPainter() { + return bp_; + } + + public void setBackgroundPainter(BuBackgroundPainter _bp) { + bp_ = _bp; + invalidate(); + repaint(); + } + + private Insets margins_ = createHardMargins(); + + protected Insets createHardMargins() { + return new Insets(0, 0, 0, 0); + } + + public Insets getHardMargins() { + Insets r = new Insets(margins_.top, margins_.left, margins_.bottom, margins_.right); + + BuBackgroundPainter bp = getBackgroundPainter(); + if (bp != null) r.bottom = Math.max(r.bottom, bp.getBarHeight()); + + return r; + } + + public void setHardMargins(Insets _margins) { + margins_ = _margins; + invalidate(); + repaint(); + } + + // Filles + + /** + * Ajoute une fenetre interne. Lors de l'ajout, la fenetre est rendue visible, positionn\xE9e devant les autres, et devient active. + * @param _f La fenetre interne a ajouter. + */ + public void addInternalFrame(JInternalFrame _f) { + if (!SwingUtilities.isEventDispatchThread()) throw new RuntimeException("Not in swing thread. " + + "Use Implementation.addInternalFrame() instead"); + + // B.M. : On prend garde que l'\xE9tat de la fenetre (qui peut \xEAtre une ancienne frame supprim\xE9e puis ajout\xE9e a nouveau) + // soit bien reinitialis\xE9. Sinon, risque de traceback. + if (_f.getDesktopPane() == null) { + if (_f.isSelected()) { + try { + _f.setSelected(false); + } catch (PropertyVetoException ex) {} + } + if (_f.isIcon()) { + try { + _f.setIcon(false); + } catch (PropertyVetoException ex) {} + } + + Point pf = _f.getLocation(); + if ((pf.x == 0) && (pf.y == 0)) { + Container cp = getParent(); + if (cp instanceof JViewport) { + Rectangle vr = ((JViewport) cp).getViewRect(); + Dimension df = _f.getSize(); + + pf.x = vr.x + (vr.width - df.width) / 2; + pf.y = vr.y + (vr.height - df.height) / 2; + _f.setLocation(pf); + } + } + + // SwingUtilities.updateComponentTreeUI(_f); + add(_f); + checkInternalFrame(_f); + // doLayout(); + // validate(); + + snapXY(_f); + snapWH(_f); + // repaint(); // @GDX ??? + } + + activateInternalFrame(_f); + } + + public void removeInternalFrame(JInternalFrame _f) { + if (!SwingUtilities.isEventDispatchThread()) throw new RuntimeException("Not in swing thread. " + + "Use Implementation.removeInternalFrame() instead"); + + if (_f != null && _f.getDesktopPane() == this) { + deactivateInternalFrame(_f); + remove(_f); + } + + adjustSize(); + } + + /** + * Indique au desktop qu'il y a eu un changement de position/taille de l'internal frame. Ceci lui permet de r\xE9ajuster sa taille. + * @param _f L'internal frame concern\xE9e par le changement de taille/position. + */ + public void checkInternalFrame(JInternalFrame _f) { + if (!SwingUtilities.isEventDispatchThread()) throw new RuntimeException("Not in swing thread."); + + Dimension dd = getSize(); + Point pf = _f.getLocation(); + Dimension df = _f.getSize(); + + if (_f.isResizable()) { + if (df.width > dd.width) df.width = dd.width; + if (df.height > dd.height) df.height = dd.height; + if (!df.equals(getSize())) _f.setSize(df); + } + + if (pf.x + df.width > dd.width) pf.x = dd.width - df.width; + if (pf.y + df.height > dd.height) pf.y = dd.height - df.height; + if (pf.x < 0) pf.x = 0; + if (pf.y < 0) pf.y = 0; + + if (isTabbed() && isPalette(_f) && (pf.x < LEFT_MARGIN + 4)) pf.x = LEFT_MARGIN + 4; + + if (!pf.equals(getLocation())) _f.setLocation(pf); + + adjustSize(); + } + + /** + * Active une fenetre interne. Lors de l'activation, la fenetre est rendue visible, positionn\xE9e devant les autres, et + * d\xE9siconifi\xE9e. + * @param _f La fenetre interne a activer. + */ + public void activateInternalFrame(JInternalFrame _f) { + if (!SwingUtilities.isEventDispatchThread()) throw new RuntimeException("Not in swing thread. " + + "Use Implementation.activateInternalFrame() instead"); + + if (!_f.isVisible()) { + _f.setVisible(true); + } + + if (_f.isClosed()) { + try { + _f.setClosed(false); + } catch (PropertyVetoException ex) {} + } + + checkInternalFrame(_f); + + if (_f.isIcon()) { + try { + _f.setIcon(false); + } catch (PropertyVetoException ex) {} + } + + // if(!isPalette(_f)) + { + moveToFront(_f); + if (!_f.isSelected() && !isPalette(_f)) { + try { + _f.setSelected(true); + } catch (PropertyVetoException ex) {} + } + } + } + + public void deactivateInternalFrame(JInternalFrame _f) { + if (!SwingUtilities.isEventDispatchThread()) throw new RuntimeException("Not in swing thread."); + + checkInternalFrame(_f); + + if (_f.isSelected()) { + try { + _f.setSelected(false); + } catch (PropertyVetoException ex) {} + } + } + + public/* synchronized */JInternalFrame getCurrentInternalFrame() { + JInternalFrame[] frames = getAllFrames(); + JInternalFrame r = null; + + for (int i = 0; i < frames.length; i++) + if (frames[i].isSelected()) { + r = frames[i]; + break; + } + + return r; + } + + public/* synchronized */JInternalFrame[] getNormalFrames() { + JInternalFrame[] frames = getAllFrames(); + int l, n, i, j; + + l = frames.length; + n = 0; + + for (i = 0; i < l; i++) + if (!frames[i].isIcon() && !isPalette(frames[i])) n++; + + JInternalFrame[] r = new JInternalFrame[n]; + + j = 0; + for (i = 0; i < l; i++) + if (!frames[i].isIcon() && !isPalette(frames[i])) { + r[j] = frames[i]; + j++; + } + + return r; + } + + public/* synchronized */JInternalFrame[] getNotIconifiedFrames() { + JInternalFrame[] frames = getAllFrames(); + int l, n, i, j; + + l = frames.length; + n = 0; + + for (i = 0; i < l; i++) + if (!frames[i].isIcon()) n++; + + JInternalFrame[] r = new JInternalFrame[n]; + + j = 0; + for (i = 0; i < l; i++) + if (!frames[i].isIcon()) { + r[j] = frames[i]; + j++; + } + + return r; + } + + public/* synchronized */JInternalFrame[] getIconifiedFrames() { + JInternalFrame[] frames = getAllFrames(); + int l, n, i, j; + + l = frames.length; + n = 0; + + for (i = 0; i < l; i++) + if (frames[i].isIcon()) n++; + + JInternalFrame[] r = new JInternalFrame[n]; + + j = 0; + for (i = 0; i < l; i++) + if (frames[i].isIcon()) { + r[j] = frames[i]; + j++; + } + + return r; + } + + public/* synchronized */JInternalFrame[] getPalettes() { + JInternalFrame[] frames = getAllFrames(); + int l, n, i, j; + + l = frames.length; + n = 0; + + for (i = 0; i < l; i++) + if (isPalette(frames[i])) n++; + + JInternalFrame[] r = new JInternalFrame[n]; + + j = 0; + for (i = 0; i < l; i++) + if (isPalette(frames[i])) { + r[j] = frames[i]; + j++; + } + + return r; + } + + public int getNormalFramesCount() { + return getNormalFrames().length; + } + + public int getNotIconifiedFramesCount() { + return getNotIconifiedFrames().length; + } + + public int getIconifiedFramesCount() { + return getIconifiedFrames().length; + } + + public int getPalettesCount() { + return getPalettes().length; + } + + public JInternalFrame getSelectedFrame() { + JInternalFrame r = null; + + if (BuLib.swing() >= 1.2) { + r = super.getSelectedFrame(); + } else { + JInternalFrame[] f = getNormalFrames(); + for (int i = 0; i < f.length; i++) + if (f[i].isSelected()) { + r = f[i]; + break; + } + } + + return r; + } + + // Reorganisation + + protected void sortFramesByTitle(JInternalFrame[] _frames) { + JInternalFrame tmp; + int i, l; + + l = _frames.length; + for (i = 0; i + 1 < l; i++) { + String t1 = _frames[i].getTitle(); + String t2 = _frames[i + 1].getTitle(); + if ((t1 != null) && (t2 != null) && (t1.compareTo(t2) > 0)) { + tmp = _frames[i]; + _frames[i] = _frames[i + 1]; + _frames[i + 1] = tmp; + i--; + if (i >= 0) i--; + } + } + } + + protected void sortFramesByHeight(JInternalFrame[] _frames) { + sortFramesByTitle(_frames); + + JInternalFrame tmp; + int i, l; + + l = _frames.length; + for (i = 0; i + 1 < l; i++) + if (_frames[i].getHeight() > _frames[i + 1].getHeight()) { + tmp = _frames[i]; + _frames[i] = _frames[i + 1]; + _frames[i + 1] = tmp; + i--; + if (i >= 0) i--; + } + } + + protected void sortFramesByWidth(JInternalFrame[] _frames) { + sortFramesByTitle(_frames); + + JInternalFrame tmp; + int i, l; + + l = _frames.length; + for (i = 0; i + 1 < l; i++) + if (_frames[i].getWidth() < _frames[i + 1].getWidth()) { + tmp = _frames[i]; + _frames[i] = _frames[i + 1]; + _frames[i + 1] = tmp; + i--; + if (i >= 0) i--; + } + } + + public/* synchronized */void waterfall() { + if (isTabbed()) return; + + JInternalFrame[] frames = getNormalFrames(); + int i, l, x, y; + + l = frames.length; + if (l > 0) { + sortFramesByTitle(frames); + + x = 74; + y = 0; // y=5; + for (i = l - 1; i >= 0; i--) { + frames[i].setLocation(x, y); + moveToFront(frames[i]); + checkInternalFrame(frames[i]); + x += SNAPX;// x+=25; + y += SNAPY;// y+=25; + } + } + } + + public/* synchronized */void tile() { + if (isTabbed()) return; + + JInternalFrame[] frames = getNormalFrames(); + int i, l, x, y, h, wd/* ,hd */; + + l = frames.length; + if (l > 0) { + sortFramesByHeight(frames); + + wd = getWidth(); // getSize().width; + // hd=getHeight(); // getSize().height; + wd = (wd < 200 ? 20... [truncated message content] |
From: <emm...@us...> - 2008-12-22 14:50:16
|
Revision: 4312 http://fudaa.svn.sourceforge.net/fudaa/?rev=4312&view=rev Author: emmanuel_martin Date: 2008-12-22 14:50:07 +0000 (Mon, 22 Dec 2008) Log Message: ----------- Ajout de l'export mascaret 1d et 2d ; r?\195?\169organisation du d?\195?\169coupage en package des sources modeleur 1d ; Construction d'une premi?\195?\168re version des vues des modules biefs et profils (les controleurs ne sont pas faits). Modified Paths: -------------- branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISAttributeConstants.java 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 branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlProjectExportPanel.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/MdlFille1d.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/test/testModeleur1d/TestDataGeometryAdapter.java Added Paths: ----------- branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/mascaret/io/MascaretDataError.java branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/mascaret/io/MascaretDataIncomplete.java branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/mascaret/io/MascaretProfilAbstractRepresentation.java branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/mascaret/io/MascaretWriter.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/controller/ 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/model/ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/DataGeometry.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/DataGeometryAdapter.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/DataGeometryException.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/DataGeometryListener.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/ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/VueBief.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/VueContainerModules.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/VueCourbe.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/VueExport.java 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/VueModuleGestionProfil.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/VueTableau.java Removed Paths: ------------- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/Controller1d.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/DataGeometry.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/DataGeometryAdapter.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/DataGeometryException.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/DataGeometryListener.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/VueBief.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/VueCourbe.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/VueTableau.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-12-22 14:20:55 UTC (rev 4311) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISAttributeConstants.java 2008-12-22 14:50:07 UTC (rev 4312) @@ -11,11 +11,10 @@ import java.util.Arrays; import java.util.List; +import org.fudaa.ctulu.CtuluLib; import org.fudaa.ctulu.CtuluLibString; import org.fudaa.ctulu.gui.CtuluValueEditorChoice; -import org.fudaa.ctulu.CtuluLib; - import com.memoire.fu.FuLib; /** @@ -57,6 +56,10 @@ public final static String ATT_NATURE_CE="CE"; /** Nature axe hydraulique */ public final static String ATT_NATURE_AH="AH"; + /** Nature limite de stockage (gauche ou droite) */ + public final static String ATT_NATURE_LS="LS"; + /** Nature rive (gauche ou droite) */ + public final static String ATT_NATURE_RV="RV"; /** * Un attribut nom, global. @@ -263,4 +266,54 @@ } return false; } + + // Attributs 1D \\ + + /** + * Attribut contenant la coordonn\xE9e de l'intersection entre une rive gauche et + * un profil. La donn\xE9e sauvgard\xE9e est une coordonn\xE9e (Coordinate). + */ + public final static GISAttribute INTERSECTION_RIVE_GAUCHE=new GISAttribute(null, CtuluLib.getS("Intersection rive gauche"), false){ + @Override + public String getID() { + return "ATTRIBUTE_INTERSECTION_RIVE_GAUCHE"; + } + }; + + /** + * Attribut contenant la coordonn\xE9e de l'intersection entre une rive droite et + * un profil. La donn\xE9e sauvgard\xE9e est une coordonn\xE9e (Coordinate). + */ + public final static GISAttribute INTERSECTION_RIVE_DROITE=new GISAttribute(null, CtuluLib.getS("Intersection rive droite"), false){ + @Override + public String getID() { + return "ATTRIBUTE_INTERSECTION_RIVE_DROITE"; + } + }; + + /** + * Attribut contenant la coordonn\xE9e de l'intersection entre une limite de + * stockage gauche et un profil. La donn\xE9e sauvgard\xE9e est une coordonn\xE9e + * (Coordinate). + */ + public final static GISAttribute INTERSECTION_LIMITE_STOCKAGE_GAUCHE=new GISAttribute(null, CtuluLib + .getS("Intersection limite stockage gauche"), false){ + @Override + public String getID() { + return "ATTRIBUTE_INTERSECTION_LIMITE_STOCKAGE_GAUCHE"; + } + }; + + /** + * Attribut contenant la coordonn\xE9e de l'intersection entre une limite de + * stockage droite et un profil. La donn\xE9e sauvgard\xE9e est une coordonn\xE9e + * (Coordinate). + */ + public final static GISAttribute INTERSECTION_LIMITE_STOCKAGE_DROITE=new GISAttribute(null, CtuluLib + .getS("Intersection limite stockage droite"), false){ + @Override + public String getID() { + return "ATTRIBUTE_INTERSECTION_LIMITE_STOCKAGE_DROITE"; + } + }; } Copied: branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/mascaret/io/MascaretDataError.java (from rev 4305, branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/DataGeometryException.java) =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/mascaret/io/MascaretDataError.java (rev 0) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/mascaret/io/MascaretDataError.java 2008-12-22 14:50:07 UTC (rev 4312) @@ -0,0 +1,22 @@ +/* + * @creation 19 d\xE9c. 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; + +/** + * Exception utilis\xE9 par MascaretWriter indiquant que des donn\xE9es sont + * incoh\xE9rentes et rendent ainsi impossible l'export. + * + * @author Emmanuel MARTIN + * @version $Id:$ + */ +public class MascaretDataError extends Exception { + + public MascaretDataError(String _msg){ + super(_msg); + } +} Property changes on: branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/mascaret/io/MascaretDataError.java ___________________________________________________________________ Added: svn:keywords + Id Added: svn:mergeinfo + /branches/Br_FudaaModeleur_TF/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/DataGeometryException.java:3445-3850 /branches/FudaaModeleur_TC1/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/DataGeometryException.java:3861-3891 Added: svn:eol-style + native Copied: branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/mascaret/io/MascaretDataIncomplete.java (from rev 4305, branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/DataGeometryException.java) =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/mascaret/io/MascaretDataIncomplete.java (rev 0) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/mascaret/io/MascaretDataIncomplete.java 2008-12-22 14:50:07 UTC (rev 4312) @@ -0,0 +1,22 @@ +/* + * @creation 19 d\xE9c. 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; + +/** + * Exception utilis\xE9 par MascaretWriter indiquant que des g\xE9om\xE9tries manque pour + * g\xE9n\xE9rer le fichier. + * + * @author Emmanuel MARTIN + * @version $Id:$ + */ +public class MascaretDataIncomplete extends Exception { + + public MascaretDataIncomplete(String _msg){ + super(_msg); + } +} Property changes on: branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/mascaret/io/MascaretDataIncomplete.java ___________________________________________________________________ Added: svn:keywords + Id Added: svn:mergeinfo + /branches/Br_FudaaModeleur_TF/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/DataGeometryException.java:3445-3850 /branches/FudaaModeleur_TC1/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/DataGeometryException.java:3861-3891 Added: svn:eol-style + native Modified: 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/MascaretFileFormat.java 2008-12-22 14:20:55 UTC (rev 4311) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/mascaret/io/MascaretFileFormat.java 2008-12-22 14:50:07 UTC (rev 4312) @@ -1,6 +1,6 @@ /* * @creation 13 nov. 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... Copied: branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/mascaret/io/MascaretProfilAbstractRepresentation.java (from rev 4305, branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/DataGeometryException.java) =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/mascaret/io/MascaretProfilAbstractRepresentation.java (rev 0) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/mascaret/io/MascaretProfilAbstractRepresentation.java 2008-12-22 14:50:07 UTC (rev 4312) @@ -0,0 +1,74 @@ +/* + * @creation 19 d\xE9c. 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.util.ArrayList; +import java.util.List; + +/** + * Container des informations relative \xE0 un profil. + * + * @author Emmanuel MARTIN + * @version $Id:$ + */ +public class MascaretProfilAbstractRepresentation { + public String nomBief; + public String nomProfil; + public List<Double> coordZ=new ArrayList<Double>(); // Bathy ou Topo + public List<Character> bathyOuTopoOuStockage=new ArrayList<Character>(); // B ou T ou S + // 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&&bathyOuTopoOuStockage.size()==coordZ.size(); + int i=-1; + // Verifi que bathyOuTopo ne comporte que B ou T + while(check&&++i<bathyOuTopoOuStockage.size()) + check=bathyOuTopoOuStockage.get(i).equals('T')||bathyOuTopoOuStockage.get(i).equals('B')||bathyOuTopoOuStockage.get(i).equals('S'); + 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; + } +} Property changes on: branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/mascaret/io/MascaretProfilAbstractRepresentation.java ___________________________________________________________________ Added: svn:keywords + Id Added: svn:mergeinfo + /branches/Br_FudaaModeleur_TF/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/DataGeometryException.java:3445-3850 /branches/FudaaModeleur_TC1/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/DataGeometryException.java:3861-3891 Added: svn:eol-style + native Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/mascaret/io/MascaretReader.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/mascaret/io/MascaretReader.java 2008-12-22 14:20:55 UTC (rev 4311) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/mascaret/io/MascaretReader.java 2008-12-22 14:50:07 UTC (rev 4312) @@ -32,66 +32,6 @@ */ 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){ @@ -106,7 +46,7 @@ private char[] charSeparation_=new char[]{' ', '\t'}; private char charSeparationNewLigne_='\n'; /** Profiles extraits */ - List<Profil> profils_=new ArrayList<Profil>(); + List<MascaretProfilAbstractRepresentation> profils_=new ArrayList<MascaretProfilAbstractRepresentation>(); public MascaretReader() { rawData_=null; @@ -183,7 +123,7 @@ */ String token=nextWordToken(lineToken); while (lineToken!=null&&token.equalsIgnoreCase("profil")) { - Profil profil=new Profil(); + MascaretProfilAbstractRepresentation profil=new MascaretProfilAbstractRepresentation(); // Premi\xE8re ligne \\ // Extraction des informations commune \xE0 1d et 2d @@ -206,7 +146,7 @@ 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)); + profil.bathyOuTopoOuStockage.add(nextWordToken(lineToken).charAt(0)); // Coordonn\xE9es XY : non pr\xE9sent dans les fichiers 1d token=nextWordToken(lineToken); if (token!=null) @@ -245,7 +185,7 @@ // 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); + MascaretProfilAbstractRepresentation profil=profils_.get(k); CoordinateArraySequence coordSeq=new CoordinateArraySequence(profil.coordXYTraceProfil.size()); // Trace profil for(int i=0;i<profil.coordXYTraceProfil.size();i++){ Copied: branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/mascaret/io/MascaretWriter.java (from rev 4303, branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/DataGeometryListener.java) =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/mascaret/io/MascaretWriter.java (rev 0) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/mascaret/io/MascaretWriter.java 2008-12-22 14:50:07 UTC (rev 4312) @@ -0,0 +1,372 @@ +/* + * @creation 19 d\xE9c. 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.FileWriter; +import java.io.IOException; +import java.io.Writer; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import org.fudaa.ctulu.CtuluAnalyze; +import org.fudaa.ctulu.fileformat.FileWriteOperationAbstract; +import org.fudaa.ctulu.fileformat.FortranInterface; +import org.fudaa.ctulu.gis.GISAttributeConstants; +import org.fudaa.ctulu.gis.GISAttributeModelDoubleInterface; +import org.fudaa.ctulu.gis.GISGeometryFactory; +import org.fudaa.ctulu.gis.GISPoint; +import org.fudaa.ctulu.gis.GISPolyligne; +import org.fudaa.ctulu.gis.GISZoneCollectionLigneBrisee; + +import com.vividsolutions.jts.geom.Coordinate; +import com.vividsolutions.jts.geom.CoordinateSequence; +import com.vividsolutions.jts.geom.Geometry; + +/** + * Ecrit au format mascaret 1d et 2d. + * @author Emmanuel MARTIN + * @version $Id:$ + */ +public class MascaretWriter extends FileWriteOperationAbstract { + + /** Le flux de sorti. */ + private Writer out_; + /** Les profils \xE0 \xE9crire. */ + private MascaretProfilAbstractRepresentation[] profils_; + /** Version du fichier mascaret de destination. */ + private String version_; + + /** + * Cette classe permet \xE0 l'exporteur de selectionner les + * profils \xE0 exporter. G\xE9n\xE9ralement les profiles invalides sont ignor\xE9s. + * @author Emmanuel MARTIN + * @version $Id:$ + */ + public interface FunctorSelectProfil { + public boolean exportProfil(GISZoneCollectionLigneBrisee _zone, int _idxProfil); + } + + public MascaretWriter() {} + + /** + * L'argument doit \xEAtre un tableau contenant : + * 0 : string : le nom du bief + * 1 : GISZoneCollectionLigneBrisee[] : les zones dans lesquelles trouver les g\xE9om\xE9tries + * 2 : FunctorSelectProfil : pour selectionner les profils \xE0 exporter + * 3 : string : la version du fichier mascaret g\xE9n\xE9r\xE9 + * + * On passe en param\xE8tre les diff\xE9rentes GISZoneCollectionLigneBrisee qui + * contiennent les g\xE9om\xE9tries n\xE9c\xE9ssaires \xE0 l'exportation. Ces zone peuvent + * contenir des g\xE9om\xE9tries incompatible avec l'export (comme des polygones), + * elles seront simplement ignor\xE9es. Dans le cas o\xF9 des g\xE9om\xE9tries manqueront, + * une exception du type MascaretDataIncomplete est lev\xE9e. Les profils invalides + * sont \xE9galements ignor\xE9s. Si certaines donn\xE9es sont incoh\xE9rentes une exception + * du type MascaretDataError est lev\xE9e. La version du fichier de destination ('1d' + * ou '2d'). Si un des trois param\xE8tres est null une exception de type + * {@link IllegalArgumentException} est lev\xE9e, si version n'est pas soit '1d' + * soit '2d' (case ignor\xE9e) la m\xEAme exception est lev\xE9e. + */ + @Override + protected void internalWrite(Object _o) { + try { + if(((Object[])_o).length!=4) + throw new IllegalArgumentException("Il doit y avoir 4 param\xE8tres dans _o."); + String nomBief=(String)((Object[])_o)[0]; + GISZoneCollectionLigneBrisee[] zones=(GISZoneCollectionLigneBrisee[])((Object[])_o)[1]; + FunctorSelectProfil selectorProfil=(FunctorSelectProfil)((Object[])_o)[2]; + version_=(String)((Object[])_o)[3]; + if (nomBief==null) + throw new IllegalArgumentException("nomBief ne doit pas \xEAtre null"); + if (zones==null) + throw new IllegalArgumentException("zones mustn't be null"); + if (version_==null||!version_.equalsIgnoreCase("1d")&&!version_.equalsIgnoreCase("2d")) + throw new IllegalArgumentException("version doit \xEAtre \xE9gale \xE0 1d ou 2d"); + generateMascaretProfilAbstractRepresentations(nomBief, zones, selectorProfil); + + for (int i=0; i<profils_.length; i++) { + MascaretProfilAbstractRepresentation profil=profils_[i]; + // Premi\xE8re ligne + out_.write("Profil "+profil.nomBief+" "+profil.nomProfil+" "+profil.abscisseCurvilingeAxeHydraulique); + if (version_.equals("1d")) + out_.write('\n'); + else { + out_.write(' '); + for (int j=0; j<profil.coordXYTraceProfil.size(); j++) { + out_.write(profil.coordXYTraceProfil.get(j)[0]+" "); + out_.write(profil.coordXYTraceProfil.get(j)[1]+" "); + } + out_.write("AXE "+profil.coordIntersectionAxeHydraulique[0]+" "+profil.coordIntersectionAxeHydraulique[1]); + out_.write('\n'); + } + // Les autres lignes + for (int j=0; j<profil.coordXYProfil.size(); j++) { + out_.write(profil.coordCurviligneProfil.get(j)+" "+profil.coordZ.get(j)+" "+profil.bathyOuTopoOuStockage.get(j)); + if (version_.equals("1d")) + out_.write('\n'); + else + out_.write(" "+profil.coordXYProfil.get(j)[0]+" "+profil.coordXYProfil.get(j)[1]+"\n"); + } + } + } + catch (Exception _exp) { + analyze_.manageException(_exp); + } + } + + @Override + protected FortranInterface getFortranInterface() { + return new FortranInterface() { + public void close() throws IOException { + if (out_ != null) { + out_.close(); + } + } + }; + } + + @Override + public void setFile(File _f) { + analyze_ = new CtuluAnalyze(); + analyze_.setResource(_f.getAbsolutePath()); + FileWriter out = null; + try { + out = new FileWriter(_f); + } catch (final IOException _e) { + analyze_.manageException(_e); + } + if (out != null) { + out_ = out; + } + } + + /** + * G\xE9n\xE8re les repr\xE9sentatino interm\xE9diaires des profils. + * @param zones_ + * @throws MascaretDataError + * @throws MascaretDataIncomplete + */ + private void generateMascaretProfilAbstractRepresentations(String _nomBief, GISZoneCollectionLigneBrisee[] _zones, FunctorSelectProfil _selectorProfil) throws MascaretDataError, MascaretDataIncomplete{ + // Recherche de l'axe hydraulique \\ + GISZoneCollectionLigneBrisee zoneAxeHydraulique=null; + int indexAxeHydraulique=-1; + for (int i=0; i<_zones.length; i++) { + int idxAttNature=_zones[i].getIndiceOf(GISAttributeConstants.NATURE); + if (idxAttNature!=-1) + for (int j=0; j<_zones[i].getNbGeometries(); j++) + if (_zones[i].getValue(idxAttNature, j)==GISAttributeConstants.ATT_NATURE_AH) + if (zoneAxeHydraulique==null) { + zoneAxeHydraulique=_zones[i]; + indexAxeHydraulique=j; + } + else + throw new MascaretDataError("Il existe plusieurs axes hydrauliques."); + } + if(zoneAxeHydraulique==null) + throw new MascaretDataIncomplete("Il n'y a pas d'axes hydrauliques."); + + // Recherche des profils \\ + List<GISZoneCollectionLigneBrisee> profils=new ArrayList<GISZoneCollectionLigneBrisee>(); + List<Integer> indexProfils=new ArrayList<Integer>(); + for (int i=0; i<_zones.length; i++) { + int idxAttNature=_zones[i].getIndiceOf(GISAttributeConstants.NATURE); + if (idxAttNature!=-1) + for (int j=0; j<_zones[i].getNbGeometries(); j++) + if (_zones[i].getValue(idxAttNature, j)==GISAttributeConstants.ATT_NATURE_PF&&_selectorProfil.exportProfil(_zones[i], i)) { + profils.add(_zones[i]); + indexProfils.add(j); + } + } + + // G\xE9n\xE9ration des MascaretProfilAbstractRepresentations \\ + profils_=new MascaretProfilAbstractRepresentation[profils.size()]; + int countNoName=1; + GISPolyligne axeHydraulique=(GISPolyligne)zoneAxeHydraulique.getGeometry(indexAxeHydraulique); + for (int i=0;i<profils.size();i++) { + GISZoneCollectionLigneBrisee zoneProfil=profils.get(i); + int idxProfil=indexProfils.get(i); + GISPolyligne profil=(GISPolyligne) zoneProfil.getGeometry(idxProfil); + MascaretProfilAbstractRepresentation profilAbs=new MascaretProfilAbstractRepresentation(); + + // Information globales sur le profil \\ + // Nom bief + if(_nomBief.contains(" ")) + throw new MascaretDataError("Le nom du bief ne doit pas contenir d'espace."); + profilAbs.nomBief=_nomBief; + // Nom profil + int idxTitle=zoneProfil.getIndiceOf(GISAttributeConstants.TITRE); + if(idxTitle!=-1){ + String nomProfil=(String) zoneProfil.getValue(idxTitle, idxProfil); + if(nomProfil.contains(" ")) + throw new MascaretDataError("Le nom du profil ne doit pas contenir d'espace."); + profilAbs.nomProfil=nomProfil; + } + else + profilAbs.nomProfil="No_Name_"+countNoName++; + // Intersection axe hydraulique + Geometry intersection=axeHydraulique.intersection(profil); + if(intersection.getNumPoints()!=1) + throw new MascaretDataError("Un profil \xE0 plusieurs ou aucun point(s) d'intersection(s) avec l'axe hydraulique."); + profilAbs.coordIntersectionAxeHydraulique=new double[]{intersection.getCoordinate().x, intersection.getCoordinate().y}; + // Abscisse curviligne axe hydraulique + CoordinateSequence coordSeq=axeHydraulique.getCoordinateSequence(); + profilAbs.abscisseCurvilingeAxeHydraulique=absCurv(coordSeq, intersection.getCoordinate()); + // Trace profil + coordSeq=profil.getCoordinateSequence(); + profilAbs.coordXYTraceProfil.add(new double[]{coordSeq.getX(0), coordSeq.getY(0)}); + profilAbs.coordXYTraceProfil.add(new double[]{coordSeq.getX(coordSeq.size()-1), coordSeq.getY(coordSeq.size()-1)}); + + // Information atomiques sur le profil \\ + coordSeq=profil.getCoordinateSequence(); + int idxZ=zoneProfil.getIndiceOf(zoneProfil.getAttributeIsZ()); + for(int j=0;j<profil.getNumPoints();j++){ + // Valeur curviligne + profilAbs.coordCurviligneProfil.add(absCurv(coordSeq, j)); + // Coordonn\xE9es X Y + profilAbs.coordXYProfil.add(new double[]{coordSeq.getCoordinate(j).x, coordSeq.getCoordinate(j).y}); + // Coordinate Z + if(idxZ!=-1) + profilAbs.coordZ.add(((GISAttributeModelDoubleInterface)zoneProfil.getValue(idxZ, idxProfil)).getValue(j)); + } + // Extraction des valeurs d'intersection + ArrayList<Integer> seps=new ArrayList<Integer>(); + //INTERSECTION_RIVE_GAUCHE + int idxInterRiveG=zoneProfil.getIndiceOf(GISAttributeConstants.INTERSECTION_RIVE_GAUCHE); + Coordinate intersectionRiveGauche; + Integer idxRG=-1; + if(idxInterRiveG!=-1) { + intersectionRiveGauche=(Coordinate) zoneProfil.getValue(idxInterRiveG, idxProfil); + idxRG=idxIntersection(coordSeq, intersectionRiveGauche); + seps.add(idxRG); + } + //INTERSECTION_RIVE_DROITE + int idxInterRiveD=zoneProfil.getIndiceOf(GISAttributeConstants.INTERSECTION_RIVE_DROITE); + Coordinate intersectionRiveDroite; + Integer idxRD=-1; + if(idxInterRiveD!=-1) { + intersectionRiveDroite=(Coordinate) zoneProfil.getValue(idxInterRiveD, idxProfil); + idxRD=idxIntersection(coordSeq, intersectionRiveDroite); + seps.add(idxRD); + } + //INTERSECTION_LIMITE_STOCKAGE_GAUCHE + int idxInterStockageG=zoneProfil.getIndiceOf(GISAttributeConstants.INTERSECTION_LIMITE_STOCKAGE_GAUCHE); + Coordinate intersectionStockageGauche; + Integer idxSG=-1; + if(idxInterStockageG!=-1) { + intersectionStockageGauche=(Coordinate) zoneProfil.getValue(idxInterStockageG, idxProfil); + idxSG=idxIntersection(coordSeq, intersectionStockageGauche); + seps.add(idxSG); + } + //INTERSECTION_LIMITE_STOCKAGE_DROITE + int idxInterStockageD=zoneProfil.getIndiceOf(GISAttributeConstants.INTERSECTION_LIMITE_STOCKAGE_DROITE); + Coordinate intersectionStockageDroit; + Integer idxSD=-1; + if(idxInterStockageD!=-1) { + intersectionStockageDroit=(Coordinate) zoneProfil.getValue(idxInterStockageD, idxProfil); + idxSD=idxIntersection(coordSeq, intersectionStockageDroit); + seps.add(idxSD); + } + if(idxRG==-1&&idxRD!=-1||idxRG!=-1&&idxRD==-1) + throw new MascaretDataIncomplete("Il y a une seule rive (il doit y en avoir soit 0 soit 2)"); + if(idxSG==-1&&idxSD!=-1||idxSG!=-1&&idxSD==-1) + throw new MascaretDataIncomplete("Il y a une seule limite de stockage (il doit y en avoir soit 0 soit 2)"); + Integer[] sepsT=seps.toArray(new Integer[0]); + Arrays.sort(sepsT); + // Bathy Topo ou Stockage + if(sepsT.length==4){ + int j; + for(j=0;j<sepsT[0];j++) + profilAbs.bathyOuTopoOuStockage.add('S'); + for(;j<sepsT[1];j++) + profilAbs.bathyOuTopoOuStockage.add('T'); + for(;j<sepsT[2];j++) + profilAbs.bathyOuTopoOuStockage.add('B'); + for(;j<sepsT[3];j++) + profilAbs.bathyOuTopoOuStockage.add('T'); + for(;j<coordSeq.size();j++) + profilAbs.bathyOuTopoOuStockage.add('S'); + } + if(sepsT.length==2) { + if(sepsT[0]==idxRG||sepsT[0]==idxRD){ + int j; + for(j=0;j<sepsT[0];j++) + profilAbs.bathyOuTopoOuStockage.add('T'); + for(;j<sepsT[1];j++) + profilAbs.bathyOuTopoOuStockage.add('B'); + for(;j<coordSeq.size();j++) + profilAbs.bathyOuTopoOuStockage.add('T'); + } + else{ + int j; + for(j=0;j<sepsT[0];j++) + profilAbs.bathyOuTopoOuStockage.add('S'); + for(;j<sepsT[1];j++) + profilAbs.bathyOuTopoOuStockage.add('B'); + for(;j<coordSeq.size();j++) + profilAbs.bathyOuTopoOuStockage.add('S'); + } + } + else + for(int j=0;j<coordSeq.size();j++) + profilAbs.bathyOuTopoOuStockage.add('B'); + + // Verification de la coh\xE9rence des r\xE9sultats + if(version_.equals("1d")) + if(!profilAbs.check1D()) + throw new MascaretDataError("Erreur de programmation : les donn\xE9es g\xE9n\xE9r\xE9es ne sont pas coh\xE9rente pour le 1d."); + else + if(!profilAbs.check2D()) + throw new MascaretDataError("Erreur de programmation : les donn\xE9es g\xE9n\xE9r\xE9es ne sont pas coh\xE9rente pour le 2d."); + + // Stockage avec les autres \\ + profils_[i]=profilAbs; + } + } + + /** + * Calcul l'abscisse curviligne du point indiqu\xE9 en param\xE8tre + */ + private double absCurv(CoordinateSequence _coordSeq, Coordinate _point){ + int k=idxIntersection(_coordSeq, _point); + // Calcule de l'abscisse curviligne + double valueCurviligne=0; + for (int j=1; j<=k; j++) + valueCurviligne+=_coordSeq.getCoordinate(j).distance(_coordSeq.getCoordinate(j-1)); + // Mise \xE0 jour de l'abscisse curviligne + valueCurviligne+=_coordSeq.getCoordinate(k).distance(_point); + return valueCurviligne; + } + + /** + * Calcul l'abscisse curviligne du point indiqu\xE9 en param\xE8tre + */ + private double absCurv(CoordinateSequence _coordSeq, int _idxPoint){ + if(_idxPoint==0) + return 0; + double valueCurviligne=0; + for (int j=1; j<=_idxPoint; j++) + valueCurviligne+=_coordSeq.getCoordinate(j).distance(_coordSeq.getCoordinate(j-1)); + return valueCurviligne; + } + + /** + * Retourne l'indice pr\xE9c\xE9dent d'un point d'intersectin avec une geometrie. + */ + private int idxIntersection(CoordinateSequence _coordSeq, Coordinate _point){ + /* Recherche de l'index du dernier point de la polyligne \xE0 prendre en + * compte. */ + boolean fini=false; + int k=-1; + GISPoint point= new GISPoint(_point); + while (!fini&&++k<_coordSeq.size()-1) + fini=(GISGeometryFactory.INSTANCE + .createLineString(new Coordinate[]{_coordSeq.getCoordinate(k), _coordSeq.getCoordinate(k+1)})).intersects(point); + return k; + } +} Property changes on: branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/mascaret/io/MascaretWriter.java ___________________________________________________________________ Added: svn:keywords + Id Added: svn:mergeinfo + /branches/Br_FudaaModeleur_TF/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/DataGeometryListener.java:3445-3850 /branches/FudaaModeleur_TC1/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/DataGeometryListener.java:3861-3891 Added: svn:eol-style + native Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlProjectExportPanel.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlProjectExportPanel.java 2008-12-22 14:20:55 UTC (rev 4311) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlProjectExportPanel.java 2008-12-22 14:50:07 UTC (rev 4312) @@ -284,7 +284,7 @@ nbFiles++; } String name=CtuluLibFile.getSansExtension(f.getName()); - // Teste sur l'existance des fichier. Dans le cas d'un enregistrement en + // Test sur l'existence des fichier. Dans le cas d'un enregistrement en // rubar, il faut aussi tester avec les extensions .sem et .cn et aussi <nom>_autres.st if (CtuluLibFile.getExtension(f.getName()).equalsIgnoreCase("st")) { if ((new File(f.getParent()+File.separatorChar+name+".sem")).exists()) { Deleted: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/Controller1d.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/Controller1d.java 2008-12-22 14:20:55 UTC (rev 4311) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/Controller1d.java 2008-12-22 14:50:07 UTC (rev 4312) @@ -1,262 +0,0 @@ -/* - * @creation 9 d\xE9c. 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.modeleur1d; - -import java.awt.Color; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; - -import javax.swing.Action; -import javax.swing.JComponent; -import javax.swing.JDesktopPane; -import javax.swing.event.InternalFrameAdapter; -import javax.swing.event.InternalFrameEvent; -import javax.swing.event.ListSelectionEvent; -import javax.swing.event.ListSelectionListener; - -import org.fudaa.ctulu.CtuluCommandManager; -import org.fudaa.ctulu.CtuluListSelectionEvent; -import org.fudaa.ctulu.CtuluListSelectionListener; -import org.fudaa.ctulu.gis.GISAttributeConstants; -import org.fudaa.ctulu.gis.GISZoneCollectionLigneBrisee; -import org.fudaa.ebli.calque.BArbreCalqueModel; -import org.fudaa.ebli.calque.ZCalqueAffichageDonneesInterface; -import org.fudaa.ebli.calque.ZScene; -import org.fudaa.ebli.calque.ZSelectionEvent; -import org.fudaa.ebli.calque.ZSelectionListener; -import org.fudaa.ebli.calque.edition.ZModeleLigneBriseeEditable; -import org.fudaa.ebli.commun.EbliActionInterface; -import org.fudaa.ebli.commun.EbliFormatter; -import org.fudaa.ebli.commun.EbliFormatterInterface; -import org.fudaa.ebli.commun.EbliLib; -import org.fudaa.fudaa.commun.FudaaLib; -import org.fudaa.fudaa.modeleur.MdlImplementation; - -import com.memoire.bu.BuDesktop; -import com.memoire.bu.BuLabel; - -/** - * Cette classe a la charge et la responsabilit\xE9 de g\xE9rer toutes les actions, - * interactions et r\xE9actions de la fen\xEAtre 1d dans son ensemble. - * - * @author Emmanuel MARTIN - * @version $Id$ - */ -public class Controller1d extends InternalFrameAdapter implements ZSelectionListener, ListSelectionListener, CtuluListSelectionListener { - - /** La vue du bief. */ - private VueBief vueBief_; - /** La vue d'un profil par tableau. */ - private VueTableau vueTableau_; - /** La vue d'un profil via une courbe. */ - private VueCourbe vueCourbe_; - /** Un label pour afficher les erreurs. */ - private BuLabel vueError_; - /** Le lien avec le reste de l'application. */ - private MdlImplementation appli_; - /** La frame contenant tous les widgets 1d. */ - private MdlFille1d frame1d_; - /** Indique si on doit \xE9couter les \xE9venements de selection. */ - private boolean listenEventSelection_=true; - /** L'adapter des donn\xE9es de la geometry en cours de manipulation. */ - private DataGeometryAdapter dataGeomAdapter_; - /** Formater */ - private EbliFormatterInterface formater_=new EbliFormatter(); - /** Le commande manager pour le undo/redo */ - private CtuluCommandManager mng_; - - public Controller1d(MdlImplementation _appli, MdlFille1d _frame1d){ - if(_appli==null||_frame1d==null) - throw new IllegalArgumentException("Les param\xE8tres ne doivent pas \xEAtre null."); - appli_=_appli; - frame1d_=_frame1d; - frame1d_.addInternalFrameListener(this); - mng_=new CtuluCommandManager(); - vueBief_=new VueBief(appli_, this); - vueBief_.getScene().addSelectionListener(this); - treeModel_=vueBief_.getArbreCalqueModel(); - try { - dataGeomAdapter_=new DataGeometryAdapter(null, -1); - } - catch (DataGeometryException _exc) { - _exc.printStackTrace(); - } - vueTableau_=new VueTableau(this, dataGeomAdapter_); - vueTableau_.addSelectionListener(this); - vueCourbe_=new VueCourbe(this, dataGeomAdapter_); - vueCourbe_.addSelectionListener(this); - vueError_=new BuLabel(); - vueError_.setForeground(Color.RED); - clearError(); - } - - public VueBief getVueBief(){ - return vueBief_; - } - public VueTableau getVueTableau(){ - return vueTableau_; - } - public VueCourbe getVueCourbe(){ - return vueCourbe_; - } - public JComponent getVueError(){ - return vueError_; - } - - public EbliFormatterInterface getFormater(){ - return formater_; - } - - public CtuluCommandManager getCommandManager(){ - return mng_; - } - - // Gestion de l'affichage des erreurs. \\ - - public void showError(String _message){ - if(_message==null||_message.length()==0) - clearError(); - vueError_.setText(_message); - } - - public void clearError(){ - vueError_.setText(" "); - } - - // Gestion de l'arbre \\ - - /** Le model de l'arbre a afficher sur la droite de l'\xE9cran. */ - private BArbreCalqueModel treeModel_; - - /** Retourne le model de l'abre a afficher sur la droite de l'\xE9can. */ - public BArbreCalqueModel getTreeModel(){ - return treeModel_; - } - - /** - * Mise \xE0 jour de l'arbre des calques a chaque activation de la fen\xEAtre 1d. La - * mise \xE0 jour s'effectue en fonction des calques 2d. - */ - public void internalFrameActivated(InternalFrameEvent e) { - vueBief_.updateTree(); - } - - // Gestion des actions \\ - - /** Les action \xE0 la fen\xEAtre 1d. */ - JComponent[] specificTools_; - - /** - * Renvoie les actions sp\xE9cifiques \xE0 la fen\xEAtre 1d. Ils seront affiches dans la - * tool bar de l'application. - * - * @return specificTools_ - */ - public JComponent[] getToolsActions() { - if (specificTools_==null) { - final JDesktopPane j=frame1d_.getDesktopPane(); - BuDesktop buJ=null; - if (j instanceof BuDesktop) - buJ=(BuDesktop)j; - List<EbliActionInterface> actionAbs=vueBief_.getController().getActions(); - // Selection des actions - String[] tmpAction=new String[]{"RECTANGLE_SELECTION", "POLYGON_SELECTION", "RESTORE", "ZOOM", "ZOOM_ON_SELECTED", - "LAST_VIEW", "MOVE_VIEW", "CHANGE_REFERENCE", "NAVIGATE"}; - // info : Actions not kept : "CHOOSE_COLOR_PALET", "EDIT_LEGEND", "CONFIGURE", "INFOS", "TABLE" - HashSet<String> actionsKept=new HashSet<String>(); - for (int i=0; i<tmpAction.length; i++) - actionsKept.add(tmpAction[i]); - List<EbliActionInterface> actions=new ArrayList<EbliActionInterface>(); - for (int i=0; i<actionAbs.size(); i++) - if (actionAbs.get(i)==null) - actions.add(actionAbs.get(i)); - else if (actionsKept.contains(actionAbs.get(i).getValue(Action.ACTION_COMMAND_KEY))) - actions.add(actionAbs.get(i)); - // Construction des boutons - final List<?> l=EbliLib.updateToolButtons(actions, buJ); - specificTools_=new JComponent[l.size()]; - l.toArray(specificTools_); - } - if (specificTools_==null) - return null; - final JComponent[] r=new JComponent[specificTools_.length]; - System.arraycopy(specificTools_, 0, r, 0, r.length); - return r; - } - - // Gestion de la selection entre les trois widgets (tableau, bief et courbe) \\ - - /** - * Changement de la selection dans le widget de bief. - */ - public void selectionChanged(ZSelectionEvent _evt) { - clearError(); - ZScene scene=vueBief_.getScene(); - int sceneIdSelected=scene.getSelectionHelper().getUniqueSelectedIdx(); - boolean ok=true; // Indique si tout s'est bien pass\xE9. - if (sceneIdSelected==-1) - try {dataGeomAdapter_.setData(null, -1);} - catch (DataGeometryException _exc) {_exc.printStackTrace();} - else { - int idSelected=scene.sceneId2LayerId(sceneIdSelected); - // Extraction des diff\xE9rentes informations n\xE9c\xE9ssaires au changement de - // courbe \\ - ZCalqueAffichageDonneesInterface calque=scene.getLayerForId(sceneIdSelected); - if (calque.modeleDonnees() instanceof ZModeleLigneBriseeEditable) { - GISZoneCollectionLigneBrisee zone=((ZModeleLigneBriseeEditable)calque.modeleDonnees()).getGeomData(); - if (zone.getIndiceOf(GISAttributeConstants.NATURE)!=-1) { - if (zone.getValue(zone.getIndiceOf(GISAttributeConstants.NATURE), idSelected)==GISAttributeConstants.ATT_NATURE_PF) { - try { - dataGeomAdapter_.setData(zone, idSelected); - } - catch (DataGeometryException _exc) { - showError(_exc.getMessage()); - } - } - else - // On a pas selectionn\xE9 un profil, on annule la selection - ok=false; - } - else - // Il n'y a pas d'attribut Nature, on annule la selection - ok=false; - } - else - // Le type de model ne correspond pas, on annule la selection - ok=false; - } - if(!ok) { - //dataGeomAdapter_.setData(null, -1); - scene.clearSelection(); - showError(FudaaLib.getS("Seuls les profils sont selectionnables.")); - } - } - - /** - * Changement de la selection dans le widget du tableau. - */ - public void valueChanged(ListSelectionEvent e) { - if (listenEventSelection_) { - listenEventSelection_=false; - vueCourbe_.setSelection(vueTableau_.getSelection()); - listenEventSelection_=true; - } - } - - /** - * Changement de la selection dans le widget de la courbe. - */ - public void listeSelectionChanged(CtuluListSelectionEvent _e) { - if (listenEventSelection_) { - listenEventSelection_=false; - vueTableau_.setSelection(vueCourbe_.getSelection()); - listenEventSelection_=true; - } - } -} Deleted: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/DataGeometry.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/DataGeometry.java 2008-12-22 14:20:55 UTC (rev 4311) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/DataGeometry.java 2008-12-22 14:50:07 UTC (rev 4312) @@ -1,68 +0,0 @@ -/* - * @creation 10 d\xE9c. 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.modeleur1d; - -import org.fudaa.ctulu.CtuluCommandContainer; - -/** - * Une interface permettant d'acc\xE9der aux informations manipul\xE9es par les - * widgets tableau et courbe. - * - * @author Emmanuel MARTIN - * @version $Id$ - */ -public interface DataGeometry { - - /** Ajout d'un nouveau listener. */ - public void addDataGeometryListener(DataGeometryListener _listener); - - /** Supprime le listener. */ - public void removeDataGeometryListener(DataGeometryListener _listener); - - /** Retourne le nombre de points total de la geometry. */ - public int getNbPoint(); - - /** Retourne l'abcisse curviligne du point indiqu\xE9 en param\xE8tre. */ - public double getCurv(int _idxPoint); - - /** Retourne la valeur maximal de l'abcisse curviligne. */ - public double getCurvMax(); - - /** Retourne la valeur minimal de l'abcisse curvilgne. */ - public double getCurvMin(); - - /** Retourne la valeur de z du point indiqu\xE9 en param\xE8tre. */ - public double getZ(int _idxPoint); - - /** Retourne la valeur maximal de z. */ - public double getZMax(); - - /** Retourne la valeur minimal de z. */ - public double getZMin(); - - /** - * Enregistre l'abcisse curviligne du point indiqu\xE9 en param\xE8tre. - * Ce changement d'abscisse curviligne fonctionne sur tout les points. - * Si un points extr\xE9mit\xE9 est chang\xE9, le point 2D est d\xE9plac\xE9 sur son axe, - * la longueur globale n'est pas concerv\xE9e dans l'op\xE9ration. - * Si c'est un point de rupture le point 2D est d\xE9plac\xE9 de telle mani\xE8re - * que la longueur globale soit concerv\xE9e. - * Pour les autres points, le point 2D est d\xE9plac\xE9 sur son axe en concervant - * la longeur globale. - */ - public void setCurv(int _idxPoint, double _value, CtuluCommandContainer _cmd) throws DataGeometryException; - - /** Enregistre la valeur de z du point indiqu\xE9 en param\xE8tre. */ - public void setZ(int _idxPoint, double _value, CtuluCommandContainer _cmd); - - /** Enregistre l'abcisse curviligne et la valeur de z du point indiqu\xE9 en param\xE8tre. */ - public void setValues(int _idxPoint, double _valueCurv, double _valueZ, CtuluCommandContainer _cmd) throws DataGeometryException; - - /** Supprime le point indiqu\xE9 en param\xE8tre. */ - public void remove(int _idxPoint, CtuluCommandContainer _cmd) throws DataGeometryException; -} Deleted: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/DataGeometryAdapter.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/DataGeometryAdapter.java 2008-12-22 14:20:55 UTC (rev 4311) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/DataGeometryAdapter.java 2008-12-22 14:50:07 UTC (rev 4312) @@ -1,737 +0,0 @@ -/* - * @creation 10 d\xE9c. 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.modeleur1d; - -import java.util.ArrayList; -import java.util.List; - -import org.fudaa.ctulu.CtuluCommand; -import org.fudaa.ctulu.CtuluCommandComposite; -import org.fudaa.ctulu.CtuluCommandContainer; -import org.fudaa.ctulu.CtuluListSelection; -import org.fudaa.ctulu.CtuluNamedCommand; -import org.fudaa.ctulu.collection.CtuluCollection; -import org.fudaa.ctulu.gis.GISCoordinateSequenceContainerInterface; -import org.fudaa.ctulu.gis.GISGeometryFactory; -import org.fudaa.ctulu.gis.GISPolyligne; -import org.fudaa.ctulu.gis.GISZoneCollection; -import org.fudaa.ctulu.gis.GISZoneCollectionLigneBrisee; -import org.fudaa.fudaa.commun.FudaaLib; - -import com.vividsolutions.jts.geom.Coordinate; -import com.vividsolutions.jts.geom.CoordinateSequence; -import com.vividsolutions.jts.geom.Geometry; - -/** - * Cette classe permet d'adapter une GISZoneCollection en un model manipulable - * simplement. Cette simplification se fait en cachant toutes les informations - * inutils et en ajoutant une information d'abcisse curviligne. - * - * @author Emmanuel MARTIN - * @version $Id$ - */ -public class DataGeometryAdapter implements DataGeometry { - - /** - * Un command container pour le undo/redo. - * Fonctionnement : - * Deux \xE9l\xE9ments sont \xE0 prendre en compte lors du undo/redo : - * 1) Il peut \xEAtre n\xE9c\xE9ssaire de mettre a jour le z et/ou le curv. - * 2) Le undo/redo peut \xEAtre d\xE9clanch\xE9 alors que le DataGeometryAdapter g\xE9re actuellement une autre g\xE9om\xE9try. - * Pour g\xE9rer ces deux cas : - * 1) Deux booleans sont pris par le constructeur indiquant si il faut mettre \xE0 jour les valeurs de z et/ou de curv. - * 2) La zone et l'index de la g\xE9om\xE9trie g\xE9r\xE9 au moment de l'action sont m\xE9moris\xE9s pour g\xE9rer le cas 2. Dans le cas - * o\xF9 un autre g\xE9om\xE9trie est g\xE9r\xE9e au moment du undo/redo aucun update n'est d\xE9clanch\xE9. - * Ainsi m\xEAme si la g\xE9om\xE9trie selectionn\xE9 change plein de fois, revient sur la selection pr\xE9c\xE9dente etc...La mise \xE0 - * jour visuelle se fera correctement. - * Information suppl\xE9mentaire : pour fonctionner correctement le CtuluCommandContainer prit en param\xE8tre contenant - * le undo/redo ne doit pas d\xE9pendre de DataGeometryAdapter mais seulement de la zone. - */ - protected class DGCommandUndoRedo implements CtuluCommand, CtuluNamedCommand { - private CtuluCommand cmd_; - private boolean updateZ_; - private boolean updateCurv_; - private GISZoneCollectionLigneBrisee oldZone_; - private int oldIdxGeom_; - - public DGCommandUndoRedo(CtuluCommand _cmd, boolean _updateZ, boolean _updateCurv){ - cmd_=_cmd; - updateZ_=_updateZ; - updateCurv_=_updateCurv; - oldZone_=zone_; - oldIdxGeom_=idxGeom_; - } - - private void updateIfNeeded(){ - if(oldZone_==zone_&&oldIdxGeom_==idxGeom_) { - if(updateZ_) updateCacheZ(); - if(updateCurv_) updateCacheCurv(); - fireDataGeometryChanged(); - } - } - - public void redo() { - cmd_.redo(); - updateIfNeeded(); - } - - public void undo() { - cmd_.undo(); - updateIfNeeded(); - } - - public String getName() { - if(cmd_ instanceof CtuluNamedCommand) - return ((CtuluNamedCommand) cmd_).getName(); - else - return null; - } - } - - private GISZoneCollectionLigneBrisee zone_; - private int idxGeom_; - private CtuluCollection z_; - private List<Double> curv_; - // Caches \\ - int idxZMax_; - int idxZMin_; - // Le profil est potentiellement coup\xE9 en trois, les deux indices qui suivent - // indique l'index de chacune de ces ruptures. - int idxRupture1_; - int idxRupture2_; - - public DataGeometryAdapter(GISZoneCollectionLigneBrisee _zone, int _idxGeom) throws IllegalArgumentException, DataGeometryException { - setData(_zone, _idxGeom); - } - - /** - * Met \xE0 jour les valeurs zMin et zMax. - * Si z_ est null, zMin et zMax sont mises \xE0 -1. - */ - protected void updateCacheZ(){ - if(z_!=null) { - idxZMax_=0; - idxZMin_=0; - for (int i=1; i<z_.getSize(); i++) { - double val=(Double)z_.getObjectValueAt(i); - if (val>(Double)z_.getObjectValueAt(idxZMax_)) - idxZMax_=i; - else if (val<(Double)z_.getObjectValueAt(idxZMin_)) - idxZMin_=i; - } - } - else { - idxZMax_=-1; - idxZMin_=-1; - } - } - - /** - * Met \xE0 jour les valeurs curv_. - * Si curv_ ou zone_ sont null, rien n'est fait. - */ - protected void updateCacheCurv(){ - if(curv_!=null&&zone_!=null) { - CoordinateSequence seq=((GISCoordinateSequenceContainerInterface)zone_.getGeometry(idxGeom_)).getCoordinateSequence(); - curv_.clear(); - double curvPre=0; - curv_.add((double)0); - for (int i=1; i<seq.size(); i++) { - double partialCurv=Math.sqrt(Math.pow(seq.getX(i)-seq.getX(i-1), 2)+Math.pow(seq.getY(i)-seq.getY(i-1), 2)); - curvPre=curvPre+partialCurv; - curv_.add(curvPre); - } - } - } - - /** - * Permet de choisir la g\xE9om\xE9trie sur lequel l'instance va travailler. - * Hypoth\xE8se importante : les points de la g\xE9om\xE9tries sont correctement - * ordonn\xE9s (les points sont ordonn\xE9s en ordre croissant de leur abscisse - * curviligne). La veracit\xE9 de cette hypoth\xE8se n'est PAS v\xE9rifi\xE9 dans setData. - * - * @param _zone la zone contenant la g\xE9om\xE9trie - * @param _idxGeom l'indice de la g\xE9om\xE9trie dans _zone - * @throws DataGeometryException - */ - public void setData(GISZoneCollectionLigneBrisee _zone, int _idxGeom) throws IllegalArgumentException, DataGeometryException { - if (_zone==null&&_idxGeom==-1) { - zone_=null; - idxGeom_=-1; - z_=null; - curv_=null; - } - else if (_zone!=null&&_idxGeom>=0&&_idxGeom<_zone.getNbGeometries()&&_zone.getAttributeIsZ()!=null) { - try { - zone_=_zone; - idxGeom_=_idxGeom; - z_=(CtuluCollection)zone_.getValue(zone_.getIndiceOf(zone_.getAttributeIsZ()), idxGeom_); - curv_=new ArrayList<Double>(); - CoordinateSequence seq=((GISCoordinateSequenceContainerInterface)zone_.getGeometry(idxGeom_)).getCoordinateSequence(); - // Verifie qu'on a bien au minimum deux points. \\ - if (seq.size()<2) - throw new DataGeometryException(FudaaLib.getS("Le profil doit avoir au minimum deux points.")); - // Verifie que deux points cons\xE9cutifs ne sont pas confondus. \\ - for (int i=1; i<seq.size(); i++) - if (seq.getX(i-1)==seq.getX(i)&&seq.getY(i-1)==seq.getY(i)) - throw new DataGeometryException(FudaaLib.getS("Au moins deux points dans le profil sont confondus.")); - // Calcul des acbscisses curvilignes => hypoth\xE8se d'ordonnancement correcte des points \\ - updateCacheCurv(); - // Remplissage du cache Z \\ - updateCacheZ(); - - // Verifie que le profil donn\xE9 ne poss\xE8de pas des axes qui se coupent entre eux \\ - for(int i=1;i<seq.size();i++){ - Geometry mainAxe=GISGeometryFactory.INSTANCE.createLineString(new Coordinate[]{seq.getCoordinate(i-1), seq.getCoordinate(i)}); - boolean ok=true; - // Un seul point d'intersection avec l'axe qui suit - if(i+1<seq.size()&&mainAxe.intersectio... [truncated message content] |
From: <bma...@us...> - 2008-12-22 14:21:02
|
Revision: 4311 http://fudaa.svn.sourceforge.net/fudaa/?rev=4311&view=rev Author: bmarchan Date: 2008-12-22 14:20:55 +0000 (Mon, 22 Dec 2008) Log Message: ----------- BugFix#125 : Traceback lors de l'ouverture d'une bd si la fenetre 2D est iconifi?\195?\169e Modified Paths: -------------- branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/com/memoire/bu/BuDesktop.java Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/com/memoire/bu/BuDesktop.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/com/memoire/bu/BuDesktop.java 2008-12-19 12:13:30 UTC (rev 4310) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/com/memoire/bu/BuDesktop.java 2008-12-22 14:20:55 UTC (rev 4311) @@ -417,18 +417,27 @@ // Filles + /** + * Ajoute une fenetre interne. Lors de l'ajout, la fenetre est rendue visible, positionn\xE9e devant les autres, et devient active. + * @param _f La fenetre interne a ajouter. + */ public void addInternalFrame(JInternalFrame _f) { if (!SwingUtilities.isEventDispatchThread()) throw new RuntimeException("Not in swing thread. " + "Use Implementation.addInternalFrame() instead"); - // System.err.println(_f.getName()+":"+_f.getDesktopPane()); - + // B.M. : On prend garde que l'\xE9tat de la fenetre (qui peut \xEAtre une ancienne frame supprim\xE9e puis ajout\xE9e a nouveau) + // soit bien reinitialis\xE9. Sinon, risque de traceback. if (_f.getDesktopPane() == null) { if (_f.isSelected()) { try { _f.setSelected(false); } catch (PropertyVetoException ex) {} } + if (_f.isIcon()) { + try { + _f.setIcon(false); + } catch (PropertyVetoException ex) {} + } Point pf = _f.getLocation(); if ((pf.x == 0) && (pf.y == 0)) { @@ -469,6 +478,10 @@ adjustSize(); } + /** + * Indique au desktop qu'il y a eu un changement de position/taille de l'internal frame. Ceci lui permet de r\xE9ajuster sa taille. + * @param _f L'internal frame concern\xE9e par le changement de taille/position. + */ public void checkInternalFrame(JInternalFrame _f) { if (!SwingUtilities.isEventDispatchThread()) throw new RuntimeException("Not in swing thread."); @@ -494,6 +507,11 @@ adjustSize(); } + /** + * Active une fenetre interne. Lors de l'activation, la fenetre est rendue visible, positionn\xE9e devant les autres, et + * d\xE9siconifi\xE9e. + * @param _f La fenetre interne a activer. + */ public void activateInternalFrame(JInternalFrame _f) { if (!SwingUtilities.isEventDispatchThread()) throw new RuntimeException("Not in swing thread. " + "Use Implementation.activateInternalFrame() instead"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bma...@us...> - 2008-12-19 12:22:23
|
Revision: 4309 http://fudaa.svn.sourceforge.net/fudaa/?rev=4309&view=rev Author: bmarchan Date: 2008-12-19 11:34:55 +0000 (Fri, 19 Dec 2008) Log Message: ----------- Ticket#129 : Un calque cr?\195?\169?\195?\169 a un nom unique pour l'utilisateur. Modified Paths: -------------- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/BGroupeCalque.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/action/CalqueNewCalqueAction.java Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/BGroupeCalque.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/BGroupeCalque.java 2008-12-18 16:15:31 UTC (rev 4308) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/BGroupeCalque.java 2008-12-19 11:34:55 UTC (rev 4309) @@ -171,7 +171,14 @@ * BCalqueAffichage) ((BCalqueAffichage)c[i]).setRapide(b); if(!isValid()) repaint(); } */ + /** + * Recherche un nom unique sous la forme _pref+"_"+_idx parmis les fils du calque parent. + * @param _pref le prefix pour le nom + * @param _parent le calque parent + * @return Le nom unique du style _pref+"_"+indice. + */ public static String findUniqueChildName(final BCalque _parent, final String _pref) { + // FIXME BM : Propriete layer.child.id get mais child.id put !!! Pas de correspondance possible. Integer idxSt = (Integer) _parent.getClientProperty("layer.child.id"); if (idxSt == null) { idxSt = new Integer(0); @@ -190,19 +197,21 @@ } /** - * @param _pref le prefix + * Construit un nom de calque sous la forme _pref+"_"+_idx + * @param _pref le prefix xxxx * @param _idx l'identifiant - * @return _pref+"_"+_idx + * @return Le nom du calque */ - public static String buildName(final String _pref, final int _idx) { + private static String buildName(final String _pref, final int _idx) { return _pref + '_' + _idx; } /** - * @param _cqName le nom de la forme "toto_"+idx + * Retourne l'indice idx pour un nom de calque de la forme "xxxx_"+idx + * @param _cqName le nom du calque * @return -1 si forme incorrect. Sinon, l'indice */ - public static int getIdx(final String _cqName) { + private static int getIdx(final String _cqName) { final int idxTmp = _cqName.lastIndexOf('_'); if (idxTmp < 0) { return -1; @@ -215,39 +224,47 @@ } /** - * @param _pref le prefix du nouveau nom + * Recherche un nom unique sous la forme _pref+"_"+_idx parmis les fils du calque parent. + * @param _pref le prefix pour le nom * @param _parent le calque parent - * @return l'identifiant unique du style _pref+"_"+entier + * @param _idx L'indice initial + * @return Le nom unique du style _pref+"_"+indice. Si le nom pass\xE9 est unique, il est retourn\xE9 + * tel quel. Sinon, un nouvel indice est choisit. */ private static String findUniqueName(final String _pref, final BCalque _parent, final int _idx) { final BCalque[] cqs = _parent.getCalques(); - final String defaultName = _pref + '_' + CtuluLibString.getString(_idx); + final String defaultName=buildName(_pref, _idx); +// final String defaultName = _pref + '_' + CtuluLibString.getString(_idx); + + // Aucun calque trouv\xE9 avec ce nom. if (cqs == null || cqs.length == 0) { return defaultName; } - final String[] name = new String[cqs.length]; - final int nb = name.length; + final String[] cqNames = new String[cqs.length]; + final int nb = cqNames.length; boolean found = false; for (int i = 0; i < nb; i++) { - name[i] = cqs[i].getName(); - if (defaultName.equals(name[i])) { + cqNames[i] = cqs[i].getName(); + if (defaultName.equals(cqNames[i])) { found = true; } } if (!found) { return defaultName; } + + // Un calque a \xE9t\xE9 trouv\xE9 avec ce nom => On en definit un nouveau avec un indice diff\xE9rent. int lastIdx = 0; String r = null; - Arrays.sort(name); + Arrays.sort(cqNames); for (int i = 0; i < nb && (r == null); i++) { - lastIdx = BGroupeCalque.getIdx(name[i]); + lastIdx = BGroupeCalque.getIdx(cqNames[i]); if (FuLog.isTrace()) { FuLog.trace("TRL: test for i=" + i); } if (lastIdx > i) { r = BGroupeCalque.buildName(_pref, i); - if (Arrays.binarySearch(name, r) >= 0) { + if (Arrays.binarySearch(cqNames, r) >= 0) { r = null; } } else { @@ -260,7 +277,7 @@ } r = BGroupeCalque.buildName(_pref, lastIdx + 1); } - if (Arrays.binarySearch(name, r) >= 0) { + if (Arrays.binarySearch(cqNames, r) >= 0) { throw new IllegalArgumentException("cant find unique name " + r); } if (FuLog.isTrace()) { @@ -270,6 +287,25 @@ } /** + * Retourne un titre de calque qui n'existe pas d\xE9j\xE0 parmis les fils du groupe de calques. + * @param _rootTitle La racine du titre. + * @return Le titre, sous la forme _title+" "+num + */ + public String findUniqueChildTitle(String _rootTitle) { + BCalque[] cqs=this.getCalques(); + int num=0; + for (BCalque cq : cqs) { + if (cq.getTitle().startsWith(_rootTitle)) { + try { + num=Math.max(num,Integer.parseInt(cq.getTitle().substring(_rootTitle.length()).trim())); + } + catch (NumberFormatException _exc) {} + } + } + return _rootTitle+" "+(num+1); + } + + /** * On force le mode visible dependant des sous calques, car les calques sont des components. * Les components fils ne sont affich\xE9s que si les components parents sont visibles. */ 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-12-18 16:15:31 UTC (rev 4308) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlVisuPanel.java 2008-12-19 11:34:55 UTC (rev 4309) @@ -273,7 +273,7 @@ BGroupeCalque cqBief=new BGroupeCalque(); cqBief.setTitleModifiable(true); String name=BGroupeCalque.findUniqueChildName(cqBiefs_); - cqBief.setTitle(MdlResource.MDL.getString("Bief")); + cqBief.setTitle(cqBiefs_.findUniqueChildTitle(MdlResource.MDL.getString("Bief"))); cqBief.setName(name); cqBief.putClientProperty(Action.SHORT_DESCRIPTION, TrResource.getS("Un bief")); cqBief.setDestructible(true); Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/action/CalqueNewCalqueAction.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/action/CalqueNewCalqueAction.java 2008-12-18 16:15:31 UTC (rev 4308) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/action/CalqueNewCalqueAction.java 2008-12-19 11:34:55 UTC (rev 4309) @@ -31,14 +31,14 @@ /** Une op\xE9ration de construction d'un nouveau calque */ class OperationForLayerCreation implements CtuluNamedCommand { - private final BCalque parent_; + private final BGroupeCalque parent_; private final ZCalqueAffichageDonnees la_; /** * @param _parent le calque parent * @param _la le calque ajout\xE9 */ - OperationForLayerCreation(BCalque _parent, ZCalqueAffichageDonnees _la) { + OperationForLayerCreation(BGroupeCalque _parent, ZCalqueAffichageDonnees _la) { parent_ = _parent; la_ = _la; } @@ -57,7 +57,7 @@ } FSigEditor editor_; - BCalque parent_; + BGroupeCalque parent_; int cqType_; /** @@ -68,7 +68,7 @@ * @param _parent Le calque parent dans lequel sera cr\xE9\xE9 le calque. * @param _editor L'\xE9diteur. */ - public CalqueNewCalqueAction(String _title, Icon _icon, int _cqType, BCalque _parent, FSigEditor _editor) { + public CalqueNewCalqueAction(String _title, Icon _icon, int _cqType, BGroupeCalque _parent, FSigEditor _editor) { super(_title, _icon, "CREER"); editor_=_editor; parent_=_parent; @@ -78,6 +78,7 @@ public void actionPerformed(final ActionEvent _e) { ZCalqueAffichageDonnees cq=MdlLayerFactory.getInstance().createLayer(cqType_, editor_); cq.setName(BGroupeCalque.findUniqueChildName(parent_, ((MdlLayerInterface)cq).getExtName())); + cq.setTitle(parent_.findUniqueChildTitle(cq.getTitle())); CtuluCommand cmd=new OperationForLayerCreation(parent_,cq); cmd.redo(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bma...@us...> - 2008-12-19 12:13:39
|
Revision: 4310 http://fudaa.svn.sourceforge.net/fudaa/?rev=4310&view=rev Author: bmarchan Date: 2008-12-19 12:13:30 +0000 (Fri, 19 Dec 2008) Log Message: ----------- BugFix#131 : Export de plusieurs calques s?\195?\169lectionn?\195?\169s (la s?\195?\169lection multicalques ne fonctionnait plus). Modified Paths: -------------- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlProjectExportPanel.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/action/CalqueDeleteCalqueAction.java Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlProjectExportPanel.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlProjectExportPanel.java 2008-12-19 11:34:55 UTC (rev 4309) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlProjectExportPanel.java 2008-12-19 12:13:30 UTC (rev 4310) @@ -169,7 +169,7 @@ // rbAllLayers_.addActionListener(rbListener); add(rbAllLayers_); - rbSelectedLayers_=new BuRadioButton("Exporter depuis les calques s\xE9lectionn\xE9s"); + rbSelectedLayers_=new BuRadioButton("Exporter les calques s\xE9lectionn\xE9s (et leurs sous-calques)"); // rbSelectedLayers_.addActionListener(rbListener); add(rbSelectedLayers_); 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-12-19 11:34:55 UTC (rev 4309) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlVisuPanel.java 2008-12-19 12:13:30 UTC (rev 4310) @@ -64,7 +64,7 @@ */ public MdlVisuPanel(FudaaCommonImplementation _impl/*, boolean _createDefault*/) { super(_impl); - modelArbre_.setSelectionMultiCalques(false); + initCalques(true); installLayerActions(); getScene().setRestrictedToCalqueActif(false); Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/action/CalqueDeleteCalqueAction.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/action/CalqueDeleteCalqueAction.java 2008-12-19 11:34:55 UTC (rev 4309) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/action/CalqueDeleteCalqueAction.java 2008-12-19 12:13:30 UTC (rev 4310) @@ -86,7 +86,7 @@ } if (treeModel_.getSelection().length>1) { - editor_.getUi().error("Destruction non autoris\xE9e","La destruction n'est pas autoris\xE9e sur plusieurs calques.", false); + editor_.getUi().error("Destruction non autoris\xE9e","La destruction simultan\xE9e de plusieurs calques n'est pas autoris\xE9e.", false); return; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fa...@us...> - 2008-12-18 16:15:39
|
Revision: 4308 http://fudaa.svn.sourceforge.net/fudaa/?rev=4308&view=rev Author: fargeix Date: 2008-12-18 16:15:31 +0000 (Thu, 18 Dec 2008) Log Message: ----------- Corrections diverses de Fudaa-Albe, notamment pour le rendre compatible avec les syst?\195?\168mes d'exploitation Linux. Modified Paths: -------------- trunk/fudaa_devel/fudaa/src/org/fudaa/fudaa/albe/AlbeDeplacementReactionResultats.java trunk/fudaa_devel/fudaa/src/org/fudaa/fudaa/albe/AlbeFilleNoteDeCalculs.java trunk/fudaa_devel/fudaa/src/org/fudaa/fudaa/albe/AlbeFilleResultatsCombinaison.java trunk/fudaa_devel/fudaa/src/org/fudaa/fudaa/albe/AlbeImplementation.java trunk/fudaa_devel/fudaa/src/org/fudaa/fudaa/albe/AlbeLib.java trunk/fudaa_devel/fudaa/src/org/fudaa/fudaa/albe/AlbeMobilisationDefenseResultats.java trunk/fudaa_devel/fudaa/src/org/fudaa/fudaa/albe/AlbeRecapitulatifResultats.java trunk/fudaa_devel/fudaa/src/org/fudaa/fudaa/albe/AlbeRes.java trunk/fudaa_devel/fudaa/src/org/fudaa/fudaa/albe/AlbeResistancePieuResultats.java trunk/fudaa_devel/fudaa/src/org/fudaa/fudaa/albe/AlbeResultatsRecapitulatifsBrowserFrame.java trunk/fudaa_devel/fudaa/src/org/fudaa/fudaa/albe/WHtmlContent.java trunk/fudaa_devel/fudaa/src/org/fudaa/fudaa/albe/astuces.txt trunk/fudaa_devel/fudaa-distrib/albe/izpack/Unix_shortcutSpec.xml trunk/fudaa_devel/fudaa-distrib/albe/izpack/izpack_fudaa_albe.xml Modified: trunk/fudaa_devel/fudaa/src/org/fudaa/fudaa/albe/AlbeDeplacementReactionResultats.java =================================================================== --- trunk/fudaa_devel/fudaa/src/org/fudaa/fudaa/albe/AlbeDeplacementReactionResultats.java 2008-12-18 11:23:04 UTC (rev 4307) +++ trunk/fudaa_devel/fudaa/src/org/fudaa/fudaa/albe/AlbeDeplacementReactionResultats.java 2008-12-18 16:15:31 UTC (rev 4308) @@ -145,16 +145,16 @@ String html = ""; html += "<table border=\"2\" cellspacing=\"0\" cellpadding=\"5\">" + CtuluLibString.LINE_SEP; - html += "<th></th><th bgcolor=\"#DDDDDD\">Valeur calcul\xE9e</th><th bgcolor=\"#DDDDDD\">Valeur maximale</th><th bgcolor=\"#DDDDDD\">Facteur de dimensionnement</th>"; + html += "<th></th><th bgcolor=\"#DDDDDD\">Valeur calculée</th><th bgcolor=\"#DDDDDD\">Valeur maximale</th><th bgcolor=\"#DDDDDD\">Facteur de dimensionnement</th>"; html += "<tr align=center>" + CtuluLibString.LINE_SEP; - html += "<th bgcolor=\"#DDDDDD\">D\xE9placement en t\xEAte</th>" + CtuluLibString.LINE_SEP; + html += "<th bgcolor=\"#DDDDDD\">Déplacement en tête</th>" + CtuluLibString.LINE_SEP; html += "<td>" + deplacementTeteVal_.getText() + "</td>" + CtuluLibString.LINE_SEP; html += "<td>" + deplacementTetemax_.getText() + "</td>" + CtuluLibString.LINE_SEP; html += "<td>" + deplacementTeteDim_.getText() + "</td>" + CtuluLibString.LINE_SEP; html += "</tr>" + CtuluLibString.LINE_SEP; if (fp_.accostage_){ html += "<tr align=center>" + CtuluLibString.LINE_SEP; - html += "<th bgcolor=\"#DDDDDD\">R\xE9action au choc</th>" + CtuluLibString.LINE_SEP; + html += "<th bgcolor=\"#DDDDDD\">Réaction au choc</th>" + CtuluLibString.LINE_SEP; html += "<td>" + reactionChocVal_.getText() + "</td>" + CtuluLibString.LINE_SEP; html += "<td>" + reactionChocMax_.getText() + "</td>" + CtuluLibString.LINE_SEP; html += "<td>" + reactionChocDim_.getText() + "</td>" + CtuluLibString.LINE_SEP; Modified: trunk/fudaa_devel/fudaa/src/org/fudaa/fudaa/albe/AlbeFilleNoteDeCalculs.java =================================================================== --- trunk/fudaa_devel/fudaa/src/org/fudaa/fudaa/albe/AlbeFilleNoteDeCalculs.java 2008-12-18 11:23:04 UTC (rev 4307) +++ trunk/fudaa_devel/fudaa/src/org/fudaa/fudaa/albe/AlbeFilleNoteDeCalculs.java 2008-12-18 16:15:31 UTC (rev 4308) @@ -210,12 +210,12 @@ (new File(AlbeLib.NOTE_DE_CALCULS_HTML_FILE + "files")).mkdirs(); } if (isChoosen("PRESENTATION")) { - p = new HtmlPartie("PRESENTATION", "Pr\xE9sentation", 1, WHtmlContent.createContentFor( + p = new HtmlPartie("PRESENTATION", "Présentation", 1, WHtmlContent.createContentFor( "PRESENTATION", this, project_, locSttings)); doc.addPartie(p); } if (isChoosen("RAPPELHYPOTHESES")) { - p = new HtmlPartie("RAPPELHYPOTHESES", "Rappel des hypoth\xE8ses", 1, WHtmlContent + p = new HtmlPartie("RAPPELHYPOTHESES", "Rappel des hypothèses", 1, WHtmlContent .createContentFor("RAPPELHYPOTHESES", this, project_, locSttings)); if (isChoosen("RAPPELHYPOTHESES_OUVRAGE")) { sp = new HtmlPartie("RAPPELHYPOTHESES_OUVRAGE", "Ouvrage", 2, WHtmlContent @@ -238,20 +238,20 @@ WHtmlContent.createContentFor("RAPPELHYPOTHESES_COEFFPARTIELS", this, project_, locSttings)); if (isChoosen("RAPPELHYPOTHESES_COEFFPARTIELS_MATERIAUXETSOL")) { - ssp = new HtmlPartie("RAPPELHYPOTHESES_COEFFPARTIELS_MATERIAUXETSOL", "Mat\xE9riaux et sol", + ssp = new HtmlPartie("RAPPELHYPOTHESES_COEFFPARTIELS_MATERIAUXETSOL", "Matériaux et sol", 3, WHtmlContent.createContentFor("RAPPELHYPOTHESES_COEFFPARTIELS_MATERIAUXETSOL", this, project_, locSttings)); sp.addSousPartie(ssp); } if (isChoosen("RAPPELHYPOTHESES_COEFFPARTIELS_MODELE")) { - ssp = new HtmlPartie("RAPPELHYPOTHESES_COEFFPARTIELS_MODELE", "Coefficients de mod\xE8le", + ssp = new HtmlPartie("RAPPELHYPOTHESES_COEFFPARTIELS_MODELE", "Coefficients de modèle", 3, WHtmlContent.createContentFor("RAPPELHYPOTHESES_COEFFPARTIELS_MODELE", this, project_, locSttings)); sp.addSousPartie(ssp); } if (isChoosen("RAPPELHYPOTHESES_COEFFPARTIELS_CRITERESDIM")) { ssp = new HtmlPartie("RAPPELHYPOTHESES_COEFFPARTIELS_CRITERESDIM", - "Crit\xE8res de dimensionnement", 3, WHtmlContent.createContentFor( + "Critères de dimensionnement", 3, WHtmlContent.createContentFor( "RAPPELHYPOTHESES_COEFFPARTIELS_CRITERESDIM", this, project_, locSttings)); sp.addSousPartie(ssp); } @@ -266,10 +266,10 @@ doc.addPartie(p); } if (isChoosen("RESULTATS")) { - p = new HtmlPartie("RESULTATS", "R\xE9sultats des calculs", 1, WHtmlContent.createContentFor( + p = new HtmlPartie("RESULTATS", "Résultats des calculs", 1, WHtmlContent.createContentFor( "RESULTATS", this, project_, locSttings)); if (isChoosen("RESULTATS_TABLEAUXRECAPITULATIFS")) { - sp = new HtmlPartie("RESULTATS_TABLEAUXRECAPITULATIFS", "Tableaux r\xE9capitulatifs", 2, + sp = new HtmlPartie("RESULTATS_TABLEAUXRECAPITULATIFS", "Tableaux récapitulatifs", 2, WHtmlContent.createContentFor("RESULTATS_TABLEAUXRECAPITULATIFS", this, project_, locSttings)); p.addSousPartie(sp); @@ -279,13 +279,13 @@ // Si lancement manuel if (isChoosen("COMBINAISONMANUELLE")) { - sp = new HtmlPartie("RESULTATS_DETAILLES_COMBIMANUELLE", "R\xE9sultats d\xE9taill\xE9s", 2, + sp = new HtmlPartie("RESULTATS_DETAILLES_COMBIMANUELLE", "Résultats détaillés", 2, WHtmlContent.createContentResultatsDetailles("RESULTATS_DETAILLES_COMBIMANUELLE", this, project_, locSttings)); } // Si lancement automatique else { - sp = new HtmlPartie("RESULTATS_DETAILLES", "R\xE9sultats d\xE9taill\xE9s", 2, WHtmlContent + sp = new HtmlPartie("RESULTATS_DETAILLES", "Résultats détaillés", 2, WHtmlContent .createContentFor("RESULTATS_DETAILLES", this, project_, locSttings)); // R\xE9sultats ELU fondamental @@ -320,7 +320,7 @@ // R\xE9sultats ELS fr\xE9quent for (int i = 1; i <= 8; i++) { if (isChoosen("RESULTATS_DETAILLES_ELSFREQ" + i)) { - ssp = new HtmlPartie("RESULTATS_DETAILLES_ELSFREQ" + i, "ELS fr\xE9quent : combinaison " + ssp = new HtmlPartie("RESULTATS_DETAILLES_ELSFREQ" + i, "ELS fréquent : combinaison " + i, 3, WHtmlContent.createContentResultatsDetailles( "RESULTATS_DETAILLES_ELSFREQ" + i, this, project_, locSttings)); sp.addSousPartie(ssp); @@ -423,7 +423,7 @@ } } String end = ""; - end += "<br><i>g\xE9n\xE9r\xE9e par le logiciel <b>" + AlbeImplementation.SOFTWARE_TITLE + "</b></i>" + end += "<br><i>générée par le logiciel <b>" + AlbeImplementation.SOFTWARE_TITLE + "</b></i>" + CtuluLibString.LINE_SEP; end += "</body>" + CtuluLibString.LINE_SEP + ""; end += "</html>" + CtuluLibString.LINE_SEP + ""; Modified: trunk/fudaa_devel/fudaa/src/org/fudaa/fudaa/albe/AlbeFilleResultatsCombinaison.java =================================================================== --- trunk/fudaa_devel/fudaa/src/org/fudaa/fudaa/albe/AlbeFilleResultatsCombinaison.java 2008-12-18 11:23:04 UTC (rev 4307) +++ trunk/fudaa_devel/fudaa/src/org/fudaa/fudaa/albe/AlbeFilleResultatsCombinaison.java 2008-12-18 16:15:31 UTC (rev 4308) @@ -223,16 +223,16 @@ int i = 1; String html = ""; html += "<html>" + CtuluLibString.LINE_SEP + ""; - html += "<head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\"><title>R\xE9sultats combinaison " + html += "<head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\"><title>Résultats combinaison " + (typeCombi_ == AlbeLib.COMBINAISON_MANUELLE ? "manuelle" : (numCombi_ + " " + AlbeRes .getCombinaison(typeCombi_))) + "</title></head>" + CtuluLibString.LINE_SEP + ""; html += "<body>" + CtuluLibString.LINE_SEP + ""; html += "<hr>" + CtuluLibString.LINE_SEP; - html += "<CENTER><h1><FONT COLOR = \"#FF0000\">R\xE9sultats</FONT></h1></CENTER>" + html += "<CENTER><h1><FONT COLOR = \"#FF0000\">Résultats</FONT></h1></CENTER>" + CtuluLibString.LINE_SEP + ""; html += "<hr>" + CtuluLibString.LINE_SEP; // Ligne 'Information' - html += "<br><p>Cette page pr\xE9sente le d\xE9tail des r\xE9sultats du logiciel <b><i>" + html += "<br><p>Cette page présente le détail des résultats du logiciel <b><i>" + AlbeImplementation.SOFTWARE_TITLE + "</i></b> pour la combinaison " + (typeCombi_ == AlbeLib.COMBINAISON_MANUELLE ? "manuelle" @@ -241,49 +241,49 @@ // Sommaire html += "<ul type = none>" + CtuluLibString.LINE_SEP; html += "<br><h2><FONT COLOR = \"#3333CC\"> Sommaire</FONT></h2>" + CtuluLibString.LINE_SEP; - html += "<a href = \"#recapitulatif\">" + (i++) + ". R\xE9capitulatif des r\xE9sultats</a><br>" + html += "<a href = \"#recapitulatif\">" + (i++) + ". Récapitulatif des résultats</a><br>" + CtuluLibString.LINE_SEP; - html += "<a href = \"#resistance_pieu\">" + (i++) + ". R\xE9sistance du pieu</a><br>" + html += "<a href = \"#resistance_pieu\">" + (i++) + ". Résistance du pieu</a><br>" + CtuluLibString.LINE_SEP; - html += "<a href = \"#mobilisation_butee\">" + (i++) + ". Mobilisation de la but\xE9e</a><br>" + html += "<a href = \"#mobilisation_butee\">" + (i++) + ". Mobilisation de la butée</a><br>" + CtuluLibString.LINE_SEP; if (presenceDefense_) html += "<a href = \"#mobilisation_defense\">" + (i++) - + ". Mobilisation de la d\xE9fense</a><br>" + CtuluLibString.LINE_SEP; - html += "<a href = \"#deplacement_reaction\">" + (i++) + ". D\xE9placement et r\xE9action</a><br>" + + ". Mobilisation de la défense</a><br>" + CtuluLibString.LINE_SEP; + html += "<a href = \"#deplacement_reaction\">" + (i++) + ". Déplacement et réaction</a><br>" + CtuluLibString.LINE_SEP; i = 1; // R\xE9capitulatif des r\xE9sultats html += "<br><br><h2><FONT COLOR = \"#3333CC\"><li><a name =recapitulatif>" + (i++) - + ". R\xE9capitulatif des r\xE9sultats</a></FONT></h2>" + CtuluLibString.LINE_SEP; + + ". Récapitulatif des résultats</a></FONT></h2>" + CtuluLibString.LINE_SEP; html += recap_.buildPartieHtml(); // R\xE9sistance du pieu html += "<h2><FONT COLOR = \"#3333CC\"><li><a name =resistance_pieu>" + (i++) - + ". R\xE9sistance du pieu</a></FONT></h2>" + CtuluLibString.LINE_SEP; + + ". Résistance du pieu</a></FONT></h2>" + CtuluLibString.LINE_SEP; html += resistance_.buildPartieHtml(); // Mobilisation de la but\xE9e html += "<h2><FONT COLOR = \"#3333CC\"><li><a name =mobilisation_butee>" + (i++) - + ". Mobilisation de la but\xE9e</a></FONT></h2>" + CtuluLibString.LINE_SEP; + + ". Mobilisation de la butée</a></FONT></h2>" + CtuluLibString.LINE_SEP; html += butee_.buildPartieHtml(); // Mobilisation de la d\xE9fense if (presenceDefense_) { html += "<h2><FONT COLOR = \"#3333CC\"><li><a name =mobilisation_defense>" + (i++) - + ". Mobilisation de la d\xE9fense</a></FONT></h2>" + CtuluLibString.LINE_SEP; + + ". Mobilisation de la défense</a></FONT></h2>" + CtuluLibString.LINE_SEP; html += defense_.buildPartieHtml(); } // D\xE9placements et r\xE9action html += "<h2><FONT COLOR = \"#3333CC\"><li><a name =deplacement_reaction>" + (i++) - + ". D\xE9placement et r\xE9action</a></FONT></h2>" + CtuluLibString.LINE_SEP; + + ". Déplacement et réaction</a></FONT></h2>" + CtuluLibString.LINE_SEP; html += deplacement_.buildPartieHtml(); html += "</ul>" + CtuluLibString.LINE_SEP; - html += "<br><br><i>g\xE9n\xE9r\xE9 par le logiciel <b>" + AlbeImplementation.SOFTWARE_TITLE + html += "<br><br><i>généré par le logiciel <b>" + AlbeImplementation.SOFTWARE_TITLE + "</b></i>" + CtuluLibString.LINE_SEP; html += "</body>" + CtuluLibString.LINE_SEP + ""; html += "</html>" + CtuluLibString.LINE_SEP + ""; Modified: trunk/fudaa_devel/fudaa/src/org/fudaa/fudaa/albe/AlbeImplementation.java =================================================================== --- trunk/fudaa_devel/fudaa/src/org/fudaa/fudaa/albe/AlbeImplementation.java 2008-12-18 11:23:04 UTC (rev 4307) +++ trunk/fudaa_devel/fudaa/src/org/fudaa/fudaa/albe/AlbeImplementation.java 2008-12-18 16:15:31 UTC (rev 4308) @@ -174,9 +174,9 @@ /** titre du logiciel */ isAlbe_.name = "Albe"; /** version courante du logiciel */ - isAlbe_.version = "1.1"; + isAlbe_.version = "1.1.1"; /** date de la version courante du logiciel */ - isAlbe_.date = "28/11/08"; + isAlbe_.date = "17/12/08"; /** informations sur le droits r\xE9serv\xE9s */ isAlbe_.rights = "CETMEF (c) 2003"; /** email du responsable du logiciel */ @@ -1366,13 +1366,13 @@ */ public boolean confirmExit() { - int res = AlbeLib.dialogAdvancedConfirmation(getApp(), "Fermeture du logiciel", + /* int res = AlbeLib.dialogAdvancedConfirmation(getApp(), "Fermeture du logiciel", "Voulez-vous vraiment quitter ce logiciel ?"); if (res == JOptionPane.YES_OPTION) - return true; +*/ return true; - return false; + // return false; } public boolean isCloseFrameMode() { Modified: trunk/fudaa_devel/fudaa/src/org/fudaa/fudaa/albe/AlbeLib.java =================================================================== --- trunk/fudaa_devel/fudaa/src/org/fudaa/fudaa/albe/AlbeLib.java 2008-12-18 11:23:04 UTC (rev 4307) +++ trunk/fudaa_devel/fudaa/src/org/fudaa/fudaa/albe/AlbeLib.java 2008-12-18 16:15:31 UTC (rev 4308) @@ -941,7 +941,7 @@ if (_fatalMsg.length > 0) { html += "<h2><font color = red>Erreurs bloquantes</font></h2>" + CtuluLibString.LINE_SEP + ""; html += "<table width=\"100%\" border=1>" + CtuluLibString.LINE_SEP + ""; - html += "<tr><td><b>Onglet</b></td><td><b>Donn\xE9es</b></td><td><b>Etat</b></td><td><b>Message</b></td></tr>" + html += "<tr><td><b>Onglet</b></td><td><b>Données</b></td><td><b>Etat</b></td><td><b>Message</b></td></tr>" + CtuluLibString.LINE_SEP + ""; for (i = 0; i < _fatalMsg.length; i++) { html += "<tr bgcolor=\"#" + (((i % 2) == 1) ? "DDDDDD" : "FFFFFF") + "\">" @@ -959,7 +959,7 @@ html += "<br><h2><font color = green>Avertissements</font></h2>" + CtuluLibString.LINE_SEP + ""; html += "<table width=\"100%\" border=1>" + CtuluLibString.LINE_SEP + ""; - html += "<tr><td><b>Onglet</b></td><td><b>Donn\xE9es</b></td><td><b>Etat</b></td><td><b>Message</b></td></tr>" + html += "<tr><td><b>Onglet</b></td><td><b>Données</b></td><td><b>Etat</b></td><td><b>Message</b></td></tr>" + CtuluLibString.LINE_SEP + ""; for (i = 0; i < _warningMsg.length; i++) { html += "<tr bgcolor=\"#" + (((i % 2) == 1) ? "DDDDDD" : "FFFFFF") + "\">" @@ -973,8 +973,8 @@ } html += "</table>" + CtuluLibString.LINE_SEP + ""; } - html += "<br><br><b>Remarques :</b><br>Les erreurs bloquantes vous emp\xEAchent de lancer les calculs, vous devez donc les corriger pour pouvoir continuer.<br>" - + " Les avertissements ne vous emp\xEAchent pas de lancer les calculs mais vous signalent d'une incoh\xE9rence de certaines donn\xE9es."; + html += "<br><br><b>Remarques :</b><br>Les erreurs bloquantes vous empêchent de lancer les calculs, vous devez donc les corriger pour pouvoir continuer.<br>" + + " Les avertissements ne vous emp\xEAchent pas de lancer les calculs mais vous signalent d'une incohérence de certaines données."; html += "</body>" + CtuluLibString.LINE_SEP + ""; html += "</html>" + CtuluLibString.LINE_SEP + ""; final AlbeImplementation _albe = (AlbeImplementation) _a.getImplementation(); Modified: trunk/fudaa_devel/fudaa/src/org/fudaa/fudaa/albe/AlbeMobilisationDefenseResultats.java =================================================================== --- trunk/fudaa_devel/fudaa/src/org/fudaa/fudaa/albe/AlbeMobilisationDefenseResultats.java 2008-12-18 11:23:04 UTC (rev 4307) +++ trunk/fudaa_devel/fudaa/src/org/fudaa/fudaa/albe/AlbeMobilisationDefenseResultats.java 2008-12-18 16:15:31 UTC (rev 4308) @@ -153,10 +153,10 @@ public String buildPartieHtml() { String html = ""; html += fp_.addImgFromScript(getScript(), "courbe_deflexion_reaction.gif", - "Courbe d\xE9flexion r\xE9action"); + "Courbe déflexion réaction"); html += "<br><br><ul type = square>" + CtuluLibString.LINE_SEP; - html += "<li>D\xE9flexion calcul\xE9e : " + fp_.deflexions_[0] + CtuluLibString.LINE_SEP; - html += "<li>D\xE9flexion admissible : " + fp_.deflexions_[1] + CtuluLibString.LINE_SEP; + html += "<li>Déflexion calculée : " + fp_.deflexions_[0] + CtuluLibString.LINE_SEP; + html += "<li>Déflexion admissible : " + fp_.deflexions_[1] + CtuluLibString.LINE_SEP; html += "<li>Facteur de dimensionnement : " + fp_.deflexions_[2] + CtuluLibString.LINE_SEP; html += "</ul><br>" + CtuluLibString.LINE_SEP; Modified: trunk/fudaa_devel/fudaa/src/org/fudaa/fudaa/albe/AlbeRecapitulatifResultats.java =================================================================== --- trunk/fudaa_devel/fudaa/src/org/fudaa/fudaa/albe/AlbeRecapitulatifResultats.java 2008-12-18 11:23:04 UTC (rev 4307) +++ trunk/fudaa_devel/fudaa/src/org/fudaa/fudaa/albe/AlbeRecapitulatifResultats.java 2008-12-18 16:15:31 UTC (rev 4308) @@ -441,10 +441,10 @@ html += "<ul>" + CtuluLibString.LINE_SEP; // Caract\xE9ristiques g\xE9om\xE9triques - html += "<li><b>Caract\xE9ristiques g\xE9om\xE9triques</b>" + CtuluLibString.LINE_SEP; + html += "<li><b>Caractéristiques géométriques</b>" + CtuluLibString.LINE_SEP; html += "<br><ul type = square>" + CtuluLibString.LINE_SEP; html += "<li>Cote de dragage : " + coteDragage_.getText() + CtuluLibString.LINE_SEP; - html += "<li>Cote de la t\xEAte de l'ouvrage : " + coteTete_.getText() + CtuluLibString.LINE_SEP; + html += "<li>Cote de la tête de l'ouvrage : " + coteTete_.getText() + CtuluLibString.LINE_SEP; html += "<li>Cote du choc : " + coteChoc_.getText() + CtuluLibString.LINE_SEP; html += "<li>Corrosion : " + corrosion_.getText() + CtuluLibString.LINE_SEP; html += "<li>" + (fp_.accostage_ ? "Energie d'accostage : " : "Effort d'amarrage : ") @@ -456,37 +456,37 @@ html += "<li>Coefficient sur sol : " + coefSol_.getText() + CtuluLibString.LINE_SEP; html += "<li>Coefficient sur acier : " + coefAcier_.getText() + CtuluLibString.LINE_SEP; if (fp_.presenceDefense_) - html += "<li>Coefficient sur d\xE9fense : " + coefDefense_.getText() + CtuluLibString.LINE_SEP; + html += "<li>Coefficient sur défense : " + coefDefense_.getText() + CtuluLibString.LINE_SEP; html += "</ul>" + CtuluLibString.LINE_SEP; // Facteurs de dimensionnement html += "<br><li><b>Facteurs de dimensionnement</b>" + CtuluLibString.LINE_SEP; html += "<br><br><table border=\"2\" cellspacing=\"0\" cellpadding=\"5\">" + CtuluLibString.LINE_SEP; html += "<th></th><th bgcolor=\"#DDDDDD\">Valeur maximale</th><th bgcolor=\"#DDDDDD\">Facteur de dimensionnement</th>"; html += "<tr align=center>" + CtuluLibString.LINE_SEP; - html += "<th bgcolor=\"#DDDDDD\">R\xE9sistance des tubes</th>" + CtuluLibString.LINE_SEP; + html += "<th bgcolor=\"#DDDDDD\">Résistance des tubes</th>" + CtuluLibString.LINE_SEP; html += "<td>" + coefModeleResistance_.getText() + "</td>" + CtuluLibString.LINE_SEP; html += "<td>" + coefModeleResistanceGamma_.getText() + "</td>" + CtuluLibString.LINE_SEP; html += "</tr>" + CtuluLibString.LINE_SEP; html += "<tr align=center>" + CtuluLibString.LINE_SEP; - html += "<th bgcolor=\"#DDDDDD\">Mobilisation de la but\xE9e du sol</th>" + CtuluLibString.LINE_SEP; + html += "<th bgcolor=\"#DDDDDD\">Mobilisation de la butée du sol</th>" + CtuluLibString.LINE_SEP; html += "<td>" + coefModeleMobilisation_.getText() + "</td>" + CtuluLibString.LINE_SEP; html += "<td>" + coefModeleMobilisationGamma_.getText() + "</td>" + CtuluLibString.LINE_SEP; html += "</tr>" + CtuluLibString.LINE_SEP; if (fp_.presenceDefense_) { html += "<tr align=center>" + CtuluLibString.LINE_SEP; - html += "<th bgcolor=\"#DDDDDD\">D\xE9flexion de la d\xE9fense</th>" + CtuluLibString.LINE_SEP; + html += "<th bgcolor=\"#DDDDDD\">Déflexion de la défense</th>" + CtuluLibString.LINE_SEP; html += "<td>" + deflexionMax_.getText() + "</td>" + CtuluLibString.LINE_SEP; html += "<td>" + deflexionMaxGamma_.getText() + "</td>" + CtuluLibString.LINE_SEP; html += "</tr>" + CtuluLibString.LINE_SEP; } html += "<tr align=center>" + CtuluLibString.LINE_SEP; - html += "<th bgcolor=\"#DDDDDD\">D\xE9placement en t\xEAte</th>" + CtuluLibString.LINE_SEP; + html += "<th bgcolor=\"#DDDDDD\">Déplacement en tête</th>" + CtuluLibString.LINE_SEP; html += "<td>" + deplacementMax_.getText() + "</td>" + CtuluLibString.LINE_SEP; html += "<td>" + deplacementMaxGamma_.getText() + "</td>" + CtuluLibString.LINE_SEP; html += "</tr>" + CtuluLibString.LINE_SEP; if (fp_.accostage_) { html += "<tr align=center>" + CtuluLibString.LINE_SEP; - html += "<th bgcolor=\"#DDDDDD\">R\xE9action au choc</th>" + CtuluLibString.LINE_SEP; + html += "<th bgcolor=\"#DDDDDD\">Réaction au choc</th>" + CtuluLibString.LINE_SEP; html += "<td>" + reactionMax_.getText() + "</td>" + CtuluLibString.LINE_SEP; html += "<td>" + reactionMaxGamma_.getText() + "</td>" + CtuluLibString.LINE_SEP; html += "</tr>" + CtuluLibString.LINE_SEP; @@ -497,7 +497,7 @@ html += "<br><ul type = square>" + CtuluLibString.LINE_SEP; html += "<li>Energie des modules : " + energieModules_.getText() + CtuluLibString.LINE_SEP; if (fp_.presenceDefense_) - html += "<li>Energie des d\xE9fenses : " + energieDefenses_.getText() + CtuluLibString.LINE_SEP; + html += "<li>Energie des défenses : " + energieDefenses_.getText() + CtuluLibString.LINE_SEP; html += "</ul></ul><br>" + CtuluLibString.LINE_SEP; return html; Modified: trunk/fudaa_devel/fudaa/src/org/fudaa/fudaa/albe/AlbeRes.java =================================================================== --- trunk/fudaa_devel/fudaa/src/org/fudaa/fudaa/albe/AlbeRes.java 2008-12-18 11:23:04 UTC (rev 4307) +++ trunk/fudaa_devel/fudaa/src/org/fudaa/fudaa/albe/AlbeRes.java 2008-12-18 16:15:31 UTC (rev 4308) @@ -421,7 +421,7 @@ break; } case AlbeLib.ELS_FREQ: { - s = "ELS fr\xE9quent"; + s = "ELS fréquent"; break; } } @@ -515,26 +515,26 @@ if (_typeCombi == AlbeLib.ELU_FONDA) html += "<th rowspan = \"2\">Action du<br>sol</th>" + CtuluLibString.LINE_SEP; if (_defense) - html += "<th rowspan = \"2\">R\xE9action<br>transmise<br>par la<br>d\xE9fense</th>" + html += "<th rowspan = \"2\">Réaction<br>transmise<br>par la<br>défense</th>" + CtuluLibString.LINE_SEP; html += "<th rowspan = \"2\">Corrosion<br>du tube</th>" + CtuluLibString.LINE_SEP; if (_typeCombi != AlbeLib.ELS_FREQ) - html += "<th colspan = \"" + nbTroncons + "\">Flexion des tron\xE7ons</th>" + html += "<th colspan = \"" + nbTroncons + "\">Flexion des tronçons</th>" + CtuluLibString.LINE_SEP; if (_typeCombi != AlbeLib.ELS_RARE) - html += "<th rowspan = \"2\">Mobilisation<br>de la but\xE9e<br>du sol</th>" + html += "<th rowspan = \"2\">Mobilisation<br>de la butée<br>du sol</th>" + CtuluLibString.LINE_SEP; if (_typeCombi == AlbeLib.ELS_RARE) - html += "<th colspan = \"2\">D\xE9placement<br>en t\xEAte</th>" + CtuluLibString.LINE_SEP; + html += "<th colspan = \"2\">Déplacement<br>en tête</th>" + CtuluLibString.LINE_SEP; if (_defense && _typeCombi != AlbeLib.ELS_FREQ) - html += "<th colspan = \"2\">D\xE9flexion<br>d\xE9fenses</th>" + CtuluLibString.LINE_SEP; + html += "<th colspan = \"2\">Déflexion<br>défenses</th>" + CtuluLibString.LINE_SEP; if (_accostage && (_typeCombi == AlbeLib.ELU_FONDA || _typeCombi == AlbeLib.ELU_ACC)) - html += "<th colspan = \"2\">Efforts<br>(r\xE9action)</th>" + CtuluLibString.LINE_SEP; + html += "<th colspan = \"2\">Efforts<br>(réaction)</th>" + CtuluLibString.LINE_SEP; html += "</tr>" + CtuluLibString.LINE_SEP; html += "<tr align = \"center\">"; if (_typeCombi != AlbeLib.ELS_FREQ) { for (int i = 1; i < nbTroncons + 1; i++) { - html += "<th>Tron\xE7on " + i + "</th>" + CtuluLibString.LINE_SEP; + html += "<th>Tronçon " + i + "</th>" + CtuluLibString.LINE_SEP; } } if (_typeCombi == AlbeLib.ELS_RARE) { @@ -573,46 +573,46 @@ html += "<td rowspan = \"8\">AC<br>bas</td>" + CtuluLibString.LINE_SEP; html += "<td rowspan = \"4\">favorable</td>" + CtuluLibString.LINE_SEP; html += "<td rowspan = \"2\">maximale</td>" + CtuluLibString.LINE_SEP; - html += "<td>corrod\xE9</td>" + CtuluLibString.LINE_SEP; + html += "<td>corrodé</td>" + CtuluLibString.LINE_SEP; html += afficheLigneRes(_params, _results, true, true, AlbeLib.ELU_FONDA, 0); html += "</tr>" + CtuluLibString.LINE_SEP; html += "<tr align = \"center\">" + CtuluLibString.LINE_SEP; html += "<th>2</th>"; - html += "<td>non corrod\xE9</td>" + CtuluLibString.LINE_SEP; + html += "<td>non corrodé</td>" + CtuluLibString.LINE_SEP; html += afficheLigneRes(_params, _results, true, true, AlbeLib.ELU_FONDA, 1); html += "</tr>" + CtuluLibString.LINE_SEP; html += "<tr align = \"center\">" + CtuluLibString.LINE_SEP; html += "<th>3</th>"; html += "<td rowspan = \"2\">minimale</td>" + CtuluLibString.LINE_SEP; - html += "<td>corrod\xE9</td>" + CtuluLibString.LINE_SEP; + html += "<td>corrodé</td>" + CtuluLibString.LINE_SEP; html += afficheLigneRes(_params, _results, true, true, AlbeLib.ELU_FONDA, 2); html += "</tr>" + CtuluLibString.LINE_SEP; html += "<tr align = \"center\">" + CtuluLibString.LINE_SEP; html += "<th>4</th>"; - html += "<td>non corrod\xE9</td>" + CtuluLibString.LINE_SEP; + html += "<td>non corrodé</td>" + CtuluLibString.LINE_SEP; html += afficheLigneRes(_params, _results, true, true, AlbeLib.ELU_FONDA, 3); html += "</tr>" + CtuluLibString.LINE_SEP; html += "<tr align = \"center\">" + CtuluLibString.LINE_SEP; html += "<th>5</th>"; - html += "<td rowspan = \"4\">d\xE9favorable</td>" + CtuluLibString.LINE_SEP; + html += "<td rowspan = \"4\">défavorable</td>" + CtuluLibString.LINE_SEP; html += "<td rowspan = \"2\">maximale</td>" + CtuluLibString.LINE_SEP; - html += "<td>corrod\xE9</td>" + CtuluLibString.LINE_SEP; + html += "<td>corrodé</td>" + CtuluLibString.LINE_SEP; html += afficheLigneRes(_params, _results, true, true, AlbeLib.ELU_FONDA, 4); html += "</tr>" + CtuluLibString.LINE_SEP; html += "<tr align = \"center\">" + CtuluLibString.LINE_SEP; html += "<th>6</th>"; - html += "<td>non corrod\xE9</td>" + CtuluLibString.LINE_SEP; + html += "<td>non corrodé</td>" + CtuluLibString.LINE_SEP; html += afficheLigneRes(_params, _results, true, true, AlbeLib.ELU_FONDA, 5); html += "</tr>" + CtuluLibString.LINE_SEP; html += "<tr align = \"center\">" + CtuluLibString.LINE_SEP; html += "<th>7</th>"; html += "<td rowspan = \"2\">minimale</td>" + CtuluLibString.LINE_SEP; - html += "<td>corrod\xE9</td>" + CtuluLibString.LINE_SEP; + html += "<td>corrodé</td>" + CtuluLibString.LINE_SEP; html += afficheLigneRes(_params, _results, true, true, AlbeLib.ELU_FONDA, 6); html += "</tr>" + CtuluLibString.LINE_SEP; html += "<tr align = \"center\">" + CtuluLibString.LINE_SEP; html += "<th>8</th>"; - html += "<td>non corrod\xE9</td>" + CtuluLibString.LINE_SEP; + html += "<td>non corrodé</td>" + CtuluLibString.LINE_SEP; html += afficheLigneRes(_params, _results, true, true, AlbeLib.ELU_FONDA, 7); html += "</tr>" + CtuluLibString.LINE_SEP; html += "<tr align = \"center\">" + CtuluLibString.LINE_SEP; @@ -620,46 +620,46 @@ html += "<td rowspan = \"8\">AC<br>haut</td>" + CtuluLibString.LINE_SEP; html += "<td rowspan = \"4\">favorable</td>" + CtuluLibString.LINE_SEP; html += "<td rowspan = \"2\">maximale</td>" + CtuluLibString.LINE_SEP; - html += "<td>corrod\xE9</td>" + CtuluLibString.LINE_SEP; + html += "<td>corrodé</td>" + CtuluLibString.LINE_SEP; html += afficheLigneRes(_params, _results, true, true, AlbeLib.ELU_FONDA, 8); html += "</tr>" + CtuluLibString.LINE_SEP; html += "<tr align = \"center\">" + CtuluLibString.LINE_SEP; html += "<th>10</th>"; - html += "<td>non corrod\xE9</td>" + CtuluLibString.LINE_SEP; + html += "<td>non corrodé</td>" + CtuluLibString.LINE_SEP; html += afficheLigneRes(_params, _results, true, true, AlbeLib.ELU_FONDA, 9); html += "</tr>" + CtuluLibString.LINE_SEP; html += "<tr align = \"center\">" + CtuluLibString.LINE_SEP; html += "<th>11</th>"; html += "<td rowspan = \"2\">minimale</td>" + CtuluLibString.LINE_SEP; - html += "<td>corrod\xE9</td>" + CtuluLibString.LINE_SEP; + html += "<td>corrodé</td>" + CtuluLibString.LINE_SEP; html += afficheLigneRes(_params, _results, true, true, AlbeLib.ELU_FONDA, 10); html += "</tr>" + CtuluLibString.LINE_SEP; html += "<tr align = \"center\">" + CtuluLibString.LINE_SEP; html += "<th>12</th>"; - html += "<td>non corrod\xE9</td>" + CtuluLibString.LINE_SEP; + html += "<td>non corrodé</td>" + CtuluLibString.LINE_SEP; html += afficheLigneRes(_params, _results, true, true, AlbeLib.ELU_FONDA, 11); html += "</tr>" + CtuluLibString.LINE_SEP; html += "<tr align = \"center\">" + CtuluLibString.LINE_SEP; html += "<th>13</th>"; - html += "<td rowspan = \"4\">d\xE9favorable</td>" + CtuluLibString.LINE_SEP; + html += "<td rowspan = \"4\">défavorable</td>" + CtuluLibString.LINE_SEP; html += "<td rowspan = \"2\">maximale</td>" + CtuluLibString.LINE_SEP; - html += "<td>corrod\xE9</td>" + CtuluLibString.LINE_SEP; + html += "<td>corrodé</td>" + CtuluLibString.LINE_SEP; html += afficheLigneRes(_params, _results, true, true, AlbeLib.ELU_FONDA, 12); html += "</tr>" + CtuluLibString.LINE_SEP; html += "<tr align = \"center\">" + CtuluLibString.LINE_SEP; html += "<th>14</th>"; - html += "<td>non corrod\xE9</td>" + CtuluLibString.LINE_SEP; + html += "<td>non corrodé</td>" + CtuluLibString.LINE_SEP; html += afficheLigneRes(_params, _results, true, true, AlbeLib.ELU_FONDA, 13); html += "</tr>" + CtuluLibString.LINE_SEP; html += "<tr align = \"center\">" + CtuluLibString.LINE_SEP; html += "<th>15</th>"; html += "<td rowspan = \"2\">minimale</td>" + CtuluLibString.LINE_SEP; - html += "<td>corrod\xE9</td>" + CtuluLibString.LINE_SEP; + html += "<td>corrodé</td>" + CtuluLibString.LINE_SEP; html += afficheLigneRes(_params, _results, true, true, AlbeLib.ELU_FONDA, 14); html += "</tr>" + CtuluLibString.LINE_SEP; html += "<tr align = \"center\">" + CtuluLibString.LINE_SEP; html += "<th>16</th>"; - html += "<td>non corrod\xE9</td>" + CtuluLibString.LINE_SEP; + html += "<td>non corrodé</td>" + CtuluLibString.LINE_SEP; html += afficheLigneRes(_params, _results, true, true, AlbeLib.ELU_FONDA, 15); html += "</tr>" + CtuluLibString.LINE_SEP; } else { @@ -667,46 +667,46 @@ html += "<th>1</th>"; html += "<td rowspan = \"4\">AC<br>bas</td>" + CtuluLibString.LINE_SEP; html += "<td rowspan = \"2\">favorable</td>" + CtuluLibString.LINE_SEP; - html += "<td>corrod\xE9</td>" + CtuluLibString.LINE_SEP; + html += "<td>corrodé</td>" + CtuluLibString.LINE_SEP; html += afficheLigneRes(_params, _results, true, false, AlbeLib.ELU_FONDA, 0); html += "</tr>" + CtuluLibString.LINE_SEP; html += "<tr align = \"center\">" + CtuluLibString.LINE_SEP; html += "<th>2</th>"; - html += "<td>non corrod\xE9</td>" + CtuluLibString.LINE_SEP; + html += "<td>non corrodé</td>" + CtuluLibString.LINE_SEP; html += afficheLigneRes(_params, _results, true, false, AlbeLib.ELU_FONDA, 1); html += "</tr>" + CtuluLibString.LINE_SEP; html += "<tr align = \"center\">" + CtuluLibString.LINE_SEP; html += "<th>3</th>"; - html += "<td rowspan = \"2\">d\xE9favorable</td>" + CtuluLibString.LINE_SEP; - html += "<td>corrod\xE9</td>" + CtuluLibString.LINE_SEP; + html += "<td rowspan = \"2\">défavorable</td>" + CtuluLibString.LINE_SEP; + html += "<td>corrodé</td>" + CtuluLibString.LINE_SEP; html += afficheLigneRes(_params, _results, true, false, AlbeLib.ELU_FONDA, 2); html += "</tr>" + CtuluLibString.LINE_SEP; html += "<tr align = \"center\">" + CtuluLibString.LINE_SEP; html += "<th>4</th>"; - html += "<td>non corrod\xE9</td>" + CtuluLibString.LINE_SEP; + html += "<td>non corrodé</td>" + CtuluLibString.LINE_SEP; html += afficheLigneRes(_params, _results, true, false, AlbeLib.ELU_FONDA, 3); html += "</tr>" + CtuluLibString.LINE_SEP; html += "<tr align = \"center\">" + CtuluLibString.LINE_SEP; html += "<th>5</th>"; html += "<td rowspan = \"4\">AC<br>haut</td>" + CtuluLibString.LINE_SEP; html += "<td rowspan = \"2\">favorable</td>" + CtuluLibString.LINE_SEP; - html += "<td>corrod\xE9</td>" + CtuluLibString.LINE_SEP; + html += "<td>corrodé</td>" + CtuluLibString.LINE_SEP; html += afficheLigneRes(_params, _results, true, false, AlbeLib.ELU_FONDA, 4); html += "</tr>" + CtuluLibString.LINE_SEP; html += "<tr align = \"center\">" + CtuluLibString.LINE_SEP; html += "<th>6</th>"; - html += "<td>non corrod\xE9</td>" + CtuluLibString.LINE_SEP; + html += "<td>non corrodé</td>" + CtuluLibString.LINE_SEP; html += afficheLigneRes(_params, _results, true, false, AlbeLib.ELU_FONDA, 5); html += "</tr>" + CtuluLibString.LINE_SEP; html += "<tr align = \"center\">" + CtuluLibString.LINE_SEP; html += "<th>7</th>"; - html += "<td rowspan = \"2\">d\xE9favorable</td>" + CtuluLibString.LINE_SEP; - html += "<td>corrod\xE9</td>" + CtuluLibString.LINE_SEP; + html += "<td rowspan = \"2\">défavorable</td>" + CtuluLibString.LINE_SEP; + html += "<td>corrodé</td>" + CtuluLibString.LINE_SEP; html += afficheLigneRes(_params, _results, true, false, AlbeLib.ELU_FONDA, 6); html += "</tr>" + CtuluLibString.LINE_SEP; html += "<tr align = \"center\">" + CtuluLibString.LINE_SEP; html += "<th>8</th>"; - html += "<td>non corrod\xE9</td>" + CtuluLibString.LINE_SEP; + html += "<td>non corrodé</td>" + CtuluLibString.LINE_SEP; html += afficheLigneRes(_params, _results, true, false, AlbeLib.ELU_FONDA, 7); html += "</tr>" + CtuluLibString.LINE_SEP; } @@ -716,23 +716,23 @@ html += "<tr align = \"center\">" + CtuluLibString.LINE_SEP; html += "<th>1</th>"; html += "<td rowspan = \"2\">favorable</td>" + CtuluLibString.LINE_SEP; - html += "<td>corrod\xE9</td>" + CtuluLibString.LINE_SEP; + html += "<td>corrodé</td>" + CtuluLibString.LINE_SEP; html += afficheLigneRes(_params, _results, false, false, AlbeLib.ELU_FONDA, 0); html += "</tr>" + CtuluLibString.LINE_SEP; html += "<tr align = \"center\">" + CtuluLibString.LINE_SEP; html += "<th>2</th>"; - html += "<td>non corrod\xE9</td>" + CtuluLibString.LINE_SEP; + html += "<td>non corrodé</td>" + CtuluLibString.LINE_SEP; html += afficheLigneRes(_params, _results, false, false, AlbeLib.ELU_FONDA, 1); html += "</tr>" + CtuluLibString.LINE_SEP; html += "<tr align = \"center\">" + CtuluLibString.LINE_SEP; html += "<th>3</th>"; - html += "<td rowspan = \"2\">d\xE9favorable</td>" + CtuluLibString.LINE_SEP; - html += "<td>corrod\xE9</td>" + CtuluLibString.LINE_SEP; + html += "<td rowspan = \"2\">défavorable</td>" + CtuluLibString.LINE_SEP; + html += "<td>corrodé</td>" + CtuluLibString.LINE_SEP; html += afficheLigneRes(_params, _results, false, false, AlbeLib.ELU_FONDA, 2); html += "</tr>" + CtuluLibString.LINE_SEP; html += "<tr align = \"center\">" + CtuluLibString.LINE_SEP; html += "<th>4</th>"; - html += "<td>non corrod\xE9</td>" + CtuluLibString.LINE_SEP; + html += "<td>non corrodé</td>" + CtuluLibString.LINE_SEP; html += afficheLigneRes(_params, _results, false, false, AlbeLib.ELU_FONDA, 3); html += "</tr>" + CtuluLibString.LINE_SEP; } @@ -757,81 +757,81 @@ html += "<th>1</th>"; html += "<td rowspan = \"4\">AC<br>bas</td>" + CtuluLibString.LINE_SEP; html += "<td rowspan = \"2\">maximale</td>" + CtuluLibString.LINE_SEP; - html += "<td>corrod\xE9</td>" + CtuluLibString.LINE_SEP; + html += "<td>corrodé</td>" + CtuluLibString.LINE_SEP; html += afficheLigneRes(_params, _results, true, true, _typeCombi, 0); html += "</tr>" + CtuluLibString.LINE_SEP; html += "<tr align = \"center\">" + CtuluLibString.LINE_SEP; html += "<th>2</th>"; - html += "<td>non corrod\xE9</td>" + CtuluLibString.LINE_SEP; + html += "<td>non corrodé</td>" + CtuluLibString.LINE_SEP; html += afficheLigneRes(_params, _results, true, true, _typeCombi, 1); html += "</tr>" + CtuluLibString.LINE_SEP; html += "<tr align = \"center\">" + CtuluLibString.LINE_SEP; html += "<th>3</th>"; html += "<td rowspan = \"2\">minimale</td>" + CtuluLibString.LINE_SEP; - html += "<td>corrod\xE9</td>" + CtuluLibString.LINE_SEP; + html += "<td>corrodé</td>" + CtuluLibString.LINE_SEP; html += afficheLigneRes(_params, _results, true, true, _typeCombi, 2); html += "</tr>" + CtuluLibString.LINE_SEP; html += "<tr align = \"center\">" + CtuluLibString.LINE_SEP; html += "<th>4</th>"; - html += "<td>non corrod\xE9</td>" + CtuluLibString.LINE_SEP; + html += "<td>non corrodé</td>" + CtuluLibString.LINE_SEP; html += afficheLigneRes(_params, _results, true, true, _typeCombi, 3); html += "</tr>" + CtuluLibString.LINE_SEP; html += "<tr align = \"center\">" + CtuluLibString.LINE_SEP; html += "<th>5</th>"; html += "<td rowspan = \"4\">AC<br>haut</td>" + CtuluLibString.LINE_SEP; html += "<td rowspan = \"2\">maximale</td>" + CtuluLibString.LINE_SEP; - html += "<td>corrod\xE9</td>" + CtuluLibString.LINE_SEP; + html += "<td>corrodé</td>" + CtuluLibString.LINE_SEP; html += afficheLigneRes(_params, _results, true, true, _typeCombi, 4); html += "</tr>" + CtuluLibString.LINE_SEP; html += "<tr align = \"center\">" + CtuluLibString.LINE_SEP; html += "<th>6</th>"; - html += "<td>non corrod\xE9</td>" + CtuluLibString.LINE_SEP; + html += "<td>non corrodé</td>" + CtuluLibString.LINE_SEP; html += afficheLigneRes(_params, _results, true, true, _typeCombi, 5); html += "</tr>" + CtuluLibString.LINE_SEP; html += "<tr align = \"center\">" + CtuluLibString.LINE_SEP; html += "<th>7</th>"; html += "<td rowspan = \"2\">minimale</td>" + CtuluLibString.LINE_SEP; - html += "<td>corrod\xE9</td>" + CtuluLibString.LINE_SEP; + html += "<td>corrodé</td>" + CtuluLibString.LINE_SEP; html += afficheLigneRes(_params, _results, true, true, _typeCombi, 6); html += "</tr>" + CtuluLibString.LINE_SEP; html += "<tr align = \"center\">" + CtuluLibString.LINE_SEP; html += "<th>8</th>"; - html += "<td>non corrod\xE9</td>" + CtuluLibString.LINE_SEP; + html += "<td>non corrodé</td>" + CtuluLibString.LINE_SEP; html += afficheLigneRes(_params, _results, true, true, _typeCombi, 7); html += "</tr>" + CtuluLibString.LINE_SEP; } else { html += "<tr align = \"center\">" + CtuluLibString.LINE_SEP; html += "<th>1</th>"; html += "<td rowspan = \"2\">AC<br>bas</td>" + CtuluLibString.LINE_SEP; - html += "<td>corrod\xE9</td>" + CtuluLibString.LINE_SEP; + html += "<td>corrodé</td>" + CtuluLibString.LINE_SEP; html += afficheLigneRes(_params, _results, true, false, _typeCombi, 0); html += "</tr>" + CtuluLibString.LINE_SEP; html += "<tr align = \"center\">" + CtuluLibString.LINE_SEP; html += "<th>2</th>"; - html += "<td>non corrod\xE9</td>" + CtuluLibString.LINE_SEP; + html += "<td>non corrodé</td>" + CtuluLibString.LINE_SEP; html += afficheLigneRes(_params, _results, true, false, _typeCombi, 1); html += "</tr>" + CtuluLibString.LINE_SEP; html += "<tr align = \"center\">" + CtuluLibString.LINE_SEP; html += "<th>3</th>"; html += "<td rowspan = \"2\">AC<br>haut</td>" + CtuluLibString.LINE_SEP; - html += "<td>corrod\xE9</td>" + CtuluLibString.LINE_SEP; + html += "<td>corrodé</td>" + CtuluLibString.LINE_SEP; html += afficheLigneRes(_params, _results, true, false, _typeCombi, 2); html += "</tr>" + CtuluLibString.LINE_SEP; html += "<tr align = \"center\">" + CtuluLibString.LINE_SEP; html += "<th>4</th>"; - html += "<td>non corrod\xE9</td>" + CtuluLibString.LINE_SEP; + html += "<td>non corrodé</td>" + CtuluLibString.LINE_SEP; html += afficheLigneRes(_params, _results, true, false, _typeCombi, 3); html += "</tr>" + CtuluLibString.LINE_SEP; } } else { html += "<tr align = \"center\">" + CtuluLibString.LINE_SEP; html += "<th>1</th>"; - html += "<td>corrod\xE9</td>" + CtuluLibString.LINE_SEP; + html += "<td>corrodé</td>" + CtuluLibString.LINE_SEP; html += afficheLigneRes(_params, _results, false, false, _typeCombi, 0); html += "</tr>" + CtuluLibString.LINE_SEP; html += "<tr align = \"center\">" + CtuluLibString.LINE_SEP; html += "<th>2</th>"; - html += "<td>non corrod\xE9</td>" + CtuluLibString.LINE_SEP; + html += "<td>non corrodé</td>" + CtuluLibString.LINE_SEP; html += afficheLigneRes(_params, _results, false, false, _typeCombi, 1); html += "</tr>" + CtuluLibString.LINE_SEP; } @@ -889,7 +889,7 @@ double[] flexions = getFlexionsPieu(_params, res, _typeCombi, corrosion); for (int i = 0; i < flexions.length; i++) { if (flexions[i] > limiteFlexion) - html += "<td>non sollicit\xE9</td>"; + html += "<td>non sollicité</td>"; else html += "<td><font color = " + (flexions[i] < 1 ? "red>" : "green>") + flexions[i] + "</font></td>"; @@ -938,7 +938,7 @@ double[] flexions = getFlexionsPieu(_params, res, _typeCombi, corrosion); for (int i = 0; i < flexions.length; i++) { if (flexions[i] > limiteFlexion) - html += "<td>non sollicit\xE9</td>"; + html += "<td>non sollicité</td>"; else html += "<td><font color = " + (flexions[i] < 1 ? "red>" : "green>") + flexions[i] + "</font></td>"; @@ -986,7 +986,7 @@ for (int i = 0; i < flexions.length; i++) { if (flexions[i] > limiteFlexion) - html += "<td>non sollicit\xE9</td>"; + html += "<td>non sollicité</td>"; else html += "<td><font color = " + (flexions[i] < 1 ? "red>" : "green>") + flexions[i] + "</font></td>"; @@ -1049,7 +1049,7 @@ break; } case AlbeLib.ELS_FREQ: { - FuLog.warning("Il n'existe pas de coefficient sur l'acier pour l'ELS fr\xE9quent."); + FuLog.warning("Il n'existe pas de coefficient sur l'acier pour l'ELS fréquent."); break; } case AlbeLib.COMBINAISON_MANUELLE: { @@ -1081,7 +1081,7 @@ } case AlbeLib.ELS_FREQ: { FuLog - .warning("Il n'existe pas de coefficient sur la r\xE9sistance structurale des pieux pour l'ELS fr\xE9quent."); + .warning("Il n'existe pas de coefficient sur la résistance structurale des pieux pour l'ELS fréquent."); break; } case AlbeLib.COMBINAISON_MANUELLE: { Modified: trunk/fudaa_devel/fudaa/src/org/fudaa/fudaa/albe/AlbeResistancePieuResultats.java =================================================================== --- trunk/fudaa_devel/fudaa/src/org/fudaa/fudaa/albe/AlbeResistancePieuResultats.java 2008-12-18 11:23:04 UTC (rev 4307) +++ trunk/fudaa_devel/fudaa/src/org/fudaa/fudaa/albe/AlbeResistancePieuResultats.java 2008-12-18 16:15:31 UTC (rev 4308) @@ -354,7 +354,7 @@ String html = ""; html += "<table border=\"2\" cellspacing=\"0\" cellpadding=\"5\">" + CtuluLibString.LINE_SEP; - html += "<th bgcolor=\"#DDDDDD\">Cote (m)</th><th bgcolor=\"#DDDDDD\">Fl\xE8che (cm)</th><th bgcolor=\"#DDDDDD\">Moment (kN.m)</th><th bgcolor=\"#DDDDDD\">Effort tranchant (kN)</th><th bgcolor=\"#DDDDDD\">Contrainte (MPa)</th>"; + html += "<th bgcolor=\"#DDDDDD\">Cote (m)</th><th bgcolor=\"#DDDDDD\">Flèche (cm)</th><th bgcolor=\"#DDDDDD\">Moment (kN.m)</th><th bgcolor=\"#DDDDDD\">Effort tranchant (kN)</th><th bgcolor=\"#DDDDDD\">Contrainte (MPa)</th>"; for (int i = 0; i < tbMoments_.getRowCount(); i++) { html += "<tr align=center>" + CtuluLibString.LINE_SEP; for (int j = 0; j < tbMoments_.getColumnCount(); j++) { @@ -364,7 +364,7 @@ } html += "</table><br><br>" + CtuluLibString.LINE_SEP; html += fp_.addImgFromScript(getScriptDeformee(), "courbe_deformee_ouvrage.gif", - "Courbe de la d\xE9form\xE9e de l'ouvrage"); + "Courbe de la déformée de l'ouvrage"); html += "<br><br>"; html += fp_.addImgFromScript(getScriptCourbeMoments(), "courbe_moments.gif", "Courbe des moments"); Modified: trunk/fudaa_devel/fudaa/src/org/fudaa/fudaa/albe/AlbeResultatsRecapitulatifsBrowserFrame.java =================================================================== --- trunk/fudaa_devel/fudaa/src/org/fudaa/fudaa/albe/AlbeResultatsRecapitulatifsBrowserFrame.java 2008-12-18 11:23:04 UTC (rev 4307) +++ trunk/fudaa_devel/fudaa/src/org/fudaa/fudaa/albe/AlbeResultatsRecapitulatifsBrowserFrame.java 2008-12-18 16:15:31 UTC (rev 4308) @@ -199,16 +199,16 @@ String html = ""; html += "<html>" + CtuluLibString.LINE_SEP + ""; html += "<head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\"><title>" - + AlbeRes.getCombinaison(typeCombi_) + " : r\xE9sultats r\xE9capitulatifs" + "</title></head>" + + AlbeRes.getCombinaison(typeCombi_) + " : résultats récapitulatifs" + "</title></head>" + CtuluLibString.LINE_SEP + ""; html += "<body>" + CtuluLibString.LINE_SEP + ""; html += "<hr>" + CtuluLibString.LINE_SEP; - html += "<CENTER><h2><FONT COLOR = \"#FF0000\">R\xE9sultats r\xE9capitulatifs pour l'" + html += "<CENTER><h2><FONT COLOR = \"#FF0000\">Résultats récapitulatifs pour l'" + AlbeRes.getCombinaison(typeCombi_) + "</FONT></h2></CENTER>" + CtuluLibString.LINE_SEP + ""; html += "<hr><br><br>" + CtuluLibString.LINE_SEP; html += AlbeRes.buildTabRecapResultats(params_, results_, accostage_, defense_, typeCombi_,true); - html += "<br><br><i>g\xE9n\xE9r\xE9 par le logiciel <b>" + AlbeImplementation.SOFTWARE_TITLE + html += "<br><br><i>généré par le logiciel <b>" + AlbeImplementation.SOFTWARE_TITLE + "</b></i>" + CtuluLibString.LINE_SEP; html += "</body>" + CtuluLibString.LINE_SEP + ""; html += "</html>" + CtuluLibString.LINE_SEP + ""; Modified: trunk/fudaa_devel/fudaa/src/org/fudaa/fudaa/albe/WHtmlContent.java =================================================================== --- trunk/fudaa_devel/fudaa/src/org/fudaa/fudaa/albe/WHtmlContent.java 2008-12-18 11:23:04 UTC (rev 4307) +++ trunk/fudaa_devel/fudaa/src/org/fudaa/fudaa/albe/WHtmlContent.java 2008-12-18 16:15:31 UTC (rev 4308) @@ -221,7 +221,7 @@ } protected void buildContent() { - html_ += "Cette note d\xE9crit les r\xE9sultats des calculs effectu\xE9s par le logiciel <i>Fudaa-" + html_ += "Cette note décrit les résultats des calculs effectués par le logiciel <i>Fudaa-" + AlbeImplementation.SOFTWARE_TITLE + "</i> (version " + AlbeImplementation.informationsSoftware().version + ").<br></p>" + CtuluLibString.LINE_SEP; @@ -245,18 +245,18 @@ if (auteur != AlbeLib.VAL_NULLE) html_ += "<li><b>Auteur : </b>" + auteur + "<br>" + CtuluLibString.LINE_SEP; if (dateCalculs != AlbeLib.VAL_NULLE) - html_ += "<li><b>Date de r\xE9alisation des calculs : </b>" + dateCalculs + "<br>" + html_ += "<li><b>Date de réalisation des calculs : </b>" + dateCalculs + "<br>" + CtuluLibString.LINE_SEP; if (adresse != AlbeLib.VAL_NULLE) html_ += "<li><b>Adresse courriel : </b>" + adresse + "<br>" + CtuluLibString.LINE_SEP; if (organisation != AlbeLib.VAL_NULLE) html_ += "<li><b>Organisation : </b>" + organisation + "<br>" + CtuluLibString.LINE_SEP; if (departement != AlbeLib.VAL_NULLE) - html_ += "<li><b>D\xE9partement : </b>" + departement + "<br>" + CtuluLibString.LINE_SEP; + html_ += "<li><b>Département : </b>" + departement + "<br>" + CtuluLibString.LINE_SEP; if (version != AlbeLib.VAL_NULLE) html_ += "<li><b>Version : </b>" + version + "<br>" + CtuluLibString.LINE_SEP; if (dateCreation != AlbeLib.VAL_NULLE) - html_ += "<li><b>Date de cr\xE9ation : </b>" + dateCreation + "<br>" + CtuluLibString.LINE_SEP; + html_ += "<li><b>Date de création : </b>" + dateCreation + "<br>" + CtuluLibString.LINE_SEP; if (dateModification != AlbeLib.VAL_NULLE) html_ += "<li><b>Date de modification : </b>" + dateModification + "<br>" + CtuluLibString.LINE_SEP; @@ -306,7 +306,7 @@ // Calcul de la cote du pied de l'ouvrage double cotePied = params_.geo.coteTeteOuvrage - longueur; html_ += "<ul type = square>" + CtuluLibString.LINE_SEP; - html_ += "<li>Cote de la t\xEAte de l'ouvrage : " + params_.geo.coteTeteOuvrage + " m<br>" + html_ += "<li>Cote de la tête de l'ouvrage : " + params_.geo.coteTeteOuvrage + " m<br>" + CtuluLibString.LINE_SEP; html_ += "<li>Cote du pied de l'ouvrage : " + cotePied + " m<br>" + CtuluLibString.LINE_SEP; html_ += "<li>Cote de dragage : " + params_.geo.coteDragageBassin + " m<br>" @@ -322,7 +322,7 @@ Object[] epaisseur = new Object[nbTroncons]; Object[] fykTub = new Object[nbTroncons]; Object[] corrosion = new Object[nbTroncons]; - colNamesTub[0] = "Tron\xE7on"; + colNamesTub[0] = "Tronçon"; colNamesTub[1] = "Longueur (m)"; colNamesTub[2] = "Epaisseur (mm)"; colNamesTub[3] = "f<SUB>yk</SUB> (MPa)"; @@ -335,7 +335,7 @@ + params_.pieu.tronconsTubulaire[i - 1].valeurCaracteristiqueLimiteElastiqueAcier; corrosion[i - 1] = "" + params_.pieu.tronconsTubulaire[i - 1].perteEpaisseurCorrosion; } - html_ += "<br><li>Diam\xE8tre du tube : " + params_.pieu.diametreTroncons + " mm<br>" + html_ += "<br><li>Diamètre du tube : " + params_.pieu.diametreTroncons + " mm<br>" + CtuluLibString.LINE_SEP; addTable(colNamesTub, new Object[][] { tronconTub, longueurTub, epaisseur, fykTub, corrosion }); @@ -350,7 +350,7 @@ Object[] fykCais = new Object[nbTroncons]; Object[] inertieCor = new Object[nbTroncons]; Object[] sectionCor = new Object[nbTroncons]; - colNamesCais[0] = "Tron\xE7on"; + colNamesCais[0] = "Tronçon"; colNamesCais[1] = "Longueur (m)"; colNamesCais[2] = "Inertie (cm<SUP>4</SUP>)"; colNamesCais[3] = "Section (cm<SUP>2</SUP>)"; @@ -381,8 +381,8 @@ Object[] deflexion = new Object[nbPoints]; Object[] reaction = new Object[nbPoints]; Object[] energies = new Object[nbPoints]; - colNamesDef[0] = "D\xE9flexion (%)"; - colNamesDef[1] = "R\xE9action (kN)"; + colNamesDef[0] = "Déflexion (%)"; + colNamesDef[1] = "Réaction (kN)"; colNamesDef[2] = "Energie (kJ)"; double[] en = calculeEnergies(); for (int i = 0; i < nbPoints; i++) { @@ -390,7 +390,7 @@ reaction[i] = "" + params_.defense.points[i].effort; energies[i] = "" + AlbeLib.arronditDouble(en[i]); } - html_ += "<br><li>Hauteur de la d\xE9fense : " + params_.defense.hauteur + " mm<br>" + html_ += "<br><li>Hauteur de la défense : " + params_.defense.hauteur + " mm<br>" + CtuluLibString.LINE_SEP; addTable(colNamesDef, new Object[][] { deflexion, reaction, energies }); addImgFromScript(getScriptReaction(), "courbe_deflexion_reaction.gif", @@ -415,7 +415,7 @@ CtuluImageExport.export(imagePanel.produceImage(null), new File(file), "png", ((AlbeImplementation) ((AlbeFilleNoteDeCalculs) parent_).appli_.getImplementation())); - html_ += "<b>Sch\xE9ma \xE0 l'\xE9chelle de l'ouvrage :</b><br><br>" + CtuluLibString.LINE_SEP; + html_ += "<b>Schéma à l'échelle de l'ouvrage :</b><br><br>" + CtuluLibString.LINE_SEP; html_ += "<a href=\"" + cheminRel + "\" target=\"_blank\"><img src=\"" + cheminRel + "\" alt =\"Sch\xE9ma de l'ouvrage\"></a><br><br>" + CtuluLibString.LINE_SEP; } @@ -554,7 +554,7 @@ alpha[i - 1] = "" + params_.sol.courbe[i - 1].coefficientRheologique; } html_ += "<ul type = disc>" + CtuluLibString.LINE_SEP; - html_ += "<li><b>Caract\xE9ristiques introduites :</b><br>"; + html_ += "<li><b>Caractéristiques introduites :</b><br>"; if (params_.sol.modeleComportementSol.equals(AlbeLib.IDL_COURBE_ELASTO_PLASTIQUE_PURE) || params_.sol.modeleComportementSol.equals(AlbeLib.IDL_COURBE_SETRA)) { colNames[2] = "pl* (kPa)"; @@ -583,20 +583,20 @@ } - html_ += "<li><b>Mod\xE8le de comportement adopt\xE9 : </b>"; + html_ += "<li><b>Modèle de comportement adopté : </b>"; if (params_.sol.modeleComportementSol.equals(AlbeLib.IDL_COURBE_MANUELLE)) html_ += "courbe introduite manuellement point \xE0 point<br><br>"; else if (params_.sol.modeleComportementSol.equals(AlbeLib.IDL_COURBE_ELASTO_PLASTIQUE_PURE)) - html_ += "courbe de r\xE9action \xE9lasto-plastique<br><br>"; + html_ += "courbe de r\xE9action élasto-plastique<br><br>"; else if (params_.sol.modeleComportementSol.equals(AlbeLib.IDL_COURBE_SETRA)) html_ += "courbe type du SETRA<br><br>"; else if (params_.sol.modeleComportementSol.equals(AlbeLib.IDL_COURBE_FASCICULE_COURTE_DUREE)) - html_ += "courbe du fascicule 62 titre V sollicitation de courte dur\xE9e<br><br>"; + html_ += "courbe du fascicule 62 titre V sollicitation de courte durée<br><br>"; else if (params_.sol.modeleComportementSol .equals(AlbeLib.IDL_COURBE_FASCICULE_TRES_COURTE_DUREE)) - html_ += "courbe du fascicule 62 titre V sollicitation de tr\xE8s courte dur\xE9e<br><br>"; + html_ += "courbe du fascicule 62 titre V sollicitation de très courte durée<br><br>"; else if (params_.sol.modeleComportementSol.equals(AlbeLib.IDL_COURBE_FASCICULE_LONGUE_DUREE)) - html_ += "courbe du fascicule 62 titre V sollicitation de longue dur\xE9e<br><br>"; + html_ += "courbe du fascicule 62 titre V sollicitation de longue durée<br><br>"; html_ += "</ul>" + CtuluLibString.LINE_SEP; html_ += "<ul type = circle>" + CtuluLibString.LINE_SEP; for (int i = 0; i < nbCouches; i++) { @@ -616,7 +616,7 @@ Object[] colNames = new Object[2]; Object[] deplacement = new Object[nbPoints]; Object[] pression = new Object[nbPoints]; - colNames[0] = "D\xE9placement (m)"; + colNames[0] = "Déplacement (m)"; colNames[1] = "Pression (kPa)"; for (int i = 0; i < nbPoints; i++) { deplacement[i] = "" + params_.sol.points[_n - 1][i].deplacement; @@ -815,13 +815,13 @@ + CtuluLibString.LINE_SEP; html_ += "Cote d'accostage bas : " + params_.action.coteAccostageBas + " m<br>" + CtuluLibString.LINE_SEP; - html_ += "<br>Effort vertical en t\xEAte de pieu : " + params_.action.effortVerticalAccostage + html_ += "<br>Effort vertical en tête de pieu : " + params_.action.effortVerticalAccostage + " kN<br>" + CtuluLibString.LINE_SEP; html_ += "<br><b>Energies d'accostage</b>" + CtuluLib... [truncated message content] |
From: <emm...@us...> - 2008-12-18 11:23:08
|
Revision: 4307 http://fudaa.svn.sourceforge.net/fudaa/?rev=4307&view=rev Author: emmanuel_martin Date: 2008-12-18 11:23:04 +0000 (Thu, 18 Dec 2008) Log Message: ----------- Correction de l'undo/redo concernant plusieurs points d?\195?\169plac?\195?\169s en une fois (l'undo/redo ne se faisait pas d'un bloque) Modified Paths: -------------- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/VueCourbe.java Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/VueCourbe.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/VueCourbe.java 2008-12-18 10:59:27 UTC (rev 4306) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/VueCourbe.java 2008-12-18 11:23:04 UTC (rev 4307) @@ -68,6 +68,8 @@ protected class CourbeGeomModel implements EGModel, DataGeometryListener { private DataGeometry data_; + /** Un commande manager temporaire. */ + private CtuluCommandContainer cmd_; public CourbeGeomModel(DataGeometry _data) { if(_data==null) @@ -103,18 +105,25 @@ public boolean deplace(int[] idx, double _deltax, double _deltay, CtuluCommandContainer _cmd) { Arrays.sort(idx); - CtuluCommandComposite cmd=new CtuluCommandComposite(FudaaLib.getS("D\xE9placement d'un ou plusieurs points")); + boolean createCmd=false; + if(cmd_==null) { + createCmd=true; + cmd_=new CtuluCommandComposite(FudaaLib.getS("D\xE9placement d'un ou plusieurs points")); + } // Selon le sens de d\xE9placement, il faut commencer par le d\xE9but ou la fin du tableau if(_deltax<0) for(int index:idx) - setValue(index, getX(index)+_deltax, getY(index)+_deltay, cmd); + setValue(index, getX(index)+_deltax, getY(index)+_deltay, cmd_); else for(int i=idx.length-1;i>=0;i--) - setValue(idx[i], getX(idx[i])+_deltax, getY(idx[i])+_deltay, cmd); - if(controller_.getCommandManager()!=null) - // Pour une explication sur l'utilisation de controller_ a la place de - // _cmd voir l'entete de la classe. - controller_.getCommandManager().addCmd(cmd.getSimplify()); + setValue(idx[i], getX(idx[i])+_deltax, getY(idx[i])+_deltay, cmd_); + if(createCmd) { + if(controller_.getCommandManager()!=null) + // Pour une explication sur l'utilisation de controller_ a la place de + // _cmd voir l'entete de la classe. + controller_.getCommandManager().addCmd(((CtuluCommandComposite) cmd_).getSimplify()); + cmd_=null; + } return true; } @@ -183,9 +192,20 @@ public boolean removeValue(int _i, CtuluCommandContainer _cmd) { try { - // Pour une explication sur l'utilisation de controller_ a la place de - // _cmd voir l'entete de la classe. - data_.remove(_i, controller_.getCommandManager()); + boolean createCmd=false; + if(cmd_==null) { + createCmd=true; + cmd_=new CtuluCommandComposite(FudaaLib.getS("Suppression d'un point")); + } + // Suppression du poin + data_.remove(_i, cmd_); + if(createCmd) { + if(controller_.getCommandManager()!=null) + // Pour une explication sur l'utilisation de controller_ a la place de + // _cmd voir l'entete de la classe. + controller_.getCommandManager().addCmd(((CtuluCommandComposite) cmd_).getSimplify()); + cmd_=null; + } return true; } catch (DataGeometryException _exc) { @@ -209,9 +229,20 @@ public boolean setValue(int _i, double _x, double _y, CtuluCommandContainer _cmd) { controller_.clearError(); try { - // Pour une explication sur l'utilisation de controller_ a la place de - // _cmd voir l'entete de la classe. - data_.setValues(_i, _x, _y, controller_.getCommandManager()); + boolean createCmd=false; + if(cmd_==null) { + createCmd=true; + cmd_=new CtuluCommandComposite(FudaaLib.getS("D\xE9placement d'un point")); + } + // D\xE9placement du point + data_.setValues(_i, _x, _y, cmd_); + if(createCmd) { + if(controller_.getCommandManager()!=null) + // Pour une explication sur l'utilisation de controller_ a la place de + // _cmd voir l'entete de la classe. + controller_.getCommandManager().addCmd(((CtuluCommandComposite) cmd_).getSimplify()); + cmd_=null; + } return true; } catch (DataGeometryException _exc) { @@ -221,13 +252,21 @@ } public boolean setValues(int[] _idx, double[] _x, double[] _y, CtuluCommandContainer _cmd) { - CtuluCommandComposite cmd=new CtuluCommandComposite(FudaaLib.getS("D\xE9placement d'un ou plusieurs points")); + boolean createCmd=false; + if(cmd_==null) { + createCmd=true; + cmd_=new CtuluCommandComposite(FudaaLib.getS("D\xE9placement d'un ou plusieurs points")); + } + // D\xE9placement for(int index: _idx) - setValue(index, _x[index], _y[index], cmd); - if(controller_.getCommandManager()!=null) - // Pour une explication sur l'utilisation de controller_ a la place de - // _cmd voir l'entete de la classe. - controller_.getCommandManager().addCmd(cmd.getSimplify()); + setValue(index, _x[index], _y[index], cmd_); + if(createCmd) { + if(controller_.getCommandManager()!=null) + // Pour une explication sur l'utilisation de controller_ a la place de + // _cmd voir l'entete de la classe. + controller_.getCommandManager().addCmd(((CtuluCommandComposite) cmd_).getSimplify()); + cmd_=null; + } return true; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <emm...@us...> - 2008-12-18 10:59:30
|
Revision: 4306 http://fudaa.svn.sourceforge.net/fudaa/?rev=4306&view=rev Author: emmanuel_martin Date: 2008-12-18 10:59:27 +0000 (Thu, 18 Dec 2008) Log Message: ----------- Ajout de l'undo/redo dans le modeleur1d. Modified Paths: -------------- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/Controller1d.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/DataGeometry.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/DataGeometryAdapter.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/MdlFille1d.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/VueCourbe.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/VueTableau.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/test/testModeleur1d/TestDataGeometryAdapter.java Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/Controller1d.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/Controller1d.java 2008-12-17 17:44:49 UTC (rev 4305) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/Controller1d.java 2008-12-18 10:59:27 UTC (rev 4306) @@ -20,6 +20,7 @@ import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; +import org.fudaa.ctulu.CtuluCommandManager; import org.fudaa.ctulu.CtuluListSelectionEvent; import org.fudaa.ctulu.CtuluListSelectionListener; import org.fudaa.ctulu.gis.GISAttributeConstants; @@ -67,6 +68,8 @@ private DataGeometryAdapter dataGeomAdapter_; /** Formater */ private EbliFormatterInterface formater_=new EbliFormatter(); + /** Le commande manager pour le undo/redo */ + private CtuluCommandManager mng_; public Controller1d(MdlImplementation _appli, MdlFille1d _frame1d){ if(_appli==null||_frame1d==null) @@ -74,6 +77,7 @@ appli_=_appli; frame1d_=_frame1d; frame1d_.addInternalFrameListener(this); + mng_=new CtuluCommandManager(); vueBief_=new VueBief(appli_, this); vueBief_.getScene().addSelectionListener(this); treeModel_=vueBief_.getArbreCalqueModel(); @@ -109,6 +113,10 @@ return formater_; } + public CtuluCommandManager getCommandManager(){ + return mng_; + } + // Gestion de l'affichage des erreurs. \\ public void showError(String _message){ Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/DataGeometry.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/DataGeometry.java 2008-12-17 17:44:49 UTC (rev 4305) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/DataGeometry.java 2008-12-18 10:59:27 UTC (rev 4306) @@ -7,6 +7,8 @@ */ package org.fudaa.fudaa.modeleur.modeleur1d; +import org.fudaa.ctulu.CtuluCommandContainer; + /** * Une interface permettant d'acc\xE9der aux informations manipul\xE9es par les * widgets tableau et courbe. @@ -53,14 +55,14 @@ * Pour les autres points, le point 2D est d\xE9plac\xE9 sur son axe en concervant * la longeur globale. */ - public void setCurv(int _idxPoint, double _value) throws DataGeometryException; + public void setCurv(int _idxPoint, double _value, CtuluCommandContainer _cmd) throws DataGeometryException; /** Enregistre la valeur de z du point indiqu\xE9 en param\xE8tre. */ - public void setZ(int _idxPoint, double _value); + public void setZ(int _idxPoint, double _value, CtuluCommandContainer _cmd); /** Enregistre l'abcisse curviligne et la valeur de z du point indiqu\xE9 en param\xE8tre. */ - public void setValues(int _idxPoint, double _valueCurv, double _valueZ) throws DataGeometryException; + public void setValues(int _idxPoint, double _valueCurv, double _valueZ, CtuluCommandContainer _cmd) throws DataGeometryException; /** Supprime le point indiqu\xE9 en param\xE8tre. */ - public void remove(int _idxPoint) throws DataGeometryException; + public void remove(int _idxPoint, CtuluCommandContainer _cmd) throws DataGeometryException; } Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/DataGeometryAdapter.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/DataGeometryAdapter.java 2008-12-17 17:44:49 UTC (rev 4305) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/DataGeometryAdapter.java 2008-12-18 10:59:27 UTC (rev 4306) @@ -10,7 +10,11 @@ import java.util.ArrayList; import java.util.List; +import org.fudaa.ctulu.CtuluCommand; +import org.fudaa.ctulu.CtuluCommandComposite; +import org.fudaa.ctulu.CtuluCommandContainer; import org.fudaa.ctulu.CtuluListSelection; +import org.fudaa.ctulu.CtuluNamedCommand; import org.fudaa.ctulu.collection.CtuluCollection; import org.fudaa.ctulu.gis.GISCoordinateSequenceContainerInterface; import org.fudaa.ctulu.gis.GISGeometryFactory; @@ -33,6 +37,62 @@ */ public class DataGeometryAdapter implements DataGeometry { + /** + * Un command container pour le undo/redo. + * Fonctionnement : + * Deux \xE9l\xE9ments sont \xE0 prendre en compte lors du undo/redo : + * 1) Il peut \xEAtre n\xE9c\xE9ssaire de mettre a jour le z et/ou le curv. + * 2) Le undo/redo peut \xEAtre d\xE9clanch\xE9 alors que le DataGeometryAdapter g\xE9re actuellement une autre g\xE9om\xE9try. + * Pour g\xE9rer ces deux cas : + * 1) Deux booleans sont pris par le constructeur indiquant si il faut mettre \xE0 jour les valeurs de z et/ou de curv. + * 2) La zone et l'index de la g\xE9om\xE9trie g\xE9r\xE9 au moment de l'action sont m\xE9moris\xE9s pour g\xE9rer le cas 2. Dans le cas + * o\xF9 un autre g\xE9om\xE9trie est g\xE9r\xE9e au moment du undo/redo aucun update n'est d\xE9clanch\xE9. + * Ainsi m\xEAme si la g\xE9om\xE9trie selectionn\xE9 change plein de fois, revient sur la selection pr\xE9c\xE9dente etc...La mise \xE0 + * jour visuelle se fera correctement. + * Information suppl\xE9mentaire : pour fonctionner correctement le CtuluCommandContainer prit en param\xE8tre contenant + * le undo/redo ne doit pas d\xE9pendre de DataGeometryAdapter mais seulement de la zone. + */ + protected class DGCommandUndoRedo implements CtuluCommand, CtuluNamedCommand { + private CtuluCommand cmd_; + private boolean updateZ_; + private boolean updateCurv_; + private GISZoneCollectionLigneBrisee oldZone_; + private int oldIdxGeom_; + + public DGCommandUndoRedo(CtuluCommand _cmd, boolean _updateZ, boolean _updateCurv){ + cmd_=_cmd; + updateZ_=_updateZ; + updateCurv_=_updateCurv; + oldZone_=zone_; + oldIdxGeom_=idxGeom_; + } + + private void updateIfNeeded(){ + if(oldZone_==zone_&&oldIdxGeom_==idxGeom_) { + if(updateZ_) updateCacheZ(); + if(updateCurv_) updateCacheCurv(); + fireDataGeometryChanged(); + } + } + + public void redo() { + cmd_.redo(); + updateIfNeeded(); + } + + public void undo() { + cmd_.undo(); + updateIfNeeded(); + } + + public String getName() { + if(cmd_ instanceof CtuluNamedCommand) + return ((CtuluNamedCommand) cmd_).getName(); + else + return null; + } + } + private GISZoneCollectionLigneBrisee zone_; private int idxGeom_; private CtuluCollection z_; @@ -50,6 +110,46 @@ } /** + * Met \xE0 jour les valeurs zMin et zMax. + * Si z_ est null, zMin et zMax sont mises \xE0 -1. + */ + protected void updateCacheZ(){ + if(z_!=null) { + idxZMax_=0; + idxZMin_=0; + for (int i=1; i<z_.getSize(); i++) { + double val=(Double)z_.getObjectValueAt(i); + if (val>(Double)z_.getObjectValueAt(idxZMax_)) + idxZMax_=i; + else if (val<(Double)z_.getObjectValueAt(idxZMin_)) + idxZMin_=i; + } + } + else { + idxZMax_=-1; + idxZMin_=-1; + } + } + + /** + * Met \xE0 jour les valeurs curv_. + * Si curv_ ou zone_ sont null, rien n'est fait. + */ + protected void updateCacheCurv(){ + if(curv_!=null&&zone_!=null) { + CoordinateSequence seq=((GISCoordinateSequenceContainerInterface)zone_.getGeometry(idxGeom_)).getCoordinateSequence(); + curv_.clear(); + double curvPre=0; + curv_.add((double)0); + for (int i=1; i<seq.size(); i++) { + double partialCurv=Math.sqrt(Math.pow(seq.getX(i)-seq.getX(i-1), 2)+Math.pow(seq.getY(i)-seq.getY(i-1), 2)); + curvPre=curvPre+partialCurv; + curv_.add(curvPre); + } + } + } + + /** * Permet de choisir la g\xE9om\xE9trie sur lequel l'instance va travailler. * Hypoth\xE8se importante : les points de la g\xE9om\xE9tries sont correctement * ordonn\xE9s (les points sont ordonn\xE9s en ordre croissant de leur abscisse @@ -80,25 +180,10 @@ for (int i=1; i<seq.size(); i++) if (seq.getX(i-1)==seq.getX(i)&&seq.getY(i-1)==seq.getY(i)) throw new DataGeometryException(FudaaLib.getS("Au moins deux points dans le profil sont confondus.")); - // Calcul des acbscisses curvilignes => hypoth\xE8se d'ordonnancement - // correcte des points \\ - double curvPre=0; - curv_.add((double)0); - for (int i=1; i<seq.size(); i++) { - double partialCurv=Math.sqrt(Math.pow(seq.getX(i)-seq.getX(i-1), 2)+Math.pow(seq.getY(i)-seq.getY(i-1), 2)); - curvPre=curvPre+partialCurv; - curv_.add(curvPre); - } + // Calcul des acbscisses curvilignes => hypoth\xE8se d'ordonnancement correcte des points \\ + updateCacheCurv(); // Remplissage du cache Z \\ - idxZMax_=0; - idxZMin_=0; - for (int i=1; i<z_.getSize(); i++) { - double val=(Double)z_.getObjectValueAt(i); - if (val>(Double)z_.getObjectValueAt(idxZMax_)) - idxZMax_=i; - else if (val<(Double)z_.getObjectValueAt(idxZMin_)) - idxZMin_=i; - } + updateCacheZ(); // Verifie que le profil donn\xE9 ne poss\xE8de pas des axes qui se coupent entre eux \\ for(int i=1;i<seq.size();i++){ @@ -212,7 +297,7 @@ return ((Double)z_.getObjectValueAt(_idxPoint)).doubleValue(); } - public void setCurv(int _idxPoint, double _value) throws DataGeometryException { + public void setCurv(int _idxPoint, double _value, CtuluCommandContainer _cmd) throws DataGeometryException { if(curv_==null||_idxPoint<0||_idxPoint>=curv_.size()) // Si curv_!=null alors z et index_ ont des valeurs coh\xE9rentes throw new IllegalArgumentException("Cet index n'existe pas."); // Extraction des coordonn\xE9es de la g\xE9om\xE9trie pour pouvoir les modifier par la suite @@ -324,6 +409,13 @@ * abscisses curvilignes de chacun des points. * Pour y parvenir le nouveau coefficient directeur des axes est calcul\xE9 et appliqu\xE9 au rapport de * l'abcisse curviligne avec l'abscisse du point extr\xE9mit\xE9 de l'axe. + * + * Derni\xE8re petite note pour la fin, le cas dit 'simple' pr\xE9c\xE9dent + * (d\xE9placement d'un point qui n'est pas un point de rupture) n'est qu'un + * cas particulier de la r\xE9solution ci dessus (la solution de l'\xE9quation + * du second degr\xE9 serait unique). On pourrait donc l'enlever, je pense que + * s\xE9parer ces deux cas ne fait pas de mal pour une \xE9ventuelle relecture + * et/ou modification de ce code. */ // Application de la m\xE9thode d\xE9crite ci dessus \\ @@ -460,29 +552,29 @@ } } } - + CtuluCommandComposite cmd=new CtuluCommandComposite("Changement abs. curviligne"); // Enregistrement des nouvelles coordonn\xE9es \\ - zone_.setCoordinateSequence(idxGeom_, GISGeometryFactory.INSTANCE.getCoordinateSequenceFactory().create(coords), null); + zone_.setCoordinateSequence(idxGeom_, GISGeometryFactory.INSTANCE.getCoordinateSequenceFactory().create(coords), cmd); + // Gestion du undo/redo \\ + if(_cmd!=null) + _cmd.addCmd(new DGCommandUndoRedo(cmd, false, true)); // Notification des changements de valeurs fireDataGeometryChanged(); } - public void setZ(int _idxPoint, double _value) { + public void setZ(int _idxPoint, double _value, CtuluCommandContainer _cmd) { if (z_==null||_idxPoint<0||_idxPoint>=z_.getSize()) throw new IllegalArgumentException("Cet index n'existe pas."); - z_.setObject(_idxPoint, _value, null); + + CtuluCommandComposite cmd=new CtuluCommandComposite("Changement abs. curviligne"); + // Mise \xE0 jour du z \\ + z_.setObject(_idxPoint, _value, cmd); + // Gestion du undo/redo \\ + if(_cmd!=null) + _cmd.addCmd(new DGCommandUndoRedo(cmd, true, false)); // Mise \xE0 jour de idxZMin_ et idxZMax_ - if (_idxPoint==idxZMax_||_idxPoint==idxZMin_) { - idxZMax_=0; - idxZMin_=0; - for (int i=1; i<z_.getSize(); i++) { - double val=(Double)z_.getObjectValueAt(i); - if (val>(Double)z_.getObjectValueAt(idxZMax_)) - idxZMax_=i; - else if (val<(Double)z_.getObjectValueAt(idxZMin_)) - idxZMin_=i; - } - } + if (_idxPoint==idxZMax_||_idxPoint==idxZMin_) + updateCacheZ(); else if (_value>(Double)z_.getObjectValueAt(idxZMax_)) idxZMax_=_idxPoint; else if (_value<(Double)z_.getObjectValueAt(idxZMin_)) @@ -518,18 +610,25 @@ return (Double) z_.getObjectValueAt(idxZMin_); } - public void setValues(int _idxPoint, double _valueCurv, double _valueZ) throws DataGeometryException{ - setZ(_idxPoint, _valueZ); - setCurv(_idxPoint, _valueCurv); + public void setValues(int _idxPoint, double _valueCurv, double _valueZ, CtuluCommandContainer _cmd) throws DataGeometryException{ + CtuluCommandComposite cmd=new CtuluCommandComposite(FudaaLib.getS("D\xE9placement d'un point")); + setZ(_idxPoint, _valueZ, cmd); + setCurv(_idxPoint, _valueCurv, cmd); + if(_cmd!=null) + _cmd.addCmd(cmd.getSimplify()); } - public void remove(int _idxPoint) throws DataGeometryException { + public void remove(int _idxPoint, CtuluCommandContainer _cmd) throws DataGeometryException { if(zone_==null||z_==null||curv_==null||_idxPoint<0||_idxPoint>=curv_.size()) throw new IllegalArgumentException("Cet index n'existe pas."); if(curv_.size()==2) throw new DataGeometryException("On ne peut pas enlever un point quand il n'en reste que deux."); + CtuluCommandComposite cmd=new CtuluCommandComposite("Changement abs. curviligne"); // Suppression du point dans la zone - zone_.removeAtomics(idxGeom_, new CtuluListSelection(new int[]{_idxPoint}), null, null); + zone_.removeAtomics(idxGeom_, new CtuluListSelection(new int[]{_idxPoint}), null, cmd); + // Gestion du undo/redo \\ + if(_cmd!=null) + _cmd.addCmd(new DGCommandUndoRedo(cmd, true, true)); z_=(CtuluCollection)zone_.getValue(zone_.getIndiceOf(zone_.getAttributeIsZ()), idxGeom_); // Mise \xE0 jour des informations curvilignes \\ if (_idxPoint==0) { @@ -553,17 +652,8 @@ // Si _idxPoint est le dernier curv_.remove(curv_.size()-1); // Mise \xE0 jour de idxZMin_ et idxZMax_ - if (_idxPoint==idxZMax_||_idxPoint==idxZMin_) { - idxZMax_=0; - idxZMin_=0; - for (int i=1; i<z_.getSize(); i++) { - double val=(Double)z_.getObjectValueAt(i); - if (val>(Double)z_.getObjectValueAt(idxZMax_)) - idxZMax_=i; - else if (val<(Double)z_.getObjectValueAt(idxZMin_)) - idxZMin_=i; - } - } + if (_idxPoint==idxZMax_||_idxPoint==idxZMin_) + updateCacheZ(); fireDataGeometryChanged(); } Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/MdlFille1d.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/MdlFille1d.java 2008-12-17 17:44:49 UTC (rev 4305) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/MdlFille1d.java 2008-12-18 10:59:27 UTC (rev 4306) @@ -14,6 +14,8 @@ import javax.swing.JComponent; import javax.swing.JSplitPane; +import org.fudaa.ctulu.CtuluCommandManager; +import org.fudaa.ctulu.CtuluUndoRedoInterface; import org.fudaa.ctulu.gui.CtuluFilleWithComponent; import org.fudaa.ebli.calque.BArbreCalque; import org.fudaa.ebli.impression.EbliFilleImprimable; @@ -22,6 +24,7 @@ import org.fudaa.fudaa.sig.FSigResource; import com.memoire.bu.BuBorderLayout; +import com.memoire.bu.BuUndoRedoInterface; /** * La fenetre interne vue 2D des donn\xE9es du modeleur. Elle construit le composant arbre de @@ -33,7 +36,7 @@ * @author Emmanuel Martin * @version $Id$ */ -public class MdlFille1d extends EbliFilleImprimable implements CtuluFilleWithComponent { +public class MdlFille1d extends EbliFilleImprimable implements BuUndoRedoInterface, CtuluFilleWithComponent, CtuluUndoRedoInterface { /** Le controller 1d */ private Controller1d controller_; @@ -104,4 +107,22 @@ public JComponent[] getSpecificTools() { return controller_.getToolsActions(); } + + public void redo() { + controller_.getCommandManager().redo(); + } + + public void undo() { + controller_.getCommandManager().undo(); + } + + public void clearCmd(CtuluCommandManager _source) { + } + + public CtuluCommandManager getCmdMng() { + return controller_.getCommandManager(); + } + + public void setActive(boolean _active) { + } } Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/VueCourbe.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/VueCourbe.java 2008-12-17 17:44:49 UTC (rev 4305) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/VueCourbe.java 2008-12-18 10:59:27 UTC (rev 4306) @@ -19,6 +19,7 @@ import javax.swing.Action; import javax.swing.JComponent; +import org.fudaa.ctulu.CtuluCommandComposite; import org.fudaa.ctulu.CtuluCommandContainer; import org.fudaa.ctulu.CtuluLib; import org.fudaa.ctulu.CtuluListSelectionInterface; @@ -47,6 +48,14 @@ * Cette vue permet la modification et le visionnage d'un profil (pr\xE9alablement * selectionn\xE9 dans la vue du bief). * + * Element important a propos de l'implementation de l'undo/redo : + * une gestion de l'undo/redo est d\xE9j\xE0 pr\xE9sente dans le framework de courbe, + * mais il n'est pas utilis\xE9 pour g\xE9rer l'undo/redo. La raison est qu'il permet + * d'annuler trop d'action (notamment l'ajout de courbe) ce qui peut provoquer + * des comportements incoh\xE9rent dans l'application. C'est pour cette raison que + * tous les undo/redo passent \xE0 la place par le gestionnaire undo/redo du + * controller1d. + * * @author Emmanuel MARTIN * @version $Id$ */ @@ -94,13 +103,18 @@ public boolean deplace(int[] idx, double _deltax, double _deltay, CtuluCommandContainer _cmd) { Arrays.sort(idx); + CtuluCommandComposite cmd=new CtuluCommandComposite(FudaaLib.getS("D\xE9placement d'un ou plusieurs points")); // Selon le sens de d\xE9placement, il faut commencer par le d\xE9but ou la fin du tableau if(_deltax<0) for(int index:idx) - setValue(index, getX(index)+_deltax, getY(index)+_deltay, _cmd); + setValue(index, getX(index)+_deltax, getY(index)+_deltay, cmd); else for(int i=idx.length-1;i>=0;i--) - setValue(idx[i], getX(idx[i])+_deltax, getY(idx[i])+_deltay, _cmd); + setValue(idx[i], getX(idx[i])+_deltax, getY(idx[i])+_deltay, cmd); + if(controller_.getCommandManager()!=null) + // Pour une explication sur l'utilisation de controller_ a la place de + // _cmd voir l'entete de la classe. + controller_.getCommandManager().addCmd(cmd.getSimplify()); return true; } @@ -169,7 +183,9 @@ public boolean removeValue(int _i, CtuluCommandContainer _cmd) { try { - data_.remove(_i); + // Pour une explication sur l'utilisation de controller_ a la place de + // _cmd voir l'entete de la classe. + data_.remove(_i, controller_.getCommandManager()); return true; } catch (DataGeometryException _exc) { @@ -193,7 +209,9 @@ public boolean setValue(int _i, double _x, double _y, CtuluCommandContainer _cmd) { controller_.clearError(); try { - data_.setValues(_i, _x, _y); + // Pour une explication sur l'utilisation de controller_ a la place de + // _cmd voir l'entete de la classe. + data_.setValues(_i, _x, _y, controller_.getCommandManager()); return true; } catch (DataGeometryException _exc) { @@ -203,8 +221,13 @@ } public boolean setValues(int[] _idx, double[] _x, double[] _y, CtuluCommandContainer _cmd) { + CtuluCommandComposite cmd=new CtuluCommandComposite(FudaaLib.getS("D\xE9placement d'un ou plusieurs points")); for(int index: _idx) - setValue(index, _x[index], _y[index], _cmd); + setValue(index, _x[index], _y[index], cmd); + if(controller_.getCommandManager()!=null) + // Pour une explication sur l'utilisation de controller_ a la place de + // _cmd voir l'entete de la classe. + controller_.getCommandManager().addCmd(cmd.getSimplify()); return true; } } Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/VueTableau.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/VueTableau.java 2008-12-17 17:44:49 UTC (rev 4305) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/VueTableau.java 2008-12-18 10:59:27 UTC (rev 4306) @@ -85,13 +85,13 @@ controller_.clearError(); if(columnIndex==0) try { - data_.setCurv(rowIndex, (Double) value); + data_.setCurv(rowIndex, (Double) value, controller_.getCommandManager()); } catch (DataGeometryException _exc) { controller_.showError(_exc.getMessage()); } else - data_.setZ(rowIndex, (Double) value); + data_.setZ(rowIndex, (Double) value, controller_.getCommandManager()); } } Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/test/testModeleur1d/TestDataGeometryAdapter.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/test/testModeleur1d/TestDataGeometryAdapter.java 2008-12-17 17:44:49 UTC (rev 4305) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/test/testModeleur1d/TestDataGeometryAdapter.java 2008-12-18 10:59:27 UTC (rev 4306) @@ -23,7 +23,7 @@ /** * Test pour DataGeometryAdapter. * @author Emmanuel MARTIN - * @version $Id:$ + * @version $Id$ */ public class TestDataGeometryAdapter extends TestCase { @@ -565,46 +565,46 @@ // Cas limits geomAdapter_.setData(null, -1); try{ - geomAdapter_.setCurv(0, 0); + geomAdapter_.setCurv(0, 0, null); fail(); } catch(IllegalArgumentException _exc) {} try{ - geomAdapter_.setCurv(-1, 0); + geomAdapter_.setCurv(-1, 0, null); fail(); } catch(IllegalArgumentException _exc) {} geomAdapter_.setData(zone1_, 0); try{ - geomAdapter_.setCurv(-1, 0); + geomAdapter_.setCurv(-1, 0, null); fail(); } catch(IllegalArgumentException _exc) {} try{ - geomAdapter_.setCurv(zone1_.getGeometry(0).getNumPoints(), 0); + geomAdapter_.setCurv(zone1_.getGeometry(0).getNumPoints(), 0, null); fail(); } catch(IllegalArgumentException _exc) {} try{ - geomAdapter_.setCurv(zone1_.getGeometry(0).getNumPoints()+1, 0); + geomAdapter_.setCurv(zone1_.getGeometry(0).getNumPoints()+1, 0, null); fail(); } catch(IllegalArgumentException _exc) {} // Une abcisse curviligne peut \xEAtre donn\xE9 pour le premier point, seulement pour lui geomAdapter_.setData(zone5_, 0); try{ - geomAdapter_.setCurv(0, -1); + geomAdapter_.setCurv(0, -1, null); } catch(Exception exc){ fail(); } try{ - geomAdapter_.setCurv(1, -1); + geomAdapter_.setCurv(1, -1, null); fail(); } catch(DataGeometryException exc){} try{ - geomAdapter_.setCurv(geomAdapter_.getNbPoint()-1, -1); + geomAdapter_.setCurv(geomAdapter_.getNbPoint()-1, -1, null); fail(); } catch(DataGeometryException exc){} @@ -612,29 +612,29 @@ // Test sur le d\xE9placement d'un point au del\xE0 d'un autre ou au niveau d'un autre geomAdapter_.setData(zone5_, 0); try{ - geomAdapter_.setCurv(0, Math.sqrt(10*10+5*5)+1); + geomAdapter_.setCurv(0, Math.sqrt(10*10+5*5)+1, null); fail(); } catch(DataGeometryException exc){} try{ - geomAdapter_.setCurv(1, 0); + geomAdapter_.setCurv(1, 0, null); fail(); } catch(DataGeometryException exc){} geomAdapter_.setData(zone5_, 6); try{ - geomAdapter_.setCurv(2, geomAdapter_.getCurv(1)-0.1); + geomAdapter_.setCurv(2, geomAdapter_.getCurv(1)-0.1, null); fail(); } catch(DataGeometryException exc){} geomAdapter_.setData(zone5_, 11); try{ // Tentative de se placer sur un point de rupture - geomAdapter_.setCurv(3, geomAdapter_.getCurv(2)); + geomAdapter_.setCurv(3, geomAdapter_.getCurv(2), null); fail(); } catch(DataGeometryException exc){} try{ // Tentative d'un point de rupture de d\xE9pacer un point adjacent - geomAdapter_.setCurv(2, geomAdapter_.getCurv(3)+1); + geomAdapter_.setCurv(2, geomAdapter_.getCurv(3)+1, null); fail(); } catch(DataGeometryException exc){} @@ -643,7 +643,7 @@ // Cas g\xE9n\xE9ral, d\xE9placement d\xE9but geomAdapter_.setData(zone5_, 0); double curvOld=geomAdapter_.getCurv(1); - geomAdapter_.setCurv(0, Math.sqrt(5*5+2.5*2.5)); + geomAdapter_.setCurv(0, Math.sqrt(5*5+2.5*2.5), null); assertEquals(curvOld-Math.sqrt(5*5+2.5*2.5), geomAdapter_.getCurv(1), tolerance); assertEquals(5, zone5_.getGeometry(0).getCoordinates()[0].x, tolerance); assertEquals(2.5, zone5_.getGeometry(0).getCoordinates()[0].y, tolerance); @@ -651,7 +651,7 @@ // Cas g\xE9n\xE9ral, d\xE9placement fin avec point de ruptures geomAdapter_.setData(zone5_, 16); curvOld=geomAdapter_.getCurv(9); - geomAdapter_.setCurv(9, geomAdapter_.getCurv(8)+Math.sqrt((10/4.-10/16.)*(10/4.-10/16.)+(-5/4.+5/16.)*(-5/4.+5/16.))); + geomAdapter_.setCurv(9, geomAdapter_.getCurv(8)+Math.sqrt((10/4.-10/16.)*(10/4.-10/16.)+(-5/4.+5/16.)*(-5/4.+5/16.)), null); assertEquals(geomAdapter_.getCurv(8)+Math.sqrt((10/4.-10/16.)*(10/4.-10/16.)+(-5/4.+5/16.)*(-5/4.+5/16.)), geomAdapter_.getCurv(9), tolerance); assertEquals(10/16., zone5_.getGeometry(16).getCoordinates()[9].x, tolerance); assertEquals(-5/16., zone5_.getGeometry(16).getCoordinates()[9].y, tolerance); @@ -659,7 +659,7 @@ // Cas particulier parall\xE8le \xE0 l'axe des x geomAdapter_.setData(zone5_, 1); curvOld=geomAdapter_.getCurv(1); - geomAdapter_.setCurv(0, -5); + geomAdapter_.setCurv(0, -5, null); assertEquals(curvOld+5, geomAdapter_.getCurv(1), tolerance); assertEquals(0, zone5_.getGeometry(1).getCoordinates()[0].x, tolerance); assertEquals(10, zone5_.getGeometry(1).getCoordinates()[0].y, tolerance); @@ -667,7 +667,7 @@ // Cas particulier parall\xE8le \xE0 l'axe des y geomAdapter_.setData(zone5_, 8); curvOld=geomAdapter_.getCurv(2); - geomAdapter_.setCurv(0, -5); + geomAdapter_.setCurv(0, -5, null); assertEquals(curvOld+5, geomAdapter_.getCurv(2), tolerance); assertEquals(-9.1, zone5_.getGeometry(8).getCoordinates()[0].x, tolerance); assertEquals(93, zone5_.getGeometry(8).getCoordinates()[0].y, tolerance); @@ -677,7 +677,7 @@ geomAdapter_.setData(zone5_, 4); curvOld=geomAdapter_.getCurv(1); double curvOld2=geomAdapter_.getCurv(2); - geomAdapter_.setCurv(1, geomAdapter_.getCurv(1)-5); + geomAdapter_.setCurv(1, geomAdapter_.getCurv(1)-5, null); assertEquals(curvOld-5, geomAdapter_.getCurv(1), tolerance); assertEquals(curvOld2, geomAdapter_.getCurv(2), tolerance); assertEquals(15, zone5_.getGeometry(4).getCoordinates()[1].x, tolerance); @@ -687,7 +687,7 @@ geomAdapter_.setData(zone5_, 15); curvOld=geomAdapter_.getCurv(3); curvOld2=geomAdapter_.getCurv(1); - geomAdapter_.setCurv(3, geomAdapter_.getCurv(3)-2); + geomAdapter_.setCurv(3, geomAdapter_.getCurv(3)-2, null); assertEquals(curvOld-2, geomAdapter_.getCurv(3), tolerance); assertEquals(curvOld2, geomAdapter_.getCurv(1), tolerance); assertEquals(10, zone5_.getGeometry(15).getCoordinates()[3].x, tolerance); @@ -700,7 +700,7 @@ double[] absCurv=new double[6]; for(int i=0;i<6;i++) absCurv[i]=geomAdapter_.getCurv(i); - geomAdapter_.setCurv(2,geomAdapter_.getCurv(2)-2); + geomAdapter_.setCurv(2,geomAdapter_.getCurv(2)-2, null); absCurv[2]=absCurv[2]-2; // R\xE9instancier un nouvel adapter va verifier si il n'y a pas de nouveaux points de ruptures qui sont apparux ou qu'il y ai pas des axes qui se croisent DataGeometryAdapter testAdapter=null; @@ -717,7 +717,7 @@ setUp(); // Test sur les coordonn\xE9es g\xE9n\xE9r\xE9es geomAdapter_.setData(zone1_, 0); - geomAdapter_.setCurv(1, 5); + geomAdapter_.setCurv(1, 5, null); assertEquals(5.0, geomAdapter_.getCurv(1), tolerance); Coordinate p=((GISPolyligne)zone1_.getGeometry(0)).getCoordinateSequence().getCoordinate(1); assertEquals(3.1013705223595296, p.x, tolerance); @@ -726,24 +726,24 @@ public void testSetZ() throws IllegalArgumentException, DataGeometryException { geomAdapter_.setData(zone0_, 0); - geomAdapter_.setZ(0, 20); + geomAdapter_.setZ(0, 20, null); assertEquals(20, geomAdapter_.getZ(0), tolerance); - geomAdapter_.setZ(2, -2); + geomAdapter_.setZ(2, -2, null); assertEquals(-2, geomAdapter_.getZ(2), tolerance); // Cas limits try{ - geomAdapter_.setZ(-11, -2); + geomAdapter_.setZ(-11, -2, null); fail(); }catch(IllegalArgumentException _exc){} try { - geomAdapter_.setZ(1000, -2); + geomAdapter_.setZ(1000, -2, null); fail(); } catch (IllegalArgumentException _exc){} // Cas limits geomAdapter_.setData(null, -1); try { - geomAdapter_.setZ(0, 10); + geomAdapter_.setZ(0, 10, null); fail(); } catch(IllegalArgumentException _exc){} @@ -768,9 +768,9 @@ assertEquals(10, geomAdapter_.getZMax(), tolerance); geomAdapter_.setData(zone1_, 0); assertEquals(0, geomAdapter_.getZMax(), tolerance); - geomAdapter_.setZ(0, 20); + geomAdapter_.setZ(0, 20, null); assertEquals(20, geomAdapter_.getZMax(), tolerance); - geomAdapter_.setZ(0, -5); + geomAdapter_.setZ(0, -5, null); assertEquals(0, geomAdapter_.getZMax(), tolerance); } @@ -779,9 +779,9 @@ assertEquals(-20, geomAdapter_.getZMin(), tolerance); geomAdapter_.setData(zone1_, 0); assertEquals(0, geomAdapter_.getZMin(), tolerance); - geomAdapter_.setZ(0, -20); + geomAdapter_.setZ(0, -20, null); assertEquals(-20, geomAdapter_.getZMin(), tolerance); - geomAdapter_.setZ(0, 10); + geomAdapter_.setZ(0, 10, null); assertEquals(0, geomAdapter_.getZMin(), tolerance); } @@ -791,7 +791,7 @@ double[] absCurv=new double[6]; for(int i=0;i<6;i++) absCurv[i]=geomAdapter_.getCurv(i); - geomAdapter_.setValues(2,geomAdapter_.getCurv(2)-2, 60); + geomAdapter_.setValues(2,geomAdapter_.getCurv(2)-2, 60, null); assertEquals(60, geomAdapter_.getZ(2), tolerance); absCurv[2]=absCurv[2]-2; // R\xE9instancier un nouvel adapter va verifier si il n'y a pas de nouveaux points de ruptures qui sont apparux ou qu'il y ai pas des axes qui se croisent @@ -811,14 +811,14 @@ public void testRemove() throws IllegalArgumentException, DataGeometryException { // Un cas g\xE9n\xE9ral geomAdapter_.setData(zone0_, 0); - geomAdapter_.remove(0); + geomAdapter_.remove(0, null); assertEquals(2, geomAdapter_.getNbPoint()); assertEquals(-20, geomAdapter_.getZ(0), tolerance); assertEquals(0, geomAdapter_.getCurv(0), tolerance); assertEquals(Math.sqrt((50+10)*(50+10)+(10+20)*(10+20)), geomAdapter_.getCurv(1), tolerance); // On ne peut pas descendre en dessous de 2 points try { - geomAdapter_.remove(0); + geomAdapter_.remove(0, null); fail(); } catch(DataGeometryException _exc){ @@ -827,15 +827,15 @@ // Cas limits geomAdapter_.setData(null, -1); try { - geomAdapter_.remove(0); + geomAdapter_.remove(0, null); fail(); } catch(IllegalArgumentException _exc){} // Un cas g\xE9n\xE9ral geomAdapter_.setData(zone3_, 1); - geomAdapter_.remove(4); - geomAdapter_.remove(2); - geomAdapter_.remove(1); + geomAdapter_.remove(4, null); + geomAdapter_.remove(2, null); + geomAdapter_.remove(1, null); assertEquals(2, geomAdapter_.getNbPoint()); assertEquals(0, geomAdapter_.getZ(0), tolerance); assertEquals(0, geomAdapter_.getCurv(0), tolerance); @@ -861,13 +861,13 @@ assertTrue(listener.callNewGeom); listener.callNewGeom=false; // Test dataGeometryChanged - geomAdapter_.setZ(0, 10); + geomAdapter_.setZ(0, 10, null); assertTrue(listener.callChanged); listener.callChanged=false; - geomAdapter_.setCurv(1, (geomAdapter_.getCurv(2)-geomAdapter_.getCurv(0))/2); + geomAdapter_.setCurv(1, (geomAdapter_.getCurv(2)-geomAdapter_.getCurv(0))/2, null); assertTrue(listener.callChanged); listener.callChanged=false; - geomAdapter_.setValues(0, 0, 20); + geomAdapter_.setValues(0, 0, 20, null); assertTrue(listener.callChanged); listener.callChanged=false; try { @@ -896,13 +896,13 @@ assertFalse(listener.callNewGeom); listener.callNewGeom=false; // Test dataGeometryChanged - geomAdapter_.setZ(0, 10); + geomAdapter_.setZ(0, 10, null); assertFalse(listener.callChanged); listener.callChanged=false; - geomAdapter_.setCurv(1, (geomAdapter_.getCurv(2)-geomAdapter_.getCurv(0))/2); + geomAdapter_.setCurv(1, (geomAdapter_.getCurv(2)-geomAdapter_.getCurv(0))/2, null); assertFalse(listener.callChanged); listener.callChanged=false; - geomAdapter_.setValues(0, 0, 20); + geomAdapter_.setValues(0, 0, 20, null); assertFalse(listener.callChanged); listener.callChanged=false; try { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |